IDEMPIERE-1621 Mandatory field in process parameter panel not in red label

This commit is contained in:
Elaine Tan 2013-12-10 15:43:43 +08:00
parent 8f2813cd73
commit 486836db27
2 changed files with 16 additions and 3 deletions

View File

@ -282,6 +282,7 @@ public class ProcessParameterPanel extends Panel implements
// The Editor // The Editor
WEditor editor = WebEditorFactory.getEditor(mField, false); WEditor editor = WebEditorFactory.getEditor(mField, false);
editor.setProcessParameter(true);
editor.getComponent().addEventListener(Events.ON_FOCUS, this); editor.getComponent().addEventListener(Events.ON_FOCUS, this);
editor.getComponent().addEventListener(Events.ON_BLUR, this); editor.getComponent().addEventListener(Events.ON_BLUR, this);
editor.addValueChangeListener(this); editor.addValueChangeListener(this);
@ -336,6 +337,7 @@ public class ProcessParameterPanel extends Panel implements
m_mFields2.add(mField2); m_mFields2.add(mField2);
// The Editor // The Editor
WEditor editor2 = WebEditorFactory.getEditor(mField2, false); WEditor editor2 = WebEditorFactory.getEditor(mField2, false);
editor2.setProcessParameter(true);
//override attribute //override attribute
editor2.getComponent().setWidgetAttribute("columnName", mField2.getColumnName()+"_To"); editor2.getComponent().setWidgetAttribute("columnName", mField2.getColumnName()+"_To");
editor2.getComponent().addEventListener(Events.ON_FOCUS, this); editor2.getComponent().addEventListener(Events.ON_FOCUS, this);

View File

@ -92,6 +92,8 @@ public abstract class WEditor implements EventListener<Event>, PropertyChangeLis
private boolean tableEditor; private boolean tableEditor;
private boolean isProcessParameter;
public WEditor(Component comp, GridField gridField) { public WEditor(Component comp, GridField gridField) {
this(comp, gridField, -1); this(comp, gridField, -1);
} }
@ -208,6 +210,7 @@ public abstract class WEditor implements EventListener<Event>, PropertyChangeLis
label = new Label(""); label = new Label("");
label.setValue(strLabel); label.setValue(strLabel);
label.setTooltiptext(description); label.setTooltiptext(description);
label.setMandatory(mandatory);
this.setMandatory (mandatory); this.setMandatory (mandatory);
@ -546,7 +549,7 @@ public abstract class WEditor implements EventListener<Event>, PropertyChangeLis
} }
public boolean isMandatoryStyle() { public boolean isMandatoryStyle() {
return mandatory && !readOnly && getGridField().isEditable(true) && isNullOrEmpty(); return mandatory && !readOnly && (isProcessParameter || getGridField().isEditable(true)) && isNullOrEmpty();
} }
public boolean isNullOrEmpty() { public boolean isNullOrEmpty() {
@ -633,6 +636,14 @@ public abstract class WEditor implements EventListener<Event>, PropertyChangeLis
return false; return false;
} }
public boolean isProcessParameter() {
return isProcessParameter;
}
public void setProcessParameter(boolean isProcessParameter) {
this.isProcessParameter = isProcessParameter;
}
private static final String STYLE_ZOOMABLE_LABEL = "cursor: pointer; text-decoration: underline;"; 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_NORMAL_LABEL = "color: #333;";
private static final String STYLE_EMPTY_MANDATORY_LABEL = "color: red;"; private static final String STYLE_EMPTY_MANDATORY_LABEL = "color: red;";