Class WNumberEditor

java.lang.Object
org.adempiere.webui.editor.WEditor
org.adempiere.webui.editor.WNumberEditor
All Implemented Interfaces:
PropertyChangeListener, EventListener, IInputValidator, ContextMenuListener, org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event>

public class WNumberEditor extends WEditor implements ContextMenuListener
Default editor for DisplayType.ID and DisplayType.isNumeric(int).
Implemented with NumberBox.
Version:
$Revision: 0.10 $
Author:
Ashley G Ramdass, Low Heng Sin, Cristina Ghita, www.arhipac.ro
  • BF [3058780] WNumberEditor allow only BigDecimal
    • Field Details

      • LISTENER_EVENTS

        public static final String[] LISTENER_EVENTS
      • MAX_DISPLAY_LENGTH

        public static final int MAX_DISPLAY_LENGTH
        See Also:
      • MIN_DISPLAY_LENGTH

        public static final int MIN_DISPLAY_LENGTH
        See Also:
    • Constructor Details

      • WNumberEditor

        public WNumberEditor()
        Default constructor, default to DisplayType.Number.
      • WNumberEditor

        public WNumberEditor(int displayType)
        Parameters:
        displayType -
      • WNumberEditor

        public WNumberEditor(GridField gridField)
        Parameters:
        gridField -
      • WNumberEditor

        public WNumberEditor(GridField gridField, boolean tableEditor, IEditorConfiguration editorConfiguration)
        Parameters:
        gridField -
        tableEditor -
        editorConfiguration -
      • WNumberEditor

        public WNumberEditor(GridField gridField, boolean integral)
        Parameters:
        gridField -
        integral - true to create NumberBox for DisplayType.Integer
      • WNumberEditor

        public WNumberEditor(String columnName, boolean mandatory, boolean readonly, boolean updateable, int displayType, String title)
        Parameters:
        columnName -
        mandatory -
        readonly -
        updateable -
        displayType -
        title -
    • Method Details

      • newNumberBox

        protected static NumberBox newNumberBox(GridField gridField, boolean tableEditor, IEditorConfiguration editorConfiguration)
        Create new NumberBox instance.
        Parameters:
        gridField -
        tableEditor -
        editorConfiguration -
        Returns:
        NumberBox
      • onEvent

        public void onEvent(org.zkoss.zk.ui.event.Event event)
        Event handler
        Specified by:
        onEvent in interface org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event>
        Parameters:
        event -
      • addDecimalPlaces

        public BigDecimal addDecimalPlaces(BigDecimal oldValue)
        IDEMPIERE-2553 - Enter amounts without decimal separator
        Parameters:
        oldValue -
        Returns:
        oldValue (if oldValue is already with decimal point)
        or oldValue divided by AutomaticDecimalPlacesForAmoun value from Env context (for e.g, if AutomaticDecimalPlacesForAmoun=2, oldValue/100)
      • getComponent

        public NumberBox getComponent()
        Overrides:
        getComponent in class WEditor
        Returns:
        NumberBox
      • isReadWrite

        public boolean isReadWrite()
        Specified by:
        isReadWrite in class WEditor
        Returns:
        true if editable
      • setReadWrite

        public void setReadWrite(boolean readWrite)
        Specified by:
        setReadWrite in class WEditor
      • getDisplay

        public String getDisplay()
        Specified by:
        getDisplay in class WEditor
        Returns:
        display text
      • getValue

        public BigDecimal getValue()
        Specified by:
        getValue in class WEditor
        Returns:
        Object, current value of editor
      • setValue

        public void setValue(Object value)
        Description copied from class: WEditor
        Set editor value
        Specified by:
        setValue in class WEditor
      • getEvents

        public String[] getEvents()
        Overrides:
        getEvents in class WEditor
        Returns:
        list of WEditor.component events that this editor will listen to
      • onMenu

        public void onMenu(ContextMenuEvent evt)
        Handle context menu events
        Specified by:
        onMenu in interface ContextMenuListener
        Parameters:
        evt -
      • setTableEditor

        public void setTableEditor(boolean b)
        Description copied from class: WEditor
        Set grid view mode. Have no effect if editor doesn't has a separate grid view mode.
        Overrides:
        setTableEditor in class WEditor
      • setFieldStyle

        protected void setFieldStyle(String style)
        Set field style to Decimalbox inside NumberBox.
        Overrides:
        setFieldStyle in class WEditor
        Parameters:
        style -