Improvements for zkwebui process parameter panel:

- show mandatory fields similar to windows (marked with a red * at the end)
- validate mandatory fields, inform the user and allow the user to fill them without cancelling the report/process (the user is notified immediately no need to push Parameter button to go back and fill the mandatory parameters - similar as swing client behaves)
This commit is contained in:
Carlos Ruiz 2011-03-07 10:59:31 -05:00
parent 67d11bfa3b
commit dc9b7d5829
2 changed files with 34 additions and 6 deletions

View File

@ -319,8 +319,11 @@ public class ProcessDialog extends Window implements EventListener//, ASyncProce
if (component instanceof Button) { if (component instanceof Button) {
Button element = (Button)component; Button element = (Button)component;
if ("Ok".equalsIgnoreCase(element.getId())) { if ("Ok".equalsIgnoreCase(element.getId())) {
if (isParameterPage) if (isParameterPage) {
if (!parameterPanel.validateParameters())
return;
this.startProcess(); this.startProcess();
}
else else
restart(); restart();
} else if ("Cancel".equalsIgnoreCase(element.getId())) { } else if ("Cancel".equalsIgnoreCase(element.getId())) {

View File

@ -45,6 +45,7 @@ import org.compiere.process.ProcessInfo;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
import org.compiere.util.DB; import org.compiere.util.DB;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.zkoss.zul.Div;
import org.zkoss.zul.Hbox; import org.zkoss.zul.Hbox;
import org.zkoss.zul.Label; import org.zkoss.zul.Label;
@ -56,9 +57,12 @@ import org.zkoss.zul.Label;
* @author Low Heng Sin * @author Low Heng Sin
* @version 2006-12-01 * @version 2006-12-01
*/ */
@SuppressWarnings("serial")
public class ProcessParameterPanel extends Panel implements public class ProcessParameterPanel extends Panel implements
ValueChangeListener, IProcessParameter { ValueChangeListener, IProcessParameter {
/**
*
*/
private static final long serialVersionUID = 7163263872945366389L;
private String width; private String width;
/** /**
@ -285,7 +289,14 @@ public class ProcessParameterPanel extends Panel implements
// //
m_wEditors.add(editor); // add to Editors m_wEditors.add(editor); // add to Editors
row.appendChild(editor.getLabel().rightAlign()); Div div = new Div();
div.setAlign("right");
org.adempiere.webui.component.Label label = editor.getLabel();
div.appendChild(label);
if (label.getDecorator() != null)
div.appendChild(label.getDecorator());
row.appendChild(div);
// //
if (voF.isRange) { if (voF.isRange) {
Hbox box = new Hbox(); Hbox box = new Hbox();
@ -326,11 +337,11 @@ public class ProcessParameterPanel extends Panel implements
} // createField } // createField
/** /**
* Save Parameter values * Validate Parameter values
* *
* @return true if parameters saved * @return true if parameters are valid
*/ */
public boolean saveParameters() { public boolean validateParameters() {
log.config(""); log.config("");
/** /**
@ -377,6 +388,20 @@ public class ProcessParameterPanel extends Panel implements
return false; return false;
} }
return true;
} // validateParameters
/**
* Save Parameter values
*
* @return true if parameters saved
*/
public boolean saveParameters() {
log.config("");
if (!validateParameters())
return false;
/********************************************************************** /**********************************************************************
* Save Now * Save Now
*/ */