use of com.ramussoft.pb.types.GlobalId in project ramus by Vitaliy-Yakovchuk.
the class IDEFPanel method loadPosiotion.
public void loadPosiotion() {
final InputStream stream = dataPlugin.getNamedData("system/idef0.pos");
closeTabs();
movingArea.clear();
if (stream == null) {
movingArea.setActiveFunction(dataPlugin.getBaseFunction());
} else {
try {
DataLoader.readInteger(stream);
final int l = DataLoader.readInteger(stream);
if (l < 0)
return;
final Tab[] tabs = new Tab[l];
for (int i = 0; i < l; i++) {
final GlobalId id = new GlobalId(stream);
tabs[i] = simpleCreateTab((Function) dataPlugin.findRowByGlobalId(id));
}
if (l > 0) {
final int s = DataLoader.readInteger(stream);
tabs[s].getPanel().add(getJScrollPane1(), BorderLayout.CENTER);
tabs[s].select();
movingArea.setActiveFunction(tabs[s].getFunction());
} else {
final GlobalId id = new GlobalId(stream);
Function active = (Function) dataPlugin.findRowByGlobalId(id);
if (active == null)
active = dataPlugin.getBaseFunction();
movingArea.setActiveFunction(active);
}
stream.close();
} catch (final IOException e) {
e.printStackTrace();
}
}
repaint();
}
Aggregations