Search in sources :

Example 1 with VisualPanel

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

the class IDEF0TabView method createPanel.

private void createPanel() {
    panel = new IDEFPanel(frame, dataPlugin, framework, rules, this) {

        @Override
        protected void openTab(Function function) {
            long id = -1;
            if (!dataPlugin.getBaseFunction().equals(function))
                id = function.getElement().getId();
            OpenDiagram openDiagram = new OpenDiagram(dataPlugin.getBaseFunctionQualifier(), id);
            framework.propertyChanged(IDEF0ViewPlugin.OPEN_DIAGRAM, openDiagram);
        }

        @Override
        protected void setActiveObject(Object activeObject) {
            super.setActiveObject(activeObject);
            if (activeObject instanceof VisualPanel)
                activaPanel = (VisualPanel) activeObject;
            if ((Boolean) handAction.getValue(AbstractAction.SELECTED_KEY)) {
                if (activeObject instanceof VisualPanel) {
                    panel.getMovingArea().startUserTransaction();
                    VisualPanel vpanel = (VisualPanel) activeObject;
                    visualCopy.copyTo(vpanel);
                    panel.getMovingArea().commitUserTransaction();
                }
            } else {
                if (activeObject instanceof VisualPanel) {
                    handAction.setEnabled(true);
                } else
                    handAction.setEnabled(false);
            }
        }
    };
    Function function = null;
    if (functionId >= 0) {
        function = (Function) dataPlugin.findRowByGlobalId(functionId);
    }
    if (function == null)
        function = dataPlugin.getBaseFunction();
    panel.getMovingArea().setActiveFunction(function);
    panel.getMovingArea().addActiveFunctionListener(new ActiveFunctionListener() {

        @Override
        public void activeFunctionChanged(ActiveFunctionEvent event) {
            refreshTitle();
            framework.propertyChanged(ACTIVE_DIAGRAM, getOpenAction());
        }
    });
    frame.getActiveZoom().doZoom(panel);
    basePanel.add(panel, BorderLayout.CENTER);
}
Also used : IDEFPanel(com.ramussoft.pb.idef.frames.IDEFPanel) Function(com.ramussoft.pb.Function) VisualPanel(com.ramussoft.pb.idef.visual.VisualPanel) ActiveFunctionListener(com.ramussoft.pb.idef.visual.event.ActiveFunctionListener) ActiveFunctionEvent(com.ramussoft.pb.idef.visual.event.ActiveFunctionEvent)

Aggregations

Function (com.ramussoft.pb.Function)1 IDEFPanel (com.ramussoft.pb.idef.frames.IDEFPanel)1 VisualPanel (com.ramussoft.pb.idef.visual.VisualPanel)1 ActiveFunctionEvent (com.ramussoft.pb.idef.visual.event.ActiveFunctionEvent)1 ActiveFunctionListener (com.ramussoft.pb.idef.visual.event.ActiveFunctionListener)1