use of de.symeda.sormas.ui.utils.SormasFieldGroupFieldFactory in project SORMAS-Project by hzi-braunschweig.
the class CampaignFormBuilder method createField.
@SuppressWarnings("unchecked")
private <T extends Field<?>> T createField(String fieldId, String caption, CampaignFormElementType type, List<CampaignFormElementStyle> styles) {
SormasFieldGroupFieldFactory fieldFactory = new SormasFieldGroupFieldFactory(new FieldVisibilityCheckers(), UiFieldAccessCheckers.getNoop());
T field;
if (type == CampaignFormElementType.YES_NO) {
field = fieldFactory.createField(Boolean.class, (Class<T>) NullableOptionGroup.class);
} else if (type == CampaignFormElementType.TEXT || type == CampaignFormElementType.NUMBER) {
field = fieldFactory.createField(String.class, (Class<T>) TextField.class);
} else {
field = null;
}
prepareComponent((AbstractComponent) field, fieldId, caption, type, styles);
return field;
}
use of de.symeda.sormas.ui.utils.SormasFieldGroupFieldFactory in project SORMAS-Project by hzi-braunschweig.
the class DEAFormBuilder method buildForm.
public void buildForm() {
SormasFieldGroupFieldFactory fieldFactory = new SormasFieldGroupFieldFactory(new FieldVisibilityCheckers(), UiFieldAccessCheckers.getNoop());
for (DeaContentEntry deaContentEntry : deaContentEntries) {
final TextField textField = fieldFactory.createField(String.class, TextField.class);
textField.setWidthFull();
final String caption = deaContentEntry.getCaption();
textField.setId(caption);
CssStyles.style(textField, CssStyles.TEXTFIELD_ROW);
textField.setCaption(caption);
if (!isCreate) {
textField.setValue(deaContentEntry.getValue());
}
gridLayout.addComponent(textField);
fields.add(textField);
}
}
Aggregations