use of org.eclipse.scout.rt.client.ui.form.fields.sequencebox.ISequenceBox in project scout.rt by eclipse.
the class DefaultSearchFilterService method applySearchDelegate.
@Override
public void applySearchDelegate(IFormField field, SearchFilter search, boolean includeChildren) {
String label = field.getLabel();
if (field.getParentField() instanceof ISequenceBox && field.getParentField() instanceof AbstractFormField) {
AbstractFormField range = (AbstractFormField) field.getParentField();
if (range.getInitialLabel() != null) {
label = range.getInitialLabel() + (StringUtility.isNullOrEmpty(label) ? "" : " " + label);
}
}
// composer
if (field instanceof AbstractComposerField) {
AbstractComposerField composerField = (AbstractComposerField) field;
ITreeNode rootNode = composerField.getTree().getRootNode();
if (rootNode != null) {
StringBuilder buf = new StringBuilder();
new ComposerDisplayTextBuilder().build(rootNode, buf, "");
String s = buf.toString();
if (StringUtility.hasText(s)) {
search.addDisplayText(s);
}
}
return;
}
// list box
if (field instanceof AbstractListBox<?>) {
AbstractListBox<?> valueField = (AbstractListBox<?>) field;
if (!valueField.getValue().isEmpty()) {
search.addDisplayText(label + " " + TEXTS.get("LogicIn") + " " + valueField.getDisplayText());
}
return;
}
// tree box
if (field instanceof AbstractTreeBox<?>) {
AbstractTreeBox<?> valueField = (AbstractTreeBox<?>) field;
if (!valueField.getValue().isEmpty()) {
search.addDisplayText(label + " " + TEXTS.get("LogicIn") + " " + valueField.getDisplayText());
}
return;
}
// string, html, label field
if (field instanceof AbstractStringField || field instanceof AbstractHtmlField || field instanceof AbstractLabelField) {
AbstractValueField<?> valueField = (AbstractValueField<?>) field;
if (valueField.getValue() != null) {
search.addDisplayText(label + " " + TEXTS.get("LogicLike") + " " + valueField.getDisplayText());
}
return;
}
// boolean field
if (field instanceof AbstractBooleanField) {
AbstractBooleanField valueField = (AbstractBooleanField) field;
if (valueField.getValue() != null && valueField.getValue()) {
search.addDisplayText(label);
}
return;
}
// radiobuttongroup field
if (field instanceof AbstractRadioButtonGroup<?>) {
AbstractRadioButtonGroup<?> valueField = (AbstractRadioButtonGroup<?>) field;
if (valueField.getValue() != null) {
IButton selectedButton = valueField.getSelectedButton();
search.addDisplayText(label + " = " + (selectedButton != null ? selectedButton.getLabel() : ""));
}
return;
}
// value field
if (field instanceof AbstractValueField<?>) {
AbstractValueField<?> valueField = (AbstractValueField<?>) field;
if (valueField.getValue() != null) {
search.addDisplayText(label + " " + TEXTS.get("LogicEQ") + " " + valueField.getDisplayText());
}
return;
}
if (includeChildren) {
applySearchDelegateForChildren(field, search);
}
}
use of org.eclipse.scout.rt.client.ui.form.fields.sequencebox.ISequenceBox in project scout.rt by eclipse.
the class MobileDeviceTransformer method makeFieldScalable.
/**
* Makes sure weightX is set to 1 which makes the field scalable.
* <p>
* Reason:<br>
* The width of the field should be adjusted according to the display width, otherwise it may be too big to be
* displayed. <br>
* Additionally, since we use a one column layout, setting weightX to 0 might destroy the layout because it affects
* all the fields in the groupBox.
*/
protected void makeFieldScalable(IFormField field) {
// Since a sequencebox contains several fields it's very risky to modify the gridData because it could make the fields too big or too small.
if (field.getParentField() instanceof ISequenceBox) {
return;
}
// Make sure weightX is set to 1 so the field grows and shrinks and does not break the 1 column layout
GridData gridDataHints = field.getGridDataHints();
if (gridDataHints.weightX == 0) {
gridDataHints.weightX = 1;
field.setGridDataHints(gridDataHints);
markGridDataDirty(field.getForm());
}
}
use of org.eclipse.scout.rt.client.ui.form.fields.sequencebox.ISequenceBox in project scout.rt by eclipse.
the class AbstractComposerValueBox method initConfig.
@Override
protected void initConfig() {
super.initConfig();
HashMap<Integer, Map<Integer, IComposerValueField>> operatorTypeToFieldMap = new HashMap<Integer, Map<Integer, IComposerValueField>>();
interceptInitOperatorToFieldMap(operatorTypeToFieldMap);
m_operatorTypeToFieldMap = operatorTypeToFieldMap;
m_valueChangedListener = new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent e) {
if (IValueField.PROP_VALUE.equals(e.getPropertyName())) {
try {
interceptChangedValue();
} catch (Exception ex) {
LOG.error("fire value change on {}", e.getSource(), ex);
}
}
}
};
for (IFormField f : getFields()) {
f.setLabelVisible(false);
f.setLabel(TEXTS.get("Value"));
f.setVisible(false);
if (f instanceof ISequenceBox) {
List<IFormField> sequenceBoxChildFields = ((ISequenceBox) f).getFields();
if (CollectionUtility.hasElements(sequenceBoxChildFields)) {
IFormField firstField = CollectionUtility.firstElement(sequenceBoxChildFields);
firstField.setLabelVisible(false);
if (sequenceBoxChildFields.size() > 1) {
IFormField secondField = CollectionUtility.getElement(sequenceBoxChildFields, 1);
secondField.setLabel(TEXTS.get("and"));
}
}
}
}
}
use of org.eclipse.scout.rt.client.ui.form.fields.sequencebox.ISequenceBox in project scout.rt by eclipse.
the class JsonObjectFactory method createJsonAdapter.
@SuppressWarnings("unchecked")
@Override
public IJsonAdapter<?> createJsonAdapter(Object model, IUiSession session, String id, IJsonAdapter<?> parent) {
// --- form fields ----
if (model instanceof IGroupBox) {
// we must distinct between normal group-boxes and group-boxes in tab-boxes
// the use the same model, but we need different adapters
IGroupBox groupBox = (IGroupBox) model;
if (groupBox.getParentField() instanceof ITabBox) {
return new JsonTabItem<IGroupBox>(groupBox, session, id, parent);
} else {
return new JsonGroupBox<IGroupBox>(groupBox, session, id, parent);
}
}
if (model instanceof ISequenceBox) {
return new JsonSequenceBox<ISequenceBox>((ISequenceBox) model, session, id, parent);
}
if (model instanceof ITabBox) {
return new JsonTabBox<ITabBox>((ITabBox) model, session, id, parent);
}
if (model instanceof IBooleanField) {
return new JsonCheckBoxField<IBooleanField>((IBooleanField) model, session, id, parent);
}
if (model instanceof ILabelField) {
return new JsonLabelField<ILabelField>((ILabelField) model, session, id, parent);
}
if (model instanceof IImageField) {
return new JsonImageField<IImageField>((IImageField) model, session, id, parent);
}
if (model instanceof ITableField<?>) {
return new JsonTableField<ITableField<? extends ITable>>((ITableField<?>) model, session, id, parent);
}
if (model instanceof IListBox<?>) {
return new JsonListBox((IListBox<?>) model, session, id, parent);
}
if (model instanceof ITreeField) {
return new JsonTreeField<ITreeField>((ITreeField) model, session, id, parent);
}
if (model instanceof ITreeBox<?>) {
return new JsonTreeBox<ITreeBox>((ITreeBox<?>) model, session, id, parent);
}
if (model instanceof IRadioButton<?>) {
return new JsonRadioButton<IRadioButton>((IRadioButton<?>) model, session, id, parent);
}
if (model instanceof IRadioButtonGroup<?>) {
return new JsonRadioButtonGroup<IRadioButtonGroup>((IRadioButtonGroup<?>) model, session, id, parent);
}
if (model instanceof IButton) {
return new JsonButton<IButton>((IButton) model, session, id, parent);
}
if (model instanceof IStringField) {
return new JsonStringField<IStringField>((IStringField) model, session, id, parent);
}
if (model instanceof INumberField<?>) {
return new JsonNumberField<INumberField>((INumberField<?>) model, session, id, parent);
}
if (model instanceof IProposalField2<?>) {
return new JsonProposalField2((IProposalField2<?>) model, session, id, parent);
}
if (model instanceof ISmartField2<?>) {
return new JsonSmartField2((ISmartField2<?>) model, session, id, parent);
}
if (model instanceof IContentAssistField<?, ?>) {
return new JsonSmartField((IContentAssistField<?, ?>) model, session, id, parent);
}
if (model instanceof IProposalChooser) {
return new JsonProposalChooser<IProposalChooser>((IProposalChooser) model, session, id, parent);
}
if (model instanceof IDateField) {
return new JsonDateField<IDateField>((IDateField) model, session, id, parent);
}
if (model instanceof ICalendarField<?>) {
return new JsonCalendarField<ICalendarField<? extends ICalendar>>((ICalendarField<?>) model, session, id, parent);
}
if (model instanceof IPlannerField<?>) {
return new JsonPlannerField((IPlannerField<?>) model, session, id, parent);
}
if (model instanceof IWrappedFormField<?>) {
return new JsonWrappedFormField<IWrappedFormField<? extends IForm>>((IWrappedFormField<?>) model, session, id, parent);
}
if (model instanceof ISplitBox) {
return new JsonSplitBox<ISplitBox>((ISplitBox) model, session, id, parent);
}
if (model instanceof IPlaceholderField) {
return new JsonPlaceholderField<IPlaceholderField>((IPlaceholderField) model, session, id, parent);
}
if (model instanceof IWizardProgressField) {
return new JsonWizardProgressField<IWizardProgressField>((IWizardProgressField) model, session, id, parent);
}
if (model instanceof IHtmlField) {
return new JsonHtmlField<IHtmlField>((IHtmlField) model, session, id, parent);
}
if (model instanceof IComposerField) {
return new JsonComposerField<IComposerField>((IComposerField) model, session, id, parent);
}
if (model instanceof IBeanField) {
return new JsonBeanField<IBeanField<?>>((IBeanField) model, session, id, parent);
}
if (model instanceof IFileChooserField) {
return new JsonFileChooserField<IFileChooserField>((IFileChooserField) model, session, id, parent);
}
if (model instanceof IColorField) {
return new JsonColorField<IColorField>((IColorField) model, session, id, parent);
}
if (model instanceof IBrowserField) {
return new JsonBrowserField<IBrowserField>((IBrowserField) model, session, id, parent);
}
if (model instanceof IClipboardField) {
return new JsonClipboardField<IClipboardField>((IClipboardField) model, session, id, parent);
}
// --- other model objects ---
if (model instanceof IDesktop) {
return new JsonDesktop<IDesktop>((IDesktop) model, session, id, parent);
}
if (model instanceof IFormMenu<?>) {
return new JsonFormMenu((IFormMenu<?>) model, session, id, parent);
}
if (model instanceof IMenu) {
return new JsonMenu<IMenu>((IMenu) model, session, id, parent);
}
if (model instanceof IKeyStroke) {
return new JsonKeyStroke<IKeyStroke>((IKeyStroke) model, session, id, parent);
}
if (model instanceof ISearchForm) {
return new JsonSearchForm<ISearchForm>((ISearchForm) model, session, id, parent);
}
if (model instanceof IForm) {
return new JsonForm<IForm>((IForm) model, session, id, parent);
}
if (model instanceof IMessageBox) {
return new JsonMessageBox<IMessageBox>((IMessageBox) model, session, id, parent);
}
if (model instanceof IDesktopNotification) {
return new JsonDesktopNotification<IDesktopNotification>((IDesktopNotification) model, session, id, parent);
}
if (model instanceof IOutlineViewButton) {
return new JsonOutlineViewButton<IOutlineViewButton>((IOutlineViewButton) model, session, id, parent);
}
if (model instanceof IViewButton) {
return new JsonViewButton<IViewButton>((IViewButton) model, session, id, parent);
}
if (model instanceof ISearchOutline) {
return new JsonSearchOutline<ISearchOutline>((ISearchOutline) model, session, id, parent);
}
if (model instanceof IOutline) {
return new JsonOutline<IOutline>((IOutline) model, session, id, parent);
}
if (model instanceof ITree) {
return new JsonTree<ITree>((ITree) model, session, id, parent);
}
if (model instanceof ITable) {
ITable table = (ITable) model;
IPage page = (IPage) table.getProperty(JsonOutlineTable.PROP_PAGE);
if (page != null) {
return new JsonOutlineTable<ITable>(table, session, id, parent, page);
}
return new JsonTable<ITable>(table, session, id, parent);
}
if (model instanceof IClientSession) {
return new JsonClientSession<IClientSession>((IClientSession) model, session, id, parent);
}
if (model instanceof ICalendar) {
return new JsonCalendar<ICalendar>((ICalendar) model, session, id, parent);
}
if (model instanceof CalendarComponent) {
return new JsonCalendarComponent<CalendarComponent>((CalendarComponent) model, session, id, parent);
}
if (model instanceof IPlanner<?, ?>) {
return new JsonPlanner<IPlanner>((IPlanner<?, ?>) model, session, id, parent);
}
if (model instanceof IFileChooser) {
return new JsonFileChooser<IFileChooser>((IFileChooser) model, session, id, parent);
}
if (model instanceof IAggregateTableControl) {
// needs to be before ITableControl
return new JsonAggregateTableControl<IAggregateTableControl>((IAggregateTableControl) model, session, id, parent);
}
if (model instanceof IFormTableControl) {
// needs to be before ITableControl
return new JsonFormTableControl<IFormTableControl>((IFormTableControl) model, session, id, parent);
}
if (model instanceof ITableControl) {
return new JsonTableControl<ITableControl>((ITableControl) model, session, id, parent);
}
if (model instanceof IStatusMenuMapping) {
return new JsonStatusMenuMapping<IStatusMenuMapping>((IStatusMenuMapping) model, session, id, parent);
}
return null;
}
Aggregations