* Merge branches/adempiere341 revision 6095 bug fixes for zkwebui
This commit is contained in:
parent
cd7097d6ab
commit
2e27910d9b
|
@ -626,7 +626,7 @@ public class Desktop extends AbstractUIPart implements MenuListener, Serializabl
|
|||
if(dragged instanceof Treerow)
|
||||
{
|
||||
Treerow treerow = (Treerow) dragged;
|
||||
Treeitem treeitem = treerow.getTreeitem();
|
||||
Treeitem treeitem = (Treeitem) treerow.getParent();
|
||||
|
||||
Object value = treeitem.getValue();
|
||||
if(value != null)
|
||||
|
@ -717,7 +717,6 @@ public class Desktop extends AbstractUIPart implements MenuListener, Serializabl
|
|||
|
||||
if(menu.getAction().equals(MMenu.ACTION_Window))
|
||||
{
|
||||
Integer wMenuId = Integer.valueOf(menu.getAD_Window_ID());
|
||||
ADWindow adWindow = new ADWindow(Env.getCtx(), menu.getAD_Window_ID());
|
||||
|
||||
Tabpanel tabPanel = new Tabpanel();
|
||||
|
|
|
@ -526,6 +526,7 @@ public class WAcctViewer extends Window implements EventListener
|
|||
|
||||
paging.addEventListener("onPaging", this);
|
||||
paging.setAutohide(true);
|
||||
paging.setDetailed(true);
|
||||
|
||||
// Query Tab
|
||||
|
||||
|
|
|
@ -87,12 +87,12 @@ public abstract class WCreateFrom extends Window implements EventListener, WTabl
|
|||
protected Button btnOk = new Button();
|
||||
protected Button btnSelectAll = new Button();
|
||||
|
||||
private Label bankAccountLabel = new Label();
|
||||
private Label bPartnerLabel = new Label();
|
||||
private Label shipmentLabel = new Label();
|
||||
private Label orderLabel = new Label();
|
||||
private Label invoiceLabel = new Label();
|
||||
private Label locatorLabel = new Label();
|
||||
protected Label bankAccountLabel = new Label();
|
||||
protected Label bPartnerLabel = new Label();
|
||||
protected Label shipmentLabel = new Label();
|
||||
protected Label orderLabel = new Label();
|
||||
protected Label invoiceLabel = new Label();
|
||||
protected Label locatorLabel = new Label();
|
||||
protected Label lblStatus = new Label();
|
||||
|
||||
protected WListbox dataTable = new WListbox();
|
||||
|
@ -227,7 +227,7 @@ public abstract class WCreateFrom extends Window implements EventListener, WTabl
|
|||
|
||||
// Window
|
||||
|
||||
this.setWidth("700px");
|
||||
// this.setWidth("700px");
|
||||
this.setClosable(true);
|
||||
this.setBorder("normal");
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ import org.adempiere.webui.editor.WLocatorEditor;
|
|||
import org.adempiere.webui.event.ValueChangeEvent;
|
||||
import org.adempiere.webui.event.ValueChangeListener;
|
||||
import org.adempiere.webui.event.WTableModelListener;
|
||||
import org.adempiere.webui.window.FDialog;
|
||||
import org.compiere.model.GridTab;
|
||||
import org.compiere.model.MInOut;
|
||||
import org.compiere.model.MInOutLine;
|
||||
|
@ -97,6 +98,8 @@ public class WCreateFromShipment extends WCreateFrom implements EventListener, V
|
|||
initBPartner(false);
|
||||
bPartnerField.addValueChangeListner(this);
|
||||
|
||||
locatorLabel.setMandatory(true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -343,7 +346,7 @@ public class WCreateFromShipment extends WCreateFrom implements EventListener, V
|
|||
|
||||
if (mlocator == null || mlocator.getM_Locator_ID()/*.intValue()*/ == 0)
|
||||
{
|
||||
/* locatorField.setBackground(AdempierePLAF.getFieldBackground_Error());*/
|
||||
FDialog.error(p_WindowNo, Msg.getMsg(Env.getCtx(), "FillMandatory", new Object[]{locatorField.getLabel().getValue()}));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,37 +30,39 @@ import org.compiere.model.GridTable;
|
|||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
import org.zkoss.zk.ui.event.Events;
|
||||
import org.zkoss.zul.Div;
|
||||
import org.zkoss.zul.Hbox;
|
||||
import org.zkoss.zkex.zul.Borderlayout;
|
||||
import org.zkoss.zkex.zul.Center;
|
||||
import org.zkoss.zkex.zul.South;
|
||||
import org.zkoss.zul.ListitemRenderer;
|
||||
import org.zkoss.zul.Paging;
|
||||
import org.zkoss.zul.event.ZulEvents;
|
||||
|
||||
public class GridPanel extends Div implements EventListener
|
||||
public class GridPanel extends Borderlayout implements EventListener
|
||||
{
|
||||
private static final int MIN_COLUMN_WIDTH = 100;
|
||||
|
||||
private static final int MAX_COLUMN_WIDTH = 300;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Listbox listbox = null;
|
||||
|
||||
private int pageSize = 10;
|
||||
private long numPages;
|
||||
private int pageSize = 1000;
|
||||
|
||||
private GridField[] gridField;
|
||||
private AbstractTableModel tableModel;
|
||||
|
||||
private int numColumns = 5;
|
||||
private int numRows;
|
||||
|
||||
private Button[] buttons;
|
||||
private Hbox boxButtons = new Hbox();
|
||||
|
||||
private int windowNo;
|
||||
|
||||
private GridTab gridTab;
|
||||
|
||||
private int pageId = 0;
|
||||
|
||||
private ListHead listHead;
|
||||
|
||||
private boolean init;
|
||||
|
||||
private GridTableListModel listModel;
|
||||
|
||||
private Paging paging;
|
||||
|
||||
public GridPanel()
|
||||
{
|
||||
|
@ -82,14 +84,13 @@ public class GridPanel extends Div implements EventListener
|
|||
tableModel = gridTab.getTableModel();
|
||||
|
||||
numColumns = tableModel.getColumnCount();
|
||||
numRows = tableModel.getRowCount();
|
||||
|
||||
gridField = ((GridTable)tableModel).getFields();
|
||||
|
||||
setupColumns();
|
||||
render();
|
||||
|
||||
listbox.setSelectedIndex(gridTab.getCurrentRow());
|
||||
updateListIndex();
|
||||
|
||||
this.init = true;
|
||||
}
|
||||
|
@ -108,12 +109,34 @@ public class GridPanel extends Div implements EventListener
|
|||
public void refresh(GridTab gridTab) {
|
||||
this.gridTab = gridTab;
|
||||
tableModel = gridTab.getTableModel();
|
||||
numRows = tableModel.getRowCount();
|
||||
gridField = ((GridTable)tableModel).getFields();
|
||||
|
||||
updateModel();
|
||||
|
||||
listbox.setSelectedIndex(gridTab.getCurrentRow());
|
||||
updateListIndex();
|
||||
}
|
||||
|
||||
/**
|
||||
* Update listbox index to sync with grid current row pointer changes
|
||||
*/
|
||||
public void updateListIndex() {
|
||||
int rowIndex = gridTab.getCurrentRow();
|
||||
if (pageSize > 0) {
|
||||
if (paging.getTotalSize() != gridTab.getRowCount())
|
||||
paging.setTotalSize(gridTab.getRowCount());
|
||||
int pgIndex = rowIndex % pageSize;
|
||||
int pgNo = (rowIndex - pgIndex) / pageSize;
|
||||
if (listModel.getPage() != pgNo) {
|
||||
listModel.setPage(pgNo);
|
||||
}
|
||||
if (paging.getActivePage() != pgNo)
|
||||
paging.setActivePage(pgNo);
|
||||
if (listbox.getSelectedIndex() != pgIndex)
|
||||
listbox.setSelectedIndex(pgIndex);
|
||||
} else {
|
||||
if (listbox.getSelectedIndex() != rowIndex)
|
||||
listbox.setSelectedIndex(rowIndex);
|
||||
}
|
||||
}
|
||||
|
||||
public void setPageSize(int pageSize)
|
||||
|
@ -141,7 +164,7 @@ public class GridPanel extends Div implements EventListener
|
|||
ListHead header = new ListHead();
|
||||
header.setSizable(true);
|
||||
|
||||
Map colnames = new HashMap<Integer, String>();
|
||||
Map<Integer, String> colnames = new HashMap<Integer, String>();
|
||||
int index = 0;
|
||||
for (int i = 0; i < numColumns; i++)
|
||||
{
|
||||
|
@ -153,10 +176,10 @@ public class GridPanel extends Div implements EventListener
|
|||
colHeader.setSort("auto");
|
||||
colHeader.setLabel(gridField[i].getHeader());
|
||||
int l = gridField[i].getDisplayLength() * 10;
|
||||
if (l > 300)
|
||||
l = 300;
|
||||
else if ( l < 100)
|
||||
l = 100;
|
||||
if (l > MAX_COLUMN_WIDTH)
|
||||
l = MAX_COLUMN_WIDTH;
|
||||
else if ( l < MIN_COLUMN_WIDTH)
|
||||
l = MIN_COLUMN_WIDTH;
|
||||
colHeader.setWidth(Integer.toString(l) + "px");
|
||||
header.appendChild(colHeader);
|
||||
}
|
||||
|
@ -174,12 +197,26 @@ public class GridPanel extends Div implements EventListener
|
|||
LayoutUtils.addSclass("adtab-grid", listbox);
|
||||
|
||||
updateModel();
|
||||
|
||||
this.appendChild(listbox);
|
||||
|
||||
Center center = new Center();
|
||||
center.appendChild(listbox);
|
||||
this.appendChild(center);
|
||||
|
||||
if (pageSize > 0) {
|
||||
paging = new Paging();
|
||||
paging.setPageSize(pageSize);
|
||||
paging.setTotalSize(tableModel.getRowCount());
|
||||
paging.setDetailed(true);
|
||||
South south = new South();
|
||||
south.appendChild(paging);
|
||||
this.appendChild(south);
|
||||
paging.addEventListener(ZulEvents.ON_PAGING, this);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateModel() {
|
||||
GridTableListModel listModel = new GridTableListModel((GridTable)tableModel, windowNo);
|
||||
listModel = new GridTableListModel((GridTable)tableModel, windowNo);
|
||||
listModel.setPageSize(pageSize);
|
||||
listbox.setItemRenderer(listModel);
|
||||
listbox.setModel(listModel);
|
||||
}
|
||||
|
@ -196,8 +233,30 @@ public class GridPanel extends Div implements EventListener
|
|||
return;
|
||||
else if (event.getTarget() == listbox)
|
||||
{
|
||||
gridTab.navigate(listbox.getSelectedIndex());
|
||||
updateModelIndex();
|
||||
}
|
||||
else if (event.getTarget() == paging)
|
||||
{
|
||||
int pgNo = paging.getActivePage();
|
||||
if (pgNo != listModel.getPage())
|
||||
{
|
||||
listbox.clearSelection();
|
||||
listModel.setPage(pgNo);
|
||||
listbox.setSelectedIndex(0);
|
||||
updateModelIndex();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateModelIndex() {
|
||||
int rowIndex = listbox.getSelectedIndex();
|
||||
if (pageSize > 0) {
|
||||
int start = listModel.getPage() * listModel.getPageSize();
|
||||
rowIndex = start + rowIndex;
|
||||
}
|
||||
|
||||
if (gridTab.getCurrentRow() != rowIndex)
|
||||
gridTab.navigate(rowIndex);
|
||||
}
|
||||
|
||||
public Listbox getListbox() {
|
||||
|
|
|
@ -29,6 +29,9 @@ public class GridTableListModel extends AbstractListModel implements ListitemRen
|
|||
private GridTable tableModel;
|
||||
private GridField[] gridField;
|
||||
private int windowNo;
|
||||
|
||||
private int pageSize = -1;
|
||||
private int pageNo = 0;
|
||||
|
||||
public GridTableListModel(GridTable tableModel, int windowNo) {
|
||||
this.tableModel = tableModel;
|
||||
|
@ -40,6 +43,9 @@ public class GridTableListModel extends AbstractListModel implements ListitemRen
|
|||
public Object getElementAt(int rowIndex) {
|
||||
int columnCount = tableModel.getColumnCount();
|
||||
Object[] values = new Object[columnCount];
|
||||
if (pageSize > 0) {
|
||||
rowIndex = (pageNo * pageSize) + rowIndex;
|
||||
}
|
||||
if (rowIndex < tableModel.getRowCount()) {
|
||||
for (int i = 0; i < columnCount; i++) {
|
||||
values[i] = tableModel.getValueAt(rowIndex, i);
|
||||
|
@ -48,9 +54,53 @@ public class GridTableListModel extends AbstractListModel implements ListitemRen
|
|||
|
||||
return values;
|
||||
}
|
||||
|
||||
/**
|
||||
* set current page no ( starting from 0 )
|
||||
* @param pg
|
||||
*/
|
||||
public void setPage(int pg) {
|
||||
if (pageNo != pg) {
|
||||
if (pg > 0) {
|
||||
int start = pg * pageSize;
|
||||
if (start >= tableModel.getRowCount()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
pageNo = pg;
|
||||
fireEvent(ListDataEvent.CONTENTS_CHANGED, -1, -1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return current page no ( starting from 0 )
|
||||
*/
|
||||
public int getPage() {
|
||||
return pageNo;
|
||||
}
|
||||
|
||||
public void setPageSize(int pgSize) {
|
||||
pageSize = pgSize;
|
||||
}
|
||||
|
||||
public int getPageSize() {
|
||||
return pageSize;
|
||||
}
|
||||
|
||||
public int getSize() {
|
||||
return tableModel.getRowCount();
|
||||
int total = tableModel.getRowCount();
|
||||
if (pageSize < 0)
|
||||
return total;
|
||||
else if ((total - ( pageNo * pageSize)) < 0) {
|
||||
pageNo = 0;
|
||||
return pageSize > total ? total : pageSize;
|
||||
} else {
|
||||
int end = (pageNo + 1) * pageSize;
|
||||
if (end > total)
|
||||
return total - ( pageNo * pageSize);
|
||||
else
|
||||
return pageSize;
|
||||
}
|
||||
}
|
||||
|
||||
public void render(Listitem listitem, Object data) throws Exception {
|
||||
|
@ -135,7 +185,10 @@ public class GridTableListModel extends AbstractListModel implements ListitemRen
|
|||
}
|
||||
|
||||
public Listcell newListcell(Listitem item) {
|
||||
return null;
|
||||
ListCell listCell = new ListCell();
|
||||
listCell.applyProperties();
|
||||
listCell.setParent(item);
|
||||
return listCell;
|
||||
}
|
||||
|
||||
public Listitem newListitem(Listbox listbox) {
|
||||
|
|
|
@ -407,27 +407,34 @@ public class WListItemRenderer implements ListitemRenderer, EventListener, Listi
|
|||
{
|
||||
ListHeader header = null;
|
||||
|
||||
String headerText = headerValue.toString();
|
||||
if (m_headers.size() <= headerIndex)
|
||||
{
|
||||
Comparator ascComparator = getColumnComparator(true, headerIndex);
|
||||
Comparator dscComparator = getColumnComparator(false, headerIndex);
|
||||
|
||||
header = new ListHeader(headerValue.toString());
|
||||
header = new ListHeader(headerText);
|
||||
|
||||
header.setSort("auto");
|
||||
header.setSortAscending(ascComparator);
|
||||
header.setSortDescending(dscComparator);
|
||||
|
||||
header.setWidth("auto");
|
||||
int width = headerText.trim().length() * 9;
|
||||
if (width > 300)
|
||||
width = 300;
|
||||
else if (width > 0 && width < 100)
|
||||
width = 100;
|
||||
|
||||
header.setWidth(width + "px");
|
||||
m_headers.add(header);
|
||||
}
|
||||
else
|
||||
{
|
||||
header = m_headers.get(headerIndex);
|
||||
|
||||
if (!header.getLabel().equals(headerValue.toString()))
|
||||
if (!header.getLabel().equals(headerText))
|
||||
{
|
||||
header.setLabel(headerValue.toString());
|
||||
header.setLabel(headerText);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -480,7 +487,6 @@ public class WListItemRenderer implements ListitemRenderer, EventListener, Listi
|
|||
head.appendChild(header);
|
||||
}
|
||||
head.setSizable(true);
|
||||
head.setWidth("auto");
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -671,7 +677,9 @@ public class WListItemRenderer implements ListitemRenderer, EventListener, Listi
|
|||
*/
|
||||
public Listcell newListcell(Listitem item)
|
||||
{
|
||||
return null;
|
||||
ListCell cell = new ListCell();
|
||||
cell.applyProperties();
|
||||
return cell;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -679,7 +687,10 @@ public class WListItemRenderer implements ListitemRenderer, EventListener, Listi
|
|||
*/
|
||||
public Listitem newListitem(Listbox listbox)
|
||||
{
|
||||
return new ListItem();
|
||||
ListItem item = new ListItem();
|
||||
item.applyProperties();
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -140,10 +140,10 @@ public class WListbox extends Listbox implements TableValueChangeListener, WTabl
|
|||
|
||||
head = super.getListHead();
|
||||
|
||||
//detach the old header
|
||||
//init only once
|
||||
if (head != null)
|
||||
{
|
||||
head.detach();
|
||||
return;
|
||||
}
|
||||
|
||||
head = new ListHead();
|
||||
|
@ -160,7 +160,7 @@ public class WListbox extends Listbox implements TableValueChangeListener, WTabl
|
|||
+ this.getItemRenderer().getClass().getSimpleName());
|
||||
}
|
||||
|
||||
//reattach the listhead
|
||||
//attach the listhead
|
||||
head.setParent(this);
|
||||
|
||||
return;
|
||||
|
|
|
@ -69,7 +69,7 @@ public class WStatusBar extends Grid implements EventListener
|
|||
// this.setBorder("normal");
|
||||
rows.appendChild(statusBar);
|
||||
this.appendChild(rows);
|
||||
this.setWidth("98%");
|
||||
this.setWidth("99%");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
|
@ -152,6 +152,12 @@ public abstract class WEditor implements EventListener, PropertyChangeListener
|
|||
|
||||
((HtmlBasedComponent)component).setTooltiptext(description);
|
||||
label.setTooltiptext(description);
|
||||
|
||||
//init listeners
|
||||
for (String event : this.getEvents())
|
||||
{
|
||||
component.addEventListener(event, this);
|
||||
}
|
||||
}
|
||||
|
||||
public GridField getGridField()
|
||||
|
@ -225,13 +231,6 @@ public abstract class WEditor implements EventListener, PropertyChangeListener
|
|||
return;
|
||||
}
|
||||
|
||||
if (listeners.size() == 0)
|
||||
{
|
||||
for (String event : this.getEvents())
|
||||
{
|
||||
component.addEventListener(event, this);
|
||||
}
|
||||
}
|
||||
listeners.add(listener);
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ import org.zkoss.zk.ui.event.Events;
|
|||
*/
|
||||
public class WNumberEditor extends WEditor
|
||||
{
|
||||
public final String[] LISTENER_EVENTS = {Events.ON_CHANGE};
|
||||
public static final String[] LISTENER_EVENTS = {Events.ON_CHANGE};
|
||||
|
||||
public static final int MAX_DISPLAY_LENGTH = 20;
|
||||
|
||||
|
|
|
@ -218,8 +218,8 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
|||
|
||||
private void actionRefresh(Object value)
|
||||
{
|
||||
boolean mandatory = isMandatory();
|
||||
AEnv.actionRefresh(lookup, value, mandatory);
|
||||
// boolean mandatory = isMandatory();
|
||||
// AEnv.actionRefresh(lookup, value, mandatory);
|
||||
setValue(value);
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ import org.zkoss.zk.ui.event.Events;
|
|||
public class WTableDirEditor extends WEditor implements ListDataListener,
|
||||
ContextMenuListener, IZoomableEditor
|
||||
{
|
||||
public final String[] LISTENER_EVENTS = {Events.ON_SELECT};
|
||||
public final static String[] LISTENER_EVENTS = {Events.ON_SELECT};
|
||||
|
||||
private static final CLogger logger;
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ import org.zkoss.zk.ui.event.Events;
|
|||
*/
|
||||
public class WYesNoEditor extends WEditor
|
||||
{
|
||||
public final String[] LISTENER_EVENTS = {Events.ON_CHECK};
|
||||
public static final String[] LISTENER_EVENTS = {Events.ON_CHECK};
|
||||
private static final CLogger logger;
|
||||
|
||||
static
|
||||
|
|
|
@ -738,6 +738,10 @@ DataStatusListener, ValueChangeListener, IADTabpanel
|
|||
else
|
||||
setSelectedNode(gridTab.getRecord_ID());
|
||||
}
|
||||
|
||||
if (listPanel.isVisible()) {
|
||||
listPanel.updateListIndex();
|
||||
}
|
||||
}
|
||||
|
||||
private void deleteNode(int recordId) {
|
||||
|
|
|
@ -39,6 +39,7 @@ import org.zkoss.zk.ui.event.EventListener;
|
|||
import org.zkoss.zk.ui.event.Events;
|
||||
import org.zkoss.zul.Hbox;
|
||||
import org.zkoss.zul.Intbox;
|
||||
import org.zkoss.zul.Separator;
|
||||
import org.zkoss.zul.Vbox;
|
||||
|
||||
/**
|
||||
|
@ -171,8 +172,7 @@ public class InfoBPartnerPanel extends InfoPanel implements EventListener, WTabl
|
|||
contentPanel = new WListbox();
|
||||
contentPanel.setWidth("99%");
|
||||
contentPanel.setHeight("400px");
|
||||
contentPanel.setStyle("overflow:auto");
|
||||
|
||||
contentPanel.setVflex(true);
|
||||
}
|
||||
|
||||
private void init()
|
||||
|
@ -259,18 +259,15 @@ public class InfoBPartnerPanel extends InfoPanel implements EventListener, WTabl
|
|||
parameterPanel.appendChild(vbox3);
|
||||
parameterPanel.appendChild(vbox4);
|
||||
|
||||
Vbox mainPanel = new Vbox();
|
||||
Panel mainPanel = new Panel();
|
||||
mainPanel.appendChild(parameterPanel);
|
||||
|
||||
/* Div div = new Div();
|
||||
div.setStyle("overflow:hidden");
|
||||
div.setWidth("1000px");
|
||||
div.appendChild(contentPanel);
|
||||
mainPanel.appendChild(div);*/
|
||||
|
||||
mainPanel.setWidth("100%");
|
||||
mainPanel.appendChild(new Separator());
|
||||
mainPanel.appendChild(contentPanel);
|
||||
mainPanel.appendChild(new Separator());
|
||||
mainPanel.appendChild(confirmPanel);
|
||||
mainPanel.appendChild(new Separator());
|
||||
mainPanel.appendChild(statusBar);
|
||||
|
||||
this.appendChild(mainPanel);
|
||||
|
|
|
@ -26,6 +26,7 @@ import java.util.ArrayList;
|
|||
import java.util.logging.Level;
|
||||
|
||||
import org.adempiere.webui.component.Label;
|
||||
import org.adempiere.webui.component.Panel;
|
||||
import org.adempiere.webui.component.Textbox;
|
||||
import org.adempiere.webui.component.WListbox;
|
||||
import org.adempiere.webui.event.WTableModelEvent;
|
||||
|
@ -38,7 +39,7 @@ import org.compiere.util.Env;
|
|||
import org.compiere.util.Msg;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
import org.zkoss.zul.Hbox;
|
||||
import org.zkoss.zul.Vbox;
|
||||
import org.zkoss.zul.Separator;
|
||||
|
||||
public class InfoGeneralPanel extends InfoPanel implements EventListener
|
||||
{
|
||||
|
@ -98,14 +99,17 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener
|
|||
parameterPanel.appendChild(lbl4);
|
||||
parameterPanel.appendChild(txt4);
|
||||
|
||||
Vbox mainPanel = new Vbox();
|
||||
Panel mainPanel = new Panel();
|
||||
mainPanel.setWidth("100%");
|
||||
mainPanel.appendChild(parameterPanel);
|
||||
|
||||
contentPanel.setWidth("99%");
|
||||
contentPanel.setHeight("400px");
|
||||
contentPanel.setStyle("overflow:auto");
|
||||
contentPanel.setVflex(true);
|
||||
|
||||
mainPanel.appendChild(new Separator());
|
||||
mainPanel.appendChild(contentPanel);
|
||||
mainPanel.appendChild(new Separator());
|
||||
mainPanel.appendChild(confirmPanel);
|
||||
|
||||
this.appendChild(mainPanel);
|
||||
|
|
|
@ -45,6 +45,7 @@ import org.compiere.util.Msg;
|
|||
import org.compiere.util.Util;
|
||||
import org.zkoss.zk.ui.WrongValueException;
|
||||
import org.zkoss.zul.Hbox;
|
||||
import org.zkoss.zul.Separator;
|
||||
import org.zkoss.zul.Vbox;
|
||||
|
||||
/**
|
||||
|
@ -175,7 +176,7 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
|
|||
contentPanel = new WListbox();
|
||||
contentPanel.setWidth("99%");
|
||||
contentPanel.setHeight("400px");
|
||||
contentPanel.setStyle("overflow:auto");
|
||||
contentPanel.setVflex(true);
|
||||
}
|
||||
|
||||
private void init()
|
||||
|
@ -265,14 +266,14 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
|
|||
parameterPanel.appendChild(vbox3);
|
||||
parameterPanel.setWidth("100%");
|
||||
|
||||
Vbox mainPanel = new Vbox();
|
||||
Panel mainPanel = new Panel();
|
||||
mainPanel.setWidth("100%");
|
||||
mainPanel.appendChild(parameterPanel);
|
||||
contentPanel.setWidth("99%");
|
||||
contentPanel.setHeight("400px");
|
||||
contentPanel.setStyle("overflow:auto");
|
||||
mainPanel.appendChild(new Separator());
|
||||
mainPanel.appendChild(contentPanel);
|
||||
mainPanel.appendChild(new Separator());
|
||||
mainPanel.appendChild(confirmPanel);
|
||||
mainPanel.appendChild(new Separator());
|
||||
mainPanel.appendChild(statusBar);
|
||||
|
||||
this.appendChild(mainPanel);
|
||||
|
|
|
@ -45,6 +45,7 @@ import org.compiere.util.Util;
|
|||
import org.zkoss.zk.ui.WrongValueException;
|
||||
import org.zkoss.zul.Div;
|
||||
import org.zkoss.zul.Hbox;
|
||||
import org.zkoss.zul.Separator;
|
||||
import org.zkoss.zul.Vbox;
|
||||
|
||||
/**
|
||||
|
@ -153,7 +154,7 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
|
|||
contentPanel = new WListbox();
|
||||
contentPanel.setWidth("99%");
|
||||
contentPanel.setHeight("400px");
|
||||
contentPanel.setStyle("overflow:auto");
|
||||
contentPanel.setVflex(true);
|
||||
}
|
||||
|
||||
public void init()
|
||||
|
@ -231,15 +232,14 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
|
|||
parameterPanel.appendChild(vbox3);
|
||||
parameterPanel.setWidth("100%");
|
||||
|
||||
Vbox mainPanel = new Vbox();
|
||||
Panel mainPanel = new Panel();
|
||||
mainPanel.setWidth("100%");
|
||||
mainPanel.appendChild(parameterPanel);
|
||||
Div div = new Div();
|
||||
div.setStyle("overflow:auto");
|
||||
div.setWidth("100%");
|
||||
div.appendChild(contentPanel);
|
||||
mainPanel.appendChild(div);
|
||||
mainPanel.appendChild(new Separator());
|
||||
mainPanel.appendChild(contentPanel);
|
||||
mainPanel.appendChild(new Separator());
|
||||
mainPanel.appendChild(confirmPanel);
|
||||
mainPanel.appendChild(new Separator());
|
||||
mainPanel.appendChild(statusBar);
|
||||
|
||||
this.appendChild(mainPanel);
|
||||
|
|
|
@ -23,6 +23,7 @@ import java.sql.ResultSet;
|
|||
import java.sql.SQLException;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
import java.util.logging.Level;
|
||||
|
||||
|
@ -46,6 +47,8 @@ import org.compiere.util.Msg;
|
|||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
import org.zkoss.zk.ui.event.Events;
|
||||
import org.zkoss.zul.Paging;
|
||||
import org.zkoss.zul.event.ZulEvents;
|
||||
|
||||
/**
|
||||
* Search Information and return selection - Base Class.
|
||||
|
@ -56,6 +59,8 @@ import org.zkoss.zk.ui.event.Events;
|
|||
public abstract class InfoPanel extends Window implements EventListener, WTableModelListener
|
||||
{
|
||||
|
||||
private final static int PAGE_SIZE = 100;
|
||||
|
||||
public static InfoPanel create (int WindowNo,
|
||||
String tableName, String keyColumn, String value,
|
||||
boolean multiSelection, String whereClause)
|
||||
|
@ -292,6 +297,8 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
protected CLogger log = CLogger.getCLogger(getClass());
|
||||
|
||||
protected WListbox contentPanel = new WListbox();
|
||||
private Paging paging;
|
||||
private int pageNo;
|
||||
|
||||
private static final String[] lISTENER_EVENTS = {};
|
||||
|
||||
|
@ -445,16 +452,48 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
|
||||
protected void renderItems()
|
||||
{
|
||||
Vector<String> columnHeader = getColumnHeader(p_layout);
|
||||
Vector<String> columnHeader = getColumnHeader(p_layout);
|
||||
if (line != null)
|
||||
{
|
||||
model = new ListModelTable(line);
|
||||
model.addTableModelListener(this);
|
||||
contentPanel.setData(model, columnHeader);
|
||||
if (line.size() > PAGE_SIZE)
|
||||
{
|
||||
if (paging == null)
|
||||
{
|
||||
paging = new Paging();
|
||||
paging.setPageSize(PAGE_SIZE);
|
||||
paging.setTotalSize(line.size());
|
||||
paging.setDetailed(true);
|
||||
paging.addEventListener(ZulEvents.ON_PAGING, this);
|
||||
contentPanel.getParent().insertBefore(paging, contentPanel.getNextSibling());
|
||||
}
|
||||
List<Object> subList = line.subList(0, PAGE_SIZE);
|
||||
model = new ListModelTable(subList);
|
||||
model.addTableModelListener(this);
|
||||
contentPanel.setData(model, columnHeader);
|
||||
|
||||
pageNo = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (paging != null)
|
||||
{
|
||||
paging.setTotalSize(line.size());
|
||||
pageNo = 0;
|
||||
}
|
||||
model = new ListModelTable(line);
|
||||
model.addTableModelListener(this);
|
||||
contentPanel.setData(model, columnHeader);
|
||||
}
|
||||
}
|
||||
int no = contentPanel.getRowCount();
|
||||
int no = line.size();
|
||||
setStatusLine(Integer.toString(no) + " " + Msg.getMsg(Env.getCtx(), "SearchRows_EnterQuery"), false);
|
||||
setStatusDB(Integer.toString(no));
|
||||
|
||||
//better performance
|
||||
// contentPanel.setFixedLayout(true);
|
||||
|
||||
//workaround for scrollbar position problem
|
||||
contentPanel.renderAll();
|
||||
}
|
||||
|
||||
|
||||
|
@ -789,6 +828,29 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
this.detach();
|
||||
}
|
||||
}
|
||||
else if (event.getTarget() == paging)
|
||||
{
|
||||
int pgNo = paging.getActivePage();
|
||||
if (pageNo != pgNo)
|
||||
{
|
||||
|
||||
contentPanel.clearSelection();
|
||||
|
||||
pageNo = pgNo;
|
||||
int start = pageNo * PAGE_SIZE;
|
||||
int end = start + PAGE_SIZE;
|
||||
if (end > line.size())
|
||||
end = line.size();
|
||||
List<Object> subList = line.subList(start, end);
|
||||
model = new ListModelTable(subList);
|
||||
model.addTableModelListener(this);
|
||||
contentPanel.setData(model, getColumnHeader(p_layout));
|
||||
|
||||
//workaround for scrollbar position problem
|
||||
contentPanel.renderAll();
|
||||
contentPanel.setSelectedIndex(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
} // onEvent
|
||||
|
||||
|
|
|
@ -60,8 +60,8 @@ import org.compiere.util.Msg;
|
|||
import org.compiere.util.Util;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
import org.zkoss.zk.ui.event.Events;
|
||||
import org.zkoss.zul.Div;
|
||||
import org.zkoss.zul.Hbox;
|
||||
import org.zkoss.zul.Separator;
|
||||
import org.zkoss.zul.Vbox;
|
||||
|
||||
/**
|
||||
|
@ -204,7 +204,7 @@ public final class InfoProductPanel extends InfoPanel implements EventListener
|
|||
contentPanel = new WListbox();
|
||||
contentPanel.setWidth("99%");
|
||||
contentPanel.setHeight("400px");
|
||||
contentPanel.setStyle("overflow:auto");
|
||||
contentPanel.setVflex(true);
|
||||
} // initComponents
|
||||
|
||||
private void init()
|
||||
|
@ -272,14 +272,12 @@ public final class InfoProductPanel extends InfoPanel implements EventListener
|
|||
parameterPanel.appendChild(vbox3);
|
||||
parameterPanel.appendChild(vbox4);
|
||||
|
||||
Vbox mainPanel = new Vbox();
|
||||
Panel mainPanel = new Panel();
|
||||
mainPanel.setWidth("100%");
|
||||
mainPanel.appendChild(parameterPanel);
|
||||
Div div = new Div();
|
||||
div.setStyle("overflow:auto");
|
||||
div.setWidth("100%");
|
||||
div.appendChild(contentPanel);
|
||||
mainPanel.appendChild(div);
|
||||
mainPanel.appendChild(new Separator());
|
||||
mainPanel.appendChild(contentPanel);
|
||||
mainPanel.appendChild(new Separator());
|
||||
mainPanel.appendChild(confirmPanel);
|
||||
|
||||
this.appendChild(mainPanel);
|
||||
|
|
|
@ -42,6 +42,7 @@ import org.zkoss.zul.Treechildren;
|
|||
import org.zkoss.zul.Treecol;
|
||||
import org.zkoss.zul.Treecols;
|
||||
import org.zkoss.zul.Treeitem;
|
||||
import org.zkoss.zul.Treerow;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -85,7 +86,6 @@ public class MenuPanel extends Panel implements EventListener
|
|||
menuTree = new Tree();
|
||||
menuTree.setMultiple(false);
|
||||
menuTree.setId("mnuMain");
|
||||
menuTree.addEventListener(Events.ON_SELECT, this);
|
||||
menuTree.setWidth("100%");
|
||||
menuTree.setHeight("100%");
|
||||
menuTree.setVflex(false);
|
||||
|
@ -175,17 +175,12 @@ public class MenuPanel extends Panel implements EventListener
|
|||
|
||||
treeitem.getTreerow().setDraggable("favourite"); // Elaine 2008/07/24
|
||||
pnlSearch.addTreeItem(treeitem);
|
||||
|
||||
treeitem.getTreerow().addEventListener(Events.ON_CLICK, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList getMenuItems()
|
||||
{
|
||||
ArrayList ret = new ArrayList();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public void addMenuListener(MenuListener menuListener)
|
||||
{
|
||||
menuListeners.add(menuListener);
|
||||
|
@ -201,16 +196,16 @@ public class MenuPanel extends Panel implements EventListener
|
|||
Component comp = event.getTarget();
|
||||
String eventName = event.getName();
|
||||
|
||||
if(eventName.equals(Events.ON_SELECT))
|
||||
if (eventName.equals(Events.ON_CLICK))
|
||||
{
|
||||
if(comp.equals(menuTree))
|
||||
{
|
||||
Treeitem selectedItem = menuTree.getSelectedItem();
|
||||
if (comp instanceof Treerow)
|
||||
{
|
||||
Treeitem selectedItem = (Treeitem) comp.getParent();
|
||||
if(selectedItem.getValue() != null)
|
||||
{
|
||||
fireMenuSelectedEvent(selectedItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ public class MenuSearchPanel extends Panel implements EventListener
|
|||
|
||||
public void onPostSelect() {
|
||||
Clients.showBusy(null, false);
|
||||
Event event = new Event(Events.ON_SELECT, menuPanel.getMenuTree());
|
||||
Event event = new Event(Events.ON_CLICK, menuPanel.getMenuTree().getSelectedItem().getTreerow());
|
||||
Events.postEvent(event);
|
||||
}
|
||||
|
||||
|
|
|
@ -32,8 +32,10 @@ import java.util.Vector;
|
|||
import java.util.logging.Level;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.adempiere.webui.LayoutUtils;
|
||||
import org.adempiere.webui.component.Button;
|
||||
import org.adempiere.webui.component.Combobox;
|
||||
import org.adempiere.webui.component.Grid;
|
||||
import org.adempiere.webui.component.Label;
|
||||
import org.adempiere.webui.component.ListCell;
|
||||
import org.adempiere.webui.component.ListHead;
|
||||
|
@ -41,6 +43,8 @@ import org.adempiere.webui.component.ListHeader;
|
|||
import org.adempiere.webui.component.ListItem;
|
||||
import org.adempiere.webui.component.Listbox;
|
||||
import org.adempiere.webui.component.Panel;
|
||||
import org.adempiere.webui.component.Row;
|
||||
import org.adempiere.webui.component.Rows;
|
||||
import org.adempiere.webui.component.Textbox;
|
||||
import org.adempiere.webui.component.ToolBar;
|
||||
import org.adempiere.webui.component.ToolBarButton;
|
||||
|
@ -73,6 +77,7 @@ import org.zkoss.zk.ui.event.EventListener;
|
|||
import org.zkoss.zk.ui.event.Events;
|
||||
import org.zkoss.zul.Comboitem;
|
||||
import org.zkoss.zul.Hbox;
|
||||
import org.zkoss.zul.Separator;
|
||||
import org.zkoss.zul.Vbox;
|
||||
|
||||
/**
|
||||
|
@ -106,7 +111,7 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
|
|||
//
|
||||
private Listbox advancedPanel;
|
||||
/** container of Simple Window contents */
|
||||
private Vbox contentSimple;
|
||||
private Grid contentSimple;
|
||||
/** Target Window No */
|
||||
private int m_targetWindowNo;
|
||||
/** Table ID */
|
||||
|
@ -150,6 +155,11 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
|
|||
|
||||
private int m_AD_Tab_ID = 1;
|
||||
private MUserQuery[] userQueries;
|
||||
private Rows contentSimpleRows;
|
||||
private Row pnlDocument;
|
||||
private Row pnlDescription;
|
||||
private Row pnlValue;
|
||||
private Row pnlName;
|
||||
|
||||
/** Index ColumnName = 0 */
|
||||
public static final int INDEX_COLUMNNAME = 0;
|
||||
|
@ -267,42 +277,38 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
|
|||
hboxButton.appendChild(pnlButtonRight);
|
||||
hboxButton.setWidth("100%");
|
||||
|
||||
Panel pnlDocument = new Panel();
|
||||
pnlDocument = new Row();
|
||||
pnlDocument.setId("pnlDocument");
|
||||
pnlDocument.appendChild(lblDocumentNo);
|
||||
pnlDocument.appendChild(LayoutUtils.makeRightAlign(lblDocumentNo));
|
||||
pnlDocument.appendChild(fieldDocumentNo);
|
||||
pnlDocument.setWidth("70%");
|
||||
pnlDocument.setAlign("right");
|
||||
|
||||
Panel pnlDescription = new Panel();
|
||||
pnlDescription.appendChild(lblDescription);
|
||||
pnlDescription = new Row();
|
||||
pnlDescription.appendChild(LayoutUtils.makeRightAlign(lblDescription));
|
||||
pnlDescription.appendChild(fieldDescription);
|
||||
pnlDescription.setWidth("70%");
|
||||
pnlDescription.setAlign("right");
|
||||
|
||||
Panel pnlValue = new Panel();
|
||||
pnlValue.appendChild(lblValue);
|
||||
pnlValue = new Row();
|
||||
pnlValue.appendChild(LayoutUtils.makeRightAlign(lblValue));
|
||||
pnlValue.appendChild(fieldValue);
|
||||
pnlValue.setWidth("70%");
|
||||
pnlValue.setAlign("right");
|
||||
|
||||
Panel pnlName = new Panel();
|
||||
pnlName.appendChild(lblName);
|
||||
pnlName = new Row();
|
||||
pnlName.appendChild(LayoutUtils.makeRightAlign(lblName));
|
||||
pnlName.appendChild(fieldName);
|
||||
pnlName.setWidth("70%");
|
||||
pnlName.setAlign("right");
|
||||
|
||||
contentSimple = new Vbox();
|
||||
contentSimple = new Grid();
|
||||
contentSimple.setId("contentSimple");
|
||||
contentSimple.setWidth("100%");
|
||||
contentSimple.setStyle("padding:10px; text-align:left");
|
||||
contentSimple.makeNoStrip();
|
||||
|
||||
contentSimpleRows = new Rows();
|
||||
contentSimple.appendChild(contentSimpleRows);
|
||||
|
||||
contentSimple.appendChild(pnlValue);
|
||||
contentSimple.appendChild(pnlName);
|
||||
contentSimple.appendChild(pnlDocument);
|
||||
contentSimple.appendChild(pnlDescription);
|
||||
contentSimpleRows.appendChild(pnlValue);
|
||||
contentSimpleRows.appendChild(pnlName);
|
||||
contentSimpleRows.appendChild(pnlDocument);
|
||||
contentSimpleRows.appendChild(pnlDescription);
|
||||
|
||||
winLookupRecord.appendChild(contentSimple);
|
||||
winLookupRecord.appendChild(new Separator());
|
||||
winLookupRecord.appendChild(hboxButton);
|
||||
winLookupRecord.setWidth("100%");
|
||||
winLookupRecord.addEventListener(Events.ON_OK, this);
|
||||
|
@ -452,20 +458,16 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
|
|||
} // for all target tab fields
|
||||
|
||||
// Disable simple query fields
|
||||
lblValue.setVisible(hasValue);
|
||||
fieldValue.setVisible(hasValue);
|
||||
pnlValue.setVisible(hasValue);
|
||||
if (hasValue)
|
||||
fieldValue.addEventListener(Events.ON_CHANGE,this);
|
||||
lblDocumentNo.setVisible(hasDocNo);
|
||||
fieldDocumentNo.setVisible(hasDocNo);
|
||||
pnlDocument.setVisible(hasDocNo);
|
||||
if (hasDocNo)
|
||||
fieldDocumentNo.addEventListener(Events.ON_CHANGE,this);
|
||||
lblName.setVisible(hasName);
|
||||
fieldName.setVisible(hasName);
|
||||
pnlName.setVisible(hasName);
|
||||
if (hasName)
|
||||
fieldName.addEventListener(Events.ON_CHANGE,this);
|
||||
lblDescription.setVisible(hasDescription);
|
||||
fieldDescription.setVisible(hasDescription);
|
||||
pnlDescription.setVisible(hasDescription);
|
||||
if (hasDescription)
|
||||
fieldDescription.addEventListener(Events.ON_CHANGE,this);
|
||||
|
||||
|
@ -627,17 +629,9 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
|
|||
|
||||
// Editor
|
||||
WEditor editor = null;
|
||||
if (mField.isLookup())
|
||||
{
|
||||
WTableDirEditor wd = new WTableDirEditor(mField);
|
||||
editor = wd;
|
||||
}
|
||||
else
|
||||
{
|
||||
editor = WebEditorFactory.getEditor(mField, false);
|
||||
editor.setMandatory(false);
|
||||
editor.setReadWrite(true);
|
||||
}
|
||||
editor = WebEditorFactory.getEditor(mField, false);
|
||||
editor.setMandatory(false);
|
||||
editor.setReadWrite(true);
|
||||
Label label = editor.getLabel();
|
||||
Component fieldLabel = editor.getComponent();
|
||||
|
||||
|
@ -645,13 +639,12 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
|
|||
if (displayLength > 0) // set it back
|
||||
mField.setDisplayLength(displayLength);
|
||||
//
|
||||
Panel panel = new Panel();
|
||||
panel.setWidth("70%");
|
||||
panel.setAlign("right");
|
||||
panel.appendChild(label);
|
||||
|
||||
Row panel = new Row();
|
||||
panel.appendChild(LayoutUtils.makeRightAlign(label));
|
||||
panel.appendChild(fieldLabel);
|
||||
|
||||
contentSimple.appendChild(panel);
|
||||
contentSimpleRows.appendChild(panel);
|
||||
m_sEditors.add(editor);
|
||||
|
||||
} // addSelectionColumn
|
||||
|
@ -1684,8 +1677,8 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
|
|||
if(evt.getSource() instanceof WSearchEditor)
|
||||
{
|
||||
WSearchEditor se = (WSearchEditor) evt.getSource();
|
||||
String display = se.getGridField().getLookup().getDisplay(evt.getNewValue().toString());
|
||||
label.setValue(display);
|
||||
se.setValue(evt.getNewValue());
|
||||
label.setValue(se.getDisplay());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue