use of org.eclipse.scout.rt.client.ui.form.fields.AbstractValueField in project scout.rt by eclipse.
the class AbstractColumnTest method testMapEditorFieldProperties.
/**
* Tests that column properties are mapped correctly to editor field. {@link #mapEditorFieldProperties(IFormField)}
*/
@Test
public void testMapEditorFieldProperties() {
String bColor = "469406";
setBackgroundColor(bColor);
String fColor = "FAAAF1";
setForegroundColor(fColor);
FontSpec fontSpec = new FontSpec("Arial", FontSpec.STYLE_ITALIC | FontSpec.STYLE_BOLD, 0);
setFont(fontSpec);
setMandatory(true);
AbstractValueField<String> field = new AbstractValueField<String>() {
};
mapEditorFieldProperties(field);
assertEquals("expected backgroundColor property to be progagated to field", bColor, field.getBackgroundColor());
assertEquals("expected foregroundColor property to be progagated to field", fColor, field.getForegroundColor());
assertEquals("expected font property to be progagated to field", fontSpec, field.getFont());
assertTrue("expected mandatory property to be progagated to field", field.isMandatory());
}
use of org.eclipse.scout.rt.client.ui.form.fields.AbstractValueField 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.AbstractValueField in project scout.rt by eclipse.
the class SmartFieldLookupTest method testSubtreeLookup_InBackground.
@Test
public void testSubtreeLookup_InBackground() {
IValueField<Long> masterField = new AbstractValueField<Long>() {
};
masterField.setValue(testMasterValue);
m_field.setLookupCall(new TestLookupCall());
m_field.setMasterField(masterField);
IFuture<List<ILookupRow<Long>>> futureRows = m_field.callSubTreeLookupInBackground(1L, TriState.TRUE, false);
List<? extends ILookupRow<Long>> rows = awaitDoneAndGet(futureRows);
assertEquals(2, rows.size());
}
use of org.eclipse.scout.rt.client.ui.form.fields.AbstractValueField in project scout.rt by eclipse.
the class SmartFieldLookupTest method testSubtreeLookup_WithMasterField.
@Test
public void testSubtreeLookup_WithMasterField() {
IValueField<Long> masterField = new AbstractValueField<Long>() {
};
masterField.setValue(testMasterValue);
m_field.setLookupCall(new TestLookupCall());
m_field.setMasterField(masterField);
List<? extends ILookupRow<Long>> rows2 = m_field.callSubTreeLookup(1L);
assertEquals(2, rows2.size());
}
Aggregations