Search in sources :

Example 1 with OrderedCollection

use of org.eclipse.scout.rt.platform.util.collection.OrderedCollection in project scout.rt by eclipse.

the class AbstractActionNode method initConfig.

@Override
@SuppressWarnings("unchecked")
protected void initConfig() {
    super.initConfig();
    // menus
    List<Class<? extends IActionNode>> configuredChildActions = getConfiguredChildActions();
    OrderedCollection<T> actionNodes = new OrderedCollection<T>();
    for (Class<? extends IActionNode> a : configuredChildActions) {
        IActionNode node = ConfigurationUtility.newInnerInstance(this, a);
        node.setParent(this);
        actionNodes.addOrdered((T) node);
    }
    m_contributionHolder = new ContributionComposite(this);
    List<IActionNode> contributedActions = m_contributionHolder.getContributionsByClass(IActionNode.class);
    for (IActionNode n : contributedActions) {
        actionNodes.addOrdered((T) n);
    }
    try {
        injectActionNodesInternal(actionNodes);
    } catch (RuntimeException e) {
        BEANS.get(ExceptionHandler.class).handle(e);
    }
    // add
    setChildActions(actionNodes.getOrderedList());
}
Also used : ContributionComposite(org.eclipse.scout.rt.shared.extension.ContributionComposite) OrderedCollection(org.eclipse.scout.rt.platform.util.collection.OrderedCollection)

Example 2 with OrderedCollection

use of org.eclipse.scout.rt.platform.util.collection.OrderedCollection in project scout.rt by eclipse.

the class AbstractTreeNode method lazyCreateAndInitializeMenus.

protected List<IMenu> lazyCreateAndInitializeMenus() {
    List<Class<? extends IMenu>> declaredMenus = getDeclaredMenus();
    List<IMenu> contributedMenus = m_contributionHolder.getContributionsByClass(IMenu.class);
    OrderedCollection<IMenu> menus = new OrderedCollection<IMenu>();
    for (Class<? extends IMenu> menuClazz : declaredMenus) {
        IMenu menu = ConfigurationUtility.newInnerInstance(this, menuClazz);
        menus.addOrdered(menu);
    }
    try {
        injectMenusInternal(menus);
    } catch (Exception e) {
        LOG.error("error occured while dynamically contribute menus.", e);
    }
    menus.addAllOrdered(contributedMenus);
    new MoveActionNodesHandler<IMenu>(menus).moveModelObjects();
    m_menus = menus.getOrderedList();
    // init menus
    try {
        ActionUtility.initActions(m_menus);
    } catch (RuntimeException e) {
        LOG.error("could not initialize actions.", e);
    }
    return m_menus;
}
Also used : IMenu(org.eclipse.scout.rt.client.ui.action.menu.IMenu) OrderedCollection(org.eclipse.scout.rt.platform.util.collection.OrderedCollection)

Example 3 with OrderedCollection

use of org.eclipse.scout.rt.platform.util.collection.OrderedCollection in project scout.rt by eclipse.

the class AbstractTable method initMenus.

protected void initMenus() {
    List<Class<? extends IMenu>> ma = getDeclaredMenus();
    OrderedCollection<IMenu> menus = new OrderedCollection<IMenu>();
    Map<Class<?>, Class<? extends IMenu>> replacements = ConfigurationUtility.getReplacementMapping(ma);
    if (!replacements.isEmpty()) {
        m_menuReplacementMapping = replacements;
    }
    for (Class<? extends IMenu> clazz : ma) {
        IMenu menu = ConfigurationUtility.newInnerInstance(this, clazz);
        menus.addOrdered(menu);
    }
    List<IMenu> contributedMenus = m_contributionHolder.getContributionsByClass(IMenu.class);
    menus.addAllOrdered(contributedMenus);
    injectMenusInternal(menus);
    addHeaderMenus(menus);
    // set container on menus
    for (IMenu menu : menus) {
        menu.setContainerInternal(this);
    }
    new MoveActionNodesHandler<IMenu>(menus).moveModelObjects();
    ITableContextMenu contextMenu = new TableContextMenu(this, menus.getOrderedList());
    setContextMenu(contextMenu);
}
Also used : ITableContextMenu(org.eclipse.scout.rt.client.ui.action.menu.root.ITableContextMenu) IMenu(org.eclipse.scout.rt.client.ui.action.menu.IMenu) OrderedCollection(org.eclipse.scout.rt.platform.util.collection.OrderedCollection) ITableContextMenu(org.eclipse.scout.rt.client.ui.action.menu.root.ITableContextMenu) TableContextMenu(org.eclipse.scout.rt.client.ui.action.menu.root.internal.TableContextMenu)

Example 4 with OrderedCollection

use of org.eclipse.scout.rt.platform.util.collection.OrderedCollection in project scout.rt by eclipse.

the class AbstractTable method createTableControlsInternal.

private void createTableControlsInternal() {
    List<Class<? extends ITableControl>> tcs = getConfiguredTableControls();
    OrderedCollection<ITableControl> tableControls = new OrderedCollection<ITableControl>();
    for (Class<? extends ITableControl> clazz : tcs) {
        ITableControl tableControl = ConfigurationUtility.newInnerInstance(this, clazz);
        ((AbstractTableControl) tableControl).setTable(this);
        tableControls.addOrdered(tableControl);
    }
    m_tableControls = tableControls.getOrderedList();
}
Also used : AbstractTableControl(org.eclipse.scout.rt.client.ui.basic.table.controls.AbstractTableControl) ITableControl(org.eclipse.scout.rt.client.ui.basic.table.controls.ITableControl) OrderedCollection(org.eclipse.scout.rt.platform.util.collection.OrderedCollection)

Example 5 with OrderedCollection

use of org.eclipse.scout.rt.platform.util.collection.OrderedCollection in project scout.rt by eclipse.

the class AbstractPlanner method initConfig.

protected void initConfig() {
    m_listenerList = new EventListenerList();
    m_activityMapUIFacade = createUIFacade();
    // 
    setLabel(getConfiguredLabel());
    setAvailableDisplayModes(getConfiguredAvailableDisplayModes());
    setDisplayMode(getConfiguredDisplayMode());
    setDisplayModeOptions(new HashMap<Integer, DisplayModeOptions>());
    initDisplayModeOptions();
    setHeaderVisible(getConfiguredHeaderVisible());
    setSelectionMode(getConfiguredSelectionMode());
    setActivitySelectable(getConfiguredActivitySelectable());
    setMinimumActivityDuration(getConfiguredMinimumActivityDuration());
    // menus
    List<Class<? extends IMenu>> declaredMenus = getDeclaredMenus();
    OrderedCollection<IMenu> menus = new OrderedCollection<IMenu>();
    for (Class<? extends IMenu> menuClazz : declaredMenus) {
        IMenu menu = ConfigurationUtility.newInnerInstance(this, menuClazz);
        menus.addOrdered(menu);
    }
    m_contributionHolder = new ContributionComposite(this);
    List<IMenu> contributedMenus = m_contributionHolder.getContributionsByClass(IMenu.class);
    menus.addAllOrdered(contributedMenus);
    try {
        injectMenusInternal(menus);
    } catch (Exception e) {
        LOG.error("error occured while dynamically contributing menus.", e);
    }
    new MoveActionNodesHandler<IMenu>(menus).moveModelObjects();
    IPlannerContextMenu contextMenu = new PlannerContextMenu(this, menus.getOrderedList());
    setContextMenu(contextMenu);
    // local property observer
    addPlannerListener(new PlannerAdapter() {

        @Override
        @SuppressWarnings("unchecked")
        public void plannerChanged(PlannerEvent e) {
            if (e.getType() == PlannerEvent.TYPE_RESOURCES_SELECTED) {
                List<Resource<RI>> resources = (List<Resource<RI>>) e.getResources();
                try {
                    interceptResourcesSelected(resources);
                } catch (Exception t) {
                    BEANS.get(ExceptionHandler.class).handle(t);
                }
            }
        }
    });
    addPropertyChangeListener(new PropertyChangeListener() {

        @Override
        @SuppressWarnings("unchecked")
        public void propertyChange(PropertyChangeEvent e) {
            if (e.getPropertyName().equals(PROP_DISPLAY_MODE)) {
                try {
                    interceptDisplayModeChanged((int) e.getNewValue());
                } catch (Exception t) {
                    BEANS.get(ExceptionHandler.class).handle(t);
                }
            } else if (e.getPropertyName().equals(PROP_VIEW_RANGE)) {
                try {
                    interceptViewRangeChanged((Range) e.getNewValue());
                } catch (Exception t) {
                    BEANS.get(ExceptionHandler.class).handle(t);
                }
            } else if (e.getPropertyName().equals(PROP_SELECTION_RANGE)) {
                try {
                    interceptSelectionRangeChanged((Range) e.getNewValue());
                } catch (Exception t) {
                    BEANS.get(ExceptionHandler.class).handle(t);
                }
            } else if (e.getPropertyName().equals(PROP_SELECTED_ACTIVITY)) {
                Activity<RI, AI> cell = (Activity<RI, AI>) e.getNewValue();
                if (cell != null) {
                    try {
                        interceptActivitySelected(cell);
                    } catch (Exception t) {
                        BEANS.get(ExceptionHandler.class).handle(t);
                    }
                }
            }
        }
    });
}
Also used : PropertyChangeListener(java.beans.PropertyChangeListener) ExceptionHandler(org.eclipse.scout.rt.platform.exception.ExceptionHandler) EventListenerList(org.eclipse.scout.rt.platform.util.EventListenerList) ArrayList(java.util.ArrayList) EventListenerList(org.eclipse.scout.rt.platform.util.EventListenerList) List(java.util.List) IMenu(org.eclipse.scout.rt.client.ui.action.menu.IMenu) PropertyChangeEvent(java.beans.PropertyChangeEvent) IPlannerContextMenu(org.eclipse.scout.rt.client.ui.action.menu.root.IPlannerContextMenu) ContributionComposite(org.eclipse.scout.rt.shared.extension.ContributionComposite) OrderedCollection(org.eclipse.scout.rt.platform.util.collection.OrderedCollection) Range(org.eclipse.scout.rt.platform.util.Range) PlannerContextMenu(org.eclipse.scout.rt.client.ui.action.menu.root.internal.PlannerContextMenu) IPlannerContextMenu(org.eclipse.scout.rt.client.ui.action.menu.root.IPlannerContextMenu)

Aggregations

OrderedCollection (org.eclipse.scout.rt.platform.util.collection.OrderedCollection)23 IMenu (org.eclipse.scout.rt.client.ui.action.menu.IMenu)12 ContributionComposite (org.eclipse.scout.rt.shared.extension.ContributionComposite)8 ArrayList (java.util.ArrayList)7 ProcessingException (org.eclipse.scout.rt.platform.exception.ProcessingException)5 PropertyChangeEvent (java.beans.PropertyChangeEvent)4 PropertyChangeListener (java.beans.PropertyChangeListener)4 AbstractTable (org.eclipse.scout.rt.client.ui.basic.table.AbstractTable)4 ITable (org.eclipse.scout.rt.client.ui.basic.table.ITable)4 ITableRow (org.eclipse.scout.rt.client.ui.basic.table.ITableRow)4 IProposalField (org.eclipse.scout.rt.client.ui.form.fields.smartfield.IProposalField)4 EventListenerList (org.eclipse.scout.rt.platform.util.EventListenerList)4 Test (org.junit.Test)4 List (java.util.List)3 FormFieldContextMenu (org.eclipse.scout.rt.client.ui.action.menu.root.internal.FormFieldContextMenu)3 IEventHistory (org.eclipse.scout.rt.client.ui.IEventHistory)2 IKeyStroke (org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke)2 IFormFieldContextMenu (org.eclipse.scout.rt.client.ui.action.menu.root.IFormFieldContextMenu)2 VetoException (org.eclipse.scout.rt.platform.exception.VetoException)2 IOException (java.io.IOException)1