Search in sources :

Example 1 with GlobalId

use of com.ramussoft.pb.types.GlobalId in project ramus by Vitaliy-Yakovchuk.

the class PaintSector method loadFromStreamOld.

public static PaintSector loadFromStreamOld(final InputStream stream, final int version, final MovingArea area, final DataLoader.MemoryData memoryData, final DataPlugin dataPlugin, final GlobalId newId) throws IOException {
    final PaintSector sector = new PaintSector(area);
    DataLoader.readString(stream);
    DataLoader.readString(stream);
    sector.showTilda = DataLoader.readBoolean(stream);
    final int l = DataLoader.readInteger(stream);
    sector.points = new Point[l];
    for (int i = 0; i < l; i++) {
        final Point p = new Point();
        // p.setSector(sector);
        p.loadFromStreamOld(stream, memoryData, dataPlugin);
        sector.points[i] = p;
    }
    GlobalId id = new GlobalId();
    id.loadFromStream(stream);
    if (newId != null)
        id = newId;
    sector.sector = dataPlugin.findSectorByGlobalId(id);
    if (sector.sector == null) {
        if (!DataLoader.readBoolean(stream)) {
            DataLoader.readFRectangle(stream);
            DataLoader.readBoolean(stream);
            if (sector.showTilda)
                DataLoader.readDouble(stream);
        }
        return null;
    }
    sector.sector.reload();
    sector.loadVisuals();
    sector.setSectorPoints();
    if (DataLoader.readBoolean(stream))
        sector.text = null;
    else {
        sector.createText();
        if (sector.text == null) {
            DataLoader.readFRectangle(stream);
            DataLoader.readBoolean(stream);
            if (sector.showTilda)
                DataLoader.readDouble(stream);
        } else {
            sector.text.setBounds(DataLoader.readFRectangle(stream));
            sector.text.setTransparent(DataLoader.readBoolean(stream));
            if (sector.showTilda)
                sector.tildaPos.setPos(DataLoader.readDouble(stream));
        }
    }
    return sector;
}
Also used : FloatPoint(com.dsoft.pb.types.FloatPoint) NCrosspoint(com.ramussoft.pb.data.negine.NCrosspoint) Crosspoint(com.ramussoft.pb.Crosspoint) FloatPoint(com.dsoft.pb.types.FloatPoint) GlobalId(com.ramussoft.pb.types.GlobalId)

Example 2 with GlobalId

use of com.ramussoft.pb.types.GlobalId in project ramus by Vitaliy-Yakovchuk.

the class NFunction method getOwners.

public Row[] getOwners() {
    Function function = (Function) getParentRow();
    if (function.getDecompositionType() == MovingArea.DIAGRAM_TYPE_DFDS) {
        if (function != null) {
            List<Row> res = new ArrayList<Row>();
            int c = function.getChildCount();
            for (int i = 0; i < c; i++) {
                Function function2 = (Function) function.getChildAt(i);
                if (function2.getType() == Function.TYPE_DFDS_ROLE && this.equals(function2.getOwner())) {
                    Stream stream = (Stream) dataPlugin.findRowByGlobalId(function2.getLink());
                    if (stream != null) {
                        for (Row row : stream.getAdded()) if (!res.contains(row))
                            res.add(row);
                    }
                }
            }
            Row[] rows = res.toArray(new Row[res.size()]);
            RowFactory.sortByName(rows);
            return rows;
        }
    }
    String s = dataPlugin.getProperty(DataPlugin.PROPERTY_OUNERS);
    if (s == null)
        s = "";
    final StringTokenizer st = new StringTokenizer(s);
    final Vector<GlobalId> ids = new Vector<GlobalId>();
    while (st.hasMoreTokens()) {
        ids.add(GlobalId.convert(st.nextToken()));
    }
    final MatrixProjection projection = dataPlugin.getProjection(MatrixProjection.TYPE_IDEF0, "BOTTOM");
    final Vector left = projection.getLeft(this);
    final Vector<Row> res = new Vector<Row>();
    Row[] rows;
    for (int i = 0; i < left.size(); i++) {
        final Stream r = (Stream) left.get(i);
        if ((rows = r.getAdded()).length == 0)
            addRow(res, ids, r);
        else
            for (final Row element2 : rows) addRow(res, ids, element2);
    }
    rows = res.toArray(new Row[res.size()]);
    RowFactory.sortByName(rows);
    return rows;
}
Also used : MatrixProjection(com.ramussoft.pb.MatrixProjection) ArrayList(java.util.ArrayList) GlobalId(com.ramussoft.pb.types.GlobalId) Function(com.ramussoft.pb.Function) StringTokenizer(java.util.StringTokenizer) Stream(com.ramussoft.pb.Stream) Row(com.ramussoft.pb.Row) Vector(java.util.Vector)

Example 3 with GlobalId

use of com.ramussoft.pb.types.GlobalId in project ramus by Vitaliy-Yakovchuk.

the class HTTPParser method loadRowById.

private Row loadRowById() {
    final String sId = (String) params.get("id");
    if (sId == null) {
        return null;
    }
    final GlobalId id = GlobalId.convert(sId);
    if (id == null) {
        return null;
    }
    return dataPlugin.findRowByGlobalId(id);
}
Also used : GlobalId(com.ramussoft.pb.types.GlobalId)

Example 4 with GlobalId

use of com.ramussoft.pb.types.GlobalId in project ramus by Vitaliy-Yakovchuk.

the class Point method loadFromStreamOld.

public void loadFromStreamOld(final InputStream stream, final DataLoader.MemoryData memoryData, DataPlugin dataPlugin) throws IOException {
    xOrdinate = DataLoader.readOrdinate(stream, memoryData);
    yOrdinate = DataLoader.readOrdinate(stream, memoryData);
    yOrdinate.addPoint(this);
    xOrdinate.addPoint(this);
    type = DataLoader.readInteger(stream);
    // borderTypeO =
    // old
    DataLoader.readInteger(stream);
    final GlobalId id = new GlobalId();
    // 
    id.loadFromStream(stream);
    if (id.getLocalId() >= 0) {
        // old
        // functionO = (Function)
        dataPlugin.findRowByGlobalId(id);
        // functionTypeO =
        DataLoader.readInteger(stream);
    }
}
Also used : GlobalId(com.ramussoft.pb.types.GlobalId)

Example 5 with GlobalId

use of com.ramussoft.pb.types.GlobalId in project ramus by Vitaliy-Yakovchuk.

the class HTTPParser method getSelRows.

private Row[] getSelRows(Qualifier clasificator) {
    final Enumeration e = params.keys();
    Vector v = new Vector();
    final String base = params.get("base");
    if (base == null) {
        while (e.hasMoreElements()) {
            final Object key = e.nextElement();
            final GlobalId id = GlobalId.convert(key.toString());
            if (id != null) {
                if (!params.get(key).equals("")) {
                    final Row r = dataPlugin.findRowByGlobalId(id);
                    if (r != null)
                        v.add(r);
                }
            }
        }
        final Vector rec = dataPlugin.getRecChildren(clasificator);
        final Vector res = new Vector();
        Object tmp;
        for (int i = 0; i < rec.size(); i++) if (v.indexOf(tmp = rec.get(i)) >= 0)
            res.add(tmp);
        v = res;
    } else {
        try {
            final Row row = dataPlugin.findRowByGlobalId(GlobalId.convert(base));
            v = dataPlugin.getRecChilds(row, true);
            v.insertElementAt(row, 0);
        } catch (final Exception ex) {
        }
    }
    final Row[] rows = new Row[v.size()];
    for (int i = 0; i < rows.length; i++) rows[i] = (Row) v.get(i);
    return rows;
}
Also used : Enumeration(java.util.Enumeration) Row(com.ramussoft.pb.Row) NRow(com.ramussoft.pb.data.negine.NRow) Vector(java.util.Vector) DataException(com.ramussoft.report.data.DataException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) SQLException(java.sql.SQLException) IOException(java.io.IOException) 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