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);
}
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;
}
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);
}
}
Aggregations