Search in sources :

Example 6 with GlobalId

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();
}
Also used : NFunction(com.ramussoft.pb.data.negine.NFunction) Function(com.ramussoft.pb.Function) MovingFunction(com.ramussoft.pb.idef.visual.MovingFunction) InputStream(java.io.InputStream) IOException(java.io.IOException) Crosspoint(com.ramussoft.pb.Crosspoint) GlobalId(com.ramussoft.pb.types.GlobalId)

Aggregations

GlobalId (com.ramussoft.pb.types.GlobalId)6 Crosspoint (com.ramussoft.pb.Crosspoint)2 Function (com.ramussoft.pb.Function)2 Row (com.ramussoft.pb.Row)2 IOException (java.io.IOException)2 Vector (java.util.Vector)2 FloatPoint (com.dsoft.pb.types.FloatPoint)1 MatrixProjection (com.ramussoft.pb.MatrixProjection)1 Stream (com.ramussoft.pb.Stream)1 NCrosspoint (com.ramussoft.pb.data.negine.NCrosspoint)1 NFunction (com.ramussoft.pb.data.negine.NFunction)1 NRow (com.ramussoft.pb.data.negine.NRow)1 MovingFunction (com.ramussoft.pb.idef.visual.MovingFunction)1 DataException (com.ramussoft.report.data.DataException)1 InputStream (java.io.InputStream)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 SQLException (java.sql.SQLException)1 ArrayList (java.util.ArrayList)1 Enumeration (java.util.Enumeration)1 StringTokenizer (java.util.StringTokenizer)1