From 5dec4b17c07dbb2e259256fb9e81ed88cbeefef3 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Sun, 7 Dec 2008 00:34:55 +0000 Subject: [PATCH] Regression : Cancel button of form doesn't work. Generate Invoice(Manual) & Generate Shipment(Manual) - fixed can't select multiple, improve parameter panel layout. --- .../src/org/adempiere/webui/Desktop.java | 2 +- .../adempiere/webui/apps/form/WInOutGen.java | 27 ++++++---- .../webui/apps/form/WInvoiceGen.java | 24 +++++---- .../webui/component/ListModelTable.java | 6 +-- .../webui/component/WListItemRenderer.java | 50 +------------------ 5 files changed, 37 insertions(+), 72 deletions(-) diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/Desktop.java b/zkwebui/WEB-INF/src/org/adempiere/webui/Desktop.java index c76b74ff47..9952b1e64b 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/Desktop.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/Desktop.java @@ -936,7 +936,7 @@ public class Desktop extends AbstractUIPart implements MenuListener, Serializabl Tabpanel panel = (Tabpanel) windowContainer.getSelectedTab().getLinkedPanel(); Component component = panel.getFirstChild(); Object att = component.getAttribute(WINDOWNO_ATTRIBUTE); - if (att != null && (att instanceof Integer)) + if ( windowContainer.closeActiveWindow() ) { if (att != null && (att instanceof Integer)) diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/apps/form/WInOutGen.java b/zkwebui/WEB-INF/src/org/adempiere/webui/apps/form/WInOutGen.java index 7ccf135f73..9cc1e8a37d 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/apps/form/WInOutGen.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/apps/form/WInOutGen.java @@ -27,10 +27,12 @@ import org.adempiere.webui.LayoutUtils; import org.adempiere.webui.apps.AEnv; import org.adempiere.webui.component.ConfirmPanel; import org.adempiere.webui.component.DesktopTabpanel; +import org.adempiere.webui.component.GridFactory; import org.adempiere.webui.component.Label; import org.adempiere.webui.component.Listbox; import org.adempiere.webui.component.ListboxFactory; -import org.adempiere.webui.component.Panel; +import org.adempiere.webui.component.Grid; +import org.adempiere.webui.component.Row; import org.adempiere.webui.component.Tab; import org.adempiere.webui.component.Tabbox; import org.adempiere.webui.component.Tabpanels; @@ -102,6 +104,8 @@ public class WInOutGen extends ADForm implements EventListener, ValueChangeListe south.appendChild(statusBar); LayoutUtils.addSclass("status-border", statusBar); south.setHeight("22px"); + + executeQuery(); } catch(Exception ex) { @@ -117,7 +121,7 @@ public class WInOutGen extends ADForm implements EventListener, ValueChangeListe // private Tabbox tabbedPane = new Tabbox(); private Borderlayout selPanel = new Borderlayout(); - private Panel selNorthPanel = new Panel(); + private Grid selNorthPanel = GridFactory.newGridLayout(); private Label lWarehouse = new Label(); private WTableDirEditor fWarehouse; private Label lBPartner = new Label(); @@ -171,12 +175,13 @@ public class WInOutGen extends ADForm implements EventListener, ValueChangeListe North north = new North(); selPanel.appendChild(north); north.appendChild(selNorthPanel); - selNorthPanel.appendChild(lWarehouse); - selNorthPanel.appendChild(fWarehouse.getComponent()); - selNorthPanel.appendChild(new Space()); - selNorthPanel.appendChild(lBPartner); - selNorthPanel.appendChild(fBPartner.getComponent()); - selNorthPanel.appendChild(new Space()); + Row row = selNorthPanel.newRows().newRow(); + row.appendChild(lWarehouse.rightAlign()); + row.appendChild(fWarehouse.getComponent()); + row.appendChild(new Space()); + row.appendChild(lBPartner.rightAlign()); + row.appendChild(fBPartner.getComponent()); + row.appendChild(new Space()); South south = new South(); selPanel.appendChild(south); @@ -207,8 +212,10 @@ public class WInOutGen extends ADForm implements EventListener, ValueChangeListe south.appendChild(confirmPanelGen); confirmPanelGen.addActionListener(this); - selNorthPanel.appendChild(lDocType); - selNorthPanel.appendChild(cmbDocType); + row = new Row(); + selNorthPanel.getRows().appendChild(row); + row.appendChild(lDocType.rightAlign()); + row.appendChild(cmbDocType); } // jbInit /** diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/apps/form/WInvoiceGen.java b/zkwebui/WEB-INF/src/org/adempiere/webui/apps/form/WInvoiceGen.java index 8077ff37e7..0f84210fdd 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/apps/form/WInvoiceGen.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/apps/form/WInvoiceGen.java @@ -31,10 +31,12 @@ import org.adempiere.webui.LayoutUtils; import org.adempiere.webui.apps.AEnv; import org.adempiere.webui.component.ConfirmPanel; import org.adempiere.webui.component.DesktopTabpanel; +import org.adempiere.webui.component.Grid; +import org.adempiere.webui.component.GridFactory; import org.adempiere.webui.component.Label; import org.adempiere.webui.component.Listbox; import org.adempiere.webui.component.ListboxFactory; -import org.adempiere.webui.component.Panel; +import org.adempiere.webui.component.Row; import org.adempiere.webui.component.Tab; import org.adempiere.webui.component.Tabbox; import org.adempiere.webui.component.Tabpanels; @@ -138,7 +140,7 @@ public class WInvoiceGen extends ADForm // private Tabbox tabbedPane = new Tabbox(); private Borderlayout selPanel = new Borderlayout(); - private Panel selNorthPanel = new Panel(); + private Grid selNorthPanel = GridFactory.newGridLayout(); private Label lOrg = new Label(); private WTableDirEditor fOrg; private Label lBPartner = new Label(); @@ -188,12 +190,12 @@ public class WInvoiceGen extends ADForm North north = new North(); selPanel.appendChild(north); north.appendChild(selNorthPanel); - selNorthPanel.appendChild(lOrg); - selNorthPanel.appendChild(fOrg.getComponent()); - selNorthPanel.appendChild(new Space()); - selNorthPanel.appendChild(lBPartner); - selNorthPanel.appendChild(fBPartner.getComponent()); - selNorthPanel.appendChild(new Space()); + Row row = selNorthPanel.newRows().newRow(); + row.appendChild(lOrg.rightAlign()); + row.appendChild(fOrg.getComponent()); + row.appendChild(lBPartner.rightAlign()); + row.appendChild(fBPartner.getComponent()); + row.appendChild(new Space()); South south = new South(); selPanel.appendChild(south); @@ -225,8 +227,10 @@ public class WInvoiceGen extends ADForm south.appendChild(confirmPanelGen); confirmPanelGen.addActionListener(this); - selNorthPanel.appendChild(lDocType); - selNorthPanel.appendChild(cmbDocType); + row = new Row(); + selNorthPanel.getRows().appendChild(row); + row.appendChild(lDocType.rightAlign()); + row.appendChild(cmbDocType); } // jbInit /** diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/component/ListModelTable.java b/zkwebui/WEB-INF/src/org/adempiere/webui/component/ListModelTable.java index 53831fb0b4..e1db0fc18c 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/component/ListModelTable.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/component/ListModelTable.java @@ -244,14 +244,14 @@ public class ListModelTable extends ListModelList implements ListModelExt * Set the number of rows in the table and initialise new rows. * For each new row, an empty collection of the size specified by * {@link #setNoColumns(int)} is created. - * Please note that the number of rows in a table cannot be decreased. * @param rowCount The number of rows to be contained in the table */ public void setNoRows(int rowCount) { List newRow = null; - if (rowCount >= getSize()) + int currentSize = getSize(); + if (rowCount >= currentSize) { boolean vector = (getInnerList() instanceof Vector) ? true : false; while (getSize() < rowCount) @@ -275,7 +275,7 @@ public class ListModelTable extends ListModelList implements ListModelExt } else { - throw new IllegalArgumentException("The ListModelTable cannot be shrunk"); + removeRange(rowCount, currentSize); } } diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/component/WListItemRenderer.java b/zkwebui/WEB-INF/src/org/adempiere/webui/component/WListItemRenderer.java index f299e0b29a..ba149a3bf5 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/component/WListItemRenderer.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/component/WListItemRenderer.java @@ -38,14 +38,12 @@ import org.zkoss.zk.ui.Component; 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.event.SelectEvent; import org.zkoss.zul.Decimalbox; import org.zkoss.zul.Listbox; import org.zkoss.zul.Listcell; import org.zkoss.zul.Listitem; import org.zkoss.zul.ListitemRenderer; import org.zkoss.zul.ListitemRendererExt; -import org.zkoss.zul.impl.NumberInputElement; /** * Renderer for {@link org.adempiere.webui.component.ListItems} @@ -61,7 +59,7 @@ public class WListItemRenderer implements ListitemRenderer, EventListener, Listi new ArrayList(); /** A list containing the indices of the currently selected ListItems. */ - private Set m_selectedItems = new HashSet(); + private Set m_selectedItems = new HashSet(); /** Array of table details. */ private ArrayList m_tableColumns = new ArrayList(); /** Array of {@link ListHeader}s for the list head. */ @@ -542,55 +540,11 @@ public class WListItemRenderer implements ListitemRenderer, EventListener, Listi int row = -1; Object value = null; TableValueChangeEvent vcEvent = null; - Set newlyUnselectedItems = new HashSet(); - Set newlySelectedItems = new HashSet(); WTableColumn tableColumn; Component source = event.getTarget(); - if (source instanceof WListbox) - { - if (event instanceof SelectEvent) - { - col = 0; - tableColumn = m_tableColumns.get(col); - - newlyUnselectedItems.addAll(m_selectedItems); - newlyUnselectedItems.removeAll(((SelectEvent)event).getSelectedItems()); - - newlySelectedItems.addAll(((SelectEvent)event).getSelectedItems()); - newlySelectedItems.removeAll(m_selectedItems); - - m_selectedItems.clear(); - m_selectedItems.addAll(((SelectEvent)event).getSelectedItems()); - - for (Object item : newlySelectedItems) - { - row =((ListItem)item).getIndex(); - value = Boolean.TRUE; - vcEvent = new TableValueChangeEvent(source, - tableColumn.getHeaderValue().toString(), - row, col, - value, value); - fireTableValueChange(vcEvent); - } - - - for (Object item : newlyUnselectedItems) - { - row =((ListItem)item).getIndex(); - value = Boolean.FALSE; - vcEvent = new TableValueChangeEvent(source, - tableColumn.getHeaderValue().toString(), - row, col, - value, value); - - fireTableValueChange(vcEvent); - } - } - } - - else if (isWithinListCell(source)) + if (isWithinListCell(source)) { row = getRowPosition(source); col = getColumnPosition(source);