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.Component
component
protected GridField
gridField
protected GridTab
gridTab
static String
INIT_EDIT_EVENT
protected Label
label
protected ArrayList<ValueChangeListener>
listeners
protected boolean
mandatory
static int
MAX_DISPLAY_LENGTH
protected WEditorPopupMenu
popupMenu
protected boolean
readOnly
protected boolean
tableEditor
-
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 void
addChangeLogMenu(WEditorPopupMenu popupMenu)
protected void
addTextEditorMenu(WEditorPopupMenu popupMenu)
void
addValueChangeListener(ValueChangeListener listener)
protected void
applyFieldStyles(boolean applyDictionaryStyle)
protected void
applyLabelStyles(boolean applyDictionaryStyle)
protected String
buildStyle(int AD_Style_ID)
protected String
cleanColumnName(String originalColumnName)
Remove the table qualifier from the supplied column name.void
dynamicDisplay()
void
dynamicDisplay(Properties ctx)
allow subclass to perform dynamic loading of datavoid
fillHorizontal()
Stretch editor component to fill containerprotected void
fireValueChange(ValueChangeEvent event)
protected void
focusNext()
String
getColumnName()
org.zkoss.zk.ui.Component
getComponent()
String
getDescription()
Method is used to distinguish between 2 similar WSearchEditorsabstract String
getDisplay()
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.String
getDisplayTextForGridView(Object value)
String[]
getEvents()
GridField
getGridField()
Label
getLabel()
WEditorPopupMenu
getPopupMenu()
protected Evaluatee
getStyleEvaluatee()
abstract Object
getValue()
boolean
isComponentOfEditor(org.zkoss.zk.ui.Component comp)
boolean
isMandatory()
boolean
isMandatoryStyle()
boolean
isNullOrEmpty()
boolean
isProcessParameter()
abstract boolean
isReadWrite()
boolean
isSearchable()
protected boolean
isShowPreference()
boolean
isVisible()
boolean
isZoomable()
void
propertyChange(PropertyChangeEvent evt)
boolean
removeValuechangeListener(ValueChangeListener listener)
void
setBackground(boolean error)
void
setBackground(Color color)
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)
protected void
setColumnName(String columnName)
protected void
setComponent(org.zkoss.zk.ui.Component comp)
Set the editor component.protected void
setFieldStyle(String style)
void
setGridTab(GridTab gridTab)
protected void
setLabelStyle(String style)
void
setMandatory(boolean mandatory)
Set whether the editor represents a mandatory field.void
setProcessParameter(boolean isProcessParameter)
abstract void
setReadWrite(boolean readWrite)
void
setTableEditor(boolean b)
abstract void
setValue(Object value)
void
setVisible(boolean visible)
void
showMenu()
call to show context menu of this field.String
toString()
void
updateLabelStyle()
Deprecated.void
updateStyle()
void
updateStyle(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:
propertyChange
in 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()
-
-