use of com.ramussoft.pb.Row in project ramus by Vitaliy-Yakovchuk.
the class SelectOwner method setFunction.
public void setFunction(final Function function) {
final Row[] rows = function.getOwners();
final Row ouner = function.getOwner();
listModel = new DefaultListModel();
jList.setModel(listModel);
boolean b = true;
if (ouner != null) {
for (final Row row : rows) if (ouner.equals(row)) {
b = false;
break;
}
}
if (b && ouner != null) {
listModel.addElement("<html><body><i><b>" + ouner.getName() + "</b></i></body></html>");
} else
listModel.addElement("<html><body><i><b>" + ResourceLoader.getString("owner_not_selected") + "</b></i></body></html>");
jList.setSelectedIndex(0);
for (final Row element : rows) listModel.addElement(element);
if (!b)
jList.setSelectedValue(ouner, true);
}
use of com.ramussoft.pb.Row in project ramus by Vitaliy-Yakovchuk.
the class SectorRefactor method copyOwnersFrom.
public static void copyOwnersFrom(Function function, DataPlugin dataPlugin) {
Function par = (Function) function.getParent();
HashSet<Function> roles = new HashSet<Function>();
for (Sector sector : par.getSectors()) {
if (function.equals(sector.getStart().getFunction())) {
getEndRoles(sector, roles, dataPlugin);
getStartRoles(sector, roles, dataPlugin);
}
if (function.equals(sector.getEnd().getFunction())) {
getStartRoles(sector, roles, dataPlugin);
getEndRoles(sector, roles, dataPlugin);
}
}
Stream stream = (Stream) dataPlugin.findRowByGlobalId(function.getLink());
Row[] owners;
if (stream == null)
owners = new Row[] {};
else
owners = stream.getAdded();
for (Function function2 : roles) {
stream = (Stream) dataPlugin.findRowByGlobalId(function2.getLink());
if (stream == null) {
if (owners.length > 0) {
stream = (Stream) dataPlugin.createRow(dataPlugin.getBaseStream(), true);
function2.setLink(stream.getElement().getId());
stream.setRows(owners);
}
} else {
stream.setRows(owners);
}
}
}
use of com.ramussoft.pb.Row in project ramus by Vitaliy-Yakovchuk.
the class ModelParaleler method getRow.
private Row getRow(long rowId) {
if (rowId < 0l)
return null;
Row res = rowHash.get(rowId);
if (res == null) {
Row row = fromDataPlugin.findRowByGlobalId(rowId);
if (row == null)
return null;
Element element = row.getElement();
if (!((row instanceof Stream) && (element.getName().equals("")))) {
Qualifier qualifier = null;
if (row instanceof Stream)
qualifier = IDEF0Plugin.getBaseStreamQualifier(toEngine);
else
qualifier = getQualifier(element.getQualifierId());
if (qualifier == null)
return null;
Element e = toEngine.getElement(element.getName(), qualifier.getId());
if (e != null) {
Row row2 = toDataPlugin.findRowByGlobalId(e.getId());
rowHash.put(e.getId(), row2);
return row2;
}
}
Row r = fromDataPlugin.findRowByGlobalId(rowId);
res = toDataPlugin.createRow(getRow(getParentRow(r)), r.isElement());
rowHash.put(r.getElement().getId(), res);
copyRow(r, res);
}
return res;
}
use of com.ramussoft.pb.Row in project ramus by Vitaliy-Yakovchuk.
the class ModelParaleler method copyFunction.
private void copyFunction(NFunction source, NFunction destination) {
long l = source.getLink();
if (l >= 0) {
Row row = fromDataPlugin.findRowByGlobalId(l);
if (row != null) {
l = getRow(row).getElement().getId();
destination.setLink(l);
}
}
// destination.setName(source.getName());
if (source.getChildCount() > 0) {
SectorRefactor sr = new SectorRefactor(new MovingArea(fromDataPlugin));
sr.loadFromFunction(source, false);
for (int i = 0; i < sr.getSectorsCount(); i++) {
PaintSector ps = sr.getSector(i);
PaintSector.save(ps, new DataLoader.MemoryData(), fromEngine);
ps.setSector(getSector((NSector) ps.getSector()));
}
// sr.saveToFunction(destination);
}
}
use of com.ramussoft.pb.Row in project ramus by Vitaliy-Yakovchuk.
the class ModelParaleler method getRow.
private Row getRow(Row r) {
if (r == fromDataPlugin.getBaseStream())
return toDataPlugin.getBaseStream();
if ((r == null) || (r.getElement() == null))
return null;
if ((function != null) && (r.equals(function.getParentRow())))
return base;
Row res = rowHash.get(r.getElement().getId());
if (res == null) {
res = toDataPlugin.createRow(getRow(getParentRow(r)), r.isElement());
rowHash.put(r.getElement().getId(), res);
if (r instanceof Function)
if (!(res instanceof Function))
System.out.println(res);
copyRow(r, res);
}
return res;
}
Aggregations