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