Search in sources :

Example 1 with ActionChangeAdapter

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

use of com.ramussoft.gui.common.event.ActionChangeAdapter 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)

Aggregations

ActionChangeAdapter (com.ramussoft.gui.common.event.ActionChangeAdapter)2 ActionChangeEvent (com.ramussoft.gui.common.event.ActionChangeEvent)2 ViewTitleEvent (com.ramussoft.gui.common.event.ViewTitleEvent)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