use of com.ramussoft.pb.Function in project ramus by Vitaliy-Yakovchuk.
the class IDEF0Object method getDFDSKod.
public static String getDFDSKod(Row function, DataPlugin dataPlugin) {
if (function instanceof Function) {
ProjectOptions po = ((Function) function).getProjectOptions();
String letter = po.getDeligate().getModelLetter();
if (letter != null && letter.length() > 0) {
if (function.equals(dataPlugin.getBaseFunction()))
return letter + "-0";
return letter + getRecDFDSKod(function, true);
}
}
if (function.equals(dataPlugin.getBaseFunction()))
return "A-0";
return "A-" + getRecDFDSKod(function, true);
}
use of com.ramussoft.pb.Function 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.Function in project ramus by Vitaliy-Yakovchuk.
the class IDEFPanel method openTab.
private void openTab() {
Function function = ((MovingFunction) movingArea.getActiveObject()).getFunction();
openTab(function);
}
use of com.ramussoft.pb.Function in project ramus by Vitaliy-Yakovchuk.
the class IDEFPanel method loadFromParalel.
protected void loadFromParalel() {
try {
final JFileChooser chooser = frame.getChooser();
if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
final Function f = ((MovingFunction) movingArea.getActiveObject()).getFunction();
frame.propertyChange(MChangeListener.FILE_SAVE, null);
dataPlugin.loadFromParalel(dataPlugin, f, chooser.getSelectedFile(), framework);
frame.propertyChange(MChangeListener.FILE_LOAD, null);
}
} catch (final IOException e) {
JOptionPane.showMessageDialog(framework.getMainFrame(), e.getLocalizedMessage());
}
}
use of com.ramussoft.pb.Function in project ramus by Vitaliy-Yakovchuk.
the class MouseSelection method paint.
public void paint(Graphics2D g, MovingArea area) {
for (Function function : functions) {
FRectangle rectangle = function.getBounds();
g.drawRect(area.getIntOrdinate(rectangle.getX() - 2), area.getIntOrdinate(rectangle.getY() - 2), area.getIntOrdinate(rectangle.getWidth() + 4), area.getIntOrdinate(rectangle.getHeight() + 4));
}
for (MovingLabel label : labels) {
FRectangle rectangle = label.boundsCopy;
g.drawRect(area.getIntOrdinate(rectangle.getX() - 2), area.getIntOrdinate(rectangle.getY() - 2), area.getIntOrdinate(rectangle.getWidth() + 4), area.getIntOrdinate(rectangle.getHeight() + 4));
}
}
Aggregations