Search in sources :

Example 6 with Row

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

the class SelectClasificatorDialog method showModal.

public Row showModal() {
    result = null;
    rows = Main.dataPlugin.getRecChilds(null, false);
    list.setModel(new AbstractListModel() {

        public Object getElementAt(final int index) {
            final Row row = rows.get(index);
            return row.getKod() + " " + row.getName();
        }

        public int getSize() {
            if (rows == null)
                return 0;
            return rows.size();
        }
    });
    if (active != null) {
        final int index = rows.indexOf(active);
        list.setSelectedIndex(index);
    }
    setVisible(true);
    rows = null;
    Options.saveOptions("selectCLDialog", this);
    return result;
}
Also used : Row(com.ramussoft.pb.Row) AbstractListModel(javax.swing.AbstractListModel)

Example 7 with Row

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

the class MatrixProjectionOuner method getRight.

public Vector<Row> getRight(final Row row) {
    final Vector<Row> res = new Vector<Row>();
    final Vector<Row> functions = Main.dataPlugin.getRecChilds(Main.dataPlugin.getBaseFunction(), true);
    for (int i = 0; i < functions.size(); i++) {
        final Function f = (Function) functions.get(i);
        final Row o = f.getOwner();
        if (o.equals(row))
            res.add(f);
    }
    return res;
}
Also used : Function(com.ramussoft.pb.Function) Row(com.ramussoft.pb.Row) Vector(java.util.Vector)

Example 8 with Row

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

the class MatrixProjectionStreams method getLeft.

/**
 * Повертає набір класифікаторів пов’язаних з елементом класифікатора
 * потоків, атрибут обов’язково має бети елементом класифікатора потоків.
 */
public Vector<Row> getLeft(final Row row) {
    final Row[] rows = ((Stream) row).getAdded();
    final Vector<Row> res = new Vector<Row>();
    for (final Row row2 : rows) res.add(row2);
    return res;
}
Also used : Stream(com.ramussoft.pb.Stream) Row(com.ramussoft.pb.Row) Vector(java.util.Vector)

Example 9 with Row

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

the class External method paint.

@Override
public void paint(Graphics2D g) {
    DataPlugin dp = ((NFunction) function).getDataPlugin();
    Row row = dp.findRowByGlobalId(function.getLink());
    final class PolygonD extends Polygon {

        /**
         */
        private static final long serialVersionUID = 113232131232134523L;

        public void addPoint(final double x, final double y) {
            super.addPoint((int) x, (int) y);
        }
    }
    g.setColor(function.getBackground());
    final Rectangle2D rect = movingArea.getBounds(getBounds());
    g.fill(rect);
    g.setFont(function.getFont());
    paintText(g);
    if (row != null) {
        String string = row.getKod();
        movingArea.paintText(g, string, new FRectangle(myBounds.getX() + 3, myBounds.getY() + 3, myBounds.getWidth() - 3, myBounds.getHeight() - 3), Line.LEFT_ALIGN, 0, true);
    }
    paintBorder(g);
    final Stroke tmp = g.getStroke();
    g.draw(rect);
    double zm = movingArea.getIDoubleOrdinate(2);
    g.draw(new Line2D.Double(rect.getX() + zm, rect.getY() + zm, rect.getX() + zm, rect.getY() + rect.getHeight()));
    g.draw(new Line2D.Double(rect.getX() + zm, rect.getY() + zm, rect.getX() + rect.getWidth(), rect.getY() + zm));
    if (paintTriangle >= 0) {
        final PolygonD p = new PolygonD();
        p.addPoint(rect.getX() + rect.getWidth() / 2, rect.getY() + rect.getHeight() / 2);
        int standoff2 = -1;
        switch(paintTriangle) {
            case Point.TOP:
                {
                    p.addPoint(rect.getX() + standoff2, rect.getY() + standoff2);
                    p.addPoint(rect.getX() + rect.getWidth() - standoff2, rect.getY() + standoff2);
                }
                break;
            case Point.LEFT:
                {
                    p.addPoint(rect.getX() + standoff2, rect.getY() + standoff2);
                    p.addPoint(rect.getX() + standoff2, rect.getY() + rect.getHeight() - standoff2);
                }
                break;
            case Point.RIGHT:
                {
                    p.addPoint(rect.getX() + rect.getWidth() - standoff2, rect.getY() + standoff2);
                    p.addPoint(rect.getX() + rect.getWidth() - standoff2, rect.getY() + rect.getHeight() - standoff2);
                }
                break;
            case Point.BOTTOM:
                {
                    p.addPoint(rect.getX() + standoff2, rect.getY() + rect.getHeight() - standoff2);
                    p.addPoint(rect.getX() + rect.getWidth() - standoff2, rect.getY() + rect.getHeight() - standoff2);
                }
                break;
        }
        if (p.npoints > 1)
            g.fillPolygon(p);
    }
    g.setStroke(tmp);
}
Also used : Stroke(java.awt.Stroke) NFunction(com.ramussoft.pb.data.negine.NFunction) Rectangle2D(java.awt.geom.Rectangle2D) Line2D(java.awt.geom.Line2D) Point(com.ramussoft.pb.idef.elements.Point) FRectangle(com.dsoft.pb.types.FRectangle) Row(com.ramussoft.pb.Row) DataPlugin(com.ramussoft.pb.DataPlugin) Polygon(java.awt.Polygon)

Example 10 with Row

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

the class DFDSRole method onProcessEndBoundsChange.

@Override
public void onProcessEndBoundsChange() {
    final FRectangle oldRec = function.getBounds();
    myBounds.setTransformNetBounds(MovingArea.NET_LENGTH);
    List<PaintSector> list = new ArrayList<PaintSector>();
    final SectorRefactor refactor = movingArea.getRefactor();
    boolean sectorReplaced = false;
    DFDSFunction function = movingArea.findDFDSFunction(this.getBounds());
    if (function != null) {
        getFunction().setOwner(function.getFunction());
        for (int i = 0; i < refactor.getSectorsCount(); i++) {
            PaintSector ps = refactor.getSector(i);
            Function function2 = ps.getSector().getStart().getFunction();
            if (function2 != null && function2.equals(this.function)) {
                replaceFunction(ps.getSector().getStart(), ps, list, ps.getStartPoint(), ps.getSector().getStart().getFunctionType(), function, refactor, true);
            }
            Function function3 = ps.getSector().getEnd().getFunction();
            if (function3 != null && function3.equals(this.function)) {
                replaceFunction(ps.getSector().getEnd(), ps, list, ps.getEndPoint(), ps.getSector().getEnd().getFunctionType(), function, refactor, false);
            }
        }
        function.justifyRoles();
        sectorReplaced = true;
    } else {
        if (this.getFunction().getOwner() != null) {
            DFDSFunction function2 = movingArea.findDFDSFunction(this.getFunction().getOwner());
            if (function2 != null && function2.getBounds().intersects(this.getBounds())) {
                function2.justifyRoles();
            } else
                this.function.setBounds(new FRectangle(myBounds));
        } else
            this.function.setBounds(new FRectangle(myBounds));
    }
    MemoryData memoryData = new MemoryData();
    if (!sectorReplaced) {
        for (int i = 0; i < refactor.getSectorsCount(); i++) {
            PaintSector sector = refactor.getSector(i);
            setAddedSectorPos(oldRec, sector, list);
        }
    }
    for (PaintSector ps : list) PaintSector.save(ps, memoryData, ((NFunction) this.function).getEngine());
    long l = this.function.getLink();
    if (l >= 0l) {
        Stream stream = (Stream) movingArea.getDataPlugin().findRowByGlobalId(l);
        if (stream != null) {
            Row[] rows = stream.getAdded();
            RectangleVisualOptions ops = new RectangleVisualOptions();
            ops.bounds = this.function.getBounds();
            ops.background = this.function.getBackground();
            ops.font = this.function.getFont();
            ops.foreground = this.function.getForeground();
            for (Row row : rows) if (row != null) {
                IDEF0Plugin.setDefaultRectangleVisualOptions(movingArea.getDataPlugin().getEngine(), row.getElement(), ops);
            }
        }
    }
}
Also used : SectorRefactor(com.ramussoft.pb.idef.elements.SectorRefactor) NFunction(com.ramussoft.pb.data.negine.NFunction) ArrayList(java.util.ArrayList) Point(com.ramussoft.pb.idef.elements.Point) FloatPoint(com.dsoft.pb.types.FloatPoint) Function(com.ramussoft.pb.Function) NFunction(com.ramussoft.pb.data.negine.NFunction) FRectangle(com.dsoft.pb.types.FRectangle) PaintSector(com.ramussoft.pb.idef.elements.PaintSector) MemoryData(com.dsoft.utils.DataLoader.MemoryData) RectangleVisualOptions(com.ramussoft.idef0.attribute.RectangleVisualOptions) Stream(com.ramussoft.pb.Stream) 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