IDEMPIERE-4192 Mandatory label red

This commit is contained in:
Diego Ruiz 2020-03-10 12:54:54 +01:00 committed by Carlos Ruiz
parent d79c6de5e5
commit eae52b13ad
2 changed files with 42 additions and 5 deletions

View File

@ -571,7 +571,15 @@ public abstract class WEditor implements EventListener<Event>, PropertyChangeLis
protected void applyLabelStyles(boolean applyDictionaryStyle) { protected void applyLabelStyles(boolean applyDictionaryStyle) {
if (label != null) { if (label != null) {
boolean zoomable = isZoomable(); 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 (ClientInfo.isMobile()) {
if (!zoomable && popupMenu != null) { if (!zoomable && popupMenu != null) {
style = style + STYLE_MOBILE_ZOOMABLE; style = style + STYLE_MOBILE_ZOOMABLE;
@ -613,6 +621,17 @@ public abstract class WEditor implements EventListener<Event>, PropertyChangeLis
style = buildStyle(gridField.getAD_FieldStyle_ID()); style = buildStyle(gridField.getAD_FieldStyle_ID());
} }
setFieldStyle(style); 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) { protected void setFieldStyle(String style) {
@ -829,10 +848,11 @@ public abstract class WEditor implements EventListener<Event>, PropertyChangeLis
protected Evaluatee getStyleEvaluatee() { protected Evaluatee getStyleEvaluatee() {
return new EvaluateeWrapper(this, gridField, tableEditor); return new EvaluateeWrapper(this, gridField, tableEditor);
} }
private static final String STYLE_ZOOMABLE_LABEL = "cursor: pointer; text-decoration: underline;"; private static final String CLASS_MANDATORY_FIELD = "idempiere-mandatory";
private static final String STYLE_NORMAL_LABEL = "color: #333;"; private static final String CLASS_ZOOMABLE_LABEL = "idempiere-zoomable-label";
private static final String STYLE_EMPTY_MANDATORY_LABEL = "color: red;"; 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 final String STYLE_MOBILE_ZOOMABLE = "cursor: pointer;";
private static class EvaluateeWrapper implements Evaluatee { private static class EvaluateeWrapper implements Evaluatee {

View File

@ -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 { .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; 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;
}