Package org.adempiere.webui.editor
Class WEditor
- java.lang.Object
-
- org.adempiere.webui.editor.WEditor
-
- All Implemented Interfaces:
PropertyChangeListener,EventListener,org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event>
- Direct Known Subclasses:
WAccountEditor,WAssignmentEditor,WBinaryEditor,WButtonEditor,WChartEditor,WChosenboxListEditor,WChosenboxSearchEditor,WDashboardContentEditor,WDateEditor,WDatetimeEditor,WFileDirectoryEditor,WFilenameEditor,WHtmlEditor,WImageEditor,WInfoPAttributeEditor,WLocationEditor,WLocatorEditor,WNumberEditor,WPAttributeEditor,WPaymentEditor,WRadioGroupEditor,WSearchEditor,WStringEditor,WTableDirEditor,WTimeEditor,WUrlEditor,WYesNoEditor
public abstract class WEditor extends Object implements org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event>, PropertyChangeListener
- Version:
- $Revision: 0.10 $
- Author:
- Ashley G Ramdass
-
-
Field Summary
Fields Modifier and Type Field Description protected org.zkoss.zk.ui.Componentcomponentprotected GridFieldgridFieldprotected GridTabgridTabstatic StringINIT_EDIT_EVENTprotected Labellabelprotected ArrayList<ValueChangeListener>listenersprotected booleanmandatorystatic intMAX_DISPLAY_LENGTHprotected WEditorPopupMenupopupMenuprotected booleanreadOnlyprotected booleantableEditor
-
Constructor Summary
Constructors Constructor Description WEditor(org.zkoss.zk.ui.Component comp, String label, String description, boolean mandatory, boolean readonly, boolean updateable)Constructor for use if a grid field is unavailableWEditor(org.zkoss.zk.ui.Component comp, String columnName, String label, String description, boolean mandatory, boolean readonly, boolean updateable)Constructor for use if a grid field is unavailableWEditor(org.zkoss.zk.ui.Component comp, GridField gridField)WEditor(org.zkoss.zk.ui.Component comp, GridField gridField, boolean tableEditor, IEditorConfiguration editorConfiguration)WEditor(org.zkoss.zk.ui.Component comp, GridField gridField, int rowIndex)WEditor(org.zkoss.zk.ui.Component comp, GridField gridField, int rowIndex, boolean tableEditor, IEditorConfiguration editorConfiguration)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected voidaddChangeLogMenu(WEditorPopupMenu popupMenu)protected voidaddTextEditorMenu(WEditorPopupMenu popupMenu)voidaddValueChangeListener(ValueChangeListener listener)protected voidapplyFieldStyles(boolean applyDictionaryStyle)protected voidapplyLabelStyles(boolean applyDictionaryStyle)protected StringbuildStyle(int AD_Style_ID)protected StringcleanColumnName(String originalColumnName)Remove the table qualifier from the supplied column name.voiddynamicDisplay()voiddynamicDisplay(Properties ctx)allow subclass to perform dynamic loading of datavoidfillHorizontal()Stretch editor component to fill containerprotected voidfireValueChange(ValueChangeEvent event)protected voidfocusNext()StringgetColumnName()org.zkoss.zk.ui.ComponentgetComponent()StringgetDescription()Method is used to distinguish between 2 similar WSearchEditorsabstract StringgetDisplay()org.zkoss.zk.ui.ComponentgetDisplayComponent()return component use for display value in grid view mode in non edit status if return null, a label will replace.StringgetDisplayTextForGridView(Object value)String[]getEvents()GridFieldgetGridField()LabelgetLabel()WEditorPopupMenugetPopupMenu()protected EvaluateegetStyleEvaluatee()abstract ObjectgetValue()booleanisComponentOfEditor(org.zkoss.zk.ui.Component comp)booleanisMandatory()booleanisMandatoryStyle()booleanisNullOrEmpty()booleanisProcessParameter()abstract booleanisReadWrite()booleanisSearchable()protected booleanisShowPreference()booleanisVisible()booleanisZoomable()voidpropertyChange(PropertyChangeEvent evt)booleanremoveValuechangeListener(ValueChangeListener listener)voidsetBackground(boolean error)voidsetBackground(Color color)voidsetChangeEventWhenEditing(boolean isChangeEventWhenEditing)Normal zk component just fire onChange event when user loss focus call this method with true value let component fire event when user type first character remark: editor set true for this method also need handle INIT_EDIT_EVENT to take effect, can refer implement atWStringEditor.onEvent(Event)protected voidsetColumnName(String columnName)protected voidsetComponent(org.zkoss.zk.ui.Component comp)Set the editor component.protected voidsetFieldStyle(String style)voidsetGridTab(GridTab gridTab)protected voidsetLabelStyle(String style)voidsetMandatory(boolean mandatory)Set whether the editor represents a mandatory field.voidsetProcessParameter(boolean isProcessParameter)abstract voidsetReadWrite(boolean readWrite)voidsetTableEditor(boolean b)abstract voidsetValue(Object value)voidsetVisible(boolean visible)voidshowMenu()call to show context menu of this field.StringtoString()voidupdateLabelStyle()Deprecated.voidupdateStyle()voidupdateStyle(boolean applyDictionaryStyle)
-
-
-
Field Detail
-
MAX_DISPLAY_LENGTH
public static final int MAX_DISPLAY_LENGTH
- See Also:
- Constant Field Values
-
INIT_EDIT_EVENT
public static final String INIT_EDIT_EVENT
- See Also:
- Constant Field Values
-
gridField
protected GridField gridField
-
gridTab
protected GridTab gridTab
-
label
protected Label label
-
component
protected org.zkoss.zk.ui.Component component
-
mandatory
protected boolean mandatory
-
listeners
protected ArrayList<ValueChangeListener> listeners
-
readOnly
protected boolean readOnly
-
popupMenu
protected WEditorPopupMenu popupMenu
-
tableEditor
protected boolean tableEditor
-
-
Constructor Detail
-
WEditor
public WEditor(org.zkoss.zk.ui.Component comp, GridField gridField)- Parameters:
comp-gridField-
-
WEditor
public WEditor(org.zkoss.zk.ui.Component comp, GridField gridField, boolean tableEditor, IEditorConfiguration editorConfiguration)- Parameters:
comp-gridField-tableEditor-editorConfiguration-
-
WEditor
public WEditor(org.zkoss.zk.ui.Component comp, GridField gridField, int rowIndex)- Parameters:
comp-gridField-rowIndex-
-
WEditor
public WEditor(org.zkoss.zk.ui.Component comp, GridField gridField, int rowIndex, boolean tableEditor, IEditorConfiguration editorConfiguration)- Parameters:
comp-gridField-rowIndex-tableEditor-editorConfiguration-
-
WEditor
public WEditor(org.zkoss.zk.ui.Component comp, String label, String description, boolean mandatory, boolean readonly, boolean updateable)Constructor for use if a grid field is unavailable- Parameters:
comp- The editor's componentlabel- column name (not displayed)description- description of componentmandatory- whether a selection must be madereadonly- whether or not the editor is read onlyupdateable- whether the editor contents can be changed
-
WEditor
public WEditor(org.zkoss.zk.ui.Component comp, String columnName, String label, String description, boolean mandatory, boolean readonly, boolean updateable)Constructor for use if a grid field is unavailable- Parameters:
comp- The editor's componentlabel- column name (not displayed)description- description of componentmandatory- whether a selection must be madereadonly- whether or not the editor is read onlyupdateable- whether the editor contents can be changed
-
-
Method Detail
-
showMenu
public void showMenu()
call to show context menu of this field. must call after append component of this field to parent
-
setChangeEventWhenEditing
public void setChangeEventWhenEditing(boolean isChangeEventWhenEditing)
Normal zk component just fire onChange event when user loss focus call this method with true value let component fire event when user type first character remark: editor set true for this method also need handle INIT_EDIT_EVENT to take effect, can refer implement atWStringEditor.onEvent(Event)- Parameters:
isChangeEventWhenEditing-
-
getDescription
public String getDescription()
Method is used to distinguish between 2 similar WSearchEditors
-
setComponent
protected void setComponent(org.zkoss.zk.ui.Component comp)
Set the editor component.- Parameters:
comp- the editor component
-
getGridField
public GridField getGridField()
- Returns:
- grid field for this editor ( can be null )
-
getColumnName
public String getColumnName()
- Returns:
- columnNames
-
cleanColumnName
protected String cleanColumnName(String originalColumnName)
Remove the table qualifier from the supplied column name. The column name may be prefixed with the table name i.e.[table name].[column name]. The function returns- Parameters:
originalColumnName- The column name to clean- Returns:
- the column name with any table qualifier removed
i.e.
[column name]
-
setColumnName
protected void setColumnName(String columnName)
-
getComponent
public org.zkoss.zk.ui.Component getComponent()
- Returns:
- Component
-
setGridTab
public void setGridTab(GridTab gridTab)
- Parameters:
gridTab-
-
getPopupMenu
public WEditorPopupMenu getPopupMenu()
- Returns:
- popup menu instance ( if available )
-
propertyChange
public void propertyChange(PropertyChangeEvent evt)
- Specified by:
propertyChangein interfacePropertyChangeListener- Parameters:
evt-
-
addValueChangeListener
public void addValueChangeListener(ValueChangeListener listener)
- Parameters:
listener-
-
removeValuechangeListener
public boolean removeValuechangeListener(ValueChangeListener listener)
-
fireValueChange
protected void fireValueChange(ValueChangeEvent event)
-
getLabel
public Label getLabel()
- Returns:
- Label
-
setReadWrite
public abstract void setReadWrite(boolean readWrite)
- Parameters:
readWrite-
-
isReadWrite
public abstract boolean isReadWrite()
- Returns:
- editable
-
setVisible
public void setVisible(boolean visible)
- Parameters:
visible-
-
isVisible
public boolean isVisible()
- Returns:
- is visible
-
setBackground
public void setBackground(boolean error)
-
setBackground
public void setBackground(Color color)
-
setValue
public abstract void setValue(Object value)
- Parameters:
value-
-
getValue
public abstract Object getValue()
- Returns:
- Object
-
getDisplay
public abstract String getDisplay()
- Returns:
- display text
-
getEvents
public String[] getEvents()
- Returns:
- list of events
-
setMandatory
public void setMandatory(boolean mandatory)
Set whether the editor represents a mandatory field.- Parameters:
mandatory- whether the field is mandatory
-
isMandatory
public boolean isMandatory()
- Returns:
- boolean
-
dynamicDisplay
public void dynamicDisplay()
-
dynamicDisplay
public void dynamicDisplay(Properties ctx)
allow subclass to perform dynamic loading of data
-
updateStyle
public void updateStyle(boolean applyDictionaryStyle)
-
updateStyle
public void updateStyle()
-
applyLabelStyles
protected void applyLabelStyles(boolean applyDictionaryStyle)
-
setLabelStyle
protected void setLabelStyle(String style)
-
applyFieldStyles
protected void applyFieldStyles(boolean applyDictionaryStyle)
-
setFieldStyle
protected void setFieldStyle(String style)
-
isSearchable
public boolean isSearchable()
- Returns:
- true if usable in find window, false otherwise
-
buildStyle
protected String buildStyle(int AD_Style_ID)
-
fillHorizontal
public void fillHorizontal()
Stretch editor component to fill container
-
updateLabelStyle
public void updateLabelStyle()
Deprecated.
-
isMandatoryStyle
public boolean isMandatoryStyle()
-
isNullOrEmpty
public boolean isNullOrEmpty()
-
isZoomable
public boolean isZoomable()
-
setTableEditor
public void setTableEditor(boolean b)
-
isShowPreference
protected boolean isShowPreference()
- Returns:
- boolean
-
addChangeLogMenu
protected void addChangeLogMenu(WEditorPopupMenu popupMenu)
- Parameters:
popupMenu-
-
addTextEditorMenu
protected void addTextEditorMenu(WEditorPopupMenu popupMenu)
- Parameters:
popupMenu-
-
isComponentOfEditor
public boolean isComponentOfEditor(org.zkoss.zk.ui.Component comp)
-
isProcessParameter
public boolean isProcessParameter()
-
setProcessParameter
public void setProcessParameter(boolean isProcessParameter)
-
getDisplayComponent
public org.zkoss.zk.ui.Component getDisplayComponent()
return component use for display value in grid view mode in non edit status if return null, a label will replace. because each row must has one instance of this component, don't cache it. just create new instance- Returns:
-
focusNext
protected void focusNext()
-
getStyleEvaluatee
protected Evaluatee getStyleEvaluatee()
-
-