WGenForm must be declare as instance variable instead of static variable.

This commit is contained in:
Heng Sin Low 2011-02-16 12:11:56 +08:00
parent bc5fffb793
commit d31059cc6d
2 changed files with 37 additions and 37 deletions

View File

@ -44,12 +44,12 @@ import org.zkoss.zul.Space;
/** /**
* Generate Shipment (manual) view class * Generate Shipment (manual) view class
* *
*/ */
public class WInOutGen extends InOutGen implements IFormController, EventListener, ValueChangeListener public class WInOutGen extends InOutGen implements IFormController, EventListener, ValueChangeListener
{ {
private static WGenForm form; private WGenForm form;
/** Logger */ /** Logger */
private static CLogger log = CLogger.getCLogger(WInOutGen.class); private static CLogger log = CLogger.getCLogger(WInOutGen.class);
// //
@ -61,20 +61,20 @@ public class WInOutGen extends InOutGen implements IFormController, EventListene
private Listbox cmbDocType = ListboxFactory.newDropdownListbox(); private Listbox cmbDocType = ListboxFactory.newDropdownListbox();
private Label lDocAction = new Label(); private Label lDocAction = new Label();
private WTableDirEditor docAction; private WTableDirEditor docAction;
public WInOutGen() public WInOutGen()
{ {
log.info(""); log.info("");
form = new WGenForm(this); form = new WGenForm(this);
Env.setContext(Env.getCtx(), form.getWindowNo(), "IsSOTrx", "Y"); Env.setContext(Env.getCtx(), form.getWindowNo(), "IsSOTrx", "Y");
try try
{ {
super.dynInit(); super.dynInit();
dynInit(); dynInit();
zkInit(); zkInit();
form.postQueryEvent(); form.postQueryEvent();
} }
catch(Exception ex) catch(Exception ex)
@ -82,7 +82,7 @@ public class WInOutGen extends InOutGen implements IFormController, EventListene
log.log(Level.SEVERE, "init", ex); log.log(Level.SEVERE, "init", ex);
} }
} // init } // init
/** /**
* Static Init. * Static Init.
* <pre> * <pre>
@ -97,7 +97,7 @@ public class WInOutGen extends InOutGen implements IFormController, EventListene
void zkInit() throws Exception void zkInit() throws Exception
{ {
lBPartner.setText("BPartner"); lBPartner.setText("BPartner");
Row row = form.getParameterPanel().newRows().newRow(); Row row = form.getParameterPanel().newRows().newRow();
row.appendChild(lWarehouse.rightAlign()); row.appendChild(lWarehouse.rightAlign());
row.appendChild(fWarehouse.getComponent()); row.appendChild(fWarehouse.getComponent());
@ -105,7 +105,7 @@ public class WInOutGen extends InOutGen implements IFormController, EventListene
row.appendChild(lBPartner.rightAlign()); row.appendChild(lBPartner.rightAlign());
row.appendChild(fBPartner.getComponent()); row.appendChild(fBPartner.getComponent());
row.appendChild(new Space()); row.appendChild(new Space());
row = new Row(); row = new Row();
form.getParameterPanel().getRows().appendChild(row); form.getParameterPanel().getRows().appendChild(row);
row.appendChild(lDocType.rightAlign()); row.appendChild(lDocType.rightAlign());
@ -149,10 +149,10 @@ public class WInOutGen extends InOutGen implements IFormController, EventListene
cmbDocType.addItem(new KeyNamePair(MRMA.Table_ID, Msg.translate(Env.getCtx(), "VendorRMA"))); cmbDocType.addItem(new KeyNamePair(MRMA.Table_ID, Msg.translate(Env.getCtx(), "VendorRMA")));
cmbDocType.addActionListener(this); cmbDocType.addActionListener(this);
cmbDocType.setSelectedIndex(0); cmbDocType.setSelectedIndex(0);
form.getStatusBar().setStatusLine(Msg.getMsg(Env.getCtx(), "InOutGenerateSel"));//@@ form.getStatusBar().setStatusLine(Msg.getMsg(Env.getCtx(), "InOutGenerateSel"));//@@
} // fillPicks } // fillPicks
/** /**
* Query Info * Query Info
*/ */
@ -177,11 +177,11 @@ public class WInOutGen extends InOutGen implements IFormController, EventListene
form.postQueryEvent(); form.postQueryEvent();
return; return;
} }
// //
validate(); validate();
} // actionPerformed } // actionPerformed
public void validate() public void validate()
{ {
if (isSelectionActive() && getM_Warehouse_ID() <= 0) if (isSelectionActive() && getM_Warehouse_ID() <= 0)
@ -190,7 +190,7 @@ public class WInOutGen extends InOutGen implements IFormController, EventListene
} }
form.saveSelection(); form.saveSelection();
ArrayList<Integer> selection = getSelection(); ArrayList<Integer> selection = getSelection();
if (selection != null if (selection != null
&& selection.size() > 0 && selection.size() > 0
@ -220,17 +220,17 @@ public class WInOutGen extends InOutGen implements IFormController, EventListene
} }
form.postQueryEvent(); form.postQueryEvent();
} // vetoableChange } // vetoableChange
/************************************************************************** /**************************************************************************
* Generate Shipments * Generate Shipments
*/ */
public String generate() public String generate()
{ {
KeyNamePair docTypeKNPair = (KeyNamePair)cmbDocType.getSelectedItem().toKeyNamePair(); KeyNamePair docTypeKNPair = (KeyNamePair)cmbDocType.getSelectedItem().toKeyNamePair();
String docActionSelected = (String)docAction.getValue(); String docActionSelected = (String)docAction.getValue();
return generate(form.getStatusBar(), docTypeKNPair, docActionSelected); return generate(form.getStatusBar(), docTypeKNPair, docActionSelected);
} // generateShipments } // generateShipments
public ADForm getForm() public ADForm getForm()
{ {
return form; return form;

View File

@ -43,12 +43,12 @@ import org.zkoss.zul.Space;
/** /**
* Generate Invoice (manual) view class * Generate Invoice (manual) view class
* *
*/ */
public class WInvoiceGen extends InvoiceGen implements IFormController, EventListener, ValueChangeListener public class WInvoiceGen extends InvoiceGen implements IFormController, EventListener, ValueChangeListener
{ {
private static WGenForm form; private WGenForm form;
/** Logger */ /** Logger */
private static CLogger log = CLogger.getCLogger(WInOutGen.class); private static CLogger log = CLogger.getCLogger(WInOutGen.class);
// //
@ -60,20 +60,20 @@ public class WInvoiceGen extends InvoiceGen implements IFormController, EventLis
private Listbox cmbDocType = ListboxFactory.newDropdownListbox(); private Listbox cmbDocType = ListboxFactory.newDropdownListbox();
private Label lDocAction = new Label(); private Label lDocAction = new Label();
private WTableDirEditor docAction; private WTableDirEditor docAction;
public WInvoiceGen() public WInvoiceGen()
{ {
log.info(""); log.info("");
form = new WGenForm(this); form = new WGenForm(this);
Env.setContext(Env.getCtx(), form.getWindowNo(), "IsSOTrx", "Y"); Env.setContext(Env.getCtx(), form.getWindowNo(), "IsSOTrx", "Y");
try try
{ {
super.dynInit(); super.dynInit();
dynInit(); dynInit();
zkInit(); zkInit();
form.postQueryEvent(); form.postQueryEvent();
} }
catch(Exception ex) catch(Exception ex)
@ -81,7 +81,7 @@ public class WInvoiceGen extends InvoiceGen implements IFormController, EventLis
log.log(Level.SEVERE, "init", ex); log.log(Level.SEVERE, "init", ex);
} }
} // init } // init
/** /**
* Static Init. * Static Init.
* <pre> * <pre>
@ -97,7 +97,7 @@ public class WInvoiceGen extends InvoiceGen implements IFormController, EventLis
{ {
lOrg.setText(Msg.translate(Env.getCtx(), "AD_Org_ID")); lOrg.setText(Msg.translate(Env.getCtx(), "AD_Org_ID"));
lBPartner.setText("BPartner"); lBPartner.setText("BPartner");
Row row = form.getParameterPanel().newRows().newRow(); Row row = form.getParameterPanel().newRows().newRow();
row.appendChild(lOrg.rightAlign()); row.appendChild(lOrg.rightAlign());
row.appendChild(fOrg.getComponent()); row.appendChild(fOrg.getComponent());
@ -105,7 +105,7 @@ public class WInvoiceGen extends InvoiceGen implements IFormController, EventLis
row.appendChild(lBPartner.rightAlign()); row.appendChild(lBPartner.rightAlign());
row.appendChild(fBPartner.getComponent()); row.appendChild(fBPartner.getComponent());
row.appendChild(new Space()); row.appendChild(new Space());
row = new Row(); row = new Row();
form.getParameterPanel().getRows().appendChild(row); form.getParameterPanel().getRows().appendChild(row);
row.appendChild(lDocType.rightAlign()); row.appendChild(lDocType.rightAlign());
@ -140,17 +140,17 @@ public class WInvoiceGen extends InvoiceGen implements IFormController, EventLis
docAction = new WTableDirEditor("DocAction", true, false, true,docActionL); docAction = new WTableDirEditor("DocAction", true, false, true,docActionL);
docAction.setValue(DocAction.ACTION_Complete); docAction.setValue(DocAction.ACTION_Complete);
docAction.addValueChangeListener(this); docAction.addValueChangeListener(this);
// Document Type Sales Order/Vendor RMA // Document Type Sales Order/Vendor RMA
lDocType.setText(Msg.translate(Env.getCtx(), "C_DocType_ID")); lDocType.setText(Msg.translate(Env.getCtx(), "C_DocType_ID"));
cmbDocType.addItem(new KeyNamePair(MOrder.Table_ID, Msg.translate(Env.getCtx(), "Order"))); cmbDocType.addItem(new KeyNamePair(MOrder.Table_ID, Msg.translate(Env.getCtx(), "Order")));
cmbDocType.addItem(new KeyNamePair(MRMA.Table_ID, Msg.translate(Env.getCtx(), "CustomerRMA"))); cmbDocType.addItem(new KeyNamePair(MRMA.Table_ID, Msg.translate(Env.getCtx(), "CustomerRMA")));
cmbDocType.addActionListener(this); cmbDocType.addActionListener(this);
cmbDocType.setSelectedIndex(0); cmbDocType.setSelectedIndex(0);
form.getStatusBar().setStatusLine(Msg.getMsg(Env.getCtx(), "InvGenerateSel"));//@@ form.getStatusBar().setStatusLine(Msg.getMsg(Env.getCtx(), "InvGenerateSel"));//@@
} // fillPicks } // fillPicks
/** /**
* Query Info * Query Info
*/ */
@ -175,15 +175,15 @@ public class WInvoiceGen extends InvoiceGen implements IFormController, EventLis
form.postQueryEvent(); form.postQueryEvent();
return; return;
} }
// //
validate(); validate();
} // actionPerformed } // actionPerformed
public void validate() public void validate()
{ {
form.saveSelection(); form.saveSelection();
ArrayList<Integer> selection = getSelection(); ArrayList<Integer> selection = getSelection();
if (selection != null && selection.size() > 0 && isSelectionActive()) if (selection != null && selection.size() > 0 && isSelectionActive())
form.generate(); form.generate();
@ -207,17 +207,17 @@ public class WInvoiceGen extends InvoiceGen implements IFormController, EventLis
} }
form.postQueryEvent(); form.postQueryEvent();
} // vetoableChange } // vetoableChange
/************************************************************************** /**************************************************************************
* Generate Shipments * Generate Shipments
*/ */
public String generate() public String generate()
{ {
KeyNamePair docTypeKNPair = (KeyNamePair)cmbDocType.getSelectedItem().toKeyNamePair(); KeyNamePair docTypeKNPair = (KeyNamePair)cmbDocType.getSelectedItem().toKeyNamePair();
String docActionSelected = (String)docAction.getValue(); String docActionSelected = (String)docAction.getValue();
return generate(form.getStatusBar(), docTypeKNPair, docActionSelected); return generate(form.getStatusBar(), docTypeKNPair, docActionSelected);
} // generateShipments } // generateShipments
public ADForm getForm() public ADForm getForm()
{ {
return form; return form;