Search in sources :

Example 1 with TabbedEvent

use of com.ramussoft.gui.common.event.TabbedEvent in project ramus by Vitaliy-Yakovchuk.

the class IDEF0ViewPlugin method addOpenDiagramListener.

private void addOpenDiagramListener() {
    framework.addActionListener(OPEN_DIAGRAM, new ActionListener() {

        @Override
        public void onAction(final ActionEvent event) {
            if (framework.openView(event))
                return;
            final DiagramData data = new DiagramData();
            data.openDiagram = (OpenDiagram) event.getValue();
            data.listener = new QualifierAdapter() {

                @Override
                public void qualifierDeleted(QualifierEvent event) {
                    if (event.getOldQualifier().equals(data.openDiagram.getQualifier())) {
                        data.view.close();
                    }
                }

                @Override
                public void qualifierUpdated(QualifierEvent event) {
                    if (data.openDiagram.getQualifier().equals(event.getNewQualifier())) {
                        IDEF0TabView view = (IDEF0TabView) data.view;
                        if (view.isBaseFunctionSelected()) {
                            ViewTitleEvent event2 = new ViewTitleEvent(data.view, event.getNewQualifier().getName());
                            view.titleChanged(event2);
                        }
                    }
                }
            };
            data.elementListener = new ElementAdapter() {

                @Override
                public void elementDeleted(ElementEvent event) {
                    if (((IDEF0TabView) data.view).isSelectedElementId(event.getOldElement()))
                        data.view.close();
                }
            };
            engine.addQualifierListener(data.listener);
            engine.addElementListener(data.openDiagram.getQualifier(), data.elementListener);
            data.view = new IDEF0TabView(framework, NDataPluginFactory.getDataPlugin(data.openDiagram.getQualifier(), engine, rules), data.openDiagram.getFunctionId(), frame, rules) {

                @Override
                public void close() {
                    super.close();
                    engine.removeQualifierListener(data.listener);
                    engine.removeElementListener(data.openDiagram.getQualifier(), data.elementListener);
                    TabbedEvent tEvent = new TabbedEvent(IDEF0TabbedView.IDEF0_TAB_VIEW, this);
                    tabRemoved(tEvent);
                }
            };
            TabbedEvent tEvent = new TabbedEvent(IDEF0TabbedView.IDEF0_TAB_VIEW, (TabView) data.view);
            tabCreated(tEvent);
        }
    });
}
Also used : QualifierAdapter(com.ramussoft.common.event.QualifierAdapter) ElementAdapter(com.ramussoft.common.event.ElementAdapter) ActionEvent(com.ramussoft.gui.common.event.ActionEvent) QualifierEvent(com.ramussoft.common.event.QualifierEvent) ElementEvent(com.ramussoft.common.event.ElementEvent) TabbedEvent(com.ramussoft.gui.common.event.TabbedEvent) ViewTitleEvent(com.ramussoft.gui.common.event.ViewTitleEvent) ActionListener(com.ramussoft.gui.common.event.ActionListener)

Example 2 with TabbedEvent

use of com.ramussoft.gui.common.event.TabbedEvent in project ramus by Vitaliy-Yakovchuk.

the class IDEF0ViewPlugin method addOpenStreamsViewListener.

private void addOpenStreamsViewListener() {
    framework.addActionListener(OPEN_STREAMS, new ActionListener() {

        @Override
        public void onAction(final ActionEvent event) {
            if (framework.openView(event))
                return;
            final StreamsData data = new StreamsData();
            data.view = new StreamsTabView(framework) {

                @Override
                public void close() {
                    super.close();
                    TabbedEvent tEvent = new TabbedEvent(IDEF0TabbedView.IDEF0_TAB_VIEW, this);
                    tabRemoved(tEvent);
                }
            };
            TabbedEvent tEvent = new TabbedEvent(IDEF0TabbedView.IDEF0_TAB_VIEW, (TabView) data.view);
            tabCreated(tEvent);
        }
    });
}
Also used : ActionListener(com.ramussoft.gui.common.event.ActionListener) ActionEvent(com.ramussoft.gui.common.event.ActionEvent) TabbedEvent(com.ramussoft.gui.common.event.TabbedEvent)

Example 3 with TabbedEvent

use of com.ramussoft.gui.common.event.TabbedEvent in project ramus by Vitaliy-Yakovchuk.

the class ReportViewPlugin method addOpenReportEditorListener.

private void addOpenReportEditorListener() {
    framework.addActionListener(OPEN_SCRIPT_REPORT, new ActionListener() {

        @Override
        public void onAction(final ActionEvent event) {
            if (framework.openView(event))
                return;
            final Data data = new Data();
            data.element = (Element) event.getValue();
            data.attributeListener = new ElementAttributeListener() {

                @Override
                public void attributeChanged(AttributeEvent event) {
                    Object value = event.getNewValue();
                    if ((value instanceof String) && (event.getElement().equals(data.element))) {
                        ViewTitleEvent e = new ViewTitleEvent(data.view, value.toString());
                        data.view.titleChanged(e);
                    }
                }
            };
            data.elementListener = new ElementAdapter() {

                @Override
                public void elementDeleted(ElementEvent event) {
                    if (event.getOldElement().equals(data.element)) {
                        data.view.close();
                    }
                }
            };
            engine.addElementListener(ReportPlugin.getReportsQualifier(engine), data.elementListener);
            engine.addElementAttributeListener(ReportPlugin.getReportsQualifier(engine), data.attributeListener);
            String type = (String) engine.getAttribute(data.element, ReportPlugin.getReportTypeAttribute(engine));
            if (ReportPlugin.TYPE_JSSP.equals(type))
                data.view = new ScriptReportEditorView(framework, data.element) {

                    @Override
                    public void close() {
                        super.close();
                        engine.removeElementListener(ReportPlugin.getReportsQualifier(engine), data.elementListener);
                        engine.removeElementAttributeListener(ReportPlugin.getReportsQualifier(engine), data.attributeListener);
                        TabbedEvent tEvent = new TabbedEvent("TabbedTableView", this);
                        tabRemoved(tEvent);
                    }

                    @Override
                    public String getTitle() {
                        return data.element.getName();
                    }
                };
            else if (ReportPlugin.TYPE_JSSP_DOC_BOOK.equals(type))
                data.view = new DocBookScriptReportEditorView(framework, data.element) {

                    @Override
                    public void close() {
                        super.close();
                        engine.removeElementListener(ReportPlugin.getReportsQualifier(engine), data.elementListener);
                        engine.removeElementAttributeListener(ReportPlugin.getReportsQualifier(engine), data.attributeListener);
                        TabbedEvent tEvent = new TabbedEvent("TabbedTableView", this);
                        tabRemoved(tEvent);
                    }

                    @Override
                    public String getTitle() {
                        return data.element.getName();
                    }
                };
            else
                data.view = new XMLReportEditorView(framework, data.element) {

                    @Override
                    public void close() {
                        super.close();
                        engine.removeElementListener(ReportPlugin.getReportsQualifier(engine), data.elementListener);
                        engine.removeElementAttributeListener(ReportPlugin.getReportsQualifier(engine), data.attributeListener);
                        TabbedEvent tEvent = new TabbedEvent("TabbedTableView", this);
                        tabRemoved(tEvent);
                    }

                    @Override
                    public String getTitle() {
                        return data.element.getName();
                    }
                };
            TabbedEvent tEvent = new TabbedEvent(REPORTS_TAB_VIEW, data.view);
            tabCreated(tEvent);
        }
    });
}
Also used : ElementAdapter(com.ramussoft.common.event.ElementAdapter) ActionEvent(com.ramussoft.gui.common.event.ActionEvent) ElementAttributeListener(com.ramussoft.common.event.ElementAttributeListener) Element(com.ramussoft.common.Element) ElementEvent(com.ramussoft.common.event.ElementEvent) AttributeEvent(com.ramussoft.common.event.AttributeEvent) TabbedEvent(com.ramussoft.gui.common.event.TabbedEvent) XMLReportEditorView(com.ramussoft.report.editor.XMLReportEditorView) DocBookScriptReportEditorView(com.ramussoft.report.editor.DocBookScriptReportEditorView) ViewTitleEvent(com.ramussoft.gui.common.event.ViewTitleEvent) ActionListener(com.ramussoft.gui.common.event.ActionListener) ScriptReportEditorView(com.ramussoft.report.editor.ScriptReportEditorView) DocBookScriptReportEditorView(com.ramussoft.report.editor.DocBookScriptReportEditorView)

Example 4 with TabbedEvent

use of com.ramussoft.gui.common.event.TabbedEvent in project ramus by Vitaliy-Yakovchuk.

the class ChartGUIPlugin method setFramework.

@Override
public void setFramework(GUIFramework aFramework) {
    super.setFramework(aFramework);
    framework.addActionListener(OPEN_CHART, new ActionListener() {

        @Override
        public void onAction(ActionEvent event) {
            if (framework.openView(event))
                return;
            Element element = (Element) event.getValue();
            ChartView view = new ChartView(framework, element) {

                @Override
                public void close() {
                    super.close();
                    TabbedEvent tEvent = new TabbedEvent("TabbedTableView", this);
                    tabRemoved(tEvent);
                }
            };
            TabbedEvent tEvent = new TabbedEvent(TabbedTableView.MAIN_TABBED_VIEW, view);
            tabCreated(tEvent);
        }
    });
    framework.addActionListener(OPEN_CHART_SET, new ActionListener() {

        @Override
        public void onAction(ActionEvent event) {
            if (framework.openView(event))
                return;
            Element element = (Element) event.getValue();
            ChartSetView view = new ChartSetView(framework, element) {

                @Override
                public void close() {
                    super.close();
                    TabbedEvent tEvent = new TabbedEvent("TabbedTableView", this);
                    tabRemoved(tEvent);
                }
            };
            TabbedEvent tEvent = new TabbedEvent(TabbedTableView.MAIN_TABBED_VIEW, view);
            tabCreated(tEvent);
        }
    });
}
Also used : ActionListener(com.ramussoft.gui.common.event.ActionListener) ActionEvent(com.ramussoft.gui.common.event.ActionEvent) Element(com.ramussoft.common.Element) TabbedEvent(com.ramussoft.gui.common.event.TabbedEvent)

Example 5 with TabbedEvent

use of com.ramussoft.gui.common.event.TabbedEvent in project ramus by Vitaliy-Yakovchuk.

the class ElistPlugin method setFramework.

@Override
public void setFramework(final GUIFramework framework) {
    super.setFramework(framework);
    framework.addActionListener(OPEN_ELEMENT_LIST, new ActionListener() {

        @Override
        public void onAction(final ActionEvent event) {
            if (framework.openView(event))
                return;
            Attribute attribute = (Attribute) event.getValue();
            ElistTabView elistTabView = new ElistTabView(framework, attribute) {

                @Override
                public void close() {
                    super.close();
                    TabbedEvent tEvent = new TabbedEvent("TabbedTableView", this);
                    tabRemoved(tEvent);
                }
            };
            TabbedEvent tEvent = new TabbedEvent(TabbedTableView.MAIN_TABBED_VIEW, elistTabView);
            tabCreated(tEvent);
        }
    });
    framework.addActionListener(OPEN_ELEMENT_LIST_IN_TABLE, new ActionListener() {

        @Override
        public void onAction(final ActionEvent event) {
            if (framework.openView(event))
                return;
            Attribute attribute = (Attribute) event.getValue();
            ElistTableTabView elistTabView = new ElistTableTabView(framework, attribute) {

                @Override
                public void close() {
                    super.close();
                    TabbedEvent tEvent = new TabbedEvent("TabbedTableView", this);
                    tabRemoved(tEvent);
                }
            };
            TabbedEvent tEvent = new TabbedEvent(TabbedTableView.MAIN_TABBED_VIEW, elistTabView);
            tabCreated(tEvent);
        }
    });
}
Also used : ActionListener(com.ramussoft.gui.common.event.ActionListener) Attribute(com.ramussoft.common.Attribute) ActionEvent(com.ramussoft.gui.common.event.ActionEvent) TabbedEvent(com.ramussoft.gui.common.event.TabbedEvent)

Aggregations

ActionListener (com.ramussoft.gui.common.event.ActionListener)7 TabbedEvent (com.ramussoft.gui.common.event.TabbedEvent)7 ActionEvent (com.ramussoft.gui.common.event.ActionEvent)6 ViewTitleEvent (com.ramussoft.gui.common.event.ViewTitleEvent)3 Element (com.ramussoft.common.Element)2 ElementAdapter (com.ramussoft.common.event.ElementAdapter)2 ElementEvent (com.ramussoft.common.event.ElementEvent)2 QualifierAdapter (com.ramussoft.common.event.QualifierAdapter)2 QualifierEvent (com.ramussoft.common.event.QualifierEvent)2 Attribute (com.ramussoft.common.Attribute)1 Qualifier (com.ramussoft.common.Qualifier)1 AttributeEvent (com.ramussoft.common.event.AttributeEvent)1 ElementAttributeListener (com.ramussoft.common.event.ElementAttributeListener)1 TabView (com.ramussoft.gui.common.TabView)1 TableTabView (com.ramussoft.gui.qualifier.table.TableTabView)1 DocBookScriptReportEditorView (com.ramussoft.report.editor.DocBookScriptReportEditorView)1 ScriptReportEditorView (com.ramussoft.report.editor.ScriptReportEditorView)1 XMLReportEditorView (com.ramussoft.report.editor.XMLReportEditorView)1