Class WColorEditor

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

public class WColorEditor extends WEditor implements ContextMenuListener
Default editor for DisplayType.Color.
Implemented with EditorBox component and HTML color type (<input type="color">).
Author:
Nicolas Micoud (TGI)
  • Field Details

  • Constructor Details

    • WColorEditor

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

      public WColorEditor(GridField gridField, boolean tableEditor, IEditorConfiguration editorConfiguration)
      Parameters:
      gridField -
      tableEditor -
      editorConfiguration -
  • Method Details

    • addColorEditorMenu

      protected void addColorEditorMenu(WEditorPopupMenu popupMenu)
      Add entries to popup context menu
      Parameters:
      popupMenu -
    • onMenu

      public void onMenu(ContextMenuEvent evt)
      Specified by:
      onMenu in interface ContextMenuListener
    • getComponent

      public EditorBox getComponent()
      Overrides:
      getComponent in class WEditor
      Returns:
      Component
    • setValue

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

      protected String getBackgroundFillStyle(String color)
      Parameters:
      color - hex coded color string
      Returns:
      background fill style
    • getValue

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

      public String getDisplay()
      Specified by:
      getDisplay in class WEditor
      Returns:
      display text
    • 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
    • onEvent

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

      public void openColorPicker()
      Open HTML native color picker
    • processNewValue

      protected void processNewValue(String newValue)
      Process newValue from color picker
      Parameters:
      newValue -
    • getEvents

      public String[] getEvents()
      Overrides:
      getEvents in class WEditor
      Returns:
      list of WEditor.component events that this editor will listen to
    • 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
    • getDisplayTextForGridView

      public String getDisplayTextForGridView(GridRowCtx gridRowCtx, Object value)
      Overrides:
      getDisplayTextForGridView in class WEditor
      Parameters:
      gridRowCtx - GridRowCtx
      Returns:
      display text for grid view, for consumption by WEditor.getDisplayComponent()
    • getDisplayComponent

      public org.zkoss.zk.ui.Component getDisplayComponent()
      Description copied from class: WEditor
      Return component use for display mode in ADTabpanel grid view (GridTabRowRenderer) or custom editor of WListItemRenderer.
      For GridTabRowRenderer, only Html is supported and will use content from WEditor.getDisplayTextForGridView(GridRowCtx, Object).
      For WListItemRenderer, Html, Label and InputElement is supported.
      Return null to use the default of ADTabpanel or WListbox.
      Note: because each row must has one instance of this component, don't reuse, must always create new instance.
      Overrides:
      getDisplayComponent in class WEditor
      Returns:
      Display Component