Search in sources :

Example 1 with MovingFunction

use of com.ramussoft.pb.idef.visual.MovingFunction in project ramus by Vitaliy-Yakovchuk.

the class IDEFPanel method setFunctionType.

protected void setFunctionType(final int type) {
    movingArea.startUserTransaction();
    final Function function = ((MovingFunction) movingArea.getActiveObject()).getFunction();
    function.setType(type);
    switch(type) {
        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;
    }
    movingArea.commitUserTransaction();
}
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)

Example 2 with MovingFunction

use of com.ramussoft.pb.idef.visual.MovingFunction in project ramus by Vitaliy-Yakovchuk.

the class IDEFPanel method createParalel.

protected void createParalel() {
    Function f = null;
    try {
        final JFileChooser chooser = new JFileChooser() {

            @Override
            public void approveSelection() {
                if (getSelectedFile().exists()) {
                    if (JOptionPane.showConfirmDialog(framework.getMainFrame(), GlobalResourcesManager.getString("File.Exists"), UIManager.getString("OptionPane.messageDialogTitle"), JOptionPane.YES_NO_OPTION) != JOptionPane.YES_OPTION)
                        return;
                }
                super.approveSelection();
            }
        };
        if (chooser.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) {
            final CreateParalelDialog dialog = new CreateParalelDialog(framework.getMainFrame());
            if (!dialog.showModal())
                return;
            String fn = chooser.getSelectedFile().getAbsolutePath();
            if (!fn.substring(fn.length() - frame.FILE_EX.length()).equalsIgnoreCase(frame.FILE_EX))
                fn += frame.FILE_EX;
            f = ((MovingFunction) movingArea.getActiveObject()).getFunction();
            frame.propertyChange(MChangeListener.FILE_SAVE, null);
            boolean clearFunctionalBlock = dialog.getCreateParalelModel().isClearFunctionalBlock();
            dataPlugin.createParalel(f, dialog.getCreateParalelModel().isCopyAllRows(), clearFunctionalBlock, new File(fn), framework, movingArea.getDataPlugin());
            movingArea.repaint();
        }
    } catch (final IOException e) {
        JOptionPane.showMessageDialog(framework.getMainFrame(), e.getLocalizedMessage());
    }
}
Also used : NFunction(com.ramussoft.pb.data.negine.NFunction) Function(com.ramussoft.pb.Function) MovingFunction(com.ramussoft.pb.idef.visual.MovingFunction) JFileChooser(javax.swing.JFileChooser) IOException(java.io.IOException) File(java.io.File)

Example 3 with MovingFunction

use of com.ramussoft.pb.idef.visual.MovingFunction 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)

Example 4 with MovingFunction

use of com.ramussoft.pb.idef.visual.MovingFunction in project ramus by Vitaliy-Yakovchuk.

the class IDEFPanel method openTab.

private void openTab() {
    Function function = ((MovingFunction) movingArea.getActiveObject()).getFunction();
    openTab(function);
}
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)

Example 5 with MovingFunction

use of com.ramussoft.pb.idef.visual.MovingFunction 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());
    }
}
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) JFileChooser(javax.swing.JFileChooser) IOException(java.io.IOException)

Aggregations

Function (com.ramussoft.pb.Function)5 NFunction (com.ramussoft.pb.data.negine.NFunction)5 MovingFunction (com.ramussoft.pb.idef.visual.MovingFunction)5 IOException (java.io.IOException)2 JFileChooser (javax.swing.JFileChooser)2 DFDSRole (com.ramussoft.pb.dfds.visual.DFDSRole)1 PaintSector (com.ramussoft.pb.idef.elements.PaintSector)1 MovingLabel (com.ramussoft.pb.idef.visual.MovingLabel)1 MovingText (com.ramussoft.pb.idef.visual.MovingText)1 File (java.io.File)1 Vector (java.util.Vector)1 AbstractButton (javax.swing.AbstractButton)1