use of org.eclipse.scout.rt.client.ui.action.menu.root.IPlannerContextMenu 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