use of org.eclipse.scout.rt.shared.extension.ContributionComposite in project scout.rt by eclipse.
the class AbstractFormField method initConfig.
protected void initConfig() {
setGridDataInternal(new GridData(-1, -1, 1, 1, -1, -1));
setGridDataHints(new GridData(-1, -1, 1, 1, -1, -1));
propertySupport.setPropertyBool(PROP_EMPTY, true);
m_contributionHolder = new ContributionComposite(this);
setEnabled(getConfiguredEnabled());
setDisabledStyle(getConfiguredDisabledStyle());
setVisible(getConfiguredVisible());
setMandatory(getConfiguredMandatory());
setOrder(calculateViewOrder());
setTooltipText(getConfiguredTooltipText());
setInitialLabel(getConfiguredLabel());
setLabel(getConfiguredLabel());
setLabelPosition(getConfiguredLabelPosition());
setLabelWidthInPixel(getConfiguredLabelWidthInPixel());
setLabelHorizontalAlignment(getConfiguredLabelHorizontalAlignment());
setLabelVisible(getConfiguredLabelVisible());
setStatusVisible(getConfiguredStatusVisible());
setStatusPosition(getConfiguredStatusPosition());
setCssClass((getConfiguredCssClass()));
if (getConfiguredBackgroundColor() != null) {
setBackgroundColor((getConfiguredBackgroundColor()));
}
if (getConfiguredForegroundColor() != null) {
setForegroundColor((getConfiguredForegroundColor()));
}
if (getConfiguredFont() != null) {
setFont(FontSpec.parse(getConfiguredFont()));
}
if (getConfiguredLabelBackgroundColor() != null) {
setLabelBackgroundColor((getConfiguredLabelBackgroundColor()));
}
if (getConfiguredLabelForegroundColor() != null) {
setLabelForegroundColor((getConfiguredLabelForegroundColor()));
}
if (getConfiguredLabelFont() != null) {
setLabelFont(FontSpec.parse(getConfiguredLabelFont()));
}
setFocusable(getConfiguredFocusable());
setPreventInitialFocus(getConfiguredPreventInitialFocus());
setGridDataHints(new GridData(getConfiguredGridX(), getConfiguredGridY(), getConfiguredGridW(), getConfiguredGridH(), getConfiguredGridWeightX(), getConfiguredGridWeightY(), getConfiguredGridUseUiWidth(), getConfiguredGridUseUiHeight(), getConfiguredHorizontalAlignment(), getConfiguredVerticalAlignment(), getConfiguredFillHorizontal(), getConfiguredFillVertical(), getConfiguredWidthInPixel(), getConfiguredHeightInPixel()));
setMasterRequired(getConfiguredMasterRequired());
// private listener for subtree property change events
addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent e) {
fireSubtreePropertyChange(e);
}
});
}
use of org.eclipse.scout.rt.shared.extension.ContributionComposite in project scout.rt by eclipse.
the class AbstractTree method initConfig.
protected void initConfig() {
// default enabled
m_enabled = NamedBitMaskHelper.ALL_BITS_SET;
m_eventHistory = createEventHistory();
m_eventBuffer = createEventBuffer();
m_uiFacade = BEANS.get(ModelContextProxy.class).newProxy(createUIFacade(), ModelContext.copyCurrent());
m_contributionHolder = new ContributionComposite(this);
setEnabled(true);
setTitle(getConfiguredTitle());
setIconId(getConfiguredIconId());
setDefaultIconId(getConfiguredDefaultIconId());
setCssClass(getConfiguredCssClass());
setAutoTitle(getConfiguredAutoTitle());
setCheckable(getConfiguredCheckable());
setNodeHeightHint(getConfiguredNodeHeightHint());
setMultiCheck(getConfiguredMultiCheck());
setMultiSelect(getConfiguredMultiSelect());
setAutoDiscardOnDelete(getConfiguredAutoDiscardOnDelete());
setDragEnabled(getConfiguredDragEnabled());
setDragType(getConfiguredDragType());
setDropType(getConfiguredDropType());
setDropMaximumSize(getConfiguredDropMaximumSize());
setRootNodeVisible(getConfiguredRootNodeVisible());
setRootHandlesVisible(getConfiguredRootHandlesVisible());
setScrollToSelection(getConfiguredScrollToSelection());
setSaveAndRestoreScrollbars(getConfiguredSaveAndRestoreScrollbars());
setAutoCheckChildNodes(getConfiguredAutoCheckChildNodes());
setLazyExpandingEnabled(getConfiguredLazyExpandingEnabled());
setDisplayStyle(getConfiguredDisplayStyle());
setToggleBreadcrumbStyleEnabled(getConfiguredToggleBreadcrumbStyleEnabled());
setRootNode(new AbstractTreeNode() {
});
// add Convenience observer for drag & drop callbacks and event history
addTreeListener(new TreeAdapter() {
@Override
public void treeChanged(TreeEvent e) {
// event history
IEventHistory<TreeEvent> h = getEventHistory();
if (h != null) {
h.notifyEvent(e);
}
// dnd
switch(e.getType()) {
case TreeEvent.TYPE_NODES_DRAG_REQUEST:
{
m_lastSeenDropNode = null;
if (e.getDragObject() == null) {
try {
TransferObject transferObject = interceptDrag(e.getNode());
if (transferObject == null) {
transferObject = interceptDrag(e.getNodes());
}
e.setDragObject(transferObject);
} catch (Exception t) {
LOG.error("Drag", t);
}
}
break;
}
case TreeEvent.TYPE_NODE_DROP_ACTION:
{
m_lastSeenDropNode = null;
if (e.getDropObject() != null) {
try {
interceptDrop(e.getNode(), e.getDropObject());
} catch (Exception t) {
LOG.error("Drop", t);
}
}
break;
}
case TreeEvent.TYPE_NODES_SELECTED:
{
rebuildKeyStrokesInternal();
break;
}
case TreeEvent.TYPE_NODES_CHECKED:
{
try {
interceptNodesChecked(CollectionUtility.arrayList(e.getNodes()));
} catch (RuntimeException ex) {
BEANS.get(ExceptionHandler.class).handle(ex);
}
break;
}
case TreeEvent.TYPE_NODE_DROP_TARGET_CHANGED:
{
try {
if (m_lastSeenDropNode == null || m_lastSeenDropNode != e.getNode()) {
m_lastSeenDropNode = e.getNode();
interceptDropTargetChanged(e.getNode());
}
} catch (RuntimeException ex) {
LOG.error("DropTargetChanged", ex);
}
break;
}
case TreeEvent.TYPE_DRAG_FINISHED:
{
m_lastSeenDropNode = null;
}
}
}
});
// key shortcuts
List<Class<? extends IKeyStroke>> configuredKeyStrokes = getConfiguredKeyStrokes();
List<IKeyStroke> ksList = new ArrayList<IKeyStroke>(configuredKeyStrokes.size());
for (Class<? extends IKeyStroke> keystrokeClazz : configuredKeyStrokes) {
ksList.add(ConfigurationUtility.newInnerInstance(this, keystrokeClazz));
}
// ticket 87370: add ENTER key stroke when execNodeAction has an override
if (ConfigurationUtility.isMethodOverwrite(AbstractTree.class, "execNodeAction", new Class[] { ITreeNode.class }, this.getClass())) {
ksList.add(new KeyStroke("ENTER") {
@Override
protected void execAction() {
fireNodeAction(getSelectedNode());
}
});
}
List<IKeyStroke> contributedKeyStrokes = m_contributionHolder.getContributionsByClass(IKeyStroke.class);
contributedKeyStrokes.addAll(contributedKeyStrokes);
m_baseKeyStrokes = ksList;
setKeyStrokesInternal(m_baseKeyStrokes);
// menus
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 contributing menus.", e);
}
menus.addAllOrdered(contributedMenus);
new MoveActionNodesHandler<IMenu>(menus).moveModelObjects();
TreeContextMenu contextMenu = new TreeContextMenu(this, menus.getOrderedList());
setContextMenuInternal(contextMenu);
}
use of org.eclipse.scout.rt.shared.extension.ContributionComposite in project scout.rt by eclipse.
the class AbstractCalendar method initConfig.
protected void initConfig() {
m_uiFacade = BEANS.get(ModelContextProxy.class).newProxy(new P_UIFacade(), ModelContext.copyCurrent());
m_contributionHolder = new ContributionComposite(this);
setTitle(getConfiguredTitle());
setSelectedDate(new Date());
setStartHour(getConfiguredStartHour());
setEndHour(getConfiguredEndHour());
setUseOverflowCells(getConfiguredUseOverflowCells());
setShowDisplayModeSelection(getConfiguredShowDisplayModeSelection());
setMarkNoonHour(getConfiguredMarkNoonHour());
setMarkOutOfMonthDays(getConfiguredMarkOutOfMonthDays());
// 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);
}
List<IMenu> contributedMenus = m_contributionHolder.getContributionsByClass(IMenu.class);
menus.addAllOrdered(contributedMenus);
// producers
List<Class<? extends ICalendarItemProvider>> configuredProducers = getConfiguredProducers();
List<ICalendarItemProvider> contributedProducers = m_contributionHolder.getContributionsByClass(ICalendarItemProvider.class);
List<ICalendarItemProvider> producerList = new ArrayList<ICalendarItemProvider>(configuredProducers.size() + contributedProducers.size());
for (Class<? extends ICalendarItemProvider> itemProviderClazz : configuredProducers) {
try {
ICalendarItemProvider provider = ConfigurationUtility.newInnerInstance(this, itemProviderClazz);
producerList.add(provider);
// add empty space menus to the context menu
menus.addAllOrdered(ActionUtility.getActions(provider.getMenus(), ActionUtility.createMenuFilterMenuTypes(CollectionUtility.hashSet(CalendarMenuType.EmptySpace), false)));
} catch (Exception e) {
BEANS.get(ExceptionHandler.class).handle(new ProcessingException("error creating instance of class '" + itemProviderClazz.getName() + "'.", e));
}
}
producerList.addAll(contributedProducers);
m_providers = producerList;
try {
injectMenusInternal(menus);
} catch (Exception e) {
LOG.error("error occured while dynamically contributing menus.", e);
}
new MoveActionNodesHandler<IMenu>(menus).moveModelObjects();
ICalendarContextMenu contextMenu = new CalendarContextMenu(this, menus.getOrderedList());
setContextMenu(contextMenu);
// attach change listener for item updates
for (final ICalendarItemProvider p : m_providers) {
p.addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent e) {
if (e.getPropertyName().equals(ICalendarItemProvider.PROP_ITEMS)) {
List<ICalendarItemProvider> modified = new ArrayList<ICalendarItemProvider>(1);
modified.add(p);
updateComponentsInternal(modified);
} else if (e.getPropertyName().equals(ICalendarItemProvider.PROP_LOAD_IN_PROGRESS)) {
updateLoadInProgressInternal();
}
}
});
}
}
use of org.eclipse.scout.rt.shared.extension.ContributionComposite in project scout.rt by eclipse.
the class AbstractCalendarItemProvider method initConfig.
protected void initConfig() {
m_contributionHolder = new ContributionComposite(this);
setMoveItemEnabled(getConfiguredMoveItemEnabled());
setRefreshIntervalMillis(getConfiguredRefreshIntervallMillis());
// 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);
menu.initAction();
menus.addOrdered(menu);
}
List<IMenu> contributedMenus = m_contributionHolder.getContributionsByClass(IMenu.class);
menus.addAllOrdered(contributedMenus);
try {
injectMenusInternal(menus);
} catch (Exception e) {
LOG.error("error occured while dynamically contribute menus.", e);
}
new MoveActionNodesHandler<IMenu>(menus).moveModelObjects();
m_menus = menus.getOrderedList();
}
use of org.eclipse.scout.rt.shared.extension.ContributionComposite in project scout.rt by eclipse.
the class AbstractDataModelEntity method initConfig.
protected void initConfig() {
// default visible
m_visible = NamedBitMaskHelper.ALL_BITS_SET;
m_contributionHolder = new ContributionComposite(this);
setText(getConfiguredText());
setIconId(getConfiguredIconId());
setVisible(getConfiguredVisible());
setOneToMany(getConfiguredOneToMany());
setOrder(calculateViewOrder());
List<Class<IDataModelAttribute>> configuredAttributes = getConfiguredAttributes();
List<IDataModelAttribute> contributedAttributes = m_contributionHolder.getContributionsByClass(IDataModelAttribute.class);
OrderedCollection<IDataModelAttribute> attributes = new OrderedCollection<IDataModelAttribute>();
for (Class<? extends IDataModelAttribute> c : configuredAttributes) {
attributes.addOrdered(ConfigurationUtility.newInnerInstance(this, c));
}
attributes.addAllOrdered(contributedAttributes);
injectAttributesInternal(attributes);
ExtensionUtility.moveModelObjects(attributes);
m_attributes = attributes.getOrderedList();
for (IDataModelAttribute a : m_attributes) {
if (a instanceof AbstractDataModelAttribute) {
((AbstractDataModelAttribute) a).setParentEntity(this);
}
}
// lazy create entities at point when setParentEntity is set, this is necessary to avoid cyclic loops
m_entities = new ArrayList<IDataModelEntity>();
}
Aggregations