* Fixed minor Zk 3.5.1 compatibility issue.
* Implement hide/show tab * Improve form and editor layout * Refactoring of editor
This commit is contained in:
parent
732dea05bd
commit
00a1907332
|
@ -19,7 +19,7 @@ Copyright (C) 2007 Ashley G Ramdass (ADempiere WebUI).
|
|||
|
||||
<version>
|
||||
<version-class>org.adempiere.webui.AdempiereWebUI</version-class>
|
||||
<version-uid>0.1.1</version-uid>
|
||||
<version-uid>0.2</version-uid>
|
||||
</version>
|
||||
|
||||
<javascript src="/js/calc.js" charset="UTF-8"/>
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
/******************************************************************************
|
||||
* 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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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 <a href="mailto:sendy.yagambrum@posterita.org">Sendy Yagambrum</a>
|
||||
* @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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue