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());
}
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;
}
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);
}
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();
}
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);
}
}
}
}
});
}
Aggregations