use of com.ramussoft.pb.Row in project ramus by Vitaliy-Yakovchuk.
the class DFDSRole method mouseClicked.
@Override
public void mouseClicked(FloatPoint point) {
Row owner = getFunction().getOwner();
if (owner == null)
super.mouseClicked(point);
else {
DFDSFunction function = movingArea.findDFDSFunction(owner);
if (function == null)
super.mouseClicked(point);
else {
final Ordinate x = new Ordinate(Ordinate.TYPE_X);
final Ordinate y = new Ordinate(Ordinate.TYPE_Y);
final Point p = new Point(x, y);
final SectorRefactor.PerspectivePoint pp = new SectorRefactor.PerspectivePoint();
pp.point = p;
pp.setFunction(function.getFunction(), BOTTOM);
x.setPosition(function.getBounds().getX() + point.getX());
y.setPosition(getY(x.getPosition(), false, function.getBounds()));
if (movingArea.getPointChangingType() == SectorRefactor.TYPE_START) {
pp.type = SectorRefactor.TYPE_START;
movingArea.getRefactor().setPoint(pp);
movingArea.doSector();
} else if (movingArea.getPointChangingType() == SectorRefactor.TYPE_END) {
pp.type = SectorRefactor.TYPE_END;
movingArea.getRefactor().setPoint(pp);
movingArea.doSector();
}
}
}
}
use of com.ramussoft.pb.Row in project ramus by Vitaliy-Yakovchuk.
the class NFunction method getOwners.
public Row[] getOwners() {
Function function = (Function) getParentRow();
if (function.getDecompositionType() == MovingArea.DIAGRAM_TYPE_DFDS) {
if (function != null) {
List<Row> res = new ArrayList<Row>();
int c = function.getChildCount();
for (int i = 0; i < c; i++) {
Function function2 = (Function) function.getChildAt(i);
if (function2.getType() == Function.TYPE_DFDS_ROLE && this.equals(function2.getOwner())) {
Stream stream = (Stream) dataPlugin.findRowByGlobalId(function2.getLink());
if (stream != null) {
for (Row row : stream.getAdded()) if (!res.contains(row))
res.add(row);
}
}
}
Row[] rows = res.toArray(new Row[res.size()]);
RowFactory.sortByName(rows);
return rows;
}
}
String s = dataPlugin.getProperty(DataPlugin.PROPERTY_OUNERS);
if (s == null)
s = "";
final StringTokenizer st = new StringTokenizer(s);
final Vector<GlobalId> ids = new Vector<GlobalId>();
while (st.hasMoreTokens()) {
ids.add(GlobalId.convert(st.nextToken()));
}
final MatrixProjection projection = dataPlugin.getProjection(MatrixProjection.TYPE_IDEF0, "BOTTOM");
final Vector left = projection.getLeft(this);
final Vector<Row> res = new Vector<Row>();
Row[] rows;
for (int i = 0; i < left.size(); i++) {
final Stream r = (Stream) left.get(i);
if ((rows = r.getAdded()).length == 0)
addRow(res, ids, r);
else
for (final Row element2 : rows) addRow(res, ids, element2);
}
rows = res.toArray(new Row[res.size()]);
RowFactory.sortByName(rows);
return rows;
}
use of com.ramussoft.pb.Row in project ramus by Vitaliy-Yakovchuk.
the class NFunction method setName.
@Override
public void setName(String name) {
Row row = dataPlugin.findRowByGlobalId(getLink());
if (row != null)
row.setName(name);
else {
Attribute attribute = engine.getAttribute(rowSet.getQualifier().getAttributeForName());
if (attribute.getAttributeType().toString().equals("IDEF0.DFDSName")) {
DFDSName dfdsName = new DFDSName();
int r = name.indexOf('\n');
if (r >= 0) {
dfdsName.setShortName(name.substring(0, r));
dfdsName.setLongName(name.substring(r + 1));
} else {
dfdsName.setShortName(name);
dfdsName.setLongName("");
}
setNameObject(dfdsName);
} else
super.setName(name);
}
}
use of com.ramussoft.pb.Row in project ramus by Vitaliy-Yakovchuk.
the class NFunction method getFId.
private int getFId() {
Row parentRow = getParentRow();
if (parentRow == null)
return -1;
final Enumeration e = parentRow.children();
int res = 1;
while (e.hasMoreElements()) {
final NFunction function = (NFunction) e.nextElement();
if (function.getBounds().getX() < getBounds().getX())
res++;
else if (function.getBounds().getX() == getBounds().getX())
if (function.getBounds().getY() < getBounds().getY())
res++;
}
return res;
}
use of com.ramussoft.pb.Row in project ramus by Vitaliy-Yakovchuk.
the class NStream method getAdded.
/**
* Повертає масив рядків, які під’єднанані до потоку.
*
* @return Масив елементів класифікатора, під’єднані до потоку.
*/
public Row[] getAdded() {
for (Row row : getARows()) {
if (row == null) {
ArrayList<Row> list = new ArrayList<Row>(getARows().length);
for (Row row2 : getARows()) {
if (row2 != null)
list.add(row2);
}
setARows(list.toArray(new Row[list.size()]));
break;
}
}
Row[] rows = getARows();
for (int i = 0; i < rows.length; i++) rows[i].setAttachedStatus(rowStatuses[i]);
Arrays.sort(getARows());
return getARows();
}
Aggregations