use of org.eclipse.scout.rt.client.ui.form.IForm in project scout.rt by eclipse.
the class AbstractDesktop method setPageSearchForm.
public void setPageSearchForm(IForm f, boolean force) {
if (force || m_pageSearchForm != f) {
IForm oldForm = m_pageSearchForm;
m_pageSearchForm = f;
// extensions
for (IDesktopExtension ext : getDesktopExtensions()) {
try {
ContributionCommand cc = ext.pageSearchFormChangedDelegate(oldForm, m_pageSearchForm);
if (cc == ContributionCommand.Stop) {
break;
}
} catch (Exception t) {
LOG.error("extension {}", ext, t);
}
}
}
}
use of org.eclipse.scout.rt.client.ui.form.IForm in project scout.rt by eclipse.
the class AbstractDesktop method updateActiveFormOnOutlineChanged.
protected void updateActiveFormOnOutlineChanged() {
// If active form is not set or parent of active form is desktop
// we must do nothing
IForm activeForm = getActiveForm();
if (activeForm == null || activeForm.getDisplayParent() == this) {
return;
}
// Does the active form belong to the current outline?
// if not, we must set the active form to null otherwise we do nothing
List<IForm> formsByOutline = m_formStore.getByDisplayParent(m_outline);
if (!formsByOutline.contains(activeForm)) {
setActiveForm(null);
}
}
use of org.eclipse.scout.rt.client.ui.form.IForm in project scout.rt by eclipse.
the class AbstractPageWithNodes method enhanceDetailFormWithPageMenus.
protected void enhanceDetailFormWithPageMenus() {
if (getOutline() == null) {
return;
}
IForm form = getDetailForm();
IFormFieldContextMenu mainBoxContextMenu = form.getRootGroupBox().getContextMenu();
List<IMenu> menus = mainBoxContextMenu.getChildActions();
for (IMenu menu : getOutline().getMenusForPage(this)) {
// TODO [6.2] hmu, bsh: menues im ui sammeln anstelle in forms injecten
if (menu.getMenuTypes().contains(TreeMenuType.Header) && menu.getMenuTypes().size() == 1) {
// Don't show TreeMenuType.Header. These menus should only be shown on outline title
continue;
}
menus.add(OutlineMenuWrapper.wrapMenu(menu));
}
if (!CollectionUtility.equalsCollection(menus, mainBoxContextMenu.getChildActions())) {
mainBoxContextMenu.setChildActions(menus);
}
}
use of org.eclipse.scout.rt.client.ui.form.IForm in project scout.rt by eclipse.
the class AbstractCompositeField method getReplacingFieldClass.
/**
* Checks whether the form field with the given class has been replaced by another form field. If so, the replacing
* form field's class is returned. Otherwise the given class itself.
*
* @param c
* @return Returns the possibly available replacing field class for the given class.
* @see Replace
* @since 3.8.2
*/
private <T extends IFormField> Class<? extends T> getReplacingFieldClass(Class<T> c) {
// 1. check local replacements
if (m_formFieldReplacements != null) {
@SuppressWarnings("unchecked") Class<? extends T> replacementFieldClass = (Class<? extends T>) m_formFieldReplacements.get(c);
if (replacementFieldClass != null) {
return replacementFieldClass;
}
}
// 2. check global replacements
IForm form = getForm();
if (form instanceof AbstractForm) {
Map<Class<?>, Class<? extends IFormField>> mapping = ((AbstractForm) form).getFormFieldReplacementsInternal();
if (mapping != null) {
@SuppressWarnings("unchecked") Class<? extends T> replacementFieldClass = (Class<? extends T>) mapping.get(c);
if (replacementFieldClass != null) {
return replacementFieldClass;
}
}
}
// 3. check parent field replacements (used for templates only. It is less common and therefore checked after global replacements)
ICompositeField parentField = getParentField();
while (parentField != null) {
if (parentField instanceof AbstractCompositeField) {
Map<Class<?>, Class<? extends IFormField>> parentReplacements = ((AbstractCompositeField) parentField).m_formFieldReplacements;
if (parentReplacements != null) {
@SuppressWarnings("unchecked") Class<? extends T> replacementFieldClass = (Class<? extends T>) parentReplacements.get(c);
if (replacementFieldClass != null) {
return replacementFieldClass;
}
}
}
parentField = parentField.getParentField();
}
// 4. field is not replaced
return c;
}
use of org.eclipse.scout.rt.client.ui.form.IForm in project scout.rt by eclipse.
the class AbstractFormField method existsDuplicateClassId.
/**
* Sanity check for class ids. Scans all fields in a form to find duplicate class ids.
*
* @return <code>true</code>, if another field with the same id is found. <code>false</code> otherwise.
*/
private boolean existsDuplicateClassId() {
IForm form = getForm();
String currentClassId = computeClassId();
if (form != null) {
List<String> classIds = new ArrayList<String>();
for (IFormField f : form.getAllFields()) {
if (f != this) {
String fClassId = ConfigurationUtility.getAnnotatedClassIdWithFallback(f.getClass(), true);
classIds.add(fClassId);
}
}
if (classIds.contains(currentClassId)) {
return true;
}
}
return false;
}
Aggregations