Search in sources :

Example 91 with Row

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

the class IDEFPanel method setFunctionMenu.

public void setFunctionMenu(final Function function) {
    getJMenu1().removeAll();
    final Row[] rows = function.getOwners();
    class OwnerSetter implements ActionListener {

        private final Function function;

        private final Row owner;

        public OwnerSetter(final Function function, final Row owner) {
            super();
            this.function = function;
            this.owner = owner;
        }

        public void actionPerformed(final ActionEvent e) {
            movingArea.startUserTransaction();
            function.setOwner(owner);
            movingArea.commitUserTransaction();
        }
    }
    boolean parentOuner = false;
    Row ouner = function.getOwner();
    Row pOuner = null;
    if (function.getParent() != null)
        pOuner = ((Function) function.getParentRow()).getOwner();
    parentOuner = ((ouner != null) && (ouner.equals(pOuner)));
    JRadioButtonMenuItem item;
    if (pOuner != null) {
        item = new JRadioButtonMenuItem("<html><body><i><b>" + pOuner.getName() + "</b></i></body></html>");
    } else
        item = new JRadioButtonMenuItem("<html><body><i><b>" + ResourceLoader.getString("owner_not_selected") + "</b></i></body></html>");
    item.addActionListener(new OwnerSetter(function, null));
    if (ouner == null || parentOuner)
        item.setSelected(true);
    jMenu1.add(item);
    if (rows.length > 0)
        jMenu1.addSeparator();
    for (final Row element : rows) if (!element.equals(pOuner)) {
        item = new JRadioButtonMenuItem(element.getName());
        item.addActionListener(new OwnerSetter(function, element));
        if (ouner != null && ouner.equals(element))
            item.setSelected(true);
        jMenu1.add(item);
    }
    jMenu1.addSeparator();
    final JMenuItem mi = new JMenuItem(ResourceLoader.getString("Owners.Clasificators"));
    mi.addActionListener(new ActionListener() {

        public void actionPerformed(final ActionEvent e) {
            getOwnerClasificatorsDialog().showModal();
        }
    });
    jMenu1.add(mi);
}
Also used : NFunction(com.ramussoft.pb.data.negine.NFunction) Function(com.ramussoft.pb.Function) MovingFunction(com.ramussoft.pb.idef.visual.MovingFunction) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) JRadioButtonMenuItem(javax.swing.JRadioButtonMenuItem) Row(com.ramussoft.pb.Row) JMenuItem(javax.swing.JMenuItem)

Example 92 with Row

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

the class SectorRowsEditor method findStreamByName.

public Stream findStreamByName(final String name) {
    if ("".equals(name))
        return null;
    final Vector<Row> streams = dataPlugin.getRecChilds(dataPlugin.getBaseStream(), true);
    final int l = streams.size();
    for (int i = 0; i < l; i++) {
        final Stream s = (Stream) streams.get(i);
        if (name.equals(s.getName()) && !s.isEmptyName())
            return s;
    }
    return null;
}
Also used : Stream(com.ramussoft.pb.Stream) Row(com.ramussoft.pb.Row)

Example 93 with Row

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

the class SectorRowsEditor method addRows.

private void addRows() {
    final SelectRowDialog r = getRowSelectDialog();
    List<Row> list = r.showModal();
    if (r.isOk()) {
        addRows(list);
        List<Row> rows = selectRowPanel.getSelected();
        rows.addAll(list);
        selectRowPanel.selectRows((List) rows);
    }
}
Also used : Row(com.ramussoft.pb.Row) SelectRowDialog(com.ramussoft.pb.frames.SelectRowDialog)

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