use of de.symeda.sormas.ui.utils.CssStyles in project SORMAS-Project by hzi-braunschweig.
the class CampaignFormBuilder method prepareComponent.
private <T extends AbstractComponent> void prepareComponent(T field, String fieldId, String caption, CampaignFormElementType type, List<CampaignFormElementStyle> styles) {
Styles cssStyles = Page.getCurrent().getStyles();
if (type == CampaignFormElementType.LABEL) {
((Label) field).setContentMode(ContentMode.HTML);
} else if (type == CampaignFormElementType.YES_NO) {
if (!styles.contains(CampaignFormElementStyle.INLINE)) {
CssStyles.style(field, ValoTheme.OPTIONGROUP_HORIZONTAL, CssStyles.OPTIONGROUP_CAPTION_INLINE, CssStyles.FLOAT_RIGHT);
}
CssStyles.style(field, CssStyles.OPTIONGROUP_GRID_LAYOUT);
} else if (type == CampaignFormElementType.TEXT || type == CampaignFormElementType.NUMBER) {
if (styles.contains(CampaignFormElementStyle.ROW)) {
CssStyles.style(field, CssStyles.TEXTFIELD_ROW, CssStyles.TEXTFIELD_CAPTION_INLINE);
}
if (type == CampaignFormElementType.NUMBER) {
((TextField) field).addValidator(new NumberNumericValueValidator(I18nProperties.getValidationError(Validations.onlyNumbersAllowed, caption)));
}
}
cssStyles.add("#" + fieldId + " { width: " + calculateComponentWidth(type, styles) + "% !important; }");
}
Aggregations