use of org.eclipse.scout.rt.platform.util.collection.OrderedCollection in project scout.rt by eclipse.
the class AbstractGroupBox method initMenus.
private void initMenus() {
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) {
menus.addOrdered(ConfigurationUtility.newInnerInstance(this, menuClazz));
}
menus.addAllOrdered(contributedMenus);
injectMenusInternal(menus);
new MoveActionNodesHandler<IMenu>(menus).moveModelObjects();
// set container on menus
IFormFieldContextMenu contextMenu = new FormFieldContextMenu<IGroupBox>(this, menus.getOrderedList());
contextMenu.setContainerInternal(this);
setContextMenu(contextMenu);
}
use of org.eclipse.scout.rt.platform.util.collection.OrderedCollection in project scout.rt by eclipse.
the class AbstractImageField method initConfig.
@Override
protected void initConfig() {
m_uiFacade = BEANS.get(ModelContextProxy.class).newProxy(new P_UIFacade(), ModelContext.copyCurrent());
super.initConfig();
setImageTransform(new AffineTransformSpec());
setAutoFit(getConfiguredAutoFit());
setImageId(getConfiguredImageId());
setPanDelta(getConfiguredPanDelta());
setRotateDelta(getConfiguredRotateDelta());
setZoomDelta(getConfiguredZoomDelta());
setDragType(getConfiguredDragType());
setDropType(getConfiguredDropType());
setDropMaximumSize(getConfiguredDropMaximumSize());
setScrollBarEnabled(getConfiguredScrollBarEnabled());
// 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) {
menus.addOrdered(ConfigurationUtility.newInnerInstance(this, menuClazz));
}
menus.addAllOrdered(contributedMenus);
injectMenusInternal(menus);
new MoveActionNodesHandler<IMenu>(menus).moveModelObjects();
m_contextMenu = new FormFieldContextMenu<IImageField>(this, menus.getOrderedList());
m_contextMenu.setContainerInternal(this);
}
use of org.eclipse.scout.rt.platform.util.collection.OrderedCollection in project scout.rt by eclipse.
the class AbstractWizard method initConfig.
@SuppressWarnings({ "boxing", "unchecked" })
protected void initConfig() {
setTitle(getConfiguredTitle());
setSubTitle(getConfiguredSubTitle());
// initially the wizard is in state "closed"
setClosedInternal(true);
setCloseTypeInternal(CloseType.Unknown);
m_contributionHolder = new ContributionComposite(AbstractWizard.this);
m_containerForm = createContainerForm();
Assertions.assertNotNull(m_containerForm, "Missing container form");
interceptDecorateContainerForm();
// Run the initialization on behalf of the container form.
runWithinContainerForm(new IRunnable() {
@Override
public void run() throws Exception {
// steps
List<Class<? extends IWizardStep<? extends IForm>>> configuredAvailableSteps = getConfiguredAvailableSteps();
List<IWizardStep> contributedSteps = m_contributionHolder.getContributionsByClass(IWizardStep.class);
OrderedCollection<IWizardStep<? extends IForm>> steps = new OrderedCollection<IWizardStep<? extends IForm>>();
for (Class<? extends IWizardStep<? extends IForm>> element : configuredAvailableSteps) {
IWizardStep<? extends IForm> step = ConfigurationUtility.newInnerInstance(AbstractWizard.this, element);
steps.addOrdered(step);
}
for (IWizardStep step : contributedSteps) {
steps.addOrdered(step);
}
injectStepsInternal(steps);
ExtensionUtility.moveModelObjects(steps);
setAvailableSteps(steps.getOrderedList());
// add listener to listen on any field in active form
m_anyFieldChangeListener = new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent e) {
try {
interceptAnyFieldChanged((IFormField) e.getSource());
} catch (RuntimeException | PlatformError t) {
LOG.error("{} {}={}", e.getSource(), e.getPropertyName(), e.getNewValue(), t);
}
}
};
propertySupport.addPropertyChangeListener(PROP_WIZARD_FORM, new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent e) {
IForm oldForm = (IForm) e.getOldValue();
IForm newForm = (IForm) e.getNewValue();
if (oldForm != null) {
oldForm.getRootGroupBox().removeSubtreePropertyChangeListener(IValueField.PROP_VALUE, m_anyFieldChangeListener);
}
if (newForm != null) {
newForm.getRootGroupBox().addSubtreePropertyChangeListener(IValueField.PROP_VALUE, m_anyFieldChangeListener);
}
}
});
}
});
}
use of org.eclipse.scout.rt.platform.util.collection.OrderedCollection in project scout.rt by eclipse.
the class AbstractCompositeField method initConfig.
@Override
protected void initConfig() {
/*
* call first super initConfig to ensure all properties are applied to the field only.
* E.g. setEnabled(getConfiguredEnabled()) would enable/disable all children when called
* after field creation. -> all fields would have the enabled state of the MainBox.
*/
m_fields = CollectionUtility.emptyArrayList();
m_movedFormFieldsByClass = new HashMap<Class<? extends IFormField>, IFormField>();
m_fieldPropertyChangeListener = new P_FieldPropertyChangeListener();
super.initConfig();
// prepare injected fields
DefaultFormFieldInjection injectedFields = null;
List<Class<IFormField>> declaredFields = getConfiguredFields();
List<Class<? extends IFormField>> configuredFields = new ArrayList<Class<? extends IFormField>>(declaredFields.size());
for (Class<? extends IFormField> clazz : declaredFields) {
if (ConfigurationUtility.isInjectFieldAnnotationPresent(clazz)) {
if (injectedFields == null) {
injectedFields = new DefaultFormFieldInjection(this);
}
injectedFields.addField(clazz);
} else {
configuredFields.add(clazz);
}
}
try {
List<IFormField> contributedFields = m_contributionHolder.getContributionsByClass(IFormField.class);
if (injectedFields != null) {
FormFieldInjectionThreadLocal.push(injectedFields);
}
FormFieldInjectionThreadLocal.pushContainerField(this);
filterFieldsInternal(configuredFields);
// create instances
OrderedCollection<IFormField> fields = new OrderedCollection<IFormField>();
for (Class<? extends IFormField> clazz : configuredFields) {
IFormField f = ConfigurationUtility.newInnerInstance(this, clazz);
fields.addOrdered(f);
}
// handle contributions
fields.addAllOrdered(contributedFields);
injectFieldsInternal(fields);
// connect
for (IFormField f : fields) {
f.setParentFieldInternal(this);
}
m_fields = fields.getOrderedList();
// attach a proxy controller to each child field in the group for: visible, saveNeeded
for (IFormField f : m_fields) {
f.addPropertyChangeListener(m_fieldPropertyChangeListener);
}
} finally {
if (injectedFields != null) {
m_formFieldReplacements = injectedFields.getReplacementMapping();
FormFieldInjectionThreadLocal.pop(injectedFields);
}
FormFieldInjectionThreadLocal.popContainerField(this);
}
handleFieldVisibilityChanged();
}
use of org.eclipse.scout.rt.platform.util.collection.OrderedCollection in project scout.rt by eclipse.
the class AbstractButton method initConfig.
@Override
protected void initConfig() {
super.initConfig();
setSystemType(getConfiguredSystemType());
setDisplayStyleInternal(getConfiguredDisplayStyle());
setProcessButton(getConfiguredProcessButton());
setDefaultButton(getConfiguredDefaultButton());
setIconId(getConfiguredIconId());
setKeyStroke(getConfiguredKeyStroke());
setKeyStrokeScopeClass(getConfiguredKeyStrokeScopeClass());
setPreventDoubleClick(getConfiguredPreventDoubleClick());
// 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;
menu = ConfigurationUtility.newInnerInstance(this, menuClazz);
menus.addOrdered(menu);
}
menus.addAllOrdered(contributedMenus);
injectMenusInternal(menus);
new MoveActionNodesHandler<IMenu>(menus).moveModelObjects();
IContextMenu contextMenu = new FormFieldContextMenu<IButton>(this, menus.getOrderedList());
contextMenu.setContainerInternal(this);
setContextMenu(contextMenu);
}
Aggregations