[ 2348226 ] Implement auto complete for combobox.
ProcessParameterPanel - Updated SQL for 3.5 changes. Improve Grid view layout, sizing and field alignment. Advance find - fixed saving and loading of user define query, improve usability.
This commit is contained in:
parent
5226a75872
commit
a6032c60c4
|
@ -27,6 +27,13 @@ public interface IDesktop {
|
|||
* @return windowNo
|
||||
*/
|
||||
public int registerWindow(Object window);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param WindowNo
|
||||
* @return Object
|
||||
*/
|
||||
public Object findWindow(int WindowNo);
|
||||
|
||||
/**
|
||||
* close active window
|
||||
|
|
|
@ -154,7 +154,8 @@ implements ValueChangeListener, IProcessParameter
|
|||
+ "p.AD_Reference_ID, p.AD_Process_Para_ID, "
|
||||
+ "p.FieldLength, p.IsMandatory, p.IsRange, p.ColumnName, "
|
||||
+ "p.DefaultValue, p.DefaultValue2, p.VFormat, p.ValueMin, p.ValueMax, "
|
||||
+ "p.SeqNo, p.AD_Reference_Value_ID, vr.Code AS ValidationCode "
|
||||
+ "p.SeqNo, p.AD_Reference_Value_ID, vr.Code AS ValidationCode, "
|
||||
+ "p.ReadOnlyLogic, p.DisplayLogic "
|
||||
+ "FROM AD_Process_Para p"
|
||||
+ " LEFT OUTER JOIN AD_Val_Rule vr ON (p.AD_Val_Rule_ID=vr.AD_Val_Rule_ID) "
|
||||
+ "WHERE p.AD_Process_ID=?" // 1
|
||||
|
@ -165,7 +166,8 @@ implements ValueChangeListener, IProcessParameter
|
|||
+ "p.AD_Reference_ID, p.AD_Process_Para_ID, "
|
||||
+ "p.FieldLength, p.IsMandatory, p.IsRange, p.ColumnName, "
|
||||
+ "p.DefaultValue, p.DefaultValue2, p.VFormat, p.ValueMin, p.ValueMax, "
|
||||
+ "p.SeqNo, p.AD_Reference_Value_ID, vr.Code AS ValidationCode "
|
||||
+ "p.SeqNo, p.AD_Reference_Value_ID, vr.Code AS ValidationCode, "
|
||||
+ "p.ReadOnlyLogic, p.DisplayLogic "
|
||||
+ "FROM AD_Process_Para p"
|
||||
+ " INNER JOIN AD_Process_Para_Trl t ON (p.AD_Process_Para_ID=t.AD_Process_Para_ID)"
|
||||
+ " LEFT OUTER JOIN AD_Val_Rule vr ON (p.AD_Val_Rule_ID=vr.AD_Val_Rule_ID) "
|
||||
|
|
|
@ -24,6 +24,7 @@ import java.math.*;
|
|||
import org.adempiere.webui.apps.AEnv;
|
||||
import org.adempiere.webui.component.Button;
|
||||
import org.adempiere.webui.component.Checkbox;
|
||||
import org.adempiere.webui.component.Combobox;
|
||||
import org.adempiere.webui.component.ConfirmPanel;
|
||||
import org.adempiere.webui.component.Grid;
|
||||
import org.adempiere.webui.component.GridFactory;
|
||||
|
@ -158,7 +159,7 @@ public abstract class WCreateFrom extends Window
|
|||
protected Label bankAccountLabel = new Label();
|
||||
protected Panel parameterStdPanel = new Panel();
|
||||
protected Label bPartnerLabel = new Label();
|
||||
protected Listbox bankAccountField;
|
||||
protected Combobox bankAccountField;
|
||||
//RF [1811114]
|
||||
protected Label authorizationLabel = new Label();
|
||||
protected WStringEditor authorizationField = new WStringEditor();
|
||||
|
|
|
@ -27,21 +27,14 @@ public class ComboItem extends org.zkoss.zul.Comboitem
|
|||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Object obj;
|
||||
|
||||
public ComboItem(String label)
|
||||
{
|
||||
super(label);
|
||||
}
|
||||
|
||||
public ComboItem(String label, String object)
|
||||
public ComboItem(String label, Object value)
|
||||
{
|
||||
super(label);
|
||||
this.obj = object;
|
||||
}
|
||||
|
||||
public Object getObject()
|
||||
{
|
||||
return obj;
|
||||
}
|
||||
this.setValue(value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
package org.adempiere.webui.component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.zkoss.zul.Comboitem;
|
||||
|
||||
/**
|
||||
|
@ -28,7 +30,7 @@ import org.zkoss.zul.Comboitem;
|
|||
public class Combobox extends org.zkoss.zul.Combobox
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
public void setEnabled(boolean enabled)
|
||||
{
|
||||
this.setDisabled(!enabled);
|
||||
|
@ -40,4 +42,66 @@ public class Combobox extends org.zkoss.zul.Combobox
|
|||
item.setParent(this);
|
||||
return item;
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return !isDisabled();
|
||||
}
|
||||
|
||||
/**
|
||||
* remove all items, to ease porting of swing form
|
||||
*/
|
||||
public void removeAllItems() {
|
||||
int cnt = getItemCount();
|
||||
for (int i = cnt - 1; i >=0; i--) {
|
||||
removeItemAt(i);
|
||||
}
|
||||
}
|
||||
|
||||
public void appendItem(String name, Object value) {
|
||||
ComboItem item = new ComboItem(name, value);
|
||||
this.appendChild(item);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set selected item for the list box based on the value of list item
|
||||
* set selected to none if no item found matching the value given or
|
||||
* value is null
|
||||
* @param value Value of ListItem to set as selected
|
||||
*/
|
||||
public void setValue(Object value)
|
||||
{
|
||||
setSelectedItem(null);
|
||||
|
||||
if (value == null)
|
||||
{
|
||||
return ;
|
||||
}
|
||||
|
||||
List<Comboitem> items = getItems();
|
||||
for (Comboitem item : items)
|
||||
{
|
||||
if (value.getClass() != item.getValue().getClass()) {
|
||||
// if the classes of value and item are different convert both to String
|
||||
String stringValue = value.toString();
|
||||
String stringItem = item.getValue().toString();
|
||||
if (stringValue.equals(stringItem))
|
||||
{
|
||||
setSelectedItem(item);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (value.equals(item.getValue()))
|
||||
{
|
||||
setSelectedItem(item);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns RS_NO_WIDTH|RS_NO_HEIGHT.
|
||||
*/
|
||||
protected int getRealStyleFlags() {
|
||||
return super.getRealStyleFlags() & 0x0006;
|
||||
}
|
||||
}
|
|
@ -24,6 +24,7 @@ import org.adempiere.webui.editor.WEditor;
|
|||
import org.compiere.model.GridField;
|
||||
import org.compiere.model.GridTab;
|
||||
import org.compiere.model.GridTable;
|
||||
import org.compiere.util.DisplayType;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
import org.zkoss.zk.ui.event.Events;
|
||||
|
@ -190,7 +191,10 @@ public class GridPanel extends Borderlayout implements EventListener
|
|||
ListHeader colHeader = new ListHeader();
|
||||
colHeader.setSort("auto");
|
||||
colHeader.setLabel(gridField[i].getHeader());
|
||||
int l = gridField[i].getDisplayLength() * 10;
|
||||
int l = DisplayType.isNumeric(gridField[i].getDisplayType())
|
||||
? 100 : gridField[i].getDisplayLength() * 9;
|
||||
if (gridField[i].getHeader().length() * 9 > l)
|
||||
l = gridField[i].getHeader().length() * 9;
|
||||
if (l > MAX_COLUMN_WIDTH)
|
||||
l = MAX_COLUMN_WIDTH;
|
||||
else if ( l < MIN_COLUMN_WIDTH)
|
||||
|
@ -331,4 +335,12 @@ public class GridPanel extends Borderlayout implements EventListener
|
|||
}
|
||||
} // all components
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param windowNo
|
||||
*/
|
||||
public void setWindowNo(int windowNo) {
|
||||
this.windowNo = windowNo;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,11 +20,15 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.adempiere.webui.editor.WButtonEditor;
|
||||
import org.adempiere.webui.editor.WEditor;
|
||||
import org.adempiere.webui.editor.WEditorPopupMenu;
|
||||
import org.adempiere.webui.editor.WebEditorFactory;
|
||||
import org.adempiere.webui.event.ContextMenuListener;
|
||||
import org.adempiere.webui.panel.AbstractADWindowPanel;
|
||||
import org.adempiere.webui.session.SessionManager;
|
||||
import org.adempiere.webui.util.GridTabDataBinder;
|
||||
import org.adempiere.webui.window.ADWindow;
|
||||
import org.compiere.model.GridField;
|
||||
import org.compiere.model.GridTab;
|
||||
import org.compiere.model.MAccountLookup;
|
||||
|
@ -33,6 +37,7 @@ import org.compiere.model.MLookupFactory;
|
|||
import org.compiere.util.DisplayType;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.NamePair;
|
||||
import org.zkoss.zk.ui.HtmlBasedComponent;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
import org.zkoss.zk.ui.event.Events;
|
||||
|
@ -95,6 +100,9 @@ public class GridTabListItemRenderer implements ListitemRenderer, ListitemRender
|
|||
} else {
|
||||
cell = new Listcell(getDisplayText(values[i], i), null);
|
||||
cell.setParent(listitem);
|
||||
if (DisplayType.isNumeric(gridField[i].getDisplayType())) {
|
||||
cell.setStyle("text-align:right");
|
||||
}
|
||||
}
|
||||
}
|
||||
CellListener listener = new CellListener((Listbox) listitem.getParent());
|
||||
|
@ -116,11 +124,26 @@ public class GridTabListItemRenderer implements ListitemRenderer, ListitemRender
|
|||
Listcell cell = new Listcell("", null);
|
||||
WEditor editor = editors.get(gridField);
|
||||
if (editor != null) {
|
||||
editor.addValueChangeListener(dataBinder);
|
||||
if (editor instanceof WButtonEditor)
|
||||
{
|
||||
Object window = SessionManager.getAppDesktop().findWindow(windowNo);
|
||||
if (window != null && window instanceof ADWindow)
|
||||
{
|
||||
AbstractADWindowPanel windowPanel = ((ADWindow)window).getADWindowPanel();
|
||||
((WButtonEditor)editor).addActionListener(windowPanel);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
editor.addValueChangeListener(dataBinder);
|
||||
}
|
||||
cell.appendChild(editor.getComponent());
|
||||
if (editor.getComponent() instanceof Checkbox) {
|
||||
cell.setStyle("text-align:center");
|
||||
}
|
||||
else if (DisplayType.isNumeric(gridField.getDisplayType())) {
|
||||
cell.setStyle("text-align:right");
|
||||
}
|
||||
gridField.addPropertyChangeListener(editor);
|
||||
editor.setValue(gridField.getValue());
|
||||
WEditorPopupMenu popupMenu = editor.getPopupMenu();
|
||||
|
@ -130,6 +153,24 @@ public class GridTabListItemRenderer implements ListitemRenderer, ListitemRender
|
|||
popupMenu.addMenuListener((ContextMenuListener)editor);
|
||||
cell.appendChild(popupMenu);
|
||||
}
|
||||
|
||||
//streach component to fill grid cell
|
||||
if (editor.getComponent() instanceof HtmlBasedComponent) {
|
||||
//can't stretch bandbox & datebox
|
||||
if (!(editor.getComponent() instanceof Bandbox) &&
|
||||
!(editor.getComponent() instanceof Datebox)) {
|
||||
String width = "100%";
|
||||
if (editor.getComponent() instanceof Button) {
|
||||
Button btn = (Button) editor.getComponent();
|
||||
String zclass = btn.getZclass();
|
||||
if (!zclass.contains("form-button ")) {
|
||||
btn.setZclass("form-button " + zclass);
|
||||
}
|
||||
} else {
|
||||
((HtmlBasedComponent)editor.getComponent()).setWidth(width);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return cell;
|
||||
|
@ -201,37 +242,36 @@ public class GridTabListItemRenderer implements ListitemRenderer, ListitemRender
|
|||
return "";
|
||||
|
||||
GridField[] gridField = gridTab.getFields();
|
||||
if (gridTab.getTableModel().getColumnClass(columnIndex).equals(Integer.class))
|
||||
if (gridField[columnIndex].isLookup())
|
||||
{
|
||||
if (gridField[columnIndex].isLookup())
|
||||
{
|
||||
NamePair namepair = null;
|
||||
if (gridField[columnIndex].getDisplayType() == DisplayType.Account)
|
||||
{
|
||||
MAccountLookup lookup = new MAccountLookup(Env.getCtx(), windowNo);
|
||||
namepair = lookup.get(value);
|
||||
}
|
||||
else
|
||||
{
|
||||
MLookup lookup = MLookupFactory.get(
|
||||
Env.getCtx(), windowNo, 0, gridField[columnIndex].getAD_Column_ID(),
|
||||
gridField[columnIndex].getDisplayType());
|
||||
|
||||
namepair = lookup.get(value);
|
||||
}
|
||||
if (namepair != null)
|
||||
return namepair.getName();
|
||||
else
|
||||
return "";
|
||||
}
|
||||
else
|
||||
return value.toString();
|
||||
NamePair namepair = null;
|
||||
if (gridField[columnIndex].getDisplayType() == DisplayType.Account)
|
||||
{
|
||||
MAccountLookup lookup = new MAccountLookup(Env.getCtx(), windowNo);
|
||||
namepair = lookup.get(value);
|
||||
}
|
||||
else
|
||||
{
|
||||
MLookup lookup = MLookupFactory.get(
|
||||
Env.getCtx(), windowNo, 0, gridField[columnIndex].getAD_Column_ID(),
|
||||
gridField[columnIndex].getDisplayType());
|
||||
|
||||
namepair = lookup.get(value);
|
||||
}
|
||||
if (namepair != null)
|
||||
return namepair.getName();
|
||||
else
|
||||
return "";
|
||||
}
|
||||
else if (gridTab.getTableModel().getColumnClass(columnIndex).equals(Timestamp.class))
|
||||
{
|
||||
SimpleDateFormat dateFormat = DisplayType.getDateFormat(DisplayType.Date);
|
||||
return dateFormat.format((Timestamp)value);
|
||||
}
|
||||
else if (DisplayType.isNumeric(gridField[columnIndex].getDisplayType()))
|
||||
{
|
||||
return DisplayType.getNumberFormat(gridField[columnIndex].getDisplayType()).format(value);
|
||||
}
|
||||
else
|
||||
return value.toString();
|
||||
}
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
|
||||
package org.adempiere.webui.component;
|
||||
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.beans.PropertyChangeSupport;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
@ -40,7 +38,6 @@ import org.zkoss.zul.Listitem;
|
|||
public class Listbox extends org.zkoss.zul.Listbox implements EventListener
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
private PropertyChangeSupport m_propertyChangeListeners = new PropertyChangeSupport(this);
|
||||
|
||||
private List<EventListener> doubleClickListeners = new ArrayList<EventListener>();
|
||||
private List<EventListener> onDropListeners = new ArrayList<EventListener>();
|
||||
|
@ -99,11 +96,6 @@ public class Listbox extends org.zkoss.zul.Listbox implements EventListener
|
|||
return (List<ListItem>)super.getItems();
|
||||
}
|
||||
|
||||
public synchronized void addPropertyChangeListener(PropertyChangeListener l)
|
||||
{
|
||||
m_propertyChangeListeners.addPropertyChangeListener(l);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set selected item for the list box based on the value of list item
|
||||
* set selected to none if no item found matching the value given or
|
||||
|
|
|
@ -24,8 +24,7 @@ import javax.swing.event.ListDataListener;
|
|||
|
||||
import org.adempiere.webui.ValuePreference;
|
||||
import org.adempiere.webui.apps.AEnv;
|
||||
import org.adempiere.webui.component.ListItem;
|
||||
import org.adempiere.webui.component.Listbox;
|
||||
import org.adempiere.webui.component.Combobox;
|
||||
import org.adempiere.webui.event.ContextMenuEvent;
|
||||
import org.adempiere.webui.event.ContextMenuListener;
|
||||
import org.adempiere.webui.event.ValueChangeEvent;
|
||||
|
@ -40,6 +39,7 @@ import org.compiere.util.NamePair;
|
|||
import org.compiere.util.ValueNamePair;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.Events;
|
||||
import org.zkoss.zul.Comboitem;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -52,7 +52,8 @@ ContextMenuListener, IZoomableEditor
|
|||
{
|
||||
public final static String[] LISTENER_EVENTS = {Events.ON_SELECT};
|
||||
|
||||
private static final CLogger logger;
|
||||
@SuppressWarnings("unused")
|
||||
private static final CLogger logger;
|
||||
|
||||
static
|
||||
{
|
||||
|
@ -65,7 +66,7 @@ ContextMenuListener, IZoomableEditor
|
|||
|
||||
public WTableDirEditor(GridField gridField)
|
||||
{
|
||||
super(new Listbox(), gridField);
|
||||
super(new Combobox(), gridField);
|
||||
lookup = gridField.getLookup();
|
||||
init();
|
||||
}
|
||||
|
@ -82,7 +83,7 @@ ContextMenuListener, IZoomableEditor
|
|||
*/
|
||||
public WTableDirEditor(Lookup lookup, String label, String description, boolean mandatory, boolean readonly, boolean updateable)
|
||||
{
|
||||
super(new Listbox(), label, description, mandatory, readonly, updateable);
|
||||
super(new Combobox(), label, description, mandatory, readonly, updateable);
|
||||
|
||||
if (lookup == null)
|
||||
{
|
||||
|
@ -105,7 +106,7 @@ ContextMenuListener, IZoomableEditor
|
|||
public WTableDirEditor(String columnName, boolean mandatory, boolean isReadOnly, boolean isUpdateable,
|
||||
Lookup lookup)
|
||||
{
|
||||
super(new Listbox(), columnName, null, null, mandatory, isReadOnly, isUpdateable);
|
||||
super(new Combobox(), columnName, null, null, mandatory, isReadOnly, isUpdateable);
|
||||
if (lookup == null)
|
||||
{
|
||||
throw new IllegalArgumentException("Lookup cannot be null");
|
||||
|
@ -116,11 +117,10 @@ ContextMenuListener, IZoomableEditor
|
|||
|
||||
private void init()
|
||||
{
|
||||
getComponent().setRows(0);
|
||||
getComponent().setMultiple(false);
|
||||
getComponent().setMold("select");
|
||||
getComponent().setWidth("200px");
|
||||
getComponent().addPropertyChangeListener(this);
|
||||
getComponent().setAutocomplete(true);
|
||||
getComponent().setAutodrop(true);
|
||||
getComponent().addEventListener(Events.ON_BLUR, this);
|
||||
|
||||
boolean zoom= false;
|
||||
if (lookup != null)
|
||||
|
@ -153,7 +153,7 @@ ContextMenuListener, IZoomableEditor
|
|||
{
|
||||
|
||||
String display = null;
|
||||
ListItem selItem = getComponent().getSelectedItem();
|
||||
Comboitem selItem = getComponent().getSelectedItem();
|
||||
if (selItem != null)
|
||||
{
|
||||
display = selItem.getLabel();
|
||||
|
@ -165,7 +165,7 @@ ContextMenuListener, IZoomableEditor
|
|||
public Object getValue()
|
||||
{
|
||||
Object retVal = null;
|
||||
ListItem selItem = getComponent().getSelectedItem();
|
||||
Comboitem selItem = getComponent().getSelectedItem();
|
||||
if (selItem != null)
|
||||
{
|
||||
retVal = selItem.getValue();
|
||||
|
@ -198,8 +198,8 @@ ContextMenuListener, IZoomableEditor
|
|||
}
|
||||
|
||||
@Override
|
||||
public Listbox getComponent() {
|
||||
return (Listbox) component;
|
||||
public Combobox getComponent() {
|
||||
return (Combobox) component;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -266,6 +266,13 @@ ContextMenuListener, IZoomableEditor
|
|||
super.fireValueChange(changeEvent);
|
||||
oldValue = newValue;
|
||||
}
|
||||
else if (Events.ON_BLUR.equalsIgnoreCase(event.getName()))
|
||||
{
|
||||
if (getComponent().getSelectedItem() == null)
|
||||
{
|
||||
setValue(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String[] getEvents()
|
||||
|
|
|
@ -72,8 +72,6 @@ import org.zkoss.zkex.zul.Center;
|
|||
import org.zkoss.zkex.zul.West;
|
||||
import org.zkoss.zul.Div;
|
||||
import org.zkoss.zul.Group;
|
||||
import org.zkoss.zul.Groupfoot;
|
||||
import org.zkoss.zul.Hbox;
|
||||
import org.zkoss.zul.Separator;
|
||||
import org.zkoss.zul.SimpleTreeNode;
|
||||
import org.zkoss.zul.Space;
|
||||
|
@ -97,7 +95,9 @@ public class ADTabpanel extends Div implements Evaluatee, EventListener,
|
|||
DataStatusListener, IADTabpanel
|
||||
{
|
||||
|
||||
private static final CLogger logger;
|
||||
private static final long serialVersionUID = 212250368715189455L;
|
||||
|
||||
private static final CLogger logger;
|
||||
|
||||
static
|
||||
{
|
||||
|
@ -215,6 +215,7 @@ DataStatusListener, IADTabpanel
|
|||
}
|
||||
this.appendChild(listPanel);
|
||||
listPanel.setVisible(false);
|
||||
listPanel.setWindowNo(windowNo);
|
||||
}
|
||||
|
||||
public void createUI()
|
||||
|
|
|
@ -415,7 +415,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
|||
GridField[] findFields = mTab.getFields();
|
||||
FindWindow find = new FindWindow(curWindowNo,
|
||||
mTab.getName(), mTab.getAD_Table_ID(), mTab.getTableName(),
|
||||
where.toString(), findFields, 10); // no query below 10
|
||||
where.toString(), findFields, 10, mTab.getAD_Tab_ID()); // no query below 10
|
||||
if (find.getTitle() != null && find.getTitle().length() > 0) {
|
||||
// Title is not set when the number of rows is below the minRecords parameter (10)
|
||||
find.setVisible(true);
|
||||
|
@ -952,7 +952,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
|||
GridField[] findFields = GridField.createFields(ctx, curTab.getWindowNo(), 0,curTab.getAD_Tab_ID());
|
||||
FindWindow find = new FindWindow (curTab.getWindowNo(), curTab.getName(),
|
||||
curTab.getAD_Table_ID(), curTab.getTableName(),
|
||||
curTab.getWhereExtended(), findFields, 1);
|
||||
curTab.getWhereExtended(), findFields, 1, curTab.getAD_Tab_ID());
|
||||
AEnv.showWindow(find);
|
||||
MQuery query = find.getQuery();
|
||||
|
||||
|
|
|
@ -23,27 +23,70 @@ import org.zkoss.zk.ui.Component;
|
|||
*/
|
||||
public interface IADTabpanel extends Component, Evaluatee {
|
||||
|
||||
/**
|
||||
* @return display logic
|
||||
*/
|
||||
public String getDisplayLogic();
|
||||
|
||||
/**
|
||||
* @return tab level
|
||||
*/
|
||||
public int getTabLevel();
|
||||
|
||||
/**
|
||||
* @return true if refresh is not needed
|
||||
*/
|
||||
public boolean isCurrent();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return title
|
||||
*/
|
||||
public String getTitle();
|
||||
|
||||
/**
|
||||
* Render the panel
|
||||
*/
|
||||
public void createUI();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return GridTab
|
||||
*/
|
||||
public GridTab getGridTab();
|
||||
|
||||
/**
|
||||
* activate/deactivate the panel
|
||||
* @param b
|
||||
*/
|
||||
public void activate(boolean b);
|
||||
|
||||
/**
|
||||
* retrieve data from db
|
||||
*/
|
||||
public void query();
|
||||
|
||||
/**
|
||||
* Refresh from db
|
||||
*/
|
||||
public void refresh();
|
||||
|
||||
public void query(boolean currentRows, int currentDays, int i);
|
||||
/**
|
||||
* retrieve data from db
|
||||
* @param currentRows
|
||||
* @param currentDays
|
||||
* @param maxRows
|
||||
*/
|
||||
public void query(boolean currentRows, int currentDays, int maxRows);
|
||||
|
||||
/**
|
||||
* Toggle between grid and form view
|
||||
*/
|
||||
public void switchRowPresentation();
|
||||
|
||||
/**
|
||||
* Dynamic update of field properties ( visibility, filter and mandatory )
|
||||
* @param i
|
||||
*/
|
||||
public void dynamicDisplay(int i);
|
||||
}
|
||||
|
|
|
@ -51,7 +51,6 @@ import org.adempiere.webui.component.ToolBarButton;
|
|||
import org.adempiere.webui.component.Window;
|
||||
import org.adempiere.webui.editor.WEditor;
|
||||
import org.adempiere.webui.editor.WNumberEditor;
|
||||
import org.adempiere.webui.editor.WSearchEditor;
|
||||
import org.adempiere.webui.editor.WStringEditor;
|
||||
import org.adempiere.webui.editor.WebEditorFactory;
|
||||
import org.adempiere.webui.event.ValueChangeEvent;
|
||||
|
@ -138,14 +137,6 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
|
|||
private boolean hasDocNo = false;
|
||||
private boolean hasName = false;
|
||||
private boolean hasDescription = false;
|
||||
/** Line in Simple Content */
|
||||
// private int sLine = 6;
|
||||
/** Value 2(to) */
|
||||
private boolean m_valueToColumn;
|
||||
/** Between selected */
|
||||
private boolean m_between = false;
|
||||
/** Editor */
|
||||
private WEditor m_editor = null;
|
||||
/** List of WEditors */
|
||||
private ArrayList<WEditor> m_sEditors = new ArrayList<WEditor>();
|
||||
/** Target Fields with AD_Column_ID as key */
|
||||
|
@ -155,7 +146,7 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
|
|||
/** Length of Fields on first tab */
|
||||
public static final int FIELDLENGTH = 20;
|
||||
|
||||
private int m_AD_Tab_ID = 1;
|
||||
private int m_AD_Tab_ID = 0;
|
||||
private MUserQuery[] userQueries;
|
||||
private Rows contentSimpleRows;
|
||||
private Row pnlDocument;
|
||||
|
@ -184,16 +175,18 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
|
|||
* @param whereExtended whereExtended
|
||||
* @param findFields findFields
|
||||
* @param minRecords minRecords
|
||||
* @param adTabId
|
||||
**/
|
||||
public FindWindow (int targetWindowNo, String title,
|
||||
int AD_Table_ID, String tableName, String whereExtended,
|
||||
GridField[] findFields, int minRecords)
|
||||
GridField[] findFields, int minRecords, int adTabId)
|
||||
{
|
||||
m_targetWindowNo = targetWindowNo;
|
||||
m_AD_Table_ID = AD_Table_ID;
|
||||
m_tableName = tableName;
|
||||
m_whereExtended = whereExtended;
|
||||
m_findFields = findFields;
|
||||
m_AD_Tab_ID = adTabId;
|
||||
//
|
||||
m_query = new MQuery (m_tableName);
|
||||
m_query.addRestriction(m_whereExtended);
|
||||
|
@ -213,8 +206,7 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
|
|||
this.setBorder("normal");
|
||||
this.setWidth("700px");
|
||||
this.setTitle(Msg.getMsg(Env.getCtx(), "Find").replaceAll("&", "") + ": " + title);
|
||||
this.setAttribute("modal", Boolean.TRUE);
|
||||
// this.setAttribute("mode", "modal");
|
||||
this.setAttribute(Window.MODE_KEY, Window.MODE_MODAL);
|
||||
this.setClosable(true);
|
||||
this.setSizable(true);
|
||||
}
|
||||
|
@ -252,19 +244,19 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
|
|||
|
||||
Button btnNew = new Button();
|
||||
btnNew.setName("btnNew");
|
||||
btnNew.setSrc("/images/New24.png");
|
||||
btnNew.setImage("/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.setImage("/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.setImage("/images/Cancel24.png");
|
||||
btnCancel.addEventListener(Events.ON_CLICK,this);
|
||||
LayoutUtils.addSclass("action-button", btnCancel);
|
||||
|
||||
|
@ -327,18 +319,18 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
|
|||
private void initAdvanced()
|
||||
{
|
||||
ToolBarButton btnNew = new ToolBarButton();
|
||||
btnNew.setSrc("/images/New24.png");
|
||||
btnNew.setImage("/images/New24.png");
|
||||
btnNew.setAttribute("name", "btnNewAdv");
|
||||
btnNew.addEventListener(Events.ON_CLICK, this);
|
||||
|
||||
ToolBarButton btnDelete = new ToolBarButton();
|
||||
btnDelete.setAttribute("name","btnDeleteAdv");
|
||||
btnDelete.setSrc("/images/Delete24.png");
|
||||
btnDelete.setImage("/images/Delete24.png");
|
||||
btnDelete.addEventListener(Events.ON_CLICK, this);
|
||||
|
||||
ToolBarButton btnSave = new ToolBarButton();
|
||||
btnSave.setAttribute("name","btnSaveAdv");
|
||||
btnSave.setSrc("/images/Save24.png");
|
||||
btnSave.setImage("/images/Save24.png");
|
||||
btnSave.addEventListener(Events.ON_CLICK, this);
|
||||
|
||||
fQueryName = new Combobox();
|
||||
|
@ -355,13 +347,15 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
|
|||
|
||||
Button btnOk = new Button();
|
||||
btnOk.setName("btnOkAdv");
|
||||
btnOk.setSrc("/images/Ok24.png");
|
||||
btnOk.setImage("/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.setImage("/images/Cancel24.png");
|
||||
btnCancel.addEventListener(Events.ON_CLICK, this);
|
||||
LayoutUtils.addSclass("action-button", btnCancel);
|
||||
|
||||
Panel pnlButtonRight = new Panel();
|
||||
pnlButtonRight.appendChild(btnOk);
|
||||
|
@ -370,10 +364,13 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
|
|||
|
||||
ToolBar toolBar = new ToolBar();
|
||||
toolBar.appendChild(btnNew);
|
||||
toolBar.appendChild(btnDelete);
|
||||
toolBar.appendChild(btnDelete);
|
||||
toolBar.appendChild(fQueryName);
|
||||
toolBar.appendChild(btnSave);
|
||||
toolBar.setWidth("100%");
|
||||
fQueryName.setStyle("margin-left: 3px; margin-right: 3px; position: relative; top: 5px;");
|
||||
|
||||
btnSave.setDisabled(m_AD_Tab_ID <= 0);
|
||||
|
||||
Hbox confirmPanel = new Hbox();
|
||||
confirmPanel.appendChild(pnlButtonRight);
|
||||
|
@ -739,27 +736,6 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
|
|||
dispose();
|
||||
}
|
||||
}
|
||||
else if (event.getTarget() instanceof Label)
|
||||
{
|
||||
Label label = (Label)event.getTarget();
|
||||
String value = label.getValue();
|
||||
ListCell listcell = (ListCell)label.getParent();
|
||||
ListItem row = (ListItem)listcell.getParent();
|
||||
advancedPanel.setSelectedItem(row);
|
||||
|
||||
if (listcell.getId().equals("cellQueryFrom"+row.getId()))
|
||||
{
|
||||
Component component = getEditorCompQueryFrom(row);
|
||||
addRowEditor(component, listcell);
|
||||
m_editor.setValue(value);
|
||||
}
|
||||
else if (listcell.getId().equals("cellQueryTo"+row.getId()))
|
||||
{
|
||||
Component component = getEditorCompQueryTo(row);
|
||||
addRowEditor(component,listcell);
|
||||
m_editor.setValue(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (Events.ON_OK.equals(event.getName()))
|
||||
{
|
||||
|
@ -782,7 +758,7 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
|
|||
String code = userQuery.getCode();
|
||||
String[] segments = code.split(Pattern.quote(SEGMENT_SEPARATOR));
|
||||
|
||||
List rowList = advancedPanel.getChildren();
|
||||
List<?> rowList = advancedPanel.getChildren();
|
||||
for (int rowIndex = rowList.size() - 1; rowIndex >= 1; rowIndex--)
|
||||
rowList.remove(rowIndex);
|
||||
|
||||
|
@ -792,6 +768,7 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
|
|||
|
||||
ListItem listItem = new ListItem();
|
||||
listItem.setWidth("100%");
|
||||
advancedPanel.appendChild(listItem);
|
||||
|
||||
Listbox listColumn = new Listbox();
|
||||
listColumn.setId("listColumn"+listItem.getId());
|
||||
|
@ -832,17 +809,14 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
|
|||
String value = fields.length > INDEX_VALUE ? fields[INDEX_VALUE] : "";
|
||||
if(value.length() > 0)
|
||||
{
|
||||
cellQueryFrom.appendChild(parseString(getTargetMField(columnName), value));
|
||||
cellQueryFrom.appendChild(parseString(getTargetMField(columnName), value, listItem, false));
|
||||
}
|
||||
|
||||
String value2 = fields.length > INDEX_VALUE2 ? fields[INDEX_VALUE2] : "";
|
||||
if(value2.length() > 0)
|
||||
{
|
||||
cellQueryTo.appendChild(parseString(getTargetMField(columnName), value2));
|
||||
cellQueryTo.appendChild(parseString(getTargetMField(columnName), value2, listItem, true));
|
||||
}
|
||||
|
||||
advancedPanel.appendChild(listItem);
|
||||
// advancedPanel.setSelectedItem(listItem);
|
||||
}
|
||||
|
||||
advancedPanel.invalidate();
|
||||
|
@ -852,33 +826,36 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
|
|||
* Parse String
|
||||
* @param field column
|
||||
* @param in value
|
||||
* @param to
|
||||
* @param listItem
|
||||
* @return data type corected value
|
||||
*/
|
||||
private Label parseString(GridField field, String in)
|
||||
private Component parseString(GridField field, String in, ListItem listItem, boolean to)
|
||||
{
|
||||
if (in == null)
|
||||
return null;
|
||||
int dt = field.getDisplayType();
|
||||
try
|
||||
{
|
||||
WEditor editor = null;
|
||||
if (field.isKey())
|
||||
m_editor = new WNumberEditor(field);
|
||||
editor = new WNumberEditor(field);
|
||||
else
|
||||
m_editor = WebEditorFactory.getEditor(field, true);
|
||||
if (m_editor == null)
|
||||
m_editor = new WStringEditor(field);
|
||||
editor = WebEditorFactory.getEditor(field, true);
|
||||
if (editor == null)
|
||||
editor = new WStringEditor(field);
|
||||
|
||||
// Return Integer
|
||||
if (dt == DisplayType.Integer
|
||||
|| (DisplayType.isID(dt) && field.getColumnName().endsWith("_ID")))
|
||||
{
|
||||
int i = Integer.parseInt(in);
|
||||
m_editor.setValue(new Integer(i));
|
||||
editor.setValue(new Integer(i));
|
||||
}
|
||||
// Return BigDecimal
|
||||
else if (DisplayType.isNumeric(dt))
|
||||
{
|
||||
m_editor.setValue(DisplayType.getNumberFormat(dt).parse(in));
|
||||
editor.setValue(DisplayType.getNumberFormat(dt).parse(in));
|
||||
}
|
||||
// Return Timestamp
|
||||
else if (DisplayType.isDate(dt))
|
||||
|
@ -887,7 +864,7 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
|
|||
try
|
||||
{
|
||||
time = DisplayType.getDateFormat_JDBC().parse(in).getTime();
|
||||
m_editor.setValue(new Timestamp(time));
|
||||
editor.setValue(new Timestamp(time));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -895,26 +872,30 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
|
|||
time = DisplayType.getDateFormat(dt).parse(in).getTime();
|
||||
}
|
||||
|
||||
m_editor.setValue(new Timestamp(time));
|
||||
editor.setValue(new Timestamp(time));
|
||||
}
|
||||
else if (dt == DisplayType.YesNo)
|
||||
m_editor.setValue(Boolean.valueOf(in));
|
||||
editor.setValue(Boolean.valueOf(in));
|
||||
else
|
||||
m_editor.setValue(in);
|
||||
editor.setValue(in);
|
||||
|
||||
Label label = new Label();
|
||||
if(m_editor instanceof WSearchEditor)
|
||||
{
|
||||
WSearchEditor se = (WSearchEditor) m_editor;
|
||||
String display = se.getGridField().getLookup().getDisplay(m_editor.getValue().toString());
|
||||
label.setValue(display);
|
||||
}
|
||||
else
|
||||
{
|
||||
label.setValue(m_editor.getDisplay());
|
||||
}
|
||||
label.setAttribute("value", m_editor.getValue());
|
||||
return label;
|
||||
editor.addValueChangeListener(this);
|
||||
|
||||
boolean between = false;
|
||||
Listbox listOp = (Listbox) listItem.getFellow("listOperator"+listItem.getId());
|
||||
String betweenValue = listOp.getSelectedItem().getValue().toString();
|
||||
String opValue = MQuery.OPERATORS[MQuery.BETWEEN_INDEX].getValue();
|
||||
if (to && betweenValue != null
|
||||
&& betweenValue.equals(opValue))
|
||||
between = true;
|
||||
|
||||
boolean enabled = !to || (to && between);
|
||||
|
||||
editor.setReadWrite(enabled);
|
||||
editor.setVisible(enabled);
|
||||
editor.dynamicDisplay();
|
||||
|
||||
return editor.getComponent();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -926,12 +907,11 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
|
|||
|
||||
private void cmd_save(boolean saveQuery)
|
||||
{
|
||||
// advancedTable.stopEditor(true);
|
||||
//
|
||||
m_query = new MQuery(m_tableName);
|
||||
StringBuffer code = new StringBuffer();
|
||||
|
||||
List rowList = advancedPanel.getChildren();
|
||||
List<?> rowList = advancedPanel.getChildren();
|
||||
|
||||
for (int rowIndex = 1; rowIndex < rowList.size() ; rowIndex++)
|
||||
{
|
||||
|
@ -955,12 +935,7 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
|
|||
|
||||
// Value ******
|
||||
ListCell cellQueryFrom = (ListCell)row.getFellow("cellQueryFrom"+row.getId());
|
||||
// Elaine 2008/07/29
|
||||
if(!(cellQueryFrom.getChildren().get(0) instanceof Label))
|
||||
continue;
|
||||
//
|
||||
Label labelFrom = (Label)(cellQueryFrom.getChildren().get(0));
|
||||
Object value = labelFrom.getAttribute("value");
|
||||
Object value = cellQueryFrom.getAttribute("value");
|
||||
if (value == null)
|
||||
continue;
|
||||
Object parsedValue = parseValue(field, value);
|
||||
|
@ -976,12 +951,7 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
|
|||
if (MQuery.OPERATORS[MQuery.BETWEEN_INDEX].equals(op))
|
||||
{
|
||||
ListCell cellQueryTo = (ListCell)row.getFellow("cellQueryTo"+row.getId());
|
||||
// Elaine 2008/07/29
|
||||
if(!(cellQueryTo.getChildren().get(0) instanceof Label))
|
||||
continue;
|
||||
//
|
||||
Label labelTo = (Label)(cellQueryTo.getChildren().get(0));
|
||||
value2 = labelTo.getAttribute("value");
|
||||
value2 = cellQueryTo.getAttribute("value");
|
||||
if (value2 == null)
|
||||
continue;
|
||||
Object parsedValue2 = parseValue(field, value2);
|
||||
|
@ -1075,9 +1045,6 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
|
|||
**/
|
||||
private String getColumnName(ListItem row)
|
||||
{
|
||||
/*List list = row.getChildren();
|
||||
Panel pnlColumn = (Panel)list.get(0);
|
||||
List lstColumn = pnlColumn.getChildren();*/
|
||||
Listbox listColumn = (Listbox)row.getFellow("listColumn"+row.getId());
|
||||
String columnName = listColumn.getSelectedItem().getValue().toString();
|
||||
|
||||
|
@ -1092,8 +1059,7 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
|
|||
**/
|
||||
private Component getEditorCompQueryFrom(ListItem row)
|
||||
{
|
||||
m_valueToColumn = false;
|
||||
return getEditorComponent(row);
|
||||
return getEditorComponent(row, false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1103,8 +1069,7 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
|
|||
**/
|
||||
private Component getEditorCompQueryTo(ListItem row)
|
||||
{
|
||||
m_valueToColumn = true;
|
||||
return getEditorComponent(row);
|
||||
return getEditorComponent(row, true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1149,7 +1114,7 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
|
|||
**/
|
||||
private void addOperators(ValueNamePair[] op, Listbox listOperator)
|
||||
{
|
||||
List itemList = listOperator.getChildren();
|
||||
List<?> itemList = listOperator.getChildren();
|
||||
itemList.clear();
|
||||
for (ValueNamePair item: op)
|
||||
{
|
||||
|
@ -1163,39 +1128,39 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
|
|||
* @param row row
|
||||
* @return Editor component
|
||||
**/
|
||||
public Component getEditorComponent(ListItem row)
|
||||
public Component getEditorComponent(ListItem row, boolean to)
|
||||
{
|
||||
String columnName = getColumnName(row);
|
||||
m_between = false;
|
||||
boolean between = false;
|
||||
Listbox listOp = (Listbox) row.getFellow("listOperator"+row.getId());
|
||||
String betweenValue = listOp.getSelectedItem().getValue().toString();
|
||||
String opValue = MQuery.OPERATORS[MQuery.BETWEEN_INDEX].getValue();
|
||||
if (m_valueToColumn && betweenValue != null
|
||||
if (to && betweenValue != null
|
||||
&& betweenValue.equals(opValue))
|
||||
m_between = true;
|
||||
between = true;
|
||||
|
||||
boolean enabled = !m_valueToColumn || (m_valueToColumn && m_between);
|
||||
boolean enabled = !to || (to && between);
|
||||
|
||||
// Create Editor
|
||||
GridField field = getTargetMField(columnName);
|
||||
// log.fine( "Field=" + field.toStringX());
|
||||
if(field == null) return new Label("");
|
||||
|
||||
WEditor editor = null;
|
||||
if (field.isKey())
|
||||
m_editor = new WNumberEditor(field);
|
||||
editor = new WNumberEditor(field);
|
||||
else
|
||||
m_editor = WebEditorFactory.getEditor(field, true);
|
||||
if (m_editor == null)
|
||||
m_editor = new WStringEditor(field);
|
||||
editor = WebEditorFactory.getEditor(field, true);
|
||||
if (editor == null)
|
||||
editor = new WStringEditor(field);
|
||||
|
||||
field.addPropertyChangeListener(m_editor);
|
||||
m_editor.addValueChangeListener(this);
|
||||
m_editor.setValue(null);
|
||||
m_editor.setReadWrite(enabled);
|
||||
m_editor.setVisible(enabled);
|
||||
m_editor.dynamicDisplay();
|
||||
field.addPropertyChangeListener(editor);
|
||||
editor.addValueChangeListener(this);
|
||||
editor.setValue(null);
|
||||
editor.setReadWrite(enabled);
|
||||
editor.setVisible(enabled);
|
||||
editor.dynamicDisplay();
|
||||
//
|
||||
return m_editor.getComponent();
|
||||
return editor.getComponent();
|
||||
|
||||
} // getTableCellEditorComponent
|
||||
|
||||
|
@ -1339,7 +1304,7 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
|
|||
log.info("");
|
||||
//
|
||||
m_query = new MQuery(m_tableName);
|
||||
List rowList = advancedPanel.getChildren();
|
||||
List<?> rowList = advancedPanel.getChildren();
|
||||
|
||||
for (int rowIndex = 1; rowIndex < rowList.size() ; rowIndex++)
|
||||
{
|
||||
|
@ -1363,12 +1328,7 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
|
|||
|
||||
// Value ******
|
||||
ListCell cellQueryFrom = (ListCell)row.getFellow("cellQueryFrom"+row.getId());
|
||||
// Elaine 2008/07/29
|
||||
if(!(cellQueryFrom.getChildren().get(0) instanceof Label))
|
||||
continue;
|
||||
//
|
||||
Label labelFrom = (Label)(cellQueryFrom.getChildren().get(0));
|
||||
Object value = labelFrom.getAttribute("value");
|
||||
Object value = cellQueryFrom.getAttribute("value");
|
||||
if (value == null)
|
||||
continue;
|
||||
Object parsedValue = parseValue(field, value);
|
||||
|
@ -1383,12 +1343,7 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
|
|||
if (MQuery.OPERATORS[MQuery.BETWEEN_INDEX].equals(op))
|
||||
{
|
||||
ListCell cellQueryTo = (ListCell)row.getFellow("cellQueryTo"+row.getId());
|
||||
// Elaine 2008/07/29
|
||||
if(!(cellQueryTo.getChildren().get(0) instanceof Label))
|
||||
continue;
|
||||
//
|
||||
Label labelTo = (Label)(cellQueryTo.getChildren().get(0));
|
||||
Object value2 = labelTo.getAttribute("value");
|
||||
Object value2 = cellQueryTo.getAttribute("value");
|
||||
if (value2 == null)
|
||||
continue;
|
||||
Object parsedValue2 = parseValue(field, value2);
|
||||
|
@ -1539,7 +1494,7 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
|
|||
**/
|
||||
private String getSubCategoriesString(int productCategoryId, Vector<SimpleTreeNode> categories, int loopIndicatorId) throws AdempiereSystemError {
|
||||
String ret = "";
|
||||
final Iterator iter = categories.iterator();
|
||||
final Iterator<SimpleTreeNode> iter = categories.iterator();
|
||||
while (iter.hasNext()) {
|
||||
SimpleTreeNode node = (SimpleTreeNode) iter.next();
|
||||
if (node.getParentId() == productCategoryId) {
|
||||
|
@ -1682,25 +1637,7 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
|
|||
// Editor component
|
||||
Component component = editor.getComponent();
|
||||
ListCell listcell = (ListCell)component.getParent();
|
||||
|
||||
// Elaine 2008/07/29
|
||||
Label label = new Label();
|
||||
if(evt.getSource() instanceof WSearchEditor)
|
||||
{
|
||||
WSearchEditor se = (WSearchEditor) evt.getSource();
|
||||
se.setValue(evt.getNewValue());
|
||||
label.setValue(se.getDisplay());
|
||||
}
|
||||
else
|
||||
{
|
||||
label.setValue(editor.getDisplay());
|
||||
}
|
||||
label.setAttribute("value", evt.getNewValue());
|
||||
//
|
||||
|
||||
listcell.appendChild(label);
|
||||
listcell.removeChild(component);
|
||||
label.addEventListener(Events.ON_CLICK,this);
|
||||
listcell.setAttribute("value", evt.getNewValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -858,7 +858,7 @@ public class ZkReportViewer extends Window implements EventListener {
|
|||
bFind.setVisible(false);
|
||||
else
|
||||
{
|
||||
FindWindow find = new FindWindow(m_WindowNo, title, AD_Table_ID, tableName,"", findFields, 1);
|
||||
FindWindow find = new FindWindow(m_WindowNo, title, AD_Table_ID, tableName,"", findFields, 1, AD_Tab_ID);
|
||||
find.setVisible(true);
|
||||
AEnv.showWindow(find);
|
||||
m_reportEngine.setQuery(find.getQuery());
|
||||
|
|
|
@ -0,0 +1,83 @@
|
|||
/* Combobox2Default.java
|
||||
|
||||
{{IS_NOTE
|
||||
Purpose:
|
||||
|
||||
Description:
|
||||
|
||||
History:
|
||||
Jun 6, 2008 8:57:53 AM , Created by jumperchen
|
||||
}}IS_NOTE
|
||||
|
||||
Copyright (C) 2008 Potix Corporation. All Rights Reserved.
|
||||
|
||||
{{IS_RIGHT
|
||||
This program is distributed under GPL Version 2.0 in the hope that
|
||||
it will be useful, but WITHOUT ANY WARRANTY.
|
||||
}}IS_RIGHT
|
||||
*/
|
||||
package org.zkoss.zkmax.zul.render;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
|
||||
import javax.servlet.ServletRequest;
|
||||
|
||||
import org.zkoss.util.Utils;
|
||||
import org.zkoss.web.servlet.Servlets;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
import org.zkoss.zk.ui.Execution;
|
||||
import org.zkoss.zk.ui.Executions;
|
||||
import org.zkoss.zk.ui.render.ComponentRenderer;
|
||||
import org.zkoss.zk.ui.render.SmartWriter;
|
||||
import org.zkoss.zul.Combobox;
|
||||
|
||||
/**
|
||||
* {@link Combobox}'s default mold.
|
||||
*
|
||||
* @author jumperchen
|
||||
*
|
||||
* @since 3.5.0
|
||||
*
|
||||
* @author hengsin
|
||||
* modify default zk layout for combobox
|
||||
*/
|
||||
public class Combobox2Default implements ComponentRenderer {
|
||||
public void render(Component comp, Writer out) throws IOException {
|
||||
final SmartWriter wh = new SmartWriter(out);
|
||||
final Combobox self = (Combobox) comp;
|
||||
final String uuid = self.getUuid();
|
||||
final String zcls = self.getZclass();
|
||||
final Execution exec = Executions.getCurrent();
|
||||
|
||||
String tableStyle = "display:inline-block";
|
||||
String inputAttrs = self.getInnerAttrs();
|
||||
if (inputAttrs.indexOf("style") >= 0) {
|
||||
inputAttrs = inputAttrs.substring(0, inputAttrs.indexOf("style"));
|
||||
}
|
||||
inputAttrs = inputAttrs.trim() + " style='width: 100%'";
|
||||
wh.write("<span id=\"").write(uuid).write("\"")
|
||||
.write(self.getOuterAttrs())
|
||||
.write(" z.type=\"zul.cb.Cmbox\" z.combo=\"true\">")
|
||||
.write("<table border='0' cellspacing='0' cellpadding='0'")
|
||||
.write(" width='").write(self.getWidth()).write("'")
|
||||
.write(" style='"). write(tableStyle).write("'>")
|
||||
.write("<tr style='width:100%; white-space:nowrap;'><td style='width: 100%'><input id=\"")
|
||||
.write(uuid).write("!real\" autocomplete=\"off\"")
|
||||
.write(" class=\"").write(zcls).write("-inp\" ")
|
||||
.write(inputAttrs).write("/></td><td style='width: 17px'><span id=\"")
|
||||
.write(uuid).write("!btn\" class=\"").write(zcls).write("-btn\"");
|
||||
|
||||
if (!self.isButtonVisible())
|
||||
wh.write(" style=\"display:none\"");
|
||||
|
||||
wh.write("><img class=\"").write(zcls).write("-img\" onmousedown=\"return false;\"");
|
||||
wh.write(" src=\"").write(exec.encodeURL("~./img/spacer.gif")).write("\"")
|
||||
.write("\"/></span></td></tr></table><div id=\"").write(uuid).write("!pp\" class=\"")
|
||||
.write(zcls).write("-pp\" style=\"display:none\" tabindex=\"-1\">")
|
||||
.write("<table id=\"").write(uuid)
|
||||
.write("!cave\" cellpadding=\"0\" cellspacing=\"0\">")
|
||||
.writeChildren(self)
|
||||
.write("</table></div></span>");
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue