Search in sources :

Example 1 with ViewTitleEvent

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

the class GUIPluginFactory method initActions.

private void initActions(final String id, final View view, final DefaultCDockable dockable) {
    Action[] actions = view.getActions();
    addActions(id, view, dockable, actions);
    dockable.addSeparator();
    view.addViewTitleListener(new ViewTitleListener() {

        @Override
        public void titleChanged(ViewTitleEvent event) {
            dockable.setTitleText(event.getNewTitle());
        }
    });
    view.addActionChangeListener(new ActionChangeAdapter() {

        @Override
        public void actionsAdded(ActionChangeEvent event) {
            Action[] actions = event.getActions();
            List<Action> list = new ArrayList<Action>();
            for (Action a : actions) {
                if (a != null)
                    list.add(a);
            }
            addActions(id, view, dockable, list.toArray(new Action[list.size()]));
        }

        @Override
        public void actionsRemoved(ActionChangeEvent event) {
            for (Action a : event.getActions()) if (a != null) {
                CDecorateableAction button = actionButtons.remove(a);
                if (button != null)
                    dockable.removeAction(button);
            }
        }
    });
}
Also used : AbstractAction(javax.swing.AbstractAction) CDecorateableAction(bibliothek.gui.dock.common.intern.action.CDecorateableAction) Action(javax.swing.Action) ViewTitleEvent(com.ramussoft.gui.common.event.ViewTitleEvent) ActionChangeAdapter(com.ramussoft.gui.common.event.ActionChangeAdapter) ActionChangeEvent(com.ramussoft.gui.common.event.ActionChangeEvent) CDecorateableAction(bibliothek.gui.dock.common.intern.action.CDecorateableAction) List(java.util.List) ArrayList(java.util.ArrayList) ViewTitleListener(com.ramussoft.gui.common.event.ViewTitleListener)

Example 2 with ViewTitleEvent

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

the class SimleGUIPluginFactory method initActions.

private void initActions(final String id, final View view, final DFrame dockable) {
    Action[] actions = view.getActions();
    addActions(id, view, dockable, actions);
    dockable.addSeparator();
    view.addViewTitleListener(new ViewTitleListener() {

        @Override
        public void titleChanged(ViewTitleEvent event) {
            dockable.setTitleText(event.getNewTitle());
        }
    });
    view.addActionChangeListener(new ActionChangeAdapter() {

        @Override
        public void actionsAdded(ActionChangeEvent event) {
            Action[] actions = event.getActions();
            List<Action> list = new ArrayList<Action>();
            for (Action a : actions) {
                if (a != null)
                    list.add(a);
            }
            addActions(id, view, dockable, list.toArray(new Action[list.size()]));
        }

        @Override
        public void actionsRemoved(ActionChangeEvent event) {
            for (Action a : event.getActions()) if (a != null) {
                dockable.removeAction(a);
            }
        }
    });
}
Also used : AbstractAction(javax.swing.AbstractAction) Action(javax.swing.Action) ViewTitleEvent(com.ramussoft.gui.common.event.ViewTitleEvent) ActionChangeAdapter(com.ramussoft.gui.common.event.ActionChangeAdapter) ActionChangeEvent(com.ramussoft.gui.common.event.ActionChangeEvent) List(java.util.List) ArrayList(java.util.ArrayList) ViewTitleListener(com.ramussoft.gui.common.event.ViewTitleListener)

Example 3 with ViewTitleEvent

use of com.ramussoft.gui.common.event.ViewTitleEvent 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 4 with ViewTitleEvent

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

the class ChartView method titleChanged.

protected void titleChanged(String newTitle) {
    ViewTitleEvent event2 = new ViewTitleEvent(ChartView.this, newTitle);
    titleChanged(event2);
    reload();
}
Also used : ViewTitleEvent(com.ramussoft.gui.common.event.ViewTitleEvent)

Example 5 with ViewTitleEvent

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

the class IDEF0TabView method refreshTitle.

private void refreshTitle() {
    ViewTitleEvent titleEvent = new ViewTitleEvent(IDEF0TabView.this, getTitle());
    titleChanged(titleEvent);
}
Also used : ViewTitleEvent(com.ramussoft.gui.common.event.ViewTitleEvent)

Aggregations

ViewTitleEvent (com.ramussoft.gui.common.event.ViewTitleEvent)7 ActionEvent (com.ramussoft.gui.common.event.ActionEvent)3 ActionListener (com.ramussoft.gui.common.event.ActionListener)3 TabbedEvent (com.ramussoft.gui.common.event.TabbedEvent)3 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 ActionChangeAdapter (com.ramussoft.gui.common.event.ActionChangeAdapter)2 ActionChangeEvent (com.ramussoft.gui.common.event.ActionChangeEvent)2 ViewTitleListener (com.ramussoft.gui.common.event.ViewTitleListener)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 AbstractAction (javax.swing.AbstractAction)2 Action (javax.swing.Action)2 CDecorateableAction (bibliothek.gui.dock.common.intern.action.CDecorateableAction)1 Element (com.ramussoft.common.Element)1 Qualifier (com.ramussoft.common.Qualifier)1 AttributeEvent (com.ramussoft.common.event.AttributeEvent)1 ElementAttributeListener (com.ramussoft.common.event.ElementAttributeListener)1