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

View File

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

View File

@ -29,14 +29,14 @@ import org.zkoss.zul.event.ListDataEvent;
import org.zkoss.zul.ext.Sortable;
/**
*
* ListModel for {@link GridTabSelectionListView}
* @author Low Heng Sin
*
*/
public class SimpleGridTableListModel extends AbstractListModel<GridTableRow> implements TableModelListener, Sortable<Object> {
/**
*
* generated serial id
*/
private static final long serialVersionUID = 698185856751242764L;
private GridTable tableModel;
@ -61,6 +61,7 @@ public class SimpleGridTableListModel extends AbstractListModel<GridTableRow> im
* @param rowIndex
* @see ListModel#getElementAt(int)
*/
@Override
public GridTableRow getElementAt(int rowIndex) {
GridTableRow row = null;
int columnCount = tableModel.getColumnCount();
@ -80,6 +81,7 @@ public class SimpleGridTableListModel extends AbstractListModel<GridTableRow> im
* @return int
* @see ListModel#getSize()
*/
@Override
public int getSize() {
return tableModel.getRowCount();
}
@ -109,6 +111,7 @@ public class SimpleGridTableListModel extends AbstractListModel<GridTableRow> im
* @param ascending
* @see ListModelExt#sort(Comparator, boolean)
*/
@Override
public void sort(Comparator<Object> cmpr, boolean ascending) {
//use default zk comparator
if (cmpr instanceof ListitemComparator) {
@ -129,6 +132,7 @@ public class SimpleGridTableListModel extends AbstractListModel<GridTableRow> im
* @param e
* @see TableModelListener#tableChanged(TableModelEvent)
*/
@Override
public void tableChanged(TableModelEvent e) {
if (Executions.getCurrent() != null) {
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.GridTabVO;
import org.compiere.model.GridWindow;
import org.compiere.util.DisplayType;
import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.compiere.util.Util;
@ -43,7 +44,8 @@ import org.zkoss.zul.Menuitem;
import org.zkoss.zul.ext.Selectable;
/**
*
* Default editor for {@link DisplayType#MultipleSelectionGrid}.
* Implemented with {@link GridTabSelectionListView} component.
* @author hengsin
*
*/
@ -51,10 +53,12 @@ public class WGridTabMultiSelectionEditor extends WEditor implements ContextMenu
{
private static final String[] LISTENER_EVENTS = {Events.ON_SELECT};
/** comma separated list of selected row indices */
private Object oldValue;
private GridTab listViewGridTab = null;
/** current value of link column */
private String currentLinkValue = null;
private boolean readWrite;
@ -107,6 +111,9 @@ public class WGridTabMultiSelectionEditor extends WEditor implements ContextMenu
this.readWrite = readWrite;
}
/**
* Initialize component and context menu
*/
private void init()
{
if (tableEditor)
@ -147,6 +154,7 @@ public class WGridTabMultiSelectionEditor extends WEditor implements ContextMenu
}
}
@Override
public void onEvent(Event event)
{
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() : "");
}
/**
* Update selected row from {@link #oldValue}
*/
private void updateSlectedIndices() {
GridTabSelectionListView listView = (GridTabSelectionListView) getComponent();
if (!Util.isEmpty((String)oldValue))
@ -259,6 +270,7 @@ public class WGridTabMultiSelectionEditor extends WEditor implements ContextMenu
return LISTENER_EVENTS;
}
@Override
public void onMenu(ContextMenuEvent evt)
{
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.GridTabVO;
import org.compiere.model.GridWindow;
import org.compiere.util.DisplayType;
import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.compiere.util.Util;
@ -36,7 +37,8 @@ import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Menuitem;
/**
*
* Default editor for {@link DisplayType#SingleSelectionGrid}.
* Implemented with {@link GridTabSelectionListView} component.
* @author hengsin
*
*/
@ -44,10 +46,12 @@ public class WGridTabSingleSelectionEditor extends WEditor implements ContextMen
{
private static final String[] LISTENER_EVENTS = {Events.ON_SELECT};
/** selected row index */
private Object oldValue;
private GridTab listViewGridTab = null;
/** current value of link column */
private String currentLinkValue = null;
private boolean readWrite;
@ -100,6 +104,9 @@ public class WGridTabSingleSelectionEditor extends WEditor implements ContextMen
this.readWrite = readWrite;
}
/**
* Initialize component and context menu
*/
private void init()
{
if (tableEditor)
@ -140,6 +147,7 @@ public class WGridTabSingleSelectionEditor extends WEditor implements ContextMen
}
}
@Override
public void onEvent(Event event)
{
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() : "");
}
/**
* Update selected row indices from {@link #oldValue}
*/
private void updateSlectedIndices() {
GridTabSelectionListView listView = (GridTabSelectionListView) getComponent();
listView.clearSelection();
@ -210,6 +221,7 @@ public class WGridTabSingleSelectionEditor extends WEditor implements ContextMen
return LISTENER_EVENTS;
}
@Override
public void onMenu(ContextMenuEvent evt)
{
if (WEditorPopupMenu.PREFERENCE_EVENT.equals(evt.getContextEvent()))

View File

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

View File

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

View File

@ -20,13 +20,14 @@ package org.adempiere.webui.event;
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>
* @date Mar 10, 2007
* @version $Revision: 0.10 $
*/
public class ContextMenuEvent
{
/** Event id/name */
private String contextEvent;
private Component target;

View File

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

View File

@ -14,9 +14,8 @@
package org.adempiere.webui.event;
/**
*
* Event constant for popup modal/highlighted dialog.
* @author hengsin
*
*/
public interface DialogEvents {
@ -26,7 +25,7 @@ public interface DialogEvents {
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
*/
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;
/**
*
* Event for drill down and drill across
* @author hengsin
*
*/
public class DrillEvent extends Event {
/**
*
* generated serial id
*/
private static final long serialVersionUID = 4877800961258241047L;
public final static String ON_DRILL_DOWN = "onDrillDown";
public final static String ON_DRILL_ACROSS = "onDrillAcross";
/**
* @param name
* @param target
* @param data
*/
public DrillEvent(String name, Component target, Object data) {
super(name, target, data);
}
/**
* Data for drill event
*/
public static class DrillData {
private MQuery query;
@ -50,6 +57,13 @@ public class DrillEvent extends Event {
*/
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) {
this.query = query;
this.columnName = columnName;
@ -58,27 +72,40 @@ public class DrillEvent extends Event {
this.displayValue = displayValue;
}
/**
* @return MQuery
*/
public MQuery getQuery() {
return query;
}
/**
* @return column name
*/
public String getColumnName() {
return columnName;
}
/**
* @return value
*/
public Object getValue() {
return value;
}
/**
* @return [columnName, displayValue, value, processID - source]
*/
public Object getData() {
return data;
}
/**
* @return display text
*/
public String getDisplayValue() {
return displayValue;
}
}
}

View File

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

View File

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

View File

@ -18,17 +18,15 @@
package org.adempiere.webui.event;
/**
* Interface specifying the functions
* that must be implemented to listen for a TableValueChangeEvent event
* Listener interface for {@link TableValueChangeEvent}.
*
* @author Andrew Kimball
*/
public interface TableValueChangeListener
{
/**
* Respond to a TableValueChangeEvent event
* Notifies this listener that an event has occurred.
* To get the event, you have to register it first by use of
* Respond to a TableValueChangeEvent event.<br/>
* To listen to the event, you have to register it first by calling
* {@link org.adempiere.webui.component.WListItemRenderer#addTableValueChangeListener(TableValueChangeListener)}
*
* @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 {
/**
*
* generated serial id
*/
private static final long serialVersionUID = 7727018026113457776L;
/** on loading of user token **/

View File

@ -17,8 +17,10 @@
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>
* @date Feb 25, 2007
* @version $Revision: 0.10 $
@ -175,6 +177,9 @@ public interface ToolbarListener
*/
public void onCustomize();
/**
* Process (gear icon) button
*/
public void onProcess();
/**

View File

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

View File

@ -18,7 +18,7 @@
package org.adempiere.webui.event;
/**
*
* Value change event for a named property.
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @date Mar 10, 2007
* @version $Revision: 0.10 $
@ -32,7 +32,7 @@ public class ValueChangeEvent
protected Object source;
/**
* name of the property that changed. May be null, if not known.
* name of the property that changed
*/
private String propertyName;
@ -47,9 +47,15 @@ public class ValueChangeEvent
private Object oldValue;
// 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;
/**
* @param source
* @param propertyName
* @param oldValue
* @param newValue
*/
public ValueChangeEvent(Object source, String propertyName,
Object oldValue, Object newValue)
{
@ -59,16 +65,25 @@ public class ValueChangeEvent
this.oldValue = oldValue;
}
/**
* @return new value
*/
public Object getNewValue()
{
return newValue;
}
/**
* @return old/previous value
*/
public Object getOldValue()
{
return oldValue;
}
/**
* @return property name
*/
public String getPropertyName()
{
return propertyName;

View File

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

View File

@ -17,12 +17,13 @@
package org.adempiere.webui.event;
import org.adempiere.webui.component.ListModelTable;
import org.zkoss.zul.ListModel;
import org.zkoss.zul.event.ListDataEvent;
/**
* Change event for {@link ListModelTable}
* @author andy
*
*/
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
* that was based on the rows and requery the <code>TableModel</code> to
* get the new row count and all the appropriate values. The
* <code>WListbox</code> will repaint the entire visible region on receiving
* this event, querying the model for the cell values that are visible. The
* structure of the table ie, the column names, types and order have not
* changed.
* get the new row count and all the appropriate values.<br/>
* The <code>WListbox</code> will initiate repaint on receiving this event,
* querying the model for the cell values that are visible.<br/>
*
* @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
* 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 row Index of the affected row

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -37,6 +37,7 @@ import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zul.Window.Mode;
/**
* Default implementation of {@link IFeedbackService}
* @author hengsin
*
*/
@ -64,14 +65,21 @@ public class DefaultFeedbackService implements IFeedbackService {
new CreateNewRequestAction();
}
/**
* Action class to send feedback email to support
*/
protected static class EmailSupportAction implements EventListener<Event>{
private boolean errorOnly;
/**
* @param errorOnly
*/
protected EmailSupportAction(boolean errorOnly) {
this.errorOnly = errorOnly;
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 => " +
"{ const dataUrl = canvas.toDataURL();" +
" let widget = zk.Widget.$('#" + SessionManager.getAppDesktop().getComponent().getUuid()+"');"+
@ -98,11 +106,18 @@ public class DefaultFeedbackService implements IFeedbackService {
showEmailDialog(imageBytes);
}
/**
* @return Feedback subject
*/
protected String getFeedbackSubject() {
String feedBackHeader = Msg.getMsg(Env.getCtx(), "FeedBackHeader");
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) {
DataSource ds = FeedbackManager.getLogAttachment(errorOnly);
@ -140,16 +155,25 @@ public class DefaultFeedbackService implements IFeedbackService {
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) {
String retValue = MSysConfig.getValue(scValue, Env.getAD_Client_ID(Env.getCtx()), Env.getAD_Org_ID(Env.getCtx()));
return Util.isEmpty(retValue) ? "" : retValue;
}
}
/**
* Action class to create new feedback request
*/
protected static class CreateNewRequestAction implements EventListener<Event>{
protected CreateNewRequestAction() {
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 => " +
"{ let dataUrl = canvas.toDataURL();" +
" let widget = zk.Widget.$('#" + SessionManager.getAppDesktop().getComponent().getUuid()+"');"+
@ -176,6 +200,10 @@ public class DefaultFeedbackService implements IFeedbackService {
showRequestDialog(imageBytes);
}
/**
* Show create feedback request dialog with screenshot attachment
* @param imageBytes screenshot attachment content
*/
protected void showRequestDialog(byte[] imageBytes) {
FeedbackRequestWindow window = new FeedbackRequestWindow();
AEnv.showWindow(window);

View File

@ -23,6 +23,7 @@ import org.compiere.util.CLogger;
import org.zkoss.zk.ui.Component;
/**
* Default implementation of {@link IFormFactory}
* @author hengsin
*
*/
@ -266,6 +267,10 @@ public class DefaultFormFactory implements IFormFactory {
return zkName;
}
/**
* @param clazz
* @return true if clazz is descendant of IFormController or Component
*/
private static boolean isZkFormClass(Class<?> 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;
/**
*
* Default implementation of {@link IInfoFactory}
* @author hengsin
*
*/
@ -64,6 +64,19 @@ public class DefaultInfoFactory implements IInfoFactory {
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,
String value, boolean multiSelection, String whereClause, int AD_InfoWindow_ID, boolean lookup, String predefinedContextVariables, GridField field) {
InfoPanel info = null;
@ -228,6 +241,10 @@ public class DefaultInfoFactory implements IInfoFactory {
return null;
}
/**
* Set IsSOTrx context variable base on C_DocType_ID context value.
* @param WindowNo
*/
private void setSOTrxBasedOnDocType(int WindowNo) {
int C_DocType_ID = Env.getContextAsInt(Env.getCtx(), WindowNo, "C_DocType_ID");
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.WQuickEntry;
/**
* Default implementation of {@link IQuickEntryFactory}
* @author Andreas Sumerauer
*/
public class DefaultQuickEntryFactory implements IQuickEntryFactory {

View File

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

View File

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

View File

@ -17,24 +17,25 @@ import org.compiere.model.MDashboardContent;
import org.zkoss.zk.ui.Component;
/**
* Factory interface for dashboard gadget
* @author Antonio Cañaveral
* @author hengsin
*
*/
public interface IDashboardGadgetFactory {
/**
*
* @param uri String
* @param uri zul url
* @param parent Component
* @return Component instance of DashboardPanel or null
* @return new DashboardPanel component instance or null
*/
public Component getGadget(String uri, Component parent);
/**
* @param url String
* @param url zul url
* @param parent Component
* @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) {
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;
/**
*
* Factory interface for {@link GridField} editor
* @author hengsin
*
*/

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -49,6 +49,10 @@ import io.github.classgraph.ClassGraph;
import io.github.classgraph.ClassInfo;
import io.github.classgraph.ScanResult;
/**
* Default implementation of {@link IMappedFormFactory}
* @author hengsin
*/
@Component(name = "org.adempiere.webui.factory.MappedFormFactory",
immediate = true,
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);
/**
* Default constructor
*/
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 Constructor<?> constructor;
/**
* @param constructor form class constructor
*/
private FormSupplier(Constructor<?> constructor) {
this.constructor = constructor;
}

View File

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

View File

@ -24,26 +24,26 @@ import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
/**
* Quick Entry Window
* Interface based on class WQuickEntry by Carlos Ruiz
* Quick Entry Window.<br/>
* Based on class WQuickEntry by Carlos Ruiz
* @Author Andreas Sumerauer
*/
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
* 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 ();
/**
* Load Record_ID
* Load record by Record_ID
* @param Record_ID - existing Record or 0 for new
* @return true if loaded
*/
@ -56,12 +56,12 @@ public abstract class AbstractWQuickEntry extends Window implements Component, I
public abstract int getRecord_ID();
/**
* refresh all fields
* Dynamic update of all fields
*/
public abstract void dynamicDisplay();
/**
* get size quickfields
* @return number of quick fields
*/
public abstract int getQuickFields();

View File

@ -67,7 +67,7 @@ import org.zkoss.zul.Vlayout;
public class WQuickEntry extends AbstractWQuickEntry implements EventListener<Event>, ValueChangeListener
{
/**
*
* generated serial id
*/
private static final long serialVersionUID = -6385383768870354870L;
@ -82,14 +82,17 @@ public class WQuickEntry extends AbstractWQuickEntry implements EventListener<Ev
private int parent_TabNo;
List<GridField> quickFields = new ArrayList<GridField>();
/** editors for {@link #quickFields} */
protected List<WEditor> quickEditors = new ArrayList<WEditor>();
protected List<Object> initialValues = new ArrayList<Object>();
protected List<GridTab> quickTabs = new ArrayList<GridTab>();
/** POs for {@link #quickTabs} */
protected List<PO> quickPOs = new ArrayList<PO>();
/** Read Only */
private boolean m_readOnly = false;
/** Center container for field label and editors */
protected Vlayout centerPanel = new Vlayout();
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;
/** browser orientation */
private String orientation;
/**
* @param WindowNo
* @param AD_Window_ID
*/
public WQuickEntry(int WindowNo, int AD_Window_ID)
{
this(WindowNo, 0, AD_Window_ID);
@ -109,6 +117,7 @@ public class WQuickEntry extends AbstractWQuickEntry implements EventListener<Ev
* Constructor.
* Requires call loadRecord
* @param WindowNo Window No
* @param TabNo
* @param 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
/**
* @param AD_Window_ID
*/
public WQuickEntry(int AD_Window_ID)
{
super();
@ -145,14 +157,14 @@ public class WQuickEntry extends AbstractWQuickEntry implements EventListener<Ev
m_AD_Window_ID = AD_Window_ID;
parent_WindowNo = 0;
m_WindowNo = 0;
log.info("R/O=" + isReadOnly());
if (log.isLoggable(Level.INFO))
log.info("R/O=" + isReadOnly());
} // WQuickEntry
/**
* Static Init
* Layout dialog
* @throws Exception
*/
protected void initLayout() throws Exception
{
if (!ThemeManager.isUseCSSForWindowSize()) {
@ -186,6 +198,9 @@ public class WQuickEntry extends AbstractWQuickEntry implements EventListener<Ev
}
}
/**
* Handle client info event
*/
protected void onClientInfo()
{
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()
{
@ -242,6 +257,10 @@ public class WQuickEntry extends AbstractWQuickEntry implements EventListener<Ev
}
} // initPOs
/**
* @param refID display type
* @return true if display type support quick entry
*/
private boolean isValidQuickEntryType(int refID) {
boolean valid =
! (
@ -252,6 +271,12 @@ public class WQuickEntry extends AbstractWQuickEntry implements EventListener<Ev
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) {
if (newTab) {
Separator sep = new Separator();
@ -281,25 +306,15 @@ public class WQuickEntry extends AbstractWQuickEntry implements EventListener<Ev
layout.appendChild(field);
ZKUpdateUtil.setHflex((HtmlBasedComponent)field, "7");
//editor.setValue("Y");
centerPanel.appendChild(layout);
}
/**
* check table is editable in quick entry
* user must has write right and has at least a input field
* @return
*/
@Override
public boolean isAvailableQuickEdit (){
return isHasField && !isReadOnly();
}
/**
* Load Record_ID
* @param Record_ID - existing Record or 0 for new
* @return true if loaded
*/
@Override
public boolean loadRecord (int Record_ID)
{
String parentColumn = null;
@ -398,7 +413,8 @@ public class WQuickEntry extends AbstractWQuickEntry implements EventListener<Ev
*/
protected boolean actionSave()
{
log.config("");
if (log.isLoggable(Level.CONFIG))
log.config("");
boolean anyChange = false;
for (int idxf = 0; idxf < quickEditors.size(); idxf++) {
if (isChanged(idxf)) {
@ -508,11 +524,7 @@ public class WQuickEntry extends AbstractWQuickEntry implements EventListener<Ev
|| (value != null && initialValue != null);
}
/**
* Returns Record_ID
* @return Record_ID (0 = not saved)
*/
@Override
public int getRecord_ID()
{
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();
} // getRecord_ID
@Override
public void onEvent(Event e) throws Exception
{
if (isReadOnly())
@ -552,6 +565,7 @@ public class WQuickEntry extends AbstractWQuickEntry implements EventListener<Ev
desktop.unregisterWindow(m_WindowNo);
}
@Override
public void valueChange(ValueChangeEvent evt)
{
if (evt.getSource() instanceof WEditor) {
@ -595,9 +609,7 @@ public class WQuickEntry extends AbstractWQuickEntry implements EventListener<Ev
}
}
/**
* refresh all fields
*/
@Override
public void dynamicDisplay()
{
for (int idxf = 0; idxf < quickFields.size(); idxf++) {
@ -614,6 +626,10 @@ public class WQuickEntry extends AbstractWQuickEntry implements EventListener<Ev
}
} // dynamicDisplay
/**
* Update style of all field editors
* @param tab
*/
private void updateStyleTab(GridTab tab) {
for (int idxf = 0; idxf < quickFields.size(); idxf++) {
GridField field = quickFields.get(idxf);
@ -625,22 +641,20 @@ public class WQuickEntry extends AbstractWQuickEntry implements EventListener<Ev
}
}
/**
* get size quickfields
*/
@Override
public final int getQuickFields(){
return quickFields.size();
}// size of quickfields
}
/**
* get readOnly
* @return true if it is read only, false otherwise
*/
protected final boolean isReadOnly() {
return m_readOnly;
}
/**
* @return the confirmPanel
* @return the ConfirmPanel
*/
protected final ConfirmPanel getConfirmPanel() {
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;
import org.compiere.model.GridField;
@ -8,12 +29,13 @@ import org.compiere.model.MAsset;
import org.compiere.util.Env;
/**
* Info window for A_Asset
* @author hengsin
*
*/
public class InfoAssetWindow extends InfoWindow {
/**
*
* generated serial id
*/
private static final long serialVersionUID = 8671986505516245911L;
@ -31,7 +53,6 @@ public class InfoAssetWindow extends InfoWindow {
int AD_InfoWindow_ID) {
super(WindowNo, tableName, keyColumn, queryValue, multipleSelection,
whereClause, AD_InfoWindow_ID);
// TODO Auto-generated constructor stub
}
/**
@ -49,7 +70,6 @@ public class InfoAssetWindow extends InfoWindow {
int AD_InfoWindow_ID, boolean lookup) {
super(WindowNo, tableName, keyColumn, queryValue, multipleSelection,
whereClause, AD_InfoWindow_ID, lookup);
// TODO Auto-generated constructor stub
}
/**
@ -61,6 +81,7 @@ public class InfoAssetWindow extends InfoWindow {
* @param whereClause
* @param AD_InfoWindow_ID
* @param lookup
* @param field
* @param predefinedContextVariables
*/
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;
import org.compiere.model.GridField;
/**
* Info window for S_ResourceAssignment
* @author hengsin
*
*/
public class InfoAssignmentWindow extends InfoWindow {
/**
*
* generated serial id
*/
private static final long serialVersionUID = -5726562881863657609L;
@ -58,6 +80,7 @@ public class InfoAssignmentWindow extends InfoWindow {
* @param whereClause
* @param AD_InfoWindow_ID
* @param lookup
* @param field
* @param predefinedContextVariables
*/
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;
import java.util.logging.Level;
import org.adempiere.webui.panel.InvoiceHistory;
import org.compiere.model.GridField;
import org.compiere.model.MBPartner;
import org.compiere.util.Env;
/**
* Info window for C_BPartner
* @author hengsin
*
*/
public class InfoBPartnerWindow extends InfoWindow {
/**
*
* generated serial id
*/
private static final long serialVersionUID = 240758053410996182L;
@ -43,6 +67,7 @@ public class InfoBPartnerWindow extends InfoWindow {
* @param whereClause
* @param AD_InfoWindow_ID
* @param lookup
* @param field
*/
public InfoBPartnerWindow(int WindowNo, String tableName, String keyColumn,
String queryValue, boolean multipleSelection, String whereClause,
@ -60,6 +85,7 @@ public class InfoBPartnerWindow extends InfoWindow {
* @param whereClause
* @param AD_InfoWindow_ID
* @param lookup
* @param field
* @param predefinedContextVariables
*/
public InfoBPartnerWindow(int WindowNo, String tableName, String keyColumn,
@ -79,14 +105,14 @@ public class InfoBPartnerWindow extends InfoWindow {
return true;
} // hasHistory
// Elaine 2008/12/16
/**************************************************************************
/**
* Show History
*/
@Override
protected void showHistory()
{
log.info("");
if (log.isLoggable(Level.INFO))
log.info("");
Integer C_BPartner_ID = getIntSelectedRowKey(MBPartner.Table_ID);
if (C_BPartner_ID == null)
return;

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;
import org.compiere.model.GridField;
/**
* Info window for M_InOut
* @author hengsin
*
*/
public class InfoInOutWindow extends InfoWindow {
/**
*
* generated serial id
*/
private static final long serialVersionUID = 3027121642718090785L;
@ -57,6 +79,7 @@ public class InfoInOutWindow extends InfoWindow {
* @param whereClause
* @param AD_InfoWindow_ID
* @param lookup
* @param field
* @param predefinedContextVariables
*/
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;
import org.compiere.model.GridField;
@ -8,12 +29,13 @@ import org.compiere.model.MInvoice;
import org.compiere.util.Env;
/**
* Info window for C_Invoice
* @author hengsin
*
*/
public class InfoInvoiceWindow extends InfoWindow {
/**
*
* generated serial id
*/
private static final long serialVersionUID = -5175983673145977830L;
@ -59,6 +81,7 @@ public class InfoInvoiceWindow extends InfoWindow {
* @param whereClause
* @param AD_InfoWindow_ID
* @param lookup
* @param field
* @param predefinedContextVariables
*/
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;
import org.compiere.model.GridField;
/**
* Info window for C_Order
* @author hengsin
*
*/
public class InfoOrderWindow extends InfoWindow {
/**
*
* generated serial id
*/
private static final long serialVersionUID = 1241927188305227636L;
@ -57,6 +79,7 @@ public class InfoOrderWindow extends InfoWindow {
* @param whereClause
* @param AD_InfoWindow_ID
* @param lookup
* @param field
* @param predefinedContextVariables
*/
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;
/**
* Info window for M_AttributeSetInstance
* @author hengsin
*
*/
public class InfoPAttributeInstanceWindow extends InfoWindow {
/**
*
* generated serial id
*/
private static final long serialVersionUID = 8387016462564425684L;
@ -28,7 +50,6 @@ public class InfoPAttributeInstanceWindow extends InfoWindow {
String whereClause, int AD_InfoWindow_ID) {
super(WindowNo, tableName, keyColumn, queryValue, multipleSelection,
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;
/**

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;
import org.compiere.model.GridField;
/**
* Info window for C_Payment
* @author hengsin
*
*/
public class InfoPaymentWindow extends InfoWindow {
/**
*
* generated serial id
*/
private static final long serialVersionUID = 1322780214387328688L;
@ -57,6 +79,7 @@ public class InfoPaymentWindow extends InfoWindow {
* @param whereClause
* @param AD_InfoWindow_ID
* @param lookup
* @param field
* @param predefinedContextVariables
*/
public InfoPaymentWindow(int WindowNo, String tableName, String keyColumn,

View File

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

View File

@ -167,17 +167,19 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
private static final String ON_QUERY_AFTER_CHANGE = "onQueryAfterChange";
/** Query parameter grid */
protected Grid parameterGrid;
private Borderlayout layout;
private Vbox southBody;
/** List of WEditors */
protected List<WEditor> editors;
protected ArrayList<WEditor> editors2;
/** List of editors that will trigger query after changes by user */
protected List<WEditor> queryAfterChangeEditors;
protected List<WEditor> identifiers;
protected Properties infoContext;
/** embedded Panel **/
/** embedded Panel (AD_InfoRelated) **/
protected Tabbox embeddedPane = new Tabbox();
protected ArrayList <EmbedWinInfo> embeddedWinList = new ArrayList <EmbedWinInfo>();
protected Map<Integer, RelatedInfoWindow> relatedMap = new HashMap<>();
@ -191,9 +193,12 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
protected AbstractWQuickEntry vqe;
//From and to grid fields
private List<GridField> gridFields;
private List<GridField> gridFields2;
/** Selection Column Sequence:[InfoColumnVO, GridField] */
private TreeMap<Integer, List<Object[]>> parameterTree;
/** To grid field of {@link #parameterTree} */
private TreeMap<Integer, List<Object[]>> parameterTree2;
private Checkbox checkAND;
@ -209,19 +214,24 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
private Button exportButton = null;
/**
* Menu contail process menu item
* Popup menu for process
*/
protected Menupopup ipMenu;
/** Number of column for {@link #parameterGrid} */
private int noOfParameterColumn;
/** true to auto collapse parameter panel after execution of query */
private boolean autoCollapsedParameterPanel = false;
/**
* @param WindowNo
* @param tableName
* @param keyColumn
* @param queryValue
* @param multipleSelection
* @param whereClause
* @param AD_InfoWindow_ID
*/
public InfoWindow(int WindowNo, String tableName, String keyColumn, String queryValue,
boolean multipleSelection, String whereClause, int AD_InfoWindow_ID) {
@ -232,8 +242,10 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
* @param WindowNo
* @param tableName
* @param keyColumn
* @param queryValue
* @param multipleSelection
* @param whereClause
* @param AD_InfoWindow_ID
* @param lookup
*/
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());
//Xolali IDEMPIERE-1045
//update related info window tabs
contentPanel.addActionListener(new EventListener<Event>() {
public void onEvent(Event event) throws Exception {
@ -297,17 +309,16 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
updateSubcontent(row);
}
}); //xolali --end-
});
Env.setPredefinedVariables(Env.getCtx(), getWindowNo(), predefinedContextVariables);
infoContext = new Properties(Env.getCtx());
p_loadedOK = loadInfoDefinition();
// make process button only in windown mode
// make process button only in window mode
if (!m_lookup){
// IDEMPIERE-1334
initInfoProcess();
// when have a process, force multi select mode
// when have a process, force multiple selection mode
if (haveProcess)
setMultipleSelection(true);
}
@ -360,7 +371,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
* {@inheritDoc}
*/
@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)
row = contentPanel.getSelectedRow();
@ -384,11 +395,10 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
}
/**
* IDEMPIERE-1334
* load info process info
* separate by layout type
* init drop list and menu control
* set status of haveProcess flag
* IDEMPIERE-1334<br/>
* Load info processes by layout type.<br/>
* Create buttons, drop down list and popup menu.<br/>
* Set status of haveProcess flag.<br/>
*/
protected void initInfoProcess() {
if (infoWindow == null){
@ -509,10 +519,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
}
/**
* evel display logic of process info button
* 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
* Evaluate display logic of process info button and set visiblity of button. <br/>
*/
protected void bindInfoProcessBt (){
if (infoProcessBtList == null){
@ -521,11 +528,11 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
// display process in button style
for (MInfoProcess infoProcessBt : infoProcessBtList){
// eval display logic
// evaluate display logic
for (Button evlBt: btProcessList){
Integer processId = (Integer)evlBt.getAttribute(PROCESS_ID_KEY);
if (processId.intValue() == infoProcessBt.getAD_Process_ID()){
// display or hiden button
// display or hide button
evlBt.setVisible(infoProcessBt.isDisplayed(infoContext, p_WindowNo));
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
* when all item is hiden, hiden combobox and process button too
* Create drop down list (Combobox) of process
*/
protected void bindInfoProcessDropDown (){
if (infoProcessDropList == null || infoProcessDropList.size() == 0){
return;
}
// list info process after eval display logic
// list info process after evaluation of display logic
List<MInfoProcess> infoProcessDropListTmp = new ArrayList<MInfoProcess> ();
// 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);
btCbbProcess.setVisible(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
* when all menu item is hiden, hiden process menu button too
* Create popup of menu for processes
*/
protected void bindInfoProcessMenu (){
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());
// make menu item for each info process
// Create menu item for each info process
Menuitem ipMenuItem = new Menuitem();
ipMenuItem.setLabel(process.get_Translation(MProcess.COLUMNNAME_Name));
if (!Util.isEmpty(infoProcess.getImageURL(), true)) {
@ -591,11 +596,12 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
ipMenu.appendChild(ipMenuItem);
}
//hide menu button if no visible process
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() {
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() {
isQueryByUser = true;
@ -750,7 +756,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
gridField2 = new GridField(vo2);
}
gridFields2.add(gridField2);
//IDEMPIERE-4485 Clone new Gridfields with IsReadOnly = false
//IDEMPIERE-4485 Clone new Grid fields with IsReadOnly = false
if(infoColumn.isQueryCriteria()) {
vo = vo.clone(infoContext, p_WindowNo, 0, vo.AD_Window_ID, 0, 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;
@ -795,13 +801,13 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
}
infoWindowListItemRenderer = new WInfoWindowListItemRenderer(this);
contentPanel.setItemRenderer(infoWindowListItemRenderer);
infoWindowListItemRenderer = new WInfoWindowListItemRenderer(this);
contentPanel.setItemRenderer(infoWindowListItemRenderer);
if(hasEditable)
{
contentPanel.setAllowIDColumnForReadWrite(true);
infoWindowListItemRenderer.addTableValueChangeListener(contentPanel); // Replicated from WListbox constructor
}
contentPanel.setAllowIDColumnForReadWrite(true);
infoWindowListItemRenderer.addTableValueChangeListener(contentPanel); // Replicated from WListbox constructor
}
StringBuilder builder = new StringBuilder(p_whereClause != null ? p_whereClause.trim() : "");
String infoWhereClause = infoWindow.getWhereClause();
@ -832,7 +838,6 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
if (infoWindow == null)
return false;
// topinfoColumns = infoWindow.getInfoColumns();
MInfoRelated[] infoRelatedList = infoWindow.getInfoRelated(true);
//Init Info Related VO
relatedInfoList = InfoRelatedVO.getInfoRelatedVOList(Env.getCtx(), infoRelatedList, p_WindowNo);
@ -840,8 +845,6 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
Tabpanels tabPanels = new Tabpanels();
Tabs tabs = new Tabs();
// for(int i=0; i < relatedinfoList.length - 1 ; i++) {
for (InfoRelatedVO relatedInfo:relatedInfoList) {
if(!relatedInfo.isDisplayed(infoContext)) {
@ -861,8 +864,6 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
WListbox embeddedTbl = new WListbox();
String m_sqlEmbedded;
//MInfoWindow.getInfoWindow(infoRelatedID);
if (embedInfo != null) {
ArrayList<ColumnInfo> list = new ArrayList<ColumnInfo>();
list = getInfoColumnslayout(embedInfo);
@ -894,7 +895,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
embeddedPaging.setSclass("infowindow-related-paging");
//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);
RelatedInfoWindow relatedInfoWindow = new RelatedInfoWindow(ewinInfo, this, embeddedPaging, s_sqlCount, s_layoutEmbedded, editorMap);
relatedMap.put(embedInfo.getAD_InfoWindow_ID(), relatedInfoWindow);
@ -903,7 +904,6 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
Tab tab = new Tab(tabTitle);
tabs.appendChild(tab);
Tabpanel desktopTabPanel = new Tabpanel();
//desktopTabPanel.
ZKUpdateUtil.setHeight(desktopTabPanel, "100%");
Vlayout vlayout = new Vlayout();
ZKUpdateUtil.setVflex(vlayout, "1");
@ -916,12 +916,8 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
}
if (relatedInfoList.length > 0) { // setup the panel
//embeddedPane.setTitle(Msg.translate(Env.getCtx(), "Related Information"));
ZKUpdateUtil.setHeight(embeddedPane, "100%");
//tabPanels = new Tabpanels();
embeddedPane.appendChild(tabPanels);
//tabs = new 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() {
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);
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(".");
if (index >= 0 && index == infoColumn.getSelectClause().lastIndexOf("."))
@ -1108,7 +1104,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
@Override
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
*/
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
* in case first time search, return true
* @return
* Check if parameter value has change
* @return true if at least one parameter value has change or this is the first search by user
*/
protected boolean isParameteChangeValue (){
if (prevParameterValues == null){
// never process query, because consider as changed value to process current search
return true;
}
@ -1416,8 +1410,8 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
}
/**
* set parameter for statement.
* not need check null for value
* Set parameters for prepared statement.<br/>
* Does not need null check for value.
* @param pstmt
* @param parameterIndex
* @param value
@ -1477,15 +1471,15 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
}
/**
* add all ViewID in each MInfoProcess to query
* if main query have subquery in SELECT, it will beak or incorrect
* Add all ViewID in each MInfoProcess to query.<br/>
* If main query have subquery in SELECT, it will beak or incorrect
*/
protected void addViewIDToQuery () {
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 () {
if (isNeedAppendKeyViewData()){
@ -1499,15 +1493,14 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
}
/**
* because data of infoColumn have isDisplay = false not load,
* just display column is load to show in List.
* Some function receive data from hidden column as viewID in infoProcess
* or parentLink of infoRelateWindow.
*
* this function just add column name of hidden infoWindow to end of query
* @param sqlMain main sql to append column
* @param listInfoColumn list of PO contain infoColumnID, this infoColumnID will add to query
* @return sql after append column
* Info window load infoColumns with isDisplay = true to construct the main query. <br/>
* Some function uses 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.
* <p/>
* Append info window column to query.
* @param sqlMain main SQL to append column
* @param listInfoColumn list of info column to add to query
* @return SQL after append column
*/
protected String addMoreColumnToQuery (String sqlMain, IInfoColumn [] listInfoColumn) {
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.setSclass("south-collapsible-with-title");
south.setAutoscroll(true);
//south.sets
inner.appendChild(south);
embeddedPane.setSclass("info-product-tabbedpane");
ZKUpdateUtil.setVflex(embeddedPane, "1");
ZKUpdateUtil.setHflex(embeddedPane, "1");
south.appendChild(embeddedPane);
}// render embedded
center.appendChild(inner);
@ -1834,7 +1825,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
* Add Selection Column to first Tab
* @param infoColumn
* @param mField field
**/
*/
protected void addSelectionColumn(InfoColumnVO infoColumn, GridField mField, GridField mField2)
{
int displayLength = mField.getDisplayLength();
@ -2117,7 +2108,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
* Append ORDER BY expressions into the select list
* @param sql
* @param orderBy
* @return String parsed sql
* @return sql with order by
*/
private String appendOrderByToSelectList(String sql, String 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
* @return int idx
* @return index of the FROM keyword
*/
private int getIdxFrom(String sql) {
int parenthesisLevel = 0;
@ -2522,7 +2513,9 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
return true;
} // testCount
/** Return true if there is an 'IsActive' criteria */
/**
* @return true if there is an 'IsActive' criteria
*/
protected boolean hasIsActiveEditor() {
for (WEditor editor : editors) {
if (editor.getGridField() != null && "IsActive".equals(editor.getGridField().getColumnName())) {
@ -2550,54 +2543,54 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
? tableInfos[0].getSynonym()
: tableInfos[0].getTableName();
String keySelectClause = keyTableAlias + "." + p_keyColumn;
String keySelectClause = keyTableAlias + "." + p_keyColumn;
for (InfoColumnVO infoColumn : infoColumns)
for (InfoColumnVO infoColumn : infoColumns)
{
if (infoColumn.isDisplayed(infoContext, p_WindowNo))
{
ColumnInfo columnInfo = null;
String colSQL = infoColumn.getSelectClause();
if (! colSQL.toUpperCase().contains(" AS "))
colSQL += " AS " + infoColumn.getColumnName();
if (infoColumn.getAD_Reference_ID() == DisplayType.ID)
{
if (infoColumn.isDisplayed(infoContext, p_WindowNo))
{
ColumnInfo columnInfo = null;
String colSQL = infoColumn.getSelectClause();
if (! colSQL.toUpperCase().contains(" AS "))
colSQL += " AS " + infoColumn.getColumnName();
if (infoColumn.getAD_Reference_ID() == DisplayType.ID)
{
if (infoColumn.getSelectClause().equalsIgnoreCase(keySelectClause))
continue;
columnInfo = new ColumnInfo(infoColumn.getNameTrl(), colSQL, DisplayType.getClass(infoColumn.getAD_Reference_ID(), true));
}
else if (DisplayType.isLookup(infoColumn.getAD_Reference_ID()))
{
if (infoColumn.getAD_Reference_ID() == DisplayType.List)
{
WEditor editor = null;
editor = WebEditorFactory.getEditor(getGridField(infoColumn), true);
editor.setMandatory(false);
editor.setReadWrite(false);
editorMap.put(colSQL, editor);
columnInfo = new ColumnInfo(infoColumn.getNameTrl(), colSQL, ValueNamePair.class, (String)null);
}
else
{
GridField field = getGridField(infoColumn);
columnInfo = createLookupColumnInfo(tableInfos, field, infoColumn);
}
}
else
{
columnInfo = new ColumnInfo(infoColumn.getNameTrl(), colSQL, DisplayType.getClass(infoColumn.getAD_Reference_ID(), true));
}
columnInfo.setColDescription(infoColumn.getDescriptionTrl());
columnInfo.setGridField(getGridField(infoColumn));
columnInfo.setAD_Reference_ID(infoColumn.getAD_Reference_ID());
columnInfo.setAD_Reference_Value_ID(infoColumn.getAD_Reference_Value_ID());
list.add(columnInfo);
}
if (infoColumn.getSelectClause().equalsIgnoreCase(keySelectClause))
continue;
columnInfo = new ColumnInfo(infoColumn.getNameTrl(), colSQL, DisplayType.getClass(infoColumn.getAD_Reference_ID(), true));
}
else if (DisplayType.isLookup(infoColumn.getAD_Reference_ID()))
{
if (infoColumn.getAD_Reference_ID() == DisplayType.List)
{
WEditor editor = null;
editor = WebEditorFactory.getEditor(getGridField(infoColumn), true);
editor.setMandatory(false);
editor.setReadWrite(false);
editorMap.put(colSQL, editor);
columnInfo = new ColumnInfo(infoColumn.getNameTrl(), colSQL, ValueNamePair.class, (String)null);
}
else
{
GridField field = getGridField(infoColumn);
columnInfo = createLookupColumnInfo(tableInfos, field, infoColumn);
}
}
else
{
columnInfo = new ColumnInfo(infoColumn.getNameTrl(), colSQL, DisplayType.getClass(infoColumn.getAD_Reference_ID(), true));
}
columnInfo.setColDescription(infoColumn.getDescriptionTrl());
columnInfo.setGridField(getGridField(infoColumn));
columnInfo.setAD_Reference_ID(infoColumn.getAD_Reference_ID());
columnInfo.setAD_Reference_Value_ID(infoColumn.getAD_Reference_Value_ID());
list.add(columnInfo);
}
return list;
}
return list;
}
/**
@ -2617,7 +2610,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
* author xolali IDEMPIERE-1045
* GridField getGridField(InfoColumnVO infoColumn)
* @param infoColumn
* @return
* @return GridField
*/
protected GridField getGridField(InfoColumnVO infoColumn){
String columnName = infoColumn.getColumnName();
@ -2668,10 +2661,10 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
}
/**
* valid mandatory of a not null, display field
* display red color when a mandatory field is not input
* Validate mandatory fields.<br/>
* Display red color when a mandatory field is not fill.
* @param wEditor
* @return
* @return true if pass mandatory validation, false otherwise
*/
protected boolean validateField (WEditor wEditor){
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
* @return
* @return AD_Window_ID
*/
protected int getADWindowID() {
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) {
Component comp = layout.getCenter();
for (Component c : comp.getChildren()) {
@ -2802,7 +2798,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
ListModelTable model = contentPanel.getModel();
Properties ctx = new Properties(Env.getCtx()); // Allow session values
// Parameter dditors
// Parameter editors
for(WEditor e:editors)
{
@ -3099,7 +3095,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
List<Object> originalSelectedRow = temporarySelectedData.get(keyViewValue);
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);
if (originalSelectedRow != null)
@ -3140,12 +3136,12 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
*/
protected void initExport()
{
exportButton = ButtonFactory.createNamedButton("Export", false, true);
exportButton.setId("Export");
exportButton.setEnabled(false);
exportButton.addEventListener(Events.ON_CLICK, new XlsxExportAction());
confirmPanel.addComponentsLeft(exportButton);
exportButton = ButtonFactory.createNamedButton("Export", false, true);
exportButton.setId("Export");
exportButton.setEnabled(false);
exportButton.addEventListener(Events.ON_CLICK, new XlsxExportAction());
confirmPanel.addComponentsLeft(exportButton);
}
/**

View File

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

View File

@ -147,7 +147,5 @@ public class WInfoPAttributeEditor extends WEditor implements IWhereClauseEditor
@Override
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 data data that is returned from {@link ListModel#getElementAt}
* @param index the row/list index of the data that is currently being rendered
* @param data data returned from {@link ListModel#getElementAt}
* @param index the row/list index of data that is currently being rendered
*/
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
{
/**
*
* generated serial id
*/
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);
}
/** The unique identifier of the form type */
/** AD_Form_ID */
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;
/** Name of form */
private String m_name;
private ProcessInfo m_pi;
private IFormController m_customForm;
@ -91,11 +90,17 @@ public abstract class ADForm extends Window implements EventListener<Event>, IHe
this.setContentSclass("adform-content");
}
/**
* @return window number
*/
public int getWindowNo()
{
return m_WindowNo;
}
/**
* @return AD_Form_ID
*/
protected int getAdFormId()
{
return m_adFormId;
@ -104,15 +109,15 @@ public abstract class ADForm extends Window implements EventListener<Event>, IHe
/**
* Initialise the form
*
* @param adFormId the Adempiere form identifier
* @param name the name of the Adempiere form
* @param adFormId AD_Form_ID
* @param name Name of form
*/
protected void init(int adFormId, String name)
{
if(adFormId <= 0)
{
throw new IllegalArgumentException("Form Id is invalid");
throw new IllegalArgumentException("Form Id is invalid");
}
m_adFormId = adFormId;
@ -125,6 +130,9 @@ public abstract class ADForm extends Window implements EventListener<Event>, IHe
addEventListener(WindowContainer.ON_WINDOW_CONTAINER_SELECTION_CHANGED_EVENT, this);
}
/**
* Initialize form layout
*/
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
*
* @param adFormID The unique identifier for the form type
* @param adFormID AD_Form_ID
* @return The created form
*/
public static ADForm openForm (int adFormID)
@ -188,6 +196,7 @@ public abstract class ADForm extends Window implements EventListener<Event>, IHe
* @param gridTab
* @param pi
* @param predefinedContextVariables
* @param isSOTrx
* @return The created form
*/
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)
{
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
{
@ -225,9 +234,7 @@ public abstract class ADForm extends Window implements EventListener<Event>, IHe
}
} // openForm
/**
*
*/
@Override
public void onEvent(Event event) throws Exception
{
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;
}
/**
* @param customForm
*/
public void setICustomForm(IFormController customForm)
{
m_customForm = customForm;
}
/**
* @return IFormController
*/
public IFormController getICustomForm()
{
return m_customForm;
@ -282,6 +295,9 @@ public abstract class ADForm extends Window implements EventListener<Event>, IHe
private GridTab gridTab;
/**
* @return GridTab
*/
public GridTab getGridTab()
{
return gridTab;

View File

@ -57,28 +57,35 @@ import org.zkoss.zul.Treeitem;
import org.zkoss.zul.Treerow;
/**
* Menu Panel Base
* Abstract base class for Menu Panel
* @author Elaine
* @date July 31, 2012
*/
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";
/** Treeitem attribute to store the name of a menu item */
public static final String MENU_LABEL_ATTRIBUTE = "menu.label";
/**
*
* generated serial id
*/
private static final long serialVersionUID = -6160708371157917922L;
/** Event queue name */
public static final String MENU_ITEM_SELECTED_QUEUE = "MENU_ITEM_SELECTED_QUEUE";
private Properties ctx;
private Tree menuTree;
/** Listener for {@link #MENU_ITEM_SELECTED_QUEUE} event queue */
private EventListener<Event> listener;
/**
* @param parent
*/
public AbstractMenuPanel(Component parent)
{
if (parent != null)
@ -86,6 +93,9 @@ public abstract class AbstractMenuPanel extends Panel implements EventListener<E
init();
}
/**
* Initialize {@link #menuTree}
*/
protected void init() {
ctx = Env.getCtx();
int adRoleId = Env.getAD_Role_ID(ctx);
@ -96,6 +106,9 @@ public abstract class AbstractMenuPanel extends Panel implements EventListener<E
initMenu(rootNode);
}
/**
* Create components
*/
protected void initComponents()
{
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
}
/**
* Fill {@link #menuTree} from rootNode
* @param rootNode
*/
private void initMenu(MTreeNode rootNode)
{
Treecols treeCols = new Treecols();
@ -123,6 +140,11 @@ public abstract class AbstractMenuPanel extends Panel implements EventListener<E
generateMenu(rootTreeChildren, rootNode);
}
/**
* @param ctx
* @param adRoleId
* @return AD_Tree_ID for role
*/
private int getTreeId(Properties ctx, int adRoleId)
{
int AD_Tree_ID = DB.getSQLValue(null,
@ -135,6 +157,11 @@ public abstract class AbstractMenuPanel extends Panel implements EventListener<E
return AD_Tree_ID;
}
/**
* Fill treeChildren from mNode
* @param treeChildren
* @param mNode
*/
private void generateMenu(Treechildren treeChildren, MTreeNode mNode)
{
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()
{
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;
}
@Override
public void onEvent(Event event)
{
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) {
boolean newRecord = false;
if (comp instanceof A) {
@ -311,10 +348,16 @@ public abstract class AbstractMenuPanel extends Panel implements EventListener<E
else
selectedItem.setOpen(!selectedItem.isOpen());
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));
}
}
/**
* Handle new record event
* @param selectedItem
*/
private void onNewRecord(Treeitem selectedItem) {
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) {
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()
{
return menuTree;
}
/**
* @return ctx
*/
public Properties getCtx()
{
return ctx;

View File

@ -49,14 +49,14 @@ import org.zkoss.zul.Separator;
import org.zkoss.zul.South;
/**
*
* Window to view and acknowledge messages from AD_BroadcastMessage
* @author Vivek
* @author Deepak Pansheriya
*
*/
public class BroadcastMessageWindow extends Window implements IBroadcastMsgPopup,EventListener<Event>{
/**
*
* generated serial id
*/
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 UPDATE_CurrMsg = 0;
/** index of current show/render message in {@link #mbMessages} */
private int currMsg=0;
private Label textMsgNo = null;
private Html textMsgContent = null;
private North north =null;
/** Container for message navigation controls */
private Div swDiv =null;
private Button btnPrev = null;
private Button btnNext = null;
private Checkbox acknowledged = null;
private ArrayList<MBroadcastMessage> mbMessages = null;
/** AD_BroadcastMessage_ID:Processed */
private Hashtable<Integer, Boolean> hashMessages = new Hashtable<Integer, Boolean>();
/** Parent of window */
private HeaderPanel pnlHead = null;
private boolean isTest = false;
private boolean initialised = false;
/**
* @param pnlHead
*/
public BroadcastMessageWindow(HeaderPanel pnlHead) {
this.pnlHead = pnlHead;
textMsgNo = new Label();
@ -88,6 +95,9 @@ public class BroadcastMessageWindow extends Window implements IBroadcastMsgPopup
btnNext = new Button(">");
}
/**
* Layout window
*/
private void init() {
Borderlayout layout = new Borderlayout();
this.appendChild(layout);
@ -145,20 +155,20 @@ public class BroadcastMessageWindow extends Window implements IBroadcastMsgPopup
swDiv.setParent(leftCell);
acknowledged = new Checkbox();
//createHashTable();
currMsg = 0;
btnPrev.addEventListener("onClick", this);
btnNext = new Button(">");
btnNext.addEventListener("onClick", this);
swDiv.appendChild(btnPrev);
swDiv.appendChild(new Separator("vertical"));
swDiv.appendChild(textMsgNo);
swDiv.appendChild(new Separator("vertical"));
swDiv.appendChild(btnNext);
textMsgNo.setStyle("font-weight:bold;");
renderMsg(UPDATE_CurrMsg);
//createHashTable();
currMsg = 0;
btnPrev.addEventListener("onClick", this);
btnNext = new Button(">");
btnNext.addEventListener("onClick", this);
swDiv.appendChild(btnPrev);
swDiv.appendChild(new Separator("vertical"));
swDiv.appendChild(textMsgNo);
swDiv.appendChild(new Separator("vertical"));
swDiv.appendChild(btnNext);
textMsgNo.setStyle("font-weight:bold;");
renderMsg(UPDATE_CurrMsg);
if(mbMessages.size()<=0)
swDiv.setVisible(false);
@ -183,6 +193,10 @@ public class BroadcastMessageWindow extends Window implements IBroadcastMsgPopup
}
}
/**
* Process messages
* @param arrMessages
*/
public void prepareMessage(ArrayList<MBroadcastMessage> arrMessages){
mbMessages = arrMessages;
createHashTable();
@ -243,7 +257,7 @@ public class BroadcastMessageWindow extends Window implements IBroadcastMsgPopup
/**
* Update message on window
* @param status
* @param status next, previous or current
*/
public void renderMsg(int status) {
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" */
void setTitle(MBroadcastMessage bm) {
protected void setTitle(MBroadcastMessage bm) {
String title = bm.get_Translation(MBroadcastMessage.COLUMNNAME_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;
/**
* Change Password Panel
* Change Password dialog
* @author Elaine
* @date August 30, 2012
*/
public class ChangePasswordPanel extends Window implements EventListener<Event>
{
/**
*
* generated serial id
*/
private static final long serialVersionUID = -4117126419866788951L;
@ -93,6 +93,14 @@ public class ChangePasswordPanel extends Window implements EventListener<Event>
protected Textbox txtRetypeNewPassword;
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)
{
this.wndLogin = loginWindow;
@ -113,6 +121,9 @@ public class ChangePasswordPanel extends Window implements EventListener<Event>
createUI();
}
/**
* Layout dialog
*/
protected void createUI() {
Div div = new Div();
div.setSclass(ITheme.LOGIN_BOX_HEADER_CLASS);
@ -211,6 +222,9 @@ public class ChangePasswordPanel extends Window implements EventListener<Event>
this.appendChild(div);
}
/**
* Create components
*/
private void initComponents()
{
lblOldPassword = new Label();
@ -265,13 +279,13 @@ public class ChangePasswordPanel extends Window implements EventListener<Event>
txtAnswer = new Textbox();
txtAnswer.setId("txtAnswer");
// txtAnswer.setType("password");
txtAnswer.setCols(25);
ZKUpdateUtil.setWidth(txtAnswer, "220px");
}
public void onEvent(Event event)
{
@Override
public void onEvent(Event event)
{
if (event.getTarget().getId().equals(ConfirmPanel.A_OK))
{
validateChangePassword();
@ -279,7 +293,6 @@ public class ChangePasswordPanel extends Window implements EventListener<Event>
else if (event.getTarget().getId().equals(ConfirmPanel.A_CANCEL))
{
SessionManager.logoutSession();
//wndLogin.loginCancelled();
}
else if (event.getTarget() == txtNewPassword) {
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()
{
Clients.clearBusy();

View File

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

View File

@ -25,10 +25,11 @@ import org.adempiere.webui.component.Panel;
* @date Mar 2, 2007
* @version $Revision: 0.10 $
*/
@Deprecated(forRemoval = true, since = "11")
public class ConfigurationPanel extends Panel
{
/**
*
* generated serial id
*/
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;
@org.idempiere.ui.zk.annotation.Form
public class CustomForm extends ADForm
{
/**
*
* generated serial id
*/
private static final long serialVersionUID = -8498084996736578534L;

View File

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

View File

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

View File

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

View File

@ -71,6 +71,9 @@ public class HelpController
private Panel pnlToolTip, pnlContextHelp, pnlQuickInfo;
private Html htmlToolTip, htmlContextHelp, htmlQuickInfo;
/**
* Default constructor
*/
public HelpController()
{
dashboardLayout = new Anchorlayout();
@ -79,6 +82,11 @@ public class HelpController
ZKUpdateUtil.setHflex(dashboardLayout, "1");
}
/**
* Render tooltips, context help and quick info.
* @param parent
* @param desktopImpl
*/
public void render(Component parent, IDesktop desktopImpl)
{
Style style = new Style();
@ -160,6 +168,9 @@ public class HelpController
renderQuickInfo(null);
}
/**
* Setup client side script for field tooltip
*/
public void setupFieldTooltip() {
Clients.response("helpControllerFieldTooltip",
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
*/
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 desc
* @param help
@ -219,9 +230,9 @@ public class HelpController
otherContent = Msg.getMsg(Env.getCtx(), "PlaceCursorIntoField");
}
sb.append("<i>(");
sb.append (otherContent);
sb.append (")</i>");
sb.append("<i>(");
sb.append (otherContent);
sb.append (")</i>");
}else{
sb.append("<b>");
sb.append(hdr);
@ -244,6 +255,11 @@ public class HelpController
htmlToolTip.setContent(sb.toString());
}
/**
* Render context help (AD_CtxHelpMsg)
* @param ctxType
* @param recordId
*/
public void renderCtxHelp(String ctxType, int recordId)
{
if (ctxType != X_AD_CtxHelp.CTXTYPE_Home && ctxType != X_AD_CtxHelp.CTXTYPE_Tab &&
@ -653,6 +669,12 @@ public class HelpController
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) {
if (!MRole.getDefault().isTableAccessExcluded(MCtxHelpSuggestion.Table_ID)) {
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) {
if (obj == null) {
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)
{
htmlString = htmlString
@ -708,6 +739,11 @@ public class HelpController
return htmlString;
}
/**
* @param ctxType
* @param recordId
* @return MCtxHelpMsg
*/
private MCtxHelpMsg getCtxHelpMsg(String ctxType, int recordId)
{
MCtxHelpMsg retValue = MCtxHelpMsg.get(ctxType, recordId);
@ -716,7 +752,7 @@ public class HelpController
/**
* @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)
{

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;

View File

@ -15,7 +15,8 @@
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
*
*/

View File

@ -16,12 +16,15 @@ package org.adempiere.webui.panel;
import org.adempiere.webui.component.Tabpanel;
/**
*
* Interface to handle the closing of a Tab.
* @author hengsin
*
*/
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);
}

View File

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

View File

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

View File

@ -54,20 +54,20 @@ import org.zkoss.zul.South;
/**
* 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>
*/
public class InvoiceHistory extends Window implements EventListener<Event>
{
/**
*
* generated serial id
*/
private static final long serialVersionUID = 8742214467478030802L;
boolean showDetailATP = false;
protected boolean showDetailATP = false;
/**
* Show History
* @param parent
* @param C_BPartner_ID partner
* @param M_Product_ID product
* @param M_Warehouse_ID warehouse
@ -136,9 +136,9 @@ public class InvoiceHistory extends Window implements EventListener<Event>
private ListModelTable m_modelAtp = null;
/**
* Ststic Init
* Layout window
*/
void jbInit() throws Exception
protected void jbInit() throws Exception
{
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 ()
{
@ -289,7 +290,8 @@ public class InvoiceHistory extends Window implements EventListener<Event>
} // 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 ()
{
@ -314,7 +316,10 @@ public class InvoiceHistory extends Window implements EventListener<Event>
} // qyeryBPartner
/**
* Fill Table
* Fill list
* @param sql
* @param parameter
* @return List of records
*/
private Vector<Vector<Object>> fillTable (String sql, int parameter)
{
@ -369,8 +374,9 @@ public class InvoiceHistory extends Window implements EventListener<Event>
} // fillTable
/**
* Set Label
* to product or bp name
* Set Label to product or bp name.
* @param sql
* @param parameter
*/
private void fillLabel (String sql, int parameter)
{
@ -380,7 +386,7 @@ public class InvoiceHistory extends Window implements EventListener<Event>
label.setText(retValue);
} // fillLabel
@Override
public void onEvent(Event e) throws Exception {
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 ()
{

View File

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

View File

@ -103,7 +103,7 @@ import org.zkoss.zul.Image;
public class LoginPanel extends Window implements EventListener<Event>
{
/**
*
* generated serial id
*/
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 */
private int failures = 0;
/**
* @param ctx
* @param loginWindow
*/
public LoginPanel(Properties ctx, LoginWindow loginWindow)
{
this.ctx = ctx;
@ -149,6 +153,9 @@ public class LoginPanel extends Window implements EventListener<Event>
this.addEventListener(ON_LOAD_TOKEN, this);
}
/**
* Layout panel
*/
private void init()
{
createUI();
@ -238,6 +245,9 @@ public class LoginPanel extends Window implements EventListener<Event>
txtPassword.removeEventListener(Events.ON_FOCUS, txtPassword);
}
/**
* Layout panel
*/
protected void createUI() {
Form form = new Form();
@ -364,6 +374,9 @@ public class LoginPanel extends Window implements EventListener<Event>
this.appendChild(form);
}
/**
* Create components
*/
private void initComponents()
{
lblUserId = new Label();
@ -383,14 +396,12 @@ public class LoginPanel extends Window implements EventListener<Event>
txtUserId.setCols(25);
txtUserId.setMaxlength(40);
ZKUpdateUtil.setWidth(txtUserId, "220px");
//txtUserId.addEventListener(Events.ON_CHANGE, this); // Elaine 2009/02/06
txtUserId.setClientAttribute("autocomplete", "username");
txtPassword = new Textbox();
txtPassword.setId("txtPassword");
txtPassword.setType("password");
txtPassword.setCols(25);
// txtPassword.setMaxlength(40);
ZKUpdateUtil.setWidth(txtPassword, "220px");
if (MSysConfig.getBooleanValue(MSysConfig.ZK_LOGIN_ALLOW_CHROME_SAVE_PASSWORD, true))
txtPassword.setClientAttribute("autocomplete", "current-password");
@ -425,8 +436,9 @@ public class LoginPanel extends Window implements EventListener<Event>
if (lstLanguage.getItems().size() > 0){
validLstLanguage = (String)lstLanguage.getItems().get(0).getLabel();
}
}
}
@Override
public void onEvent(Event event)
{
Component eventComp = event.getTarget();
@ -455,16 +467,6 @@ public class LoginPanel extends Window implements EventListener<Event>
{
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))
{
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) {
String userName = txtUserId.getValue();
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))
{
lstLanguage.setSelectedIndex(i);
languageChanged(li.getLabel()); // Elaine 2009/04/17 language changed
languageChanged(li.getLabel());
break;
}
}
}
}
/**
* Apply language change to UI elements
* @param langName
*/
private void languageChanged(String 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)));
}
/**
* Find language by name
* @param langName
* @return Language
*/
private Language findLanguage(String langName) {
Language tmp = Language.getLanguage(langName);
Language language = new Language(tmp.getName(), tmp.getAD_Language(), tmp.getLocale(), tmp.isDecimalPoint(),
@ -559,20 +574,20 @@ public class LoginPanel extends Window implements EventListener<Event>
Env.setContext(ctx, AEnv.LOCALE, language.getLocale().toString());
//cph::erp added this in order to get the processing dialog in the correct language
Locale locale = language.getLocale();
try {
Locale locale = language.getLocale();
try {
Clients.reloadMessages(locale);
} catch (IOException e) {
logger.log(Level.WARNING, e.getLocalizedMessage(), e);
}
Locales.setThreadLocal(locale);
// cph::erp end
} catch (IOException e) {
logger.log(Level.WARNING, e.getLocalizedMessage(), e);
}
Locales.setThreadLocal(locale);
return language;
}
/**
* validates user name and password when logging in
*
**/
* Validates user name and password when logging in
*/
public void validateLogin()
{
Login login = new Login(ctx);
@ -657,12 +672,11 @@ public class LoginPanel extends Window implements EventListener<Event>
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?
// https://sourceforge.net/p/adempiere/zk-web-client/303/
// 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));
// End of temporary code for [ adempiere-ZK Web Client-2832968 ] User context lost?
/* Check DB version */
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() {
String msg = Msg.getMsg(Env.getCtx(), "SessionTimeoutText").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;
}
/**
* Handle reset password event
*/
private void btnResetPasswordClicked()
{
String userId = Login.getAppUser(txtUserId.getValue());
@ -725,7 +745,10 @@ public class LoginPanel extends Window implements EventListener<Event>
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) {
List<String> arrstr = new ArrayList<String>();
if (header == null)

View File

@ -25,33 +25,45 @@ import org.zkoss.zul.Checkbox;
import org.zkoss.zul.Toolbar;
/**
* Menu Search Panel
* Panel with {@link MenuTreeSearchPanel}.
* @author Elaine
* @date July 31, 2012
*/
public class MenuSearchPanel extends AbstractMenuPanel
{
/**
*
* generated serial id
*/
private static final long serialVersionUID = 5308522340852904168L;
protected MenuTreeSearchPanel pnlSearch;
/** Listener for MENU_TREE_FILTER_CHECKED_QUEUE desktop event queue */
private EventListener<Event> listener;
/**
* @param parent
*/
public MenuSearchPanel(Component parent)
{
super(parent);
this.setSclass("menu-search-panel-container");
}
/**
* Layout panel
*/
@Override
protected void init()
{
super.init();
pnlSearch.initialise();
}
/**
* Create components
*/
@Override
protected void 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;
import java.util.List;
@ -21,6 +45,9 @@ import org.zkoss.zul.Treechildren;
import org.zkoss.zul.Treeitem;
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 {
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";
/** Tree to apply menu type filter and flat view toggle */
private Tree tree;
@SuppressWarnings("unused")
private TreeSearchPanel searchPanel;
private Checkbox flatView;
/**
* @param tree
* @param panel
*/
public MenuTreeFilterPanel(Tree tree, TreeSearchPanel panel) {
super();
this.tree = tree;
@ -114,6 +146,7 @@ public class MenuTreeFilterPanel extends Popup implements EventListener<Event>,
appendChild(box);
}
@Override
public void onEvent(Event event) throws Exception {
final Checkbox chk = (Checkbox) event.getTarget();
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 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) {
Treeitem sibling = (Treeitem) treeItem.getAttribute(ORIGINAL_SIBLING);
if (sibling != null)
@ -245,6 +283,12 @@ public class MenuTreeFilterPanel extends Popup implements EventListener<Event>,
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) {
List<Component> childrens = treechildren.getChildren();
if (childrens.isEmpty()) {
@ -274,6 +318,11 @@ public class MenuTreeFilterPanel extends Popup implements EventListener<Event>,
return null;
}
/**
* Handle menu type toggle
* @param tree
* @param chk
*/
public static void toggle(Tree tree, final Checkbox chk) {
TreeUtils.traverse(tree, new TreeItemAction() {
public void run(Treeitem treeItem) {

View File

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

View File

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

View File

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

View File

@ -25,10 +25,11 @@ import org.adempiere.webui.component.Panel;
* @date Mar 3, 2007
* @version $Revision: 0.10 $
*/
@Deprecated(forRemoval = true, since = "11")
public class RequestNoticePanel extends Panel
{
/**
*
* generated serial id
*/
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>
{
/**
*
* generated serial id
*/
private static final long serialVersionUID = -657724758165769510L;
@ -98,6 +98,12 @@ public class ResetPasswordPanel extends Window implements EventListener<Event>
protected Textbox txtUserId;
protected Textbox txtEmail;
/**
* @param ctx
* @param loginWindow
* @param userName
* @param noSecurityQuestion
*/
public ResetPasswordPanel(Properties ctx, LoginWindow loginWindow, String userName, boolean noSecurityQuestion)
{
this.wndLogin = loginWindow;
@ -114,11 +120,17 @@ public class ResetPasswordPanel extends Window implements EventListener<Event>
loadData();
}
/**
* Layout panel
*/
private void init()
{
createUI();
}
/**
* Layout panel
*/
protected void createUI() {
Div div = new Div();
div.setSclass(ITheme.LOGIN_BOX_HEADER_CLASS);
@ -216,6 +228,9 @@ public class ResetPasswordPanel extends Window implements EventListener<Event>
this.appendChild(div);
}
/**
* Create components
*/
private void initComponents()
{
lblEmail = new Label();
@ -260,7 +275,6 @@ public class ResetPasswordPanel extends Window implements EventListener<Event>
txtAnswer = new Textbox();
txtAnswer.setType("password");
txtAnswer.setId("txtAnswer");
// txtAnswer.setType("password");
txtAnswer.setCols(25);
ZKUpdateUtil.setWidth(txtAnswer, "220px");
txtAnswer.setReadonly(true);
@ -278,6 +292,9 @@ public class ResetPasswordPanel extends Window implements EventListener<Event>
}
}
/**
* Load security question from AD_User
*/
protected void loadSecurityQuestion()
{
String email = txtEmail.getValue();
@ -313,6 +330,7 @@ public class ResetPasswordPanel extends Window implements EventListener<Event>
txtAnswer.setVisible(true);
}
@Override
public void onEvent(Event event)
{
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))
{
SessionManager.logoutSession();
//wndLogin.loginCancelled();
}
}
/**
* Validate fields
*/
public void validate (){
Clients.clearBusy();
@ -335,6 +355,9 @@ public class ResetPasswordPanel extends Window implements EventListener<Event>
validateResetPassword();
}
/**
* validate user name and email
*/
protected void validateEmail()
{
String email = txtEmail.getValue();
@ -365,6 +388,9 @@ public class ResetPasswordPanel extends Window implements EventListener<Event>
loadSecurityQuestion();
}
/**
* validate fields and reset password
*/
protected void validateResetPassword()
{
String email = txtEmail.getValue();
@ -493,13 +519,18 @@ public class ResetPasswordPanel extends Window implements EventListener<Event>
@Override
public void onCallback(Integer result) {
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)
{
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;
/**
*
* Select role panel
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @date Feb 25, 2007
* @version $Revision: 0.10 $
@ -83,7 +83,7 @@ import org.zkoss.zul.Image;
public class RolePanel extends Window implements EventListener<Event>, Deferrable
{
/**
*
* generated serial id
*/
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";
/**
* @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) {
this.wndLogin = loginWindow;
m_ctx = ctx;
@ -140,7 +148,6 @@ public class RolePanel extends Window implements EventListener<Event>, Deferrabl
m_userpreference.loadPreference(user.get_ID());
}
initComponents();
init();
this.setId("rolePanel");
@ -167,12 +174,18 @@ public class RolePanel extends Window implements EventListener<Event>, Deferrabl
}
}
/**
* Layout panel
*/
private void init()
{
Clients.response(new AuScript("zAu.cmd0.clearBusy()"));
createUI();
}
/**
* Layout panel
*/
protected void createUI() {
Div div = new Div();
div.setSclass(ITheme.LOGIN_BOX_HEADER_CLASS);
@ -293,6 +306,9 @@ public class RolePanel extends Window implements EventListener<Event>, Deferrabl
this.appendChild(div);
}
/**
* Create components
*/
private void initComponents()
{
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);
}
/**
* Update roles available for selection (after selection of tenant)
*/
private void updateRoleList()
{
lstRole.getItems().clear();
@ -457,6 +476,9 @@ public class RolePanel extends Window implements EventListener<Event>, Deferrabl
updateOrganisationList();
}
/**
* After organizations available for selection (after selection of role)
*/
private void updateOrganisationList()
{
lstOrganisation.getItems().clear();
@ -507,6 +529,9 @@ public class RolePanel extends Window implements EventListener<Event>, Deferrabl
updateWarehouseList();
}
/**
* Update list of warehouse available for selection (after selection of organization)
*/
private void updateWarehouseList()
{
lstWarehouse.getItems().clear();
@ -542,6 +567,7 @@ public class RolePanel extends Window implements EventListener<Event>, Deferrabl
}
}
@Override
public void onEvent(Event event)
{
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() {
if (lstClient.getSelectedItem() != null) {
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
*
**/
*/
public void validateRoles(boolean isMFAValidated)
{
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);
}
@Override
public boolean isDeferrable() {
return false;
}
/**
* @return true if role selection panel will be shown to user
*/
public boolean show() {
return m_showRolePanel;
}

View File

@ -45,9 +45,6 @@ import org.zkoss.zul.West;
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>
* @date Mar 12, 2007
* @version $Revision: 0.10 $
@ -55,7 +52,7 @@ import org.zkoss.zul.Borderlayout;
public class StatusBarPanel extends Panel implements EventListener<Event>, IStatusBar
{
/**
*
* generated serial id
*/
private static final long serialVersionUID = 1217160210065925924L;
@ -82,12 +79,18 @@ public class StatusBarPanel extends Panel implements EventListener<Event>, IStat
private Div popupContent;
private String popupStyle;
/**
* Default constructor
*/
public StatusBarPanel()
{
super();
init();
}
/**
* Layout panel
*/
private void init()
{
setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "statusBar");
@ -239,6 +242,9 @@ public class StatusBarPanel extends Panel implements EventListener<Event>, IStat
return statusLine.getValue();
}
/**
* Create popup for status line
*/
private void createPopup() {
popupContent = new Div();
@ -250,11 +256,15 @@ public class StatusBarPanel extends Panel implements EventListener<Event>, IStat
popup.setStyle("position: absolute; display: none");
}
/**
* Show status line popup
*/
private void showPopup() {
popup.setVisible(true);
popup.setStyle(popupStyle);
if (getRoot() == null || !getRoot().isVisible() ) return;
//client side script to position popup
String script = "(function(){let d = zk.Widget.$('" + popup.getUuid() + "').$n();";
script += "d.style.display='block';d.style.visibility='hidden';";
script += "let dhs = document.defaultView.getComputedStyle(d, null).getPropertyValue('height');";
@ -297,6 +307,9 @@ public class StatusBarPanel extends Panel implements EventListener<Event>, IStat
invalidate();
} // setInfo
/**
* @param rowNum
*/
public void setSelectedRowNumber (String rowNum){
selectedLine.setVisible(rowNum != null);
if (rowNum != null){
@ -305,6 +318,7 @@ public class StatusBarPanel extends Panel implements EventListener<Event>, IStat
invalidate();
}
@Override
public void onEvent(Event event) throws Exception {
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.Vlayout;
import org.zkoss.zul.Window;
/**
*
* session timeout counter window
* @author Deepak Pansheriya
*
*/
public class TimeoutPanel extends Window implements
org.zkoss.zk.ui.event.EventListener<Event> {
/**
* generated serial id
*/
private static final long serialVersionUID = -2734157789771800337L;
private Timer timer = null;
private int count = 0;
@ -48,11 +51,14 @@ public class TimeoutPanel extends Window implements
private Label ltime = null;
private Timer timerJS = null;
/**
* @param pnlHead
* @param timeInSecond
*/
public TimeoutPanel(HeaderPanel pnlHead, int timeInSecond) {
count = timeInSecond;
pnlHead.appendChild(this);
Borderlayout layout = new Borderlayout();
layout.setParent(this);
@ -79,17 +85,14 @@ public class TimeoutPanel extends Window implements
Vlayout centerVlayout = new Vlayout();
centerVlayout.setParent(center);
centerVlayout.setStyle("height:100%; text-align: center;");
centerVlayout.setStyle("height:100%; text-align: center;");
South south = new South();
south.setParent(layout);
south.setParent(layout);
Div divSouth = new Div();
divSouth.setParent(south);
divSouth.setStyle("height:100%; text-align: center;");
divSouth.setStyle("height:100%; text-align: center;");
timer = new Timer();
timer.setDelay((count * 1000));
@ -97,7 +100,6 @@ public class TimeoutPanel extends Window implements
timer.setRepeats(true);
timer.start();
centerVlayout.appendChild(timer);
Script jScript = new Script("var countJS = "+count+";");
jScript.setDynamicProperty("defer","true");
@ -120,17 +122,14 @@ public class TimeoutPanel extends Window implements
ltime = new Label(minConverted +" : "+secConverted);
ltime.setParent(centerVlayout);
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"));
txtLbl.setParent(centerVlayout);
txtLbl.setStyle("font-size: 12px;");
Vlayout vLayout = new Vlayout();
vLayout.setParent(divSouth);
Label saveLbl = new Label(Msg.getMsg(Env.getCtx(),"killsession.saveWorkMessage"));
saveLbl.setParent(vLayout);
saveLbl.setStyle("font-size: 20px;");

View File

@ -22,6 +22,7 @@ import java.util.Set;
import java.util.TreeMap;
import org.adempiere.webui.ClientInfo;
import org.adempiere.webui.adwindow.ADTreePanel;
import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.component.AutoComplete;
import org.adempiere.webui.component.Label;
@ -61,7 +62,8 @@ import org.zkoss.zul.impl.LabelElement;
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>
* @date Mar 3, 2007
* @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";
/**
*
* generated serial id
*/
private static final long serialVersionUID = -1659100374345282774L;
private static final String ON_COMBO_SELECT_ECHO_EVENT = "onComboSelectEcho";
private static final String ON_POST_SELECT_TREEITEM_EVENT = "onPostSelectTreeitem";
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>();
//values for combo auto complete
protected String[] treeValues;
protected String[] treeTypes;
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});"
+ "zAu.send(evt);})()";
/**
* Layout panel
*/
protected void init()
{
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) {
if (moveItemBox != null) {
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) {
Treeitem item = (Treeitem) evt.getData();
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() {
if (moveItemBox != null) {
moveItemBox.detach();
@ -274,12 +292,20 @@ public class TreeSearchPanel extends Panel implements EventListener<Event>, Tree
ti.focus();
}
/**
* Add treeItem to {@link #treeNodeItemMap}
* @param treeItem
*/
protected void addTreeItem(Treeitem treeItem)
{
StringBuilder key = new StringBuilder(getLabel(treeItem)).append(".").append(treeItem.getAttribute(AbstractMenuPanel.MENU_TYPE_ATTRIBUTE));
treeNodeItemMap.put(key.toString(), treeItem);
}
/**
* Add DefaultTreeNode to {@link #treeNodeItemMap}
* @param node
*/
protected void addTreeItem(DefaultTreeNode<?> node) {
Object data = node.getData();
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() {
treeNodeItemMap.clear();
if (tree.getModel() == null) {
@ -371,6 +400,10 @@ public class TreeSearchPanel extends Panel implements EventListener<Event>, Tree
cmbSearch.setContents(treeTypes);
}
/**
* @param treeItem
* @return true if treeItem is folder
*/
protected boolean isFolder(Treeitem treeItem) {
List<Component> list = treeItem.getChildren();
for (Component c : list) {
@ -381,6 +414,10 @@ public class TreeSearchPanel extends Panel implements EventListener<Event>, Tree
return false;
}
/**
* @param treeItem
* @return label for treeItem
*/
protected String getLabel(Treeitem treeItem) {
String label = treeItem.getLabel();
if (label == null || label.trim().length() == 0)
@ -395,6 +432,10 @@ public class TreeSearchPanel extends Panel implements EventListener<Event>, Tree
return label;
}
/**
* @param treeItem
* @return Image URL for treeItem
*/
protected String getImage(Treeitem treeItem) {
String image = treeItem.getImage();
if (image == null || image.trim().length() == 0)
@ -413,6 +454,7 @@ public class TreeSearchPanel extends Panel implements EventListener<Event>, Tree
* @param event
* @see EventListener#onEvent(Event)
*/
@Override
public void onEvent(Event event)
{
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) {
if (Executions.getCurrent().getAttribute(getUuid()+".selectTreeitem") != null)
return;
@ -515,6 +561,9 @@ public class TreeSearchPanel extends Panel implements EventListener<Event>, Tree
}
}
/**
* Handle ON_POST_SELECT_TREEITEM_EVENT
*/
protected void onPostSelectTreeitem() {
Clients.clearBusy();
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);
}
/**
* select selectedItem and make sure parent of selectedItem is open
* @param selectedItem
*/
public static void select(Treeitem selectedItem) {
Treeitem parent = selectedItem.getParentItem();
while (parent != null) {
@ -554,6 +607,9 @@ public class TreeSearchPanel extends Panel implements EventListener<Event>, Tree
refreshSearchList();
}
/**
* @return selected tree item
*/
public Treeitem getSelectedItem() {
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_LOGOUT = "onDeferLogout";
/**
* Default constructor
*/
public UserPanel()
{
super();
this.ctx = Env.getCtx();
}
/**
* Call when UI is compose from zul definition
*/
protected void onCreate()
{
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() {
return ClientInfo.isMobile();
}
/**
* @return name of user
*/
private String getUserName()
{
MUser user = MUser.get(ctx);
return user.getName();
}
/**
* @return name of role
*/
private String getRoleName()
{
MRole role = MRole.getDefault(ctx, false);
return role.getName();
}
/**
* @return name of tenant
*/
private String getClientName()
{
MClient client = MClient.get(ctx);
return client.getName();
}
/**
* @return name of organization
*/
private String getOrgName()
{
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 {
if (event == null)
return;
@ -292,6 +314,9 @@ public class UserPanel implements EventListener<Event>, Composer<Component>
}
/**
* Open user panel popup for mobile client
*/
protected void openMobileUserPanelPopup() {
if (popup != null) {
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() {
MUser user = MUser.get(ctx);
return user.getEMail();
}
/**
* @return name of warehouse
*/
private String getWarehouseName() {
int id = Env.getContextAsInt(Env.getCtx(), Env.M_WAREHOUSE_ID);
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.Image;
/**
* Multi factor authentication panel
*/
public class ValidateMFAPanel extends Window implements EventListener<Event> {
/**
*
* generated serial id
*/
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 */
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) {
this.wndLogin = loginWindow;
m_ctx = ctx;
@ -146,6 +158,9 @@ public class ValidateMFAPanel extends Window implements EventListener<Event> {
}
/**
* Layout panel
*/
private void init() {
Div div = new Div();
div.setSclass(ITheme.LOGIN_BOX_HEADER_CLASS);
@ -244,6 +259,10 @@ public class ValidateMFAPanel extends Window implements EventListener<Event> {
this.appendChild(div);
}
/**
* Create components
* @param hasCookie
*/
private void initComponents(boolean hasCookie) {
lblMFAMechanism = new Label();
lblMFAMechanism.setId("lblMFAMechanism");
@ -298,6 +317,7 @@ public class ValidateMFAPanel extends Window implements EventListener<Event> {
txtValidationCode.setDisabled(true);
}
@Override
public void onEvent(Event event) {
if (event.getTarget().getId().equals(ConfirmPanel.A_OK)) {
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) {
Clients.clearBusy();
@ -426,6 +450,9 @@ public class ValidateMFAPanel extends Window implements EventListener<Event> {
return null;
}
/**
* @return true if panel is shown to user
*/
public boolean show() {
return m_showMFAPanel;
}

View File

@ -86,14 +86,14 @@ import org.zkoss.zul.impl.Utils;
import org.zkoss.zul.impl.XulElement;
/**
*
* Attachment window
* @author Low Heng Sin
*
*/
public class WAttachment extends Window implements EventListener<Event>
{
/**
*
* generated serial id
*/
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_UU record UUID
* @param trxName transaction
* @param eventListener
* @param eventListener listener for ON_WINDOW_CLOSE event
*/
public WAttachment( int WindowNo, int AD_Attachment_ID,
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);
AEnv.showWindow(this);
if (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));
}
autoPreview(0, true);
}
catch (Exception e)
{
@ -270,7 +264,7 @@ public class WAttachment extends Window implements EventListener<Event>
} // WAttachment
/**
* Static setup.
* layout window
* <pre>
* - northPanel
* - toolBar
@ -282,8 +276,7 @@ public class WAttachment extends Window implements EventListener<Event>
* </pre>
* @throws Exception
*/
void staticInit() throws Exception
protected void staticInit() throws Exception
{
this.setAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "attachment");
this.setMaximizable(true);
@ -367,7 +360,6 @@ public class WAttachment extends Window implements EventListener<Event>
bLoad.setImage(ThemeManager.getThemeResource("images/Import24.png"));
bLoad.setSclass("img-btn");
bLoad.setId("bLoad");
// bLoad.setAttribute("org.zkoss.zul.image.preload", Boolean.TRUE);
bLoad.setTooltiptext(Msg.getMsg(Env.getCtx(), "Load"));
bLoad.setUpload("multiple=true," + AdempiereWebUI.getUploadSetting());
bLoad.addEventListener(Events.ON_UPLOAD, this);
@ -390,7 +382,6 @@ public class WAttachment extends Window implements EventListener<Event>
Center centerPane = new Center();
centerPane.setSclass("dialog-content");
//centerPane.setAutoscroll(true); // not required the preview has its own scroll bar
mainPanel.appendChild(centerPane);
centerPane.appendChild(previewPanel);
ZKUpdateUtil.setVflex(previewPanel, "1");
@ -442,6 +433,9 @@ public class WAttachment extends Window implements EventListener<Event>
addEventListener(Events.ON_CANCEL, e -> onCancel());
}
/**
* Handle onClientInfo event
*/
protected void onClientInfo()
{
if (getPage() != null)
@ -458,9 +452,8 @@ public class WAttachment extends Window implements EventListener<Event>
}
/**
* Dispose
* Dispose
*/
public void dispose ()
{
preview = null;
@ -468,12 +461,12 @@ public class WAttachment extends Window implements EventListener<Event>
} // dispose
/**
* Load Attachments
* Load Attachment items
*/
private void loadAttachments()
{
log.config("");
if (log.isLoggable(Level.CONFIG))
log.config("");
// Set Text/Description
@ -498,6 +491,12 @@ public class WAttachment extends Window implements EventListener<Event>
} // 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)
{
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) {
int index = name.lastIndexOf(".");
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
*/
@ -604,6 +608,9 @@ public class WAttachment extends Window implements EventListener<Event>
bPreview.setEnabled(false);
} // displayData
/**
* Clear preview content ({@link #preview} and {@link #customPreviewComponent})
*/
private void clearPreview()
{
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
* @return file name or null
*/
private String getFileName (int index)
{
String fileName = null;
@ -668,10 +674,10 @@ public class WAttachment extends Window implements EventListener<Event>
} // getFileName
/**
* Action Listener
* handle event
* @param e event
*/
@Override
public void onEvent(Event e)
{
// Save and Close
@ -735,6 +741,9 @@ public class WAttachment extends Window implements EventListener<Event>
} // onEvent
/**
* Handle onCancel event
*/
private void onCancel() {
// do not allow to close tab for Events.ON_CTRL_KEY event
if(isUseEscForTabClosing)
@ -743,10 +752,13 @@ public class WAttachment extends Window implements EventListener<Event>
dispose();
}
/**
* Process uploaded media
* @param media
*/
private void processUploadMedia(Media media) {
if (media != null && ((media.isBinary() && media.getByteData().length>0) || (!media.isBinary() && media.getStringData().length() > 0)))
{
// pdfViewer.setContent(media);
;
}
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) {
byte[] bytes = null;
@ -813,11 +830,12 @@ public class WAttachment extends Window implements EventListener<Event>
}
/**
* Delete entire Attachment
* Delete entire Attachment
*/
private void deleteAttachment()
{
log.info("");
if (log.isLoggable(Level.INFO))
log.info("");
Dialog.ask(m_WindowNo, "AttachmentDelete?", new Callback<Boolean>() {
@ -837,12 +855,12 @@ public class WAttachment extends Window implements EventListener<Event>
} // deleteAttachment
/**
* Delete Attachment Entry
* Delete current Attachment Entry
*/
private void deleteAttachmentEntry()
{
log.info("");
if (log.isLoggable(Level.INFO))
log.info("");
final int index = cbContent.getSelectedIndex();
String fileName = getFileName(index);
@ -870,13 +888,13 @@ public class WAttachment extends Window implements EventListener<Event>
} // deleteAttachment
/**
* Save Attachment to File
* Save current Attachment entry to File
*/
private void saveAttachmentToFile()
{
int index = cbContent.getSelectedIndex();
log.info("index=" + index);
if (log.isLoggable(Level.INFO))
log.info("index=" + index);
if (m_attachment.getEntryCount() < index)
return;
@ -896,7 +914,11 @@ public class WAttachment extends Window implements EventListener<Event>
}
} // saveAttachmentToFile
/**
* Get charset from content type header. Fallback to UTF-8
* @param contentType
* @return charset
*/
static private String getCharset(String contentType) {
if (contentType != null) {
int j = contentType.indexOf("charset=");
@ -908,6 +930,9 @@ public class WAttachment extends Window implements EventListener<Event>
return "UTF-8";
}
/**
* Save all attachment items as zip file
*/
private void saveAllAsZip() {
File zipFile = m_attachment.saveAsZip();
@ -923,6 +948,9 @@ public class WAttachment extends Window implements EventListener<Event>
}
}
/**
* Email current attachment entry
*/
private void sendMail()
{
int index = cbContent.getSelectedIndex();

View File

@ -60,12 +60,13 @@ import org.zkoss.zul.Listitem;
import org.zkoss.zul.Space;
import org.zkoss.zul.Vlayout;
/**
* Document action dialog
*/
public class WDocActionPanel extends Window implements EventListener<Event>, DialogEvents
{
/**
*
* generated serial id
*/
private static final long serialVersionUID = -3218367479851088526L;
@ -90,11 +91,18 @@ public class WDocActionPanel extends Window implements EventListener<Event>, Dia
logger = CLogger.getCLogger(WDocActionPanel.class);
}
/**
* @param mgridTab
*/
public WDocActionPanel(GridTab mgridTab)
{
this(mgridTab, false);
}
/**
* @param mgridTab
* @param fromMenu
*/
public WDocActionPanel(GridTab mgridTab, boolean fromMenu)
{
gridTab = mgridTab;
@ -111,12 +119,11 @@ public class WDocActionPanel extends Window implements EventListener<Event>, Dia
}
/**
* Dynamic Init - determine valid DocActions based on DocStatus for the different documents.
* Dynamic Init - determine valid DocActions based on DocStatus for the different documents.
* @param fromMenu
*/
private void dynInit(boolean fromMenu)
{
//
Object Processing = gridTab.getValue("Processing");
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)
{
//message.setText("*** ERROR ***");
return;
}
@ -235,10 +241,19 @@ public class WDocActionPanel extends Window implements EventListener<Event>, Dia
DocAction = DocumentEngine.ACTION_Close;
}
/**
* @return available document action items
*/
public List<Listitem> getDocActionItems() {
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)
{
String sql = "SELECT 2 FROM " + TableName
@ -248,6 +263,9 @@ public class WDocActionPanel extends Window implements EventListener<Event>, Dia
return result == 2;
}
/**
* Create components
*/
private void initComponents()
{
lblDocAction = new Label();
@ -267,6 +285,9 @@ public class WDocActionPanel extends Window implements EventListener<Event>, Dia
ZKUpdateUtil.setVflex(confirmPanel, "true");
}
/**
* Layout dialog
*/
private void init()
{
setSclass("popup-dialog doc-action-dialog");
@ -322,6 +343,7 @@ public class WDocActionPanel extends Window implements EventListener<Event>, Dia
return m_OKpressed;
} // isStartProcess
@Override
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) {
lstDocAction.setSelectedIndex(-1);
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) {
MClientInfo clientInfo = MClientInfo.get(Env.getCtx());
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() {
String statusSql = "SELECT DocStatus FROM " + gridTab.getTableName()
+ " WHERE " + gridTab.getKeyColumnName() + " = ? ";
@ -416,6 +449,9 @@ public class WDocActionPanel extends Window implements EventListener<Event>, Dia
detach();
}
/**
* Update GridTab with selected DocAction value
*/
private void setValue()
{
int index = getSelectedIndex();
@ -424,8 +460,11 @@ public class WDocActionPanel extends Window implements EventListener<Event>, Dia
gridTab.setValue("DocAction", s_value[index]);
} // save
private void readReference()
{
/**
* Load document action list from AD_Ref_List
*/
private void readReference()
{
ArrayList<String> v_value = new ArrayList<String>();
ArrayList<String> v_name = new ArrayList<String>();
ArrayList<String> v_description = new ArrayList<String>();
@ -445,6 +484,9 @@ public class WDocActionPanel extends Window implements EventListener<Event>, Dia
}
} // readReference
/**
* @return selected index
*/
public int getSelectedIndex()
{
int index = 0;
@ -464,6 +506,9 @@ public class WDocActionPanel extends Window implements EventListener<Event>, Dia
return index;
} // getSelectedIndex
/**
* @return number of document action items
*/
public int getNumberOfOptions() {
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.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
* @date September 24, 2007
*/
public class WOnlyCurrentDays extends Window implements EventListener<Event>, DialogEvents
{
/**
*
* generated serial id
*/
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);
/**
* Static Initializer
* Layout dialog
* @throws Exception
*/
*/
private void jbInit() throws Exception
{
bShowAll.setLabel(Msg.getMsg(Env.getCtx(), "All"));
@ -123,13 +120,13 @@ public class WOnlyCurrentDays extends Window implements EventListener<Event>, Di
/**
* Get selected number of days
* @return days or -1 for all
*/
*/
public int getCurrentDays()
{
return m_days;
} // getCurrentDays
@Override
public void onEvent(Event event) throws Exception
{
if (event.getTarget() == bShowDay)

View File

@ -46,14 +46,18 @@ import org.zkoss.zul.Hbox;
import org.zkoss.zul.Html;
import org.zkoss.zul.Vlayout;
/**
* Form to capture process parameters for scheduler, etc
*/
@org.idempiere.ui.zk.annotation.Form
public class WProcessParameterForm extends ADForm
{
/**
*
* generated serial id
*/
private static final long serialVersionUID = -2533099650671242190L;
/** Form Controller */
private WProcessParameter pp;
private VerticalBox dialogBody;
@ -77,6 +81,9 @@ public class WProcessParameterForm extends ADForm
private final static CLogger log = CLogger.getCLogger(WProcessParameterForm.class);
/**
* @param wpp
*/
public WProcessParameterForm(WProcessParameter wpp) {
pp = wpp;
initComponents();
@ -110,6 +117,9 @@ public class WProcessParameterForm extends ADForm
}
}
/**
* Handle onCancel event
*/
private void onCancel() {
// do not allow to close tab for Events.ON_CTRL_KEY event
if(isUseEscForTabClosing)
@ -118,6 +128,9 @@ public class WProcessParameterForm extends ADForm
this.dispose();
}
/**
* Handle onOk event
*/
private void onOK() {
MPInstancePara[] paras = parameterPanel.getParameters();
GridTab gridTab = super.getGridTab();
@ -157,6 +170,9 @@ public class WProcessParameterForm extends ADForm
ZKUpdateUtil.setVflex(this, "min");
}
/**
* Create components
*/
private void initComponents() {
this.setBorder("normal");
dialogBody = new VerticalBox();
@ -194,8 +210,8 @@ public class WProcessParameterForm extends ADForm
}
/**
* Dynamic Init
* @return true, if there is something to process (start from menu)
* Init {@link #parameterPanel}
* @return true if init ok
*/
private boolean init()
{
@ -252,7 +268,6 @@ public class WProcessParameterForm extends ADForm
this.setTitle(m_Name);
message.setContent(m_messageText.toString());
// Move from APanel.actionButton
processInfo.setAD_User_ID (Env.getAD_User_ID(Env.getCtx()));
processInfo.setAD_Client_ID(Env.getAD_Client_ID(Env.getCtx()));
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.Div;
/**
* Panel to select printed print format items
*/
public class WRC1DisplayFieldsPanel extends WRCTabPanel implements EventListener<Event>
{
/**
*
* generated serial id
*/
private static final long serialVersionUID = -4595966853507636969L;
private static final int RENDER_IN_COLUMNS=4;
private MPrintFormat m_printFormat;
Checkbox m_chkboxes[]=null;
Textbox m_textBoxes[]=null;
String m_oldLabel[]=null;
protected Checkbox m_chkboxes[]=null;
protected Textbox m_textBoxes[]=null;
protected String m_oldLabel[]=null;
/**
* Default constructor
*/
public WRC1DisplayFieldsPanel() {
super();
}
/**
* @param pf
*/
public WRC1DisplayFieldsPanel(MPrintFormat pf){
super();
m_printFormat=pf;
}
/**
* @return print format
*/
public MPrintFormat getM_printFormat() {
return m_printFormat;
}
/**
* Layout panel
*/
public void init() {
m_chkboxes = new Checkbox[m_pfi.size()];
@ -138,6 +152,9 @@ public class WRC1DisplayFieldsPanel extends WRCTabPanel implements EventListener
}
}
/**
* Save changes
*/
public void save(){
int i=0;
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(){
KeyNamePair [] listcheck=new KeyNamePair[m_pfi.size()];
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){
for(int j=0 ; j< m_pfi.size() ; j++){
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.Vbox;
/**
* Panel to edit order of printed print format items
*/
public class WRC2FieldOrderPanel extends WRCTabPanel implements EventListener<Event> {
/**
*
* generated serial id
*/
private static final long serialVersionUID = -7732332384947376101L;
/**
*
*/
private Button bUp = new Button();
private Button bDown = new Button();
private ArrayList<MPrintFormatItem> listColumns=new ArrayList<MPrintFormatItem>();
SimpleListModel sortModel;
protected SimpleListModel sortModel;
private Listbox sortList;
/**
* default constructor
*/
public WRC2FieldOrderPanel() {
super();
}
/**
* Populate {@link #listColumns} with printed MPrintFormatItem
*/
public void setListColumns() {
listColumns = new ArrayList<MPrintFormatItem>();
for (MPrintFormatItem item : m_pfi)
@ -69,9 +74,11 @@ public class WRC2FieldOrderPanel extends WRCTabPanel implements EventListener<Ev
listColumns.add(item);
}
/**
* Layout panel
*/
public void init()
{
Hlayout hlayout = new Hlayout();
ZKUpdateUtil.setVflex(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
*/
void migrateValueWithinYesList (int endIndex, List<ListElement> selObjects)
protected void migrateValueWithinYesList (int endIndex, List<ListElement> selObjects)
{
int iniIndex =0;
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
*/
void migrateValueWithinSortList (Event event)
protected void migrateValueWithinSortList (Event event)
{
Object[] selObjects = sortList.getSelectedItems().toArray();
if (selObjects == null)
@ -304,7 +311,7 @@ public class WRC2FieldOrderPanel extends WRCTabPanel implements EventListener<Ev
*/
public static class ListElement extends NamePair {
/**
*
* generated serial id
*/
private static final long serialVersionUID = -5645910649588308798L;
private int m_key;
@ -313,7 +320,13 @@ public class WRC2FieldOrderPanel extends WRCTabPanel implements EventListener<Ev
/** Initial seq number */
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) {
super(name);
this.m_key = key;

View File

@ -51,10 +51,13 @@ import org.zkoss.zul.Menuitem;
import org.zkoss.zul.Menupopup;
import org.zkoss.zul.Vbox;
/**
* Panel to edit sorting of print format
*/
public class WRC3SortCriteriaPanel extends WRCTabPanel implements EventListener<Event>
{
/**
*
* generated serial id
*/
private static final long serialVersionUID = 6470498382547293013L;
// UI variables
@ -65,18 +68,26 @@ public class WRC3SortCriteriaPanel extends WRCTabPanel implements EventListener
private Button bUp = new Button();
private Button bDown = new Button();
//
SimpleListModel noModel = new SimpleListModel();
SimpleListModel yesModel = new SimpleListModel();
Listbox noList = new Listbox();
Listbox yesList = new Listbox();
ArrayList<MPrintFormatItem> yesItems =new ArrayList<MPrintFormatItem>();
ArrayList<MPrintFormatItem> noItems =new ArrayList<MPrintFormatItem>();
protected SimpleListModel noModel = new SimpleListModel();
protected SimpleListModel yesModel = new SimpleListModel();
protected Listbox noList = new Listbox();
protected Listbox yesList = new Listbox();
/** List of print format items selected for ordering */
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";
/**
* default constructor
*/
public WRC3SortCriteriaPanel() {
super();
}
/**
* Layout panel
*/
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() {
yesItems =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())
.append(" (").append(pfi.isDesc() ? getOrderByDesc() : getOrderByAsc()).append(")");
return name.toString();
}
String getOrderByAsc() {
/**
* @return translated text for ascending
*/
protected String getOrderByAsc() {
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");
}
@ -283,7 +303,7 @@ public class WRC3SortCriteriaPanel extends WRCTabPanel implements EventListener
/**
* @param event
*/
void migrateValueAcrossLists (Event event)
protected void migrateValueAcrossLists (Event event)
{
Object source = event.getTarget();
if (source instanceof ListItem) {
@ -300,7 +320,13 @@ public class WRC3SortCriteriaPanel extends WRCTabPanel implements EventListener
migrateLists (listFrom,listTo,endIndex);
} // 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;
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
*/
void migrateValueWithinYesList (int endIndex, List<ListElement> selObjects)
protected void migrateValueWithinYesList (int endIndex, List<ListElement> selObjects)
{
int iniIndex =0;
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
*/
private void migrateValueWithinYesList (Event event)
@ -481,10 +507,10 @@ public class WRC3SortCriteriaPanel extends WRCTabPanel implements EventListener
}
}
} // migrateValueWithinYesList
/**
* @param int selIndexPI,int targetIndexPI
* @param selIndexPI
* @param 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 {
/**
*
* generated serial id
*/
private static final long serialVersionUID = -5645910649588308798L;
private int m_key;

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