Search in sources :

Example 61 with Function

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

the class DFDObjectDialog method showModal.

public void showModal(DFDObject object) {
    this.object = object;
    Function function = object.getFunction();
    setLink(dataPlugin.findRowByGlobalId(function.getLink()));
    fontChooser.setSelFont(function.getFont());
    backgroundColorChooser.setColor(function.getBackground());
    foregroundColorChooser.setColor(function.getForeground());
    setVisible(true);
    Options.saveOptions(this);
}
Also used : Function(com.ramussoft.pb.Function)

Example 62 with Function

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

the class DFDObjectDialog method onOk.

@Override
protected void onOk() {
    Journaled journaled = (Journaled) dataPlugin.getEngine();
    journaled.startUserTransaction();
    Function function = object.getFunction();
    function.setFont(fontChooser.getSelFont());
    function.setBackground(backgroundColorChooser.getColor());
    function.setForeground(foregroundColorChooser.getColor());
    if (link == null) {
        function.setLink(-1);
    } else
        function.setLink(link.getElement().getId());
    Function p = (Function) function.getParent();
    List<Sector> list = new ArrayList<Sector>();
    if (p != null) {
        for (Sector sector : p.getSectors()) {
            if (function.equals(sector.getStart().getFunction()))
                list.add(sector);
            else if (function.equals(sector.getEnd().getFunction()))
                list.add(sector);
        }
    }
    for (Sector sector : list) SectorRefactor.fixOwners(sector, dataPlugin);
    journaled.commitUserTransaction();
    super.onOk();
}
Also used : Journaled(com.ramussoft.common.journal.Journaled) Function(com.ramussoft.pb.Function) Sector(com.ramussoft.pb.Sector) ArrayList(java.util.ArrayList)

Example 63 with Function

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

the class DFDSFunction method getTriangle.

@Override
protected int getTriangle(FloatPoint point) {
    int changingState = getMovingArea().getPointChangingType();
    PaintSector activeSector = getMovingArea().getRefactor().getSector();
    if (activeSector != null)
        if (changingState == SectorRefactor.TYPE_START) {
            Crosspoint crosspoint = activeSector.getStart();
            Function function2 = activeSector.getSector().getStart().getFunction();
            if (crosspoint != null && crosspoint.isDLevel() && function2 != null && function2.getType() == Function.TYPE_DFDS_ROLE)
                return -1;
        } else if (changingState == SectorRefactor.TYPE_END) {
            Crosspoint crosspoint = activeSector.getEnd();
            Function function2 = activeSector.getSector().getEnd().getFunction();
            if (crosspoint != null && crosspoint.isDLevel() && function2 != null && function2.getType() == Function.TYPE_DFDS_ROLE)
                return -1;
        }
    return super.getTriangle(point);
}
Also used : DFDFunction(com.ramussoft.pb.dfd.visual.DFDFunction) NFunction(com.ramussoft.pb.data.negine.NFunction) Function(com.ramussoft.pb.Function) PaintSector(com.ramussoft.pb.idef.elements.PaintSector) Crosspoint(com.ramussoft.pb.Crosspoint) FloatPoint(com.dsoft.pb.types.FloatPoint) Crosspoint(com.ramussoft.pb.Crosspoint)

Example 64 with Function

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

the class IDLImporter method addBox.

private void addBox() {
    Function function = getFunction(box.reference);
    int i = box.name.indexOf('}');
    box.function = function;
    function.setName(box.name.substring(i + 1));
    StringTokenizer st = new StringTokenizer(box.name.substring(1, i), " ");
    if (st.hasMoreTokens())
        st.nextElement();
    if (st.hasMoreTokens()) {
        try {
            int font = Integer.parseInt(st.nextToken());
            function.setFont(uniqueFonts.get(font));
        } catch (Exception e) {
        }
    }
    if (st.hasMoreTokens())
        st.nextElement();
    Color bColor = null;
    Color fColor = null;
    if (st.hasMoreTokens()) {
        int tmp = Integer.parseInt(st.nextToken());
        if (tmp < COLORS.length) {
            fColor = COLORS[tmp];
        }
        tmp = Integer.parseInt(st.nextToken());
        if (tmp < COLORS.length) {
            bColor = COLORS[tmp];
        }
    }
    if (bColor != null)
        function.setBackground(bColor);
    if (fColor != null)
        function.setForeground(fColor);
    StringTokenizer tokenizer = new StringTokenizer(box.coordinates, " ()");
    FloatPoint p1 = toPoint(tokenizer.nextToken());
    FloatPoint p2 = toPoint(tokenizer.nextToken());
    FRectangle rectangle = new FRectangle(p1.getX(), p2.getY(), p2.getX() - p1.getX(), p1.getY() - p2.getY());
    function.setBounds(rectangle);
    Status status = new Status(Status.WORKING, "");
    function.setStatus(status);
}
Also used : Status(com.dsoft.pb.idef.elements.Status) Function(com.ramussoft.pb.Function) MovingFunction(com.ramussoft.pb.idef.visual.MovingFunction) StringTokenizer(java.util.StringTokenizer) FloatPoint(com.dsoft.pb.types.FloatPoint) FRectangle(com.dsoft.pb.types.FRectangle) Color(java.awt.Color) Crosspoint(com.ramussoft.pb.Crosspoint) Point(com.ramussoft.pb.idef.elements.Point) FloatPoint(com.dsoft.pb.types.FloatPoint) IOException(java.io.IOException)

Example 65 with Function

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

the class MatrixProjectionIDEF0 method getRight.

/**
 * Метод повертає вектор елементів класифікатора робіт, які пов’язані з
 * відповідним елементом класифікатора потоків.
 */
public Vector<Row> getRight(final Row row) {
    final Vector<Row> res = new Vector<Row>();
    final Object[] functions = Main.dataPlugin.getRecChilds(Main.dataPlugin.getBaseFunction(), true).toArray();
    Function f;
    Function pF;
    final Vector<Function> softs = new Vector<Function>();
    if (functionType == -1)
        for (final Object element : functions) {
            boolean add = true;
            f = (Function) element;
            for (int j = 0; j < softs.size(); j++) if (Main.dataPlugin.isParent(f, softs.get(j))) {
                res.add(f);
                add = false;
                break;
            }
            if (add) {
                pF = (Function) f.getParentRow();
                final Vector v = pF.getSectors();
                for (int j = 0; j < v.size(); j++) {
                    final Sector sector = (Sector) v.get(j);
                    if (type == MovingPanel.RIGHT) {
                        if (f.equals(sector.getStart().getFunction()) && row.equals(sector.getStream())) {
                            res.add(f);
                            if (sector.getStart().getTunnelSoft() == Crosspoint.TUNNEL_SOFT)
                                softs.add(f);
                        }
                    } else {
                        if (sector.getEnd().getFunctionType() == type && f.equals(sector.getStart().getFunction()) && row.equals(sector.getStream())) {
                            res.add(f);
                            if (sector.getEnd().getTunnelSoft() == Crosspoint.TUNNEL_SOFT)
                                softs.add(f);
                        }
                    }
                }
            }
        }
    else
        for (final Object element : functions) {
            f = (Function) element;
            if (f.getType() == functionType) {
                boolean add = true;
                for (int j = 0; j < softs.size(); j++) if (Main.dataPlugin.isParent(f, softs.get(j))) {
                    res.add(f);
                    add = false;
                    break;
                }
                if (add) {
                    pF = (Function) f.getParentRow();
                    final Vector v = pF.getSectors();
                    for (int j = 0; j < v.size(); j++) {
                        final Sector sector = (Sector) v.get(j);
                        if (type == MovingPanel.RIGHT) {
                            if (f.equals(sector.getStart().getFunction()) && row.equals(sector.getStream())) {
                                res.add(f);
                                if (sector.getStart().getTunnelSoft() == Crosspoint.TUNNEL_SOFT)
                                    softs.add(f);
                            }
                        } else {
                            if (sector.getEnd().getFunctionType() == type && f.equals(sector.getStart().getFunction()) && row.equals(sector.getStream())) {
                                res.add(f);
                                if (sector.getEnd().getTunnelSoft() == Crosspoint.TUNNEL_SOFT)
                                    softs.add(f);
                            }
                        }
                    }
                }
            }
        }
    return res;
}
Also used : Function(com.ramussoft.pb.Function) Sector(com.ramussoft.pb.Sector) Row(com.ramussoft.pb.Row) Vector(java.util.Vector)

Aggregations

Function (com.ramussoft.pb.Function)96 NFunction (com.ramussoft.pb.data.negine.NFunction)50 Row (com.ramussoft.pb.Row)36 MovingFunction (com.ramussoft.pb.idef.visual.MovingFunction)27 Crosspoint (com.ramussoft.pb.Crosspoint)25 Sector (com.ramussoft.pb.Sector)25 Stream (com.ramussoft.pb.Stream)21 FloatPoint (com.dsoft.pb.types.FloatPoint)19 NSector (com.ramussoft.pb.data.negine.NSector)18 DFDFunction (com.ramussoft.pb.dfd.visual.DFDFunction)17 PaintSector (com.ramussoft.pb.idef.elements.PaintSector)17 Vector (java.util.Vector)17 DFDSFunction (com.ramussoft.pb.dfds.visual.DFDSFunction)15 IOException (java.io.IOException)13 FRectangle (com.dsoft.pb.types.FRectangle)11 Point (com.ramussoft.pb.idef.elements.Point)11 SectorRefactor (com.ramussoft.pb.idef.elements.SectorRefactor)10 ByteArrayOutputStream (java.io.ByteArrayOutputStream)10 ArrayList (java.util.ArrayList)10 MovingArea (com.ramussoft.pb.idef.visual.MovingArea)8