();
+ /** current rendering group **/
private Group currentGroup;
/**
@@ -186,12 +196,12 @@ public class ProcessParameterPanel extends Panel implements
} // dispose
/**
- * Read Fields to display
+ * Render all visible fields
*
* @return true if loaded OK
*/
public boolean init() {
- log.config("");
+ if (log.isLoggable(Level.CONFIG)) log.config("");
// ASP
MClient client = MClient.get(Env.getCtx());
@@ -385,12 +395,13 @@ public class ProcessParameterPanel extends Panel implements
} // initDialog
/**
- * Create Field. - creates Fields and adds it to m_mFields list - creates
- * Editor and adds it to m_vEditors list Handeles Ranges by adding
- * additional mField/vEditor.
+ * Create editor and adds it to {@link #m_wEditors}.
+ *
+ * For range type field, create the to field and add it to {@link #m_mFields2} and
+ * create the to editor and adds it to {@link #m_wEditors2}.
*
- * mFields are used for default value and mandatory checking; vEditors are
- * used to retrieve the value (no data binding)
+ * mField is used for default value and mandatory checking and editor is
+ * used to capture input value from user (no data binding).
*
* @param voF GridFieldVO
* @param mField
@@ -403,7 +414,7 @@ public class ProcessParameterPanel extends Panel implements
editor.getComponent().addEventListener(Events.ON_FOCUS, this);
editor.addValueChangeListener(this);
editor.dynamicDisplay();
- // MField => VEditor - New Field value to be updated to editor
+ // MField => editor - New Field value to be updated to editor
mField.addPropertyChangeListener(editor);
// Set Default
Object defaultObject = mField.getDefaultForPanel();
@@ -446,6 +457,7 @@ public class ProcessParameterPanel extends Panel implements
Div box = new Div();
box.setStyle("display: flex; align-items: center;");
ZKUpdateUtil.setWidth(box, "100%");
+ //create to field and editor
if (voF.isRange) {
box.appendChild(editor.getComponent());
ZKUpdateUtil.setWidth((HtmlBasedComponent) editor.getComponent(), "49%");
@@ -492,6 +504,7 @@ public class ProcessParameterPanel extends Panel implements
m_mFields2.add(null);
m_wEditors2.add(null);
m_separators.add(null);
+ //add not in support for multi selection field
if(DisplayType.isChosenMultipleSelection(mField.getDisplayType())) {
Button bNegate = ButtonFactory.createButton("", null, null);
bNegate.setTooltiptext(Msg.translate(Env.getCtx(), "IncludeSelectedValues"));
@@ -507,6 +520,11 @@ public class ProcessParameterPanel extends Panel implements
row.appendChild(box);
} // createField
+ /**
+ * set place holder message
+ * @param editor
+ * @param msg
+ */
private void setEditorPlaceHolder(WEditor editor, String msg) {
Component c = editor.getComponent();
if (c instanceof InputElement) {
@@ -528,17 +546,15 @@ public class ProcessParameterPanel extends Panel implements
* @return true if parameters are valid
*/
public boolean validateParameters() {
- log.config("");
+ if (log.isLoggable(Level.CONFIG)) log.config("");
- /**
- * Mandatory fields see - MTable.getMandatory
- */
+ //mandatory fields validation
StringBuilder sb = new StringBuilder();
int size = m_mFields.size();
for (int i = 0; i < size; i++) {
GridField field = (GridField) m_mFields.get(i);
if (field.isMandatory(true)) // check context
- {
+ {
WEditor wEditor = (WEditor) m_wEditors.get(i);
Object data = wEditor.getValue();
if (data == null || data.toString().length() == 0) {
@@ -577,6 +593,7 @@ public class ProcessParameterPanel extends Panel implements
return false;
}
+ /** call {@link IProcessParameterListener} validate(ProcessParameterPanel) **/
if (m_processInfo.getAD_Process_ID() > 0) {
String className = MProcess.get(Env.getCtx(), m_processInfo.getAD_Process_ID()).getClassname();
List listeners = Extensions.getProcessParameterListeners(className, null);
@@ -592,12 +609,13 @@ public class ProcessParameterPanel extends Panel implements
return true;
} // validateParameters
- /*
+ /**
* load parameters from saved instance
+ * @param instance
*/
public boolean loadParameters(MPInstance instance)
{
- log.config("");
+ if (log.isLoggable(Level.CONFIG)) log.config("");
MPInstancePara[] params = instance.getParameters();
for (int j = 0; j < m_mFields.size(); j++)
@@ -688,12 +706,13 @@ public class ProcessParameterPanel extends Panel implements
return true;
} // loadParameters
- /*
+ /**
* Load parameters from Process Info
+ * @param pi
*/
public boolean loadParametersFromProcessInfo(ProcessInfo pi)
{
- log.config("");
+ if (log.isLoggable(Level.CONFIG)) log.config("");
ProcessInfoParameter[] params = pi.getParameter();
for (int j = 0; j < m_mFields.size(); j++)
@@ -742,12 +761,12 @@ public class ProcessParameterPanel extends Panel implements
} // loadParameters
/**
- * Save Parameter values
+ * Save parameter values to {@link MPInstancePara}.
*
* @return true if parameters saved
*/
public boolean saveParameters() {
- log.config("");
+ if (log.isLoggable(Level.CONFIG)) log.config("");
if (!validateParameters())
return false;
@@ -839,21 +858,19 @@ public class ProcessParameterPanel extends Panel implements
} // saveParameters
/**
- * Get Parameter values without saving
+ * Get parameter values from editors without saving to DB.
*
- * @return list of parameter values
+ * @return MPInstancePara[], list of parameter values.
*/
public MPInstancePara[] getParameters() {
- log.config("");
+ if (log.isLoggable(Level.CONFIG)) log.config("");
if (!validateParameters())
return new MPInstancePara[0];
List paras = new ArrayList();
- /**********************************************************************
- * Save Now
- */
+ /** create MPInstancePara from editors and add to paras (without saving MPInstancePara to DB) **/
for (int i = 0; i < m_mFields.size(); i++) {
// Get Values
WEditor editor = (WEditor) m_wEditors.get(i);
@@ -928,12 +945,10 @@ public class ProcessParameterPanel extends Panel implements
/**
- * Editor Listener
+ * Editor value change listener.
*
- * @param evt
- * ValueChangeEvent
+ * @param evt ValueChangeEvent
*/
-
public void valueChange(ValueChangeEvent evt) {
String propName = evt.getPropertyName();
if (evt.getSource() instanceof WEditor) {
@@ -947,7 +962,7 @@ public class ProcessParameterPanel extends Panel implements
processDependencies (changedField);
// future processCallout (changedField);
}
- Events.postEvent("onPostEditorValueChange", this, evt.getSource());
+ Events.postEvent(ON_POST_EDITOR_VALUE_CHANGE_EVENT, this, evt.getSource());
}
processNewValue(evt.getNewValue(), propName);
}
@@ -955,6 +970,7 @@ public class ProcessParameterPanel extends Panel implements
@Override
public void onEvent(Event event) throws Exception {
if (event.getName().equals(Events.ON_FOCUS)) {
+ //update tooltip text inside desktop help panel.
for (WEditor editor : m_wEditors)
{
if (editor.isComponentOfEditor(event.getTarget()))
@@ -976,7 +992,7 @@ public class ProcessParameterPanel extends Panel implements
else if (event.getName().equals("onDynamicDisplay")) {
dynamicDisplay();
}
- else if (event.getName().equals("onPostEditorValueChange")) {
+ else if (event.getName().equals(ON_POST_EDITOR_VALUE_CHANGE_EVENT)) {
WEditor editor = (WEditor)event.getData();
onPostEditorValueChange(editor);
if(editor.getComponent() != null) {
@@ -996,6 +1012,7 @@ public class ProcessParameterPanel extends Panel implements
}
else if (event.getName().equals(Events.ON_CLICK)) {
if(event.getTarget() instanceof Button) {
+ //from not in button of multi selection field
Button bNegate = (Button)event.getTarget();
boolean isSelected = !(boolean)bNegate.getAttribute("isSelected");
if(isSelected) {
@@ -1013,6 +1030,12 @@ public class ProcessParameterPanel extends Panel implements
}
}
+ /**
+ * Handle ON_POST_EDITOR_VALUE_CHANGE_EVENT event.
+ *
+ * Call {@link IProcessParameterListener#validate(ProcessParameterPanel)}.
+ * @param editor
+ */
private void onPostEditorValueChange(WEditor editor) {
if (m_processInfo.getAD_Process_ID() > 0) {
String className = MProcess.get(Env.getCtx(), m_processInfo.getAD_Process_ID()).getClassname();
@@ -1029,7 +1052,7 @@ public class ProcessParameterPanel extends Panel implements
}
/**
- * Evaluate Dependencies
+ * Notify dependent fields.
* @param changedField changed field
*/
private void processDependencies (GridField changedField)
@@ -1048,6 +1071,11 @@ public class ProcessParameterPanel extends Panel implements
}
} // processDependencies
+ /**
+ * Reset field value to null if field depends on columnName.
+ * @param field
+ * @param columnName column name of changed field
+ */
private void verifyChangedField(GridField field, String columnName) {
ArrayList list = field.getDependentOn();
if (list.contains(columnName)) {
@@ -1066,6 +1094,11 @@ public class ProcessParameterPanel extends Panel implements
}
}
+ /**
+ * Process new value from {@link #valueChange(ValueChangeEvent)}.
+ * @param value
+ * @param name
+ */
private void processNewValue(Object value, String name) {
if (value == null)
value = new String("");
@@ -1086,6 +1119,9 @@ public class ProcessParameterPanel extends Panel implements
Events.postEvent("onDynamicDisplay", this, (Object)null);
}
+ /**
+ * Dynamic update the UI state and properties of all fields.
+ */
private void dynamicDisplay() {
for (int i = 0; i < m_wEditors.size(); i++) {
WEditor editor = m_wEditors.get(i);
@@ -1172,6 +1208,10 @@ public class ProcessParameterPanel extends Panel implements
m_processInfo = processInfo;
}
+ /**
+ * focus to first visible field editor.
+ * @return true if there is at least one visible field editor.
+ */
public boolean focusToFirstEditor() {
if (m_wEditors.isEmpty())
return false;
@@ -1184,6 +1224,9 @@ public class ProcessParameterPanel extends Panel implements
return false;
}
+ /**
+ * @param toFocus
+ */
private void focusToEditor(WEditor toFocus) {
Component c = toFocus.getComponent();
if (c instanceof EditorBox) {
@@ -1211,7 +1254,7 @@ public class ProcessParameterPanel extends Panel implements
}
/**
- * Get parameter field value to editor by column name
+ * Get parameter field to editor by column name
* @param columnName
* @return editor
*/
@@ -1225,7 +1268,7 @@ public class ProcessParameterPanel extends Panel implements
}
/**
- * @return true if editor is showing dialog awaiting user action
+ * @return true if editor is showing dialog awaiting user action (usually info window).
*/
public boolean isWaitingForDialog() {
for (int i = 0; i < m_mFields.size(); i++) {
@@ -1244,6 +1287,9 @@ public class ProcessParameterPanel extends Panel implements
return false;
}
+ /**
+ * Field label ON_CLICK listener for {@link IZoomableEditor}.
+ */
static class ZoomListener implements EventListener {
private IZoomableEditor searchEditor;
@@ -1261,6 +1307,9 @@ public class ProcessParameterPanel extends Panel implements
}
+ /**
+ * @return register window number.
+ */
public int getWindowNo() {
return m_WindowNo;
}
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/WDrillReport.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/WDrillReport.java
index f8f5ea1e80..d2078d6b09 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/WDrillReport.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/WDrillReport.java
@@ -70,14 +70,14 @@ import org.zkoss.zul.Center;
import org.zkoss.zul.Div;
/**
- *
+ * Drill assistant dialog
* @author Igor Pojzl, Cloudempiere
*
*/
public class WDrillReport extends Window implements EventListener {
/**
- *
+ * generated serial id
*/
private static final long serialVersionUID = 5143424676962140799L;
@@ -88,10 +88,14 @@ public class WDrillReport extends Window implements EventListener {
private static final String DRILL_REPORT_TABLE_NAME = "TableName";
private DrillReportCtl drillReportCtl;
+ /** generated unique window name prefix **/
private String winpref;
+ /** tabpanel for related table drill **/
private Tabpanel tabPanel;
+ /** tab for related table drill **/
private Tab tableTab;
+ /** true if {@link #tabPanel} loaded **/
private boolean tablesLoaded = false;
private int windowNo = 0;
@@ -150,6 +154,10 @@ public class WDrillReport extends Window implements EventListener {
td.appendChild(getContent());
}
+ /**
+ * Header text
+ * @return {@link Table}
+ */
private Table getHeader()
{
Table table = new Table();
@@ -202,6 +210,10 @@ public class WDrillReport extends Window implements EventListener {
return table;
}
+ /**
+ * Tabbox with Drill Rules and Related Tables tab.
+ * @return {@link Tabbox}
+ */
private Tabbox getContent()
{
@@ -236,6 +248,14 @@ public class WDrillReport extends Window implements EventListener {
return tabbox;
}
+ /**
+ * Table with links for all process and nested table for print formats for each process.
+ * @param tabIndex
+ * @param drillTables [AD_Process_ID,Process Name]
+ * @param drillPrintFormatMap AD_Process_ID:[AD_Process_DrillRule_ID,Name]
+ * @param isDrillProcessRule true for drill rules, false for related tables
+ * @return {@link Table}
+ */
private Table getTabContent(int tabIndex, KeyNamePair[] drillTables, HashMap drillPrintFormatMap, boolean isDrillProcessRule)
{
Table table = new Table();
@@ -276,7 +296,6 @@ public class WDrillReport extends Window implements EventListener {
td.appendChild(getTablesBox(tabIndex, drillTables));
for (int i = 0; i < size; i++)
{
-
KeyNamePair drillTable = drillTables[i];
// tab
@@ -292,6 +311,15 @@ public class WDrillReport extends Window implements EventListener {
return table;
}
+ /**
+ * Table with process name and print formats
+ * @param drillTable [AD_Process_ID,Process Name]
+ * @param tabIndex
+ * @param groupIndex
+ * @param drillPrintFormatMap AD_Process_ID:[AD_Process_DrillRule_ID,Name]
+ * @param isDrillProcessRule
+ * @return {@link Table}
+ */
private Table getDrillTableBox(KeyNamePair drillTable, int tabIndex, int groupIndex, HashMap drillPrintFormatMap, boolean isDrillProcessRule)
{
Table table = new Table();
@@ -325,11 +353,14 @@ public class WDrillReport extends Window implements EventListener {
a.appendChild(new Text(".."));
header.appendChild(a);
+ //[AD_Process_DrillRule_ID,Name]
KeyNamePair[] drillRules = drillPrintFormatMap != null ? drillPrintFormatMap.get(drillTable.getKey()) : new KeyNamePair[]{findTablePrintFormat(drillTable)};
for (int j = 0; j < drillRules.length; j++)
{
+ //(AD_Process_DrillRule_ID,Name) or (AD_PrintFormat_ID,Name)
KeyNamePair drillRule = drillRules[j];
+ //[AD_PrintFormat_ID,Name]
KeyNamePair[] printFormats = isDrillProcessRule ? drillReportCtl.getDrillProcessRulesPrintFormatMap(drillRule.getKey()) : new KeyNamePair[] {drillRule} ;
// create new Print Format
@@ -376,7 +407,10 @@ public class WDrillReport extends Window implements EventListener {
return table;
}
-
+ /**
+ * @param drillTable KeyNamePair(AD_Process_ID,Process Name)
+ * @return KeyNamePair(AD_PrintFormat_ID,Name)
+ */
private KeyNamePair findTablePrintFormat(KeyNamePair drillTable) {
Integer printFormatID = new Query(Env.getCtx(), MPrintFormat.Table_Name, " AD_Table_ID = ? AND AD_Client_ID IN (0,?) ", null)
@@ -385,7 +419,12 @@ public class WDrillReport extends Window implements EventListener {
return new KeyNamePair((printFormatID != null && printFormatID > 0) ? printFormatID : 0, drillTable.getName());
}
-
+ /**
+ * Link for process in drillTables
+ * @param tabIndex
+ * @param drillTables [AD_Process_ID,Process Name]
+ * @return {@link Table}
+ */
private Table getTablesBox(int tabIndex, KeyNamePair[] drillTables)
{
Table table = new Table();
@@ -436,6 +475,17 @@ public class WDrillReport extends Window implements EventListener {
return table;
}
+ /**
+ * Link and description for print format.
+ * @param drillPrintFormat KeyNamePair(AD_PrintFormat_ID,Name)
+ * @param reportIndex
+ * @param formatIndex
+ * @param groupIndex
+ * @param drillTable KeyNamePair(AD_Process_ID,Name)
+ * @param drillRule KeyNamePair(AD_Process_DrillRule_ID,Name)
+ * @param isSinglePrintFormat
+ * @return {@link Tr}
+ */
private Tr getPrintFormatBox(KeyNamePair drillPrintFormat, int reportIndex, int formatIndex, int groupIndex, KeyNamePair drillTable, KeyNamePair drillRule, boolean isSinglePrintFormat)
{
@@ -451,7 +501,6 @@ public class WDrillReport extends Window implements EventListener {
H4 h4 = new H4();
h4.appendChild(new Text(drillPrintFormat.getName()));
-
td.appendChild(h4);
a = new A();
a.setHref("#"+winpref+"Rep"+reportIndex+"-"+groupIndex);
@@ -459,8 +508,6 @@ public class WDrillReport extends Window implements EventListener {
a.appendChild(new Text(".."));
td.appendChild(a);
-
-
td = new Td();
td.setStyle("width: 10%");
tr.appendChild(td);
@@ -495,7 +542,6 @@ public class WDrillReport extends Window implements EventListener {
}
}
-
td = new Td();
td.setStyle("width: 60");
tr.appendChild(td);
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/WProcessCtl.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/WProcessCtl.java
index c407f590d7..1a881f2289 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/WProcessCtl.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/WProcessCtl.java
@@ -40,7 +40,8 @@ import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
/**
- * Ported from org.compiere.apps.ProcessCtl
+ * Zk client controller for execution of process.
+ *
* @author hengsin
* @contributor red1 IDEMPIERE-1711 with final review by Hengsin
*
@@ -50,25 +51,28 @@ public class WProcessCtl extends AbstractProcessCtl {
/** Logger */
private static final CLogger log = CLogger.getCLogger(WProcessCtl.class);
+ /**
+ * Call {@link #process(int, ProcessInfo, Trx, EventListener)}
+ * @param WindowNo
+ * @param pi
+ * @param trx
+ */
public static void process (int WindowNo, ProcessInfo pi, Trx trx)
{
process(WindowNo, pi, trx, null);
}
/**
- * Process Control
- *
- * - Get Instance ID
- * - Get Parameters
- * - execute (lock - start process - unlock)
- *
- * Creates a ProcessCtl instance, which calls
- * lockUI and unlockUI if parent is a ASyncProcess
- *
- *
- * @param WindowNo window no
- * @param pi ProcessInfo process info
- * @param trx Transaction
+ * Open ProcessModalDialog to run process.
+ *
+ * - Create and save {@link MPInstance} if no pi.AD_PInstance_ID.
+ * - Use {@link ProcessModalDialog} to capture process parameters and run process.
+ *
+ *
+ * @param WindowNo window no
+ * @param pi ProcessInfo process info
+ * @param trx Transaction
+ * @param listener listener for {@link ProcessModalDialog}
*/
public static void process (int WindowNo, ProcessInfo pi, Trx trx, EventListener listener)
{
@@ -104,7 +108,6 @@ public class WProcessCtl extends AbstractProcessCtl {
ProcessModalDialog para = new ProcessModalDialog(listener, WindowNo, pi, false);
if (para.isValid())
{
- //para.setWidth("500px");
para.setVisible(true);
Object window = SessionManager.getAppDesktop().findWindow(WindowNo);
@@ -116,7 +119,7 @@ public class WProcessCtl extends AbstractProcessCtl {
parent.hideMask();
}
});
- }else if (window != null && window instanceof Component){
+ } else if (window != null && window instanceof Component){
final Mask mask = LayoutUtils.showWindowWithMask(para, (Component)window, null);
para.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener() {
@Override
@@ -124,7 +127,7 @@ public class WProcessCtl extends AbstractProcessCtl {
mask.hideMask();
}
});
- }else{
+ } else {
para.setPosition("center");
para.setAttribute(Window.MODE_KEY, Window.MODE_HIGHLIGHTED);
AEnv.showWindow(para);
@@ -134,57 +137,54 @@ public class WProcessCtl extends AbstractProcessCtl {
} // execute
/**
- * Async Process - Do it all.
- *
- * - Get Instance ID
- * - Get Parameters
- * - execute (lock - start process - unlock)
- *
- * Creates a ProcessCtl instance, which calls
- * lockUI and unlockUI if parent is a ASyncProcess
- *
- * Called from ProcessDialog.actionPerformed
+ * Save parameters and execute process.
+ *
+ * - Create and save {@link MPInstance} if no pi.AD_PInstance_ID.
+ * - Call parameter.saveParameters ({@link IProcessParameter#saveParameters()}) to save process parameters.
+ * - Save pi.getRecord_IDs() to T_Selections ({@link DB#createT_Selection(int, java.util.Collection, String)}).
+ * - Call {@link WProcessCtl#run()} to execute process.
+ *
*
- * @param aProcessUI ASyncProcess and Container
+ * @param aProcessUI {@link IProcessUI}
* @param WindowNo window no
* @param parameter Process Parameter Panel
- * @param pi ProcessInfo process info
+ * @param pi {@link ProcessInfo}
* @param trx Transaction
*/
public static void process(IProcessUI aProcessUI, int WindowNo, IProcessParameter parameter, ProcessInfo pi, Trx trx)
{
- if (log.isLoggable(Level.FINE)) log.fine("WindowNo=" + WindowNo + " - " + pi);
+ if (log.isLoggable(Level.FINE)) log.fine("WindowNo=" + WindowNo + " - " + pi);
- MPInstance instance = null;
- if (pi.getAD_PInstance_ID() < 1) { //red1 bypass if PInstance exists
- try
- {
- instance = new MPInstance(Env.getCtx(), pi.getAD_Process_ID(), pi.getRecord_ID());
+ MPInstance instance = null;
+ if (pi.getAD_PInstance_ID() < 1) { //red1 bypass if PInstance exists
+ try
+ {
+ instance = new MPInstance(Env.getCtx(), pi.getAD_Process_ID(), pi.getRecord_ID());
+ }
+ catch (Exception e)
+ {
+ pi.setSummary (e.getLocalizedMessage());
+ pi.setError (true);
+ log.warning(pi.toString());
+ return;
+ }
+ catch (Error e)
+ {
+ pi.setSummary (e.getLocalizedMessage());
+ pi.setError (true);
+ log.warning(pi.toString());
+ return;
+ }
+ if (!instance.save())
+ {
+ pi.setSummary (Msg.getMsg(Env.getCtx(), "ProcessNoInstance"));
+ pi.setError (true);
+ return;
+ }
+ pi.setAD_PInstance_ID (instance.getAD_PInstance_ID());
+ } else {
+ instance = new MPInstance(Env.getCtx(), pi.getAD_PInstance_ID(), null);
}
- catch (Exception e)
- {
- pi.setSummary (e.getLocalizedMessage());
- pi.setError (true);
- log.warning(pi.toString());
- return;
- }
- catch (Error e)
- {
- pi.setSummary (e.getLocalizedMessage());
- pi.setError (true);
- log.warning(pi.toString());
- return;
- }
- if (!instance.save())
- {
- pi.setSummary (Msg.getMsg(Env.getCtx(), "ProcessNoInstance"));
- pi.setError (true);
- return;
- }
- pi.setAD_PInstance_ID (instance.getAD_PInstance_ID());
- } else {
- instance = new MPInstance(Env.getCtx(), pi.getAD_PInstance_ID(), null);
- }
// Get Parameters
if (parameter != null) {
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/WReport.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/WReport.java
index 9437d392b6..82629a423d 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/WReport.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/WReport.java
@@ -40,15 +40,15 @@ import org.zkoss.zul.Menuitem;
import org.zkoss.zul.Menupopup;
/**
- * Base on org.compiere.print.AReport
+ * Launch report for table (immediate or through popup menu, depends on number of print format discover
+ * for AD_Table_ID and AD_Window_ID).
* @author Low Heng Sin
*
*/
public class WReport implements EventListener {
/**
- * Constructor
- *
+ * Call {@link #WReport(int, MQuery, Component, int)}
* @param AD_Table_ID table
* @param query query
*/
@@ -58,11 +58,10 @@ public class WReport implements EventListener {
}
/**
- * Constructor
- *
+ * Call {@link #WReport(int, MQuery, Component, int, String)}
* @param AD_Table_ID table
* @param query query
- * @param parent The invoking parent window
+ * @param parent The invoking parent component
* @param WindowNo The invoking parent window number
*/
public WReport (int AD_Table_ID, MQuery query, Component parent,
@@ -72,7 +71,8 @@ public class WReport implements EventListener {
}
/**
- * Constructor
+ * Launch report immediately (if only one print format found) or show menu popup
+ * for the list of print formats discover for AD_Table_ID and AD_Window_ID (from WindowNo).
*
* @param AD_Table_ID table
* @param query query
@@ -103,25 +103,26 @@ public class WReport implements EventListener {
getPrintFormats (AD_Table_ID, AD_Window_ID);
} // AReport
- /** The Query */
+ /** Query parameter **/
private MQuery m_query;
+ /** menu popup to show the list of print formats discover **/
private Menupopup m_popup;
- /** The Option List */
+ /** List of KeyNamePair(AD_PrintFormat_ID,Name) **/
private List m_list = new ArrayList();
- /** Logger */
+ /** Logger **/
private static final CLogger log = CLogger.getCLogger(WReport.class);
- /** The parent window for locking/unlocking during process execution */
- Component parent;
- /** The parent window number */
- int WindowNo;
- /** The filter to apply to this report */
+ /** The invoking parent component **/
+ protected Component parent;
+ /** The parent window number **/
+ protected int WindowNo;
+ /** The filter to apply to this report **/
private String whereExtended;
/**
- * Get the Print Formats for the table.
- * Fill the list and the popup menu
+ * Get Print Formats for table and window.
+ * If there's only 1 print format found, call {@link #launchReport(KeyNamePair)}, otherwise call {@link #showPopup()}.
* @param AD_Table_ID table
- * @param invoker component to display popup (optional)
+ * @param AD_Window_ID
*/
private void getPrintFormats (int AD_Table_ID, int AD_Window_ID)
{
@@ -134,6 +135,9 @@ public class WReport implements EventListener {
showPopup(); // below button
} // getPrintFormats
+ /**
+ * Show popup menu for the list of print formats found.
+ */
private void showPopup() {
m_popup = new Menupopup();
for(int i = 0; i < m_list.size(); i++)
@@ -150,7 +154,7 @@ public class WReport implements EventListener {
/**
* Launch Report
- * @param pp Key=AD_PrintFormat_ID
+ * @param pp KeyNamePair(AD_PrintFormat_ID,Name)
*/
private void launchReport (KeyNamePair pp)
{
@@ -202,7 +206,7 @@ public class WReport implements EventListener {
}
} // launchReport
- /**************************************************************************
+ /**
* Get AD_Table_ID for Table Name
* @param tableName table name
* @return AD_Table_ID or 0
@@ -212,9 +216,11 @@ public class WReport implements EventListener {
return MTable.getTable_ID(tableName);
} // getAD_Table_ID
+ @Override
public void onEvent(Event event) {
if(event.getTarget() instanceof Menuitem)
{
+ //ON_CLICK event from showPopup() menu item.
Menuitem mi = (Menuitem) event.getTarget();
launchReport(m_list.get(Integer.parseInt(mi.getValue().toString())));
}