use of com.ramussoft.pb.dfds.visual.DFDSRole in project ramus by Vitaliy-Yakovchuk.
the class IDEFPanel method getEnableActions.
@Override
public String[] getEnableActions() {
if (actionDisable)
return new String[] {};
final Vector<String> res = new Vector<String>();
res.add(MainFrame.PRINT_PREVIEW);
res.add(MainFrame.PRINT);
res.add(MainFrame.PAGE_SETUP);
res.add(MainFrame.IDEF0_NET);
res.add(MainFrame.GO_TO_PARENT);
res.add(MainFrame.GO_TO_CHILD);
res.add(MainFrame.EXPORT_TO_IMAGES);
if (!isReadOnly()) {
if (movingArea.getActiveFunction() != null && movingArea.getActiveFunction().getChildCount() > 0) {
res.add(MainFrame.CENTER_ALL_SECTORS);
}
if (undoMeneger != null) {
if (undoMeneger.canUndo())
res.add(MainFrame.IDEF0_UNDO);
if (undoMeneger.canRedo())
res.add(MainFrame.IDEF0_REDO);
}
res.add(MainFrame.ADD_MODEL_TO_TEMPLATE);
res.add(MainFrame.MODEL_PROPETIES);
res.add(MainFrame.DIAGRAM_PROPETIES);
res.add(MainFrame.CREATE_LEVEL);
res.add(MainFrame.CURSOR_TOOL);
res.add(MainFrame.FUNCTION_TOOL);
res.add(MainFrame.ARROW_TOOL);
res.add(MainFrame.TILDA_TOOL);
res.add(MainFrame.TEXT_TOOL);
res.add(MainFrame.RELOAD_SAVE);
if ((movingArea.getActiveFunction()).getDecompositionType() == MovingArea.DIAGRAM_TYPE_DFD) {
res.add(MainFrame.EXTERNAL_REFERENCE_TOOL);
res.add(MainFrame.DATA_STORE_TOOL);
for (AbstractButton ab : frame.getDfdsButtons()) {
if (ab.isSelected())
movingArea.cancelAdding();
ab.setVisible(false);
}
for (AbstractButton ab : frame.getDfdButtons()) ab.setVisible(true);
} else if ((movingArea.getActiveFunction()).getDecompositionType() == MovingArea.DIAGRAM_TYPE_DFDS) {
res.add(MainFrame.DFDS_ROLE_TOOL);
for (AbstractButton ab : frame.getDfdButtons()) {
if (ab.isSelected())
movingArea.cancelAdding();
ab.setVisible(false);
}
for (AbstractButton ab : frame.getDfdsButtons()) ab.setVisible(true);
} else {
for (AbstractButton ab : frame.getDfdButtons()) {
if (ab.isSelected())
movingArea.cancelAdding();
ab.setVisible(false);
}
for (AbstractButton ab : frame.getDfdsButtons()) {
if (ab.isSelected())
movingArea.cancelAdding();
ab.setVisible(false);
}
}
if (movingArea.getActiveObject() instanceof PaintSector.Pin) {
res.add(MainFrame.SET_LOOK_FOR_CHILDRENS);
res.add(MainFrame.SET_LOOK_FOR_CHILDRENS_BACKGROUND);
res.add(MainFrame.SET_LOOK_FOR_CHILDRENS_FONT);
res.add(MainFrame.SET_LOOK_FOR_CHILDRENS_FOREGROUND);
res.add(MainFrame.REMOVE);
final PaintSector.Pin pin = (PaintSector.Pin) movingArea.getActiveObject();
if (pin.getSector().getStream() != null && pin.getSector().getStream().getAdded().length > 0)
res.add(MainFrame.ARROW_COPY_VISUAL);
if (pin.getSector().getText() != null) {
res.add(MainFrame.SET_ARROW_TILDA);
getJCheckBoxMenuItem().setSelected(pin.getSector().isShowTilda());
res.add(MainFrame.SET_TRANSPARENT_ARROW_TEXT);
getJCheckBoxMenuItem1().setSelected(pin.getSector().isTransparent());
}
if (pin.getSector().isSelStart() && pin.getSector().getStartTunnelType() != Crosspoint.TUNNEL_NONE || pin.getSector().isSelEnd() && pin.getSector().getEndTunnelType() != Crosspoint.TUNNEL_NONE)
res.add(MainFrame.TUNNEL_ARROW);
res.add(MainFrame.EDIT);
} else if (movingArea.getActiveObject() instanceof MovingFunction) {
final Function function = ((MovingFunction) movingArea.getActiveObject()).getFunction();
if (function.isRemoveable())
res.add(MainFrame.REMOVE);
addParalelActions(res, function);
res.add(MainFrame.FUNCTION_TYPE);
res.add(MainFrame.FUNCTION_TYPE_ACTION);
res.add(MainFrame.FUNCTION_TYPE_OPERATION);
res.add(MainFrame.FUNCTION_TYPE_KOMPLEX);
res.add(MainFrame.FUNCTION_TYPE_PROCESS);
res.add(MainFrame.FUNCTION_TYPE_PROCESS_PART);
res.add(MainFrame.RENAME);
res.add(MainFrame.COPY);
res.add(MainFrame.CUT);
switch(function.getType()) {
case Function.TYPE_ACTION:
{
getJRadioButtonMenuItemAction().setSelected(true);
frame.getJMenuItemAction().setSelected(true);
}
break;
case Function.TYPE_OPERATION:
{
getJRadioButtonMenuItemOperation().setSelected(true);
frame.getJMenuItemOperation().setSelected(true);
}
break;
case Function.TYPE_PROCESS_PART:
{
getJRadioButtonMenuItemProcessPart().setSelected(true);
frame.getJMenuItemProcessPart().setSelected(true);
}
break;
case Function.TYPE_PROCESS:
{
getJRadioButtonMenuItemProcess().setSelected(true);
frame.getJMenuItemProcess().setSelected(true);
}
break;
case Function.TYPE_PROCESS_KOMPLEX:
{
getJRadioButtonMenuItemKomplex().setSelected(true);
frame.getJMenuItemKomplex().setSelected(true);
}
break;
}
res.add(MainFrame.CENTER_ADDED_SECTORS);
final boolean b = !dataPlugin.getBaseFunction().equals(function.getParentRow());
if (b)
res.add(MainFrame.FUNCTION_MOVE);
res.add(MainFrame.FUNCTION_ADD_LEVEL);
res.add(MainFrame.FUNCTION_REMOVE_LEVEL);
res.add(MainFrame.SET_LOOK_FOR_CHILDRENS);
res.add(MainFrame.SET_LOOK_FOR_CHILDRENS_BACKGROUND);
res.add(MainFrame.SET_LOOK_FOR_CHILDRENS_FONT);
res.add(MainFrame.SET_LOOK_FOR_CHILDRENS_FOREGROUND);
res.add(MainFrame.FUNCTION_ADD_LEVEL);
if (function.getChildCount() > 0) {
res.add(MainFrame.OPEN_TAB);
res.add(MainFrame.OPEN_IN_INNER_TAB);
}
res.add(MainFrame.EDIT);
} else if (movingArea.getActiveObject() instanceof MovingText) {
if (!(movingArea.getActiveObject() instanceof MovingLabel))
res.add(MainFrame.EDIT);
if (movingArea.canRenameActive())
res.add(MainFrame.RENAME);
res.add(MainFrame.REMOVE);
if (movingArea.getActiveObject() instanceof DFDSRole) {
if (((DFDSRole) movingArea.getActiveObject()).getFunction().getOwner() != null)
res.add(MainFrame.BRAKE_DFDSROLE_CONNECTION);
res.add(MainFrame.DFDS_ROLE_COPY_VISUAL);
}
} else
res.add(MainFrame.PASTE);
if (getMovingArea().getMouseSelection() != null) {
if (getMovingArea().getMouseSelection().getFunctions().size() > 0) {
res.add(MainFrame.REMOVE);
res.add(MainFrame.COPY);
res.add(MainFrame.CUT);
res.add(MainFrame.VISUAL_OPTIONS);
}
if (getMovingArea().getMouseSelection().getLabels().size() > 1)
res.add(MainFrame.JOIN_ARROWS);
}
}
return res.toArray(new String[res.size()]);
}
use of com.ramussoft.pb.dfds.visual.DFDSRole in project ramus by Vitaliy-Yakovchuk.
the class MouseSelection method onProcessEndBoundsChange.
public void onProcessEndBoundsChange(MovingArea movingArea, MovingText[] panels, FloatPoint diff) {
for (MovingText text : panels) if (text instanceof DFDSRole) {
IDEF0Object idef = (IDEF0Object) text;
if (contains(text))
idef.onProcessEndBoundsChange(sectors);
}
for (MovingText text : panels) {
if (!(text instanceof DFDSRole))
if (contains(text)) {
if (text instanceof IDEF0Object) {
IDEF0Object idef = (IDEF0Object) text;
idef.onProcessEndBoundsChange(sectors);
}
}
}
List<Ordinate> xOrdinates = new ArrayList<Ordinate>();
List<Ordinate> yOrdinates = new ArrayList<Ordinate>();
for (PaintSector ps : sectors) {
for (Point point : ps.getPoints()) {
boolean has;
has = false;
for (Ordinate o : xOrdinates) if (o.getOrdinateId() == point.getXOrdinate().getOrdinateId()) {
has = true;
break;
}
if (!has)
xOrdinates.add(point.getXOrdinate());
has = false;
for (Ordinate o : yOrdinates) if (o.getOrdinateId() == point.getYOrdinate().getOrdinateId()) {
has = true;
break;
}
if (!has)
yOrdinates.add(point.getYOrdinate());
}
}
List<PaintSector> psrs = new ArrayList<PaintSector>();
psrs.addAll(sectors);
for (Ordinate xOrdinate : xOrdinates) {
xOrdinate.setPosition(xOrdinate.getPosition() + diff.getX());
for (Point point : xOrdinate.getPoints()) if (!psrs.contains(point.getSector()))
psrs.add(point.getSector());
}
for (Ordinate yOrdinate : yOrdinates) {
yOrdinate.setPosition(yOrdinate.getPosition() + diff.getY());
for (Point point : yOrdinate.getPoints()) if (!psrs.contains(point.getSector()))
psrs.add(point.getSector());
}
MemoryData data = new MemoryData();
for (PaintSector paintSector : sectors) {
Function sFunction = paintSector.getSector().getStart().getFunction();
if (sFunction != null) {
switch(paintSector.getSector().getStart().getFunctionType()) {
case MovingFunction.LEFT:
paintSector.getStartPoint().setX(sFunction.getBounds().getLeft());
break;
case MovingFunction.RIGHT:
paintSector.getStartPoint().setX(sFunction.getBounds().getRight());
break;
case MovingFunction.TOP:
paintSector.getStartPoint().setY(sFunction.getBounds().getTop());
break;
case MovingFunction.BOTTOM:
paintSector.getStartPoint().setY(sFunction.getBounds().getBottom());
break;
}
}
sFunction = paintSector.getSector().getEnd().getFunction();
if (sFunction != null) {
switch(paintSector.getSector().getEnd().getFunctionType()) {
case MovingFunction.LEFT:
paintSector.getEndPoint().setX(sFunction.getBounds().getLeft());
break;
case MovingFunction.RIGHT:
paintSector.getEndPoint().setX(sFunction.getBounds().getRight());
break;
case MovingFunction.TOP:
paintSector.getEndPoint().setY(sFunction.getBounds().getTop());
break;
case MovingFunction.BOTTOM:
paintSector.getEndPoint().setY(sFunction.getBounds().getBottom());
break;
}
}
}
for (MovingText text : panels) {
if (!(text instanceof DFDSRole))
if (contains(text)) {
if (!(text instanceof IDEF0Object)) {
text.onProcessEndBoundsChange();
if (text instanceof MovingLabel)
((MovingLabel) text).boundsCopy = text.getBounds();
}
}
}
for (PaintSector ps : psrs) PaintSector.save(ps, data, movingArea.getDataPlugin().getEngine());
}
Aggregations