diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WEditor.java index 986861ec66..fe4ba1d7e6 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WEditor.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WEditor.java @@ -571,7 +571,15 @@ public abstract class WEditor implements EventListener, PropertyChangeLis protected void applyLabelStyles(boolean applyDictionaryStyle) { if (label != null) { boolean zoomable = isZoomable(); - String style = (zoomable ? STYLE_ZOOMABLE_LABEL : "") + (isMandatoryStyle() ? STYLE_EMPTY_MANDATORY_LABEL : STYLE_NORMAL_LABEL); + LayoutUtils.addSclass(CLASS_NORMAL_LABEL, label); + if (zoomable) + LayoutUtils.addSclass(CLASS_ZOOMABLE_LABEL, label); + if (isMandatoryStyle()) + LayoutUtils.addSclass(CLASS_EMPTY_MANDATORY_LABEL, label); + else + LayoutUtils.removeSclass(CLASS_EMPTY_MANDATORY_LABEL, label); + + String style = ""; if (ClientInfo.isMobile()) { if (!zoomable && popupMenu != null) { style = style + STYLE_MOBILE_ZOOMABLE; @@ -613,6 +621,17 @@ public abstract class WEditor implements EventListener, PropertyChangeLis style = buildStyle(gridField.getAD_FieldStyle_ID()); } setFieldStyle(style); + setFieldMandatoryStyle(); + } + + private void setFieldMandatoryStyle() { + HtmlBasedComponent component = (HtmlBasedComponent) getComponent(); + if (component != null) { + if (isMandatoryStyle()) + LayoutUtils.addSclass(CLASS_MANDATORY_FIELD, component); + else + LayoutUtils.removeSclass(CLASS_MANDATORY_FIELD, component); + } } protected void setFieldStyle(String style) { @@ -829,10 +848,11 @@ public abstract class WEditor implements EventListener, PropertyChangeLis protected Evaluatee getStyleEvaluatee() { return new EvaluateeWrapper(this, gridField, tableEditor); } - - private static final String STYLE_ZOOMABLE_LABEL = "cursor: pointer; text-decoration: underline;"; - private static final String STYLE_NORMAL_LABEL = "color: #333;"; - private static final String STYLE_EMPTY_MANDATORY_LABEL = "color: red;"; + + private static final String CLASS_MANDATORY_FIELD = "idempiere-mandatory"; + private static final String CLASS_ZOOMABLE_LABEL = "idempiere-zoomable-label"; + private static final String CLASS_NORMAL_LABEL = "idempiere-label"; + private static final String CLASS_EMPTY_MANDATORY_LABEL = "idempiere-mandatory-label"; private static final String STYLE_MOBILE_ZOOMABLE = "cursor: pointer;"; private static class EvaluateeWrapper implements Evaluatee { diff --git a/org.adempiere.ui.zk/theme/default/css/fragment/field-editor.css.dsp b/org.adempiere.ui.zk/theme/default/css/fragment/field-editor.css.dsp index cf5d21c7ea..35b542cbb9 100644 --- a/org.adempiere.ui.zk/theme/default/css/fragment/field-editor.css.dsp +++ b/org.adempiere.ui.zk/theme/default/css/fragment/field-editor.css.dsp @@ -206,3 +206,20 @@ span.grid-combobox-editor { .dashboard-field-panel.z-panel, .dashboard-field-panel.z-panel > .z-panel-body, .dashboard-field-panel.z-panel > .z-panel-body > .z-panelchildren { overflow: visible; } + +.idempiere-mandatory, .idempiere-mandatory input, .idempiere-mandatory a { + border-color:red; +} + +.idempiere-label { + color: #333; +} + +.idempiere-mandatory-label{ + color: red!important; +} + +.idempiere-zoomable-label { + cursor: pointer; + text-decoration: underline; +} \ No newline at end of file