use of com.haulmont.cuba.gui.components.FieldGroup in project cuba by cuba-platform.
the class SessionAttributeEditor method init.
@Override
public void init(Map<String, Object> params) {
datasource = getDsContext().get("attribute");
FieldGroup fields = (FieldGroup) getComponent("fields");
FieldGroup.FieldConfig field = fields.getField("datatype");
fields.addCustomField(field, new FieldGroup.CustomFieldGenerator() {
@Override
public Component generateField(Datasource datasource, String propertyId) {
LookupField lookup = AppConfig.getFactory().createComponent(LookupField.class);
lookup.setDatasource(datasource, propertyId);
lookup.setRequiredMessage(getMessage("datatypeMsg"));
lookup.setRequired(true);
lookup.setPageLength(15);
Map<String, Object> options = new TreeMap<>();
String mainMessagePack = AppConfig.getMessagesPack();
for (String datatypeId : Datatypes.getIds()) {
options.put(messages.getMessage(mainMessagePack, "Datatype." + datatypeId), datatypeId);
}
lookup.setOptionsMap(options);
return lookup;
}
});
}
Aggregations