From 793b7f28f44b5d96ebabdfdc98ef2f18cc0abbf1 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Wed, 7 Apr 2010 10:17:14 +0000 Subject: [PATCH] Info window enhancement: * Info should be non-modal when not open as lookup ( that's how the swing client perform now ) * Layout refinement * Always open the progress indicator when running query * InfoProductPanel missing status bar * Don't show ok button when info is not open as lookup. The ok and cancel button behave the same when info is in non-lookup mode, confusing and unnecessary. Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=2983129 --- .../adempiere/webui/panel/InfoAssetPanel.java | 77 ++++++-- .../webui/panel/InfoAssignmentPanel.java | 74 +++++-- .../webui/panel/InfoBPartnerPanel.java | 82 +++++--- .../webui/panel/InfoCashLinePanel.java | 75 +++++-- .../webui/panel/InfoGeneralPanel.java | 72 +++++-- .../adempiere/webui/panel/InfoInOutPanel.java | 79 ++++++-- .../webui/panel/InfoInvoicePanel.java | 85 ++++++-- .../adempiere/webui/panel/InfoOrderPanel.java | 72 +++++-- .../org/adempiere/webui/panel/InfoPanel.java | 183 ++++++++++++++---- .../webui/panel/InfoPaymentPanel.java | 79 ++++++-- .../webui/panel/InfoProductPanel.java | 43 +++- .../adempiere/webui/panel/StatusBarPanel.java | 6 + 12 files changed, 723 insertions(+), 204 deletions(-) diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/panel/InfoAssetPanel.java b/zkwebui/WEB-INF/src/org/adempiere/webui/panel/InfoAssetPanel.java index 49b183ae7a..1c46119ec6 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/panel/InfoAssetPanel.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/panel/InfoAssetPanel.java @@ -42,7 +42,13 @@ import org.compiere.util.Env; import org.compiere.util.Msg; import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.Events; +import org.zkoss.zkex.zul.Borderlayout; +import org.zkoss.zkex.zul.Center; +import org.zkoss.zkex.zul.North; +import org.zkoss.zkex.zul.South; +import org.zkoss.zul.Div; import org.zkoss.zul.Separator; +import org.zkoss.zul.Vbox; /** * Based on InfoPayment written by Jorg Janke @@ -90,9 +96,26 @@ public class InfoAssetPanel extends InfoPanel implements ValueChangeListener, Ev private Label labelValue = new Label(); private Label labelName = new Label(); + private Borderlayout layout; + + private Vbox southBody; + /** * Standard Constructor + * @param WindowNo window no + * @param A_Asset_ID asset + * @param value Query Value or Name if enclosed in @ + * @param multiSelection multiple selections + * @param whereClause where clause + */ + public InfoAssetPanel( int WindowNo, int A_Asset_ID, String value, + boolean multiSelection, String whereClause) + { + this(WindowNo, A_Asset_ID, value, multiSelection, whereClause, true); + } + /** + * Standard Constructor * @param WindowNo window no * @param A_Asset_ID asset * @param value Query Value or Name if enclosed in @ @@ -101,9 +124,9 @@ public class InfoAssetPanel extends InfoPanel implements ValueChangeListener, Ev */ public InfoAssetPanel( int WindowNo, int A_Asset_ID, String value, - boolean multiSelection, String whereClause) + boolean multiSelection, String whereClause, boolean lookup) { - super (WindowNo, "a", "A_Asset_ID", multiSelection, whereClause); + super (WindowNo, "a", "A_Asset_ID", multiSelection, whereClause, lookup); log.info(value + ", ID=" + A_Asset_ID + ", WHERE=" + whereClause); setTitle(Msg.getMsg(Env.getCtx(), "InfoAsset")); @@ -166,20 +189,40 @@ public class InfoAssetPanel extends InfoPanel implements ValueChangeListener, Ev row.appendChild(fProduct_ID.getLabel().rightAlign()); row.appendChild(fProduct_ID.getComponent()); - contentPanel.setWidth("99%"); - contentPanel.setHeight("400px"); + layout = new Borderlayout(); + layout.setWidth("100%"); + layout.setHeight("100%"); + if (!isLookup()) + { + layout.setStyle("position: absolute"); + } + this.appendChild(layout); + + North north = new North(); + layout.appendChild(north); + north.appendChild(grid); + + Center center = new Center(); + layout.appendChild(center); + center.setFlex(true); + Div div = new Div(); + div.appendChild(contentPanel); + if (isLookup()) + contentPanel.setWidth("99%"); + else + contentPanel.setStyle("width: 99%; margin: 0px auto;"); contentPanel.setVflex(true); + div.setStyle("width :100%; height: 100%"); + center.appendChild(div); - this.setWidth("850px"); - this.setClosable(true); - this.setBorder("normal"); - this.appendChild(grid); - this.appendChild(new Separator()); - this.appendChild(contentPanel); - this.appendChild(new Separator()); - this.appendChild(confirmPanel); - this.appendChild(new Separator()); - this.appendChild(statusBar); + South south = new South(); + layout.appendChild(south); + southBody = new Vbox(); + southBody.setWidth("100%"); + south.appendChild(southBody); + southBody.appendChild(confirmPanel); + southBody.appendChild(new Separator()); + southBody.appendChild(statusBar); } /** @@ -402,4 +445,10 @@ public class InfoAssetPanel extends InfoPanel implements ValueChangeListener, Ev } } + @Override + protected void insertPagingComponent() + { + southBody.insertBefore(paging, southBody.getFirstChild()); + layout.invalidate(); + } } diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/panel/InfoAssignmentPanel.java b/zkwebui/WEB-INF/src/org/adempiere/webui/panel/InfoAssignmentPanel.java index 9ded6d2347..8508bf6560 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/panel/InfoAssignmentPanel.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/panel/InfoAssignmentPanel.java @@ -47,8 +47,13 @@ import org.compiere.util.Msg; import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.Events; +import org.zkoss.zkex.zul.Borderlayout; +import org.zkoss.zkex.zul.Center; +import org.zkoss.zkex.zul.North; +import org.zkoss.zkex.zul.South; import org.zkoss.zul.Div; import org.zkoss.zul.Separator; +import org.zkoss.zul.Vbox; /** * Based on InfoAssignment written by Jorg Janke @@ -77,6 +82,8 @@ public class InfoAssignmentPanel extends InfoPanel implements EventListener, Val private Label labelFrom = new Label(Msg.translate(Env.getCtx(), "DateFrom")); private Label labelTo = new Label(Msg.translate(Env.getCtx(), "DateTo")); + private Borderlayout layout; + private Vbox southBody; /** From Clause */ private static String s_assignmentFROM = @@ -106,12 +113,25 @@ public class InfoAssignmentPanel extends InfoPanel implements EventListener, Val * @param multiSelection multiple selection * @param whereClause where clause */ - public InfoAssignmentPanel (int WindowNo, String value, boolean multiSelection, String whereClause) + { + this(WindowNo, value, multiSelection, whereClause, true); + } + + /** + * Constructor + * + * @param WindowNo WindowNo + * @param value Query value Name or Value if contains numbers + * @param multiSelection multiple selection + * @param whereClause where clause + */ + public InfoAssignmentPanel (int WindowNo, + String value, boolean multiSelection, String whereClause, boolean lookup) { super (WindowNo, "ra", "S_ResourceAssignment_ID", - multiSelection, whereClause); + multiSelection, whereClause, lookup); log.info(value); setTitle(Msg.getMsg(Env.getCtx(), "InfoAssignment")); @@ -201,20 +221,40 @@ public class InfoAssignmentPanel extends InfoPanel implements EventListener, Val row.appendChild(div); row.appendChild(bNew); - contentPanel.setWidth("99%"); - contentPanel.setHeight("400px"); + layout = new Borderlayout(); + layout.setWidth("100%"); + layout.setHeight("100%"); + if (!isLookup()) + { + layout.setStyle("position: absolute"); + } + this.appendChild(layout); + + North north = new North(); + layout.appendChild(north); + north.appendChild(grid); + + Center center = new Center(); + layout.appendChild(center); + center.setFlex(true); + div = new Div(); + div.appendChild(contentPanel); + if (isLookup()) + contentPanel.setWidth("99%"); + else + contentPanel.setStyle("width: 99%; margin: 0px auto;"); contentPanel.setVflex(true); + div.setStyle("width :100%; height: 100%"); + center.appendChild(div); - this.setWidth("850px"); - this.setClosable(true); - this.setBorder("normal"); - this.appendChild(grid); - this.appendChild(new Separator()); - this.appendChild(contentPanel); - this.appendChild(new Separator()); - this.appendChild(confirmPanel); - this.appendChild(new Separator()); - this.appendChild(statusBar); + South south = new South(); + layout.appendChild(south); + southBody = new Vbox(); + southBody.setWidth("100%"); + south.appendChild(southBody); + southBody.appendChild(confirmPanel); + southBody.appendChild(new Separator()); + southBody.appendChild(statusBar); } /** @@ -391,7 +431,13 @@ public class InfoAssignmentPanel extends InfoPanel implements EventListener, Val public void tableChanged(WTableModelEvent event) { + } + @Override + protected void insertPagingComponent() + { + southBody.insertBefore(paging, southBody.getFirstChild()); + layout.invalidate(); } } diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/panel/InfoBPartnerPanel.java b/zkwebui/WEB-INF/src/org/adempiere/webui/panel/InfoBPartnerPanel.java index 73e7431e29..54036339c1 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/panel/InfoBPartnerPanel.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/panel/InfoBPartnerPanel.java @@ -42,8 +42,13 @@ import org.compiere.util.Msg; import org.compiere.util.Util; import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.Events; -import org.zkoss.zul.Intbox; +import org.zkoss.zkex.zul.Borderlayout; +import org.zkoss.zkex.zul.Center; +import org.zkoss.zkex.zul.North; +import org.zkoss.zkex.zul.South; +import org.zkoss.zul.Div; import org.zkoss.zul.Separator; +import org.zkoss.zul.Vbox; /** * Search Business Partner and return selection @@ -71,9 +76,9 @@ public class InfoBPartnerPanel extends InfoPanel implements EventListener, WTabl private Label lblEMail ; private Textbox fieldEMail; private Label lblPostal; - private Intbox fieldPostal; + private Textbox fieldPostal; private Label lblPhone; - private Intbox fieldPhone; + private Textbox fieldPhone; private Checkbox checkAND ; private Checkbox checkCustomer; @@ -85,6 +90,8 @@ public class InfoBPartnerPanel extends InfoPanel implements EventListener, WTabl /** Logger */ protected CLogger log = CLogger.getCLogger(getClass()); + private Borderlayout layout; + private Vbox southBody; /** From Clause */ private static String s_partnerFROM = "C_BPartner" @@ -118,7 +125,19 @@ public class InfoBPartnerPanel extends InfoPanel implements EventListener, WTabl */ public InfoBPartnerPanel(String queryValue,int windowNo, boolean isSOTrx,boolean multipleSelection, String whereClause) { - super (windowNo, "C_BPartner", "C_BPartner_ID",multipleSelection, whereClause); + this(queryValue, windowNo, isSOTrx, multipleSelection, whereClause, true); + } + + /** + * Standard Constructor + * @param queryvalue Query value Name or Value if contains numbers + * @param isSOTrx if false, query vendors only + * @param whereClause where clause + */ + public InfoBPartnerPanel(String queryValue,int windowNo, boolean isSOTrx,boolean multipleSelection, String whereClause, boolean lookup) + { + + super (windowNo, "C_BPartner", "C_BPartner_ID",multipleSelection, whereClause, lookup); setTitle(Msg.getMsg(Env.getCtx(), "InfoBPartner")); m_isSOTrx = isSOTrx; initComponents(); @@ -161,9 +180,9 @@ public class InfoBPartnerPanel extends InfoPanel implements EventListener, WTabl fieldContact.setMaxlength(40); fieldEMail = new Textbox(); fieldEMail.setMaxlength(40); - fieldPostal = new Intbox(); + fieldPostal = new Textbox(); fieldPostal.setMaxlength(40); - fieldPhone = new Intbox(); + fieldPhone = new Textbox(); fieldPhone.setMaxlength(40); checkAND = new Checkbox(); @@ -177,10 +196,6 @@ public class InfoBPartnerPanel extends InfoPanel implements EventListener, WTabl checkCustomer.setLabel(Msg.getMsg(Env.getCtx(), "OnlyCustomers")); else checkCustomer.setLabel(Msg.getMsg(Env.getCtx(), "OnlyVendors")); - - contentPanel.setWidth("99%"); - contentPanel.setHeight("400px"); - contentPanel.setVflex(true); } private void init() @@ -218,18 +233,41 @@ public class InfoBPartnerPanel extends InfoPanel implements EventListener, WTabl row.appendChild(fieldPostal); row.appendChild(checkAND); - this.appendChild(grid); - this.appendChild(new Separator()); - this.appendChild(contentPanel); - this.appendChild(new Separator()); - this.appendChild(confirmPanel); - this.appendChild(new Separator()); - this.appendChild(statusBar); - - this.setClosable(true); - this.setBorder("normal"); - this.setWidth("1000px"); - + layout = new Borderlayout(); + layout.setWidth("100%"); + layout.setHeight("100%"); + if (!isLookup()) + { + layout.setStyle("position: absolute"); + } + this.appendChild(layout); + + North north = new North(); + layout.appendChild(north); + north.appendChild(grid); + + Center center = new Center(); + layout.appendChild(center); + center.setFlex(true); + Div div = new Div(); + div.appendChild(contentPanel); + if (isLookup()) + contentPanel.setWidth("99%"); + else + contentPanel.setStyle("width: 99%; margin: 0px auto;"); + contentPanel.setVflex(true); + div.setStyle("width :100%; height: 100%"); + center.appendChild(div); + + South south = new South(); + layout.appendChild(south); + southBody = new Vbox(); + southBody.setWidth("100%"); + south.appendChild(southBody); + southBody.appendChild(confirmPanel); + southBody.appendChild(new Separator()); + southBody.appendChild(statusBar); + } /** diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/panel/InfoCashLinePanel.java b/zkwebui/WEB-INF/src/org/adempiere/webui/panel/InfoCashLinePanel.java index ccbf04c5cb..1af8ecd939 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/panel/InfoCashLinePanel.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/panel/InfoCashLinePanel.java @@ -46,8 +46,14 @@ import org.compiere.util.Msg; import org.compiere.util.Util; import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.Events; +import org.zkoss.zkex.zul.Borderlayout; +import org.zkoss.zkex.zul.Center; +import org.zkoss.zkex.zul.North; +import org.zkoss.zkex.zul.South; +import org.zkoss.zul.Div; import org.zkoss.zul.Hbox; import org.zkoss.zul.Separator; +import org.zkoss.zul.Vbox; /** * Based on InfoCashLine written by Jorg Janke @@ -84,6 +90,8 @@ public class InfoCashLinePanel extends InfoPanel implements ValueChangeListener, private Label lDateTo = new Label("-"); private Label lAmtFrom = new Label(Msg.translate(Env.getCtx(), "Amount")); private Label lAmtTo = new Label("-"); + private Borderlayout layout; + private Vbox southBody; /** Array of Column Info */ private static final ColumnInfo[] s_cashLayout = { @@ -122,11 +130,24 @@ public class InfoCashLinePanel extends InfoPanel implements ValueChangeListener, * @param multiSelection multiple selections * @param whereClause where clause */ - protected InfoCashLinePanel( int WindowNo, String value, boolean multiSelection, String whereClause) { - super (WindowNo, "cl", "C_CashLine_ID", multiSelection, whereClause); + this(WindowNo, value, multiSelection, whereClause, true); + } + + /** + * Detail Protected Constructor + * + * @param WindowNo window no + * @param value query value + * @param multiSelection multiple selections + * @param whereClause where clause + */ + protected InfoCashLinePanel( int WindowNo, String value, + boolean multiSelection, String whereClause, boolean lookup) + { + super (WindowNo, "cl", "C_CashLine_ID", multiSelection, whereClause, lookup); log.info( "InfoCashLine"); setTitle(Msg.getMsg(Env.getCtx(), "InfoCashLine")); @@ -227,20 +248,40 @@ public class InfoCashLinePanel extends InfoPanel implements ValueChangeListener, hbox.appendChild(fAmtTo); row.appendChild(hbox); - contentPanel.setWidth("99%"); - contentPanel.setHeight("400px"); + layout = new Borderlayout(); + layout.setWidth("100%"); + layout.setHeight("100%"); + if (!isLookup()) + { + layout.setStyle("position: absolute"); + } + this.appendChild(layout); + + North north = new North(); + layout.appendChild(north); + north.appendChild(grid); + + Center center = new Center(); + layout.appendChild(center); + center.setFlex(true); + Div div = new Div(); + div.appendChild(contentPanel); + if (isLookup()) + contentPanel.setWidth("99%"); + else + contentPanel.setStyle("width: 99%; margin: 0px auto;"); contentPanel.setVflex(true); + div.setStyle("width :100%; height: 100%"); + center.appendChild(div); - this.setWidth("850px"); - this.setClosable(true); - this.setBorder("normal"); - this.appendChild(grid); - this.appendChild(new Separator()); - this.appendChild(contentPanel); - this.appendChild(new Separator()); - this.appendChild(confirmPanel); - this.appendChild(new Separator()); - this.appendChild(statusBar); + South south = new South(); + layout.appendChild(south); + southBody = new Vbox(); + southBody.setWidth("100%"); + south.appendChild(southBody); + southBody.appendChild(confirmPanel); + southBody.appendChild(new Separator()); + southBody.appendChild(statusBar); } /** @@ -435,7 +476,13 @@ public class InfoCashLinePanel extends InfoPanel implements ValueChangeListener, public void tableChanged(WTableModelEvent event) { + } + @Override + protected void insertPagingComponent() + { + southBody.insertBefore(paging, southBody.getFirstChild()); + layout.invalidate(); } } diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/panel/InfoGeneralPanel.java b/zkwebui/WEB-INF/src/org/adempiere/webui/panel/InfoGeneralPanel.java index 36cf2947f5..635e571aca 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/panel/InfoGeneralPanel.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/panel/InfoGeneralPanel.java @@ -28,7 +28,6 @@ import java.util.logging.Level; import org.adempiere.webui.component.Grid; import org.adempiere.webui.component.GridFactory; import org.adempiere.webui.component.Label; -import org.adempiere.webui.component.Panel; import org.adempiere.webui.component.Row; import org.adempiere.webui.component.Rows; import org.adempiere.webui.component.Textbox; @@ -42,7 +41,13 @@ import org.compiere.util.Env; import org.compiere.util.Msg; import org.compiere.util.Util; import org.zkoss.zk.ui.event.EventListener; +import org.zkoss.zkex.zul.Borderlayout; +import org.zkoss.zkex.zul.Center; +import org.zkoss.zkex.zul.North; +import org.zkoss.zkex.zul.South; +import org.zkoss.zul.Div; import org.zkoss.zul.Separator; +import org.zkoss.zul.Vbox; /** * Zk Port @@ -73,6 +78,8 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener /** list of query columns (SQL) */ private ArrayList m_queryColumnsSql = new ArrayList(); + private Borderlayout layout; + private Vbox southBody; public InfoGeneralPanel(String queryValue, int windowNo,String tableName,String keyColumn, boolean isSOTrx, String whereClause) { @@ -85,6 +92,11 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener init(); initComponents(); + if (queryValue != null && queryValue.length() > 0) + { + txt1.setValue(queryValue); + } + p_loadedOK = initInfo (); } catch (Exception e) @@ -124,23 +136,40 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener row.appendChild(lbl4.rightAlign()); row.appendChild(txt4); - Panel mainPanel = new Panel(); - mainPanel.setWidth("100%"); - mainPanel.appendChild(grid); + layout = new Borderlayout(); + layout.setWidth("100%"); + layout.setHeight("100%"); + if (!isLookup()) + { + layout.setStyle("position: absolute"); + } + this.appendChild(layout); + + North north = new North(); + layout.appendChild(north); + north.appendChild(grid); - mainPanel.appendChild(new Separator()); - mainPanel.appendChild(contentPanel); - mainPanel.appendChild(new Separator()); - mainPanel.appendChild(confirmPanel); - // Elaine 2008/12/15 - mainPanel.appendChild(new Separator()); - mainPanel.appendChild(statusBar); - // + Center center = new Center(); + layout.appendChild(center); + center.setFlex(true); + Div div = new Div(); + div.appendChild(contentPanel); + if (isLookup()) + contentPanel.setWidth("99%"); + else + contentPanel.setStyle("width: 99%; margin: 0px auto;"); + contentPanel.setVflex(true); + div.setStyle("width :100%; height: 100%"); + center.appendChild(div); - this.appendChild(mainPanel); - this.setClosable(true); - this.setBorder("normal"); - this.setWidth("900px"); + South south = new South(); + layout.appendChild(south); + southBody = new Vbox(); + southBody.setWidth("100%"); + south.appendChild(southBody); + southBody.appendChild(confirmPanel); + southBody.appendChild(new Separator()); + southBody.appendChild(statusBar); } private void init() @@ -154,10 +183,6 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener lbl2 = new Label(); lbl3 = new Label(); lbl4 = new Label(); - - contentPanel.setWidth("99%"); - contentPanel.setHeight("400px"); - contentPanel.setVflex(true); } private boolean initInfo () @@ -437,7 +462,12 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener public void tableChanged(WTableModelEvent event) { - // TODO Auto-generated method stub + } + @Override + protected void insertPagingComponent() + { + southBody.insertBefore(paging, southBody.getFirstChild()); + layout.invalidate(); } } diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/panel/InfoInOutPanel.java b/zkwebui/WEB-INF/src/org/adempiere/webui/panel/InfoInOutPanel.java index 9aadffc61e..1dcffd74de 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/panel/InfoInOutPanel.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/panel/InfoInOutPanel.java @@ -46,8 +46,14 @@ import org.compiere.util.Msg; import org.compiere.util.Util; import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.Events; +import org.zkoss.zkex.zul.Borderlayout; +import org.zkoss.zkex.zul.Center; +import org.zkoss.zkex.zul.North; +import org.zkoss.zkex.zul.South; +import org.zkoss.zul.Div; import org.zkoss.zul.Hbox; import org.zkoss.zul.Separator; +import org.zkoss.zul.Vbox; /** * Based on InfoInOut written by Jorg Janke @@ -86,6 +92,10 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev private Label lDateFrom = new Label(Msg.translate(Env.getCtx(), "MovementDate")); private Label lDateTo = new Label("-"); + private Vbox southBody; + + private Borderlayout layout; + /** Array of Column Info */ private static final ColumnInfo[] s_invoiceLayout = { new ColumnInfo(" ", "i.M_InOut_ID", IDColumn.class), @@ -105,11 +115,24 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev * @param multiSelection multiple selections * @param whereClause where clause */ - protected InfoInOutPanel( int WindowNo, String value, boolean multiSelection, String whereClause) { - super (WindowNo, "i", "M_InOut_ID", multiSelection, whereClause); + this(WindowNo, value, multiSelection, whereClause, true); + } + + /** + * Detail Protected Constructor + * + * @param WindowNo window no + * @param value query value + * @param multiSelection multiple selections + * @param whereClause where clause + */ + protected InfoInOutPanel( int WindowNo, String value, + boolean multiSelection, String whereClause, boolean lookup) + { + super (WindowNo, "i", "M_InOut_ID", multiSelection, whereClause, lookup); log.info( "InfoInOut"); setTitle(Msg.getMsg(Env.getCtx(), "InfoInOut")); @@ -192,20 +215,40 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev row.appendChild(fPOReference); row.appendChild(new Label()); - contentPanel.setWidth("99%"); - contentPanel.setHeight("400px"); - contentPanel.setVflex(true); + layout = new Borderlayout(); + layout.setWidth("100%"); + layout.setHeight("100%"); + if (!isLookup()) + { + layout.setStyle("position: absolute"); + } + this.appendChild(layout); - this.setWidth("850px"); - this.setClosable(true); - this.setBorder("normal"); - this.appendChild(grid); - this.appendChild(new Separator()); - this.appendChild(contentPanel); - this.appendChild(new Separator()); - this.appendChild(confirmPanel); - this.appendChild(new Separator()); - this.appendChild(statusBar); + North north = new North(); + layout.appendChild(north); + north.appendChild(grid); + + Center center = new Center(); + layout.appendChild(center); + center.setFlex(true); + Div div = new Div(); + div.appendChild(contentPanel); + if (isLookup()) + contentPanel.setWidth("99%"); + else + contentPanel.setStyle("width: 99%; margin: 0px auto;"); + contentPanel.setVflex(true); + div.setStyle("width :100%; height: 100%"); + center.appendChild(div); + + South south = new South(); + layout.appendChild(south); + southBody = new Vbox(); + southBody.setWidth("100%"); + south.appendChild(southBody); + southBody.appendChild(confirmPanel); + southBody.appendChild(new Separator()); + southBody.appendChild(statusBar); } /** @@ -386,4 +429,10 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev { } + + @Override + protected void insertPagingComponent() { + southBody.insertBefore(paging, southBody.getFirstChild()); + layout.invalidate(); + } } \ No newline at end of file diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/panel/InfoInvoicePanel.java b/zkwebui/WEB-INF/src/org/adempiere/webui/panel/InfoInvoicePanel.java index b78c5f1c8e..7030ff0193 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/panel/InfoInvoicePanel.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/panel/InfoInvoicePanel.java @@ -30,7 +30,6 @@ import org.adempiere.webui.component.Grid; import org.adempiere.webui.component.GridFactory; import org.adempiere.webui.component.Label; import org.adempiere.webui.component.NumberBox; -import org.adempiere.webui.component.Panel; import org.adempiere.webui.component.Row; import org.adempiere.webui.component.Rows; import org.adempiere.webui.component.Textbox; @@ -49,8 +48,14 @@ import org.compiere.util.KeyNamePair; import org.compiere.util.Msg; import org.compiere.util.Util; import org.zkoss.zk.ui.WrongValueException; +import org.zkoss.zkex.zul.Borderlayout; +import org.zkoss.zkex.zul.Center; +import org.zkoss.zkex.zul.North; +import org.zkoss.zkex.zul.South; +import org.zkoss.zul.Div; import org.zkoss.zul.Hbox; import org.zkoss.zul.Separator; +import org.zkoss.zul.Vbox; /** * Search Invoice and return selection @@ -80,7 +85,21 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener protected InfoInvoicePanel(int WindowNo, String value, boolean multiSelection, String whereClause) { - super ( WindowNo, "i", "C_Invoice_ID", multiSelection, whereClause); + this(WindowNo, value, multiSelection, whereClause, true); + } + + /** + * Detail protected constructor + * @param WindowNo window no + * @param value query value + * @param multiSelection multiple selection + * @param whereClause where clause + * + */ + protected InfoInvoicePanel(int WindowNo, String value, + boolean multiSelection, String whereClause, boolean lookup) + { + super ( WindowNo, "i", "C_Invoice_ID", multiSelection, whereClause, lookup); setTitle(Msg.getMsg(Env.getCtx(), "InfoInvoice")); // @@ -119,6 +138,8 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener private Checkbox isSoTrx; private Checkbox isPaid; + private Borderlayout layout; + private Vbox southBody; /** Array of Column Info */ private static final ColumnInfo[] s_invoiceLayout = { @@ -172,10 +193,6 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener editorOrder = new WSearchEditor(lookupOrder, Msg.translate( Env.getCtx(), "C_Order_ID"), "", false, false, true); editorOrder.addValueChangeListener(this); - - contentPanel.setWidth("99%"); - contentPanel.setHeight("400px"); - contentPanel.setVflex(true); } private void init() @@ -225,20 +242,40 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener hbox.appendChild(amountTo); row.appendChild(hbox); - Panel mainPanel = new Panel(); - mainPanel.setWidth("100%"); - mainPanel.appendChild(grid); - mainPanel.appendChild(new Separator()); - mainPanel.appendChild(contentPanel); - mainPanel.appendChild(new Separator()); - mainPanel.appendChild(confirmPanel); - mainPanel.appendChild(new Separator()); - mainPanel.appendChild(statusBar); + layout = new Borderlayout(); + layout.setWidth("100%"); + layout.setHeight("100%"); + if (!isLookup()) + { + layout.setStyle("position: absolute"); + } + this.appendChild(layout); + + North north = new North(); + layout.appendChild(north); + north.appendChild(grid); + + Center center = new Center(); + layout.appendChild(center); + center.setFlex(true); + Div div = new Div(); + div.appendChild(contentPanel); + if (isLookup()) + contentPanel.setWidth("99%"); + else + contentPanel.setStyle("width: 99%; margin: 0px auto;"); + contentPanel.setVflex(true); + div.setStyle("width :100%; height: 100%"); + center.appendChild(div); - this.appendChild(mainPanel); - this.setClosable(true); - this.setBorder("normal"); - this.setWidth("850px"); + South south = new South(); + layout.appendChild(south); + southBody = new Vbox(); + southBody.setWidth("100%"); + south.appendChild(southBody); + southBody.appendChild(confirmPanel); + southBody.appendChild(new Separator()); + southBody.appendChild(statusBar); } /** @@ -526,7 +563,8 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener } @Override - protected void saveSelectionDetail() { + protected void saveSelectionDetail() + { // publish for Callout to read Integer ID = getSelectedRowKey(); Env.setContext(Env.getCtx(), p_WindowNo, Env.TAB_INFO, "C_Invoice_ID", ID == null ? "0" : ID.toString()); @@ -544,4 +582,11 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener else Env.setContext(Env.getCtx(), p_WindowNo, Env.TAB_INFO, "C_InvoicePaySchedule_ID", String.valueOf(C_InvoicePaySchedule_ID)); } + + @Override + protected void insertPagingComponent() + { + southBody.insertBefore(paging, southBody.getFirstChild()); + layout.invalidate(); + } } diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/panel/InfoOrderPanel.java b/zkwebui/WEB-INF/src/org/adempiere/webui/panel/InfoOrderPanel.java index e11249c505..952148cf4b 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/panel/InfoOrderPanel.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/panel/InfoOrderPanel.java @@ -30,7 +30,6 @@ import org.adempiere.webui.component.Grid; import org.adempiere.webui.component.GridFactory; import org.adempiere.webui.component.Label; import org.adempiere.webui.component.NumberBox; -import org.adempiere.webui.component.Panel; import org.adempiere.webui.component.Row; import org.adempiere.webui.component.Rows; import org.adempiere.webui.component.Textbox; @@ -48,8 +47,14 @@ import org.compiere.util.Env; import org.compiere.util.Msg; import org.compiere.util.Util; import org.zkoss.zk.ui.WrongValueException; +import org.zkoss.zkex.zul.Borderlayout; +import org.zkoss.zkex.zul.Center; +import org.zkoss.zkex.zul.North; +import org.zkoss.zkex.zul.South; +import org.zkoss.zul.Div; import org.zkoss.zul.Hbox; import org.zkoss.zul.Separator; +import org.zkoss.zul.Vbox; /** * Search Order info and return selection @@ -87,6 +92,8 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener private WSearchEditor editorBPartner; private Checkbox isSoTrx; + private Borderlayout layout; + private Vbox southBody; /** Array of Column Info */ private static final ColumnInfo[] s_invoiceLayout = { @@ -105,7 +112,13 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener protected InfoOrderPanel(int WindowNo, String value, boolean multiSelection, String whereClause) { - super ( WindowNo, "o", "C_Order_ID", multiSelection, whereClause); + this(WindowNo, value, multiSelection, whereClause, true); + } + + protected InfoOrderPanel(int WindowNo, String value, + boolean multiSelection, String whereClause, boolean lookup) + { + super ( WindowNo, "o", "C_Order_ID", multiSelection, whereClause, lookup); log.info( "InfoOrder"); setTitle(Msg.getMsg(Env.getCtx(), "InfoOrder")); // @@ -160,9 +173,6 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener Env.getCtx(), "C_BPartner_ID"), "", true, false, true); editorBPartner.addValueChangeListener(this); - contentPanel.setWidth("99%"); - contentPanel.setHeight("400px"); - contentPanel.setVflex(true); } public void init() @@ -212,20 +222,40 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener hbox.appendChild(amountTo); row.appendChild(hbox); - Panel mainPanel = new Panel(); - mainPanel.setWidth("100%"); - mainPanel.appendChild(grid); - mainPanel.appendChild(new Separator()); - mainPanel.appendChild(contentPanel); - mainPanel.appendChild(new Separator()); - mainPanel.appendChild(confirmPanel); - mainPanel.appendChild(new Separator()); - mainPanel.appendChild(statusBar); + layout = new Borderlayout(); + layout.setWidth("100%"); + layout.setHeight("100%"); + if (!isLookup()) + { + layout.setStyle("position: absolute"); + } + this.appendChild(layout); + + North north = new North(); + layout.appendChild(north); + north.appendChild(grid); + + Center center = new Center(); + layout.appendChild(center); + center.setFlex(true); + Div div = new Div(); + div.appendChild(contentPanel); + if (isLookup()) + contentPanel.setWidth("99%"); + else + contentPanel.setStyle("width: 99%; margin: 0px auto;"); + contentPanel.setVflex(true); + div.setStyle("width :100%; height: 100%"); + center.appendChild(div); - this.appendChild(mainPanel); - this.setClosable(true); - this.setBorder("normal"); - this.setWidth("850px"); + South south = new South(); + layout.appendChild(south); + southBody = new Vbox(); + southBody.setWidth("100%"); + south.appendChild(southBody); + southBody.appendChild(confirmPanel); + southBody.appendChild(new Separator()); + southBody.appendChild(statusBar); } /** @@ -504,4 +534,10 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener } + @Override + protected void insertPagingComponent() + { + southBody.insertBefore(paging, southBody.getFirstChild()); + layout.invalidate(); + } } diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/panel/InfoPanel.java b/zkwebui/WEB-INF/src/org/adempiere/webui/panel/InfoPanel.java index d5ec4d15a8..f610f5a608 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/panel/InfoPanel.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/panel/InfoPanel.java @@ -31,6 +31,7 @@ import java.util.Vector; import java.util.logging.Level; import org.adempiere.webui.apps.AEnv; +import org.adempiere.webui.apps.BusyDialog; import org.adempiere.webui.component.ConfirmPanel; import org.adempiere.webui.component.ListModelTable; import org.adempiere.webui.component.WListItemRenderer; @@ -40,6 +41,8 @@ import org.adempiere.webui.event.ValueChangeEvent; import org.adempiere.webui.event.ValueChangeListener; import org.adempiere.webui.event.WTableModelEvent; import org.adempiere.webui.event.WTableModelListener; +import org.adempiere.webui.part.ITabOnSelectHandler; +import org.adempiere.webui.session.SessionManager; import org.compiere.minigrid.ColumnInfo; import org.compiere.minigrid.IDColumn; import org.compiere.model.MRole; @@ -49,10 +52,13 @@ import org.compiere.util.DB; import org.compiere.util.Env; import org.compiere.util.KeyNamePair; import org.compiere.util.Msg; +import org.zkoss.zk.au.out.AuEcho; import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.Events; +import org.zkoss.zk.ui.util.Clients; import org.zkoss.zul.ListModelExt; +import org.zkoss.zul.Listitem; import org.zkoss.zul.Paging; import org.zkoss.zul.event.ZulEvents; @@ -68,10 +74,11 @@ import org.zkoss.zul.event.ZulEvents; */ public abstract class InfoPanel extends Window implements EventListener, WTableModelListener, ListModelExt { + /** - * + * generated serial version ID */ - private static final long serialVersionUID = 2961293943433626554L; + private static final long serialVersionUID = 325050327514511004L; private final static int PAGE_SIZE = 100; public static InfoPanel create (int WindowNo, @@ -121,9 +128,9 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM */ public static void showBPartner (int WindowNo) { - InfoBPartnerPanel infoBPanel = new InfoBPartnerPanel ( "", WindowNo, - !Env.getContext(Env.getCtx(),"IsSOTrx").equals("N"),false, ""); - AEnv.showWindow(infoBPanel); + InfoBPartnerPanel info = new InfoBPartnerPanel ( "", WindowNo, + !Env.getContext(Env.getCtx(),"IsSOTrx").equals("N"),false, "", false); + AEnv.showWindow(info); } // showBPartner /** @@ -133,7 +140,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM */ public static void showAsset (int WindowNo) { - InfoPanel info = new InfoAssetPanel (WindowNo, 0, "", false, ""); + InfoPanel info = new InfoAssetPanel (WindowNo, 0, "", false, "", false); AEnv.showWindow(info); } // showBPartner @@ -147,7 +154,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM InfoPanel info = new InfoProductPanel(WindowNo, Env.getContextAsInt(Env.getCtx(), WindowNo, "M_Warehouse_ID"), Env.getContextAsInt(Env.getCtx(), WindowNo, "M_PriceList_ID"), - false, "", ""); + false, "", "", false); AEnv.showWindow(info); } // showProduct @@ -159,7 +166,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM */ public static void showOrder (int WindowNo, String value) { - InfoPanel info = new InfoOrderPanel(WindowNo, "", false, ""); + InfoPanel info = new InfoOrderPanel(WindowNo, "", false, "", false); AEnv.showWindow(info); } // showOrder @@ -171,7 +178,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM */ public static void showInvoice (int WindowNo, String value) { - InfoPanel info = new InfoInvoicePanel(WindowNo, "", false, ""); + InfoPanel info = new InfoInvoicePanel(WindowNo, "", false, "", false); AEnv.showWindow(info); } // showInvoice @@ -184,7 +191,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM public static void showInOut (int WindowNo, String value) { InfoPanel info = new InfoInOutPanel (WindowNo, value, - false, ""); + false, "", false); AEnv.showWindow(info); } // showInOut @@ -197,7 +204,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM public static void showPayment (int WindowNo, String value) { InfoPanel info = new InfoPaymentPanel (WindowNo, value, - false, ""); + false, "", false); AEnv.showWindow(info); } // showPayment @@ -210,7 +217,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM public static void showCashLine (int WindowNo, String value) { InfoPanel info = new InfoCashLinePanel (WindowNo, value, - false, ""); + false, "", false); AEnv.showWindow(info); } // showCashLine @@ -223,12 +230,13 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM public static void showAssignment (int WindowNo, String value) { InfoPanel info = new InfoAssignmentPanel (WindowNo, value, - false, ""); + false, "", false); AEnv.showWindow(info); } // showAssignment /** Window Width */ static final int INFO_WIDTH = 800; + private boolean m_lookup; /************************************************** * Detail Constructor @@ -241,12 +249,27 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM String tableName, String keyColumn,boolean multipleSelection, String whereClause) { + this(WindowNo, tableName, keyColumn, multipleSelection, whereClause, true); + } + /************************************************** + * Detail Constructor + * @param WindowNo WindowNo + * @param tableName tableName + * @param keyColumn keyColumn + * @param whereClause whereClause + */ + protected InfoPanel (int WindowNo, + String tableName, String keyColumn,boolean multipleSelection, + String whereClause, boolean lookup) + { + log.info("WinNo=" + p_WindowNo + " " + whereClause); p_WindowNo = WindowNo; p_tableName = tableName; p_keyColumn = keyColumn; p_multipleSelection = multipleSelection; + m_lookup = lookup; if (whereClause == null || whereClause.indexOf('@') == -1) p_whereClause = whereClause; @@ -258,10 +281,35 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM } init(); + this.setAttribute(ITabOnSelectHandler.ATTRIBUTE_KEY, new ITabOnSelectHandler() { + public void onSelect() { + scrollToSelectedRow(); + } + }); } // InfoPanel private void init() { + if (isLookup()) + { + setAttribute(Window.MODE_KEY, Window.MODE_MODAL); + setBorder("normal"); + setClosable(true); + int height = SessionManager.getAppDesktop().getClientInfo().desktopHeight * 85 / 100; + int width = SessionManager.getAppDesktop().getClientInfo().desktopWidth * 80 / 100; + setWidth(width + "px"); + setHeight(height + "px"); + this.setContentStyle("overflow: auto"); + } + else + { + setAttribute(Window.MODE_KEY, Window.MODE_EMBEDDED); + setBorder("none"); + setWidth("100%"); + setHeight("100%"); + setStyle("position: absolute"); + } + confirmPanel = new ConfirmPanel(true, true, false, true, true, true); // Elaine 2008/12/16 confirmPanel.addActionListener(Events.ON_CLICK, this); confirmPanel.setStyle("border-top: 2px groove #444; padding-top: 4px"); @@ -269,8 +317,12 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM // Elaine 2008/12/16 confirmPanel.getButton(ConfirmPanel.A_CUSTOMIZE).setVisible(hasCustomize()); confirmPanel.getButton(ConfirmPanel.A_HISTORY).setVisible(hasHistory()); - confirmPanel.getButton(ConfirmPanel.A_ZOOM).setVisible(hasZoom()); + confirmPanel.getButton(ConfirmPanel.A_ZOOM).setVisible(hasZoom()); // + if (!isLookup()) + { + confirmPanel.getButton(ConfirmPanel.A_OK).setVisible(false); + } this.setSizable(true); this.setMaximizable(true); @@ -329,6 +381,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM private int cacheStart; private int cacheEnd; private boolean m_useDatabasePaging = false; + private BusyDialog progressWindow; private static final String[] lISTENER_EVENTS = {}; @@ -349,7 +402,6 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM public void setStatusLine (String text, boolean error) { statusBar.setStatusLine(text, error); - Thread.yield(); } // setStatusLine /** @@ -367,7 +419,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM String orderBy) { String sql =contentPanel.prepareTable(layout, from, - where,p_multipleSelection, + where,p_multipleSelection && !m_lookup, getTableName(),false); p_layout = contentPanel.getLayout(); m_sqlMain = sql; @@ -376,15 +428,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM m_sqlOrder = ""; m_sqlUserOrder = ""; if (orderBy != null && orderBy.length() > 0) - m_sqlOrder = " ORDER BY " + orderBy; - - int p = from.indexOf(" "); - String tableName = p > 0 ? from.substring(0, p) : from; - MTable table = MTable.get(Env.getCtx(), tableName); - if (table != null) - { - m_useDatabasePaging = table.isHighVolume(); - } + m_sqlOrder = " ORDER BY " + orderBy; } // prepareTable @@ -397,9 +441,10 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM cacheStart = -1; cacheEnd = -1; + testCount(); + m_useDatabasePaging = (m_count > 1000); if (m_useDatabasePaging) - { - testCount(); + { return ; } else @@ -507,12 +552,6 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM } } - if (!testCount()) - { - line = new ArrayList(); - return line; - } - cacheStart = start + 1 - (PAGE_SIZE * 4); if (cacheStart <= 0) cacheStart = 1; @@ -557,6 +596,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM m_pstmt = DB.prepareStatement(dataSql, null); setParameters (m_pstmt, false); // no count log.fine("Start query - " + (System.currentTimeMillis()-startTime) + "ms"); + m_pstmt.setFetchSize(100); m_rs = m_pstmt.executeQuery(); log.fine("End query - " + (System.currentTimeMillis()-startTime) + "ms"); //skips the row that we dont need if we can't use native db paging @@ -710,7 +750,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM */ protected Integer getSelectedRowKey() { - int key = contentPanel.getSelectedRowKey(); + Integer key = contentPanel.getSelectedRowKey(); return key; } // getSelectedRowKey @@ -988,12 +1028,12 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM } else if (event.getTarget() == contentPanel && event.getName().equals(Events.ON_DOUBLE_CLICK)) { - onOk(); + onDoubleClick(); } else if (event.getTarget().equals(confirmPanel.getButton(ConfirmPanel.A_REFRESH))) { - executeQuery(); - renderItems(); + showBusyDialog(); + Clients.response(new AuEcho(this, "onQueryCallback", null)); } else if (event.getTarget().equals(confirmPanel.getButton(ConfirmPanel.A_CANCEL))) { @@ -1021,7 +1061,8 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM if (!contentPanel.getChildren().isEmpty() && contentPanel.getSelectedRowKey()!=null) { zoom(); - this.detach(); + if (isLookup()) + this.detach(); } } else if (event.getTarget() == paging) @@ -1047,11 +1088,35 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM //default else { - executeQuery(); - renderItems(); + showBusyDialog(); + Clients.response(new AuEcho(this, "onQueryCallback", null)); } } } // onEvent + + private void showBusyDialog() { + progressWindow = new BusyDialog(); + progressWindow.setPage(this.getPage()); + progressWindow.doHighlighted(); + } + + private void hideBusyDialog() { + progressWindow.dispose(); + progressWindow = null; + } + + public void onQueryCallback() + { + try + { + executeQuery(); + renderItems(); + } + finally + { + hideBusyDialog(); + } + } private void onOk() { @@ -1061,6 +1126,19 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM } } + private void onDoubleClick() + { + if (isLookup()) + { + dispose(true); + } + else + { + zoom(); + } + + } + public void tableChanged(WTableModelEvent event) { enableButtons(); @@ -1076,7 +1154,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM } else { - int recordId = contentPanel.getSelectedRowKey(); + Integer recordId = contentPanel.getSelectedRowKey(); int AD_Table_ID = MTable.getTable_ID(p_tableName); if (AD_Table_ID <= 0) { @@ -1117,8 +1195,14 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM m_ok = ok; // End Worker - saveSelection(); - this.detach(); + if (isLookup()) + { + saveSelection(); + } + if (Window.MODE_EMBEDDED.equals(getAttribute(Window.MODE_KEY))) + SessionManager.getAppDesktop().closeActiveWindow(); + else + this.detach(); } // dispose public void sort(Comparator cmpr, boolean ascending) { @@ -1179,5 +1263,18 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM } } + public boolean isLookup() + { + return m_lookup; + } + public void scrollToSelectedRow() + { + if (contentPanel != null && contentPanel.getSelectedIndex() >= 0) { + Listitem selected = contentPanel.getItemAtIndex(contentPanel.getSelectedIndex()); + if (selected != null) { + selected.focus(); + } + } + } } // Info diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/panel/InfoPaymentPanel.java b/zkwebui/WEB-INF/src/org/adempiere/webui/panel/InfoPaymentPanel.java index 8938d1d521..def9b15e4d 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/panel/InfoPaymentPanel.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/panel/InfoPaymentPanel.java @@ -47,8 +47,14 @@ import org.compiere.util.Msg; import org.compiere.util.Util; import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.Events; +import org.zkoss.zkex.zul.Borderlayout; +import org.zkoss.zkex.zul.Center; +import org.zkoss.zkex.zul.North; +import org.zkoss.zkex.zul.South; +import org.zkoss.zul.Div; import org.zkoss.zul.Hbox; import org.zkoss.zul.Separator; +import org.zkoss.zul.Vbox; /** * Based on InfoPayment written by Jorg Janke @@ -83,6 +89,8 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener, private Label lDateTo = new Label("-"); private Label lAmtFrom = new Label(Msg.translate(Env.getCtx(), "PayAmt")); private Label lAmtTo = new Label("-"); + private Borderlayout layout; + private Vbox southBody; /** Array of Column Info */ private static final ColumnInfo[] s_paymentLayout = { @@ -120,11 +128,25 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener, * @param multiSelection multiple selections * @param whereClause where clause */ - protected InfoPaymentPanel(int WindowNo, String value, boolean multiSelection, String whereClause) { - super(WindowNo, "p", "C_Payment_ID", multiSelection, whereClause); + this(WindowNo, value, multiSelection, whereClause, true); + } + + /** + * Detail Protected Constructor + * + * @param modal modal + * @param WindowNo window no + * @param value query value + * @param multiSelection multiple selections + * @param whereClause where clause + */ + protected InfoPaymentPanel(int WindowNo, String value, + boolean multiSelection, String whereClause, boolean lookup) + { + super(WindowNo, "p", "C_Payment_ID", multiSelection, whereClause, lookup); log.info( "InfoPaymentPanel"); setTitle(Msg.getMsg(Env.getCtx(), "InfoPayment")); @@ -208,20 +230,40 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener, hbox.appendChild(fAmtTo); row.appendChild(hbox); - contentPanel.setWidth("99%"); - contentPanel.setHeight("400px"); + layout = new Borderlayout(); + layout.setWidth("100%"); + layout.setHeight("100%"); + if (!isLookup()) + { + layout.setStyle("position: absolute"); + } + this.appendChild(layout); + + North north = new North(); + layout.appendChild(north); + north.appendChild(grid); + + Center center = new Center(); + layout.appendChild(center); + center.setFlex(true); + Div div = new Div(); + div.appendChild(contentPanel); + if (isLookup()) + contentPanel.setWidth("99%"); + else + contentPanel.setStyle("width: 99%; margin: 0px auto;"); contentPanel.setVflex(true); + div.setStyle("width :100%; height: 100%"); + center.appendChild(div); - this.setWidth("850px"); - this.setClosable(true); - this.setBorder("normal"); - this.appendChild(grid); - this.appendChild(new Separator()); - this.appendChild(contentPanel); - this.appendChild(new Separator()); - this.appendChild(confirmPanel); - this.appendChild(new Separator()); - this.appendChild(statusBar); + South south = new South(); + layout.appendChild(south); + southBody = new Vbox(); + southBody.setWidth("100%"); + south.appendChild(southBody); + southBody.appendChild(confirmPanel); + southBody.appendChild(new Separator()); + southBody.appendChild(statusBar); } /** @@ -418,8 +460,15 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener, } } - public void tableChanged(WTableModelEvent event) { + public void tableChanged(WTableModelEvent event) + { + } + @Override + protected void insertPagingComponent() + { + southBody.insertBefore(paging, southBody.getFirstChild()); + layout.invalidate(); } } diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/panel/InfoProductPanel.java b/zkwebui/WEB-INF/src/org/adempiere/webui/panel/InfoProductPanel.java index c9c1e607c5..2bee77a99d 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/panel/InfoProductPanel.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/panel/InfoProductPanel.java @@ -173,7 +173,22 @@ public class InfoProductPanel extends InfoPanel implements EventListener int M_Warehouse_ID, int M_PriceList_ID, boolean multipleSelection,String value, String whereClause) { - super (windowNo, "p", "M_Product_ID",multipleSelection, whereClause); + this(windowNo, M_Warehouse_ID, M_PriceList_ID, multipleSelection, value, whereClause, true); + } + + /** + * Standard Constructor + * @param WindowNo window no + * @param M_Warehouse_ID warehouse + * @param M_PriceList_ID price list + * @param value Query Value or Name if enclosed in @ + * @param whereClause where clause + */ + public InfoProductPanel(int windowNo, + int M_Warehouse_ID, int M_PriceList_ID, boolean multipleSelection,String value, + String whereClause, boolean lookup) + { + super (windowNo, "p", "M_Product_ID",multipleSelection, whereClause, lookup); log.info(value + ", Wh=" + M_Warehouse_ID + ", PL=" + M_PriceList_ID + ", WHERE=" + whereClause); setTitle(Msg.getMsg(Env.getCtx(), "InfoProduct")); // @@ -272,7 +287,6 @@ public class InfoProductPanel extends InfoPanel implements EventListener fieldVendor = new Textbox(); fieldVendor.setMaxlength(40); - contentPanel.setWidth("99%"); contentPanel.setVflex(true); } // initComponents @@ -313,6 +327,12 @@ public class InfoProductPanel extends InfoPanel implements EventListener row.appendChild(lblAS.rightAlign()); row.appendChild(pickAS); + row = new Row(); + rows.appendChild(row); + row.appendChild(statusBar); + row.setSpans("6"); + statusBar.setEastVisibility(false); + // Product Attribute Instance m_PAttributeButton = confirmPanel.createButton(ConfirmPanel.A_PATTRIBUTE); confirmPanel.addComponentsLeft(m_PAttributeButton); @@ -426,7 +446,10 @@ public class InfoProductPanel extends InfoPanel implements EventListener borderlayout.setWidth("100%"); borderlayout.setHeight("100%"); - borderlayout.setStyle("border: none; position: relative"); + if (isLookup()) + borderlayout.setStyle("border: none; position: relative"); + else + borderlayout.setStyle("border: none; position: absolute"); Center center = new Center(); center.setAutoscroll(true); center.setFlex(true); @@ -455,13 +478,17 @@ public class InfoProductPanel extends InfoPanel implements EventListener south = new South(); mainPanel.appendChild(south); south.appendChild(confirmPanel); + if (!isLookup()) + { + mainPanel.setStyle("position: absolute"); + } this.appendChild(mainPanel); - this.setClosable(true); - this.setBorder("normal"); - - this.setWidth(width + "px"); - this.setHeight(height + "px"); + if (isLookup()) + { + this.setWidth(width + "px"); + this.setHeight(height + "px"); + } contentPanel.addActionListener(new EventListener() { public void onEvent(Event event) throws Exception { diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/panel/StatusBarPanel.java b/zkwebui/WEB-INF/src/org/adempiere/webui/panel/StatusBarPanel.java index 4b8424f031..8f8ecae14a 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/panel/StatusBarPanel.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/panel/StatusBarPanel.java @@ -316,5 +316,11 @@ public class StatusBarPanel extends Panel implements EventListener, IStatusBar popup.detach(); } + /** + * @param visible + */ + public void setEastVisibility(boolean visible) { + east.setVisible(visible); + } }