use of org.eclipse.scout.rt.client.ui.form.fields.smartfield2.SmartField2Result in project scout.rt by eclipse.
the class JsonSmartField2 method initJsonProperties.
@Override
protected void initJsonProperties(MODEL model) {
super.initJsonProperties(model);
putJsonProperty(new JsonProperty<ISmartField2<VALUE>>(IValueField.PROP_VALUE, model) {
@Override
protected VALUE modelValue() {
return getModel().getValue();
}
@Override
@SuppressWarnings("unchecked")
public Object prepareValueForToJson(Object value) {
return JsonSmartField2.this.valueToJson((VALUE) value);
}
});
putJsonProperty(new JsonProperty<ISmartField2<VALUE>>(ISmartField2.PROP_RESULT, model) {
@Override
protected Object modelValue() {
return getModel().getResult();
}
@Override
@SuppressWarnings("unchecked")
public Object prepareValueForToJson(Object value) {
return resultToJson((SmartField2Result<VALUE>) value);
}
});
putJsonProperty(new JsonProperty<ISmartField2<VALUE>>(ISmartField2.PROP_LOOKUP_ROW, model) {
@Override
protected Object modelValue() {
return getModel().getLookupRow();
}
@Override
@SuppressWarnings("unchecked")
public Object prepareValueForToJson(Object value) {
return lookupRowToJson((LookupRow<VALUE>) value, hasMultipleColumns());
}
});
putJsonProperty(new JsonProperty<ISmartField2<VALUE>>(ISmartField2.PROP_BROWSE_MAX_ROW_COUNT, model) {
@Override
protected Integer modelValue() {
return getModel().getBrowseMaxRowCount();
}
});
putJsonProperty(new JsonProperty<ISmartField2<VALUE>>(ISmartField2.PROP_BROWSE_AUTO_EXPAND_ALL, model) {
@Override
protected Boolean modelValue() {
return getModel().isBrowseAutoExpandAll();
}
});
putJsonProperty(new JsonProperty<ISmartField2<VALUE>>(ISmartField2.PROP_BROWSE_LOAD_INCREMENTAL, model) {
@Override
protected Boolean modelValue() {
return getModel().isBrowseLoadIncremental();
}
});
putJsonProperty(new JsonProperty<ISmartField2<VALUE>>(ISmartField2.PROP_ACTIVE_FILTER_ENABLED, model) {
@Override
protected Boolean modelValue() {
return getModel().isActiveFilterEnabled();
}
});
putJsonProperty(new JsonProperty<ISmartField2<VALUE>>(ISmartField2.PROP_ACTIVE_FILTER, model) {
@Override
protected TriState modelValue() {
return getModel().getActiveFilter();
}
});
putJsonProperty(new JsonProperty<ISmartField2<VALUE>>(ISmartField2.PROP_ACTIVE_FILTER_LABELS, model) {
@Override
protected String[] modelValue() {
return getModel().getActiveFilterLabels();
}
@Override
public Object prepareValueForToJson(Object value) {
return new JSONArray(value);
}
});
putJsonProperty(new JsonProperty<ISmartField2<VALUE>>(ISmartField2.PROP_COLUMN_DESCRIPTORS, model) {
@Override
protected ColumnDescriptor[] modelValue() {
return getModel().getColumnDescriptors();
}
@Override
public Object prepareValueForToJson(Object value) {
return columnDescriptorsToJson(value);
}
});
}
Aggregations