Search in sources :

Example 6 with MovingLabel

use of com.ramussoft.pb.idef.visual.MovingLabel 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()]);
}
Also used : MovingFunction(com.ramussoft.pb.idef.visual.MovingFunction) NFunction(com.ramussoft.pb.data.negine.NFunction) Function(com.ramussoft.pb.Function) MovingFunction(com.ramussoft.pb.idef.visual.MovingFunction) DFDSRole(com.ramussoft.pb.dfds.visual.DFDSRole) AbstractButton(javax.swing.AbstractButton) MovingLabel(com.ramussoft.pb.idef.visual.MovingLabel) PaintSector(com.ramussoft.pb.idef.elements.PaintSector) Vector(java.util.Vector) MovingText(com.ramussoft.pb.idef.visual.MovingText)

Aggregations

MovingLabel (com.ramussoft.pb.idef.visual.MovingLabel)6 PaintSector (com.ramussoft.pb.idef.elements.PaintSector)5 Function (com.ramussoft.pb.Function)4 SectorRefactor (com.ramussoft.pb.idef.elements.SectorRefactor)4 FloatPoint (com.dsoft.pb.types.FloatPoint)3 Crosspoint (com.ramussoft.pb.Crosspoint)3 MovingArea (com.ramussoft.pb.idef.visual.MovingArea)3 MovingFunction (com.ramussoft.pb.idef.visual.MovingFunction)3 Vector (java.util.Vector)3 Row (com.ramussoft.pb.Row)2 Stream (com.ramussoft.pb.Stream)2 Pin (com.ramussoft.pb.idef.elements.PaintSector.Pin)2 Point (com.ramussoft.pb.idef.elements.Point)2 MovingText (com.ramussoft.pb.idef.visual.MovingText)2 Dimension (java.awt.Dimension)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 IOException (java.io.IOException)2 Sector (com.ramussoft.pb.Sector)1 NFunction (com.ramussoft.pb.data.negine.NFunction)1 NRow (com.ramussoft.pb.data.negine.NRow)1