From 00a1907332ed464489307fa3ee01d612f731a7b3 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Wed, 22 Oct 2008 07:36:13 +0000 Subject: [PATCH] * Fixed minor Zk 3.5.1 compatibility issue. * Implement hide/show tab * Improve form and editor layout * Refactoring of editor --- .../WEB-INF/src/metainfo/zk/lang-addon.xml | 2 +- .../webui/component/ADButtonTabList.java | 5 + .../webui/component/AbstractADTab.java | 15 + .../webui/component/Combinationbox.java | 78 +----- .../adempiere/webui/component/EditorBox.java | 262 ++++++++++-------- .../webui/component/FilenameBox.java | 89 +----- .../org/adempiere/webui/component/IADTab.java | 81 +++++- .../webui/component/Locationbox.java | 93 +------ .../webui/component/PAttributebox.java | 73 +---- .../adempiere/webui/component/Searchbox.java | 93 +------ .../org/adempiere/webui/component/Urlbox.java | 78 +----- .../webui/editor/WAssignmentEditor.java | 4 +- .../adempiere/webui/editor/WSearchEditor.java | 2 +- .../org/adempiere/webui/panel/ADTabpanel.java | 26 +- .../adempiere/webui/window/FindWindow.java | 3 + .../webui/window/WPAttributeDialog.java | 4 +- 16 files changed, 333 insertions(+), 575 deletions(-) diff --git a/zkwebui/WEB-INF/src/metainfo/zk/lang-addon.xml b/zkwebui/WEB-INF/src/metainfo/zk/lang-addon.xml index 058b15d73b..a5817a028f 100644 --- a/zkwebui/WEB-INF/src/metainfo/zk/lang-addon.xml +++ b/zkwebui/WEB-INF/src/metainfo/zk/lang-addon.xml @@ -19,7 +19,7 @@ Copyright (C) 2007 Ashley G Ramdass (ADempiere WebUI). org.adempiere.webui.AdempiereWebUI - 0.1.1 + 0.2 diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/component/ADButtonTabList.java b/zkwebui/WEB-INF/src/org/adempiere/webui/component/ADButtonTabList.java index ea9ca22726..a5ddca007a 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/component/ADButtonTabList.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/component/ADButtonTabList.java @@ -61,9 +61,14 @@ public class ADButtonTabList extends Panel implements IADTabList, EventListener if (!tabbox.canNavigateTo(s, i)) { button.setDynamicProperty("disabled", "disabled"); button.setSclass("adwindow-navbtn-dis"); + if (!tabbox.isDisplay(i)) + button.setVisible(false); + else + button.setVisible(true); } else { button.setDynamicProperty("disabled", null); button.setSclass("adwindow-navbtn-uns"); + button.setVisible(true); } } diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/component/AbstractADTab.java b/zkwebui/WEB-INF/src/org/adempiere/webui/component/AbstractADTab.java index 1466887882..7a617f38d4 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/component/AbstractADTab.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/component/AbstractADTab.java @@ -130,6 +130,21 @@ public abstract class AbstractADTab extends AbstractUIPart implements IADTab protected abstract void doTabSelectionChanged(int oldIndex, int newIndex); + public boolean isDisplay(int index) { + if (index >= tabPanelList.size()) + return false; + + IADTabpanel newTab = tabPanelList.get(index); + if (newTab instanceof ADTabpanel) + { + if (!isDisplay(newTab)) + { + return false; + } + } + return true; + } + public boolean canNavigateTo(int fromIndex, int toIndex) { IADTabpanel newTab = tabPanelList.get(toIndex); if (newTab instanceof ADTabpanel) diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/component/Combinationbox.java b/zkwebui/WEB-INF/src/org/adempiere/webui/component/Combinationbox.java index cd0fd84f3e..35c562ecc9 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/component/Combinationbox.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/component/Combinationbox.java @@ -13,89 +13,27 @@ package org.adempiere.webui.component; -import org.adempiere.webui.LayoutUtils; -import org.adempiere.webui.apps.AEnv; -import org.zkoss.zk.ui.event.EventListener; -import org.zkoss.zul.Div; - /** * * @author Low Heng Sin * */ -public class Combinationbox extends Div +public class Combinationbox extends EditorBox { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - private Textbox textbox; - - private Button button; - - public Combinationbox() + public Combinationbox() { - initComponents(); + super(); } + /** + * @param url + */ public Combinationbox(String url) { - initComponents(); + super(); setText(url); } - - public void setButtonImage(String imageSrc) - { - button.setImage(imageSrc); - } - - private void initComponents() - { - textbox = new Textbox(); - button = new Button(); - LayoutUtils.addSclass("editor-button", button); - appendChild(textbox); - appendChild(button); - - String style = AEnv.isFirefox2() ? "display: inline" : "display: inline-block"; - style = style + ";white-space:nowrap"; - this.setStyle(style); - } - - public void setText(String value) - { - textbox.setText(value); - } - - public String getText() - { - return textbox.getText(); - } - - public void setEnabled(boolean enabled) - { - textbox.setReadonly(!enabled); - button.setEnabled(enabled); - } - - public boolean isEnabled() - { - return button.isEnabled(); - } - - public void setButtonEnabled(boolean enabled) - { - button.setEnabled(enabled); - } - - public boolean addEventListener(String evtnm, EventListener listener) - { - if ("onClick".equals(evtnm)) - return button.addEventListener(evtnm, listener); - else - return textbox.addEventListener(evtnm, listener); - } - - public void setToolTipText(String tooltiptext) { - textbox.setTooltiptext(tooltiptext); - } } \ No newline at end of file diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/component/EditorBox.java b/zkwebui/WEB-INF/src/org/adempiere/webui/component/EditorBox.java index adee14a046..581d88ade3 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/component/EditorBox.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/component/EditorBox.java @@ -1,111 +1,151 @@ -/****************************************************************************** - * Product: Posterita Ajax UI * - * Copyright (C) 2007 Posterita Ltd. All Rights Reserved. * - * This program is free software; you can redistribute it and/or modify it * - * under the terms version 2 of the GNU General Public License as published * - * by the Free Software Foundation. This program is distributed in the hope * - * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * See the GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along * - * with this program; if not, write to the Free Software Foundation, Inc., * - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * - * For the text or an alternative of this public license, you may reach us * - * Posterita Ltd., 3, Draper Avenue, Quatre Bornes, Mauritius * - * or via info@posterita.org or http://www.posterita.org/ * - *****************************************************************************/ - -package org.adempiere.webui.component; - -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; - -import org.adempiere.webui.LayoutUtils; -import org.adempiere.webui.apps.AEnv; -import org.zkoss.zk.ui.event.EventListener; - -/** - * Editor Box consists of a text box and a button. - * May be used instaed of SearchBox, LocationBox.... - * - * @author Niraj Sohun - * @date Jul 24, 2007 - */ - -public class EditorBox extends Panel -{ - - private static final long serialVersionUID = 1L; - - private PropertyChangeSupport m_propertyChangeListeners = new PropertyChangeSupport(this); - private Textbox txt; - private Button btn; - - public EditorBox() - { - initComponents(); - } - - public EditorBox(String text) - { - initComponents(); - setText(text); - } - - public void setButtonImage(String imageSrc) - { - btn.setImage(imageSrc); - } - - private void initComponents() - { - txt = new Textbox(); - txt.setStyle("display: inline;"); - btn = new Button(); - - this.appendChild(txt); - this.appendChild(btn); - - LayoutUtils.addSclass("editor-button", btn); - - String style = AEnv.isFirefox2() ? "display: inline" : "display: inline-block"; - style = style + ";white-space:nowrap"; - this.setStyle(style); - } - - public Textbox getTextBox() - { - return txt; - } - - public void setText(String value) - { - txt.setText(value); - } - - public String getText() - { - return txt.getText(); - } - - public void setEnabled(boolean enabled) - { - txt.setReadonly(enabled); - btn.setEnabled(enabled); - } - - public boolean isEnabled() - { - return txt.isReadonly(); - } - - public boolean addEventListener(String evtnm, EventListener listener) - { - return btn.addEventListener(evtnm, listener); - } - - public synchronized void addPropertyChangeListener(PropertyChangeListener l) - { - m_propertyChangeListeners.addPropertyChangeListener(l); - } -} \ No newline at end of file +/****************************************************************************** + * Copyright (C) 2008 Low Heng Sin * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + *****************************************************************************/ +package org.adempiere.webui.component; + +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; + +import org.adempiere.webui.LayoutUtils; +import org.adempiere.webui.apps.AEnv; +import org.zkoss.zk.ui.event.EventListener; +import org.zkoss.zk.ui.event.Events; + +/** + * @author Low Heng Sin + */ +public class EditorBox extends Grid { + private static final long serialVersionUID = 1L; + protected PropertyChangeSupport m_propertyChangeListeners = new PropertyChangeSupport( + this); + protected Textbox txt; + protected Button btn; + protected Column btnColumn; + + public EditorBox() { + initComponents(); + } + + /** + * @param text + */ + public EditorBox(String text) { + initComponents(); + setText(text); + } + + /** + * @param imageSrc + */ + public void setButtonImage(String imageSrc) { + btn.setImage(imageSrc); + } + + private void initComponents() { + this.makeNoStrip(); + this.setInnerWidth("100%"); + this.setFixedLayout(true); + this.setVflex(false); + + Columns cols = new Columns(); + this.appendChild(cols); + Column col = new Column(); + col.setWidth("auto"); + cols.appendChild(col); + btnColumn = new Column(); + btnColumn.setSclass("editor-button"); + btnColumn.setAlign("left"); + cols.appendChild(btnColumn); + + Rows rows = newRows(); + Row row = rows.newRow(); + txt = new Textbox(); + txt.setStyle("display: inline; width: 99%"); + btn = new Button(); + btn.setTabindex(-1); + LayoutUtils.addSclass("editor-button", btn); + row.appendChild(txt); + row.appendChild(btn); + + String style = AEnv.isFirefox2() ? "display: inline" + : "display: inline-block"; + style = style + + ";border: none; padding: 0px; background-color: transparent;"; + this.setStyle(style); + style = "white-space:nowrap; padding: 0px"; + row.setStyle(row.getStyle() + ";" + style); + } + + /** + * @return textbox component + */ + public Textbox getTextbox() { + return txt; + } + + /** + * @param value + */ + public void setText(String value) { + txt.setText(value); + } + + /** + * @return text + */ + public String getText() { + return txt.getText(); + } + + /** + * @param enabled + */ + public void setEnabled(boolean enabled) { + txt.setReadonly(!enabled); + btn.setEnabled(enabled); + btn.setVisible(enabled); + btnColumn.setVisible(enabled); + } + + /** + * @return boolean + */ + public boolean isEnabled() { + return txt.isReadonly(); + } + + /** + * @param evtnm + * @param listener + */ + public boolean addEventListener(String evtnm, EventListener listener) { + if (Events.ON_CLICK.equals(evtnm)) { + return btn.addEventListener(evtnm, listener); + } else { + return txt.addEventListener(evtnm, listener); + } + } + + /** + * @param l + */ + public synchronized void addPropertyChangeListener(PropertyChangeListener l) { + m_propertyChangeListeners.addPropertyChangeListener(l); + } + + /** + * @param tooltiptext + */ + public void setToolTipText(String tooltiptext) { + txt.setTooltiptext(tooltiptext); + } +} diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/component/FilenameBox.java b/zkwebui/WEB-INF/src/org/adempiere/webui/component/FilenameBox.java index 7b2d2637dc..fdb0fee0f1 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/component/FilenameBox.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/component/FilenameBox.java @@ -1,6 +1,5 @@ /****************************************************************************** - * Product: Posterita Ajax UI * - * Copyright (C) 2007 Posterita Ltd. All Rights Reserved. * + * Copyright (C) 2008 Low Heng Sin * * This program is free software; you can redistribute it and/or modify it * * under the terms version 2 of the GNU General Public License as published * * by the Free Software Foundation. This program is distributed in the hope * @@ -10,90 +9,30 @@ * You should have received a copy of the GNU General Public License along * * with this program; if not, write to the Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * - * For the text or an alternative of this public license, you may reach us * - * Posterita Ltd., 3, Draper Avenue, Quatre Bornes, Mauritius * - * or via info@posterita.org or http://www.posterita.org/ * *****************************************************************************/ - package org.adempiere.webui.component; -import org.adempiere.webui.LayoutUtils; -import org.adempiere.webui.apps.AEnv; -import org.zkoss.zk.ui.event.EventListener; - /** - * URL Box + * + * @author Low Heng Sin + * */ -public class FilenameBox extends Panel +public class FilenameBox extends EditorBox { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - private Textbox textbox; - - private Button button; - - public FilenameBox() + public FilenameBox() { - initComponents(); + super(); } - public FilenameBox(String url) + /** + * @param fileName + */ + public FilenameBox(String fileName) { - initComponents(); - setText(url); - } - - public void setButtonImage(String imageSrc) - { - button.setImage(imageSrc); - } - - private void initComponents() - { - textbox = new Textbox(); - textbox.setStyle("display: inline"); - button = new Button(); - LayoutUtils.addSclass("editor-button", button); - appendChild(textbox); - appendChild(button); - - String style = AEnv.isFirefox2() ? "display: inline" : "display: inline-block"; - style = style + ";white-space:nowrap"; - this.setStyle(style); - } - - public void setText(String value) - { - textbox.setText(value); - } - - public String getText() - { - return textbox.getText(); - } - - public void setEnabled(boolean enabled) - { - textbox.setReadonly(!enabled); - button.setEnabled(enabled); - } - - public boolean isEnabled() - { - return !textbox.isReadonly(); - } - - public void setButtonEnabled(boolean enabled) - { - button.setEnabled(enabled); - } - - public boolean addEventListener(String evtnm, EventListener listener) - { - if ("onClick".equals(evtnm)) - return button.addEventListener(evtnm, listener); - else - return textbox.addEventListener(evtnm, listener); + super(); + setText(fileName); } } \ No newline at end of file diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/component/IADTab.java b/zkwebui/WEB-INF/src/org/adempiere/webui/component/IADTab.java index 2ec5bf8511..f63017b1b9 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/component/IADTab.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/component/IADTab.java @@ -1,3 +1,15 @@ +/****************************************************************************** + * Copyright (C) 2008 Low Heng Sin * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + *****************************************************************************/ package org.adempiere.webui.component; import org.adempiere.webui.panel.IADTabpanel; @@ -14,28 +26,79 @@ import org.zkoss.zk.ui.event.EventListener; */ public interface IADTab extends UIPart { + /** + * + * @return selected tab index + */ public int getSelectedIndex(); + /** + * + * @param tab index + */ + public void setSelectedIndex(int i); + + /** + * @param oldTabIndex + * @param newTabIndex + * @return + */ + public boolean updateSelectedIndex(int oldTabIndex, int newTabIndex); + + /** + * @return selected tab panel reference + */ + public IADTabpanel getSelectedTabpanel(); + + /** + * + * @param fromIndex + * @param toIndex + * @return boolean + */ public boolean canNavigateTo(int fromIndex, int toIndex); + + /** + * @param index + * @return boolean + */ + public boolean isDisplay(int index); + /** + * + * @param tab + * @param tabPanel + */ public void addTab(GridTab tab, IADTabpanel tabPanel); - public void setSelectedIndex(int i); - + /** + * @return Number of tab + */ public int getTabCount(); + /** + * @param e + */ public void evaluate(DataStatusEvent e); - public boolean updateSelectedIndex(int oldTabIndex, int newTabIndex); - - public IADTabpanel getSelectedTabpanel(); - + /** + * @return path to the active tab + */ public String getPath(); - public void addSelectionEventListener( - EventListener listener); + /** + * + * @param listener + */ + public void addSelectionEventListener(EventListener listener); + /** + * @return tab selection component + */ public Component getTabSelectionComponent(); - public boolean isUseExternalSelection(); + /** + * @return boolean + */ + public boolean isUseExternalSelection(); } diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/component/Locationbox.java b/zkwebui/WEB-INF/src/org/adempiere/webui/component/Locationbox.java index 397c6d852e..202e101b2e 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/component/Locationbox.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/component/Locationbox.java @@ -1,6 +1,5 @@ /****************************************************************************** - * Product: Posterita Ajax UI * - * Copyright (C) 2007 Posterita Ltd. All Rights Reserved. * + * Copyright (C) 2008 Low Heng Sin * * This program is free software; you can redistribute it and/or modify it * * under the terms version 2 of the GNU General Public License as published * * by the Free Software Foundation. This program is distributed in the hope * @@ -10,94 +9,26 @@ * You should have received a copy of the GNU General Public License along * * with this program; if not, write to the Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * - * For the text or an alternative of this public license, you may reach us * - * Posterita Ltd., 3, Draper Avenue, Quatre Bornes, Mauritius * - * or via info@posterita.org or http://www.posterita.org/ * *****************************************************************************/ - package org.adempiere.webui.component; -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; - -import org.adempiere.webui.LayoutUtils; -import org.adempiere.webui.apps.AEnv; -import org.zkoss.zk.ui.event.EventListener; - -/** Location Editor component - * @author Sendy Yagambrum - * @date July 16, 2007 - **/ -public class Locationbox extends Panel +/** + * + * @author Low Heng Sin + * + */ +public class Locationbox extends EditorBox { - private static final long serialVersionUID = 1L; - private PropertyChangeSupport m_propertyChangeListeners = new PropertyChangeSupport(this); - private Textbox txt; - private Button btn; - - public Locationbox() + private static final long serialVersionUID = 1L; + + public Locationbox() { - initComponents(); + super(); } public Locationbox(String text) { - initComponents(); + super(); setText(text); } - - public void setButtonImage(String imageSrc) - { - btn.setImage(imageSrc); - } - - private void initComponents() - { - txt = new Textbox(); - txt.setStyle("display: inline"); - btn = new Button(); - LayoutUtils.addSclass("editor-button", btn); - this.appendChild(txt); - this.appendChild(btn); - - String style = AEnv.isFirefox2() ? "display: inline" : "display: inline-block"; - style = style + ";white-space:nowrap"; - this.setStyle(style); - } - - public Textbox getTextBox() - { - return txt; - } - - public void setText(String value) - { - txt.setText(value); - } - - public String getText() - { - return txt.getText(); - } - - public void setEnabled(boolean enabled) - { - txt.setReadonly(enabled); - btn.setEnabled(enabled); - } - - public boolean isEnabled() - { - return !txt.isReadonly(); - } - - public boolean addEventListener(String evtnm, EventListener listener) - { - return btn.addEventListener(evtnm, listener); - } - - public synchronized void addPropertyChangeListener(PropertyChangeListener l) - { - m_propertyChangeListeners.addPropertyChangeListener(l); - } } diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/component/PAttributebox.java b/zkwebui/WEB-INF/src/org/adempiere/webui/component/PAttributebox.java index 4cf8a63047..6bf525e0bb 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/component/PAttributebox.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/component/PAttributebox.java @@ -16,83 +16,26 @@ package org.adempiere.webui.component; -import org.adempiere.webui.LayoutUtils; -import org.adempiere.webui.apps.AEnv; -import org.zkoss.zk.ui.event.EventListener; - /** * Product Attribute Box * @author Low Heng Sin */ -public class PAttributebox extends Panel +public class PAttributebox extends EditorBox { - private static final long serialVersionUID = 1L; - - private Textbox textBox; - - private Button button; - + public PAttributebox() { - initComponents(); + super(); } - public PAttributebox(String description) + /** + * @param description + */ + public PAttributebox(String description) { - initComponents(); + super(); setText(description); } - public void setButtonImage(String imageSrc) - { - button.setImage(imageSrc); - } - - private void initComponents() - { - textBox = new Textbox(); - textBox.setStyle("display: inline"); - button = new Button(); - LayoutUtils.addSclass("editor-button", button); - appendChild(textBox); - appendChild(button); - - String style = AEnv.isFirefox2() ? "display: inline" : "display: inline-block"; - style = style + ";white-space:nowrap"; - this.setStyle(style + ";overflow: hidden"); - } - - public void setText(String value) - { - textBox.setText(value); - } - - public String getText() - { - return textBox.getText(); - } - - public void setEnabled(boolean enabled) - { - textBox.setReadonly(!enabled); - button.setEnabled(enabled); - } - - public void setButtonEnabled(boolean enabled) - { - button.setEnabled(enabled); - } - - public boolean addEventListener(String evtnm, EventListener listener) - { - if ("onClick".equals(evtnm)) - return button.addEventListener(evtnm, listener); - else - return textBox.addEventListener(evtnm, listener); - } - - public Textbox getTextbox() { - return textBox; - } } \ No newline at end of file diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/component/Searchbox.java b/zkwebui/WEB-INF/src/org/adempiere/webui/component/Searchbox.java index c4f72c7c66..b03ccb0837 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/component/Searchbox.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/component/Searchbox.java @@ -1,6 +1,5 @@ /****************************************************************************** - * Product: Posterita Ajax UI * - * Copyright (C) 2007 Posterita Ltd. All Rights Reserved. * + * Copyright (C) 2008 Low Heng Sin * * This program is free software; you can redistribute it and/or modify it * * under the terms version 2 of the GNU General Public License as published * * by the Free Software Foundation. This program is distributed in the hope * @@ -10,97 +9,19 @@ * You should have received a copy of the GNU General Public License along * * with this program; if not, write to the Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * - * For the text or an alternative of this public license, you may reach us * - * Posterita Ltd., 3, Draper Avenue, Quatre Bornes, Mauritius * - * or via info@posterita.org or http://www.posterita.org/ * *****************************************************************************/ - package org.adempiere.webui.component; -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; - -import org.adempiere.webui.LayoutUtils; -import org.adempiere.webui.apps.AEnv; -import org.zkoss.zk.ui.event.EventListener; -import org.zkoss.zul.Div; - -public class Searchbox extends Div +/** + * + * @author Low Heng Sin + * + */ +public class Searchbox extends EditorBox { private static final long serialVersionUID = 1L; - private PropertyChangeSupport m_propertyChangeListeners = new PropertyChangeSupport(this); - private Textbox txt; - private Button btn; public Searchbox() { - initComponents(); } - - public Searchbox(String text) - { - initComponents(); - setText(text); - } - - public void setButtonImage(String imageSrc) - { - btn.setImage(imageSrc); - } - - private void initComponents() - { - txt = new Textbox(); - txt.setStyle("display: inline;"); - btn = new Button(); - LayoutUtils.addSclass("editor-button", btn); - appendChild(txt); - appendChild(btn); - - String style = AEnv.isFirefox2() ? "display: inline" : "display: inline-block"; - style = style + ";white-space:nowrap"; - this.setStyle(style); - } - - public Textbox getTextBox() - { - return txt; - } - - public void setText(String value) - { - txt.setText(value); - } - - public String getText() - { - return txt.getText(); - } - - public void setEnabled(boolean enabled) - { - txt.setReadonly(!enabled); - btn.setEnabled(enabled); - } - - public boolean isEnabled() - { - return txt.isReadonly(); - } - - public boolean addEventListener(String evtnm, EventListener listener) - { - if("onClick".equals(evtnm)) - { - return btn.addEventListener(evtnm, listener); - } - else - { - return txt.addEventListener(evtnm, listener); - } - } - public synchronized void addPropertyChangeListener(PropertyChangeListener l) - { - m_propertyChangeListeners.addPropertyChangeListener(l); - } } diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/component/Urlbox.java b/zkwebui/WEB-INF/src/org/adempiere/webui/component/Urlbox.java index 078434c3c1..b270797005 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/component/Urlbox.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/component/Urlbox.java @@ -1,6 +1,5 @@ /****************************************************************************** - * Product: Posterita Ajax UI * - * Copyright (C) 2007 Posterita Ltd. All Rights Reserved. * + * Copyright (C) 2008 Low Heng Sin * * This program is free software; you can redistribute it and/or modify it * * under the terms version 2 of the GNU General Public License as published * * by the Free Software Foundation. This program is distributed in the hope * @@ -10,90 +9,29 @@ * You should have received a copy of the GNU General Public License along * * with this program; if not, write to the Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * - * For the text or an alternative of this public license, you may reach us * - * Posterita Ltd., 3, Draper Avenue, Quatre Bornes, Mauritius * - * or via info@posterita.org or http://www.posterita.org/ * *****************************************************************************/ - package org.adempiere.webui.component; -import org.adempiere.webui.LayoutUtils; -import org.adempiere.webui.apps.AEnv; -import org.zkoss.zk.ui.event.EventListener; - /** * URL Box + * @author Low Heng Sin */ -public class Urlbox extends Panel +public class Urlbox extends EditorBox { private static final long serialVersionUID = 1L; - private Textbox txtUrl; - - private Button btnUrl; - public Urlbox() { - initComponents(); + super(); } + /** + * @param url + */ public Urlbox(String url) { - initComponents(); + super(); setText(url); } - - public void setButtonImage(String imageSrc) - { - btnUrl.setImage(imageSrc); - } - - private void initComponents() - { - txtUrl = new Textbox(); - txtUrl.setStyle("display: inline;"); - btnUrl = new Button(); - LayoutUtils.addSclass("editor-button", btnUrl); - appendChild(txtUrl); - appendChild(btnUrl); - - String style = AEnv.isFirefox2() ? "display: inline" : "display: inline-block"; - style = style + ";white-space:nowrap"; - this.setStyle(style); - } - - public void setText(String value) - { - txtUrl.setText(value); - } - - public String getText() - { - return txtUrl.getText(); - } - - public void setEnabled(boolean enabled) - { - txtUrl.setReadonly(!enabled); - btnUrl.setEnabled(enabled); - } - - public boolean isEnabled() - { - return !txtUrl.isReadonly(); - } - - public void setButtonEnabled(boolean enabled) - { - btnUrl.setEnabled(enabled); - } - - public boolean addEventListener(String evtnm, EventListener listener) - { - if ("onClick".equals(evtnm)) - return btnUrl.addEventListener(evtnm, listener); - else - return txtUrl.addEventListener(evtnm, listener); - } } \ No newline at end of file diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/editor/WAssignmentEditor.java b/zkwebui/WEB-INF/src/org/adempiere/webui/editor/WAssignmentEditor.java index c9b4b9df5c..28b4a3b622 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/editor/WAssignmentEditor.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/editor/WAssignmentEditor.java @@ -37,7 +37,7 @@ public class WAssignmentEditor extends WEditor { } private void initComponents() { - getComponent().getTextBox().setReadonly(true); + getComponent().getTextbox().setReadonly(true); getComponent().setButtonImage("images/Assignment10.png"); getComponent().addEventListener(Events.ON_CLICK, this); } @@ -67,7 +67,7 @@ public class WAssignmentEditor extends WEditor { public void setReadWrite(boolean readWrite) { m_readWrite = readWrite; getComponent().setEnabled(readWrite); - getComponent().getTextBox().setReadonly(true); + getComponent().getTextbox().setReadonly(true); } @Override diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/editor/WSearchEditor.java b/zkwebui/WEB-INF/src/org/adempiere/webui/editor/WSearchEditor.java index 7a3dfb4705..9e6b3976e1 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/editor/WSearchEditor.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/editor/WSearchEditor.java @@ -164,7 +164,7 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value getComponent().setButtonImage("/images/PickOpen10.png"); } - (getComponent().getTextBox()).setContext(popupMenu.getId()); + (getComponent().getTextbox()).setContext(popupMenu.getId()); return; } diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/panel/ADTabpanel.java b/zkwebui/WEB-INF/src/org/adempiere/webui/panel/ADTabpanel.java index 4a9d9d6cd6..c4b0bfccbf 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/panel/ADTabpanel.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/panel/ADTabpanel.java @@ -28,6 +28,8 @@ import java.util.logging.Level; import org.adempiere.webui.LayoutUtils; import org.adempiere.webui.component.Bandbox; import org.adempiere.webui.component.Button; +import org.adempiere.webui.component.Column; +import org.adempiere.webui.component.Columns; import org.adempiere.webui.component.Datebox; import org.adempiere.webui.component.Grid; import org.adempiere.webui.component.GridPanel; @@ -214,9 +216,29 @@ DataStatusListener, ValueChangeListener, IADTabpanel if (uiCreated) return; uiCreated = true; + + //setup columns + Columns columns = new Columns(); + grid.appendChild(columns); + Column col = new Column(); + col.setWidth("14%"); + columns.appendChild(col); + col = new Column(); + col.setWidth("35%"); + columns.appendChild(col); + col = new Column(); + col.setWidth("14%"); + columns.appendChild(col); + col = new Column(); + col.setWidth("35%"); + columns.appendChild(col); + col = new Column(); + col.setWidth("2%"); + columns.appendChild(col); + Rows rows = new Rows(); GridField fields[] = gridTab.getFields(); - Row row = new Row(); + Row row = new Row(); String currentFieldGroup = null; for (int i = 0; i < fields.length; i++) @@ -360,7 +382,7 @@ DataStatusListener, ValueChangeListener, IADTabpanel //can't stretch bandbox & datebox if (!(editor.getComponent() instanceof Bandbox) && !(editor.getComponent() instanceof Datebox)) { - String width = "99%"; + String width = "100%"; if (editor.getComponent() instanceof Button) { Button btn = (Button) editor.getComponent(); String zclass = btn.getZclass(); diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/window/FindWindow.java b/zkwebui/WEB-INF/src/org/adempiere/webui/window/FindWindow.java index 8d1e641498..7e3cc858c9 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/window/FindWindow.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/window/FindWindow.java @@ -254,16 +254,19 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe btnNew.setName("btnNew"); btnNew.setSrc("/images/New24.png"); btnNew.addEventListener(Events.ON_CLICK,this); + LayoutUtils.addSclass("action-button", btnNew); Button btnOk = new Button(); btnOk.setName("btnOkSimple"); btnOk.setSrc("/images/Ok24.png"); btnOk.addEventListener(Events.ON_CLICK,this); + LayoutUtils.addSclass("action-button", btnOk); Button btnCancel = new Button(); btnCancel.setName("btnCancel"); btnCancel.setSrc("/images/Cancel24.png"); btnCancel.addEventListener(Events.ON_CLICK,this); + LayoutUtils.addSclass("action-button", btnCancel); Panel pnlButtonRight = new Panel(); pnlButtonRight.appendChild(btnOk); diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/window/WPAttributeDialog.java b/zkwebui/WEB-INF/src/org/adempiere/webui/window/WPAttributeDialog.java index 4dbc581d23..3844b9f5a7 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/window/WPAttributeDialog.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/window/WPAttributeDialog.java @@ -508,9 +508,9 @@ public class WPAttributeDialog extends Window implements EventListener { Env.clearWinContext(m_WindowNo); // - Env.setContext(Env.getCtx(), Env.WINDOW_INFO, Env.TAB_INFO, "M_AttributeSetInstance_ID", + Env.setContext(Env.getCtx(), m_WindowNoParent, Env.TAB_INFO, "M_AttributeSetInstance_ID", String.valueOf(m_M_AttributeSetInstance_ID)); - Env.setContext(Env.getCtx(), Env.WINDOW_INFO, Env.TAB_INFO, "M_Locator_ID", + Env.setContext(Env.getCtx(), m_WindowNoParent, Env.TAB_INFO, "M_Locator_ID", String.valueOf(m_M_Locator_ID)); // this.detach();