IDEMPIERE-5570 Zk: Improve readability of code (#1984)

This commit is contained in:
hengsin 2023-08-29 17:40:20 +08:00 committed by GitHub
parent b7f1499d13
commit 158648ccdb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
197 changed files with 4058 additions and 1526 deletions

View File

@ -44,14 +44,14 @@ import org.zkoss.zul.Vlayout;
import org.zkoss.zul.ext.Selectable; import org.zkoss.zul.ext.Selectable;
/** /**
* Read only grid view for single or multi selection * Read only grid view for single or multiple selection
* @author Low Heng Sin * @author Low Heng Sin
* *
*/ */
public class GridTabSelectionListView extends Vlayout public class GridTabSelectionListView extends Vlayout
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = 4145737989132101461L; private static final long serialVersionUID = 4145737989132101461L;
@ -63,33 +63,45 @@ public class GridTabSelectionListView extends Vlayout
private int pageSize = 100; private int pageSize = 100;
/** GridFields of {@link #gridTab} */
private GridField[] gridField; private GridField[] gridField;
/** Table model (GridTable) of {@link #gridTab} */
private AbstractTableModel tableModel; private AbstractTableModel tableModel;
/** length of {@link #gridField} */
private int numColumns = 5; private int numColumns = 5;
private int windowNo; private int windowNo;
private GridTab gridTab; private GridTab gridTab;
/** true if {@link #init(GridTab)} have been called */
private boolean init; private boolean init;
/** Model of {@link #listbox} */
private SimpleGridTableListModel listModel; private SimpleGridTableListModel listModel;
/** Renderer of {@link #listbox} */
private GridTabSelectionListViewRenderer renderer; private GridTabSelectionListViewRenderer renderer;
private Box labelBox; private Box labelBox;
/** Custom column width from {@link MTabCustomization} */
private Map<Integer, String> columnWidthMap; private Map<Integer, String> columnWidthMap;
/** Show number of selected row */
private Label selectedLabel; private Label selectedLabel;
/**
* @param multiple
*/
public GridTabSelectionListView(boolean multiple) public GridTabSelectionListView(boolean multiple)
{ {
this(multiple, 0); this(multiple, 0);
} }
/** /**
* @param multiple true for multiple selection mode, false for single selection mode
* @param windowNo * @param windowNo
*/ */
public GridTabSelectionListView(boolean multiple, int windowNo) public GridTabSelectionListView(boolean multiple, int windowNo)
@ -110,7 +122,6 @@ public class GridTabSelectionListView extends Vlayout
} }
/** /**
*
* @param gridTab * @param gridTab
*/ */
public void init(GridTab gridTab) public void init(GridTab gridTab)
@ -125,6 +136,10 @@ public class GridTabSelectionListView extends Vlayout
this.init = true; this.init = true;
} }
/**
*
* @param gridTab
*/
private void setupFields(GridTab gridTab) { private void setupFields(GridTab gridTab) {
this.gridTab = gridTab; this.gridTab = gridTab;
tableModel = gridTab.getTableModel(); tableModel = gridTab.getTableModel();
@ -161,8 +176,7 @@ public class GridTabSelectionListView extends Vlayout
} }
/** /**
* * @return true if {@link #init(GridTab)} have been called
* @return boolean
*/ */
public boolean isInit() { public boolean isInit() {
return init; return init;
@ -186,7 +200,7 @@ public class GridTabSelectionListView extends Vlayout
} }
/** /**
* * Refresh (re-query) gridTab and call {@link #init(GridTab)} again.
* @param gridTab * @param gridTab
*/ */
public void refresh(GridTab gridTab) { public void refresh(GridTab gridTab) {
@ -209,11 +223,17 @@ public class GridTabSelectionListView extends Vlayout
this.pageSize = pageSize; this.pageSize = pageSize;
} }
/**
* Remove all child components
*/
public void clear() public void clear()
{ {
this.getChildren().clear(); this.getChildren().clear();
} }
/**
* Setup {@link #listbox} columns
*/
private void setupColumns() private void setupColumns()
{ {
if (init) return; if (init) return;
@ -257,6 +277,11 @@ public class GridTabSelectionListView extends Vlayout
listbox.appendChild(header); listbox.appendChild(header);
} }
/**
*
* @param columnName
* @return column index
*/
private int getColumnIndex(String columnName) { private int getColumnIndex(String columnName) {
for(int i = 0; i < gridTab.getTableModel().getColumnCount(); i++) { for(int i = 0; i < gridTab.getTableModel().getColumnCount(); i++) {
if (gridTab.getTableModel().getColumnName(i).equals(columnName)) { if (gridTab.getTableModel().getColumnName(i).equals(columnName)) {
@ -266,6 +291,9 @@ public class GridTabSelectionListView extends Vlayout
return -1; return -1;
} }
/**
* render {@link #listbox}
*/
private void render() private void render()
{ {
listbox.setStyle("min-height: 200px"); listbox.setStyle("min-height: 200px");
@ -285,6 +313,9 @@ public class GridTabSelectionListView extends Vlayout
labelBox.appendChild(selectedLabel); labelBox.appendChild(selectedLabel);
} }
/**
* Update model and renderer of {@link #listbox}
*/
private void updateModel() { private void updateModel() {
listModel = new SimpleGridTableListModel((GridTable)tableModel, windowNo); listModel = new SimpleGridTableListModel((GridTable)tableModel, windowNo);
listModel.setMultiple(listbox.isMultiple()); listModel.setMultiple(listbox.isMultiple());
@ -317,12 +348,15 @@ public class GridTabSelectionListView extends Vlayout
this.windowNo = windowNo; this.windowNo = windowNo;
} }
/**
* @return GridField[]
*/
public GridField[] getFields() { public GridField[] getFields() {
return gridField; return gridField;
} }
/* (non-Javadoc) /**
* @see org.zkoss.zk.ui.AbstractComponent#addEventListener(int, java.lang.String, org.zkoss.zk.ui.event.EventListener) * If evtnm is ON_SElECT, add to {@link #listbox}, otherwise add to this component
*/ */
@Override @Override
public boolean addEventListener(int priority, String evtnm, public boolean addEventListener(int priority, String evtnm,
@ -334,6 +368,10 @@ public class GridTabSelectionListView extends Vlayout
} }
} }
/**
* Set selected indices for {@link #listbox}
* @param selectedIndices
*/
public void setSelectedIndices(int[] selectedIndices) { public void setSelectedIndices(int[] selectedIndices) {
ListModel<Object> model = listbox.getModel(); ListModel<Object> model = listbox.getModel();
if (model != null && model instanceof Selectable) { if (model != null && model instanceof Selectable) {
@ -351,6 +389,9 @@ public class GridTabSelectionListView extends Vlayout
selectedLabel.setValue(Msg.getMsg(Env.getCtx(), "Selected") + " : " + selectedIndices.length); selectedLabel.setValue(Msg.getMsg(Env.getCtx(), "Selected") + " : " + selectedIndices.length);
} }
/**
* Clear {@link #listbox} selections
*/
public void clearSelection() { public void clearSelection() {
ListModel<Object> model = listbox.getModel(); ListModel<Object> model = listbox.getModel();
if (model != null && model instanceof Selectable) { if (model != null && model instanceof Selectable) {
@ -362,6 +403,10 @@ public class GridTabSelectionListView extends Vlayout
selectedLabel.setValue(Msg.getMsg(Env.getCtx(), "Selected") + " : 0"); selectedLabel.setValue(Msg.getMsg(Env.getCtx(), "Selected") + " : 0");
} }
/**
*
* @param selected
*/
public void setSelectedIndex(int selected) { public void setSelectedIndex(int selected) {
ListModel<Object> model = listbox.getModel(); ListModel<Object> model = listbox.getModel();
if (model != null && model instanceof Selectable) { if (model != null && model instanceof Selectable) {

View File

@ -34,7 +34,7 @@ import org.zkoss.zul.ListitemRendererExt;
import org.zkoss.zul.RendererCtrl; import org.zkoss.zul.RendererCtrl;
/** /**
* ListItem renderer for GridTabSelectionListView * ListItem renderer for {@link GridTabSelectionListView}
* @author hengsin * @author hengsin
* *
*/ */
@ -126,6 +126,12 @@ public class GridTabSelectionListViewRenderer implements ListitemRenderer<GridTa
} }
} }
/**
* Create {@link Listcell} for gridField and value
* @param gridField
* @param value
* @return Listcell
*/
private Listcell renderCell(GridField gridField, Object value) { private Listcell renderCell(GridField gridField, Object value) {
Listcell cell; Listcell cell;
if (gridField.getDisplayType() == DisplayType.YesNo) { if (gridField.getDisplayType() == DisplayType.YesNo) {
@ -186,6 +192,12 @@ public class GridTabSelectionListViewRenderer implements ListitemRenderer<GridTa
return item; return item;
} }
/**
*
* @param gridField
* @param value
* @return display text
*/
private String getDisplayText(GridField gridField, Object value) private String getDisplayText(GridField gridField, Object value)
{ {
if (value == null) if (value == null)
@ -211,15 +223,14 @@ public class GridTabSelectionListViewRenderer implements ListitemRenderer<GridTa
/** /**
* Is renderer initialize * Is renderer initialize
* @return boolean * @return true if initialize, false otherwise
*/ */
public boolean isInitialize() { public boolean isInitialize() {
return !editors.isEmpty(); return !editors.isEmpty();
} }
/** /**
* * @return field editor list
* @return active editor list
*/ */
public List<WEditor> getEditors() { public List<WEditor> getEditors() {
List<WEditor> editorList = new ArrayList<WEditor>(); List<WEditor> editorList = new ArrayList<WEditor>();
@ -247,10 +258,16 @@ public class GridTabSelectionListViewRenderer implements ListitemRenderer<GridTa
public void doTry() { public void doTry() {
} }
/**
* @param listView
*/
public void setListView (GridTabSelectionListView listView) { public void setListView (GridTabSelectionListView listView) {
this.listView = listView; this.listView = listView;
} }
/**
* @return GridTabSelectionListView
*/
public GridTabSelectionListView getListView() { public GridTabSelectionListView getListView() {
return listView; return listView;
} }

View File

@ -1,19 +1,44 @@
/** /***********************************************************************
* * This file is part of iDempiere ERP Open Source *
*/ * http://www.idempiere.org *
* *
* Copyright (C) Contributors *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* 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., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301, USA. *
* *
* Contributors: *
* - hengsin *
**********************************************************************/
package org.adempiere.webui.editor.grid.selection; package org.adempiere.webui.editor.grid.selection;
/** /**
* A GridTable record/row.
* @author hengsin * @author hengsin
* *
*/ */
public class GridTableRow { public class GridTableRow {
/** record/row id */
private int id; private int id;
/** record/row values */
private Object[] values; private Object[] values;
/** /**
* * @param id
* @param values
*/ */
public GridTableRow(int id, Object[] values) { public GridTableRow(int id, Object[] values) {
this.id = id; this.id = id;
@ -28,6 +53,9 @@ public class GridTableRow {
return id; return id;
} }
/**
* @return record/row values
*/
public Object[] getValues() { public Object[] getValues() {
return values; return values;
} }

View File

@ -29,14 +29,14 @@ import org.zkoss.zul.event.ListDataEvent;
import org.zkoss.zul.ext.Sortable; import org.zkoss.zul.ext.Sortable;
/** /**
* * ListModel for {@link GridTabSelectionListView}
* @author Low Heng Sin * @author Low Heng Sin
* *
*/ */
public class SimpleGridTableListModel extends AbstractListModel<GridTableRow> implements TableModelListener, Sortable<Object> { public class SimpleGridTableListModel extends AbstractListModel<GridTableRow> implements TableModelListener, Sortable<Object> {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = 698185856751242764L; private static final long serialVersionUID = 698185856751242764L;
private GridTable tableModel; private GridTable tableModel;
@ -61,6 +61,7 @@ public class SimpleGridTableListModel extends AbstractListModel<GridTableRow> im
* @param rowIndex * @param rowIndex
* @see ListModel#getElementAt(int) * @see ListModel#getElementAt(int)
*/ */
@Override
public GridTableRow getElementAt(int rowIndex) { public GridTableRow getElementAt(int rowIndex) {
GridTableRow row = null; GridTableRow row = null;
int columnCount = tableModel.getColumnCount(); int columnCount = tableModel.getColumnCount();
@ -80,6 +81,7 @@ public class SimpleGridTableListModel extends AbstractListModel<GridTableRow> im
* @return int * @return int
* @see ListModel#getSize() * @see ListModel#getSize()
*/ */
@Override
public int getSize() { public int getSize() {
return tableModel.getRowCount(); return tableModel.getRowCount();
} }
@ -109,6 +111,7 @@ public class SimpleGridTableListModel extends AbstractListModel<GridTableRow> im
* @param ascending * @param ascending
* @see ListModelExt#sort(Comparator, boolean) * @see ListModelExt#sort(Comparator, boolean)
*/ */
@Override
public void sort(Comparator<Object> cmpr, boolean ascending) { public void sort(Comparator<Object> cmpr, boolean ascending) {
//use default zk comparator //use default zk comparator
if (cmpr instanceof ListitemComparator) { if (cmpr instanceof ListitemComparator) {
@ -129,6 +132,7 @@ public class SimpleGridTableListModel extends AbstractListModel<GridTableRow> im
* @param e * @param e
* @see TableModelListener#tableChanged(TableModelEvent) * @see TableModelListener#tableChanged(TableModelEvent)
*/ */
@Override
public void tableChanged(TableModelEvent e) { public void tableChanged(TableModelEvent e) {
if (Executions.getCurrent() != null) { if (Executions.getCurrent() != null) {
if (e.getType() == TableModelEvent.DELETE) if (e.getType() == TableModelEvent.DELETE)

View File

@ -32,6 +32,7 @@ import org.compiere.model.GridField;
import org.compiere.model.GridTab; import org.compiere.model.GridTab;
import org.compiere.model.GridTabVO; import org.compiere.model.GridTabVO;
import org.compiere.model.GridWindow; import org.compiere.model.GridWindow;
import org.compiere.util.DisplayType;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.Msg; import org.compiere.util.Msg;
import org.compiere.util.Util; import org.compiere.util.Util;
@ -43,7 +44,8 @@ import org.zkoss.zul.Menuitem;
import org.zkoss.zul.ext.Selectable; import org.zkoss.zul.ext.Selectable;
/** /**
* * Default editor for {@link DisplayType#MultipleSelectionGrid}.
* Implemented with {@link GridTabSelectionListView} component.
* @author hengsin * @author hengsin
* *
*/ */
@ -51,10 +53,12 @@ public class WGridTabMultiSelectionEditor extends WEditor implements ContextMenu
{ {
private static final String[] LISTENER_EVENTS = {Events.ON_SELECT}; private static final String[] LISTENER_EVENTS = {Events.ON_SELECT};
/** comma separated list of selected row indices */
private Object oldValue; private Object oldValue;
private GridTab listViewGridTab = null; private GridTab listViewGridTab = null;
/** current value of link column */
private String currentLinkValue = null; private String currentLinkValue = null;
private boolean readWrite; private boolean readWrite;
@ -107,6 +111,9 @@ public class WGridTabMultiSelectionEditor extends WEditor implements ContextMenu
this.readWrite = readWrite; this.readWrite = readWrite;
} }
/**
* Initialize component and context menu
*/
private void init() private void init()
{ {
if (tableEditor) if (tableEditor)
@ -147,6 +154,7 @@ public class WGridTabMultiSelectionEditor extends WEditor implements ContextMenu
} }
} }
@Override
public void onEvent(Event event) public void onEvent(Event event)
{ {
if (Events.ON_SELECT.equals(event.getName())) if (Events.ON_SELECT.equals(event.getName()))
@ -225,6 +233,9 @@ public class WGridTabMultiSelectionEditor extends WEditor implements ContextMenu
((Textbox)getComponent()).setValue(oldValue != null ? oldValue.toString() : ""); ((Textbox)getComponent()).setValue(oldValue != null ? oldValue.toString() : "");
} }
/**
* Update selected row from {@link #oldValue}
*/
private void updateSlectedIndices() { private void updateSlectedIndices() {
GridTabSelectionListView listView = (GridTabSelectionListView) getComponent(); GridTabSelectionListView listView = (GridTabSelectionListView) getComponent();
if (!Util.isEmpty((String)oldValue)) if (!Util.isEmpty((String)oldValue))
@ -259,6 +270,7 @@ public class WGridTabMultiSelectionEditor extends WEditor implements ContextMenu
return LISTENER_EVENTS; return LISTENER_EVENTS;
} }
@Override
public void onMenu(ContextMenuEvent evt) public void onMenu(ContextMenuEvent evt)
{ {
if (WEditorPopupMenu.PREFERENCE_EVENT.equals(evt.getContextEvent())) if (WEditorPopupMenu.PREFERENCE_EVENT.equals(evt.getContextEvent()))

View File

@ -27,6 +27,7 @@ import org.compiere.model.GridField;
import org.compiere.model.GridTab; import org.compiere.model.GridTab;
import org.compiere.model.GridTabVO; import org.compiere.model.GridTabVO;
import org.compiere.model.GridWindow; import org.compiere.model.GridWindow;
import org.compiere.util.DisplayType;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.Msg; import org.compiere.util.Msg;
import org.compiere.util.Util; import org.compiere.util.Util;
@ -36,7 +37,8 @@ import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Menuitem; import org.zkoss.zul.Menuitem;
/** /**
* * Default editor for {@link DisplayType#SingleSelectionGrid}.
* Implemented with {@link GridTabSelectionListView} component.
* @author hengsin * @author hengsin
* *
*/ */
@ -44,10 +46,12 @@ public class WGridTabSingleSelectionEditor extends WEditor implements ContextMen
{ {
private static final String[] LISTENER_EVENTS = {Events.ON_SELECT}; private static final String[] LISTENER_EVENTS = {Events.ON_SELECT};
/** selected row index */
private Object oldValue; private Object oldValue;
private GridTab listViewGridTab = null; private GridTab listViewGridTab = null;
/** current value of link column */
private String currentLinkValue = null; private String currentLinkValue = null;
private boolean readWrite; private boolean readWrite;
@ -100,6 +104,9 @@ public class WGridTabSingleSelectionEditor extends WEditor implements ContextMen
this.readWrite = readWrite; this.readWrite = readWrite;
} }
/**
* Initialize component and context menu
*/
private void init() private void init()
{ {
if (tableEditor) if (tableEditor)
@ -140,6 +147,7 @@ public class WGridTabSingleSelectionEditor extends WEditor implements ContextMen
} }
} }
@Override
public void onEvent(Event event) public void onEvent(Event event)
{ {
if (Events.ON_SELECT.equals(event.getName())) if (Events.ON_SELECT.equals(event.getName()))
@ -189,6 +197,9 @@ public class WGridTabSingleSelectionEditor extends WEditor implements ContextMen
((Textbox)getComponent()).setValue(oldValue != null ? oldValue.toString() : ""); ((Textbox)getComponent()).setValue(oldValue != null ? oldValue.toString() : "");
} }
/**
* Update selected row indices from {@link #oldValue}
*/
private void updateSlectedIndices() { private void updateSlectedIndices() {
GridTabSelectionListView listView = (GridTabSelectionListView) getComponent(); GridTabSelectionListView listView = (GridTabSelectionListView) getComponent();
listView.clearSelection(); listView.clearSelection();
@ -210,6 +221,7 @@ public class WGridTabSingleSelectionEditor extends WEditor implements ContextMen
return LISTENER_EVENTS; return LISTENER_EVENTS;
} }
@Override
public void onMenu(ContextMenuEvent evt) public void onMenu(ContextMenuEvent evt)
{ {
if (WEditorPopupMenu.PREFERENCE_EVENT.equals(evt.getContextEvent())) if (WEditorPopupMenu.PREFERENCE_EVENT.equals(evt.getContextEvent()))

View File

@ -18,7 +18,7 @@
package org.adempiere.webui.event; package org.adempiere.webui.event;
/** /**
* ActionEvent represents events associated with no data change. * Event for UI action
* *
* @author Niraj Sohun * @author Niraj Sohun
* @date Jul 25, 2007 * @date Jul 25, 2007
@ -55,7 +55,7 @@ public class ActionEvent
} }
/** /**
* returns name of property that changed * @return name of property that changed
*/ */
public String getPropertyName() public String getPropertyName()
{ {
@ -63,7 +63,7 @@ public class ActionEvent
} }
/** /**
* returns source of event * @return source of event
*/ */
public Object getSource() public Object getSource()
{ {
@ -71,7 +71,7 @@ public class ActionEvent
} }
/** /**
* returns name of event * @return name of event
*/ */
public String getEventName() public String getEventName()
{ {

View File

@ -18,13 +18,15 @@
package org.adempiere.webui.event; package org.adempiere.webui.event;
/** /**
* ActionListener handles events associated with no data change. * Listener interface for {@link ActionEvent}
* *
* @author Niraj Sohun * @author Niraj Sohun
* @date Jul 25, 2007 * @date Jul 25, 2007
*/ */
public interface ActionListener public interface ActionListener
{ {
/**
* @param event
*/
void actionPerformed(ActionEvent event); void actionPerformed(ActionEvent event);
} }

View File

@ -20,13 +20,14 @@ package org.adempiere.webui.event;
import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Component;
/** /**
* * Event for context menu (right-click menu) action
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a> * @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @date Mar 10, 2007 * @date Mar 10, 2007
* @version $Revision: 0.10 $ * @version $Revision: 0.10 $
*/ */
public class ContextMenuEvent public class ContextMenuEvent
{ {
/** Event id/name */
private String contextEvent; private String contextEvent;
private Component target; private Component target;

View File

@ -18,12 +18,15 @@
package org.adempiere.webui.event; package org.adempiere.webui.event;
/** /**
* * Listener interface for {@link ContextMenuEvent}
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a> * @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @date Mar 10, 2007 * @date Mar 10, 2007
* @version $Revision: 0.10 $ * @version $Revision: 0.10 $
*/ */
public interface ContextMenuListener public interface ContextMenuListener
{ {
/**
* @param evt
*/
public void onMenu(ContextMenuEvent evt); public void onMenu(ContextMenuEvent evt);
} }

View File

@ -14,9 +14,8 @@
package org.adempiere.webui.event; package org.adempiere.webui.event;
/** /**
* * Event constant for popup modal/highlighted dialog.
* @author hengsin * @author hengsin
*
*/ */
public interface DialogEvents { public interface DialogEvents {
@ -26,7 +25,7 @@ public interface DialogEvents {
public final static String ON_WINDOW_CLOSE = "onWindowClose"; public final static String ON_WINDOW_CLOSE = "onWindowClose";
/** /**
* rise event before run process, other code can inject a long process in there * event before running of process, other code can inject a long process in there
* example: at info window, save info to database before run process * example: at info window, save info to database before run process
*/ */
public final static String ON_BEFORE_RUN_PROCESS = "onBeforeRunProcess"; public final static String ON_BEFORE_RUN_PROCESS = "onBeforeRunProcess";

View File

@ -18,23 +18,30 @@ import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.Event;
/** /**
* * Event for drill down and drill across
* @author hengsin * @author hengsin
*
*/ */
public class DrillEvent extends Event { public class DrillEvent extends Event {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = 4877800961258241047L; private static final long serialVersionUID = 4877800961258241047L;
public final static String ON_DRILL_DOWN = "onDrillDown"; public final static String ON_DRILL_DOWN = "onDrillDown";
public final static String ON_DRILL_ACROSS = "onDrillAcross"; public final static String ON_DRILL_ACROSS = "onDrillAcross";
/**
* @param name
* @param target
* @param data
*/
public DrillEvent(String name, Component target, Object data) { public DrillEvent(String name, Component target, Object data) {
super(name, target, data); super(name, target, data);
} }
/**
* Data for drill event
*/
public static class DrillData { public static class DrillData {
private MQuery query; private MQuery query;
@ -50,6 +57,13 @@ public class DrillEvent extends Event {
*/ */
private Object data; private Object data;
/**
* @param query
* @param columnName
* @param value
* @param displayValue
* @param data
*/
public DrillData(MQuery query, String columnName, Object value, String displayValue, Object data) { public DrillData(MQuery query, String columnName, Object value, String displayValue, Object data) {
this.query = query; this.query = query;
this.columnName = columnName; this.columnName = columnName;
@ -58,27 +72,40 @@ public class DrillEvent extends Event {
this.displayValue = displayValue; this.displayValue = displayValue;
} }
/**
* @return MQuery
*/
public MQuery getQuery() { public MQuery getQuery() {
return query; return query;
} }
/**
* @return column name
*/
public String getColumnName() { public String getColumnName() {
return columnName; return columnName;
} }
/**
* @return value
*/
public Object getValue() { public Object getValue() {
return value; return value;
} }
/**
* @return [columnName, displayValue, value, processID - source]
*/
public Object getData() { public Object getData() {
return data; return data;
} }
/**
* @return display text
*/
public String getDisplayValue() { public String getDisplayValue() {
return displayValue; return displayValue;
} }
} }
} }

View File

@ -18,12 +18,15 @@
package org.adempiere.webui.event; package org.adempiere.webui.event;
/** /**
* * Listener interface for application menu item
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a> * @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @date Feb 25, 2007 * @date Feb 25, 2007
* @version $Revision: 0.10 $ * @version $Revision: 0.10 $
*/ */
public interface MenuListener public interface MenuListener
{ {
/**
* @param menuId AD_Menu_ID
*/
public void onMenuSelected(int menuId); public void onMenuSelected(int menuId);
} }

View File

@ -34,12 +34,12 @@ public class TableValueChangeEvent extends ValueChangeEvent
/** /**
* Constructor for the event. * Constructor for the event.
* *
* @param source The object that changed * @param source Source of event
* @param propertyName The column name of the changed object * @param propertyName Column name
* @param row The row of the changed object * @param row Row index
* @param column The column of the changed object * @param column Column index
* @param oldValue The new value of the object * @param oldValue The old value of the object
* @param newValue The old value of the object (often just a copy of the new value) * @param newValue The new value of the object (often just a copy of the new value)
*/ */
public TableValueChangeEvent(Object source, String propertyName, public TableValueChangeEvent(Object source, String propertyName,
int row, int column, int row, int column,

View File

@ -18,17 +18,15 @@
package org.adempiere.webui.event; package org.adempiere.webui.event;
/** /**
* Interface specifying the functions * Listener interface for {@link TableValueChangeEvent}.
* that must be implemented to listen for a TableValueChangeEvent event
* *
* @author Andrew Kimball * @author Andrew Kimball
*/ */
public interface TableValueChangeListener public interface TableValueChangeListener
{ {
/** /**
* Respond to a TableValueChangeEvent event * Respond to a TableValueChangeEvent event.<br/>
* Notifies this listener that an event has occurred. * To listen to the event, you have to register it first by calling
* To get the event, you have to register it first by use of
* {@link org.adempiere.webui.component.WListItemRenderer#addTableValueChangeListener(TableValueChangeListener)} * {@link org.adempiere.webui.component.WListItemRenderer#addTableValueChangeListener(TableValueChangeListener)}
* *
* @param event The event that has occurred * @param event The event that has occurred

View File

@ -24,7 +24,7 @@ import org.zkoss.zk.ui.event.Event;
public class TokenEvent extends Event { public class TokenEvent extends Event {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = 7727018026113457776L; private static final long serialVersionUID = 7727018026113457776L;
/** on loading of user token **/ /** on loading of user token **/

View File

@ -17,8 +17,10 @@
package org.adempiere.webui.event; package org.adempiere.webui.event;
import org.adempiere.webui.adwindow.ADWindowToolbar;
/** /**
* * Listener interface for {@link ADWindowToolbar}.
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a> * @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @date Feb 25, 2007 * @date Feb 25, 2007
* @version $Revision: 0.10 $ * @version $Revision: 0.10 $
@ -175,6 +177,9 @@ public interface ToolbarListener
*/ */
public void onCustomize(); public void onCustomize();
/**
* Process (gear icon) button
*/
public void onProcess(); public void onProcess();
/** /**

View File

@ -19,8 +19,8 @@ import org.zkoss.zul.Grid;
/** /**
* @author hengsin * @author hengsin
*
*/ */
@Deprecated(forRemoval = true, since = "11")
public class TouchEventHelper { public class TouchEventHelper {
private static final String TABLET_SCROLLING_FIX_INIT = "tablet.scrolling.fix.init"; private static final String TABLET_SCROLLING_FIX_INIT = "tablet.scrolling.fix.init";

View File

@ -18,7 +18,7 @@
package org.adempiere.webui.event; package org.adempiere.webui.event;
/** /**
* * Value change event for a named property.
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a> * @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @date Mar 10, 2007 * @date Mar 10, 2007
* @version $Revision: 0.10 $ * @version $Revision: 0.10 $
@ -32,7 +32,7 @@ public class ValueChangeEvent
protected Object source; protected Object source;
/** /**
* name of the property that changed. May be null, if not known. * name of the property that changed
*/ */
private String propertyName; private String propertyName;
@ -47,9 +47,15 @@ public class ValueChangeEvent
private Object oldValue; private Object oldValue;
// IDEMPIERE-1287:indicate case user just start edit field, want update status of toolbar button (like save button) // IDEMPIERE-1287:indicate case user just start edit field, want update status of toolbar button (like save button)
// but don't want change anything (ever value of edit field) // but don't want change anything (even value of edit field)
private boolean isInitEdit = false; private boolean isInitEdit = false;
/**
* @param source
* @param propertyName
* @param oldValue
* @param newValue
*/
public ValueChangeEvent(Object source, String propertyName, public ValueChangeEvent(Object source, String propertyName,
Object oldValue, Object newValue) Object oldValue, Object newValue)
{ {
@ -59,16 +65,25 @@ public class ValueChangeEvent
this.oldValue = oldValue; this.oldValue = oldValue;
} }
/**
* @return new value
*/
public Object getNewValue() public Object getNewValue()
{ {
return newValue; return newValue;
} }
/**
* @return old/previous value
*/
public Object getOldValue() public Object getOldValue()
{ {
return oldValue; return oldValue;
} }
/**
* @return property name
*/
public String getPropertyName() public String getPropertyName()
{ {
return propertyName; return propertyName;

View File

@ -18,12 +18,15 @@
package org.adempiere.webui.event; package org.adempiere.webui.event;
/** /**
* * Listener interface for {@link ValueChangeEvent}
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a> * @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @date Mar 10, 2007 * @date Mar 10, 2007
* @version $Revision: 0.10 $ * @version $Revision: 0.10 $
*/ */
public interface ValueChangeListener public interface ValueChangeListener
{ {
/**
* @param evt
*/
public void valueChange(ValueChangeEvent evt); public void valueChange(ValueChangeEvent evt);
} }

View File

@ -17,12 +17,13 @@
package org.adempiere.webui.event; package org.adempiere.webui.event;
import org.adempiere.webui.component.ListModelTable;
import org.zkoss.zul.ListModel; import org.zkoss.zul.ListModel;
import org.zkoss.zul.event.ListDataEvent; import org.zkoss.zul.event.ListDataEvent;
/** /**
* Change event for {@link ListModelTable}
* @author andy * @author andy
*
*/ */
public class WTableModelEvent extends ListDataEvent public class WTableModelEvent extends ListDataEvent
{ {
@ -42,11 +43,9 @@ public class WTableModelEvent extends ListDataEvent
/** /**
* All row data in the table has changed, listeners should discard any state * All row data in the table has changed, listeners should discard any state
* that was based on the rows and requery the <code>TableModel</code> to * that was based on the rows and requery the <code>TableModel</code> to
* get the new row count and all the appropriate values. The * get the new row count and all the appropriate values.<br/>
* <code>WListbox</code> will repaint the entire visible region on receiving * The <code>WListbox</code> will initiate repaint on receiving this event,
* this event, querying the model for the cell values that are visible. The * querying the model for the cell values that are visible.<br/>
* structure of the table ie, the column names, types and order have not
* changed.
* *
* @param source The list model that has changed * @param source The list model that has changed
*/ */
@ -60,7 +59,7 @@ public class WTableModelEvent extends ListDataEvent
/** /**
* This row of data has been updated. To denote the arrival of a completely * This row of data has been updated. To denote the arrival of a completely
* new table with a different structure use <code>HEADER_ROW</code> as the * new table with a different structure use <code>HEADER_ROW</code> as the
* value for the <code>row</code>. * value for the <code>row</code> argument.
* *
* @param source The list model that has changed * @param source The list model that has changed
* @param row Index of the affected row * @param row Index of the affected row

View File

@ -18,8 +18,7 @@
package org.adempiere.webui.event; package org.adempiere.webui.event;
/** /**
* WTableModelListener defines the interface for an object that listens * Listener interface for {@link WTableModelEvent}
* to changes in a WTableModel.
* *
* @author Andrew Kimball * @author Andrew Kimball
* *
@ -28,8 +27,8 @@ package org.adempiere.webui.event;
public interface WTableModelListener public interface WTableModelListener
{ {
/** /**
* This fine grain notification tells listeners the exact range * Notify listeners the exact range
* of cells, rows, or columns that changed. * of cells, rows, or columns that have changed.
* *
* @param event table model event * @param event table model event
*/ */

View File

@ -15,10 +15,12 @@
package org.adempiere.webui.event; package org.adempiere.webui.event;
import org.compiere.util.WebUtil; import org.compiere.util.WebUtil;
import org.idempiere.broadcast.BroadCastMsg; import org.idempiere.broadcast.BroadCastMsg;
import org.idempiere.broadcast.BroadCastUtil; import org.idempiere.broadcast.BroadCastUtil;
import org.idempiere.broadcast.BroadcastMsgUtil; import org.idempiere.broadcast.BroadcastMsgUtil;
import org.idempiere.distributed.ITopicSubscriber; import org.idempiere.distributed.ITopicSubscriber;
/** /**
* Class Manages Broadcast Messages across webui cluster * Class Manages Broadcast Messages across webui cluster
* @author Deepak Pansheriya * @author Deepak Pansheriya
@ -26,12 +28,20 @@ import org.idempiere.distributed.ITopicSubscriber;
*/ */
public class ZKBroadCastManager implements ITopicSubscriber<BroadCastMsg>{ public class ZKBroadCastManager implements ITopicSubscriber<BroadCastMsg>{
/** Global share singleton instance */
private final static ZKBroadCastManager broadCastMgr = new ZKBroadCastManager(); private final static ZKBroadCastManager broadCastMgr = new ZKBroadCastManager();
/**
* Get singleton instance
* @return ZKBroadCastManager
*/
public static ZKBroadCastManager getBroadCastMgr() { public static ZKBroadCastManager getBroadCastMgr() {
return broadCastMgr; return broadCastMgr;
} }
/**
* Default constructor
*/
private ZKBroadCastManager(){ private ZKBroadCastManager(){
BroadCastUtil.subscribe(this); BroadCastUtil.subscribe(this);
} }

View File

@ -24,11 +24,15 @@ import org.zkoss.zk.ui.event.Event;
public class ZoomEvent extends Event { public class ZoomEvent extends Event {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = -8857628145535148973L; private static final long serialVersionUID = -8857628145535148973L;
public final static String EVENT_NAME = "onZoom"; public final static String EVENT_NAME = "onZoom";
/**
* @param target
* @param data
*/
public ZoomEvent(Component target, Object data) { public ZoomEvent(Component target, Object data) {
super(EVENT_NAME, target, data); super(EVENT_NAME, target, data);
} }

View File

@ -18,7 +18,6 @@
package org.adempiere.webui.exception; package org.adempiere.webui.exception;
/** /**
*
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a> * @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @date Mar 25, 2007 * @date Mar 25, 2007
* @version $Revision: 0.10 $ * @version $Revision: 0.10 $
@ -26,15 +25,22 @@ package org.adempiere.webui.exception;
public class ApplicationException extends RuntimeException public class ApplicationException extends RuntimeException
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = -4217881437634023176L; private static final long serialVersionUID = -4217881437634023176L;
/**
* @param msg
*/
public ApplicationException(String msg) public ApplicationException(String msg)
{ {
super(msg); super(msg);
} }
/**
* @param msg
* @param ex
*/
public ApplicationException(String msg, Exception ex) public ApplicationException(String msg, Exception ex)
{ {
super(msg, ex); super(msg, ex);

View File

@ -47,20 +47,25 @@ import io.github.classgraph.ClassGraph.ScanResultProcessor;
import io.github.classgraph.ClassInfo; import io.github.classgraph.ClassInfo;
/** /**
* Scan, discover and regiser classes with {@link Form} annotation. * Scan, discover and register classes with {@link Form} annotation.
* @author hengsin * @author hengsin
* *
*/ */
public abstract class AnnotationBasedFormFactory extends AnnotationBasedFactory implements IFormFactory { public abstract class AnnotationBasedFormFactory extends AnnotationBasedFactory implements IFormFactory {
/** AD_Form.ClassName:Real Class Name */
private final Map<String, String> classCache = new HashMap<>(); private final Map<String, String> classCache = new HashMap<>();
/** Real Class Name: Constructor */
private final Map<String, Constructor<?>[]> constructorCache = new ConcurrentHashMap<>(); private final Map<String, Constructor<?>[]> constructorCache = new ConcurrentHashMap<>();
private BundleContext bundleContext = null; private BundleContext bundleContext = null;
private static final CLogger s_log = CLogger.getCLogger(AnnotationBasedFormFactory.class); private static final CLogger s_log = CLogger.getCLogger(AnnotationBasedFormFactory.class);
/**
* Default constructor
*/
public AnnotationBasedFormFactory() { public AnnotationBasedFormFactory() {
} }
@ -126,8 +131,16 @@ public abstract class AnnotationBasedFormFactory extends AnnotationBasedFactory
} }
} }
/**
* @return packages to scan
*/
protected abstract String[] getPackages(); protected abstract String[] getPackages();
/**
* Perform scan
* @param context
* @throws ClassNotFoundException
*/
@Activate @Activate
public void activate(ComponentContext context) throws ClassNotFoundException { public void activate(ComponentContext context) throws ClassNotFoundException {
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();

View File

@ -27,13 +27,16 @@ package org.adempiere.webui.factory;
import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Component;
/** /**
* * Core implementation of {@link AnnotationBasedFormFactory}
* @author hengsin * @author hengsin
* *
*/ */
@Component(immediate = true, service = IFormFactory.class, property = {"service.ranking:Integer=0"}) @Component(immediate = true, service = IFormFactory.class, property = {"service.ranking:Integer=0"})
public final class DefaultAnnotationBasedFormFactory extends AnnotationBasedFormFactory { public final class DefaultAnnotationBasedFormFactory extends AnnotationBasedFormFactory {
/**
* Default constructor
*/
public DefaultAnnotationBasedFormFactory() { public DefaultAnnotationBasedFormFactory() {
} }

View File

@ -54,7 +54,7 @@ import org.compiere.model.GridTab;
import org.compiere.util.DisplayType; import org.compiere.util.DisplayType;
/** /**
* * Default implementation of {@link IEditorFactory}
* @author hengsin * @author hengsin
* *
*/ */

View File

@ -37,6 +37,7 @@ import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zul.Window.Mode; import org.zkoss.zul.Window.Mode;
/** /**
* Default implementation of {@link IFeedbackService}
* @author hengsin * @author hengsin
* *
*/ */
@ -64,14 +65,21 @@ public class DefaultFeedbackService implements IFeedbackService {
new CreateNewRequestAction(); new CreateNewRequestAction();
} }
/**
* Action class to send feedback email to support
*/
protected static class EmailSupportAction implements EventListener<Event>{ protected static class EmailSupportAction implements EventListener<Event>{
private boolean errorOnly; private boolean errorOnly;
/**
* @param errorOnly
*/
protected EmailSupportAction(boolean errorOnly) { protected EmailSupportAction(boolean errorOnly) {
this.errorOnly = errorOnly; this.errorOnly = errorOnly;
SessionManager.getAppDesktop().getComponent().addEventListener("onEmailSupport", this); SessionManager.getAppDesktop().getComponent().addEventListener("onEmailSupport", this);
//client side script to capture screenshot and send onEmailSupport event to server
String script = "html2canvas(document.body).then(canvas => " + String script = "html2canvas(document.body).then(canvas => " +
"{ const dataUrl = canvas.toDataURL();" + "{ const dataUrl = canvas.toDataURL();" +
" let widget = zk.Widget.$('#" + SessionManager.getAppDesktop().getComponent().getUuid()+"');"+ " let widget = zk.Widget.$('#" + SessionManager.getAppDesktop().getComponent().getUuid()+"');"+
@ -98,11 +106,18 @@ public class DefaultFeedbackService implements IFeedbackService {
showEmailDialog(imageBytes); showEmailDialog(imageBytes);
} }
/**
* @return Feedback subject
*/
protected String getFeedbackSubject() { protected String getFeedbackSubject() {
String feedBackHeader = Msg.getMsg(Env.getCtx(), "FeedBackHeader"); String feedBackHeader = Msg.getMsg(Env.getCtx(), "FeedBackHeader");
return Env.parseContext(Env.getCtx(), 0, feedBackHeader, false, false); return Env.parseContext(Env.getCtx(), 0, feedBackHeader, false, false);
} }
/**
* Show email dialog with screenshot attachment
* @param imageBytes screenshot attachment content
*/
protected void showEmailDialog(byte[] imageBytes) { protected void showEmailDialog(byte[] imageBytes) {
DataSource ds = FeedbackManager.getLogAttachment(errorOnly); DataSource ds = FeedbackManager.getLogAttachment(errorOnly);
@ -140,16 +155,25 @@ public class DefaultFeedbackService implements IFeedbackService {
dialog.focus(); dialog.focus();
} }
/**
* Get recipient emails from AD_SysConfig configuration
* @param scValue AD_SysConfig.Name
* @return comma separated list of recipient emails
*/
protected String getFeedbackRecipient(String scValue) { protected String getFeedbackRecipient(String scValue) {
String retValue = MSysConfig.getValue(scValue, Env.getAD_Client_ID(Env.getCtx()), Env.getAD_Org_ID(Env.getCtx())); String retValue = MSysConfig.getValue(scValue, Env.getAD_Client_ID(Env.getCtx()), Env.getAD_Org_ID(Env.getCtx()));
return Util.isEmpty(retValue) ? "" : retValue; return Util.isEmpty(retValue) ? "" : retValue;
} }
} }
/**
* Action class to create new feedback request
*/
protected static class CreateNewRequestAction implements EventListener<Event>{ protected static class CreateNewRequestAction implements EventListener<Event>{
protected CreateNewRequestAction() { protected CreateNewRequestAction() {
SessionManager.getAppDesktop().getComponent().addEventListener("onCreateFeedbackRequest", this); SessionManager.getAppDesktop().getComponent().addEventListener("onCreateFeedbackRequest", this);
//client side script to capture screenshot and send onCreateFeedbackRequest event to server
String script = "html2canvas(document.body).then(canvas => " + String script = "html2canvas(document.body).then(canvas => " +
"{ let dataUrl = canvas.toDataURL();" + "{ let dataUrl = canvas.toDataURL();" +
" let widget = zk.Widget.$('#" + SessionManager.getAppDesktop().getComponent().getUuid()+"');"+ " let widget = zk.Widget.$('#" + SessionManager.getAppDesktop().getComponent().getUuid()+"');"+
@ -176,6 +200,10 @@ public class DefaultFeedbackService implements IFeedbackService {
showRequestDialog(imageBytes); showRequestDialog(imageBytes);
} }
/**
* Show create feedback request dialog with screenshot attachment
* @param imageBytes screenshot attachment content
*/
protected void showRequestDialog(byte[] imageBytes) { protected void showRequestDialog(byte[] imageBytes) {
FeedbackRequestWindow window = new FeedbackRequestWindow(); FeedbackRequestWindow window = new FeedbackRequestWindow();
AEnv.showWindow(window); AEnv.showWindow(window);

View File

@ -23,6 +23,7 @@ import org.compiere.util.CLogger;
import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Component;
/** /**
* Default implementation of {@link IFormFactory}
* @author hengsin * @author hengsin
* *
*/ */
@ -266,6 +267,10 @@ public class DefaultFormFactory implements IFormFactory {
return zkName; return zkName;
} }
/**
* @param clazz
* @return true if clazz is descendant of IFormController or Component
*/
private static boolean isZkFormClass(Class<?> clazz) { private static boolean isZkFormClass(Class<?> clazz) {
return IFormController.class.isAssignableFrom(clazz) || Component.class.isAssignableFrom(clazz); return IFormController.class.isAssignableFrom(clazz) || Component.class.isAssignableFrom(clazz);
} }

View File

@ -42,7 +42,7 @@ import org.compiere.model.MInfoWindow;
import org.compiere.util.Env; import org.compiere.util.Env;
/** /**
* * Default implementation of {@link IInfoFactory}
* @author hengsin * @author hengsin
* *
*/ */
@ -64,6 +64,19 @@ public class DefaultInfoFactory implements IInfoFactory {
value, multiSelection, whereClause, AD_InfoWindow_ID, lookup, null, field); value, multiSelection, whereClause, AD_InfoWindow_ID, lookup, null, field);
} }
/**
* @param WindowNo
* @param tableName
* @param keyColumn
* @param value
* @param multiSelection
* @param whereClause
* @param AD_InfoWindow_ID
* @param lookup
* @param predefinedContextVariables
* @param field
* @return InfoPanel
*/
public InfoPanel create(int WindowNo, String tableName, String keyColumn, public InfoPanel create(int WindowNo, String tableName, String keyColumn,
String value, boolean multiSelection, String whereClause, int AD_InfoWindow_ID, boolean lookup, String predefinedContextVariables, GridField field) { String value, boolean multiSelection, String whereClause, int AD_InfoWindow_ID, boolean lookup, String predefinedContextVariables, GridField field) {
InfoPanel info = null; InfoPanel info = null;
@ -228,6 +241,10 @@ public class DefaultInfoFactory implements IInfoFactory {
return null; return null;
} }
/**
* Set IsSOTrx context variable base on C_DocType_ID context value.
* @param WindowNo
*/
private void setSOTrxBasedOnDocType(int WindowNo) { private void setSOTrxBasedOnDocType(int WindowNo) {
int C_DocType_ID = Env.getContextAsInt(Env.getCtx(), WindowNo, "C_DocType_ID"); int C_DocType_ID = Env.getContextAsInt(Env.getCtx(), WindowNo, "C_DocType_ID");
if (C_DocType_ID != 0) { if (C_DocType_ID != 0) {

View File

@ -19,8 +19,8 @@ package org.adempiere.webui.factory;
import org.adempiere.webui.grid.AbstractWQuickEntry; import org.adempiere.webui.grid.AbstractWQuickEntry;
import org.adempiere.webui.grid.WQuickEntry; import org.adempiere.webui.grid.WQuickEntry;
/** /**
* Default implementation of {@link IQuickEntryFactory}
* @author Andreas Sumerauer * @author Andreas Sumerauer
*/ */
public class DefaultQuickEntryFactory implements IQuickEntryFactory { public class DefaultQuickEntryFactory implements IQuickEntryFactory {

View File

@ -19,6 +19,7 @@ import org.adempiere.webui.adwindow.IADTabpanel;
import org.compiere.model.MTab; import org.compiere.model.MTab;
/** /**
* Default implementation of {@link IADTabPanelFactory}
* @author Logilite Technologies * @author Logilite Technologies
*/ */
public class DefaultTabPanelFactory implements IADTabPanelFactory public class DefaultTabPanelFactory implements IADTabPanelFactory

View File

@ -16,15 +16,14 @@ package org.adempiere.webui.factory;
import org.adempiere.webui.adwindow.IADTabpanel; import org.adempiere.webui.adwindow.IADTabpanel;
/** /**
* @author Logilite Technologies This interface implements OSGI service to * This interface implements OSGI service to instantiate ADTabPanel based on tab type.
* retrieve ADTabPanel based on tab type. * @author Logilite Technologies
*/ */
public interface IADTabPanelFactory public interface IADTabPanelFactory
{ {
/** /**
* * @param type Tab type FORM, SORT or a custom type
* @param type Tab type * @return new IADTabPanel instance
* @return Implementor of IADTabPanel
*/ */
public IADTabpanel getInstance(String type); public IADTabpanel getInstance(String type);
} }

View File

@ -17,24 +17,25 @@ import org.compiere.model.MDashboardContent;
import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Component;
/** /**
* Factory interface for dashboard gadget
* @author Antonio Cañaveral * @author Antonio Cañaveral
* @author hengsin * @author hengsin
*
*/ */
public interface IDashboardGadgetFactory { public interface IDashboardGadgetFactory {
/** /**
* *
* @param uri String * @param uri zul url
* @param parent Component * @param parent Component
* @return Component instance of DashboardPanel or null * @return new DashboardPanel component instance or null
*/ */
public Component getGadget(String uri, Component parent); public Component getGadget(String uri, Component parent);
/** /**
* @param url String * @param url zul url
* @param parent Component * @param parent Component
* @param dc MDashboardContent * @param dc MDashboardContent
* @return Component instance of DashboardPanel or null * @return new DashboardPanel component instance or null
*/ */
default public Component getGadget(String url, Component parent, MDashboardContent dc) { default public Component getGadget(String url, Component parent, MDashboardContent dc) {
return getGadget(url, parent); // ignore the third method by default (backward compatibility) return getGadget(url, parent); // ignore the third method by default (backward compatibility)

View File

@ -19,7 +19,7 @@ import org.compiere.model.GridField;
import org.compiere.model.GridTab; import org.compiere.model.GridTab;
/** /**
* * Factory interface for {@link GridField} editor
* @author hengsin * @author hengsin
* *
*/ */

View File

@ -14,9 +14,8 @@
package org.adempiere.webui.factory; package org.adempiere.webui.factory;
/** /**
* * Interface for feedback service
* @author hengsin * @author hengsin
*
*/ */
public interface IFeedbackService { public interface IFeedbackService {

View File

@ -16,14 +16,12 @@ package org.adempiere.webui.factory;
import org.adempiere.webui.panel.ADForm; import org.adempiere.webui.panel.ADForm;
/** /**
* * Factory interface for {@link ADForm}
* @author hengsin * @author hengsin
*
*/ */
public interface IFormFactory { public interface IFormFactory {
/** /**
*
* @param formName * @param formName
* @return new form instance * @return new form instance
*/ */

View File

@ -19,9 +19,8 @@ import org.compiere.model.GridField;
import org.compiere.model.Lookup; import org.compiere.model.Lookup;
/** /**
* * Factory interface for {@link InfoPanel} ({@link InfoWindow})
* @author hengsin * @author hengsin
*
*/ */
public interface IInfoFactory { public interface IInfoFactory {

View File

@ -30,7 +30,7 @@ import org.idempiere.ui.zk.annotation.Form;
import org.osgi.framework.BundleContext; import org.osgi.framework.BundleContext;
/** /**
* * {@link IMappedByNameFactory} interface for {@link ADForm}.
* @author matheus.marcelino * @author matheus.marcelino
* *
*/ */

View File

@ -18,7 +18,7 @@ package org.adempiere.webui.factory;
import org.adempiere.webui.grid.AbstractWQuickEntry; import org.adempiere.webui.grid.AbstractWQuickEntry;
/** /**
* * Factory interface for {@link AbstractWQuickEntry}
* @author Andreas Sumerauer * @author Andreas Sumerauer
* *
*/ */

View File

@ -27,7 +27,7 @@ import org.compiere.util.CCache;
import org.osgi.framework.Constants; import org.osgi.framework.Constants;
/** /**
* * Static methods for instantiation of {@link InfoPanel}/{@link InfoWindow}
* @author hengsin * @author hengsin
* *
*/ */

View File

@ -49,6 +49,10 @@ import io.github.classgraph.ClassGraph;
import io.github.classgraph.ClassInfo; import io.github.classgraph.ClassInfo;
import io.github.classgraph.ScanResult; import io.github.classgraph.ScanResult;
/**
* Default implementation of {@link IMappedFormFactory}
* @author hengsin
*/
@Component(name = "org.adempiere.webui.factory.MappedFormFactory", @Component(name = "org.adempiere.webui.factory.MappedFormFactory",
immediate = true, immediate = true,
service = {IFormFactory.class, IMappedFormFactory.class}, service = {IFormFactory.class, IMappedFormFactory.class},
@ -57,6 +61,9 @@ public class MappedFormFactory extends MappedByNameFactory<ADForm> implements IF
private final static CLogger s_log = CLogger.getCLogger(MappedFormFactory.class); private final static CLogger s_log = CLogger.getCLogger(MappedFormFactory.class);
/**
* Default constructor
*/
public MappedFormFactory() { public MappedFormFactory() {
} }
@ -101,10 +108,16 @@ public class MappedFormFactory extends MappedByNameFactory<ADForm> implements IF
} }
/**
* {@link Supplier} class for instantiation of {@link ADForm}
*/
private static final class FormSupplier implements Supplier<ADForm> { private static final class FormSupplier implements Supplier<ADForm> {
private Constructor<?> constructor; private Constructor<?> constructor;
/**
* @param constructor form class constructor
*/
private FormSupplier(Constructor<?> constructor) { private FormSupplier(Constructor<?> constructor) {
this.constructor = constructor; this.constructor = constructor;
} }

View File

@ -21,7 +21,7 @@ import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Executions; import org.zkoss.zk.ui.Executions;
/** /**
* * Default {@link IDashboardGadgetFactory} implementation for ZUL based dashboard gadget
* @author Antonio Cañaveral * @author Antonio Cañaveral
* @author hengsin * @author hengsin
* *

View File

@ -24,26 +24,26 @@ import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.EventListener;
/** /**
* Quick Entry Window * Quick Entry Window.<br/>
* Interface based on class WQuickEntry by Carlos Ruiz * Based on class WQuickEntry by Carlos Ruiz
* @Author Andreas Sumerauer * @Author Andreas Sumerauer
*/ */
public abstract class AbstractWQuickEntry extends Window implements Component, ISupportMask, EventListener<Event>, ValueChangeListener public abstract class AbstractWQuickEntry extends Window implements Component, ISupportMask, EventListener<Event>, ValueChangeListener
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 5092377634523789098L;
/** /**
* check table is editable in quick entry * check table is editable in quick entry
* user must have write right and table has at least one input field * user must have write right and table has at least one input field
* @return * @return true if quick edit form is available, false otherwise
*/ */
public abstract boolean isAvailableQuickEdit (); public abstract boolean isAvailableQuickEdit ();
/** /**
* Load Record_ID * Load record by Record_ID
* @param Record_ID - existing Record or 0 for new * @param Record_ID - existing Record or 0 for new
* @return true if loaded * @return true if loaded
*/ */
@ -56,12 +56,12 @@ public abstract class AbstractWQuickEntry extends Window implements Component, I
public abstract int getRecord_ID(); public abstract int getRecord_ID();
/** /**
* refresh all fields * Dynamic update of all fields
*/ */
public abstract void dynamicDisplay(); public abstract void dynamicDisplay();
/** /**
* get size quickfields * @return number of quick fields
*/ */
public abstract int getQuickFields(); public abstract int getQuickFields();

View File

@ -67,7 +67,7 @@ import org.zkoss.zul.Vlayout;
public class WQuickEntry extends AbstractWQuickEntry implements EventListener<Event>, ValueChangeListener public class WQuickEntry extends AbstractWQuickEntry implements EventListener<Event>, ValueChangeListener
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = -6385383768870354870L; private static final long serialVersionUID = -6385383768870354870L;
@ -82,14 +82,17 @@ public class WQuickEntry extends AbstractWQuickEntry implements EventListener<Ev
private int parent_TabNo; private int parent_TabNo;
List<GridField> quickFields = new ArrayList<GridField>(); List<GridField> quickFields = new ArrayList<GridField>();
/** editors for {@link #quickFields} */
protected List<WEditor> quickEditors = new ArrayList<WEditor>(); protected List<WEditor> quickEditors = new ArrayList<WEditor>();
protected List<Object> initialValues = new ArrayList<Object>(); protected List<Object> initialValues = new ArrayList<Object>();
protected List<GridTab> quickTabs = new ArrayList<GridTab>(); protected List<GridTab> quickTabs = new ArrayList<GridTab>();
/** POs for {@link #quickTabs} */
protected List<PO> quickPOs = new ArrayList<PO>(); protected List<PO> quickPOs = new ArrayList<PO>();
/** Read Only */ /** Read Only */
private boolean m_readOnly = false; private boolean m_readOnly = false;
/** Center container for field label and editors */
protected Vlayout centerPanel = new Vlayout(); protected Vlayout centerPanel = new Vlayout();
private ConfirmPanel confirmPanel = new ConfirmPanel(true, false, false, false, false, false); private ConfirmPanel confirmPanel = new ConfirmPanel(true, false, false, false, false, false);
@ -98,8 +101,13 @@ public class WQuickEntry extends AbstractWQuickEntry implements EventListener<Ev
private boolean isHasField = false; private boolean isHasField = false;
/** browser orientation */
private String orientation; private String orientation;
/**
* @param WindowNo
* @param AD_Window_ID
*/
public WQuickEntry(int WindowNo, int AD_Window_ID) public WQuickEntry(int WindowNo, int AD_Window_ID)
{ {
this(WindowNo, 0, AD_Window_ID); this(WindowNo, 0, AD_Window_ID);
@ -109,6 +117,7 @@ public class WQuickEntry extends AbstractWQuickEntry implements EventListener<Ev
* Constructor. * Constructor.
* Requires call loadRecord * Requires call loadRecord
* @param WindowNo Window No * @param WindowNo Window No
* @param TabNo
* @param AD_Window_ID * @param AD_Window_ID
*/ */
public WQuickEntry(int WindowNo, int TabNo, int AD_Window_ID) public WQuickEntry(int WindowNo, int TabNo, int AD_Window_ID)
@ -138,6 +147,9 @@ public class WQuickEntry extends AbstractWQuickEntry implements EventListener<Ev
} // WQuickEntry } // WQuickEntry
/**
* @param AD_Window_ID
*/
public WQuickEntry(int AD_Window_ID) public WQuickEntry(int AD_Window_ID)
{ {
super(); super();
@ -145,14 +157,14 @@ public class WQuickEntry extends AbstractWQuickEntry implements EventListener<Ev
m_AD_Window_ID = AD_Window_ID; m_AD_Window_ID = AD_Window_ID;
parent_WindowNo = 0; parent_WindowNo = 0;
m_WindowNo = 0; m_WindowNo = 0;
if (log.isLoggable(Level.INFO))
log.info("R/O=" + isReadOnly()); log.info("R/O=" + isReadOnly());
} // WQuickEntry } // WQuickEntry
/** /**
* Static Init * Layout dialog
* @throws Exception * @throws Exception
*/ */
protected void initLayout() throws Exception protected void initLayout() throws Exception
{ {
if (!ThemeManager.isUseCSSForWindowSize()) { if (!ThemeManager.isUseCSSForWindowSize()) {
@ -186,6 +198,9 @@ public class WQuickEntry extends AbstractWQuickEntry implements EventListener<Ev
} }
} }
/**
* Handle client info event
*/
protected void onClientInfo() protected void onClientInfo()
{ {
if (getPage() != null) { if (getPage() != null) {
@ -200,7 +215,7 @@ public class WQuickEntry extends AbstractWQuickEntry implements EventListener<Ev
} }
/** /**
* Dynamic Init * Initialize {@link #quickTabs}, {@link #quickFields} and {@link #quickEditors}
*/ */
protected void initPOs() protected void initPOs()
{ {
@ -242,6 +257,10 @@ public class WQuickEntry extends AbstractWQuickEntry implements EventListener<Ev
} }
} // initPOs } // initPOs
/**
* @param refID display type
* @return true if display type support quick entry
*/
private boolean isValidQuickEntryType(int refID) { private boolean isValidQuickEntryType(int refID) {
boolean valid = boolean valid =
! ( ! (
@ -252,6 +271,12 @@ public class WQuickEntry extends AbstractWQuickEntry implements EventListener<Ev
return valid; return valid;
} }
/**
* Add new row of label and editor
* @param editor
* @param newTab true if start of new grid tab
* @param gt
*/
private void createLine(WEditor editor, boolean newTab, GridTab gt) { private void createLine(WEditor editor, boolean newTab, GridTab gt) {
if (newTab) { if (newTab) {
Separator sep = new Separator(); Separator sep = new Separator();
@ -281,25 +306,15 @@ public class WQuickEntry extends AbstractWQuickEntry implements EventListener<Ev
layout.appendChild(field); layout.appendChild(field);
ZKUpdateUtil.setHflex((HtmlBasedComponent)field, "7"); ZKUpdateUtil.setHflex((HtmlBasedComponent)field, "7");
//editor.setValue("Y");
centerPanel.appendChild(layout); centerPanel.appendChild(layout);
} }
/** @Override
* check table is editable in quick entry
* user must has write right and has at least a input field
* @return
*/
public boolean isAvailableQuickEdit (){ public boolean isAvailableQuickEdit (){
return isHasField && !isReadOnly(); return isHasField && !isReadOnly();
} }
/** @Override
* Load Record_ID
* @param Record_ID - existing Record or 0 for new
* @return true if loaded
*/
public boolean loadRecord (int Record_ID) public boolean loadRecord (int Record_ID)
{ {
String parentColumn = null; String parentColumn = null;
@ -398,6 +413,7 @@ public class WQuickEntry extends AbstractWQuickEntry implements EventListener<Ev
*/ */
protected boolean actionSave() protected boolean actionSave()
{ {
if (log.isLoggable(Level.CONFIG))
log.config(""); log.config("");
boolean anyChange = false; boolean anyChange = false;
for (int idxf = 0; idxf < quickEditors.size(); idxf++) { for (int idxf = 0; idxf < quickEditors.size(); idxf++) {
@ -508,11 +524,7 @@ public class WQuickEntry extends AbstractWQuickEntry implements EventListener<Ev
|| (value != null && initialValue != null); || (value != null && initialValue != null);
} }
/** @Override
* Returns Record_ID
* @return Record_ID (0 = not saved)
*/
public int getRecord_ID() public int getRecord_ID()
{ {
if (quickPOs.isEmpty() || quickPOs.get(0) == null) if (quickPOs.isEmpty() || quickPOs.get(0) == null)
@ -521,6 +533,7 @@ public class WQuickEntry extends AbstractWQuickEntry implements EventListener<Ev
return quickPOs.get(0).get_ID(); return quickPOs.get(0).get_ID();
} // getRecord_ID } // getRecord_ID
@Override
public void onEvent(Event e) throws Exception public void onEvent(Event e) throws Exception
{ {
if (isReadOnly()) if (isReadOnly())
@ -552,6 +565,7 @@ public class WQuickEntry extends AbstractWQuickEntry implements EventListener<Ev
desktop.unregisterWindow(m_WindowNo); desktop.unregisterWindow(m_WindowNo);
} }
@Override
public void valueChange(ValueChangeEvent evt) public void valueChange(ValueChangeEvent evt)
{ {
if (evt.getSource() instanceof WEditor) { if (evt.getSource() instanceof WEditor) {
@ -595,9 +609,7 @@ public class WQuickEntry extends AbstractWQuickEntry implements EventListener<Ev
} }
} }
/** @Override
* refresh all fields
*/
public void dynamicDisplay() public void dynamicDisplay()
{ {
for (int idxf = 0; idxf < quickFields.size(); idxf++) { for (int idxf = 0; idxf < quickFields.size(); idxf++) {
@ -614,6 +626,10 @@ public class WQuickEntry extends AbstractWQuickEntry implements EventListener<Ev
} }
} // dynamicDisplay } // dynamicDisplay
/**
* Update style of all field editors
* @param tab
*/
private void updateStyleTab(GridTab tab) { private void updateStyleTab(GridTab tab) {
for (int idxf = 0; idxf < quickFields.size(); idxf++) { for (int idxf = 0; idxf < quickFields.size(); idxf++) {
GridField field = quickFields.get(idxf); GridField field = quickFields.get(idxf);
@ -625,22 +641,20 @@ public class WQuickEntry extends AbstractWQuickEntry implements EventListener<Ev
} }
} }
/** @Override
* get size quickfields
*/
public final int getQuickFields(){ public final int getQuickFields(){
return quickFields.size(); return quickFields.size();
}// size of quickfields }
/** /**
* get readOnly * @return true if it is read only, false otherwise
*/ */
protected final boolean isReadOnly() { protected final boolean isReadOnly() {
return m_readOnly; return m_readOnly;
} }
/** /**
* @return the confirmPanel * @return the ConfirmPanel
*/ */
protected final ConfirmPanel getConfirmPanel() { protected final ConfirmPanel getConfirmPanel() {
return confirmPanel; return confirmPanel;

View File

@ -1,6 +1,27 @@
/** /***********************************************************************
* * This file is part of iDempiere ERP Open Source *
*/ * http://www.idempiere.org *
* *
* Copyright (C) Contributors *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* 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., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301, USA. *
* *
* Contributors: *
* - hengsin *
**********************************************************************/
package org.adempiere.webui.info; package org.adempiere.webui.info;
import org.compiere.model.GridField; import org.compiere.model.GridField;
@ -8,12 +29,13 @@ import org.compiere.model.MAsset;
import org.compiere.util.Env; import org.compiere.util.Env;
/** /**
* Info window for A_Asset
* @author hengsin * @author hengsin
* *
*/ */
public class InfoAssetWindow extends InfoWindow { public class InfoAssetWindow extends InfoWindow {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = 8671986505516245911L; private static final long serialVersionUID = 8671986505516245911L;
@ -31,7 +53,6 @@ public class InfoAssetWindow extends InfoWindow {
int AD_InfoWindow_ID) { int AD_InfoWindow_ID) {
super(WindowNo, tableName, keyColumn, queryValue, multipleSelection, super(WindowNo, tableName, keyColumn, queryValue, multipleSelection,
whereClause, AD_InfoWindow_ID); whereClause, AD_InfoWindow_ID);
// TODO Auto-generated constructor stub
} }
/** /**
@ -49,7 +70,6 @@ public class InfoAssetWindow extends InfoWindow {
int AD_InfoWindow_ID, boolean lookup) { int AD_InfoWindow_ID, boolean lookup) {
super(WindowNo, tableName, keyColumn, queryValue, multipleSelection, super(WindowNo, tableName, keyColumn, queryValue, multipleSelection,
whereClause, AD_InfoWindow_ID, lookup); whereClause, AD_InfoWindow_ID, lookup);
// TODO Auto-generated constructor stub
} }
/** /**
@ -61,6 +81,7 @@ public class InfoAssetWindow extends InfoWindow {
* @param whereClause * @param whereClause
* @param AD_InfoWindow_ID * @param AD_InfoWindow_ID
* @param lookup * @param lookup
* @param field
* @param predefinedContextVariables * @param predefinedContextVariables
*/ */
public InfoAssetWindow(int WindowNo, String tableName, String keyColumn, public InfoAssetWindow(int WindowNo, String tableName, String keyColumn,

View File

@ -1,18 +1,40 @@
/** /***********************************************************************
* * This file is part of iDempiere ERP Open Source *
*/ * http://www.idempiere.org *
* *
* Copyright (C) Contributors *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* 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., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301, USA. *
* *
* Contributors: *
* - hengsin *
**********************************************************************/
package org.adempiere.webui.info; package org.adempiere.webui.info;
import org.compiere.model.GridField; import org.compiere.model.GridField;
/** /**
* Info window for S_ResourceAssignment
* @author hengsin * @author hengsin
* *
*/ */
public class InfoAssignmentWindow extends InfoWindow { public class InfoAssignmentWindow extends InfoWindow {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = -5726562881863657609L; private static final long serialVersionUID = -5726562881863657609L;
@ -58,6 +80,7 @@ public class InfoAssignmentWindow extends InfoWindow {
* @param whereClause * @param whereClause
* @param AD_InfoWindow_ID * @param AD_InfoWindow_ID
* @param lookup * @param lookup
* @param field
* @param predefinedContextVariables * @param predefinedContextVariables
*/ */
public InfoAssignmentWindow(int WindowNo, String tableName, public InfoAssignmentWindow(int WindowNo, String tableName,

View File

@ -1,20 +1,44 @@
/** /***********************************************************************
* * This file is part of iDempiere ERP Open Source *
*/ * http://www.idempiere.org *
* *
* Copyright (C) Contributors *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* 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., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301, USA. *
* *
* Contributors: *
* - hengsin *
**********************************************************************/
package org.adempiere.webui.info; package org.adempiere.webui.info;
import java.util.logging.Level;
import org.adempiere.webui.panel.InvoiceHistory; import org.adempiere.webui.panel.InvoiceHistory;
import org.compiere.model.GridField; import org.compiere.model.GridField;
import org.compiere.model.MBPartner; import org.compiere.model.MBPartner;
import org.compiere.util.Env; import org.compiere.util.Env;
/** /**
* Info window for C_BPartner
* @author hengsin * @author hengsin
* *
*/ */
public class InfoBPartnerWindow extends InfoWindow { public class InfoBPartnerWindow extends InfoWindow {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = 240758053410996182L; private static final long serialVersionUID = 240758053410996182L;
@ -43,6 +67,7 @@ public class InfoBPartnerWindow extends InfoWindow {
* @param whereClause * @param whereClause
* @param AD_InfoWindow_ID * @param AD_InfoWindow_ID
* @param lookup * @param lookup
* @param field
*/ */
public InfoBPartnerWindow(int WindowNo, String tableName, String keyColumn, public InfoBPartnerWindow(int WindowNo, String tableName, String keyColumn,
String queryValue, boolean multipleSelection, String whereClause, String queryValue, boolean multipleSelection, String whereClause,
@ -60,6 +85,7 @@ public class InfoBPartnerWindow extends InfoWindow {
* @param whereClause * @param whereClause
* @param AD_InfoWindow_ID * @param AD_InfoWindow_ID
* @param lookup * @param lookup
* @param field
* @param predefinedContextVariables * @param predefinedContextVariables
*/ */
public InfoBPartnerWindow(int WindowNo, String tableName, String keyColumn, public InfoBPartnerWindow(int WindowNo, String tableName, String keyColumn,
@ -79,13 +105,13 @@ public class InfoBPartnerWindow extends InfoWindow {
return true; return true;
} // hasHistory } // hasHistory
// Elaine 2008/12/16 /**
/**************************************************************************
* Show History * Show History
*/ */
@Override @Override
protected void showHistory() protected void showHistory()
{ {
if (log.isLoggable(Level.INFO))
log.info(""); log.info("");
Integer C_BPartner_ID = getIntSelectedRowKey(MBPartner.Table_ID); Integer C_BPartner_ID = getIntSelectedRowKey(MBPartner.Table_ID);
if (C_BPartner_ID == null) if (C_BPartner_ID == null)

View File

@ -1,17 +1,39 @@
/** /***********************************************************************
* * This file is part of iDempiere ERP Open Source *
*/ * http://www.idempiere.org *
* *
* Copyright (C) Contributors *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* 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., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301, USA. *
* *
* Contributors: *
* - hengsin *
**********************************************************************/
package org.adempiere.webui.info; package org.adempiere.webui.info;
import org.compiere.model.GridField; import org.compiere.model.GridField;
/** /**
* Info window for M_InOut
* @author hengsin * @author hengsin
* *
*/ */
public class InfoInOutWindow extends InfoWindow { public class InfoInOutWindow extends InfoWindow {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = 3027121642718090785L; private static final long serialVersionUID = 3027121642718090785L;
@ -57,6 +79,7 @@ public class InfoInOutWindow extends InfoWindow {
* @param whereClause * @param whereClause
* @param AD_InfoWindow_ID * @param AD_InfoWindow_ID
* @param lookup * @param lookup
* @param field
* @param predefinedContextVariables * @param predefinedContextVariables
*/ */
public InfoInOutWindow(int WindowNo, String tableName, String keyColumn, public InfoInOutWindow(int WindowNo, String tableName, String keyColumn,

View File

@ -1,6 +1,27 @@
/** /***********************************************************************
* * This file is part of iDempiere ERP Open Source *
*/ * http://www.idempiere.org *
* *
* Copyright (C) Contributors *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* 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., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301, USA. *
* *
* Contributors: *
* - hengsin *
**********************************************************************/
package org.adempiere.webui.info; package org.adempiere.webui.info;
import org.compiere.model.GridField; import org.compiere.model.GridField;
@ -8,12 +29,13 @@ import org.compiere.model.MInvoice;
import org.compiere.util.Env; import org.compiere.util.Env;
/** /**
* Info window for C_Invoice
* @author hengsin * @author hengsin
* *
*/ */
public class InfoInvoiceWindow extends InfoWindow { public class InfoInvoiceWindow extends InfoWindow {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = -5175983673145977830L; private static final long serialVersionUID = -5175983673145977830L;
@ -59,6 +81,7 @@ public class InfoInvoiceWindow extends InfoWindow {
* @param whereClause * @param whereClause
* @param AD_InfoWindow_ID * @param AD_InfoWindow_ID
* @param lookup * @param lookup
* @param field
* @param predefinedContextVariables * @param predefinedContextVariables
*/ */
public InfoInvoiceWindow(int WindowNo, String tableName, String keyColumn, public InfoInvoiceWindow(int WindowNo, String tableName, String keyColumn,

View File

@ -1,17 +1,39 @@
/** /***********************************************************************
* * This file is part of iDempiere ERP Open Source *
*/ * http://www.idempiere.org *
* *
* Copyright (C) Contributors *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* 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., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301, USA. *
* *
* Contributors: *
* - hengsin *
**********************************************************************/
package org.adempiere.webui.info; package org.adempiere.webui.info;
import org.compiere.model.GridField; import org.compiere.model.GridField;
/** /**
* Info window for C_Order
* @author hengsin * @author hengsin
* *
*/ */
public class InfoOrderWindow extends InfoWindow { public class InfoOrderWindow extends InfoWindow {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = 1241927188305227636L; private static final long serialVersionUID = 1241927188305227636L;
@ -57,6 +79,7 @@ public class InfoOrderWindow extends InfoWindow {
* @param whereClause * @param whereClause
* @param AD_InfoWindow_ID * @param AD_InfoWindow_ID
* @param lookup * @param lookup
* @param field
* @param predefinedContextVariables * @param predefinedContextVariables
*/ */
public InfoOrderWindow(int WindowNo, String tableName, String keyColumn, public InfoOrderWindow(int WindowNo, String tableName, String keyColumn,

View File

@ -1,16 +1,38 @@
/** /***********************************************************************
* * This file is part of iDempiere ERP Open Source *
*/ * http://www.idempiere.org *
* *
* Copyright (C) Contributors *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* 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., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301, USA. *
* *
* Contributors: *
* - hengsin *
**********************************************************************/
package org.adempiere.webui.info; package org.adempiere.webui.info;
/** /**
* Info window for M_AttributeSetInstance
* @author hengsin * @author hengsin
* *
*/ */
public class InfoPAttributeInstanceWindow extends InfoWindow { public class InfoPAttributeInstanceWindow extends InfoWindow {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = 8387016462564425684L; private static final long serialVersionUID = 8387016462564425684L;
@ -28,7 +50,6 @@ public class InfoPAttributeInstanceWindow extends InfoWindow {
String whereClause, int AD_InfoWindow_ID) { String whereClause, int AD_InfoWindow_ID) {
super(WindowNo, tableName, keyColumn, queryValue, multipleSelection, super(WindowNo, tableName, keyColumn, queryValue, multipleSelection,
whereClause, AD_InfoWindow_ID); whereClause, AD_InfoWindow_ID);
// TODO Auto-generated constructor stub
} }
/** /**

View File

@ -1,6 +1,27 @@
/** /***********************************************************************
* * This file is part of iDempiere ERP Open Source *
*/ * http://www.idempiere.org *
* *
* Copyright (C) Contributors *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* 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., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301, USA. *
* *
* Contributors: *
* - hengsin *
**********************************************************************/
package org.adempiere.webui.info; package org.adempiere.webui.info;
/** /**

View File

@ -1,17 +1,39 @@
/** /***********************************************************************
* * This file is part of iDempiere ERP Open Source *
*/ * http://www.idempiere.org *
* *
* Copyright (C) Contributors *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* 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., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301, USA. *
* *
* Contributors: *
* - hengsin *
**********************************************************************/
package org.adempiere.webui.info; package org.adempiere.webui.info;
import org.compiere.model.GridField; import org.compiere.model.GridField;
/** /**
* Info window for C_Payment
* @author hengsin * @author hengsin
* *
*/ */
public class InfoPaymentWindow extends InfoWindow { public class InfoPaymentWindow extends InfoWindow {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = 1322780214387328688L; private static final long serialVersionUID = 1322780214387328688L;
@ -57,6 +79,7 @@ public class InfoPaymentWindow extends InfoWindow {
* @param whereClause * @param whereClause
* @param AD_InfoWindow_ID * @param AD_InfoWindow_ID
* @param lookup * @param lookup
* @param field
* @param predefinedContextVariables * @param predefinedContextVariables
*/ */
public InfoPaymentWindow(int WindowNo, String tableName, String keyColumn, public InfoPaymentWindow(int WindowNo, String tableName, String keyColumn,

View File

@ -71,29 +71,33 @@ import org.zkoss.zul.Center;
import org.zkoss.zul.South; import org.zkoss.zul.South;
/** /**
* Info window for M_Product
* @author hengsin * @author hengsin
* *
*/ */
public class InfoProductWindow extends InfoWindow { public class InfoProductWindow extends InfoWindow {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = -640644572459126094L; private static final long serialVersionUID = -640644572459126094L;
protected Tabbox tabbedPane; protected Tabbox tabbedPane;
/** Storage by warehouse */
protected WListbox warehouseTbl; protected WListbox warehouseTbl;
protected String m_sqlWarehouse; protected String m_sqlWarehouse;
/** Substitute products */
protected WListbox substituteTbl; protected WListbox substituteTbl;
protected String m_sqlSubstitute; protected String m_sqlSubstitute;
/** Related products */
protected WListbox relatedTbl; protected WListbox relatedTbl;
protected String m_sqlRelated; protected String m_sqlRelated;
//Available to Promise Tab /** Available to Promise Tab */
protected WListbox m_tableAtp; protected WListbox m_tableAtp;
// Group atp by warehouse or non /** true to sum ATP quantities by product attributes, warehouse and locator */
protected Checkbox chbShowDetailAtp; protected Checkbox chbShowDetailAtp;
//IDEMPIERE-337 /** Product price */
protected WListbox productpriceTbl; protected WListbox productpriceTbl;
protected String m_sqlProductprice; protected String m_sqlProductprice;
@ -104,7 +108,7 @@ public class InfoProductWindow extends InfoWindow {
protected Borderlayout contentBorderLayout; protected Borderlayout contentBorderLayout;
/** Instance Button */ /** Product Attribute Set Instance Button */
protected Button m_PAttributeButton; protected Button m_PAttributeButton;
protected int m_M_Locator_ID; protected int m_M_Locator_ID;
@ -168,6 +172,7 @@ public class InfoProductWindow extends InfoWindow {
* @param whereClause * @param whereClause
* @param AD_InfoWindow_ID * @param AD_InfoWindow_ID
* @param lookup * @param lookup
* @param field
* @param predefinedContextVariables * @param predefinedContextVariables
*/ */
public InfoProductWindow(int WindowNo, String tableName, String keyColumn, public InfoProductWindow(int WindowNo, String tableName, String keyColumn,
@ -222,6 +227,7 @@ public class InfoProductWindow extends InfoWindow {
@Override @Override
protected void renderContentPane(Center center) { protected void renderContentPane(Center center) {
//storage by warehouse
ColumnInfo[] s_layoutWarehouse = new ColumnInfo[]{ ColumnInfo[] s_layoutWarehouse = new ColumnInfo[]{
new ColumnInfo(Msg.translate(Env.getCtx(), "Warehouse"), "Warehouse", String.class, true, "Warehouse"), new ColumnInfo(Msg.translate(Env.getCtx(), "Warehouse"), "Warehouse", String.class, true, "Warehouse"),
new ColumnInfo(Msg.translate(Env.getCtx(), "QtyAvailable"), "sum(QtyAvailable)", Double.class, true, "QtyAvailable"), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyAvailable"), "sum(QtyAvailable)", Double.class, true, "QtyAvailable"),
@ -238,6 +244,7 @@ public class InfoProductWindow extends InfoWindow {
warehouseTbl.setShowTotals(true); warehouseTbl.setShowTotals(true);
warehouseTbl.setwListBoxName("AD_InfoWindow_UU|"+ infoWindow.getAD_InfoWindow_UU() +"|stock"); warehouseTbl.setwListBoxName("AD_InfoWindow_UU|"+ infoWindow.getAD_InfoWindow_UU() +"|stock");
//substitute products
ColumnInfo[] s_layoutSubstitute = new ColumnInfo[]{ ColumnInfo[] s_layoutSubstitute = new ColumnInfo[]{
new ColumnInfo(Msg.translate(Env.getCtx(), "Warehouse"), "orgname", String.class, true, "orgname"), new ColumnInfo(Msg.translate(Env.getCtx(), "Warehouse"), "orgname", String.class, true, "orgname"),
new ColumnInfo(Msg.translate(Env.getCtx(), "Value"), new ColumnInfo(Msg.translate(Env.getCtx(), "Value"),
@ -255,6 +262,7 @@ public class InfoProductWindow extends InfoWindow {
substituteTbl.setMultiSelection(false); substituteTbl.setMultiSelection(false);
substituteTbl.setwListBoxName("AD_InfoWindow_UU|"+ infoWindow.getAD_InfoWindow_UU() + "|substitute"); substituteTbl.setwListBoxName("AD_InfoWindow_UU|"+ infoWindow.getAD_InfoWindow_UU() + "|substitute");
//related products
ColumnInfo[] s_layoutRelated = new ColumnInfo[]{ ColumnInfo[] s_layoutRelated = new ColumnInfo[]{
new ColumnInfo(Msg.translate(Env.getCtx(), "Warehouse"), "orgname", String.class, true, "orgname"), new ColumnInfo(Msg.translate(Env.getCtx(), "Warehouse"), "orgname", String.class, true, "orgname"),
new ColumnInfo( new ColumnInfo(
@ -272,9 +280,8 @@ public class InfoProductWindow extends InfoWindow {
m_sqlRelated = relatedTbl.prepareTable(s_layoutRelated, s_sqlFrom, s_sqlWhere, false, "M_PRODUCT_SUBSTITUTERELATED_V"); m_sqlRelated = relatedTbl.prepareTable(s_layoutRelated, s_sqlFrom, s_sqlWhere, false, "M_PRODUCT_SUBSTITUTERELATED_V");
relatedTbl.setMultiSelection(false); relatedTbl.setMultiSelection(false);
relatedTbl.setwListBoxName("AD_InfoWindow_UU|"+ infoWindow.getAD_InfoWindow_UU() + "|related"); relatedTbl.setwListBoxName("AD_InfoWindow_UU|"+ infoWindow.getAD_InfoWindow_UU() + "|related");
//Available to Promise Tab
// Header //Available to Promise Tab
ColumnInfo[] s_LayoutAtp = new ColumnInfo[]{ ColumnInfo[] s_LayoutAtp = new ColumnInfo[]{
new ColumnInfo(Msg.translate(Env.getCtx(), "Date"), "Date", String.class, true, "Date"), new ColumnInfo(Msg.translate(Env.getCtx(), "Date"), "Date", String.class, true, "Date"),
new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOnHand"), "QtyOnHand", Double.class, true, "QtyOnHand"), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOnHand"), "QtyOnHand", Double.class, true, "QtyOnHand"),
@ -291,7 +298,7 @@ public class InfoProductWindow extends InfoWindow {
m_tableAtp.prepareTable(s_LayoutAtp, "M_Storage", null , false, "M_Storage"); m_tableAtp.prepareTable(s_LayoutAtp, "M_Storage", null , false, "M_Storage");
m_tableAtp.setwListBoxName("AD_InfoWindow_UU|" + infoWindow.getAD_InfoWindow_UU() +"|ATP"); m_tableAtp.setwListBoxName("AD_InfoWindow_UU|" + infoWindow.getAD_InfoWindow_UU() +"|ATP");
//IDEMPIERE-337 //Product prices
ArrayList<ColumnInfo> list = new ArrayList<ColumnInfo>(); ArrayList<ColumnInfo> list = new ArrayList<ColumnInfo>();
list.add(new ColumnInfo(Msg.translate(Env.getCtx(), "PriceListVersion"), "plv.Name", String.class, true, "PriceListVersion")); list.add(new ColumnInfo(Msg.translate(Env.getCtx(), "PriceListVersion"), "plv.Name", String.class, true, "PriceListVersion"));
list.add(new ColumnInfo(Msg.translate(Env.getCtx(), "ValidFrom"), "plv.ValidFrom", Timestamp.class, true, "ValidFrom")); list.add(new ColumnInfo(Msg.translate(Env.getCtx(), "ValidFrom"), "plv.ValidFrom", Timestamp.class, true, "ValidFrom"));
@ -450,7 +457,7 @@ public class InfoProductWindow extends InfoWindow {
productpriceTbl.repaint(); productpriceTbl.repaint();
m_tableAtp.repaint(); m_tableAtp.repaint();
// add related info windows // add other related info windows (AD_InfoRelated)
if (embeddedWinList.size() > 0) { if (embeddedWinList.size() > 0) {
for (EmbedWinInfo embeddedWin : embeddedWinList) { for (EmbedWinInfo embeddedWin : embeddedWinList) {
if (embeddedWin.getInfoTbl() instanceof WListbox) { if (embeddedWin.getInfoTbl() instanceof WListbox) {
@ -786,7 +793,6 @@ public class InfoProductWindow extends InfoWindow {
} }
} // refresh } // refresh
// Elaine 2008/11/26
/** /**
* Query Avaiable to promise (ATP) * Query Avaiable to promise (ATP)
* @param m_M_Warehouse_ID * @param m_M_Warehouse_ID
@ -951,6 +957,7 @@ public class InfoProductWindow extends InfoWindow {
@Override @Override
protected void showHistory() { protected void showHistory() {
if (log.isLoggable(Level.INFO))
log.info(""); log.info("");
Integer M_Product_ID = getIntSelectedRowKey(MProduct.Table_ID); Integer M_Product_ID = getIntSelectedRowKey(MProduct.Table_ID);
if (M_Product_ID == null) if (M_Product_ID == null)

View File

@ -167,17 +167,19 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
private static final String ON_QUERY_AFTER_CHANGE = "onQueryAfterChange"; private static final String ON_QUERY_AFTER_CHANGE = "onQueryAfterChange";
/** Query parameter grid */
protected Grid parameterGrid; protected Grid parameterGrid;
private Borderlayout layout; private Borderlayout layout;
private Vbox southBody; private Vbox southBody;
/** List of WEditors */ /** List of WEditors */
protected List<WEditor> editors; protected List<WEditor> editors;
protected ArrayList<WEditor> editors2; protected ArrayList<WEditor> editors2;
/** List of editors that will trigger query after changes by user */
protected List<WEditor> queryAfterChangeEditors; protected List<WEditor> queryAfterChangeEditors;
protected List<WEditor> identifiers; protected List<WEditor> identifiers;
protected Properties infoContext; protected Properties infoContext;
/** embedded Panel **/ /** embedded Panel (AD_InfoRelated) **/
protected Tabbox embeddedPane = new Tabbox(); protected Tabbox embeddedPane = new Tabbox();
protected ArrayList <EmbedWinInfo> embeddedWinList = new ArrayList <EmbedWinInfo>(); protected ArrayList <EmbedWinInfo> embeddedWinList = new ArrayList <EmbedWinInfo>();
protected Map<Integer, RelatedInfoWindow> relatedMap = new HashMap<>(); protected Map<Integer, RelatedInfoWindow> relatedMap = new HashMap<>();
@ -191,9 +193,12 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
protected AbstractWQuickEntry vqe; protected AbstractWQuickEntry vqe;
//From and to grid fields
private List<GridField> gridFields; private List<GridField> gridFields;
private List<GridField> gridFields2; private List<GridField> gridFields2;
/** Selection Column Sequence:[InfoColumnVO, GridField] */
private TreeMap<Integer, List<Object[]>> parameterTree; private TreeMap<Integer, List<Object[]>> parameterTree;
/** To grid field of {@link #parameterTree} */
private TreeMap<Integer, List<Object[]>> parameterTree2; private TreeMap<Integer, List<Object[]>> parameterTree2;
private Checkbox checkAND; private Checkbox checkAND;
@ -209,19 +214,24 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
private Button exportButton = null; private Button exportButton = null;
/** /**
* Menu contail process menu item * Popup menu for process
*/ */
protected Menupopup ipMenu; protected Menupopup ipMenu;
/** Number of column for {@link #parameterGrid} */
private int noOfParameterColumn; private int noOfParameterColumn;
/** true to auto collapse parameter panel after execution of query */
private boolean autoCollapsedParameterPanel = false; private boolean autoCollapsedParameterPanel = false;
/** /**
* @param WindowNo * @param WindowNo
* @param tableName * @param tableName
* @param keyColumn * @param keyColumn
* @param queryValue
* @param multipleSelection * @param multipleSelection
* @param whereClause * @param whereClause
* @param AD_InfoWindow_ID
*/ */
public InfoWindow(int WindowNo, String tableName, String keyColumn, String queryValue, public InfoWindow(int WindowNo, String tableName, String keyColumn, String queryValue,
boolean multipleSelection, String whereClause, int AD_InfoWindow_ID) { boolean multipleSelection, String whereClause, int AD_InfoWindow_ID) {
@ -232,8 +242,10 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
* @param WindowNo * @param WindowNo
* @param tableName * @param tableName
* @param keyColumn * @param keyColumn
* @param queryValue
* @param multipleSelection * @param multipleSelection
* @param whereClause * @param whereClause
* @param AD_InfoWindow_ID
* @param lookup * @param lookup
*/ */
public InfoWindow(int WindowNo, String tableName, String keyColumn, String queryValue, public InfoWindow(int WindowNo, String tableName, String keyColumn, String queryValue,
@ -278,7 +290,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
addEventListener(ON_QUERY_AFTER_CHANGE, e -> postQueryAfterChangeEvent()); addEventListener(ON_QUERY_AFTER_CHANGE, e -> postQueryAfterChangeEvent());
//Xolali IDEMPIERE-1045 //update related info window tabs
contentPanel.addActionListener(new EventListener<Event>() { contentPanel.addActionListener(new EventListener<Event>() {
public void onEvent(Event event) throws Exception { public void onEvent(Event event) throws Exception {
@ -297,17 +309,16 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
updateSubcontent(row); updateSubcontent(row);
} }
}); //xolali --end- });
Env.setPredefinedVariables(Env.getCtx(), getWindowNo(), predefinedContextVariables); Env.setPredefinedVariables(Env.getCtx(), getWindowNo(), predefinedContextVariables);
infoContext = new Properties(Env.getCtx()); infoContext = new Properties(Env.getCtx());
p_loadedOK = loadInfoDefinition(); p_loadedOK = loadInfoDefinition();
// make process button only in windown mode // make process button only in window mode
if (!m_lookup){ if (!m_lookup){
// IDEMPIERE-1334
initInfoProcess(); initInfoProcess();
// when have a process, force multi select mode // when have a process, force multiple selection mode
if (haveProcess) if (haveProcess)
setMultipleSelection(true); setMultipleSelection(true);
} }
@ -360,7 +371,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
protected void updateSubcontent (int row){ // F3P: For multi-selection info, using selected row blocks the dislay to the first selected protected void updateSubcontent (int row){ // F3P: For multi-selection info, display for the first selected row
if(row < 0) if(row < 0)
row = contentPanel.getSelectedRow(); row = contentPanel.getSelectedRow();
@ -384,11 +395,10 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
} }
/** /**
* IDEMPIERE-1334 * IDEMPIERE-1334<br/>
* load info process info * Load info processes by layout type.<br/>
* separate by layout type * Create buttons, drop down list and popup menu.<br/>
* init drop list and menu control * Set status of haveProcess flag.<br/>
* set status of haveProcess flag
*/ */
protected void initInfoProcess() { protected void initInfoProcess() {
if (infoWindow == null){ if (infoWindow == null){
@ -509,10 +519,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
} }
/** /**
* evel display logic of process info button * Evaluate display logic of process info button and set visiblity of button. <br/>
* set visible of button base in display logic
* when two button set for same process, two button can hiden too, or display too.
* this is bug of implementor by never have this case
*/ */
protected void bindInfoProcessBt (){ protected void bindInfoProcessBt (){
if (infoProcessBtList == null){ if (infoProcessBtList == null){
@ -521,11 +528,11 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
// display process in button style // display process in button style
for (MInfoProcess infoProcessBt : infoProcessBtList){ for (MInfoProcess infoProcessBt : infoProcessBtList){
// eval display logic // evaluate display logic
for (Button evlBt: btProcessList){ for (Button evlBt: btProcessList){
Integer processId = (Integer)evlBt.getAttribute(PROCESS_ID_KEY); Integer processId = (Integer)evlBt.getAttribute(PROCESS_ID_KEY);
if (processId.intValue() == infoProcessBt.getAD_Process_ID()){ if (processId.intValue() == infoProcessBt.getAD_Process_ID()){
// display or hiden button // display or hide button
evlBt.setVisible(infoProcessBt.isDisplayed(infoContext, p_WindowNo)); evlBt.setVisible(infoProcessBt.isDisplayed(infoContext, p_WindowNo));
break; break;
} }
@ -534,15 +541,14 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
} }
/** /**
* recreate drop down item by recreate model to set hiden, display of drop down item * Create drop down list (Combobox) of process
* when all item is hiden, hiden combobox and process button too
*/ */
protected void bindInfoProcessDropDown (){ protected void bindInfoProcessDropDown (){
if (infoProcessDropList == null || infoProcessDropList.size() == 0){ if (infoProcessDropList == null || infoProcessDropList.size() == 0){
return; return;
} }
// list info process after eval display logic // list info process after evaluation of display logic
List<MInfoProcess> infoProcessDropListTmp = new ArrayList<MInfoProcess> (); List<MInfoProcess> infoProcessDropListTmp = new ArrayList<MInfoProcess> ();
// filter item not display // filter item not display
@ -552,7 +558,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
} }
} }
// when item is filter out all. don't show combobox // When all item is hidden. don't show combobox
cbbProcess.setVisible(infoProcessDropListTmp.size() > 0); cbbProcess.setVisible(infoProcessDropListTmp.size() > 0);
btCbbProcess.setVisible(infoProcessDropListTmp.size() > 0); btCbbProcess.setVisible(infoProcessDropListTmp.size() > 0);
if (infoProcessDropListTmp.size() > 0){ if (infoProcessDropListTmp.size() > 0){
@ -563,8 +569,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
} }
/** /**
* recreate menu item by set hiden, display of menu item * Create popup of menu for processes
* when all menu item is hiden, hiden process menu button too
*/ */
protected void bindInfoProcessMenu (){ protected void bindInfoProcessMenu (){
if (infoProcessMenuList == null || infoProcessMenuList == null) if (infoProcessMenuList == null || infoProcessMenuList == null)
@ -577,7 +582,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
} }
MProcess process = MProcess.get(Env.getCtx(), infoProcess.getAD_Process_ID()); MProcess process = MProcess.get(Env.getCtx(), infoProcess.getAD_Process_ID());
// make menu item for each info process // Create menu item for each info process
Menuitem ipMenuItem = new Menuitem(); Menuitem ipMenuItem = new Menuitem();
ipMenuItem.setLabel(process.get_Translation(MProcess.COLUMNNAME_Name)); ipMenuItem.setLabel(process.get_Translation(MProcess.COLUMNNAME_Name));
if (!Util.isEmpty(infoProcess.getImageURL(), true)) { if (!Util.isEmpty(infoProcess.getImageURL(), true)) {
@ -591,11 +596,12 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
ipMenu.appendChild(ipMenuItem); ipMenu.appendChild(ipMenuItem);
} }
//hide menu button if no visible process
btMenuProcess.setVisible(ipMenu.getChildren().size() > 0); btMenuProcess.setVisible(ipMenu.getChildren().size() > 0);
} }
/** /**
* move process buttons from left side of center to the front of right side * Move process buttons from left of centre panel to the front of right panel
*/ */
public void moveProcessButtonsToBeforeRight() { public void moveProcessButtonsToBeforeRight() {
if (btProcessList == null || btProcessList.isEmpty()) if (btProcessList == null || btProcessList.isEmpty())
@ -607,7 +613,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
} }
/** /**
* process query value from input element * Process query value from input element
*/ */
protected void processQueryValue() { protected void processQueryValue() {
isQueryByUser = true; isQueryByUser = true;
@ -750,7 +756,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
gridField2 = new GridField(vo2); gridField2 = new GridField(vo2);
} }
gridFields2.add(gridField2); gridFields2.add(gridField2);
//IDEMPIERE-4485 Clone new Gridfields with IsReadOnly = false //IDEMPIERE-4485 Clone new Grid fields with IsReadOnly = false
if(infoColumn.isQueryCriteria()) { if(infoColumn.isQueryCriteria()) {
vo = vo.clone(infoContext, p_WindowNo, 0, vo.AD_Window_ID, 0, false); vo = vo.clone(infoContext, p_WindowNo, 0, vo.AD_Window_ID, 0, false);
vo.IsReadOnly = false; vo.IsReadOnly = false;
@ -772,7 +778,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
} }
} }
// If we have a process and at least one process and an editable field, change to the info window rendered // If we have a process and at least one editable field, listen for table change event
int processCount = 0; int processCount = 0;
@ -832,7 +838,6 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
if (infoWindow == null) if (infoWindow == null)
return false; return false;
// topinfoColumns = infoWindow.getInfoColumns();
MInfoRelated[] infoRelatedList = infoWindow.getInfoRelated(true); MInfoRelated[] infoRelatedList = infoWindow.getInfoRelated(true);
//Init Info Related VO //Init Info Related VO
relatedInfoList = InfoRelatedVO.getInfoRelatedVOList(Env.getCtx(), infoRelatedList, p_WindowNo); relatedInfoList = InfoRelatedVO.getInfoRelatedVOList(Env.getCtx(), infoRelatedList, p_WindowNo);
@ -840,8 +845,6 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
Tabpanels tabPanels = new Tabpanels(); Tabpanels tabPanels = new Tabpanels();
Tabs tabs = new Tabs(); Tabs tabs = new Tabs();
// for(int i=0; i < relatedinfoList.length - 1 ; i++) {
for (InfoRelatedVO relatedInfo:relatedInfoList) { for (InfoRelatedVO relatedInfo:relatedInfoList) {
if(!relatedInfo.isDisplayed(infoContext)) { if(!relatedInfo.isDisplayed(infoContext)) {
@ -861,8 +864,6 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
WListbox embeddedTbl = new WListbox(); WListbox embeddedTbl = new WListbox();
String m_sqlEmbedded; String m_sqlEmbedded;
//MInfoWindow.getInfoWindow(infoRelatedID);
if (embedInfo != null) { if (embedInfo != null) {
ArrayList<ColumnInfo> list = new ArrayList<ColumnInfo>(); ArrayList<ColumnInfo> list = new ArrayList<ColumnInfo>();
list = getInfoColumnslayout(embedInfo); list = getInfoColumnslayout(embedInfo);
@ -894,7 +895,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
embeddedPaging.setSclass("infowindow-related-paging"); embeddedPaging.setSclass("infowindow-related-paging");
//Xolali - add embeddedTbl to list, add m_sqlembedded to list //Xolali - add embeddedTbl to list, add m_sqlembedded to list
EmbedWinInfo ewinInfo = new EmbedWinInfo(embedInfo,embeddedTbl,m_sqlEmbedded,relatedInfo.getLinkColumnName(), relatedInfo.getLinkInfoColumn(), relatedInfo.getParentRelatedColumn_ID()); EmbedWinInfo ewinInfo = new EmbedWinInfo(embedInfo, embeddedTbl, m_sqlEmbedded, relatedInfo.getLinkColumnName(), relatedInfo.getLinkInfoColumn(), relatedInfo.getParentRelatedColumn_ID());
embeddedWinList.add(ewinInfo); embeddedWinList.add(ewinInfo);
RelatedInfoWindow relatedInfoWindow = new RelatedInfoWindow(ewinInfo, this, embeddedPaging, s_sqlCount, s_layoutEmbedded, editorMap); RelatedInfoWindow relatedInfoWindow = new RelatedInfoWindow(ewinInfo, this, embeddedPaging, s_sqlCount, s_layoutEmbedded, editorMap);
relatedMap.put(embedInfo.getAD_InfoWindow_ID(), relatedInfoWindow); relatedMap.put(embedInfo.getAD_InfoWindow_ID(), relatedInfoWindow);
@ -903,7 +904,6 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
Tab tab = new Tab(tabTitle); Tab tab = new Tab(tabTitle);
tabs.appendChild(tab); tabs.appendChild(tab);
Tabpanel desktopTabPanel = new Tabpanel(); Tabpanel desktopTabPanel = new Tabpanel();
//desktopTabPanel.
ZKUpdateUtil.setHeight(desktopTabPanel, "100%"); ZKUpdateUtil.setHeight(desktopTabPanel, "100%");
Vlayout vlayout = new Vlayout(); Vlayout vlayout = new Vlayout();
ZKUpdateUtil.setVflex(vlayout, "1"); ZKUpdateUtil.setVflex(vlayout, "1");
@ -916,12 +916,8 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
} }
if (relatedInfoList.length > 0) { // setup the panel if (relatedInfoList.length > 0) { // setup the panel
//embeddedPane.setTitle(Msg.translate(Env.getCtx(), "Related Information"));
ZKUpdateUtil.setHeight(embeddedPane, "100%"); ZKUpdateUtil.setHeight(embeddedPane, "100%");
//tabPanels = new Tabpanels();
embeddedPane.appendChild(tabPanels); embeddedPane.appendChild(tabPanels);
//tabs = new Tabs();
embeddedPane.appendChild(tabs); embeddedPane.appendChild(tabs);
} }
@ -930,7 +926,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
} }
/** /**
* setup list box and construct sql query clause * Setup list box and construct SQL query clause
*/ */
protected void prepareTable() { protected void prepareTable() {
List<ColumnInfo> list = new ArrayList<ColumnInfo>(); List<ColumnInfo> list = new ArrayList<ColumnInfo>();
@ -1029,7 +1025,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
MLookupInfo lookupInfo = MLookupFactory.getLookupInfo(Env.getCtx(), p_WindowNo, 0, infoColumn.getAD_Reference_ID(), Env.getLanguage(Env.getCtx()), columnName, infoColumn.getAD_Reference_Value_ID(), false, validationCode); MLookupInfo lookupInfo = MLookupFactory.getLookupInfo(Env.getCtx(), p_WindowNo, 0, infoColumn.getAD_Reference_ID(), Env.getLanguage(Env.getCtx()), columnName, infoColumn.getAD_Reference_Value_ID(), false, validationCode);
String displayColumn = lookupInfo.DisplayColumn; String displayColumn = lookupInfo.DisplayColumn;
boolean haveNotProcess = !haveProcess; // A field is editabile only if is not readonly and theres a process; boolean haveNotProcess = !haveProcess; // A field is editable only if is not readonly and there is a process;
int index = infoColumn.getSelectClause().indexOf("."); int index = infoColumn.getSelectClause().indexOf(".");
if (index >= 0 && index == infoColumn.getSelectClause().lastIndexOf(".")) if (index >= 0 && index == infoColumn.getSelectClause().lastIndexOf("."))
@ -1108,7 +1104,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
@Override @Override
protected String getSQLWhere() { protected String getSQLWhere() {
/** /**
* when query not by click requery button, reuse prev where clause * when query not by click re-query button, reuse previous where clause
* IDEMPIERE-1979 * IDEMPIERE-1979
*/ */
if (!isQueryByUser && prevWhereClause != null){ if (!isQueryByUser && prevWhereClause != null){
@ -1310,13 +1306,11 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
} }
/** /**
* Check has new parameter is change or new input * Check if parameter value has change
* in case first time search, return true * @return true if at least one parameter value has change or this is the first search by user
* @return
*/ */
protected boolean isParameteChangeValue (){ protected boolean isParameteChangeValue (){
if (prevParameterValues == null){ if (prevParameterValues == null){
// never process query, because consider as changed value to process current search
return true; return true;
} }
@ -1416,8 +1410,8 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
} }
/** /**
* set parameter for statement. * Set parameters for prepared statement.<br/>
* not need check null for value * Does not need null check for value.
* @param pstmt * @param pstmt
* @param parameterIndex * @param parameterIndex
* @param value * @param value
@ -1477,15 +1471,15 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
} }
/** /**
* add all ViewID in each MInfoProcess to query * Add all ViewID in each MInfoProcess to query.<br/>
* if main query have subquery in SELECT, it will beak or incorrect * If main query have subquery in SELECT, it will beak or incorrect
*/ */
protected void addViewIDToQuery () { protected void addViewIDToQuery () {
m_sqlMain = addMoreColumnToQuery (m_sqlMain, infoProcessList); m_sqlMain = addMoreColumnToQuery (m_sqlMain, infoProcessList);
} }
/** /**
* if {@link #keyColumnOfView} not null and not display, add query to query it's value * If {@link #keyColumnOfView} not null and not display, add {@link #keyColumnOfView} to query
*/ */
protected void addKeyViewToQuery () { protected void addKeyViewToQuery () {
if (isNeedAppendKeyViewData()){ if (isNeedAppendKeyViewData()){
@ -1499,15 +1493,14 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
} }
/** /**
* because data of infoColumn have isDisplay = false not load, * Info window load infoColumns with isDisplay = true to construct the main query. <br/>
* just display column is load to show in List. * Some function uses data from hidden column as viewID in infoProcess
* Some function receive data from hidden column as viewID in infoProcess * or as parentLink of infoRelateWindow. This function is use to append the hidden column to main query.
* or parentLink of infoRelateWindow. * <p/>
* * Append info window column to query.
* this function just add column name of hidden infoWindow to end of query * @param sqlMain main SQL to append column
* @param sqlMain main sql to append column * @param listInfoColumn list of info column to add to query
* @param listInfoColumn list of PO contain infoColumnID, this infoColumnID will add to query * @return SQL after append column
* @return sql after append column
*/ */
protected String addMoreColumnToQuery (String sqlMain, IInfoColumn [] listInfoColumn) { protected String addMoreColumnToQuery (String sqlMain, IInfoColumn [] listInfoColumn) {
if (sqlMain == null || sqlMain.length() == 0 || listInfoColumn == null || listInfoColumn.length == 0){ if (sqlMain == null || sqlMain.length() == 0 || listInfoColumn == null || listInfoColumn.length == 0){
@ -1675,14 +1668,12 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
south.setTooltiptext(Msg.translate(Env.getCtx(), "Related Information")); south.setTooltiptext(Msg.translate(Env.getCtx(), "Related Information"));
south.setSclass("south-collapsible-with-title"); south.setSclass("south-collapsible-with-title");
south.setAutoscroll(true); south.setAutoscroll(true);
//south.sets
inner.appendChild(south); inner.appendChild(south);
embeddedPane.setSclass("info-product-tabbedpane"); embeddedPane.setSclass("info-product-tabbedpane");
ZKUpdateUtil.setVflex(embeddedPane, "1"); ZKUpdateUtil.setVflex(embeddedPane, "1");
ZKUpdateUtil.setHflex(embeddedPane, "1"); ZKUpdateUtil.setHflex(embeddedPane, "1");
south.appendChild(embeddedPane); south.appendChild(embeddedPane);
}// render embedded }// render embedded
center.appendChild(inner); center.appendChild(inner);
@ -1834,7 +1825,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
* Add Selection Column to first Tab * Add Selection Column to first Tab
* @param infoColumn * @param infoColumn
* @param mField field * @param mField field
**/ */
protected void addSelectionColumn(InfoColumnVO infoColumn, GridField mField, GridField mField2) protected void addSelectionColumn(InfoColumnVO infoColumn, GridField mField, GridField mField2)
{ {
int displayLength = mField.getDisplayLength(); int displayLength = mField.getDisplayLength();
@ -2117,7 +2108,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
* Append ORDER BY expressions into the select list * Append ORDER BY expressions into the select list
* @param sql * @param sql
* @param orderBy * @param orderBy
* @return String parsed sql * @return sql with order by
*/ */
private String appendOrderByToSelectList(String sql, String orderBy) { private String appendOrderByToSelectList(String sql, String orderBy) {
if(Util.isEmpty(orderBy)) if(Util.isEmpty(orderBy))
@ -2132,9 +2123,9 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
} }
/** /**
* Get the index of the FROM statement * Get the index of the FROM keyword
* @param sql * @param sql
* @return int idx * @return index of the FROM keyword
*/ */
private int getIdxFrom(String sql) { private int getIdxFrom(String sql) {
int parenthesisLevel = 0; int parenthesisLevel = 0;
@ -2522,7 +2513,9 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
return true; return true;
} // testCount } // testCount
/** Return true if there is an 'IsActive' criteria */ /**
* @return true if there is an 'IsActive' criteria
*/
protected boolean hasIsActiveEditor() { protected boolean hasIsActiveEditor() {
for (WEditor editor : editors) { for (WEditor editor : editors) {
if (editor.getGridField() != null && "IsActive".equals(editor.getGridField().getColumnName())) { if (editor.getGridField() != null && "IsActive".equals(editor.getGridField().getColumnName())) {
@ -2617,7 +2610,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
* author xolali IDEMPIERE-1045 * author xolali IDEMPIERE-1045
* GridField getGridField(InfoColumnVO infoColumn) * GridField getGridField(InfoColumnVO infoColumn)
* @param infoColumn * @param infoColumn
* @return * @return GridField
*/ */
protected GridField getGridField(InfoColumnVO infoColumn){ protected GridField getGridField(InfoColumnVO infoColumn){
String columnName = infoColumn.getColumnName(); String columnName = infoColumn.getColumnName();
@ -2668,10 +2661,10 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
} }
/** /**
* valid mandatory of a not null, display field * Validate mandatory fields.<br/>
* display red color when a mandatory field is not input * Display red color when a mandatory field is not fill.
* @param wEditor * @param wEditor
* @return * @return true if pass mandatory validation, false otherwise
*/ */
protected boolean validateField (WEditor wEditor){ protected boolean validateField (WEditor wEditor){
if (wEditor == null || !wEditor.isVisible() || wEditor.getGridField() == null){ if (wEditor == null || !wEditor.isVisible() || wEditor.getGridField() == null){
@ -2720,7 +2713,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
/** /**
* Get id of window link with main table of this info window * Get id of window link with main table of this info window
* @return * @return AD_Window_ID
*/ */
protected int getADWindowID() { protected int getADWindowID() {
if(infoWindow == null) if(infoWindow == null)
@ -2774,7 +2767,10 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
} }
/** Allow to show or hide the sub panel (detail) programmatically */ /**
* Allow to show or hide the sub panel (detail) programmatically
* @param visible
*/
protected void setSouthVisible(boolean visible) { protected void setSouthVisible(boolean visible) {
Component comp = layout.getCenter(); Component comp = layout.getCenter();
for (Component c : comp.getChildren()) { for (Component c : comp.getChildren()) {
@ -2802,7 +2798,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
ListModelTable model = contentPanel.getModel(); ListModelTable model = contentPanel.getModel();
Properties ctx = new Properties(Env.getCtx()); // Allow session values Properties ctx = new Properties(Env.getCtx()); // Allow session values
// Parameter dditors // Parameter editors
for(WEditor e:editors) for(WEditor e:editors)
{ {
@ -3099,7 +3095,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
List<Object> originalSelectedRow = temporarySelectedData.get(keyViewValue); List<Object> originalSelectedRow = temporarySelectedData.get(keyViewValue);
ListModelTable model = contentPanel.getModel(); ListModelTable model = contentPanel.getModel();
// While restoring values we dong want to trigger listeners // While restoring values we don't want to trigger listeners
model.removeTableModelListener(this); model.removeTableModelListener(this);
if (originalSelectedRow != null) if (originalSelectedRow != null)

View File

@ -83,10 +83,12 @@ public class RelatedInfoWindow implements EventListener<Event>, Sortable<Object>
private ColumnInfo[] columnsLayout; private ColumnInfo[] columnsLayout;
/** /**
* @param info
* @param infoWindow * @param infoWindow
* @param embeddedPaging * @param embeddedPaging
* @param infoSqlCount
* @param layoutEmbedded * @param layoutEmbedded
* * @param editorMap
*/ */
public RelatedInfoWindow(EmbedWinInfo info, InfoWindow infoWindow, Paging embeddedPaging, String infoSqlCount, ColumnInfo[] layoutEmbedded, Map<String, WEditor> editorMap) { public RelatedInfoWindow(EmbedWinInfo info, InfoWindow infoWindow, Paging embeddedPaging, String infoSqlCount, ColumnInfo[] layoutEmbedded, Map<String, WEditor> editorMap) {
this.editorMap = editorMap; this.editorMap = editorMap;
@ -98,6 +100,9 @@ public class RelatedInfoWindow implements EventListener<Event>, Sortable<Object>
columnsLayout = layoutEmbedded; columnsLayout = layoutEmbedded;
} }
/**
* @param id
*/
public void refresh(Object id) { public void refresh(Object id) {
parentId = id; parentId = id;
@ -225,26 +230,32 @@ public class RelatedInfoWindow implements EventListener<Event>, Sortable<Object>
} }
/** /**
* @return the cacheStart * @return the cacheStart index
*/ */
protected int getCacheStart() { protected int getCacheStart() {
return cacheStart; return cacheStart;
} }
/** /**
* @param cacheStart the cacheStart to set * @param cacheStart set cacheStart index
*/ */
private void setCacheStart(int cacheStart) { private void setCacheStart(int cacheStart) {
this.cacheStart = cacheStart; this.cacheStart = cacheStart;
} }
/** /**
* @return the cacheEnd * @return the cacheEnd index
*/ */
protected int getCacheEnd() { protected int getCacheEnd() {
return cacheEnd; return cacheEnd;
} }
/**
* @param fromIndex
* @param toIndex
* @param line
* @return sublist from line
*/
private List<Object> getSubList (int fromIndex, int toIndex, List<Object> line){ private List<Object> getSubList (int fromIndex, int toIndex, List<Object> line){
if (toIndex > line.size()) if (toIndex > line.size())
toIndex = line.size(); toIndex = line.size();
@ -260,17 +271,17 @@ public class RelatedInfoWindow implements EventListener<Event>, Sortable<Object>
} }
/** /**
* when calculator value at bound, sometime value is overflow by data type * When calculate value at bound, sometime value is overflow by data type. <br/>
* this function calculator at high type for avoid it * This function calculate using higher type to workaround it.
* @param overValue * @param overValue
* @return * @return int value
*/ */
private int getOverIntValue (long overValue){ private int getOverIntValue (long overValue){
return getOverIntValue (overValue, 0); return getOverIntValue (overValue, 0);
} }
/** /**
* see {@link #getOverIntValue(long)}. when value over max_value set it near max_value. * see {@link #getOverIntValue(long)}. when value over max_value set it to nearest max_value.
* @param overValue * @param overValue
* @param extra * @param extra
* @return * @return
@ -282,6 +293,12 @@ public class RelatedInfoWindow implements EventListener<Event>, Sortable<Object>
return (int)overValue; return (int)overValue;
} }
/**
* Loading of data from DB
* @param start
* @param end
* @return list of values read
*/
private List<Object> readLine(int start, int end) { private List<Object> readLine(int start, int end) {
int pageSize = parentInfoWindow.getPageSize(); int pageSize = parentInfoWindow.getPageSize();
@ -572,9 +589,9 @@ public class RelatedInfoWindow implements EventListener<Event>, Sortable<Object>
} }
/** /**
* after query from database, process validate. * After query from database, validate paging. <br/>
* if end page include in cache, process calculate total record * If end page included in cache, calculate record total. <br/>
* if current page is out of page (no record is query) process query count to detect end page * If current page is out of cache (no record is query), process query count to detect end page
*/ */
protected void validateEndPage (){ protected void validateEndPage (){
if (paging == null || info.getInfowin().isLoadPageNum()) if (paging == null || info.getInfowin().isLoadPageNum())

View File

@ -147,7 +147,5 @@ public class WInfoPAttributeEditor extends WEditor implements IWhereClauseEditor
@Override @Override
public void dynamicDisplay() { public void dynamicDisplay() {
// int attributeSetId = Env.getContextAsInt(ctx, windowNo, Env.TAB_INFO, "M_AttributeSet_ID");
// setReadWrite(attributeSetId > 0);
} }
} }

View File

@ -54,10 +54,10 @@ public abstract class AbstractListitemRenderer<T> implements ListitemRenderer<T>
} }
/** /**
* Renders the data to the specified list item. * Renders data to the specified list item.
* @param item the listitem to render the result. * @param item the listitem to render the result.
* @param data data that is returned from {@link ListModel#getElementAt} * @param data data returned from {@link ListModel#getElementAt}
* @param index the row/list index of the data that is currently being rendered * @param index the row/list index of data that is currently being rendered
*/ */
public abstract void renderListitem(Listitem item, T data, int index); public abstract void renderListitem(Listitem item, T data, int index);

View File

@ -48,7 +48,7 @@ import org.zkoss.zk.ui.event.KeyEvent;
public abstract class ADForm extends Window implements EventListener<Event>, IHelpContext public abstract class ADForm extends Window implements EventListener<Event>, IHelpContext
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = -5381283117636286759L; private static final long serialVersionUID = -5381283117636286759L;
@ -60,15 +60,14 @@ public abstract class ADForm extends Window implements EventListener<Event>, IHe
logger = CLogger.getCLogger(ADForm.class); logger = CLogger.getCLogger(ADForm.class);
} }
/** The unique identifier of the form type */ /** AD_Form_ID */
private int m_adFormId; private int m_adFormId;
/** The identifying number of the window in which the form is housed */ /** window number of desktop tab */
protected int m_WindowNo; protected int m_WindowNo;
/** Name of form */
private String m_name; private String m_name;
private ProcessInfo m_pi; private ProcessInfo m_pi;
private IFormController m_customForm; private IFormController m_customForm;
@ -91,11 +90,17 @@ public abstract class ADForm extends Window implements EventListener<Event>, IHe
this.setContentSclass("adform-content"); this.setContentSclass("adform-content");
} }
/**
* @return window number
*/
public int getWindowNo() public int getWindowNo()
{ {
return m_WindowNo; return m_WindowNo;
} }
/**
* @return AD_Form_ID
*/
protected int getAdFormId() protected int getAdFormId()
{ {
return m_adFormId; return m_adFormId;
@ -104,8 +109,8 @@ public abstract class ADForm extends Window implements EventListener<Event>, IHe
/** /**
* Initialise the form * Initialise the form
* *
* @param adFormId the Adempiere form identifier * @param adFormId AD_Form_ID
* @param name the name of the Adempiere form * @param name Name of form
*/ */
protected void init(int adFormId, String name) protected void init(int adFormId, String name)
@ -125,6 +130,9 @@ public abstract class ADForm extends Window implements EventListener<Event>, IHe
addEventListener(WindowContainer.ON_WINDOW_CONTAINER_SELECTION_CHANGED_EVENT, this); addEventListener(WindowContainer.ON_WINDOW_CONTAINER_SELECTION_CHANGED_EVENT, this);
} }
/**
* Initialize form layout
*/
abstract protected void initForm(); abstract protected void initForm();
/** /**
@ -137,7 +145,7 @@ public abstract class ADForm extends Window implements EventListener<Event>, IHe
/** /**
* Create a new form corresponding to the specified identifier * Create a new form corresponding to the specified identifier
* *
* @param adFormID The unique identifier for the form type * @param adFormID AD_Form_ID
* @return The created form * @return The created form
*/ */
public static ADForm openForm (int adFormID) public static ADForm openForm (int adFormID)
@ -188,6 +196,7 @@ public abstract class ADForm extends Window implements EventListener<Event>, IHe
* @param gridTab * @param gridTab
* @param pi * @param pi
* @param predefinedContextVariables * @param predefinedContextVariables
* @param isSOTrx
* @return The created form * @return The created form
*/ */
public static ADForm openForm (int adFormID, GridTab gridTab, ProcessInfo pi, String predefinedContextVariables, boolean isSOTrx) public static ADForm openForm (int adFormID, GridTab gridTab, ProcessInfo pi, String predefinedContextVariables, boolean isSOTrx)
@ -199,7 +208,7 @@ public abstract class ADForm extends Window implements EventListener<Event>, IHe
if (mform.get_ID() == 0 || formName == null) if (mform.get_ID() == 0 || formName == null)
{ {
throw new ApplicationException("There is no form associated with the specified selection"); throw new ApplicationException("There is no form associated with the specified form ID");
} }
else else
{ {
@ -225,9 +234,7 @@ public abstract class ADForm extends Window implements EventListener<Event>, IHe
} }
} // openForm } // openForm
/** @Override
*
*/
public void onEvent(Event event) throws Exception public void onEvent(Event event) throws Exception
{ {
if (event.getName().equals(WindowContainer.ON_WINDOW_CONTAINER_SELECTION_CHANGED_EVENT)) { if (event.getName().equals(WindowContainer.ON_WINDOW_CONTAINER_SELECTION_CHANGED_EVENT)) {
@ -262,11 +269,17 @@ public abstract class ADForm extends Window implements EventListener<Event>, IHe
return m_pi; return m_pi;
} }
/**
* @param customForm
*/
public void setICustomForm(IFormController customForm) public void setICustomForm(IFormController customForm)
{ {
m_customForm = customForm; m_customForm = customForm;
} }
/**
* @return IFormController
*/
public IFormController getICustomForm() public IFormController getICustomForm()
{ {
return m_customForm; return m_customForm;
@ -282,6 +295,9 @@ public abstract class ADForm extends Window implements EventListener<Event>, IHe
private GridTab gridTab; private GridTab gridTab;
/**
* @return GridTab
*/
public GridTab getGridTab() public GridTab getGridTab()
{ {
return gridTab; return gridTab;

View File

@ -57,28 +57,35 @@ import org.zkoss.zul.Treeitem;
import org.zkoss.zul.Treerow; import org.zkoss.zul.Treerow;
/** /**
* Menu Panel Base * Abstract base class for Menu Panel
* @author Elaine * @author Elaine
* @date July 31, 2012 * @date July 31, 2012
*/ */
public abstract class AbstractMenuPanel extends Panel implements EventListener<Event> { public abstract class AbstractMenuPanel extends Panel implements EventListener<Event> {
/** Treeitem attribute to store the type of menu item (report, window, etc) */
public static final String MENU_TYPE_ATTRIBUTE = "menu.type"; public static final String MENU_TYPE_ATTRIBUTE = "menu.type";
/** Treeitem attribute to store the name of a menu item */
public static final String MENU_LABEL_ATTRIBUTE = "menu.label"; public static final String MENU_LABEL_ATTRIBUTE = "menu.label";
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = -6160708371157917922L; private static final long serialVersionUID = -6160708371157917922L;
/** Event queue name */
public static final String MENU_ITEM_SELECTED_QUEUE = "MENU_ITEM_SELECTED_QUEUE"; public static final String MENU_ITEM_SELECTED_QUEUE = "MENU_ITEM_SELECTED_QUEUE";
private Properties ctx; private Properties ctx;
private Tree menuTree; private Tree menuTree;
/** Listener for {@link #MENU_ITEM_SELECTED_QUEUE} event queue */
private EventListener<Event> listener; private EventListener<Event> listener;
/**
* @param parent
*/
public AbstractMenuPanel(Component parent) public AbstractMenuPanel(Component parent)
{ {
if (parent != null) if (parent != null)
@ -86,6 +93,9 @@ public abstract class AbstractMenuPanel extends Panel implements EventListener<E
init(); init();
} }
/**
* Initialize {@link #menuTree}
*/
protected void init() { protected void init() {
ctx = Env.getCtx(); ctx = Env.getCtx();
int adRoleId = Env.getAD_Role_ID(ctx); int adRoleId = Env.getAD_Role_ID(ctx);
@ -96,6 +106,9 @@ public abstract class AbstractMenuPanel extends Panel implements EventListener<E
initMenu(rootNode); initMenu(rootNode);
} }
/**
* Create components
*/
protected void initComponents() protected void initComponents()
{ {
this.setSclass("menu-panel"); this.setSclass("menu-panel");
@ -109,6 +122,10 @@ public abstract class AbstractMenuPanel extends Panel implements EventListener<E
menuTree.setPageSize(-1); // Due to bug in the new paging functionality menuTree.setPageSize(-1); // Due to bug in the new paging functionality
} }
/**
* Fill {@link #menuTree} from rootNode
* @param rootNode
*/
private void initMenu(MTreeNode rootNode) private void initMenu(MTreeNode rootNode)
{ {
Treecols treeCols = new Treecols(); Treecols treeCols = new Treecols();
@ -123,6 +140,11 @@ public abstract class AbstractMenuPanel extends Panel implements EventListener<E
generateMenu(rootTreeChildren, rootNode); generateMenu(rootTreeChildren, rootNode);
} }
/**
* @param ctx
* @param adRoleId
* @return AD_Tree_ID for role
*/
private int getTreeId(Properties ctx, int adRoleId) private int getTreeId(Properties ctx, int adRoleId)
{ {
int AD_Tree_ID = DB.getSQLValue(null, int AD_Tree_ID = DB.getSQLValue(null,
@ -135,6 +157,11 @@ public abstract class AbstractMenuPanel extends Panel implements EventListener<E
return AD_Tree_ID; return AD_Tree_ID;
} }
/**
* Fill treeChildren from mNode
* @param treeChildren
* @param mNode
*/
private void generateMenu(Treechildren treeChildren, MTreeNode mNode) private void generateMenu(Treechildren treeChildren, MTreeNode mNode)
{ {
Enumeration<?> nodeEnum = mNode.children(); Enumeration<?> nodeEnum = mNode.children();
@ -236,6 +263,10 @@ public abstract class AbstractMenuPanel extends Panel implements EventListener<E
} }
} }
/**
* Create new record button
* @return Toolbarbutton
*/
public Toolbarbutton createNewButton() public Toolbarbutton createNewButton()
{ {
Toolbarbutton newBtn = new Toolbarbutton(null, ThemeManager.getThemeResource("images/New10.png")); Toolbarbutton newBtn = new Toolbarbutton(null, ThemeManager.getThemeResource("images/New10.png"));
@ -248,6 +279,7 @@ public abstract class AbstractMenuPanel extends Panel implements EventListener<E
return newBtn; return newBtn;
} }
@Override
public void onEvent(Event event) public void onEvent(Event event)
{ {
Component comp = event.getTarget(); Component comp = event.getTarget();
@ -258,6 +290,11 @@ public abstract class AbstractMenuPanel extends Panel implements EventListener<E
} }
} }
/**
* Handle onClick and onOk event
* @param comp
* @param eventData
*/
private void doOnClick(Component comp, Object eventData) { private void doOnClick(Component comp, Object eventData) {
boolean newRecord = false; boolean newRecord = false;
if (comp instanceof A) { if (comp instanceof A) {
@ -311,10 +348,16 @@ public abstract class AbstractMenuPanel extends Panel implements EventListener<E
else else
selectedItem.setOpen(!selectedItem.isOpen()); selectedItem.setOpen(!selectedItem.isOpen());
selectedItem.setSelected(true); selectedItem.setSelected(true);
//publish event to sync the selection of other menu tree (if any)
EventQueues.lookup(MENU_ITEM_SELECTED_QUEUE, EventQueues.DESKTOP, true).publish(new Event(Events.ON_SELECT, null, selectedItem)); EventQueues.lookup(MENU_ITEM_SELECTED_QUEUE, EventQueues.DESKTOP, true).publish(new Event(Events.ON_SELECT, null, selectedItem));
} }
} }
/**
* Handle new record event
* @param selectedItem
*/
private void onNewRecord(Treeitem selectedItem) { private void onNewRecord(Treeitem selectedItem) {
try try
{ {
@ -351,6 +394,10 @@ public abstract class AbstractMenuPanel extends Panel implements EventListener<E
} }
/**
* Handle onClick event of tree item
* @param selectedItem
*/
protected void fireMenuSelectedEvent(Treeitem selectedItem) { protected void fireMenuSelectedEvent(Treeitem selectedItem) {
int nodeId = Integer.parseInt((String)selectedItem.getValue()); int nodeId = Integer.parseInt((String)selectedItem.getValue());
@ -367,11 +414,17 @@ public abstract class AbstractMenuPanel extends Panel implements EventListener<E
} }
} }
/**
* @return Tree
*/
public Tree getMenuTree() public Tree getMenuTree()
{ {
return menuTree; return menuTree;
} }
/**
* @return ctx
*/
public Properties getCtx() public Properties getCtx()
{ {
return ctx; return ctx;

View File

@ -49,14 +49,14 @@ import org.zkoss.zul.Separator;
import org.zkoss.zul.South; import org.zkoss.zul.South;
/** /**
* * Window to view and acknowledge messages from AD_BroadcastMessage
* @author Vivek * @author Vivek
* @author Deepak Pansheriya * @author Deepak Pansheriya
* *
*/ */
public class BroadcastMessageWindow extends Window implements IBroadcastMsgPopup,EventListener<Event>{ public class BroadcastMessageWindow extends Window implements IBroadcastMsgPopup,EventListener<Event>{
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = 1849434312706721390L; private static final long serialVersionUID = 1849434312706721390L;
@ -65,20 +65,27 @@ public class BroadcastMessageWindow extends Window implements IBroadcastMsgPopup
public static final int PRESSED_NEXT = 2; public static final int PRESSED_NEXT = 2;
public static final int UPDATE_CurrMsg = 0; public static final int UPDATE_CurrMsg = 0;
/** index of current show/render message in {@link #mbMessages} */
private int currMsg=0; private int currMsg=0;
private Label textMsgNo = null; private Label textMsgNo = null;
private Html textMsgContent = null; private Html textMsgContent = null;
private North north =null; private North north =null;
/** Container for message navigation controls */
private Div swDiv =null; private Div swDiv =null;
private Button btnPrev = null; private Button btnPrev = null;
private Button btnNext = null; private Button btnNext = null;
private Checkbox acknowledged = null; private Checkbox acknowledged = null;
private ArrayList<MBroadcastMessage> mbMessages = null; private ArrayList<MBroadcastMessage> mbMessages = null;
/** AD_BroadcastMessage_ID:Processed */
private Hashtable<Integer, Boolean> hashMessages = new Hashtable<Integer, Boolean>(); private Hashtable<Integer, Boolean> hashMessages = new Hashtable<Integer, Boolean>();
/** Parent of window */
private HeaderPanel pnlHead = null; private HeaderPanel pnlHead = null;
private boolean isTest = false; private boolean isTest = false;
private boolean initialised = false; private boolean initialised = false;
/**
* @param pnlHead
*/
public BroadcastMessageWindow(HeaderPanel pnlHead) { public BroadcastMessageWindow(HeaderPanel pnlHead) {
this.pnlHead = pnlHead; this.pnlHead = pnlHead;
textMsgNo = new Label(); textMsgNo = new Label();
@ -88,6 +95,9 @@ public class BroadcastMessageWindow extends Window implements IBroadcastMsgPopup
btnNext = new Button(">"); btnNext = new Button(">");
} }
/**
* Layout window
*/
private void init() { private void init() {
Borderlayout layout = new Borderlayout(); Borderlayout layout = new Borderlayout();
this.appendChild(layout); this.appendChild(layout);
@ -183,6 +193,10 @@ public class BroadcastMessageWindow extends Window implements IBroadcastMsgPopup
} }
} }
/**
* Process messages
* @param arrMessages
*/
public void prepareMessage(ArrayList<MBroadcastMessage> arrMessages){ public void prepareMessage(ArrayList<MBroadcastMessage> arrMessages){
mbMessages = arrMessages; mbMessages = arrMessages;
createHashTable(); createHashTable();
@ -243,7 +257,7 @@ public class BroadcastMessageWindow extends Window implements IBroadcastMsgPopup
/** /**
* Update message on window * Update message on window
* @param status * @param status next, previous or current
*/ */
public void renderMsg(int status) { public void renderMsg(int status) {
int msgToUpdate = currMsg-1; int msgToUpdate = currMsg-1;
@ -367,7 +381,7 @@ public class BroadcastMessageWindow extends Window implements IBroadcastMsgPopup
} }
/** Set the title for the panel using what is defined on the message or fallback to "Message" */ /** Set the title for the panel using what is defined on the message or fallback to "Message" */
void setTitle(MBroadcastMessage bm) { protected void setTitle(MBroadcastMessage bm) {
String title = bm.get_Translation(MBroadcastMessage.COLUMNNAME_Title); String title = bm.get_Translation(MBroadcastMessage.COLUMNNAME_Title);
setTitle(Util.isEmpty(title) ? Msg.getMsg(Env.getCtx(), "Message") : title); setTitle(Util.isEmpty(title) ? Msg.getMsg(Env.getCtx(), "Message") : title);
} }

View File

@ -57,14 +57,14 @@ import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zul.Image; import org.zkoss.zul.Image;
/** /**
* Change Password Panel * Change Password dialog
* @author Elaine * @author Elaine
* @date August 30, 2012 * @date August 30, 2012
*/ */
public class ChangePasswordPanel extends Window implements EventListener<Event> public class ChangePasswordPanel extends Window implements EventListener<Event>
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = -4117126419866788951L; private static final long serialVersionUID = -4117126419866788951L;
@ -93,6 +93,14 @@ public class ChangePasswordPanel extends Window implements EventListener<Event>
protected Textbox txtRetypeNewPassword; protected Textbox txtRetypeNewPassword;
protected Textbox txtAnswer; protected Textbox txtAnswer;
/**
* @param ctx
* @param loginWindow
* @param userName
* @param userPassword
* @param show
* @param clientsKNPairs
*/
public ChangePasswordPanel(Properties ctx, LoginWindow loginWindow, String userName, String userPassword, boolean show, KeyNamePair[] clientsKNPairs) public ChangePasswordPanel(Properties ctx, LoginWindow loginWindow, String userName, String userPassword, boolean show, KeyNamePair[] clientsKNPairs)
{ {
this.wndLogin = loginWindow; this.wndLogin = loginWindow;
@ -113,6 +121,9 @@ public class ChangePasswordPanel extends Window implements EventListener<Event>
createUI(); createUI();
} }
/**
* Layout dialog
*/
protected void createUI() { protected void createUI() {
Div div = new Div(); Div div = new Div();
div.setSclass(ITheme.LOGIN_BOX_HEADER_CLASS); div.setSclass(ITheme.LOGIN_BOX_HEADER_CLASS);
@ -211,6 +222,9 @@ public class ChangePasswordPanel extends Window implements EventListener<Event>
this.appendChild(div); this.appendChild(div);
} }
/**
* Create components
*/
private void initComponents() private void initComponents()
{ {
lblOldPassword = new Label(); lblOldPassword = new Label();
@ -265,11 +279,11 @@ public class ChangePasswordPanel extends Window implements EventListener<Event>
txtAnswer = new Textbox(); txtAnswer = new Textbox();
txtAnswer.setId("txtAnswer"); txtAnswer.setId("txtAnswer");
// txtAnswer.setType("password");
txtAnswer.setCols(25); txtAnswer.setCols(25);
ZKUpdateUtil.setWidth(txtAnswer, "220px"); ZKUpdateUtil.setWidth(txtAnswer, "220px");
} }
@Override
public void onEvent(Event event) public void onEvent(Event event)
{ {
if (event.getTarget().getId().equals(ConfirmPanel.A_OK)) if (event.getTarget().getId().equals(ConfirmPanel.A_OK))
@ -279,7 +293,6 @@ public class ChangePasswordPanel extends Window implements EventListener<Event>
else if (event.getTarget().getId().equals(ConfirmPanel.A_CANCEL)) else if (event.getTarget().getId().equals(ConfirmPanel.A_CANCEL))
{ {
SessionManager.logoutSession(); SessionManager.logoutSession();
//wndLogin.loginCancelled();
} }
else if (event.getTarget() == txtNewPassword) { else if (event.getTarget() == txtNewPassword) {
MPasswordRule pwdrule = MPasswordRule.getRules(Env.getCtx(), null); MPasswordRule pwdrule = MPasswordRule.getRules(Env.getCtx(), null);
@ -298,6 +311,9 @@ public class ChangePasswordPanel extends Window implements EventListener<Event>
} }
} }
/**
* Validate new password
*/
public void validateChangePassword() public void validateChangePassword()
{ {
Clients.clearBusy(); Clients.clearBusy();

View File

@ -25,10 +25,11 @@ import org.adempiere.webui.component.Panel;
* @date Mar 2, 2007 * @date Mar 2, 2007
* @version $Revision: 0.10 $ * @version $Revision: 0.10 $
*/ */
@Deprecated(forRemoval = true, since = "11")
public class ChatPanel extends Panel public class ChatPanel extends Panel
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = 3581014332386266757L; private static final long serialVersionUID = 3581014332386266757L;

View File

@ -25,10 +25,11 @@ import org.adempiere.webui.component.Panel;
* @date Mar 2, 2007 * @date Mar 2, 2007
* @version $Revision: 0.10 $ * @version $Revision: 0.10 $
*/ */
@Deprecated(forRemoval = true, since = "11")
public class ConfigurationPanel extends Panel public class ConfigurationPanel extends Panel
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = 7604294587769974845L; private static final long serialVersionUID = 7604294587769974845L;

View File

@ -1,11 +1,32 @@
/***********************************************************************
* This file is part of iDempiere ERP Open Source *
* http://www.idempiere.org *
* *
* Copyright (C) Contributors *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* 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., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301, USA. *
* *
**********************************************************************/
package org.adempiere.webui.panel; package org.adempiere.webui.panel;
@org.idempiere.ui.zk.annotation.Form @org.idempiere.ui.zk.annotation.Form
public class CustomForm extends ADForm public class CustomForm extends ADForm
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = -8498084996736578534L; private static final long serialVersionUID = -8498084996736578534L;

View File

@ -70,25 +70,24 @@ import org.zkoss.zul.Separator;
import org.zkoss.zul.South; import org.zkoss.zul.South;
/** /**
* * Dialog to customize grid view (selected columns, column width, etc)
* @author hengsin * @author hengsin
* *
*/ */
public class CustomizeGridViewPanel extends Panel public class CustomizeGridViewPanel extends Panel
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = -6200912526954948898L; private static final long serialVersionUID = -6200912526954948898L;
/** AD_Field_ID:Width */
private Map<Integer, String> m_columnsWidth; private Map<Integer, String> m_columnsWidth;
ArrayList<Integer> tableSeqs; protected ArrayList<Integer> tableSeqs;
GridView gridPanel = null; protected GridView gridPanel = null;
MTabCustomization m_tabcust; protected MTabCustomization m_tabcust;
/** /**
* Sort Tab Constructor
*
* @param WindowNo Window No * @param WindowNo Window No
* @param AD_Tab_ID * @param AD_Tab_ID
* @param AD_User_ID * @param AD_User_ID
@ -140,8 +139,8 @@ public class CustomizeGridViewPanel extends Panel
/* SysConfig USE_ESC_FOR_TAB_CLOSING */ /* SysConfig USE_ESC_FOR_TAB_CLOSING */
private boolean isUseEscForTabClosing = MSysConfig.getBooleanValue(MSysConfig.USE_ESC_FOR_TAB_CLOSING, false, Env.getAD_Client_ID(Env.getCtx())); private boolean isUseEscForTabClosing = MSysConfig.getBooleanValue(MSysConfig.USE_ESC_FOR_TAB_CLOSING, false, Env.getAD_Client_ID(Env.getCtx()));
/** /**
* Static Layout * Layout dialog
* *
* @throws Exception * @throws Exception
*/ */
@ -343,6 +342,9 @@ public class CustomizeGridViewPanel extends Panel
getParent().detach(); getParent().detach();
} }
/**
* Load customization data
*/
public void loadData() public void loadData()
{ {
m_tabcust = MTabCustomization.get(Env.getCtx(), m_AD_User_ID, m_AD_Tab_ID, null); m_tabcust = MTabCustomization.get(Env.getCtx(), m_AD_User_ID, m_AD_Tab_ID, null);
@ -434,7 +436,7 @@ public class CustomizeGridViewPanel extends Panel
/** /**
* @param event * @param event
*/ */
void migrateValueAcrossLists (Event event) protected void migrateValueAcrossLists (Event event)
{ {
Object source = event.getTarget(); Object source = event.getTarget();
if (source instanceof ListItem) { if (source instanceof ListItem) {
@ -450,7 +452,13 @@ public class CustomizeGridViewPanel extends Panel
migrateLists (listFrom,listTo,endIndex); migrateLists (listFrom,listTo,endIndex);
} }
void migrateLists (Listbox listFrom , Listbox listTo , int endIndex ) /**
* Move selected items from listFrom to listTo
* @param listFrom
* @param listTo
* @param endIndex
*/
protected void migrateLists (Listbox listFrom , Listbox listTo , int endIndex )
{ {
int index = 0; int index = 0;
SimpleListModel lmFrom = (SimpleListModel) listFrom.getModel(); SimpleListModel lmFrom = (SimpleListModel) listFrom.getModel();
@ -477,10 +485,10 @@ public class CustomizeGridViewPanel extends Panel
} }
/** /**
* Move within Yes List with Drag Event and Multiple Choice * Move selected items within Yes List
* @param event event * @param event event
*/ */
void migrateValueWithinYesList (int endIndex, List<ListElement> selObjects) protected void migrateValueWithinYesList (int endIndex, List<ListElement> selObjects)
{ {
int iniIndex =0; int iniIndex =0;
Arrays.sort(selObjects.toArray()); Arrays.sort(selObjects.toArray());
@ -495,10 +503,10 @@ public class CustomizeGridViewPanel extends Panel
} }
/** /**
* Move within Yes List * Move selected items within Yes List
* @param event event * @param event event
*/ */
void migrateValueWithinYesList (Event event) protected void migrateValueWithinYesList (Event event)
{ {
Object[] selObjects = yesList.getSelectedItems().toArray(); Object[] selObjects = yesList.getSelectedItems().toArray();
@ -560,8 +568,12 @@ public class CustomizeGridViewPanel extends Panel
} }
} // migrateValueWithinYesList } // migrateValueWithinYesList
/**
* Save changes
*/
public void saveData() public void saveData()
{ {
if (log.isLoggable(Level.FINE))
log.fine(""); log.fine("");
// yesList // yesList
//int index = 0; //int index = 0;
@ -678,6 +690,7 @@ public class CustomizeGridViewPanel extends Panel
return s; return s;
} }
} }
/** /**
* @author eslatis * @author eslatis
* *
@ -686,7 +699,7 @@ public class CustomizeGridViewPanel extends Panel
{ {
/** /**
* Creates a ADSortTab.DragListener. * Constructor
*/ */
public DragListener() public DragListener()
{ {
@ -727,10 +740,16 @@ public class CustomizeGridViewPanel extends Panel
} }
} }
/**
* @param b
*/
public void activate(boolean b) { public void activate(boolean b) {
if (b && !uiCreated) createUI(); if (b && !uiCreated) createUI();
} }
/**
* Layout dialog
*/
public void createUI() { public void createUI() {
if (uiCreated) return; if (uiCreated) return;
try try
@ -745,14 +764,23 @@ public class CustomizeGridViewPanel extends Panel
uiCreated = true; uiCreated = true;
} }
/**
* Load data
*/
public void query() { public void query() {
loadData(); loadData();
} }
/**
* @return true if changes have been saved
*/
public boolean isSaved() { public boolean isSaved() {
return m_saved; return m_saved;
} }
/**
* @param gridPanel
*/
public void setGridPanel(GridView gridPanel){ public void setGridPanel(GridView gridPanel){
this.gridPanel = gridPanel; this.gridPanel = gridPanel;
} }

View File

@ -29,7 +29,7 @@ import org.zkoss.zul.Separator;
* @date Mar 3, 2007 * @date Mar 3, 2007
* @version $Revision: 0.10 $ * @version $Revision: 0.10 $
*/ */
@Deprecated(forRemoval = true, since = "11")
public class FooterPanel extends Window public class FooterPanel extends Window
{ {
/** /**

View File

@ -45,7 +45,7 @@ import org.zkoss.zul.Popup;
import org.zkoss.zul.impl.LabelImageElement; import org.zkoss.zul.impl.LabelImageElement;
/** /**
* * Header panel of desktop
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a> * @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @author <a href="mailto:hengsin@gmail.com">Low Heng Sin</a> * @author <a href="mailto:hengsin@gmail.com">Low Heng Sin</a>
* @date Mar 2, 2007 * @date Mar 2, 2007
@ -55,14 +55,21 @@ import org.zkoss.zul.impl.LabelImageElement;
public class HeaderPanel extends Panel implements EventListener<Event> public class HeaderPanel extends Panel implements EventListener<Event>
{ {
/**
* generated serial id
*/
private static final long serialVersionUID = -2351317624519209484L; private static final long serialVersionUID = -2351317624519209484L;
/** Logo */
protected Image image; protected Image image;
protected LabelImageElement btnMenu; protected LabelImageElement btnMenu;
protected Popup popMenu; protected Popup popMenu;
private MenuTreePanel menuTreePanel; private MenuTreePanel menuTreePanel;
/**
* Default constructor
*/
public HeaderPanel() public HeaderPanel()
{ {
super(); super();
@ -70,6 +77,9 @@ public class HeaderPanel extends Panel implements EventListener<Event>
addEventListener(ZoomEvent.EVENT_NAME, this); addEventListener(ZoomEvent.EVENT_NAME, this);
} }
/**
* Layout panel
*/
protected void onCreate() protected void onCreate()
{ {
image = (Image) getFellow("logo"); image = (Image) getFellow("logo");
@ -92,6 +102,9 @@ public class HeaderPanel extends Panel implements EventListener<Event>
SessionManager.getSessionApplication().getKeylistener().addEventListener(Events.ON_CTRL_KEY, this); SessionManager.getSessionApplication().getKeylistener().addEventListener(Events.ON_CTRL_KEY, this);
} }
/**
* Create pop up menu tree
*/
protected void createPopupMenu() { protected void createPopupMenu() {
popMenu = new Popup(); popMenu = new Popup();
popMenu.setId("menuTreePopup"); popMenu.setId("menuTreePopup");
@ -107,6 +120,9 @@ public class HeaderPanel extends Panel implements EventListener<Event>
popMenu.setAttribute(popMenu.getUuid(), System.currentTimeMillis()); popMenu.setAttribute(popMenu.getUuid(), System.currentTimeMillis());
} }
/**
* Create global search box
*/
protected void createSearchPanel() { protected void createSearchPanel() {
GlobalSearch globalSearch = new GlobalSearch(new MenuSearchController(menuTreePanel.getMenuTree())); GlobalSearch globalSearch = new GlobalSearch(new MenuSearchController(menuTreePanel.getMenuTree()));
Component stub = getFellow("menuLookup"); Component stub = getFellow("menuLookup");
@ -115,6 +131,7 @@ public class HeaderPanel extends Panel implements EventListener<Event>
globalSearch.setId("menuLookup"); globalSearch.setId("menuLookup");
} }
@Override
public void onEvent(Event event) throws Exception { public void onEvent(Event event) throws Exception {
if (Events.ON_CLICK.equals(event.getName())) { if (Events.ON_CLICK.equals(event.getName())) {
if(event.getTarget() == image) if(event.getTarget() == image)
@ -174,16 +191,25 @@ public class HeaderPanel extends Panel implements EventListener<Event>
popMenu.setPage(null); popMenu.setPage(null);
} }
/**
* @return logo image
*/
public Image getLogo() { public Image getLogo() {
return image; return image;
} }
/**
* Close popup for global search
*/
public void closeSearchPopup() { public void closeSearchPopup() {
Component c = getFellow("menuLookup"); Component c = getFellow("menuLookup");
if (c != null && c instanceof GlobalSearch) if (c != null && c instanceof GlobalSearch)
((GlobalSearch)c).closePopup(); ((GlobalSearch)c).closePopup();
} }
/**
* Handle onClientInfo event
*/
protected void onClientInfo() { protected void onClientInfo() {
ZKUpdateUtil.setWindowWidthX(popMenu, 600); ZKUpdateUtil.setWindowWidthX(popMenu, 600);
Component c = getFellow("menuLookup"); Component c = getFellow("menuLookup");

View File

@ -71,6 +71,9 @@ public class HelpController
private Panel pnlToolTip, pnlContextHelp, pnlQuickInfo; private Panel pnlToolTip, pnlContextHelp, pnlQuickInfo;
private Html htmlToolTip, htmlContextHelp, htmlQuickInfo; private Html htmlToolTip, htmlContextHelp, htmlQuickInfo;
/**
* Default constructor
*/
public HelpController() public HelpController()
{ {
dashboardLayout = new Anchorlayout(); dashboardLayout = new Anchorlayout();
@ -79,6 +82,11 @@ public class HelpController
ZKUpdateUtil.setHflex(dashboardLayout, "1"); ZKUpdateUtil.setHflex(dashboardLayout, "1");
} }
/**
* Render tooltips, context help and quick info.
* @param parent
* @param desktopImpl
*/
public void render(Component parent, IDesktop desktopImpl) public void render(Component parent, IDesktop desktopImpl)
{ {
Style style = new Style(); Style style = new Style();
@ -160,6 +168,9 @@ public class HelpController
renderQuickInfo(null); renderQuickInfo(null);
} }
/**
* Setup client side script for field tooltip
*/
public void setupFieldTooltip() { public void setupFieldTooltip() {
Clients.response("helpControllerFieldTooltip", Clients.response("helpControllerFieldTooltip",
new AuScript(htmlToolTip, "(function(){let w=zk.Widget.$('#"+htmlToolTip.getUuid() new AuScript(htmlToolTip, "(function(){let w=zk.Widget.$('#"+htmlToolTip.getUuid()
@ -167,7 +178,7 @@ public class HelpController
} }
/** /**
* Make tooltip content for a field * Render tooltip content for a field
* @param field * @param field
*/ */
public void renderToolTip(GridField field) public void renderToolTip(GridField field)
@ -198,7 +209,7 @@ public class HelpController
} }
/** /**
* Make tooltip content, when hdr == null, show otherContent * Render tooltip content, when hdr == null, show otherContent
* @param hdr * @param hdr
* @param desc * @param desc
* @param help * @param help
@ -244,6 +255,11 @@ public class HelpController
htmlToolTip.setContent(sb.toString()); htmlToolTip.setContent(sb.toString());
} }
/**
* Render context help (AD_CtxHelpMsg)
* @param ctxType
* @param recordId
*/
public void renderCtxHelp(String ctxType, int recordId) public void renderCtxHelp(String ctxType, int recordId)
{ {
if (ctxType != X_AD_CtxHelp.CTXTYPE_Home && ctxType != X_AD_CtxHelp.CTXTYPE_Tab && if (ctxType != X_AD_CtxHelp.CTXTYPE_Home && ctxType != X_AD_CtxHelp.CTXTYPE_Tab &&
@ -653,6 +669,12 @@ public class HelpController
htmlContextHelp.setContent(sb.toString()); htmlContextHelp.setContent(sb.toString());
} }
/**
* Add context help suggestion popup menu
* @param po
* @param baseContent
* @param translatedContent
*/
private void addContextHelpMenupopup(PO po, StringBuilder baseContent, StringBuilder translatedContent) { private void addContextHelpMenupopup(PO po, StringBuilder baseContent, StringBuilder translatedContent) {
if (!MRole.getDefault().isTableAccessExcluded(MCtxHelpSuggestion.Table_ID)) { if (!MRole.getDefault().isTableAccessExcluded(MCtxHelpSuggestion.Table_ID)) {
ContextHelpMenupopup popup = new ContextHelpMenupopup(po, baseContent.toString(), translatedContent.toString()); ContextHelpMenupopup popup = new ContextHelpMenupopup(po, baseContent.toString(), translatedContent.toString());
@ -662,6 +684,10 @@ public class HelpController
} }
} }
/**
* Render quick info (AD_StatusLine)
* @param obj
*/
public void renderQuickInfo(Object obj) { public void renderQuickInfo(Object obj) {
if (obj == null) { if (obj == null) {
pnlQuickInfo.setVisible(false); pnlQuickInfo.setVisible(false);
@ -691,6 +717,11 @@ public class HelpController
} }
} }
/**
* @param htmlString
* @param all
* @return text after strip of html tag
*/
private String stripHtml(String htmlString, boolean all) private String stripHtml(String htmlString, boolean all)
{ {
htmlString = htmlString htmlString = htmlString
@ -708,6 +739,11 @@ public class HelpController
return htmlString; return htmlString;
} }
/**
* @param ctxType
* @param recordId
* @return MCtxHelpMsg
*/
private MCtxHelpMsg getCtxHelpMsg(String ctxType, int recordId) private MCtxHelpMsg getCtxHelpMsg(String ctxType, int recordId)
{ {
MCtxHelpMsg retValue = MCtxHelpMsg.get(ctxType, recordId); MCtxHelpMsg retValue = MCtxHelpMsg.get(ctxType, recordId);
@ -716,7 +752,7 @@ public class HelpController
/** /**
* @param content content * @param content content
* @return masked content or empty string if the <code>content</code> is null * @return masked content or empty string if <code>content</code> is null
*/ */
public static String escapeJavascriptContent(String content) public static String escapeJavascriptContent(String content)
{ {

View File

@ -1,3 +1,27 @@
/***********************************************************************
* This file is part of iDempiere ERP Open Source *
* http://www.idempiere.org *
* *
* Copyright (C) Contributors *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* 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., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301, USA. *
* *
* Contributors: *
* - hengsin *
**********************************************************************/
package org.adempiere.webui.panel; package org.adempiere.webui.panel;

View File

@ -15,7 +15,8 @@
package org.adempiere.webui.panel; package org.adempiere.webui.panel;
/** /**
* * Marker interface for component that wants to handle the update of context help by listening to the <br/>
* WindowContainer.ON_WINDOW_CONTAINER_SELECTION_CHANGED_EVENT event.
* @author Elaine * @author Elaine
* *
*/ */

View File

@ -16,12 +16,15 @@ package org.adempiere.webui.panel;
import org.adempiere.webui.component.Tabpanel; import org.adempiere.webui.component.Tabpanel;
/** /**
* * Interface to handle the closing of a Tab.
* @author hengsin * @author hengsin
* *
*/ */
public interface ITabOnCloseHandler { public interface ITabOnCloseHandler {
/* NOTE onClose method must implement the actual closing of the tab */ /**
* NOTE onClose method must implement the actual closing of the tab
* @param tabPanel
*/
public void onClose(Tabpanel tabPanel); public void onClose(Tabpanel tabPanel);
} }

View File

@ -41,15 +41,14 @@ import org.zkoss.zul.South;
import org.zkoss.zul.Div; import org.zkoss.zul.Div;
/** /**
* Display Product Attribute Instance Info * Display Product Attribute Set Instance Info
* This class is based on org.compiere.apps.search.PAttributeInstance written by Jorg Janke
* @author Elaine * @author Elaine
* *
*/ */
public class InfoPAttributeInstancePanel extends Window implements EventListener<Event>, WTableModelListener public class InfoPAttributeInstancePanel extends Window implements EventListener<Event>, WTableModelListener
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = -2883260173499157121L; private static final long serialVersionUID = -2883260173499157121L;
@ -87,6 +86,7 @@ public class InfoPAttributeInstancePanel extends Window implements EventListener
*/ */
private void init (int M_Warehouse_ID, int M_Locator_ID, int M_Product_ID, int C_BPartner_ID) private void init (int M_Warehouse_ID, int M_Locator_ID, int M_Product_ID, int C_BPartner_ID)
{ {
if (log.isLoggable(Level.INFO))
log.info("M_Warehouse_ID=" + M_Warehouse_ID log.info("M_Warehouse_ID=" + M_Warehouse_ID
+ ", M_Locator_ID=" + M_Locator_ID + ", M_Locator_ID=" + M_Locator_ID
+ ", M_Product_ID=" + M_Product_ID); + ", M_Product_ID=" + M_Product_ID);
@ -120,7 +120,7 @@ public class InfoPAttributeInstancePanel extends Window implements EventListener
private static final CLogger log = CLogger.getCLogger(InfoPAttributeInstancePanel.class); private static final CLogger log = CLogger.getCLogger(InfoPAttributeInstancePanel.class);
/** /**
* Static Init * layout window
* @throws Exception * @throws Exception
*/ */
private void jbInit() throws Exception private void jbInit() throws Exception
@ -156,7 +156,7 @@ public class InfoPAttributeInstancePanel extends Window implements EventListener
confirmPanel.addActionListener(this); confirmPanel.addActionListener(this);
} // jbInit } // jbInit
/** Table Column Layout Info */ /** Column Layout Info */
private static ColumnInfo[] s_layout = new ColumnInfo[] private static ColumnInfo[] s_layout = new ColumnInfo[]
{ {
new ColumnInfo(" ", "s.M_AttributeSetInstance_ID", IDColumn.class), new ColumnInfo(" ", "s.M_AttributeSetInstance_ID", IDColumn.class),
@ -249,7 +249,7 @@ public class InfoPAttributeInstancePanel extends Window implements EventListener
} // dynInit } // dynInit
/** /**
* Refresh Query * Execute Query
*/ */
private void refresh() private void refresh()
{ {
@ -288,9 +288,10 @@ public class InfoPAttributeInstancePanel extends Window implements EventListener
} // refresh } // refresh
/** /**
* Action Listener * Handle events
* @param e event * @param e event
*/ */
@Override
public void onEvent(Event e) throws Exception public void onEvent(Event e) throws Exception
{ {
if (e.getTarget().getId().equals(ConfirmPanel.A_OK)) if (e.getTarget().getId().equals(ConfirmPanel.A_OK))
@ -315,6 +316,7 @@ public class InfoPAttributeInstancePanel extends Window implements EventListener
* Table selection changed * Table selection changed
* @param e event * @param e event
*/ */
@Override
public void tableChanged(WTableModelEvent e) public void tableChanged(WTableModelEvent e)
{ {
enableButtons(); enableButtons();

View File

@ -54,18 +54,17 @@ import org.zkoss.zul.Vbox;
/** /**
* Search by Product Attribute. * Search by Product Attribute.
* This class is based on org.compiere.apps.search.InfoPAttribute written by Jorg Janke
* @author Elaine * @author Elaine
* *
*/ */
public class InfoPAttributePanel extends Window implements EventListener<Event> public class InfoPAttributePanel extends Window implements EventListener<Event>
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = -4922961793415942591L; private static final long serialVersionUID = -4922961793415942591L;
/* the attribute set selected on the InfoProduct window */ /** the attribute set selected on the InfoProduct window */
private int p_M_AttributeSet_ID = 0; private int p_M_AttributeSet_ID = 0;
/** /**
@ -106,7 +105,7 @@ public class InfoPAttributePanel extends Window implements EventListener<Event>
/** Resulting Query */ /** Resulting Query */
private String m_query = ""; private String m_query = "";
/** Product Attribure Editors */ /** Product Attribute Editors */
private ArrayList<Component> m_productEditors = new ArrayList<Component>(); private ArrayList<Component> m_productEditors = new ArrayList<Component>();
private ArrayList<Component> m_productEditorsTo = new ArrayList<Component>(); private ArrayList<Component> m_productEditorsTo = new ArrayList<Component>();
/** Instance Attribute Editors */ /** Instance Attribute Editors */
@ -129,7 +128,7 @@ public class InfoPAttributePanel extends Window implements EventListener<Event>
// //
/** /**
* Static Init * Layout dialog
* @throws Exception * @throws Exception
*/ */
private void jbInit() throws Exception private void jbInit() throws Exception
@ -386,7 +385,7 @@ public class InfoPAttributePanel extends Window implements EventListener<Event>
/** /**
* Get Attribute List * Get Attribute List
* @param M_Attribute_ID attribure * @param M_Attribute_ID attribure
* @return array * @return [M_AttributeValue_ID:Name]
*/ */
private KeyNamePair[] getAttributeList(int M_Attribute_ID) private KeyNamePair[] getAttributeList(int M_Attribute_ID)
{ {
@ -471,9 +470,10 @@ public class InfoPAttributePanel extends Window implements EventListener<Event>
/** /**
* Action Listener * Handle event
* @param e event * @param e event
*/ */
@Override
public void onEvent(Event e) throws Exception public void onEvent(Event e) throws Exception
{ {
if (e.getTarget().getId().equals(ConfirmPanel.A_OK)) if (e.getTarget().getId().equals(ConfirmPanel.A_OK))
@ -486,16 +486,16 @@ public class InfoPAttributePanel extends Window implements EventListener<Event>
m_query = null; m_query = null;
dispose(); dispose();
} }
} // actionPerformed }
/** /**
* Create Query * Create Query
* <code> * <p>
* Available synonyms: * Available synonyms:
* M_Product p * <ul>M_Product p</ul>
* M_ProductPrice pr * <ul>M_ProductPrice pr</ul>
* M_AttributeSet pa * <ul>M_AttributeSet pa</ul>
* </code> * </p>
* @return query * @return query
*/ */
private String createQuery() private String createQuery()
@ -698,12 +698,13 @@ public class InfoPAttributePanel extends Window implements EventListener<Event>
m_query = null; m_query = null;
if (sb.length() > 0) if (sb.length() > 0)
m_query = sb.toString(); m_query = sb.toString();
if (log.isLoggable(Level.CONFIG))
log.config(m_query); log.config(m_query);
return m_query; return m_query;
} // createQuery } // createQuery
/** /**
* Get resulting Query WHERE * Get where clause
* @return query or null * @return query or null
*/ */
public String getWhereClause() public String getWhereClause()

View File

@ -122,21 +122,18 @@ import org.zkoss.zul.event.ZulEvents;
import org.zkoss.zul.ext.Sortable; import org.zkoss.zul.ext.Sortable;
/** /**
* Search Information and return selection - Base Class. * Search dialog that works in two mode. <br/>
* Based on Info written by Jorg Janke * Lookup mode: Search and return selection to lookup field. <br/>
* Window mode: Search and view search results. Optional support for execution of process.
* *
* @author Sendy Yagambrum * @author Sendy Yagambrum
*
* Zk Port
* @author Elaine * @author Elaine
* @version Info.java Adempiere Swing UI 3.4.1
*
* @contributor red1 IDEMPIERE-1711 with final review by HengSin * @contributor red1 IDEMPIERE-1711 with final review by HengSin
*/ */
public abstract class InfoPanel extends Window implements EventListener<Event>, WTableModelListener, Sortable<Object>, IHelpContext public abstract class InfoPanel extends Window implements EventListener<Event>, WTableModelListener, Sortable<Object>, IHelpContext
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = 8253708190979803268L; private static final long serialVersionUID = 8253708190979803268L;
@ -149,6 +146,7 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
private final static int DEFAULT_PAGE_SIZE = 100; private final static int DEFAULT_PAGE_SIZE = 100;
private final static int DEFAULT_PAGE_PRELOAD = 4; private final static int DEFAULT_PAGE_PRELOAD = 4;
protected List<Button> btProcessList = new ArrayList<Button>(); protected List<Button> btProcessList = new ArrayList<Button>();
/** Column:WEditor */
protected Map<String, WEditor> editorMap = new HashMap<String, WEditor>(); protected Map<String, WEditor> editorMap = new HashMap<String, WEditor>();
protected final static String PROCESS_ID_KEY = "processId"; protected final static String PROCESS_ID_KEY = "processId";
protected final static String ON_RUN_PROCESS = "onRunProcess"; protected final static String ON_RUN_PROCESS = "onRunProcess";
@ -156,6 +154,7 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
// attribute key of info process // attribute key of info process
protected final static String ATT_INFO_PROCESS_KEY = "INFO_PROCESS"; protected final static String ATT_INFO_PROCESS_KEY = "INFO_PROCESS";
protected int pageSize; protected int pageSize;
/** KeyNamePair/ValueNamePair:[Column:Value] */
public LinkedHashMap<NamePair,LinkedHashMap<String, Object>> m_values = null; public LinkedHashMap<NamePair,LinkedHashMap<String, Object>> m_values = null;
protected InfoRelatedVO[] relatedInfoList; protected InfoRelatedVO[] relatedInfoList;
// for test disable load all record when num of record < 1000 // for test disable load all record when num of record < 1000
@ -165,8 +164,8 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
// max end index is integer.max_value - 1, not integer.max_value. // max end index is integer.max_value - 1, not integer.max_value.
protected int extra_max_row = 1; protected int extra_max_row = 1;
/** /**
* MInfoColumn has isKey = true, play as key column in case non column has * MInfoColumn with isKey = true. In case no column has
* isKey = true, this column is null and we use {@link #p_keyColumn} * isKey = true, keyColumnOfView will be null and we use {@link #p_keyColumn}
*/ */
protected MInfoColumn keyColumnOfView = null; protected MInfoColumn keyColumnOfView = null;
@ -179,22 +178,22 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
protected boolean hasRightQuickEntry = true; protected boolean hasRightQuickEntry = true;
protected boolean isHasNextPage = false; protected boolean isHasNextPage = false;
/** /**
* store selected record info * Value of Key Column:Values of Row.<br/>
* key of map is value of column play as keyView * Store selected rows.<br/>
* in case has no key column of view, use value of {@link #p_keyColumn} * If there's no key column of view, use value of {@link #p_keyColumn}.<br/>
* zk6.x listview don't provide event when click to checkbox select all, * Zk6.x listview deosn't send event when user click header checkbox to select all rows,
* so we can't manage selectedRecord time by time. * so we can't manage selectedRecord all the time. <br/>
* each time change page we will update this list with current * Each time change page, we will update this list with current selected records of current page <br/>
* selected record of this page by call function * by calling function {@link #updateListSelected()}.
* {@link #updateListSelected()} when move to zk7, just enough handle * When move to zk7, enough to just handle onclick only. <br/>
* onclick. because don't direct use recordSelectedData, call * Because of the issue above, don't use recordSelectedData directly, call
* {@link #getSelectedRowInfo()} * {@link #getSelectedRowInfo()} instead.
*/ */
protected Map<Object, List<Object>> recordSelectedData = new HashMap<Object, List<Object>>(); protected Map<Object, List<Object>> recordSelectedData = new HashMap<Object, List<Object>>();
/** /**
* when requery but don't clear selected record (example after run process) * When re-query but don't want to clear selected record (example after run process),
* set flag to true to run sync selected record, also * set this flag to true to run sync selected record. See also
* {@link #syncSelectedAfterRequery()} * {@link #syncSelectedAfterRequery()}
*/ */
protected boolean isRequeryByRunSuccessProcess = false; protected boolean isRequeryByRunSuccessProcess = false;
@ -217,7 +216,7 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
} }
/** /**
* Show panel based on tablename (non modal) * Show panel based on tablename (non modal and not lookup)
* @param tableName * @param tableName
*/ */
public static void showPanel (String tableName) public static void showPanel (String tableName)
@ -230,20 +229,23 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
/** Window Width */ /** Window Width */
static final int INFO_WIDTH = 800; static final int INFO_WIDTH = 800;
/** true for lookup mode */
protected boolean m_lookup; protected boolean m_lookup;
/** AD_InfoWindow_ID */
protected int m_infoWindowID; protected int m_infoWindowID;
private boolean m_closeAfterExecutionOfProcess = false; private boolean m_closeAfterExecutionOfProcess = false;
private Button btnSelectAll; private Button btnSelectAll;
private Button btnDeSelectAll; private Button btnDeSelectAll;
/** true if {@link #p_WindowNo} is not from caller/parent window */
private boolean registerWindowNo = false; private boolean registerWindowNo = false;
/************************************************** /**
* Detail Constructor
* @param WindowNo WindowNo * @param WindowNo WindowNo
* @param tableName tableName * @param tableName tableName
* @param keyColumn keyColumn * @param keyColumn keyColumn
* @param multipleSelection
* @param whereClause whereClause * @param whereClause whereClause
*/ */
protected InfoPanel (int WindowNo, protected InfoPanel (int WindowNo,
@ -270,7 +272,6 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
} }
/** /**
*
* @param WindowNo * @param WindowNo
* @param tableName * @param tableName
* @param keyColumn * @param keyColumn
@ -287,12 +288,14 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
whereClause, lookup, ADInfoWindowID, null); whereClause, lookup, ADInfoWindowID, null);
} }
/************************************************** /**
* Detail Constructor
* @param WindowNo WindowNo * @param WindowNo WindowNo
* @param tableName tableName * @param tableName tableName
* @param keyColumn keyColumn * @param keyColumn keyColumn
* @param multipleSelection
* @param whereClause whereClause * @param whereClause whereClause
* @param lookup
* @param ADInfoWindowID
* @param queryValue * @param queryValue
*/ */
protected InfoPanel (int WindowNo, protected InfoPanel (int WindowNo,
@ -397,6 +400,9 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
useQueryTimeoutFromSysConfig = false; useQueryTimeoutFromSysConfig = false;
} }
/**
* Layout window
*/
private void init() private void init()
{ {
if (isLookup()) if (isLookup())
@ -448,7 +454,6 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
} }
} }
// Elaine 2008/12/16
confirmPanel.getButton(ConfirmPanel.A_CUSTOMIZE).setVisible(hasCustomize()); confirmPanel.getButton(ConfirmPanel.A_CUSTOMIZE).setVisible(hasCustomize());
confirmPanel.getButton(ConfirmPanel.A_HISTORY).setVisible(hasHistory()); confirmPanel.getButton(ConfirmPanel.A_HISTORY).setVisible(hasHistory());
confirmPanel.getButton(ConfirmPanel.A_ZOOM).setVisible(hasZoom()); confirmPanel.getButton(ConfirmPanel.A_ZOOM).setVisible(hasZoom());
@ -472,8 +477,9 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
this.setSclass("info-panel"); this.setSclass("info-panel");
} // init } // init
protected ConfirmPanel confirmPanel; protected ConfirmPanel confirmPanel;
/** Master (owning) Window */ /** Lookup mode: parent window number. Non lookup mode: register desktop tab number for this window */
protected int p_WindowNo; protected int p_WindowNo;
/** Table Name */ /** Table Name */
protected String p_tableName; protected String p_tableName;
@ -493,8 +499,9 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
/** Result IDs */ /** Result IDs */
private ArrayList<Object> m_results = new ArrayList<Object>(3); private ArrayList<Object> m_results = new ArrayList<Object>(3);
/** Model of {@link #contentPanel} */
private ListModelTable model; private ListModelTable model;
/** Layout of Grid */ /** Layout of {@link #contentPanel} */
protected ColumnInfo[] p_layout; protected ColumnInfo[] p_layout;
/** Main SQL Statement */ /** Main SQL Statement */
protected String m_sqlMain; protected String m_sqlMain;
@ -503,8 +510,9 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
/** Order By Clause */ /** Order By Clause */
protected String m_sqlOrder; protected String m_sqlOrder;
private String m_sqlUserOrder; private String m_sqlUserOrder;
/* sql column of infocolumn (can be alias) */
protected int indexOrderColumn = -1; protected int indexOrderColumn = -1;
/** sql column name of infocolumn (can be alias) */
protected String sqlOrderColumn; protected String sqlOrderColumn;
protected Boolean isColumnSortAscending = null; protected Boolean isColumnSortAscending = null;
/**ValueChange listeners */ /**ValueChange listeners */
@ -533,26 +541,28 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
protected GridField m_gridfield; protected GridField m_gridfield;
/** /**
* false, use saved where clause * If false, use saved where clause.
* IDEMPIERE-1979 * IDEMPIERE-1979
*/ */
protected boolean isQueryByUser = false; protected boolean isQueryByUser = false;
/** true for auto complete call from lookup field */
protected boolean isAutoComplete = false; protected boolean isAutoComplete = false;
protected int queryTimeout = 0; protected int queryTimeout = 0;
protected boolean useQueryTimeoutFromSysConfig = true; protected boolean useQueryTimeoutFromSysConfig = true;
/** column name for auto complete call */
protected String autoCompleteSearchColumn = null; protected String autoCompleteSearchColumn = null;
protected String queryValue; protected String queryValue;
/** /**
* save where clause of prev requery * saved where clause of previous query
*/ */
protected String prevWhereClause = null; protected String prevWhereClause = null;
/** /**
* save value of parameter to set info query paramenter * saved value of previous query parameters
*/ */
protected List<Object> prevParameterValues = null; protected List<Object> prevParameterValues = null;
protected List<String> prevQueryOperators = null; protected List<String> prevQueryOperators = null;
@ -560,7 +570,7 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
private static final String[] lISTENER_EVENTS = {}; private static final String[] lISTENER_EVENTS = {};
/** /**
* All info process of this infoWindow * Info processes of this infoWindow
*/ */
protected MInfoProcess [] infoProcessList; protected MInfoProcess [] infoProcessList;
/** /**
@ -568,46 +578,45 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
*/ */
protected boolean haveProcess = false; protected boolean haveProcess = false;
/** /**
* Info process have style is button * Info process with style = button
*/ */
protected List<MInfoProcess> infoProcessBtList; protected List<MInfoProcess> infoProcessBtList;
/** /**
* Info process have style is drop down list * Info process with style = drop down list
*/ */
protected List<MInfoProcess> infoProcessDropList; protected List<MInfoProcess> infoProcessDropList;
/** /**
* Info process have style is menu * Info process with style = menu
*/ */
protected List<MInfoProcess> infoProcessMenuList; protected List<MInfoProcess> infoProcessMenuList;
/** /**
* save selected id and viewID * saved selected id and viewID
*/ */
protected Collection<NamePair> m_viewIDMap = new ArrayList <NamePair>(); protected Collection<NamePair> m_viewIDMap = new ArrayList <NamePair>();
/** /**
* store index of infoColumn have data append. each infoColumn just append only one time. * AD_InfoColumn_ID:Index Column Sequence <br/>
* index increase from 0. * Store index of infoColumn that have been added.Index increase from 0.
*/ */
protected Map <Integer, Integer> columnDataIndex = new HashMap <Integer, Integer> (); protected Map <Integer, Integer> columnDataIndex = new HashMap <Integer, Integer> ();
/** /**
* after load first record, set it to false. * After loading of first record, set this to false.<br/>
* when need update index of column data append to end of list {@link #columnDataIndex}, set it to true * When need to update {@link #columnDataIndex}, set this to true.
*/ */
protected boolean isMustUpdateColumnIndex = true; protected boolean isMustUpdateColumnIndex = true;
/** /**
* When start update index of column data append to end of list {@link #columnDataIndex}, reset it to 0, * Number of index column that have been added to {@link #columnDataIndex}.
* each read data for new append column, increase it up 1
*/ */
protected int indexColumnCount = 0; protected int indexColumnCount = 0;
/** /**
* to prevent append duplicate data, when begin read each record reset this list, * Before the start of reading of a row, reset this list. <br/>
* when read a column store id of infoColumn to list to check duplicate * After reading of each column, store id of infoColumn to this list to prevent duplicate.
*/ */
protected List <Integer> lsReadedColumn = new ArrayList <Integer> (); protected List <Integer> lsReadedColumn = new ArrayList <Integer> ();
/** /**
* IDEMPIERE-1334 * IDEMPIERE-1334
* button and combobox when layout process button as dropdow list * button and combobox when layout process button as dropdown list
*/ */
protected Button btCbbProcess; protected Button btCbbProcess;
protected Combobox cbbProcess; protected Combobox cbbProcess;
@ -627,6 +636,7 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
*/ */
protected int m_selectedCount = 0; protected int m_selectedCount = 0;
/** /**
* Parameter Name:Value
* Values that will be put into the context on re-query * Values that will be put into the context on re-query
*/ */
protected HashMap<String, Object> paraCtxValues = new HashMap<String, Object>(); protected HashMap<String, Object> paraCtxValues = new HashMap<String, Object>();
@ -651,7 +661,7 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
} // setStatusLine } // setStatusLine
/** /**
* Set Status DB * Set status text for DB
* @param text text * @param text text
*/ */
public void setStatusDB (String text) public void setStatusDB (String text)
@ -660,7 +670,7 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
} // setStatusDB } // setStatusDB
/** /**
* Set Status DB * Set status text for selected rows
*/ */
public void setStatusSelected () public void setStatusSelected ()
{ {
@ -691,7 +701,7 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
statusBar.setSelectedRowNumber(msg); statusBar.setSelectedRowNumber(msg);
btnSelectAll.setEnabled(m_count > 0 && selectedCount != m_count); btnSelectAll.setEnabled(m_count > 0 && selectedCount != m_count);
btnDeSelectAll.setEnabled(selectedCount > 0); btnDeSelectAll.setEnabled(selectedCount > 0);
} // setStatusDB } // setStatusSelected
/** /**
* set up list box and construct sql clause * set up list box and construct sql clause
@ -721,11 +731,14 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
m_sqlOrder = " ORDER BY " + orderBy; m_sqlOrder = " ORDER BY " + orderBy;
} // prepareTable } // prepareTable
/**
* @return true if number of page will be determined through record count.
*/
protected boolean isLoadPageNumber(){ protected boolean isLoadPageNumber(){
return infoWindow == null || infoWindow.isLoadPageNum(); return infoWindow == null || infoWindow.isLoadPageNum();
} }
/************************************************************************** /**
* Execute Query * Execute Query
*/ */
protected void executeQuery() protected void executeQuery()
@ -753,6 +766,11 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
} }
} }
/**
* Read row from result set
* @param rs
* @throws SQLException
*/
private void readData(ResultSet rs) throws SQLException { private void readData(ResultSet rs) throws SQLException {
int colOffset = 1; // columns start with 1 int colOffset = 1; // columns start with 1
List<Object> data = new ArrayList<Object>(); List<Object> data = new ArrayList<Object>();
@ -843,12 +861,12 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
} }
/** /**
* save data of all viewID column in infoProcessList to end of data line * Append viewID column in infoProcessList to data. <br/>
* when override {@link #readData(ResultSet)} consider call this method * When override {@link #readData(ResultSet)}, should include call to this method.
* IDEMPIERE-1970 * IDEMPIERE-1970
* @param rs record set to read data * @param rs result set to read data
* @param data data line to append * @param data data line to append
* @param listReadedColumn list column is appended * @param listReadedColumn list of columns appended
* @throws SQLException * @throws SQLException
*/ */
protected void appendDataForViewID(ResultSet rs, List<Object> data, List<Integer> listReadedColumn) throws SQLException { protected void appendDataForViewID(ResultSet rs, List<Object> data, List<Integer> listReadedColumn) throws SQLException {
@ -856,8 +874,8 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
} }
/** /**
* save data of all viewID column in infoProcessList to end of data line * Append id column in related info list to data. <br/>
* when override {@link #readData(ResultSet)} consider call this method * When override {@link #readData(ResultSet)}, should include call to this method.
* IDEMPIERE-2152 * IDEMPIERE-2152
* @param rs * @param rs
* @param data * @param data
@ -869,8 +887,8 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
} }
/** /**
* save data of all viewID column in infoProcessList to end of data line * Append {@link #keyColumnOfView} to data. <br/>
* when override {@link #readData(ResultSet)} consider call this method * When override {@link #readData(ResultSet)}, should include call to this method.
* IDEMPIERE-1970 * IDEMPIERE-1970
* @param rs record set to read data * @param rs record set to read data
* @param data data line to append * @param data data line to append
@ -883,11 +901,11 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
} }
/** /**
* save data of all infoColumn in listModelHaveInfoColumn to end of data line * Append value of infoColumn in listModelHaveInfoColumn to data. <br/>
* @param rs record set to read data * @param rs record set to read data
* @param data data line to append * @param data data line to append
* @param listModelHasInfoColumn * @param listModelHasInfoColumn
* @param listReadedColumn list column is appended * @param listReadedColumn list of columns appended
* @throws SQLException * @throws SQLException
*/ */
protected void appendInfoColumnData(ResultSet rs, List<Object> data, IInfoColumn [] listModelHasInfoColumn, List<Integer> listReadedColumn) throws SQLException { protected void appendInfoColumnData(ResultSet rs, List<Object> data, IInfoColumn [] listModelHasInfoColumn, List<Integer> listReadedColumn) throws SQLException {
@ -1082,6 +1100,12 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
setStatusDB(no == Integer.MAX_VALUE?"?":Integer.toString(no)); setStatusDB(no == Integer.MAX_VALUE?"?":Integer.toString(no));
} }
/**
* Read rows from start to end
* @param start
* @param end
* @return rows read
*/
private List<Object> readLine(int start, int end) { private List<Object> readLine(int start, int end) {
if (useQueryTimeoutFromSysConfig) if (useQueryTimeoutFromSysConfig)
queryTimeout = MSysConfig.getIntValue(MSysConfig.ZK_INFO_QUERY_TIME_OUT, 0, Env.getAD_Client_ID(Env.getCtx())); queryTimeout = MSysConfig.getIntValue(MSysConfig.ZK_INFO_QUERY_TIME_OUT, 0, Env.getAD_Client_ID(Env.getCtx()));
@ -1222,9 +1246,9 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
} }
/** /**
* after query from database, process validate. * After query from database, validate paging (when paging is dynamic, ie isLoadPageNumber()==false) <br/>
* if end page include in cache, process calculate total record * If end page include in cache, calculate total record read. <br/>
* if current page is out of page (no record is query) process query count to detect end page * If current page is out of cache, process query count to detect end page.
*/ */
protected void validateEndPage (){ protected void validateEndPage (){
if (paging == null || isLoadPageNumber()) if (paging == null || isLoadPageNumber())
@ -1235,7 +1259,7 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
int pageInCache = line.size() / pageSize + extraPage; int pageInCache = line.size() / pageSize + extraPage;
if (pageInCache == 0 || pageInCache <= numPagePreLoad){ if (pageInCache == 0 || pageInCache <= numPagePreLoad){
// selected page is out of page // selected page is out of cache
testCount(); testCount();
extraPage = ((m_count % pageSize > 0)?1:0); extraPage = ((m_count % pageSize > 0)?1:0);
pageInCache = m_count / pageSize + extraPage; pageInCache = m_count / pageSize + extraPage;
@ -1256,16 +1280,15 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
} }
/** /**
* fromIndex and toIndex calculate with assume always query record as {@link #testCount()} * fromIndex and toIndex is calculate base on result from {@link #testCount()}. <br/>
* example after testCount we get calculate 6page. * For example after testCount, the calculated number of page is 6 page.<br/>
* when user navigate to page 4. something change in system (a batch record change become don't match with search query) * When user navigate to page 4. something change in database and we just get 5 page with current query parameter. <br/>
* let we just get 5 page with current parameter. * So when user navigate to page 6. user will face with index issue (out of index or start index &gt; end index). <br/>
* so when user navigate to page 6. user will face with index issue. (out of index or start index &gt; end index) * This function include fix for it.
* this function is fix for it.
* @param fromIndex * @param fromIndex
* @param toIndex * @param toIndex
* @param line * @param line
* @return * @return sub list from line
*/ */
protected List<Object> getSubList (int fromIndex, int toIndex, List<Object> line){ protected List<Object> getSubList (int fromIndex, int toIndex, List<Object> line){
if (toIndex > line.size()) if (toIndex > line.size())
@ -1282,26 +1305,26 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
} }
/** /**
* when calculator value at bound, sometime value is overflow by data type * When calculating value at bound of integer datatype, sometime value will overflow.
* this function calculator at high type for avoid it * This function calculate with higher data type to avoid the overflow issue.
* @param overValue * @param value
* @return * @return int
*/ */
protected int getOverIntValue (long overValue){ protected int getOverIntValue (long value){
return getOverIntValue (overValue, 0); return getOverIntValue (value, 0);
} }
/** /**
* see {@link #getOverIntValue(long)}. when value over max_value set it near max_value. * see {@link #getOverIntValue(long)}. when value >= max_value, set it near or equal to max_value.
* @param overValue * @param value
* @param extra * @param extra extra value to minus from max_value
* @return * @return int
*/ */
protected int getOverIntValue (long overValue, int extra){ protected int getOverIntValue (long value, int extra){
if (overValue >= Integer.MAX_VALUE) if (value >= Integer.MAX_VALUE)
overValue = Integer.MAX_VALUE - extra; value = Integer.MAX_VALUE - extra;
return (int)overValue; return (int)value;
} }
/** /**
@ -1339,9 +1362,9 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
} }
/** /**
* column of grid isn't fix, it can change by display logic of column each time load data * column index of grid isn't fix, it can change by display logic of column each time after loading of data
* {@link InfoWindow#prepareTable(ColumnInfo[], String, String, String)} * {@link InfoWindow#prepareTable(ColumnInfo[], String, String, String)},
* so need to validate it by compare sql of current sort column * so need to validate it by comparing the sql of current sort column
*/ */
protected void validateOrderIndex() { protected void validateOrderIndex() {
if (indexOrderColumn > 0 && (indexOrderColumn + 1 > p_layout.length || !p_layout[indexOrderColumn].getColSQL().trim().equals(sqlOrderColumn))) { if (indexOrderColumn > 0 && (indexOrderColumn + 1 > p_layout.length || !p_layout[indexOrderColumn].getColSQL().trim().equals(sqlOrderColumn))) {
@ -1365,8 +1388,8 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
} }
/** /**
* build order clause of current sort order, and save it to m_sqlUserOrder * build order clause of current sort column, and save it to m_sqlUserOrder
* @return * @return order clause
*/ */
protected String getUserOrderClause() { protected String getUserOrderClause() {
validateOrderIndex(); validateOrderIndex();
@ -1381,10 +1404,10 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
} }
/** /**
* build order clause of give column * Build order clause of given column index. <br/>
* if call that function before init list will raise a NPE. care about your code * If call init list will raise NPE.
* @param col * @param col
* @return * @return order clause
*/ */
protected String getUserOrderClause(int col) { protected String getUserOrderClause(int col) {
ColumnInfo orderColumnInfo = p_layout[col]; ColumnInfo orderColumnInfo = p_layout[col];
@ -1404,9 +1427,9 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
} }
/** /**
* Get SQL SELECT clause for ORDER BY * Get SQL column clause for ORDER BY
* @param colsql * @param colsql
* @return String SELECT clause * @return sql column clause
*/ */
private String getSelectForOrderBy(String colsql) { private String getSelectForOrderBy(String colsql) {
@ -1442,7 +1465,7 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
} }
/** /**
* Get SQL FROM clause for ORDER BY * Get SQL FROM clause for ORDER BY (table and join)
* @param orderColumnInfo * @param orderColumnInfo
* @param displayColumn * @param displayColumn
* @return String FROM clause * @return String FROM clause
@ -1496,6 +1519,9 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
return whereClause; return whereClause;
} }
/**
* Add current info panel instance as double click and on select listener of {@link #contentPanel}.
*/
private void addDoubleClickListener() { private void addDoubleClickListener() {
Iterator<EventListener<? extends Event>> i = contentPanel.getEventListeners(Events.ON_DOUBLE_CLICK).iterator(); Iterator<EventListener<? extends Event>> i = contentPanel.getEventListeners(Events.ON_DOUBLE_CLICK).iterator();
while (i.hasNext()) { while (i.hasNext()) {
@ -1725,11 +1751,11 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
} }
/** /**
* Save selected id, viewID of all process to map viewIDMap to save into T_Selection * Add view id column (infoColumnId) to {@link #m_viewIDMap}.
* @param infoCulumnId * @param infoColumnId view id column
*/ */
public Collection<NamePair> getSaveKeys (int infoCulumnId){ public Collection<NamePair> getSaveKeys (int infoColumnId){
// clear result from prev time // clear result from previous call
m_viewIDMap.clear(); m_viewIDMap.clear();
if (p_multipleSelection) if (p_multipleSelection)
@ -1741,9 +1767,9 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
// get key data column // get key data column
Object keyData = selectedInfo.getKey(); Object keyData = selectedInfo.getKey();
if (infoCulumnId > 0){ if (infoColumnId > 0){
// have viewID, get it // has viewID, get it
int dataIndex = columnDataIndex.get(infoCulumnId) + p_layout.length; int dataIndex = columnDataIndex.get(infoColumnId) + p_layout.length;
// get row data from model // get row data from model
Object viewIDValue = selectedInfo.getValue().get(dataIndex); Object viewIDValue = selectedInfo.getValue().get(dataIndex);
@ -1752,7 +1778,7 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
else else
m_viewIDMap.add (new KeyNamePair((Integer) keyData, viewIDValue == null?null:viewIDValue.toString())); m_viewIDMap.add (new KeyNamePair((Integer) keyData, viewIDValue == null?null:viewIDValue.toString()));
}else{ }else{
// hasn't viewID, set viewID value is null // no viewID, set viewID value to null
if (keyData instanceof String) if (keyData instanceof String)
m_viewIDMap.add (new ValueNamePair((String) keyData, null)); m_viewIDMap.add (new ValueNamePair((String) keyData, null));
else else
@ -1763,15 +1789,15 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
return m_viewIDMap; return m_viewIDMap;
}else{ }else{
// never has this case, because when have process, p_multipleSelection always is true // should never reach here, when have process, p_multipleSelection is always true
return null; return null;
} }
} }
/** /**
* need overrider at infoWindow to check isDisplay * need override at infoWindow to check isDisplay
* @return * @return true if need to append {@link #keyColumnOfView} to {@link #columnDataIndex}
*/ */
protected boolean isNeedAppendKeyViewData (){ protected boolean isNeedAppendKeyViewData (){
return false; return false;
@ -1781,7 +1807,7 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
* Check type of object is IDColumn * Check type of object is IDColumn
* @param keyData * @param keyData
* @param isCheckNull when true, raise exception when data is null * @param isCheckNull when true, raise exception when data is null
* @return * @return true if keyData is instanceof IDColumn
*/ */
protected boolean isIDColumn(Object keyData, boolean isCheckNull){ protected boolean isIDColumn(Object keyData, boolean isCheckNull){
if (isCheckNull && keyData == null){ if (isCheckNull && keyData == null){
@ -1798,18 +1824,18 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
} }
/** /**
* call {@link #isIDColumn(Object, boolean)} without check null value * call {@link #isIDColumn(Object, boolean)} without null check
* @param keyData * @param keyData
* @return * @return true if keyData is instanceof IDColumn
*/ */
protected boolean isIDColumn(Object keyData){ protected boolean isIDColumn(Object keyData){
return isIDColumn(keyData, false); return isIDColumn(keyData, false);
} }
/** /**
* get all selected record of current page and update to {@link #recordSelectedData} * Get all selected record of current page and update to {@link #recordSelectedData}.<br/>
* remove unselected record and add new selected record * Remove unselected record and add new selected record.<br/>
* we maintain value of key, and extra value append by {@link #appendInfoColumnData(ResultSet, List, IInfoColumn[], List)} * We maintain value of key, and extra value append by {@link #appendInfoColumnData(ResultSet, List, IInfoColumn[], List)}
*/ */
protected void updateListSelected (){ protected void updateListSelected (){
for (int rowIndex = 0; rowIndex < contentPanel.getModel().getRowCount(); rowIndex++){ for (int rowIndex = 0; rowIndex < contentPanel.getModel().getRowCount(); rowIndex++){
@ -1851,8 +1877,8 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
} }
/** /**
* get data index of keyView * get column index of keyView
* @return * @return index of key column
*/ */
protected int getIndexKeyColumnOfView (){ protected int getIndexKeyColumnOfView (){
if (keyColumnOfView == null){ if (keyColumnOfView == null){
@ -1887,7 +1913,8 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
contentPanel.getModel().setSelection(lsSelectionRecord); contentPanel.getModel().setSelection(lsSelectionRecord);
} }
/** Hook to intercept 'restore selection' actions /**
* Hook to intercept 'restore selection' actions
* *
* @param keyViewValue row view key * @param keyViewValue row view key
* @param rowIndex row index * @param rowIndex row index
@ -1905,10 +1932,10 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
return new AdempiereException(errorMessage); return new AdempiereException(errorMessage);
} }
/** /**
* get keyView value at rowIndex and columnIndex * Get keyView value at rowIndex.<br/>
* also check in case value is null will raise an exception * Exception is raise if value is null.
* @param rowIndex * @param rowIndex
* @return * @return value of key column
*/ */
protected Object getColumnValue (int rowIndex){ protected Object getColumnValue (int rowIndex){
@ -1947,13 +1974,9 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
} }
/** /**
* in case requery data, but want store selected record (example when run success a process) * Maintain selected record after re-query (for example after success run of a process). <br/>
* we must sync selected row, because some selected row maybe not at data list (process make it change not map with query) * We must sync selected row, because some selected row maybe missing after re-query (change by process and no longer match with current query).
* current 1000 line cache * TODO:rewrite, current code just reset isRequeryByRunSuccessProcess flag and didn't do anything else.
* because in case query get more 1000 record we can't sync or maintain selected record (ever maintain for current page will make user confuse).
* just clear selection
* in case &lt; 1000 record is ok
* TODO:rewrite
*/ */
protected void syncSelectedAfterRequery (){ protected void syncSelectedAfterRequery (){
if (isRequeryByRunSuccessProcess){ if (isRequeryByRunSuccessProcess){
@ -1969,7 +1992,7 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
} }
/** /**
* update list column key value of selected record and return this list * Update {@link #recordSelectedData}
* @return {@link #recordSelectedData} after update * @return {@link #recordSelectedData} after update
*/ */
public Map<Object, List<Object>> getSelectedRowInfo (){ public Map<Object, List<Object>> getSelectedRowInfo (){
@ -2079,7 +2102,7 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
} }
/** /**
* enable all control button or disable all rely to selected record * enable all control button or disable all depends on whether there are selected records.
*/ */
protected void enableButtons (){ protected void enableButtons (){
boolean enable = (contentPanel.getSelectedCount() > 0 || getSelectedRowInfo().size() > 0); boolean enable = (contentPanel.getSelectedCount() > 0 || getSelectedRowInfo().size() > 0);
@ -2123,68 +2146,69 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
} // enableButtons } // enableButtons
// //
/************************************************************************** /**
* Get dynamic WHERE part of SQL * Get dynamic WHERE part of SQL.<br/>
* To be overwritten by concrete classes * When override this method, please take isQueryByUser and prevWhereClause into consideration.
* When override this method, please consider isQueryByUser and prevWhereClause
* @return WHERE clause * @return WHERE clause
*/ */
protected abstract String getSQLWhere(); protected abstract String getSQLWhere();
/** /**
* Set Parameters for Query * Set Parameters for Query. <br/>
* To be overwritten by concrete classes * When override this method, please take isQueryByUser and prevWhereClause into consideration.
* When override this method, please consider isQueryByUser and prevWhereClause
* @param pstmt statement * @param pstmt statement
* @param forCount for counting records * @param forCount for counting records
* @throws SQLException * @throws SQLException
*/ */
protected abstract void setParameters (PreparedStatement pstmt, boolean forCount) protected abstract void setParameters (PreparedStatement pstmt, boolean forCount)
throws SQLException; throws SQLException;
/** /**
* notify to search editor of a value change in the selection info * Show history dialog
*/ */
protected void showHistory() {} protected void showHistory() {}
/** /**
* Has History (false) * Has History (default false).
* To be overwritten by concrete classes * Override this and {@link #showHistory()} method to add history dialog support.
* @return true if it has history (default false) * @return true if it has history (default false)
*/ */
protected boolean hasHistory() {return false;} protected boolean hasHistory() {return false;}
/** /**
* Customize dialog * @return true if support running of process.
* To be overwritten by concrete classes
*/ */
protected boolean hasProcess() {return false;} protected boolean hasProcess() {return false;}
/** /**
* Customize dialog * Show Customize dialog
* To be overwritten by concrete classes
*/ */
protected void customize() {} protected void customize() {}
/** /**
* Has Customize (false) * Has Customize dialog (default false).
* To be overwritten by concrete classes * Override this and {@link #customize()} method to add customize dialog support.
* @return true if it has customize (default false) * @return true if it has customize (default false)
*/ */
protected boolean hasCustomize() {return false;} protected boolean hasCustomize() {return false;}
/** /**
* Has Zoom (false) * Has Zoom support (default false)
* To be overwritten by concrete classes * @return true if it has zoom support (default false)
* @return true if it has zoom (default false)
*/ */
protected boolean hasZoom() {return false;} protected boolean hasZoom() {return false;}
/** /**
* Has new function for create new record (false) * Support create new record (default false)
* To be overwritten by concrete classes * @return true if support create new record
* @return
*/ */
protected boolean hasNew() {return false;} protected boolean hasNew() {return false;}
/** /**
* Save Selection Details * Save Selection Details. <br/>
* To be overwritten by concrete classes * This method is call when user close an info window. <br/>
* this function call when close info window. * By default, infoWindow will set value of all column of current selected record to environment context with {@link Env#TAB_INFO}. <br/>
* default infoWindow will set value of all column of current selected record to environment variable with {@link Env#TAB_INFO} * Sub class can override this method to do more.
* class extends can do more by override it.
*/ */
protected void saveSelectionDetail() {} protected void saveSelectionDetail() {}
@ -2293,7 +2317,6 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
recordSelectedData.clear(); recordSelectedData.clear();
resetParameters (); resetParameters ();
} }
// Elaine 2008/12/16
else if (event.getTarget().equals(confirmPanel.getButton(ConfirmPanel.A_HISTORY))) else if (event.getTarget().equals(confirmPanel.getButton(ConfirmPanel.A_HISTORY)))
{ {
if (!contentPanel.getChildren().isEmpty() && contentPanel.getSelectedRowKey()!=null) if (!contentPanel.getChildren().isEmpty() && contentPanel.getSelectedRowKey()!=null)
@ -2422,7 +2445,7 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
this.onCtrlKeyEvent(keyEvent); this.onCtrlKeyEvent(keyEvent);
}else if (event.getName().equals(Events.ON_OK)){// on ok when focus at non parameter component. example grid result }else if (event.getName().equals(Events.ON_OK)){// on ok when focus at non parameter component. example grid result
if (m_lookup && contentPanel.getSelectedIndex() >= 0){ if (m_lookup && contentPanel.getSelectedIndex() >= 0){
// do nothing when parameter not change and at window mode, or at dialog mode but select non record // do nothing when parameter not change and at window mode, or at dialog mode but select no record
onOk(); onOk();
} }
else if (m_infoWindowID == 0 && event.getTarget() instanceof InfoGeneralPanel) { else if (m_infoWindowID == 0 && event.getTarget() instanceof InfoGeneralPanel) {
@ -2459,6 +2482,11 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
public static final int VK_ENTER = '\r'; public static final int VK_ENTER = '\r';
public static final int VK_ESCAPE = 0x1B; public static final int VK_ESCAPE = 0x1B;
/**
* Handle ON_CTRL_KEY event
* @param keyEvent
*/
private void onCtrlKeyEvent(KeyEvent keyEvent) { private void onCtrlKeyEvent(KeyEvent keyEvent) {
if (keyEvent.isAltKey() && !keyEvent.isCtrlKey() && keyEvent.isShiftKey()) { // Shift+Alt if (keyEvent.isAltKey() && !keyEvent.isCtrlKey() && keyEvent.isShiftKey()) { // Shift+Alt
if (keyEvent.getKeyCode() == KeyEvent.DOWN) { // Shift+Alt+Down if (keyEvent.getKeyCode() == KeyEvent.DOWN) { // Shift+Alt+Down
@ -2496,41 +2524,41 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
/** /**
* validate parameter before run query * validate parameter before run query
* @return * @return true if parameters pass validation
*/ */
public boolean validateParameters(){ public boolean validateParameters(){
return true; return true;
} }
/** /**
* Call after load parameter panel to set init value can call when reset * Call after loading of parameter panel to set initial value. Can call to reset parameters.
* parameter implement this method at inheritance class
* with each parameter, remember call Env.setContext to set new value to env
*/ */
protected void initParameters() { protected void initParameters() {
} }
/** /**
* Update relate info when selection in main info change * Update related info when selection in {@link #contentPanel} change.
*/ */
protected void updateSubcontent (){ updateSubcontent(-1);}; protected void updateSubcontent (){ updateSubcontent(-1);};
/** /**
* Update relate info for a specific row, if targetRow &lt; 0 update using selected row * Update related info for a specific row. If targetRow &lt; 0, update using selected row.
* @param targetRow * @param targetRow
*/ */
protected void updateSubcontent (int targetRow){}; protected void updateSubcontent (int targetRow){};
/** /**
* Reset parameter to default value or to empty value? implement at * Reset parameter to default value or to empty value.
* inheritance class when reset parameter maybe need init again parameter,
* reset again default value
*/ */
protected void resetParameters() { protected void resetParameters() {
} }
/**
* Before running of process
* @param processId
*/
protected void preRunProcess (Integer processId){ protected void preRunProcess (Integer processId){
// disable all control button when run process // disable all control button when run process
enableButtons(false); enableButtons(false);
@ -2539,10 +2567,9 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
} }
/** /**
* Run a process. * Run a process.<br/>
* show process dialog, * Before start process, save id of record selected. <br/>
* before start process, save id of record selected * After run of process, show process message report result.
* after run process, show message report result
* @param processIdObj * @param processIdObj
*/ */
protected void runProcess (Object processIdObj){ protected void runProcess (Object processIdObj){
@ -2652,7 +2679,8 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
/** /**
* save result values * Save selected rows to {@link #m_values}
* @param infoColumnId AD_InfoProcess.AD_InfoColumn_ID. Use as key column if > 0
*/ */
protected void saveResultSelection(int infoColumnId) { protected void saveResultSelection(int infoColumnId) {
int m_keyColumnIndex = contentPanel.getKeyColumnIndex(); int m_keyColumnIndex = contentPanel.getKeyColumnIndex();
@ -2702,7 +2730,7 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
} // saveResultSelection } // saveResultSelection
/** /**
* Insert result values * Insert selected rows to T_Selection_InfoWindow
* @param AD_PInstance_ID * @param AD_PInstance_ID
*/ */
public void createT_Selection_InfoWindow(int AD_PInstance_ID) public void createT_Selection_InfoWindow(int AD_PInstance_ID)
@ -2823,9 +2851,9 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
} // createT_Selection_InfoWindow } // createT_Selection_InfoWindow
/** /**
* Get InfoColumnID of infoProcess have processID is processId * Get InfoColumnID of infoProcess
* @param processId * @param processId
* @return value InfoColumnID, -1 when has not any map * @return AD_InfoColumn_ID, -1 if processId not in {@link #infoProcessList}
*/ */
protected int getInfoColumnIDFromProcess (int processId){ protected int getInfoColumnIDFromProcess (int processId){
for (int i = 0; i < infoProcessList.length; i++){ for (int i = 0; i < infoProcessList.length; i++){
@ -2844,6 +2872,9 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
Clients.clearBusy(this); Clients.clearBusy(this);
} }
/**
* Set sort direction indicator
*/
protected void correctHeaderOrderIndicator() { protected void correctHeaderOrderIndicator() {
Listhead listHead = contentPanel.getListHead(); Listhead listHead = contentPanel.getListHead();
if (listHead != null) { if (listHead != null) {
@ -2851,8 +2882,6 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
for(Object obj : headers) for(Object obj : headers)
{ {
Listheader header = (Listheader) obj; Listheader header = (Listheader) obj;
// idempiere use mix method. sometime call model method, sometime call component method
// so index can be difference on complicate case, just wait to fix
if (header.getColumnIndex() == indexOrderColumn) if (header.getColumnIndex() == indexOrderColumn)
header.setSortDirection(isColumnSortAscending?"ascending":"descending"); header.setSortDirection(isColumnSortAscending?"ascending":"descending");
else else
@ -2906,8 +2935,8 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
} }
/** /**
* evaluate display logic of button process * Evaluate display logic of processes.
* empty method. implement at child class extend * Implemented by sub class.
*/ */
protected void bindInfoProcess (){} protected void bindInfoProcess (){}
@ -3007,7 +3036,7 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
} }
/** /**
* Set and load the active page * Set and load pgNo as active page
* @param pgNo * @param pgNo
*/ */
private void setAndLoadActivePage(int pgNo) { private void setAndLoadActivePage(int pgNo) {
@ -3054,7 +3083,7 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
} }
/** /**
* process action when user click to new button * Handle user click on new record button.
*/ */
protected void newRecordAction (){} protected void newRecordAction (){}
@ -3073,7 +3102,7 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
} }
/** /**
* * Fire ValueChangeEvent event.
* @param event * @param event
*/ */
public void fireValueChange(ValueChangeEvent event) public void fireValueChange(ValueChangeEvent event)
@ -3085,7 +3114,7 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
} }
/** /**
* Dispose and save Selection * Dispose and save Selection
* @param ok OK pressed * @param ok true if OK pressed
*/ */
public void dispose(boolean ok) public void dispose(boolean ok)
{ {
@ -3117,6 +3146,10 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
} }
} // dispose } // dispose
/**
* Save width of columns
* @param comp
*/
private void saveWlistBoxColumnWidth(Component comp){ private void saveWlistBoxColumnWidth(Component comp){
if(comp instanceof WListbox){ if(comp instanceof WListbox){
@ -3176,7 +3209,7 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
/** /**
* *
* @return true if it is a lookup dialog * @return true if this is a lookup dialog
*/ */
public boolean isLookup() public boolean isLookup()
{ {
@ -3184,7 +3217,7 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
} }
/** /**
* scroll selected row into view * scroll selected row into view (i.e make sure it is visible)
*/ */
public void scrollToSelectedRow() public void scrollToSelectedRow()
{ {

View File

@ -54,20 +54,20 @@ import org.zkoss.zul.South;
/** /**
* Price History for BPartner/Product * Price History for BPartner/Product
* This class is based on org.compiere.apps.search.InvoiceHistory written by Jorg Janke
* @author <a href="mailto:elaine.tan@idalica.com">Elaine</a> * @author <a href="mailto:elaine.tan@idalica.com">Elaine</a>
*/ */
public class InvoiceHistory extends Window implements EventListener<Event> public class InvoiceHistory extends Window implements EventListener<Event>
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = 8742214467478030802L; private static final long serialVersionUID = 8742214467478030802L;
boolean showDetailATP = false; protected boolean showDetailATP = false;
/** /**
* Show History * Show History
* @param parent
* @param C_BPartner_ID partner * @param C_BPartner_ID partner
* @param M_Product_ID product * @param M_Product_ID product
* @param M_Warehouse_ID warehouse * @param M_Warehouse_ID warehouse
@ -136,9 +136,9 @@ public class InvoiceHistory extends Window implements EventListener<Event>
private ListModelTable m_modelAtp = null; private ListModelTable m_modelAtp = null;
/** /**
* Ststic Init * Layout window
*/ */
void jbInit() throws Exception protected void jbInit() throws Exception
{ {
label.setText("Label"); label.setText("Label");
@ -264,7 +264,8 @@ public class InvoiceHistory extends Window implements EventListener<Event>
/** /**
* Get Info for Product for given Business Parner * Get invoiced product details for a given Business Partner.
* @return invoiced product details
*/ */
private Vector<Vector<Object>> queryProduct () private Vector<Vector<Object>> queryProduct ()
{ {
@ -289,7 +290,8 @@ public class InvoiceHistory extends Window implements EventListener<Event>
} // queryProduct } // queryProduct
/** /**
* Get Info for Business Partners for given Product * Get invoiced Business Partners details for a given Product
* @return invoiced Business Partners details
*/ */
private Vector<Vector<Object>> queryBPartner () private Vector<Vector<Object>> queryBPartner ()
{ {
@ -314,7 +316,10 @@ public class InvoiceHistory extends Window implements EventListener<Event>
} // qyeryBPartner } // qyeryBPartner
/** /**
* Fill Table * Fill list
* @param sql
* @param parameter
* @return List of records
*/ */
private Vector<Vector<Object>> fillTable (String sql, int parameter) private Vector<Vector<Object>> fillTable (String sql, int parameter)
{ {
@ -369,8 +374,9 @@ public class InvoiceHistory extends Window implements EventListener<Event>
} // fillTable } // fillTable
/** /**
* Set Label * Set Label to product or bp name.
* to product or bp name * @param sql
* @param parameter
*/ */
private void fillLabel (String sql, int parameter) private void fillLabel (String sql, int parameter)
{ {
@ -380,7 +386,7 @@ public class InvoiceHistory extends Window implements EventListener<Event>
label.setText(retValue); label.setText(retValue);
} // fillLabel } // fillLabel
@Override
public void onEvent(Event e) throws Exception { public void onEvent(Event e) throws Exception {
Component component = e.getTarget(); Component component = e.getTarget();
@ -495,7 +501,7 @@ public class InvoiceHistory extends Window implements EventListener<Event>
/** /**
* Query Unconfirmed * Query Unconfirmed (Draft/In Progress M_InOut)
*/ */
private void initUnconfirmedTab () private void initUnconfirmedTab ()
{ {

View File

@ -46,9 +46,12 @@ import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Div; import org.zkoss.zul.Div;
import org.zkoss.zul.Groupbox; import org.zkoss.zul.Groupbox;
/**
* Label for a record (AD_LabelAssignment)
*/
public class LabelsPanel extends Div implements EventListener<Event> { public class LabelsPanel extends Div implements EventListener<Event> {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = 8776043844483214400L; private static final long serialVersionUID = 8776043844483214400L;
@ -93,7 +96,7 @@ public class LabelsPanel extends Div implements EventListener<Event> {
/** /**
* Get current table id * Get current table id
* @return id * @return AD_Table_ID
*/ */
public int getAD_Table_ID() { public int getAD_Table_ID() {
return AD_Table_ID; return AD_Table_ID;
@ -101,7 +104,7 @@ public class LabelsPanel extends Div implements EventListener<Event> {
/** /**
* Get current record id * Get current record id
* @return * @return Record_ID
*/ */
public int getRecord_ID() { public int getRecord_ID() {
return Record_ID; return Record_ID;
@ -109,7 +112,7 @@ public class LabelsPanel extends Div implements EventListener<Event> {
/** /**
* Get current record uuid * Get current record uuid
* @return * @return Record_UU
*/ */
public String getRecord_UU() { public String getRecord_UU() {
return Record_UU; return Record_UU;

View File

@ -103,7 +103,7 @@ import org.zkoss.zul.Image;
public class LoginPanel extends Window implements EventListener<Event> public class LoginPanel extends Window implements EventListener<Event>
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = -7859522563172088496L; private static final long serialVersionUID = -7859522563172088496L;
@ -133,6 +133,10 @@ public class LoginPanel extends Window implements EventListener<Event>
/* Number of failures to calculate an incremental delay on every trial */ /* Number of failures to calculate an incremental delay on every trial */
private int failures = 0; private int failures = 0;
/**
* @param ctx
* @param loginWindow
*/
public LoginPanel(Properties ctx, LoginWindow loginWindow) public LoginPanel(Properties ctx, LoginWindow loginWindow)
{ {
this.ctx = ctx; this.ctx = ctx;
@ -149,6 +153,9 @@ public class LoginPanel extends Window implements EventListener<Event>
this.addEventListener(ON_LOAD_TOKEN, this); this.addEventListener(ON_LOAD_TOKEN, this);
} }
/**
* Layout panel
*/
private void init() private void init()
{ {
createUI(); createUI();
@ -238,6 +245,9 @@ public class LoginPanel extends Window implements EventListener<Event>
txtPassword.removeEventListener(Events.ON_FOCUS, txtPassword); txtPassword.removeEventListener(Events.ON_FOCUS, txtPassword);
} }
/**
* Layout panel
*/
protected void createUI() { protected void createUI() {
Form form = new Form(); Form form = new Form();
@ -364,6 +374,9 @@ public class LoginPanel extends Window implements EventListener<Event>
this.appendChild(form); this.appendChild(form);
} }
/**
* Create components
*/
private void initComponents() private void initComponents()
{ {
lblUserId = new Label(); lblUserId = new Label();
@ -383,14 +396,12 @@ public class LoginPanel extends Window implements EventListener<Event>
txtUserId.setCols(25); txtUserId.setCols(25);
txtUserId.setMaxlength(40); txtUserId.setMaxlength(40);
ZKUpdateUtil.setWidth(txtUserId, "220px"); ZKUpdateUtil.setWidth(txtUserId, "220px");
//txtUserId.addEventListener(Events.ON_CHANGE, this); // Elaine 2009/02/06
txtUserId.setClientAttribute("autocomplete", "username"); txtUserId.setClientAttribute("autocomplete", "username");
txtPassword = new Textbox(); txtPassword = new Textbox();
txtPassword.setId("txtPassword"); txtPassword.setId("txtPassword");
txtPassword.setType("password"); txtPassword.setType("password");
txtPassword.setCols(25); txtPassword.setCols(25);
// txtPassword.setMaxlength(40);
ZKUpdateUtil.setWidth(txtPassword, "220px"); ZKUpdateUtil.setWidth(txtPassword, "220px");
if (MSysConfig.getBooleanValue(MSysConfig.ZK_LOGIN_ALLOW_CHROME_SAVE_PASSWORD, true)) if (MSysConfig.getBooleanValue(MSysConfig.ZK_LOGIN_ALLOW_CHROME_SAVE_PASSWORD, true))
txtPassword.setClientAttribute("autocomplete", "current-password"); txtPassword.setClientAttribute("autocomplete", "current-password");
@ -427,6 +438,7 @@ public class LoginPanel extends Window implements EventListener<Event>
} }
} }
@Override
public void onEvent(Event event) public void onEvent(Event event)
{ {
Component eventComp = event.getTarget(); Component eventComp = event.getTarget();
@ -455,16 +467,6 @@ public class LoginPanel extends Window implements EventListener<Event>
{ {
btnResetPasswordClicked(); btnResetPasswordClicked();
} }
/* code below commented per security issue IDEMPIERE-1797 reported
// Elaine 2009/02/06 - initial language
else if (event.getName().equals(Events.ON_CHANGE))
{
if(eventComp.getId().equals(txtUserId.getId()))
{
onUserIdChange(-1);
}
}
*/
else if (event.getName().equals(ON_LOAD_TOKEN)) else if (event.getName().equals(ON_LOAD_TOKEN))
{ {
BrowserToken.load(txtUserId); BrowserToken.load(txtUserId);
@ -498,6 +500,10 @@ public class LoginPanel extends Window implements EventListener<Event>
} }
} }
/**
* User id from onUserToken event.
* @param AD_User_ID
*/
private void onUserIdChange(int AD_User_ID) { private void onUserIdChange(int AD_User_ID) {
String userName = txtUserId.getValue(); String userName = txtUserId.getValue();
if (userName != null && userName.length() > 0 && AD_User_ID < 0) if (userName != null && userName.length() > 0 && AD_User_ID < 0)
@ -525,13 +531,17 @@ public class LoginPanel extends Window implements EventListener<Event>
if(li.getLabel().equals(initDefault)) if(li.getLabel().equals(initDefault))
{ {
lstLanguage.setSelectedIndex(i); lstLanguage.setSelectedIndex(i);
languageChanged(li.getLabel()); // Elaine 2009/04/17 language changed languageChanged(li.getLabel());
break; break;
} }
} }
} }
} }
/**
* Apply language change to UI elements
* @param langName
*/
private void languageChanged(String langName) private void languageChanged(String langName)
{ {
Language language = findLanguage(langName); Language language = findLanguage(langName);
@ -550,6 +560,11 @@ public class LoginPanel extends Window implements EventListener<Event>
pnlButtons.getButton(ConfirmPanel.A_HELP).setLabel(Util.cleanAmp(Msg.getMsg(language, ConfirmPanel.A_HELP))); pnlButtons.getButton(ConfirmPanel.A_HELP).setLabel(Util.cleanAmp(Msg.getMsg(language, ConfirmPanel.A_HELP)));
} }
/**
* Find language by name
* @param langName
* @return Language
*/
private Language findLanguage(String langName) { private Language findLanguage(String langName) {
Language tmp = Language.getLanguage(langName); Language tmp = Language.getLanguage(langName);
Language language = new Language(tmp.getName(), tmp.getAD_Language(), tmp.getLocale(), tmp.isDecimalPoint(), Language language = new Language(tmp.getName(), tmp.getAD_Language(), tmp.getLocale(), tmp.isDecimalPoint(),
@ -566,13 +581,13 @@ public class LoginPanel extends Window implements EventListener<Event>
logger.log(Level.WARNING, e.getLocalizedMessage(), e); logger.log(Level.WARNING, e.getLocalizedMessage(), e);
} }
Locales.setThreadLocal(locale); Locales.setThreadLocal(locale);
// cph::erp end
return language; return language;
} }
/** /**
* validates user name and password when logging in * Validates user name and password when logging in
* */
**/
public void validateLogin() public void validateLogin()
{ {
Login login = new Login(ctx); Login login = new Login(ctx);
@ -657,12 +672,11 @@ public class LoginPanel extends Window implements EventListener<Event>
Clients.response("browserTimeoutScript", new AuScript(null, timeoutText)); Clients.response("browserTimeoutScript", new AuScript(null, timeoutText));
} }
// This temporary validation code is added to check the reported bug // This validation code is added to check the reported bug
// [ adempiere-ZK Web Client-2832968 ] User context lost? // [ adempiere-ZK Web Client-2832968 ] User context lost?
// https://sourceforge.net/p/adempiere/zk-web-client/303/ // https://sourceforge.net/p/adempiere/zk-web-client/303/
// it's harmless, if there is no bug then this must never fail // it's harmless, if there is no bug then this must never fail
currSess.setAttribute(AdempiereWebUI.CHECK_AD_USER_ID_ATTR, Env.getAD_User_ID(ctx)); currSess.setAttribute(AdempiereWebUI.CHECK_AD_USER_ID_ATTR, Env.getAD_User_ID(ctx));
// End of temporary code for [ adempiere-ZK Web Client-2832968 ] User context lost?
/* Check DB version */ /* Check DB version */
String version = DB.getSQLValueString(null, "SELECT Version FROM AD_System"); String version = DB.getSQLValueString(null, "SELECT Version FROM AD_System");
@ -676,6 +690,9 @@ public class LoginPanel extends Window implements EventListener<Event>
} }
/**
* @return client side timeout script
*/
private String getUpdateTimeoutTextScript() { private String getUpdateTimeoutTextScript() {
String msg = Msg.getMsg(Env.getCtx(), "SessionTimeoutText").trim(); //IDEMPIERE-847 String msg = Msg.getMsg(Env.getCtx(), "SessionTimeoutText").trim(); //IDEMPIERE-847
String continueNsg = Msg.getMsg(Env.getCtx(), "continue").trim(); //IDEMPIERE-847 String continueNsg = Msg.getMsg(Env.getCtx(), "continue").trim(); //IDEMPIERE-847
@ -688,6 +705,9 @@ public class LoginPanel extends Window implements EventListener<Event>
return s; return s;
} }
/**
* Handle reset password event
*/
private void btnResetPasswordClicked() private void btnResetPasswordClicked()
{ {
String userId = Login.getAppUser(txtUserId.getValue()); String userId = Login.getAppUser(txtUserId.getValue());
@ -725,7 +745,10 @@ public class LoginPanel extends Window implements EventListener<Event>
wndLogin.resetPassword(userId, users.size() == 0); wndLogin.resetPassword(userId, users.size() == 0);
} }
/** get default languages from the browser */ /**
* Get default languages from the browser
* @param header
*/
private List<String> browserLanguages(String header) { private List<String> browserLanguages(String header) {
List<String> arrstr = new ArrayList<String>(); List<String> arrstr = new ArrayList<String>();
if (header == null) if (header == null)

View File

@ -25,33 +25,45 @@ import org.zkoss.zul.Checkbox;
import org.zkoss.zul.Toolbar; import org.zkoss.zul.Toolbar;
/** /**
* Menu Search Panel * Panel with {@link MenuTreeSearchPanel}.
* @author Elaine * @author Elaine
* @date July 31, 2012 * @date July 31, 2012
*/ */
public class MenuSearchPanel extends AbstractMenuPanel public class MenuSearchPanel extends AbstractMenuPanel
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = 5308522340852904168L; private static final long serialVersionUID = 5308522340852904168L;
protected MenuTreeSearchPanel pnlSearch; protected MenuTreeSearchPanel pnlSearch;
/** Listener for MENU_TREE_FILTER_CHECKED_QUEUE desktop event queue */
private EventListener<Event> listener; private EventListener<Event> listener;
/**
* @param parent
*/
public MenuSearchPanel(Component parent) public MenuSearchPanel(Component parent)
{ {
super(parent); super(parent);
this.setSclass("menu-search-panel-container"); this.setSclass("menu-search-panel-container");
} }
/**
* Layout panel
*/
@Override
protected void init() protected void init()
{ {
super.init(); super.init();
pnlSearch.initialise(); pnlSearch.initialise();
} }
/**
* Create components
*/
@Override
protected void initComponents() protected void initComponents()
{ {
super.initComponents(); super.initComponents();

View File

@ -1,3 +1,27 @@
/***********************************************************************
* This file is part of iDempiere ERP Open Source *
* http://www.idempiere.org *
* *
* Copyright (C) Contributors *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* 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., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301, USA. *
* *
* Contributors: *
* - Elaine Tan *
**********************************************************************/
package org.adempiere.webui.panel; package org.adempiere.webui.panel;
import java.util.List; import java.util.List;
@ -21,6 +45,9 @@ import org.zkoss.zul.Treechildren;
import org.zkoss.zul.Treeitem; import org.zkoss.zul.Treeitem;
import org.zkoss.zul.Vbox; import org.zkoss.zul.Vbox;
/**
* Popup panel with menu type filter and flat view toggle for a tree.
*/
public class MenuTreeFilterPanel extends Popup implements EventListener<Event>, IdSpace { public class MenuTreeFilterPanel extends Popup implements EventListener<Event>, IdSpace {
private static final String ORIGINAL_SIBLING = "original.sibling"; private static final String ORIGINAL_SIBLING = "original.sibling";
@ -31,12 +58,17 @@ public class MenuTreeFilterPanel extends Popup implements EventListener<Event>,
public static final String MENU_TREE_FILTER_CHECKED_QUEUE = "MENU_TREE_FILTER_CHECKED_QUEUE"; public static final String MENU_TREE_FILTER_CHECKED_QUEUE = "MENU_TREE_FILTER_CHECKED_QUEUE";
/** Tree to apply menu type filter and flat view toggle */
private Tree tree; private Tree tree;
@SuppressWarnings("unused") @SuppressWarnings("unused")
private TreeSearchPanel searchPanel; private TreeSearchPanel searchPanel;
private Checkbox flatView; private Checkbox flatView;
/**
* @param tree
* @param panel
*/
public MenuTreeFilterPanel(Tree tree, TreeSearchPanel panel) { public MenuTreeFilterPanel(Tree tree, TreeSearchPanel panel) {
super(); super();
this.tree = tree; this.tree = tree;
@ -114,6 +146,7 @@ public class MenuTreeFilterPanel extends Popup implements EventListener<Event>,
appendChild(box); appendChild(box);
} }
@Override
public void onEvent(Event event) throws Exception { public void onEvent(Event event) throws Exception {
final Checkbox chk = (Checkbox) event.getTarget(); final Checkbox chk = (Checkbox) event.getTarget();
EventQueues.lookup(MENU_TREE_FILTER_CHECKED_QUEUE, EventQueues.DESKTOP, true).publish(new Event(Events.ON_CHECK, null, chk)); EventQueues.lookup(MENU_TREE_FILTER_CHECKED_QUEUE, EventQueues.DESKTOP, true).publish(new Event(Events.ON_CHECK, null, chk));
@ -130,7 +163,7 @@ public class MenuTreeFilterPanel extends Popup implements EventListener<Event>,
} }
/** /**
* * Turn flat view on/off for tree
* @param tree * @param tree
* @param chk checkbox for flat view toggle * @param chk checkbox for flat view toggle
*/ */
@ -236,6 +269,11 @@ public class MenuTreeFilterPanel extends Popup implements EventListener<Event>,
}); });
} }
/**
* Put treeItem back to its original position in tree
* @param treechildren
* @param treeItem
*/
private static void reattachSibling(Treechildren treechildren, Treeitem treeItem) { private static void reattachSibling(Treechildren treechildren, Treeitem treeItem) {
Treeitem sibling = (Treeitem) treeItem.getAttribute(ORIGINAL_SIBLING); Treeitem sibling = (Treeitem) treeItem.getAttribute(ORIGINAL_SIBLING);
if (sibling != null) if (sibling != null)
@ -245,6 +283,12 @@ public class MenuTreeFilterPanel extends Popup implements EventListener<Event>,
treechildren.insertBefore(treeItem, sibling); treechildren.insertBefore(treeItem, sibling);
} }
/**
* Find next sibling that's of same menu type (sorted by label).
* @param treechildren
* @param treeItem
* @return Next sibling or null
*/
private static Component findFlatViewSibling(Treechildren treechildren, Treeitem treeItem) { private static Component findFlatViewSibling(Treechildren treechildren, Treeitem treeItem) {
List<Component> childrens = treechildren.getChildren(); List<Component> childrens = treechildren.getChildren();
if (childrens.isEmpty()) { if (childrens.isEmpty()) {
@ -274,6 +318,11 @@ public class MenuTreeFilterPanel extends Popup implements EventListener<Event>,
return null; return null;
} }
/**
* Handle menu type toggle
* @param tree
* @param chk
*/
public static void toggle(Tree tree, final Checkbox chk) { public static void toggle(Tree tree, final Checkbox chk) {
TreeUtils.traverse(tree, new TreeItemAction() { TreeUtils.traverse(tree, new TreeItemAction() {
public void run(Treeitem treeItem) { public void run(Treeitem treeItem) {

View File

@ -35,14 +35,15 @@ import org.zkoss.zul.Toolbar;
import org.zkoss.zul.Toolbarbutton; import org.zkoss.zul.Toolbarbutton;
/** /**
* Menu Tree Panel * Menu tree panel. <br/>
* Consist of Tree, expand toggle and {@link MenuTreeFilterPanel}.
* @author Elaine * @author Elaine
* @date July 31, 2012 * @date July 31, 2012
*/ */
public class MenuTreePanel extends AbstractMenuPanel public class MenuTreePanel extends AbstractMenuPanel
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = -911113870835089567L; private static final long serialVersionUID = -911113870835089567L;
private static final String ON_EXPAND_MENU_EVENT = "onExpandMenu"; private static final String ON_EXPAND_MENU_EVENT = "onExpandMenu";
@ -69,7 +70,6 @@ public class MenuTreePanel extends AbstractMenuPanel
// Auto Expand Tree - nmicoud IDEMPIERE 195 // Auto Expand Tree - nmicoud IDEMPIERE 195
if (MUser.get(getCtx()).isMenuAutoExpand()) if (MUser.get(getCtx()).isMenuAutoExpand())
expandAll(); expandAll();
// Auto Expand Tree - nmicoud IDEMPIERE 195
listener = new EventListener<Event>() { listener = new EventListener<Event>() {
public void onEvent(Event event) throws Exception { public void onEvent(Event event) throws Exception {
@ -104,7 +104,6 @@ public class MenuTreePanel extends AbstractMenuPanel
this.appendChild(pc); this.appendChild(pc);
pc.appendChild(getMenuTree()); pc.appendChild(getMenuTree());
// Elaine 2009/02/27 - expand tree
Toolbar toolbar = new Toolbar(); Toolbar toolbar = new Toolbar();
toolbar.setSclass("desktop-menu-toolbar"); toolbar.setSclass("desktop-menu-toolbar");
this.appendChild(toolbar); this.appendChild(toolbar);
@ -135,7 +134,6 @@ public class MenuTreePanel extends AbstractMenuPanel
super.onEvent(event); super.onEvent(event);
String eventName = event.getName(); String eventName = event.getName();
// Elaine 2009/02/27 - expand tree
if (eventName.equals(Events.ON_CHECK) && event.getTarget() == expandToggle) if (eventName.equals(Events.ON_CHECK) && event.getTarget() == expandToggle)
{ {
Clients.showBusy(null); Clients.showBusy(null);

View File

@ -42,7 +42,7 @@ import org.zkoss.zul.Treeitem;
*/ */
public class MenuTreeSearchPanel extends TreeSearchPanel { public class MenuTreeSearchPanel extends TreeSearchPanel {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = 3127547233019932429L; private static final long serialVersionUID = 3127547233019932429L;
@ -50,14 +50,27 @@ public class MenuTreeSearchPanel extends TreeSearchPanel {
protected Toolbarbutton openBtn; protected Toolbarbutton openBtn;
protected boolean isNew = false; protected boolean isNew = false;
/**
* @param tree
* @param event
* @param windowno
* @param tabno
*/
public MenuTreeSearchPanel(Tree tree, String event, int windowno, int tabno) { public MenuTreeSearchPanel(Tree tree, String event, int windowno, int tabno) {
super(tree, event, windowno, tabno); super(tree, event, windowno, tabno);
} }
/**
* @param tree
* @param event
*/
public MenuTreeSearchPanel(Tree tree, String event) { public MenuTreeSearchPanel(Tree tree, String event) {
super(tree, event); super(tree, event);
} }
/**
* @param tree
*/
public MenuTreeSearchPanel(Tree tree) { public MenuTreeSearchPanel(Tree tree) {
super(tree); super(tree);
} }
@ -81,6 +94,9 @@ public class MenuTreeSearchPanel extends TreeSearchPanel {
layout.insertBefore(hlayout, layout.getFirstChild()); layout.insertBefore(hlayout, layout.getFirstChild());
} }
/**
* Create toolbar button to launch a menu item
*/
protected void createOpenButton() { protected void createOpenButton() {
openBtn = new Toolbarbutton(); openBtn = new Toolbarbutton();
if (ThemeManager.isUseFontIconForImage()) if (ThemeManager.isUseFontIconForImage())
@ -103,6 +119,9 @@ public class MenuTreeSearchPanel extends TreeSearchPanel {
openBtn.setTooltiptext(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Open"))); openBtn.setTooltiptext(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Open")));
} }
/**
* Create toolbar button to create new record for a menu item
*/
protected void createNewButton() { protected void createNewButton() {
newBtn = new Toolbarbutton(); newBtn = new Toolbarbutton();
if (ThemeManager.isUseFontIconForImage()) if (ThemeManager.isUseFontIconForImage())
@ -145,6 +164,9 @@ public class MenuTreeSearchPanel extends TreeSearchPanel {
refreshAutoComplete(); refreshAutoComplete();
} }
/**
* Refresh auto complete items for {@link #cmbSearch}
*/
protected void refreshAutoComplete() { protected void refreshAutoComplete() {
List<String> valueList = new ArrayList<String>(); List<String> valueList = new ArrayList<String>();
List<String> descriptionList = new ArrayList<String>(); List<String> descriptionList = new ArrayList<String>();
@ -228,6 +250,9 @@ public class MenuTreeSearchPanel extends TreeSearchPanel {
Events.echoEvent(ON_POST_FIRE_TREE_EVENT, this, null); Events.echoEvent(ON_POST_FIRE_TREE_EVENT, this, null);
} }
/**
* Sort the values, descriptions and images list for menu items
*/
protected void orderArrays() protected void orderArrays()
{ {
String aux; String aux;

View File

@ -69,15 +69,15 @@ import org.zkoss.zul.Vbox;
*/ */
public class QuickCustomizeGridViewPanel extends Panel { public class QuickCustomizeGridViewPanel extends Panel {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = 7566420005952940208L; private static final long serialVersionUID = 7566420005952940208L;
static CLogger log = CLogger.getCLogger(QuickCustomizeGridViewPanel.class); static CLogger log = CLogger.getCLogger(QuickCustomizeGridViewPanel.class);
private Map <Integer, String> m_columnsWidth; private Map <Integer, String> m_columnsWidth;
ArrayList <Integer> tableSeqs; protected ArrayList <Integer> tableSeqs;
QuickGridView gridview = null; protected QuickGridView gridview = null;
private int m_WindowNo; private int m_WindowNo;
private int m_AD_Tab_ID; private int m_AD_Tab_ID;
@ -91,15 +91,14 @@ public class QuickCustomizeGridViewPanel extends Panel {
private Checkbox chkSaveWidth = new Checkbox(); private Checkbox chkSaveWidth = new Checkbox();
SimpleListModel yesModel = new SimpleListModel(); protected SimpleListModel yesModel = new SimpleListModel();
Listbox yesList = new Listbox(); protected Listbox yesList = new Listbox();
private boolean uiCreated; private boolean uiCreated;
private boolean m_saved = false; private boolean m_saved = false;
private ConfirmPanel confirmPanel = new ConfirmPanel(true, false, true, false, false, false); private ConfirmPanel confirmPanel = new ConfirmPanel(true, false, true, false, false, false);
/** /**
* Sort Tab Constructor
* @param WindowNo Window No * @param WindowNo Window No
* @param AD_Tab_ID * @param AD_Tab_ID
* @param AD_User_ID * @param AD_User_ID
@ -117,7 +116,7 @@ public class QuickCustomizeGridViewPanel extends Panel {
} }
/** /**
* Static Layout * Layout dialog
* *
* @throws Exception * @throws Exception
*/ */
@ -223,6 +222,9 @@ public class QuickCustomizeGridViewPanel extends Panel {
} // init } // init
/**
* Load fields
*/
public void loadData() { public void loadData() {
MTabCustomization tabCust = MTabCustomization.get(Env.getCtx(), m_AD_User_ID, m_AD_Tab_ID, null,true); MTabCustomization tabCust = MTabCustomization.get(Env.getCtx(), m_AD_User_ID, m_AD_Tab_ID, null,true);
boolean baseLanguage = Env.isBaseLanguage(Env.getCtx(), "AD_Field"); boolean baseLanguage = Env.isBaseLanguage(Env.getCtx(), "AD_Field");
@ -280,7 +282,13 @@ public class QuickCustomizeGridViewPanel extends Panel {
chkSaveWidth.setChecked(true); chkSaveWidth.setChecked(true);
} // loadData } // loadData
void migrateLists(Listbox listFrom, Listbox listTo, int endIndex) { /**
* Move selected items from listFrom to listTo
* @param listFrom
* @param listTo
* @param endIndex
*/
protected void migrateLists(Listbox listFrom, Listbox listTo, int endIndex) {
int index = 0; int index = 0;
SimpleListModel lmFrom = (SimpleListModel) listFrom.getModel(); SimpleListModel lmFrom = (SimpleListModel) listFrom.getModel();
SimpleListModel lmTo = (SimpleListModel) listTo.getModel(); SimpleListModel lmTo = (SimpleListModel) listTo.getModel();
@ -309,7 +317,7 @@ public class QuickCustomizeGridViewPanel extends Panel {
* *
* @param event event * @param event event
*/ */
void migrateValueWithinYesList(int endIndex, List<ListElement> selObjects) { protected void migrateValueWithinYesList(int endIndex, List<ListElement> selObjects) {
int iniIndex = 0; int iniIndex = 0;
Arrays.sort(selObjects.toArray()); Arrays.sort(selObjects.toArray());
ListElement endObject = (ListElement) yesModel.getElementAt(endIndex); ListElement endObject = (ListElement) yesModel.getElementAt(endIndex);
@ -327,7 +335,7 @@ public class QuickCustomizeGridViewPanel extends Panel {
* *
* @param event event * @param event event
*/ */
void migrateValueWithinYesList(Event event) { protected void migrateValueWithinYesList(Event event) {
Object[] selObjects = yesList.getSelectedItems().toArray(); Object[] selObjects = yesList.getSelectedItems().toArray();
if (selObjects == null) if (selObjects == null)
@ -385,6 +393,9 @@ public class QuickCustomizeGridViewPanel extends Panel {
} }
} // migrateValueWithinYesList } // migrateValueWithinYesList
/**
* Save changes
*/
public void saveData() { public void saveData() {
// yesList // yesList
// int index = 0; // int index = 0;
@ -429,11 +440,18 @@ public class QuickCustomizeGridViewPanel extends Panel {
} }
} // saveData } // saveData
/**
* Activate dialog. Layout dialog during first activation.
* @param b
*/
public void activate(boolean b) { public void activate(boolean b) {
if (b && !uiCreated) if (b && !uiCreated)
createUI(); createUI();
} }
/**
* Layout dialog
*/
public void createUI() { public void createUI() {
if (uiCreated) if (uiCreated)
return; return;
@ -445,10 +463,16 @@ public class QuickCustomizeGridViewPanel extends Panel {
uiCreated = true; uiCreated = true;
} }
/**
* @return true if changes have been saved
*/
public boolean isSaved() { public boolean isSaved() {
return m_saved; return m_saved;
} }
/**
* @param quickGridView
*/
public void setGridPanel(QuickGridView quickGridView) { public void setGridPanel(QuickGridView quickGridView) {
this.gridview = quickGridView; this.gridview = quickGridView;
} }

View File

@ -25,10 +25,11 @@ import org.adempiere.webui.component.Panel;
* @date Mar 3, 2007 * @date Mar 3, 2007
* @version $Revision: 0.10 $ * @version $Revision: 0.10 $
*/ */
@Deprecated(forRemoval = true, since = "11")
public class RequestNoticePanel extends Panel public class RequestNoticePanel extends Panel
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = 2530869089383947019L; private static final long serialVersionUID = 2530869089383947019L;

View File

@ -65,7 +65,7 @@ import org.zkoss.zul.Image;
public class ResetPasswordPanel extends Window implements EventListener<Event> public class ResetPasswordPanel extends Window implements EventListener<Event>
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = -657724758165769510L; private static final long serialVersionUID = -657724758165769510L;
@ -98,6 +98,12 @@ public class ResetPasswordPanel extends Window implements EventListener<Event>
protected Textbox txtUserId; protected Textbox txtUserId;
protected Textbox txtEmail; protected Textbox txtEmail;
/**
* @param ctx
* @param loginWindow
* @param userName
* @param noSecurityQuestion
*/
public ResetPasswordPanel(Properties ctx, LoginWindow loginWindow, String userName, boolean noSecurityQuestion) public ResetPasswordPanel(Properties ctx, LoginWindow loginWindow, String userName, boolean noSecurityQuestion)
{ {
this.wndLogin = loginWindow; this.wndLogin = loginWindow;
@ -114,11 +120,17 @@ public class ResetPasswordPanel extends Window implements EventListener<Event>
loadData(); loadData();
} }
/**
* Layout panel
*/
private void init() private void init()
{ {
createUI(); createUI();
} }
/**
* Layout panel
*/
protected void createUI() { protected void createUI() {
Div div = new Div(); Div div = new Div();
div.setSclass(ITheme.LOGIN_BOX_HEADER_CLASS); div.setSclass(ITheme.LOGIN_BOX_HEADER_CLASS);
@ -216,6 +228,9 @@ public class ResetPasswordPanel extends Window implements EventListener<Event>
this.appendChild(div); this.appendChild(div);
} }
/**
* Create components
*/
private void initComponents() private void initComponents()
{ {
lblEmail = new Label(); lblEmail = new Label();
@ -260,7 +275,6 @@ public class ResetPasswordPanel extends Window implements EventListener<Event>
txtAnswer = new Textbox(); txtAnswer = new Textbox();
txtAnswer.setType("password"); txtAnswer.setType("password");
txtAnswer.setId("txtAnswer"); txtAnswer.setId("txtAnswer");
// txtAnswer.setType("password");
txtAnswer.setCols(25); txtAnswer.setCols(25);
ZKUpdateUtil.setWidth(txtAnswer, "220px"); ZKUpdateUtil.setWidth(txtAnswer, "220px");
txtAnswer.setReadonly(true); txtAnswer.setReadonly(true);
@ -278,6 +292,9 @@ public class ResetPasswordPanel extends Window implements EventListener<Event>
} }
} }
/**
* Load security question from AD_User
*/
protected void loadSecurityQuestion() protected void loadSecurityQuestion()
{ {
String email = txtEmail.getValue(); String email = txtEmail.getValue();
@ -313,6 +330,7 @@ public class ResetPasswordPanel extends Window implements EventListener<Event>
txtAnswer.setVisible(true); txtAnswer.setVisible(true);
} }
@Override
public void onEvent(Event event) public void onEvent(Event event)
{ {
if (event.getTarget().getId().equals(ConfirmPanel.A_OK)) if (event.getTarget().getId().equals(ConfirmPanel.A_OK))
@ -322,10 +340,12 @@ public class ResetPasswordPanel extends Window implements EventListener<Event>
else if (event.getTarget().getId().equals(ConfirmPanel.A_CANCEL)) else if (event.getTarget().getId().equals(ConfirmPanel.A_CANCEL))
{ {
SessionManager.logoutSession(); SessionManager.logoutSession();
//wndLogin.loginCancelled();
} }
} }
/**
* Validate fields
*/
public void validate (){ public void validate (){
Clients.clearBusy(); Clients.clearBusy();
@ -335,6 +355,9 @@ public class ResetPasswordPanel extends Window implements EventListener<Event>
validateResetPassword(); validateResetPassword();
} }
/**
* validate user name and email
*/
protected void validateEmail() protected void validateEmail()
{ {
String email = txtEmail.getValue(); String email = txtEmail.getValue();
@ -365,6 +388,9 @@ public class ResetPasswordPanel extends Window implements EventListener<Event>
loadSecurityQuestion(); loadSecurityQuestion();
} }
/**
* validate fields and reset password
*/
protected void validateResetPassword() protected void validateResetPassword()
{ {
String email = txtEmail.getValue(); String email = txtEmail.getValue();
@ -493,13 +519,18 @@ public class ResetPasswordPanel extends Window implements EventListener<Event>
@Override @Override
public void onCallback(Integer result) { public void onCallback(Integer result) {
SessionManager.logoutSession(); SessionManager.logoutSession();
//wndLogin.loginCancelled();
} }
}); });
} }
} }
/**
* Send reset password email to user
* @param to
* @param newPassword
* @return true if email successfully sent
*/
protected boolean sendEmail(MUser to, String newPassword) protected boolean sendEmail(MUser to, String newPassword)
{ {
MClient client = MClient.get(m_ctx, 0);//change by: IDEMPIERE-1267 Temp password from "Forgot My Password" does not work MClient client = MClient.get(m_ctx, 0);//change by: IDEMPIERE-1267 Temp password from "Forgot My Password" does not work

View File

@ -73,7 +73,7 @@ import org.zkoss.zul.Div;
import org.zkoss.zul.Image; import org.zkoss.zul.Image;
/** /**
* * Select role panel
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a> * @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @date Feb 25, 2007 * @date Feb 25, 2007
* @version $Revision: 0.10 $ * @version $Revision: 0.10 $
@ -83,7 +83,7 @@ import org.zkoss.zul.Image;
public class RolePanel extends Window implements EventListener<Event>, Deferrable public class RolePanel extends Window implements EventListener<Event>, Deferrable
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = -1159253307008488232L; private static final long serialVersionUID = -1159253307008488232L;
@ -124,6 +124,14 @@ public class RolePanel extends Window implements EventListener<Event>, Deferrabl
private static final String ON_DEFER_LOGOUT = "onDeferLogout"; private static final String ON_DEFER_LOGOUT = "onDeferLogout";
/**
* @param ctx
* @param loginWindow
* @param userName
* @param show
* @param clientsKNPairs
* @param isClientDefined
*/
public RolePanel(Properties ctx, LoginWindow loginWindow, String userName, boolean show, KeyNamePair[] clientsKNPairs, boolean isClientDefined) { public RolePanel(Properties ctx, LoginWindow loginWindow, String userName, boolean show, KeyNamePair[] clientsKNPairs, boolean isClientDefined) {
this.wndLogin = loginWindow; this.wndLogin = loginWindow;
m_ctx = ctx; m_ctx = ctx;
@ -140,7 +148,6 @@ public class RolePanel extends Window implements EventListener<Event>, Deferrabl
m_userpreference.loadPreference(user.get_ID()); m_userpreference.loadPreference(user.get_ID());
} }
initComponents(); initComponents();
init(); init();
this.setId("rolePanel"); this.setId("rolePanel");
@ -167,12 +174,18 @@ public class RolePanel extends Window implements EventListener<Event>, Deferrabl
} }
} }
/**
* Layout panel
*/
private void init() private void init()
{ {
Clients.response(new AuScript("zAu.cmd0.clearBusy()")); Clients.response(new AuScript("zAu.cmd0.clearBusy()"));
createUI(); createUI();
} }
/**
* Layout panel
*/
protected void createUI() { protected void createUI() {
Div div = new Div(); Div div = new Div();
div.setSclass(ITheme.LOGIN_BOX_HEADER_CLASS); div.setSclass(ITheme.LOGIN_BOX_HEADER_CLASS);
@ -293,6 +306,9 @@ public class RolePanel extends Window implements EventListener<Event>, Deferrabl
this.appendChild(div); this.appendChild(div);
} }
/**
* Create components
*/
private void initComponents() private void initComponents()
{ {
Language language = Env.getLanguage(m_ctx); Language language = Env.getLanguage(m_ctx);
@ -406,6 +422,9 @@ public class RolePanel extends Window implements EventListener<Event>, Deferrabl
component.addEventListener(ON_DEFER_LOGOUT, this); component.addEventListener(ON_DEFER_LOGOUT, this);
} }
/**
* Update roles available for selection (after selection of tenant)
*/
private void updateRoleList() private void updateRoleList()
{ {
lstRole.getItems().clear(); lstRole.getItems().clear();
@ -457,6 +476,9 @@ public class RolePanel extends Window implements EventListener<Event>, Deferrabl
updateOrganisationList(); updateOrganisationList();
} }
/**
* After organizations available for selection (after selection of role)
*/
private void updateOrganisationList() private void updateOrganisationList()
{ {
lstOrganisation.getItems().clear(); lstOrganisation.getItems().clear();
@ -507,6 +529,9 @@ public class RolePanel extends Window implements EventListener<Event>, Deferrabl
updateWarehouseList(); updateWarehouseList();
} }
/**
* Update list of warehouse available for selection (after selection of organization)
*/
private void updateWarehouseList() private void updateWarehouseList()
{ {
lstWarehouse.getItems().clear(); lstWarehouse.getItems().clear();
@ -542,6 +567,7 @@ public class RolePanel extends Window implements EventListener<Event>, Deferrabl
} }
} }
@Override
public void onEvent(Event event) public void onEvent(Event event)
{ {
String eventCompId = event.getTarget().getId(); String eventCompId = event.getTarget().getId();
@ -603,6 +629,9 @@ public class RolePanel extends Window implements EventListener<Event>, Deferrabl
} }
} }
/**
* Set user id to environment context
*/
private void setUserID() { private void setUserID() {
if (lstClient.getSelectedItem() != null) { if (lstClient.getSelectedItem() != null) {
Env.setContext(m_ctx, Env.AD_CLIENT_ID, (String) lstClient.getSelectedItem().getValue()); Env.setContext(m_ctx, Env.AD_CLIENT_ID, (String) lstClient.getSelectedItem().getValue());
@ -638,10 +667,10 @@ public class RolePanel extends Window implements EventListener<Event>, Deferrabl
} }
/** /**
* validate Roles * Validate fields
* @param isMFAValidated * @param isMFAValidated
* *
**/ */
public void validateRoles(boolean isMFAValidated) public void validateRoles(boolean isMFAValidated)
{ {
Clients.clearBusy(); Clients.clearBusy();
@ -708,10 +737,14 @@ public class RolePanel extends Window implements EventListener<Event>, Deferrabl
wndLogin.validateMFA(orgKNPair, m_isClientDefined, m_userName, m_showRolePanel, m_clientKNPairs); wndLogin.validateMFA(orgKNPair, m_isClientDefined, m_userName, m_showRolePanel, m_clientKNPairs);
} }
@Override
public boolean isDeferrable() { public boolean isDeferrable() {
return false; return false;
} }
/**
* @return true if role selection panel will be shown to user
*/
public boolean show() { public boolean show() {
return m_showRolePanel; return m_showRolePanel;
} }

View File

@ -45,9 +45,6 @@ import org.zkoss.zul.West;
import org.zkoss.zul.Borderlayout; import org.zkoss.zul.Borderlayout;
/** /**
* This class is based on org.compiere.apps.StatusBar written by Jorg Janke.
* @author Jorg Janke
*
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a> * @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @date Mar 12, 2007 * @date Mar 12, 2007
* @version $Revision: 0.10 $ * @version $Revision: 0.10 $
@ -55,7 +52,7 @@ import org.zkoss.zul.Borderlayout;
public class StatusBarPanel extends Panel implements EventListener<Event>, IStatusBar public class StatusBarPanel extends Panel implements EventListener<Event>, IStatusBar
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = 1217160210065925924L; private static final long serialVersionUID = 1217160210065925924L;
@ -82,12 +79,18 @@ public class StatusBarPanel extends Panel implements EventListener<Event>, IStat
private Div popupContent; private Div popupContent;
private String popupStyle; private String popupStyle;
/**
* Default constructor
*/
public StatusBarPanel() public StatusBarPanel()
{ {
super(); super();
init(); init();
} }
/**
* Layout panel
*/
private void init() private void init()
{ {
setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "statusBar"); setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "statusBar");
@ -239,6 +242,9 @@ public class StatusBarPanel extends Panel implements EventListener<Event>, IStat
return statusLine.getValue(); return statusLine.getValue();
} }
/**
* Create popup for status line
*/
private void createPopup() { private void createPopup() {
popupContent = new Div(); popupContent = new Div();
@ -250,11 +256,15 @@ public class StatusBarPanel extends Panel implements EventListener<Event>, IStat
popup.setStyle("position: absolute; display: none"); popup.setStyle("position: absolute; display: none");
} }
/**
* Show status line popup
*/
private void showPopup() { private void showPopup() {
popup.setVisible(true); popup.setVisible(true);
popup.setStyle(popupStyle); popup.setStyle(popupStyle);
if (getRoot() == null || !getRoot().isVisible() ) return; if (getRoot() == null || !getRoot().isVisible() ) return;
//client side script to position popup
String script = "(function(){let d = zk.Widget.$('" + popup.getUuid() + "').$n();"; String script = "(function(){let d = zk.Widget.$('" + popup.getUuid() + "').$n();";
script += "d.style.display='block';d.style.visibility='hidden';"; script += "d.style.display='block';d.style.visibility='hidden';";
script += "let dhs = document.defaultView.getComputedStyle(d, null).getPropertyValue('height');"; script += "let dhs = document.defaultView.getComputedStyle(d, null).getPropertyValue('height');";
@ -297,6 +307,9 @@ public class StatusBarPanel extends Panel implements EventListener<Event>, IStat
invalidate(); invalidate();
} // setInfo } // setInfo
/**
* @param rowNum
*/
public void setSelectedRowNumber (String rowNum){ public void setSelectedRowNumber (String rowNum){
selectedLine.setVisible(rowNum != null); selectedLine.setVisible(rowNum != null);
if (rowNum != null){ if (rowNum != null){
@ -305,6 +318,7 @@ public class StatusBarPanel extends Panel implements EventListener<Event>, IStat
invalidate(); invalidate();
} }
@Override
public void onEvent(Event event) throws Exception { public void onEvent(Event event) throws Exception {
if (Events.ON_CLICK.equals(event.getName()) && event.getTarget() == statusDB) if (Events.ON_CLICK.equals(event.getName()) && event.getTarget() == statusDB)
{ {

View File

@ -32,15 +32,18 @@ import org.zkoss.zul.South;
import org.zkoss.zul.Timer; import org.zkoss.zul.Timer;
import org.zkoss.zul.Vlayout; import org.zkoss.zul.Vlayout;
import org.zkoss.zul.Window; import org.zkoss.zul.Window;
/** /**
* * session timeout counter window
* @author Deepak Pansheriya * @author Deepak Pansheriya
* *
*/ */
public class TimeoutPanel extends Window implements public class TimeoutPanel extends Window implements
org.zkoss.zk.ui.event.EventListener<Event> { org.zkoss.zk.ui.event.EventListener<Event> {
/**
* generated serial id
*/
private static final long serialVersionUID = -2734157789771800337L; private static final long serialVersionUID = -2734157789771800337L;
private Timer timer = null; private Timer timer = null;
private int count = 0; private int count = 0;
@ -48,11 +51,14 @@ public class TimeoutPanel extends Window implements
private Label ltime = null; private Label ltime = null;
private Timer timerJS = null; private Timer timerJS = null;
/**
* @param pnlHead
* @param timeInSecond
*/
public TimeoutPanel(HeaderPanel pnlHead, int timeInSecond) { public TimeoutPanel(HeaderPanel pnlHead, int timeInSecond) {
count = timeInSecond; count = timeInSecond;
pnlHead.appendChild(this); pnlHead.appendChild(this);
Borderlayout layout = new Borderlayout(); Borderlayout layout = new Borderlayout();
layout.setParent(this); layout.setParent(this);
@ -81,16 +87,13 @@ public class TimeoutPanel extends Window implements
centerVlayout.setParent(center); centerVlayout.setParent(center);
centerVlayout.setStyle("height:100%; text-align: center;"); centerVlayout.setStyle("height:100%; text-align: center;");
South south = new South(); South south = new South();
south.setParent(layout); south.setParent(layout);
Div divSouth = new Div(); Div divSouth = new Div();
divSouth.setParent(south); divSouth.setParent(south);
divSouth.setStyle("height:100%; text-align: center;"); divSouth.setStyle("height:100%; text-align: center;");
timer = new Timer(); timer = new Timer();
timer.setDelay((count * 1000)); timer.setDelay((count * 1000));
timer.addEventListener(Events.ON_TIMER, this); timer.addEventListener(Events.ON_TIMER, this);
@ -98,7 +101,6 @@ public class TimeoutPanel extends Window implements
timer.start(); timer.start();
centerVlayout.appendChild(timer); centerVlayout.appendChild(timer);
Script jScript = new Script("var countJS = "+count+";"); Script jScript = new Script("var countJS = "+count+";");
jScript.setDynamicProperty("defer","true"); jScript.setDynamicProperty("defer","true");
jScript.setParent(centerVlayout); jScript.setParent(centerVlayout);
@ -121,16 +123,13 @@ public class TimeoutPanel extends Window implements
ltime.setParent(centerVlayout); ltime.setParent(centerVlayout);
ltime.setStyle("text-align: center; font-size: 40px; color:red;"); ltime.setStyle("text-align: center; font-size: 40px; color:red;");
Html txtLbl = new Html(Msg.getMsg(Env.getCtx(),"Minutes")+"&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;"+Msg.getMsg(Env.getCtx(),"Seconds")); Html txtLbl = new Html(Msg.getMsg(Env.getCtx(),"Minutes")+"&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;"+Msg.getMsg(Env.getCtx(),"Seconds"));
txtLbl.setParent(centerVlayout); txtLbl.setParent(centerVlayout);
txtLbl.setStyle("font-size: 12px;"); txtLbl.setStyle("font-size: 12px;");
Vlayout vLayout = new Vlayout(); Vlayout vLayout = new Vlayout();
vLayout.setParent(divSouth); vLayout.setParent(divSouth);
Label saveLbl = new Label(Msg.getMsg(Env.getCtx(),"killsession.saveWorkMessage")); Label saveLbl = new Label(Msg.getMsg(Env.getCtx(),"killsession.saveWorkMessage"));
saveLbl.setParent(vLayout); saveLbl.setParent(vLayout);
saveLbl.setStyle("font-size: 20px;"); saveLbl.setStyle("font-size: 20px;");

View File

@ -22,6 +22,7 @@ import java.util.Set;
import java.util.TreeMap; import java.util.TreeMap;
import org.adempiere.webui.ClientInfo; import org.adempiere.webui.ClientInfo;
import org.adempiere.webui.adwindow.ADTreePanel;
import org.adempiere.webui.apps.AEnv; import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.component.AutoComplete; import org.adempiere.webui.component.AutoComplete;
import org.adempiere.webui.component.Label; import org.adempiere.webui.component.Label;
@ -61,7 +62,8 @@ import org.zkoss.zul.impl.LabelElement;
import org.zkoss.zul.impl.LabelImageElement; import org.zkoss.zul.impl.LabelImageElement;
/** /**
* * Panel with combo search box for menu tree. <br/>
* Use by {@link ADTreePanel}.
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a> * @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @date Mar 3, 2007 * @date Mar 3, 2007
* @version $Revision: 0.10 $ * @version $Revision: 0.10 $
@ -71,14 +73,16 @@ public class TreeSearchPanel extends Panel implements EventListener<Event>, Tree
public static final String TREE_ROW_MOVABLE = "tree.row.movable"; public static final String TREE_ROW_MOVABLE = "tree.row.movable";
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = -1659100374345282774L; private static final long serialVersionUID = -1659100374345282774L;
private static final String ON_COMBO_SELECT_ECHO_EVENT = "onComboSelectEcho"; private static final String ON_COMBO_SELECT_ECHO_EVENT = "onComboSelectEcho";
private static final String ON_POST_SELECT_TREEITEM_EVENT = "onPostSelectTreeitem"; private static final String ON_POST_SELECT_TREEITEM_EVENT = "onPostSelectTreeitem";
protected static final String ON_POST_FIRE_TREE_EVENT = "onPostFireTreeEvent"; protected static final String ON_POST_FIRE_TREE_EVENT = "onPostFireTreeEvent";
/** <label>.<menuType> : TreeItem or Name : DefaultTreeNode */
protected TreeMap<String, Object> treeNodeItemMap = new TreeMap<String, Object>(); protected TreeMap<String, Object> treeNodeItemMap = new TreeMap<String, Object>();
//values for combo auto complete
protected String[] treeValues; protected String[] treeValues;
protected String[] treeTypes; protected String[] treeTypes;
protected String[] treeDescription; protected String[] treeDescription;
@ -144,6 +148,9 @@ public class TreeSearchPanel extends Panel implements EventListener<Event>, Tree
+ "let evt = new zk.Event(panel, 'onComboSelectEcho', [comboitem.uuid, popupheight], {toServer: true});" + "let evt = new zk.Event(panel, 'onComboSelectEcho', [comboitem.uuid, popupheight], {toServer: true});"
+ "zAu.send(evt);})()"; + "zAu.send(evt);})()";
/**
* Layout panel
*/
protected void init() protected void init()
{ {
layout = new Hlayout(); layout = new Hlayout();
@ -204,6 +211,10 @@ public class TreeSearchPanel extends Panel implements EventListener<Event>, Tree
} }
} }
/**
* Handle onSelect event (for mobile only)
* @param evt
*/
private void onSelect(Event evt) { private void onSelect(Event evt) {
if (moveItemBox != null) { if (moveItemBox != null) {
Treeitem selected = tree.getSelectedItem(); Treeitem selected = tree.getSelectedItem();
@ -219,6 +230,10 @@ public class TreeSearchPanel extends Panel implements EventListener<Event>, Tree
} }
} }
/**
* Handle onPostMove event (for mobile only)
* @param evt
*/
private void onPostMove(Event evt) { private void onPostMove(Event evt) {
Treeitem item = (Treeitem) evt.getData(); Treeitem item = (Treeitem) evt.getData();
Treerow dragged = (Treerow) moveItemBtn.getAttribute("draggedComponent"); Treerow dragged = (Treerow) moveItemBtn.getAttribute("draggedComponent");
@ -234,6 +249,9 @@ public class TreeSearchPanel extends Panel implements EventListener<Event>, Tree
} }
} }
/**
* Handle onClick event of {@link #moveItemBtn} (for mobile only)
*/
private void onMoveBtnClicked() { private void onMoveBtnClicked() {
if (moveItemBox != null) { if (moveItemBox != null) {
moveItemBox.detach(); moveItemBox.detach();
@ -274,12 +292,20 @@ public class TreeSearchPanel extends Panel implements EventListener<Event>, Tree
ti.focus(); ti.focus();
} }
/**
* Add treeItem to {@link #treeNodeItemMap}
* @param treeItem
*/
protected void addTreeItem(Treeitem treeItem) protected void addTreeItem(Treeitem treeItem)
{ {
StringBuilder key = new StringBuilder(getLabel(treeItem)).append(".").append(treeItem.getAttribute(AbstractMenuPanel.MENU_TYPE_ATTRIBUTE)); StringBuilder key = new StringBuilder(getLabel(treeItem)).append(".").append(treeItem.getAttribute(AbstractMenuPanel.MENU_TYPE_ATTRIBUTE));
treeNodeItemMap.put(key.toString(), treeItem); treeNodeItemMap.put(key.toString(), treeItem);
} }
/**
* Add DefaultTreeNode to {@link #treeNodeItemMap}
* @param node
*/
protected void addTreeItem(DefaultTreeNode<?> node) { protected void addTreeItem(DefaultTreeNode<?> node) {
Object data = node.getData(); Object data = node.getData();
if (data instanceof MTreeNode) { if (data instanceof MTreeNode) {
@ -301,6 +327,9 @@ public class TreeSearchPanel extends Panel implements EventListener<Event>, Tree
} }
} }
/**
* Populate list for auto complete combo ({@link #cmbSearch})
*/
public void refreshSearchList() { public void refreshSearchList() {
treeNodeItemMap.clear(); treeNodeItemMap.clear();
if (tree.getModel() == null) { if (tree.getModel() == null) {
@ -371,6 +400,10 @@ public class TreeSearchPanel extends Panel implements EventListener<Event>, Tree
cmbSearch.setContents(treeTypes); cmbSearch.setContents(treeTypes);
} }
/**
* @param treeItem
* @return true if treeItem is folder
*/
protected boolean isFolder(Treeitem treeItem) { protected boolean isFolder(Treeitem treeItem) {
List<Component> list = treeItem.getChildren(); List<Component> list = treeItem.getChildren();
for (Component c : list) { for (Component c : list) {
@ -381,6 +414,10 @@ public class TreeSearchPanel extends Panel implements EventListener<Event>, Tree
return false; return false;
} }
/**
* @param treeItem
* @return label for treeItem
*/
protected String getLabel(Treeitem treeItem) { protected String getLabel(Treeitem treeItem) {
String label = treeItem.getLabel(); String label = treeItem.getLabel();
if (label == null || label.trim().length() == 0) if (label == null || label.trim().length() == 0)
@ -395,6 +432,10 @@ public class TreeSearchPanel extends Panel implements EventListener<Event>, Tree
return label; return label;
} }
/**
* @param treeItem
* @return Image URL for treeItem
*/
protected String getImage(Treeitem treeItem) { protected String getImage(Treeitem treeItem) {
String image = treeItem.getImage(); String image = treeItem.getImage();
if (image == null || image.trim().length() == 0) if (image == null || image.trim().length() == 0)
@ -413,6 +454,7 @@ public class TreeSearchPanel extends Panel implements EventListener<Event>, Tree
* @param event * @param event
* @see EventListener#onEvent(Event) * @see EventListener#onEvent(Event)
*/ */
@Override
public void onEvent(Event event) public void onEvent(Event event)
{ {
if (cmbSearch.equals(event.getTarget())) if (cmbSearch.equals(event.getTarget()))
@ -487,6 +529,10 @@ public class TreeSearchPanel extends Panel implements EventListener<Event>, Tree
} }
} }
/**
* Select tree item by value
* @param value
*/
private void selectTreeitem(String value) { private void selectTreeitem(String value) {
if (Executions.getCurrent().getAttribute(getUuid()+".selectTreeitem") != null) if (Executions.getCurrent().getAttribute(getUuid()+".selectTreeitem") != null)
return; return;
@ -515,6 +561,9 @@ public class TreeSearchPanel extends Panel implements EventListener<Event>, Tree
} }
} }
/**
* Handle ON_POST_SELECT_TREEITEM_EVENT
*/
protected void onPostSelectTreeitem() { protected void onPostSelectTreeitem() {
Clients.clearBusy(); Clients.clearBusy();
Event event = null; Event event = null;
@ -535,6 +584,10 @@ public class TreeSearchPanel extends Panel implements EventListener<Event>, Tree
Events.echoEvent(ON_POST_FIRE_TREE_EVENT, this, null); Events.echoEvent(ON_POST_FIRE_TREE_EVENT, this, null);
} }
/**
* select selectedItem and make sure parent of selectedItem is open
* @param selectedItem
*/
public static void select(Treeitem selectedItem) { public static void select(Treeitem selectedItem) {
Treeitem parent = selectedItem.getParentItem(); Treeitem parent = selectedItem.getParentItem();
while (parent != null) { while (parent != null) {
@ -554,6 +607,9 @@ public class TreeSearchPanel extends Panel implements EventListener<Event>, Tree
refreshSearchList(); refreshSearchList();
} }
/**
* @return selected tree item
*/
public Treeitem getSelectedItem() { public Treeitem getSelectedItem() {
return selectedItem; return selectedItem;
} }

View File

@ -82,12 +82,18 @@ public class UserPanel implements EventListener<Event>, Composer<Component>
private static final String ON_DEFER_CHANGE_ROLE = "onDeferChangeRole"; private static final String ON_DEFER_CHANGE_ROLE = "onDeferChangeRole";
private static final String ON_DEFER_LOGOUT = "onDeferLogout"; private static final String ON_DEFER_LOGOUT = "onDeferLogout";
/**
* Default constructor
*/
public UserPanel() public UserPanel()
{ {
super(); super();
this.ctx = Env.getCtx(); this.ctx = Env.getCtx();
} }
/**
* Call when UI is compose from zul definition
*/
protected void onCreate() protected void onCreate()
{ {
String s = Msg.getMsg(Env.getCtx(), "CloseTabFromBrowser?").replace("\n", "<br>"); String s = Msg.getMsg(Env.getCtx(), "CloseTabFromBrowser?").replace("\n", "<br>");
@ -143,28 +149,43 @@ public class UserPanel implements EventListener<Event>, Composer<Component>
} }
} }
/**
* @return true if client is mobile
*/
private boolean isMobile() { private boolean isMobile() {
return ClientInfo.isMobile(); return ClientInfo.isMobile();
} }
/**
* @return name of user
*/
private String getUserName() private String getUserName()
{ {
MUser user = MUser.get(ctx); MUser user = MUser.get(ctx);
return user.getName(); return user.getName();
} }
/**
* @return name of role
*/
private String getRoleName() private String getRoleName()
{ {
MRole role = MRole.getDefault(ctx, false); MRole role = MRole.getDefault(ctx, false);
return role.getName(); return role.getName();
} }
/**
* @return name of tenant
*/
private String getClientName() private String getClientName()
{ {
MClient client = MClient.get(ctx); MClient client = MClient.get(ctx);
return client.getName(); return client.getName();
} }
/**
* @return name of organization
*/
private String getOrgName() private String getOrgName()
{ {
int orgId = Env.getAD_Org_ID(ctx); int orgId = Env.getAD_Org_ID(ctx);
@ -179,6 +200,7 @@ public class UserPanel implements EventListener<Event>, Composer<Component>
} }
} }
@Override
public void onEvent(Event event) throws Exception { public void onEvent(Event event) throws Exception {
if (event == null) if (event == null)
return; return;
@ -292,6 +314,9 @@ public class UserPanel implements EventListener<Event>, Composer<Component>
} }
/**
* Open user panel popup for mobile client
*/
protected void openMobileUserPanelPopup() { protected void openMobileUserPanelPopup() {
if (popup != null) { if (popup != null) {
Object value = popup.removeAttribute(popup.getUuid()); Object value = popup.removeAttribute(popup.getUuid());
@ -339,11 +364,17 @@ public class UserPanel implements EventListener<Event>, Composer<Component>
} }
/**
* @return email of user
*/
private String getUserEmail() { private String getUserEmail() {
MUser user = MUser.get(ctx); MUser user = MUser.get(ctx);
return user.getEMail(); return user.getEMail();
} }
/**
* @return name of warehouse
*/
private String getWarehouseName() { private String getWarehouseName() {
int id = Env.getContextAsInt(Env.getCtx(), Env.M_WAREHOUSE_ID); int id = Env.getContextAsInt(Env.getCtx(), Env.M_WAREHOUSE_ID);
if (id > 0) { if (id > 0) {

View File

@ -75,9 +75,12 @@ import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zul.Checkbox; import org.zkoss.zul.Checkbox;
import org.zkoss.zul.Image; import org.zkoss.zul.Image;
/**
* Multi factor authentication panel
*/
public class ValidateMFAPanel extends Window implements EventListener<Event> { public class ValidateMFAPanel extends Window implements EventListener<Event> {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = 4777197666886479162L; private static final long serialVersionUID = 4777197666886479162L;
@ -113,6 +116,15 @@ public class ValidateMFAPanel extends Window implements EventListener<Event> {
/* Number of failures to calculate an incremental delay on every trial */ /* Number of failures to calculate an incremental delay on every trial */
private int failures = 0; private int failures = 0;
/**
* @param ctx
* @param loginWindow
* @param orgKNPair
* @param isClientDefined
* @param userName
* @param showRolePanel
* @param clientsKNPairs
*/
public ValidateMFAPanel(Properties ctx, LoginWindow loginWindow, KeyNamePair orgKNPair, boolean isClientDefined, String userName, boolean showRolePanel, KeyNamePair[] clientsKNPairs) { public ValidateMFAPanel(Properties ctx, LoginWindow loginWindow, KeyNamePair orgKNPair, boolean isClientDefined, String userName, boolean showRolePanel, KeyNamePair[] clientsKNPairs) {
this.wndLogin = loginWindow; this.wndLogin = loginWindow;
m_ctx = ctx; m_ctx = ctx;
@ -146,6 +158,9 @@ public class ValidateMFAPanel extends Window implements EventListener<Event> {
} }
/**
* Layout panel
*/
private void init() { private void init() {
Div div = new Div(); Div div = new Div();
div.setSclass(ITheme.LOGIN_BOX_HEADER_CLASS); div.setSclass(ITheme.LOGIN_BOX_HEADER_CLASS);
@ -244,6 +259,10 @@ public class ValidateMFAPanel extends Window implements EventListener<Event> {
this.appendChild(div); this.appendChild(div);
} }
/**
* Create components
* @param hasCookie
*/
private void initComponents(boolean hasCookie) { private void initComponents(boolean hasCookie) {
lblMFAMechanism = new Label(); lblMFAMechanism = new Label();
lblMFAMechanism.setId("lblMFAMechanism"); lblMFAMechanism.setId("lblMFAMechanism");
@ -298,6 +317,7 @@ public class ValidateMFAPanel extends Window implements EventListener<Event> {
txtValidationCode.setDisabled(true); txtValidationCode.setDisabled(true);
} }
@Override
public void onEvent(Event event) { public void onEvent(Event event) {
if (event.getTarget().getId().equals(ConfirmPanel.A_OK)) { if (event.getTarget().getId().equals(ConfirmPanel.A_OK)) {
validateMFAComplete(true); validateMFAComplete(true);
@ -306,6 +326,10 @@ public class ValidateMFAPanel extends Window implements EventListener<Event> {
} }
} }
/**
* Validate completion of multi factor authentication
* @param required
*/
public void validateMFAComplete(boolean required) { public void validateMFAComplete(boolean required) {
Clients.clearBusy(); Clients.clearBusy();
@ -426,6 +450,9 @@ public class ValidateMFAPanel extends Window implements EventListener<Event> {
return null; return null;
} }
/**
* @return true if panel is shown to user
*/
public boolean show() { public boolean show() {
return m_showMFAPanel; return m_showMFAPanel;
} }

View File

@ -86,14 +86,14 @@ import org.zkoss.zul.impl.Utils;
import org.zkoss.zul.impl.XulElement; import org.zkoss.zul.impl.XulElement;
/** /**
* * Attachment window
* @author Low Heng Sin * @author Low Heng Sin
* *
*/ */
public class WAttachment extends Window implements EventListener<Event> public class WAttachment extends Window implements EventListener<Event>
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = -8534334828539841412L; private static final long serialVersionUID = -8534334828539841412L;
@ -207,7 +207,7 @@ public class WAttachment extends Window implements EventListener<Event>
* @param Record_ID record key * @param Record_ID record key
* @param Record_UU record UUID * @param Record_UU record UUID
* @param trxName transaction * @param trxName transaction
* @param eventListener * @param eventListener listener for ON_WINDOW_CLOSE event
*/ */
public WAttachment( int WindowNo, int AD_Attachment_ID, public WAttachment( int WindowNo, int AD_Attachment_ID,
int AD_Table_ID, int Record_ID, String Record_UU, String trxName, EventListener<Event> eventListener) int AD_Table_ID, int Record_ID, String Record_UU, String trxName, EventListener<Event> eventListener)
@ -246,13 +246,7 @@ public class WAttachment extends Window implements EventListener<Event>
{ {
setAttribute(Window.MODE_KEY, Window.MODE_HIGHLIGHTED); setAttribute(Window.MODE_KEY, Window.MODE_HIGHLIGHTED);
AEnv.showWindow(this); AEnv.showWindow(this);
if (autoPreview(0, true)) autoPreview(0, true);
{
//String script = "setTimeout(\"zk.Widget.$('"+ preview.getUuid() + "').$n().src = zk.Widget.$('" +
//preview.getUuid() + "').$n().src\", 1000)";
//Clients.response(new AuScript(null, script));
}
} }
catch (Exception e) catch (Exception e)
{ {
@ -270,7 +264,7 @@ public class WAttachment extends Window implements EventListener<Event>
} // WAttachment } // WAttachment
/** /**
* Static setup. * layout window
* <pre> * <pre>
* - northPanel * - northPanel
* - toolBar * - toolBar
@ -282,8 +276,7 @@ public class WAttachment extends Window implements EventListener<Event>
* </pre> * </pre>
* @throws Exception * @throws Exception
*/ */
protected void staticInit() throws Exception
void staticInit() throws Exception
{ {
this.setAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "attachment"); this.setAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "attachment");
this.setMaximizable(true); this.setMaximizable(true);
@ -367,7 +360,6 @@ public class WAttachment extends Window implements EventListener<Event>
bLoad.setImage(ThemeManager.getThemeResource("images/Import24.png")); bLoad.setImage(ThemeManager.getThemeResource("images/Import24.png"));
bLoad.setSclass("img-btn"); bLoad.setSclass("img-btn");
bLoad.setId("bLoad"); bLoad.setId("bLoad");
// bLoad.setAttribute("org.zkoss.zul.image.preload", Boolean.TRUE);
bLoad.setTooltiptext(Msg.getMsg(Env.getCtx(), "Load")); bLoad.setTooltiptext(Msg.getMsg(Env.getCtx(), "Load"));
bLoad.setUpload("multiple=true," + AdempiereWebUI.getUploadSetting()); bLoad.setUpload("multiple=true," + AdempiereWebUI.getUploadSetting());
bLoad.addEventListener(Events.ON_UPLOAD, this); bLoad.addEventListener(Events.ON_UPLOAD, this);
@ -390,7 +382,6 @@ public class WAttachment extends Window implements EventListener<Event>
Center centerPane = new Center(); Center centerPane = new Center();
centerPane.setSclass("dialog-content"); centerPane.setSclass("dialog-content");
//centerPane.setAutoscroll(true); // not required the preview has its own scroll bar
mainPanel.appendChild(centerPane); mainPanel.appendChild(centerPane);
centerPane.appendChild(previewPanel); centerPane.appendChild(previewPanel);
ZKUpdateUtil.setVflex(previewPanel, "1"); ZKUpdateUtil.setVflex(previewPanel, "1");
@ -442,6 +433,9 @@ public class WAttachment extends Window implements EventListener<Event>
addEventListener(Events.ON_CANCEL, e -> onCancel()); addEventListener(Events.ON_CANCEL, e -> onCancel());
} }
/**
* Handle onClientInfo event
*/
protected void onClientInfo() protected void onClientInfo()
{ {
if (getPage() != null) if (getPage() != null)
@ -460,7 +454,6 @@ public class WAttachment extends Window implements EventListener<Event>
/** /**
* Dispose * Dispose
*/ */
public void dispose () public void dispose ()
{ {
preview = null; preview = null;
@ -468,11 +461,11 @@ public class WAttachment extends Window implements EventListener<Event>
} // dispose } // dispose
/** /**
* Load Attachments * Load Attachment items
*/ */
private void loadAttachments() private void loadAttachments()
{ {
if (log.isLoggable(Level.CONFIG))
log.config(""); log.config("");
// Set Text/Description // Set Text/Description
@ -498,6 +491,12 @@ public class WAttachment extends Window implements EventListener<Event>
} // loadAttachment } // loadAttachment
/**
* auto preview attachment item
* @param index
* @param immediate
* @return true if preview is available for attachment item
*/
private boolean autoPreview(int index, boolean immediate) private boolean autoPreview(int index, boolean immediate)
{ {
MAttachmentEntry entry = m_attachment.getEntry(index); MAttachmentEntry entry = m_attachment.getEntry(index);
@ -577,6 +576,11 @@ public class WAttachment extends Window implements EventListener<Event>
} }
} }
/**
* Get file extension
* @param name
* @return file extension or empty string
*/
private String getExtension(String name) { private String getExtension(String name) {
int index = name.lastIndexOf("."); int index = name.lastIndexOf(".");
if (index > 0) { if (index > 0) {
@ -586,7 +590,7 @@ public class WAttachment extends Window implements EventListener<Event>
} }
/** /**
* Display gif or jpg in gifPanel * Display attachment item
* @param index index * @param index index
*/ */
@ -604,6 +608,9 @@ public class WAttachment extends Window implements EventListener<Event>
bPreview.setEnabled(false); bPreview.setEnabled(false);
} // displayData } // displayData
/**
* Clear preview content ({@link #preview} and {@link #customPreviewComponent})
*/
private void clearPreview() private void clearPreview()
{ {
preview.setSrc(null); preview.setSrc(null);
@ -649,11 +656,10 @@ public class WAttachment extends Window implements EventListener<Event>
} }
/** /**
* Get File Name with index * Get file Name by index
* @param index index * @param index index
* @return file name or null * @return file name or null
*/ */
private String getFileName (int index) private String getFileName (int index)
{ {
String fileName = null; String fileName = null;
@ -668,10 +674,10 @@ public class WAttachment extends Window implements EventListener<Event>
} // getFileName } // getFileName
/** /**
* Action Listener * handle event
* @param e event * @param e event
*/ */
@Override
public void onEvent(Event e) public void onEvent(Event e)
{ {
// Save and Close // Save and Close
@ -735,6 +741,9 @@ public class WAttachment extends Window implements EventListener<Event>
} // onEvent } // onEvent
/**
* Handle onCancel event
*/
private void onCancel() { private void onCancel() {
// do not allow to close tab for Events.ON_CTRL_KEY event // do not allow to close tab for Events.ON_CTRL_KEY event
if(isUseEscForTabClosing) if(isUseEscForTabClosing)
@ -743,10 +752,13 @@ public class WAttachment extends Window implements EventListener<Event>
dispose(); dispose();
} }
/**
* Process uploaded media
* @param media
*/
private void processUploadMedia(Media media) { private void processUploadMedia(Media media) {
if (media != null && ((media.isBinary() && media.getByteData().length>0) || (!media.isBinary() && media.getStringData().length() > 0))) if (media != null && ((media.isBinary() && media.getByteData().length>0) || (!media.isBinary() && media.getStringData().length() > 0)))
{ {
// pdfViewer.setContent(media);
; ;
} }
else else
@ -781,6 +793,11 @@ public class WAttachment extends Window implements EventListener<Event>
} }
} }
/**
* Get byte[] data from media
* @param media
* @return byte[] data
*/
private byte[] getMediaData(Media media) { private byte[] getMediaData(Media media) {
byte[] bytes = null; byte[] bytes = null;
@ -817,6 +834,7 @@ public class WAttachment extends Window implements EventListener<Event>
*/ */
private void deleteAttachment() private void deleteAttachment()
{ {
if (log.isLoggable(Level.INFO))
log.info(""); log.info("");
Dialog.ask(m_WindowNo, "AttachmentDelete?", new Callback<Boolean>() { Dialog.ask(m_WindowNo, "AttachmentDelete?", new Callback<Boolean>() {
@ -837,11 +855,11 @@ public class WAttachment extends Window implements EventListener<Event>
} // deleteAttachment } // deleteAttachment
/** /**
* Delete Attachment Entry * Delete current Attachment Entry
*/ */
private void deleteAttachmentEntry() private void deleteAttachmentEntry()
{ {
if (log.isLoggable(Level.INFO))
log.info(""); log.info("");
final int index = cbContent.getSelectedIndex(); final int index = cbContent.getSelectedIndex();
@ -870,12 +888,12 @@ public class WAttachment extends Window implements EventListener<Event>
} // deleteAttachment } // deleteAttachment
/** /**
* Save Attachment to File * Save current Attachment entry to File
*/ */
private void saveAttachmentToFile() private void saveAttachmentToFile()
{ {
int index = cbContent.getSelectedIndex(); int index = cbContent.getSelectedIndex();
if (log.isLoggable(Level.INFO))
log.info("index=" + index); log.info("index=" + index);
if (m_attachment.getEntryCount() < index) if (m_attachment.getEntryCount() < index)
@ -896,7 +914,11 @@ public class WAttachment extends Window implements EventListener<Event>
} }
} // saveAttachmentToFile } // saveAttachmentToFile
/**
* Get charset from content type header. Fallback to UTF-8
* @param contentType
* @return charset
*/
static private String getCharset(String contentType) { static private String getCharset(String contentType) {
if (contentType != null) { if (contentType != null) {
int j = contentType.indexOf("charset="); int j = contentType.indexOf("charset=");
@ -908,6 +930,9 @@ public class WAttachment extends Window implements EventListener<Event>
return "UTF-8"; return "UTF-8";
} }
/**
* Save all attachment items as zip file
*/
private void saveAllAsZip() { private void saveAllAsZip() {
File zipFile = m_attachment.saveAsZip(); File zipFile = m_attachment.saveAsZip();
@ -923,6 +948,9 @@ public class WAttachment extends Window implements EventListener<Event>
} }
} }
/**
* Email current attachment entry
*/
private void sendMail() private void sendMail()
{ {
int index = cbContent.getSelectedIndex(); int index = cbContent.getSelectedIndex();

View File

@ -60,12 +60,13 @@ import org.zkoss.zul.Listitem;
import org.zkoss.zul.Space; import org.zkoss.zul.Space;
import org.zkoss.zul.Vlayout; import org.zkoss.zul.Vlayout;
/**
* Document action dialog
*/
public class WDocActionPanel extends Window implements EventListener<Event>, DialogEvents public class WDocActionPanel extends Window implements EventListener<Event>, DialogEvents
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = -3218367479851088526L; private static final long serialVersionUID = -3218367479851088526L;
@ -90,11 +91,18 @@ public class WDocActionPanel extends Window implements EventListener<Event>, Dia
logger = CLogger.getCLogger(WDocActionPanel.class); logger = CLogger.getCLogger(WDocActionPanel.class);
} }
/**
* @param mgridTab
*/
public WDocActionPanel(GridTab mgridTab) public WDocActionPanel(GridTab mgridTab)
{ {
this(mgridTab, false); this(mgridTab, false);
} }
/**
* @param mgridTab
* @param fromMenu
*/
public WDocActionPanel(GridTab mgridTab, boolean fromMenu) public WDocActionPanel(GridTab mgridTab, boolean fromMenu)
{ {
gridTab = mgridTab; gridTab = mgridTab;
@ -116,7 +124,6 @@ public class WDocActionPanel extends Window implements EventListener<Event>, Dia
*/ */
private void dynInit(boolean fromMenu) private void dynInit(boolean fromMenu)
{ {
// //
Object Processing = gridTab.getValue("Processing"); Object Processing = gridTab.getValue("Processing");
String OrderType = Env.getContext(Env.getCtx(), gridTab.getWindowNo(), "OrderType"); String OrderType = Env.getContext(Env.getCtx(), gridTab.getWindowNo(), "OrderType");
@ -124,7 +131,6 @@ public class WDocActionPanel extends Window implements EventListener<Event>, Dia
if (DocStatus == null) if (DocStatus == null)
{ {
//message.setText("*** ERROR ***");
return; return;
} }
@ -235,10 +241,19 @@ public class WDocActionPanel extends Window implements EventListener<Event>, Dia
DocAction = DocumentEngine.ACTION_Close; DocAction = DocumentEngine.ACTION_Close;
} }
/**
* @return available document action items
*/
public List<Listitem> getDocActionItems() { public List<Listitem> getDocActionItems() {
return (List<Listitem>)lstDocAction.getItems(); return (List<Listitem>)lstDocAction.getItems();
} }
/**
* @param TableName
* @param Record_ID
* @param DocStatus
* @return true if DocStatus match DocStatus from DB
*/
private boolean checkStatus (String TableName, int Record_ID, String DocStatus) private boolean checkStatus (String TableName, int Record_ID, String DocStatus)
{ {
String sql = "SELECT 2 FROM " + TableName String sql = "SELECT 2 FROM " + TableName
@ -248,6 +263,9 @@ public class WDocActionPanel extends Window implements EventListener<Event>, Dia
return result == 2; return result == 2;
} }
/**
* Create components
*/
private void initComponents() private void initComponents()
{ {
lblDocAction = new Label(); lblDocAction = new Label();
@ -267,6 +285,9 @@ public class WDocActionPanel extends Window implements EventListener<Event>, Dia
ZKUpdateUtil.setVflex(confirmPanel, "true"); ZKUpdateUtil.setVflex(confirmPanel, "true");
} }
/**
* Layout dialog
*/
private void init() private void init()
{ {
setSclass("popup-dialog doc-action-dialog"); setSclass("popup-dialog doc-action-dialog");
@ -322,6 +343,7 @@ public class WDocActionPanel extends Window implements EventListener<Event>, Dia
return m_OKpressed; return m_OKpressed;
} // isStartProcess } // isStartProcess
@Override
public void onEvent(Event event) public void onEvent(Event event)
{ {
@ -347,6 +369,10 @@ public class WDocActionPanel extends Window implements EventListener<Event>, Dia
} }
} }
/**
* Set selected document action item by value
* @param value
*/
public void setSelectedItem(String value) { public void setSelectedItem(String value) {
lstDocAction.setSelectedIndex(-1); lstDocAction.setSelectedIndex(-1);
List<Listitem> lst = (List<Listitem>)lstDocAction.getItems(); List<Listitem> lst = (List<Listitem>)lstDocAction.getItems();
@ -358,6 +384,10 @@ public class WDocActionPanel extends Window implements EventListener<Event>, Dia
} }
} }
/**
* Handle onOk event
* @param callback
*/
public void onOk(final Callback<Boolean> callback) { public void onOk(final Callback<Boolean> callback) {
MClientInfo clientInfo = MClientInfo.get(Env.getCtx()); MClientInfo clientInfo = MClientInfo.get(Env.getCtx());
if(clientInfo.isConfirmOnDocClose() || clientInfo.isConfirmOnDocVoid()) if(clientInfo.isConfirmOnDocClose() || clientInfo.isConfirmOnDocVoid())
@ -404,6 +434,9 @@ public class WDocActionPanel extends Window implements EventListener<Event>, Dia
} }
} }
/**
* Validate DocStatus not change by other, update GridTab and close dialog
*/
private void setValueAndClose() { private void setValueAndClose() {
String statusSql = "SELECT DocStatus FROM " + gridTab.getTableName() String statusSql = "SELECT DocStatus FROM " + gridTab.getTableName()
+ " WHERE " + gridTab.getKeyColumnName() + " = ? "; + " WHERE " + gridTab.getKeyColumnName() + " = ? ";
@ -416,6 +449,9 @@ public class WDocActionPanel extends Window implements EventListener<Event>, Dia
detach(); detach();
} }
/**
* Update GridTab with selected DocAction value
*/
private void setValue() private void setValue()
{ {
int index = getSelectedIndex(); int index = getSelectedIndex();
@ -424,6 +460,9 @@ public class WDocActionPanel extends Window implements EventListener<Event>, Dia
gridTab.setValue("DocAction", s_value[index]); gridTab.setValue("DocAction", s_value[index]);
} // save } // save
/**
* Load document action list from AD_Ref_List
*/
private void readReference() private void readReference()
{ {
ArrayList<String> v_value = new ArrayList<String>(); ArrayList<String> v_value = new ArrayList<String>();
@ -445,6 +484,9 @@ public class WDocActionPanel extends Window implements EventListener<Event>, Dia
} }
} // readReference } // readReference
/**
* @return selected index
*/
public int getSelectedIndex() public int getSelectedIndex()
{ {
int index = 0; int index = 0;
@ -464,6 +506,9 @@ public class WDocActionPanel extends Window implements EventListener<Event>, Dia
return index; return index;
} // getSelectedIndex } // getSelectedIndex
/**
* @return number of document action items
*/
public int getNumberOfOptions() { public int getNumberOfOptions() {
return lstDocAction != null ? lstDocAction.getItemCount() : 0; return lstDocAction != null ? lstDocAction.getItemCount() : 0;
} }

View File

@ -32,18 +32,16 @@ import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Hbox; import org.zkoss.zul.Hbox;
import org.zkoss.zul.Separator; import org.zkoss.zul.Separator;
/** /**
* Queries how many days back history is displayed as current * Dialog to select how many days back history is included as part of query
* *
* @author Niraj Sohun * @author Niraj Sohun
* @date September 24, 2007 * @date September 24, 2007
*/ */
public class WOnlyCurrentDays extends Window implements EventListener<Event>, DialogEvents public class WOnlyCurrentDays extends Window implements EventListener<Event>, DialogEvents
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = 2464266193433220449L; private static final long serialVersionUID = 2464266193433220449L;
@ -81,10 +79,9 @@ public class WOnlyCurrentDays extends Window implements EventListener<Event>, Di
private static final CLogger log = CLogger.getCLogger(WOnlyCurrentDays.class); private static final CLogger log = CLogger.getCLogger(WOnlyCurrentDays.class);
/** /**
* Static Initializer * Layout dialog
* @throws Exception * @throws Exception
*/ */
private void jbInit() throws Exception private void jbInit() throws Exception
{ {
bShowAll.setLabel(Msg.getMsg(Env.getCtx(), "All")); bShowAll.setLabel(Msg.getMsg(Env.getCtx(), "All"));
@ -124,12 +121,12 @@ public class WOnlyCurrentDays extends Window implements EventListener<Event>, Di
* Get selected number of days * Get selected number of days
* @return days or -1 for all * @return days or -1 for all
*/ */
public int getCurrentDays() public int getCurrentDays()
{ {
return m_days; return m_days;
} // getCurrentDays } // getCurrentDays
@Override
public void onEvent(Event event) throws Exception public void onEvent(Event event) throws Exception
{ {
if (event.getTarget() == bShowDay) if (event.getTarget() == bShowDay)

View File

@ -46,14 +46,18 @@ import org.zkoss.zul.Hbox;
import org.zkoss.zul.Html; import org.zkoss.zul.Html;
import org.zkoss.zul.Vlayout; import org.zkoss.zul.Vlayout;
/**
* Form to capture process parameters for scheduler, etc
*/
@org.idempiere.ui.zk.annotation.Form @org.idempiere.ui.zk.annotation.Form
public class WProcessParameterForm extends ADForm public class WProcessParameterForm extends ADForm
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = -2533099650671242190L; private static final long serialVersionUID = -2533099650671242190L;
/** Form Controller */
private WProcessParameter pp; private WProcessParameter pp;
private VerticalBox dialogBody; private VerticalBox dialogBody;
@ -77,6 +81,9 @@ public class WProcessParameterForm extends ADForm
private final static CLogger log = CLogger.getCLogger(WProcessParameterForm.class); private final static CLogger log = CLogger.getCLogger(WProcessParameterForm.class);
/**
* @param wpp
*/
public WProcessParameterForm(WProcessParameter wpp) { public WProcessParameterForm(WProcessParameter wpp) {
pp = wpp; pp = wpp;
initComponents(); initComponents();
@ -110,6 +117,9 @@ public class WProcessParameterForm extends ADForm
} }
} }
/**
* Handle onCancel event
*/
private void onCancel() { private void onCancel() {
// do not allow to close tab for Events.ON_CTRL_KEY event // do not allow to close tab for Events.ON_CTRL_KEY event
if(isUseEscForTabClosing) if(isUseEscForTabClosing)
@ -118,6 +128,9 @@ public class WProcessParameterForm extends ADForm
this.dispose(); this.dispose();
} }
/**
* Handle onOk event
*/
private void onOK() { private void onOK() {
MPInstancePara[] paras = parameterPanel.getParameters(); MPInstancePara[] paras = parameterPanel.getParameters();
GridTab gridTab = super.getGridTab(); GridTab gridTab = super.getGridTab();
@ -157,6 +170,9 @@ public class WProcessParameterForm extends ADForm
ZKUpdateUtil.setVflex(this, "min"); ZKUpdateUtil.setVflex(this, "min");
} }
/**
* Create components
*/
private void initComponents() { private void initComponents() {
this.setBorder("normal"); this.setBorder("normal");
dialogBody = new VerticalBox(); dialogBody = new VerticalBox();
@ -194,8 +210,8 @@ public class WProcessParameterForm extends ADForm
} }
/** /**
* Dynamic Init * Init {@link #parameterPanel}
* @return true, if there is something to process (start from menu) * @return true if init ok
*/ */
private boolean init() private boolean init()
{ {
@ -252,7 +268,6 @@ public class WProcessParameterForm extends ADForm
this.setTitle(m_Name); this.setTitle(m_Name);
message.setContent(m_messageText.toString()); message.setContent(m_messageText.toString());
// Move from APanel.actionButton
processInfo.setAD_User_ID (Env.getAD_User_ID(Env.getCtx())); processInfo.setAD_User_ID (Env.getAD_User_ID(Env.getCtx()));
processInfo.setAD_Client_ID(Env.getAD_Client_ID(Env.getCtx())); processInfo.setAD_Client_ID(Env.getAD_Client_ID(Env.getCtx()));
processInfo.setTitle(m_Name); processInfo.setTitle(m_Name);

View File

@ -35,33 +35,47 @@ import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Center; import org.zkoss.zul.Center;
import org.zkoss.zul.Div; import org.zkoss.zul.Div;
/**
* Panel to select printed print format items
*/
public class WRC1DisplayFieldsPanel extends WRCTabPanel implements EventListener<Event> public class WRC1DisplayFieldsPanel extends WRCTabPanel implements EventListener<Event>
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = -4595966853507636969L; private static final long serialVersionUID = -4595966853507636969L;
private static final int RENDER_IN_COLUMNS=4; private static final int RENDER_IN_COLUMNS=4;
private MPrintFormat m_printFormat; private MPrintFormat m_printFormat;
Checkbox m_chkboxes[]=null; protected Checkbox m_chkboxes[]=null;
Textbox m_textBoxes[]=null; protected Textbox m_textBoxes[]=null;
String m_oldLabel[]=null; protected String m_oldLabel[]=null;
/**
* Default constructor
*/
public WRC1DisplayFieldsPanel() { public WRC1DisplayFieldsPanel() {
super(); super();
} }
/**
* @param pf
*/
public WRC1DisplayFieldsPanel(MPrintFormat pf){ public WRC1DisplayFieldsPanel(MPrintFormat pf){
super(); super();
m_printFormat=pf; m_printFormat=pf;
} }
/**
* @return print format
*/
public MPrintFormat getM_printFormat() { public MPrintFormat getM_printFormat() {
return m_printFormat; return m_printFormat;
} }
/**
* Layout panel
*/
public void init() { public void init() {
m_chkboxes = new Checkbox[m_pfi.size()]; m_chkboxes = new Checkbox[m_pfi.size()];
@ -138,6 +152,9 @@ public class WRC1DisplayFieldsPanel extends WRCTabPanel implements EventListener
} }
} }
/**
* Save changes
*/
public void save(){ public void save(){
int i=0; int i=0;
for (MPrintFormatItem item : m_pfi){ for (MPrintFormatItem item : m_pfi){
@ -148,6 +165,10 @@ public class WRC1DisplayFieldsPanel extends WRCTabPanel implements EventListener
} }
} }
/**
* Get selected print format items
* @return [AD_PrintFormatItem_ID, Name]
*/
public KeyNamePair[] getChecked(){ public KeyNamePair[] getChecked(){
KeyNamePair [] listcheck=new KeyNamePair[m_pfi.size()]; KeyNamePair [] listcheck=new KeyNamePair[m_pfi.size()];
for(int i=0;i<m_chkboxes.length;i++){ for(int i=0;i<m_chkboxes.length;i++){
@ -182,6 +203,10 @@ public class WRC1DisplayFieldsPanel extends WRCTabPanel implements EventListener
} }
} }
/**
* Update IsPrinted with value
* @param value
*/
public void updatePrinted(boolean value){ public void updatePrinted(boolean value){
for(int j=0 ; j< m_pfi.size() ; j++){ for(int j=0 ; j< m_pfi.size() ; j++){
m_pfi.get(j).setIsPrinted(value); m_pfi.get(j).setIsPrinted(value);

View File

@ -41,27 +41,32 @@ import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zul.Hlayout; import org.zkoss.zul.Hlayout;
import org.zkoss.zul.Vbox; import org.zkoss.zul.Vbox;
/**
* Panel to edit order of printed print format items
*/
public class WRC2FieldOrderPanel extends WRCTabPanel implements EventListener<Event> { public class WRC2FieldOrderPanel extends WRCTabPanel implements EventListener<Event> {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = -7732332384947376101L; private static final long serialVersionUID = -7732332384947376101L;
/**
*
*/
private Button bUp = new Button(); private Button bUp = new Button();
private Button bDown = new Button(); private Button bDown = new Button();
private ArrayList<MPrintFormatItem> listColumns=new ArrayList<MPrintFormatItem>(); private ArrayList<MPrintFormatItem> listColumns=new ArrayList<MPrintFormatItem>();
SimpleListModel sortModel; protected SimpleListModel sortModel;
private Listbox sortList; private Listbox sortList;
/**
* default constructor
*/
public WRC2FieldOrderPanel() { public WRC2FieldOrderPanel() {
super(); super();
} }
/**
* Populate {@link #listColumns} with printed MPrintFormatItem
*/
public void setListColumns() { public void setListColumns() {
listColumns = new ArrayList<MPrintFormatItem>(); listColumns = new ArrayList<MPrintFormatItem>();
for (MPrintFormatItem item : m_pfi) for (MPrintFormatItem item : m_pfi)
@ -69,9 +74,11 @@ public class WRC2FieldOrderPanel extends WRCTabPanel implements EventListener<Ev
listColumns.add(item); listColumns.add(item);
} }
/**
* Layout panel
*/
public void init() public void init()
{ {
Hlayout hlayout = new Hlayout(); Hlayout hlayout = new Hlayout();
ZKUpdateUtil.setVflex(hlayout, "true"); ZKUpdateUtil.setVflex(hlayout, "true");
ZKUpdateUtil.setHflex(hlayout, "true"); ZKUpdateUtil.setHflex(hlayout, "true");
@ -163,10 +170,10 @@ public class WRC2FieldOrderPanel extends WRCTabPanel implements EventListener<Ev
} }
/** /**
* Move within Yes List with Drag Event and Multiple Choice * Move selected items within Yes List
* @param event event * @param event event
*/ */
void migrateValueWithinYesList (int endIndex, List<ListElement> selObjects) protected void migrateValueWithinYesList (int endIndex, List<ListElement> selObjects)
{ {
int iniIndex =0; int iniIndex =0;
Arrays.sort(selObjects.toArray()); Arrays.sort(selObjects.toArray());
@ -227,10 +234,10 @@ public class WRC2FieldOrderPanel extends WRCTabPanel implements EventListener<Ev
} }
/** /**
* Move within Yes List * Move selected items within Yes List
* @param event event * @param event event
*/ */
void migrateValueWithinSortList (Event event) protected void migrateValueWithinSortList (Event event)
{ {
Object[] selObjects = sortList.getSelectedItems().toArray(); Object[] selObjects = sortList.getSelectedItems().toArray();
if (selObjects == null) if (selObjects == null)
@ -304,7 +311,7 @@ public class WRC2FieldOrderPanel extends WRCTabPanel implements EventListener<Ev
*/ */
public static class ListElement extends NamePair { public static class ListElement extends NamePair {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = -5645910649588308798L; private static final long serialVersionUID = -5645910649588308798L;
private int m_key; private int m_key;
@ -313,7 +320,13 @@ public class WRC2FieldOrderPanel extends WRCTabPanel implements EventListener<Ev
/** Initial seq number */ /** Initial seq number */
private int m_sortNo; private int m_sortNo;
/**
* @param key
* @param name
* @param sortNo
* @param AD_Client_ID
* @param AD_Org_ID
*/
public ListElement(int key, String name, int sortNo, int AD_Client_ID, int AD_Org_ID) { public ListElement(int key, String name, int sortNo, int AD_Client_ID, int AD_Org_ID) {
super(name); super(name);
this.m_key = key; this.m_key = key;

View File

@ -51,10 +51,13 @@ import org.zkoss.zul.Menuitem;
import org.zkoss.zul.Menupopup; import org.zkoss.zul.Menupopup;
import org.zkoss.zul.Vbox; import org.zkoss.zul.Vbox;
/**
* Panel to edit sorting of print format
*/
public class WRC3SortCriteriaPanel extends WRCTabPanel implements EventListener<Event> public class WRC3SortCriteriaPanel extends WRCTabPanel implements EventListener<Event>
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = 6470498382547293013L; private static final long serialVersionUID = 6470498382547293013L;
// UI variables // UI variables
@ -65,18 +68,26 @@ public class WRC3SortCriteriaPanel extends WRCTabPanel implements EventListener
private Button bUp = new Button(); private Button bUp = new Button();
private Button bDown = new Button(); private Button bDown = new Button();
// //
SimpleListModel noModel = new SimpleListModel(); protected SimpleListModel noModel = new SimpleListModel();
SimpleListModel yesModel = new SimpleListModel(); protected SimpleListModel yesModel = new SimpleListModel();
Listbox noList = new Listbox(); protected Listbox noList = new Listbox();
Listbox yesList = new Listbox(); protected Listbox yesList = new Listbox();
ArrayList<MPrintFormatItem> yesItems =new ArrayList<MPrintFormatItem>(); /** List of print format items selected for ordering */
ArrayList<MPrintFormatItem> noItems =new ArrayList<MPrintFormatItem>(); protected ArrayList<MPrintFormatItem> yesItems =new ArrayList<MPrintFormatItem>();
/** List of print format items not selected for ordering */
protected ArrayList<MPrintFormatItem> noItems =new ArrayList<MPrintFormatItem>();
private final String asc_desc = "asc_desc"; private final String asc_desc = "asc_desc";
/**
* default constructor
*/
public WRC3SortCriteriaPanel() { public WRC3SortCriteriaPanel() {
super(); super();
} }
/**
* Layout panel
*/
public void init() public void init()
{ {
// //
@ -210,6 +221,9 @@ public class WRC3SortCriteriaPanel extends WRCTabPanel implements EventListener
} }
} }
/**
* Populate {@link #yesItems} and {@link #noItems} from print format items
*/
public void setListsColumns() { public void setListsColumns() {
yesItems =new ArrayList<MPrintFormatItem>(); yesItems =new ArrayList<MPrintFormatItem>();
noItems =new ArrayList<MPrintFormatItem>(); noItems =new ArrayList<MPrintFormatItem>();
@ -261,17 +275,23 @@ public class WRC3SortCriteriaPanel extends WRCTabPanel implements EventListener
} }
} }
String getName(MPrintFormatItem pfi) { protected String getName(MPrintFormatItem pfi) {
StringBuilder name = new StringBuilder(Util.isEmpty(pfi.getPrintName()) ? pfi.getName() : pfi.getPrintName()) StringBuilder name = new StringBuilder(Util.isEmpty(pfi.getPrintName()) ? pfi.getName() : pfi.getPrintName())
.append(" (").append(pfi.isDesc() ? getOrderByDesc() : getOrderByAsc()).append(")"); .append(" (").append(pfi.isDesc() ? getOrderByDesc() : getOrderByAsc()).append(")");
return name.toString(); return name.toString();
} }
String getOrderByAsc() { /**
* @return translated text for ascending
*/
protected String getOrderByAsc() {
return MRefList.getListName(Env.getCtx(), REFERENCE_SQLORDERBY, "A"); return MRefList.getListName(Env.getCtx(), REFERENCE_SQLORDERBY, "A");
} }
String getOrderByDesc() { /**
* @return translated text for descending
*/
protected String getOrderByDesc() {
return MRefList.getListName(Env.getCtx(), REFERENCE_SQLORDERBY, "D"); return MRefList.getListName(Env.getCtx(), REFERENCE_SQLORDERBY, "D");
} }
@ -283,7 +303,7 @@ public class WRC3SortCriteriaPanel extends WRCTabPanel implements EventListener
/** /**
* @param event * @param event
*/ */
void migrateValueAcrossLists (Event event) protected void migrateValueAcrossLists (Event event)
{ {
Object source = event.getTarget(); Object source = event.getTarget();
if (source instanceof ListItem) { if (source instanceof ListItem) {
@ -300,7 +320,13 @@ public class WRC3SortCriteriaPanel extends WRCTabPanel implements EventListener
migrateLists (listFrom,listTo,endIndex); migrateLists (listFrom,listTo,endIndex);
} // migrateValueAcrossLists } // migrateValueAcrossLists
void migrateLists (Listbox listFrom , Listbox listTo , int endIndex) /**
* Move selected items from listFrom to listTo
* @param listFrom
* @param listTo
* @param endIndex
*/
protected void migrateLists (Listbox listFrom , Listbox listTo , int endIndex)
{ {
int index = 0; int index = 0;
SimpleListModel lmFrom = (listFrom == yesList) ? yesModel:noModel; SimpleListModel lmFrom = (listFrom == yesList) ? yesModel:noModel;
@ -362,10 +388,10 @@ public class WRC3SortCriteriaPanel extends WRCTabPanel implements EventListener
} }
/** /**
* Move within Yes List with Drag Event and Multiple Choice * Move selected items within Yes List
* @param event event * @param event event
*/ */
void migrateValueWithinYesList (int endIndex, List<ListElement> selObjects) protected void migrateValueWithinYesList (int endIndex, List<ListElement> selObjects)
{ {
int iniIndex =0; int iniIndex =0;
Arrays.sort(selObjects.toArray()); Arrays.sort(selObjects.toArray());
@ -391,7 +417,7 @@ public class WRC3SortCriteriaPanel extends WRCTabPanel implements EventListener
} }
/** /**
* Move within Yes List * Move selected items within Yes List
* @param event event * @param event event
*/ */
private void migrateValueWithinYesList (Event event) private void migrateValueWithinYesList (Event event)
@ -482,9 +508,9 @@ public class WRC3SortCriteriaPanel extends WRCTabPanel implements EventListener
} }
} // migrateValueWithinYesList } // migrateValueWithinYesList
/** /**
* @param int selIndexPI,int targetIndexPI * @param selIndexPI
* @param targetIndexPI
*/ */
private void updateSortNo(int selIndexPI,int targetIndexPI) private void updateSortNo(int selIndexPI,int targetIndexPI)
{ {
@ -498,7 +524,7 @@ public class WRC3SortCriteriaPanel extends WRCTabPanel implements EventListener
*/ */
public static class ListElement extends NamePair { public static class ListElement extends NamePair {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = -5645910649588308798L; private static final long serialVersionUID = -5645910649588308798L;
private int m_key; private int m_key;

Some files were not shown because too many files have changed in this diff Show More