Search in sources :

Example 11 with Row

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

the class DFDSRole method mouseClicked.

@Override
public void mouseClicked(FloatPoint point) {
    Row owner = getFunction().getOwner();
    if (owner == null)
        super.mouseClicked(point);
    else {
        DFDSFunction function = movingArea.findDFDSFunction(owner);
        if (function == null)
            super.mouseClicked(point);
        else {
            final Ordinate x = new Ordinate(Ordinate.TYPE_X);
            final Ordinate y = new Ordinate(Ordinate.TYPE_Y);
            final Point p = new Point(x, y);
            final SectorRefactor.PerspectivePoint pp = new SectorRefactor.PerspectivePoint();
            pp.point = p;
            pp.setFunction(function.getFunction(), BOTTOM);
            x.setPosition(function.getBounds().getX() + point.getX());
            y.setPosition(getY(x.getPosition(), false, function.getBounds()));
            if (movingArea.getPointChangingType() == SectorRefactor.TYPE_START) {
                pp.type = SectorRefactor.TYPE_START;
                movingArea.getRefactor().setPoint(pp);
                movingArea.doSector();
            } else if (movingArea.getPointChangingType() == SectorRefactor.TYPE_END) {
                pp.type = SectorRefactor.TYPE_END;
                movingArea.getRefactor().setPoint(pp);
                movingArea.doSector();
            }
        }
    }
}
Also used : SectorRefactor(com.ramussoft.pb.idef.elements.SectorRefactor) Row(com.ramussoft.pb.Row) Point(com.ramussoft.pb.idef.elements.Point) FloatPoint(com.dsoft.pb.types.FloatPoint) Ordinate(com.ramussoft.pb.idef.elements.Ordinate)

Example 12 with Row

use of com.ramussoft.pb.Row 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 13 with Row

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

the class NFunction method setName.

@Override
public void setName(String name) {
    Row row = dataPlugin.findRowByGlobalId(getLink());
    if (row != null)
        row.setName(name);
    else {
        Attribute attribute = engine.getAttribute(rowSet.getQualifier().getAttributeForName());
        if (attribute.getAttributeType().toString().equals("IDEF0.DFDSName")) {
            DFDSName dfdsName = new DFDSName();
            int r = name.indexOf('\n');
            if (r >= 0) {
                dfdsName.setShortName(name.substring(0, r));
                dfdsName.setLongName(name.substring(r + 1));
            } else {
                dfdsName.setShortName(name);
                dfdsName.setLongName("");
            }
            setNameObject(dfdsName);
        } else
            super.setName(name);
    }
}
Also used : Attribute(com.ramussoft.common.Attribute) DFDSName(com.ramussoft.idef0.attribute.DFDSName) Row(com.ramussoft.pb.Row)

Example 14 with Row

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

the class NFunction method getFId.

private int getFId() {
    Row parentRow = getParentRow();
    if (parentRow == null)
        return -1;
    final Enumeration e = parentRow.children();
    int res = 1;
    while (e.hasMoreElements()) {
        final NFunction function = (NFunction) e.nextElement();
        if (function.getBounds().getX() < getBounds().getX())
            res++;
        else if (function.getBounds().getX() == getBounds().getX())
            if (function.getBounds().getY() < getBounds().getY())
                res++;
    }
    return res;
}
Also used : Enumeration(java.util.Enumeration) Row(com.ramussoft.pb.Row)

Example 15 with Row

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

the class NStream method getAdded.

/**
 * Повертає масив рядків, які під’єднанані до потоку.
 *
 * @return Масив елементів класифікатора, під’єднані до потоку.
 */
public Row[] getAdded() {
    for (Row row : getARows()) {
        if (row == null) {
            ArrayList<Row> list = new ArrayList<Row>(getARows().length);
            for (Row row2 : getARows()) {
                if (row2 != null)
                    list.add(row2);
            }
            setARows(list.toArray(new Row[list.size()]));
            break;
        }
    }
    Row[] rows = getARows();
    for (int i = 0; i < rows.length; i++) rows[i].setAttachedStatus(rowStatuses[i]);
    Arrays.sort(getARows());
    return getARows();
}
Also used : ArrayList(java.util.ArrayList) Row(com.ramussoft.pb.Row)

Aggregations

Row (com.ramussoft.pb.Row)93 Function (com.ramussoft.pb.Function)35 Stream (com.ramussoft.pb.Stream)30 Vector (java.util.Vector)28 NFunction (com.ramussoft.pb.data.negine.NFunction)19 Sector (com.ramussoft.pb.Sector)15 NRow (com.ramussoft.pb.data.negine.NRow)14 Qualifier (com.ramussoft.common.Qualifier)13 Crosspoint (com.ramussoft.pb.Crosspoint)13 NSector (com.ramussoft.pb.data.negine.NSector)13 PaintSector (com.ramussoft.pb.idef.elements.PaintSector)12 ByteArrayOutputStream (java.io.ByteArrayOutputStream)11 ArrayList (java.util.ArrayList)11 SectorRefactor (com.ramussoft.pb.idef.elements.SectorRefactor)10 Attribute (com.ramussoft.common.Attribute)9 MovingFunction (com.ramussoft.pb.idef.visual.MovingFunction)9 IOException (java.io.IOException)9 FloatPoint (com.dsoft.pb.types.FloatPoint)8 Point (com.ramussoft.pb.idef.elements.Point)8 Element (com.ramussoft.common.Element)7