Class SimpleReferenceSelector

java.lang.Object
org.zkoss.zk.ui.AbstractComponent
org.zkoss.zk.ui.HtmlBasedComponent
org.zkoss.zul.impl.XulElement
org.zkoss.zul.Div
de.hybris.platform.cockpit.model.referenceeditor.simple.AbstractSimpleReferenceSelector
de.hybris.platform.cockpit.model.referenceeditor.simple.SimpleReferenceSelector
All Implemented Interfaces:
UIViewComponent, UISimpleReferenceSelector, Serializable, Cloneable, org.zkoss.zk.ui.Component, org.zkoss.zk.ui.ext.Scope, org.zkoss.zk.ui.sys.ComponentCtrl
Direct Known Subclasses:
MediaSimpleReferenceSelector

public class SimpleReferenceSelector extends AbstractSimpleReferenceSelector
Represents simple reference selector component

Note: This is an default editor for single references that offers tow modes:
  • auto complete mode

  • advanced mode
  • See Also:
    • Nested Class Summary

      Nested classes/interfaces inherited from class org.zkoss.zk.ui.HtmlBasedComponent

      org.zkoss.zk.ui.HtmlBasedComponent.ExtraCtrl

      Nested classes/interfaces inherited from class org.zkoss.zk.ui.AbstractComponent

      org.zkoss.zk.ui.AbstractComponent.Children
    • Field Summary

      Fields
      Modifier and Type
      Field
      Description
      protected static final String
       
      protected org.zkoss.zul.Bandbox
       
      protected org.zkoss.zul.Listbox
       
      protected org.zkoss.zul.Bandpopup
       
      protected static final String
       
      protected org.zkoss.zul.Div
       
      protected org.zkoss.zul.Vbox
       
      protected static final int
       
      protected static final String
       
      static final String
       
      static final String
       
      protected static final String
       
      protected static final int
       
      protected static final int
       
      protected static final String
       
      protected static final String
       
      protected UIListView
       
      protected org.zkoss.zul.Hbox
       
      protected static final String
       
      protected org.zkoss.zul.Toolbarbutton
       
      protected org.zkoss.zul.Toolbarbutton
       
      protected static final String
       
      protected static final String
       
      protected static final String
       
      protected static final String
       
      protected static final String
       
      protected static final String
       
      protected static final String
       
      protected static final int
       
      protected static final String
       

      Fields inherited from class org.zkoss.zk.ui.HtmlBasedComponent

      _zclass

      Fields inherited from interface org.zkoss.zk.ui.Component

      APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPE

      Fields inherited from interface org.zkoss.zk.ui.sys.ComponentCtrl

      AFTER_CHILD_ADDED, AFTER_CHILD_REMOVED, AFTER_PAGE_ATTACHED, AFTER_PAGE_DETACHED, CE_BUSY_IGNORE, CE_DUPLICATE_IGNORE, CE_IMPORTANT, CE_NON_DEFERRABLE, CE_REPEAT_IGNORE
    • Constructor Summary

      Constructors
      Constructor
      Description
       
    • Method Summary

      Modifier and Type
      Method
      Description
      void
      addEventSelectorListener(String event, org.zkoss.zk.ui.event.EventListener listener)
      Adds sufficient event listeners to current component
      protected org.zkoss.zul.ListitemRenderer
      Returns sufficient renderer for auto complete list
      protected String
      computeLabel(Object typedObject)
      Returns readable name for current element
      protected org.zkoss.zul.Toolbarbutton
       
      void
      Responsible for save selected value from advanced search dialog
      void
      Saves actual selected element
      protected void
      Fire normal mode on particular component
       
      int
       
      protected int
       
      Returns model currently associated with component
      protected Map<String,Object>
      getPredefinedValues(Map<String,? extends Object> parameters)
       
       
      boolean
      Initializes this view component.
       
      boolean
       
      boolean
       
      boolean
       
      boolean
       
      boolean
       
      void
      saveCurrentValue(Object currentValue)
      Sets current value and notify sufficient controllers
      protected void
      Responsible for selecting object at specified index
      void
      setAllowcreate(Boolean allowcreate)
       
      void
      setAutocompletionAllowed(boolean allowed)
       
      void
       
      void
      setDisabled(boolean disabled)
       
      void
      setFocus(boolean focus)
      Override default focus handling in order to deliver custom behavior for simple reference selector
      void
       
      void
      Sets model associated with current simple reference component
      void
      setSearchTerm(String searchTerm)
       
      void
      setShowEditButton(boolean showEditButton)
       
      void
      Shows auto complete component where suggested values are shown
      protected void
      Shows reference selector modal dialog
      boolean
      Updates this view component completely.
      protected void
      Updates auto complete list
      void
      Updates auto completes result list
      protected void
       
      void
      Invoked when current value changed
      void
      Updates component when mode has changed.
      void
      Invoked when root search type has changed
      void
      Invoked when root type has changed
      void
      Updates search result list - used in advanced search mode

      Methods inherited from class org.zkoss.zul.Div

      getAlign, renderProperties, setAlign

      Methods inherited from class org.zkoss.zul.impl.XulElement

      clone, getContext, getCtrlKeys, getPopup, getPropertyAccess, getTooltip, setContext, setContext, setContextAttributes, setCtrlKeys, setPopup, setPopup, setPopupAttributes, setTooltip, setTooltip, setTooltipAttributes

      Methods inherited from class org.zkoss.zk.ui.HtmlBasedComponent

      addSclass, focus, getAction, getDraggable, getDroppable, getExtraCtrl, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getStyle, getTabindex, getTabindexInteger, getTooltiptext, getTop, getVflex, getWidth, getZclass, getZindex, getZIndex, removeSclass, removeSclass, service, setAction, setClass, setDraggable, setDroppable, setHeight, setHeight0, setHeightDirectly, setHflex, setHflex0, setHflexDirectly, setLeft, setLeftDirectly, setRenderdefer, setSclass, setStyle, setTabindex, setTabindex, setTooltiptext, setTop, setTopDirectly, setVflex, setVflex0, setVflexDirectly, setWidth, setWidth0, setWidthDirectly, setZclass, setZindex, setZIndex, setZIndexDirectly

      Methods inherited from class org.zkoss.zk.ui.AbstractComponent

      addAnnotation, addAnnotation, addCallback, addClientEvent, addEventHandler, addEventListener, addEventListener, addForward, addForward, addForward, addForward, addMoved, addRedrawCallback, addScopeListener, addShadowRoot, addShadowRootBefore, addSharedEventHandlerMap, appendChild, applyProperties, beforeChildAdded, beforeChildRemoved, beforeParentChanged, detach, didActivate, didActivate, didDeserialize, didDeserialize, disableBindingAnnotation, disableClientUpdate, enableBindingAnnotation, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, getAnnotation, getAnnotations, getAnnotations, getAnnotations, getAttribute, getAttribute, getAttribute, getAttributeOrFellow, getAttributes, getAttributes, getAuService, getAutag, getCallback, getChildren, getClientAttribute, getClientDataAttribute, getClientEvents, getDefaultMold, getDefinition, getDesktop, getEventHandler, getEventHandlerNames, getEventListenerMap, getEventListeners, getFellow, getFellow, getFellowIfAny, getFellowIfAny, getFellows, getFirstChild, getId, getLastChild, getListenerIterator, getMold, getNextSibling, getPage, getParent, getPreviousSibling, getRedrawCallback, getRoot, getShadowFellowIfAny, getShadowRoots, getShadowVariable, getShadowVariable, getShadowVariable0, getSpaceOwner, getSpecialRendererOutput, getStubonly, getSubBindingAnnotationCount, getTemplate, getTemplateNames, getUuid, getWidgetAttribute, getWidgetAttributeNames, getWidgetClass, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttribute, hasAttributeOrFellow, hasBindingAnnotation, hasFellow, hasFellow, hasSubBindingAnnotation, insertBefore, invalidate, isChildable, isInvalidated, isListenerAvailable, isVisible, onChildAdded, onChildRemoved, onPageAttached, onPageDetached, onWrongValue, query, queryAll, redraw, redrawChildren, removeAttribute, removeAttribute, removeAttribute, removeCallback, removeChild, removeEventListener, removeForward, removeForward, removeRedrawCallback, removeScopeListener, removeShadowRoot, render, render, render, replace, response, response, response, service, sessionDidActivate, sessionWillPassivate, setAttribute, setAttribute, setAttribute, setAuService, setAutag, setClientAttribute, setClientDataAttribute, setDefinition, setDefinition, setId, setMold, setPage, setPageBefore, setParent, setStubonly, setStubonly, setSubBindingAnnotationCount, setTemplate, setVisible, setVisibleDirectly, setWidgetAttribute, setWidgetClass, setWidgetListener, setWidgetOverride, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdateWidgetListener, smartUpdateWidgetOverride, toString, updateByClient, updateSubBindingAnnotationCount, willPassivate, willPassivate, willSerialize, willSerialize

      Methods inherited from class java.lang.Object

      equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Details

      • ADV_QUERY_BTN_IMG

        protected static final String ADV_QUERY_BTN_IMG
        See Also:
      • EDIT_BTN_IMG

        protected static final String EDIT_BTN_IMG
        See Also:
      • INIITAL_ROWS_NUMBER

        protected static final String INIITAL_ROWS_NUMBER
        See Also:
      • REFERENCE_EDITOR_BTN_SCLASS

        protected static final String REFERENCE_EDITOR_BTN_SCLASS
        See Also:
      • LIST_VIEW_SELECTOR_SCLASS

        protected static final String LIST_VIEW_SELECTOR_SCLASS
        See Also:
      • ENTER_CHAR

        protected static final int ENTER_CHAR
        See Also:
      • ESC_CHAR

        protected static final int ESC_CHAR
        See Also:
      • DOWN_ARROW

        protected static final int DOWN_ARROW
        See Also:
      • UP_ARROW

        protected static final int UP_ARROW
        See Also:
      • CLOSE_BTN_IMG

        protected static final String CLOSE_BTN_IMG
        See Also:
      • EDIT_START_EVENT

        public static final String EDIT_START_EVENT
        See Also:
      • EDIT_FINISH_EVENT

        public static final String EDIT_FINISH_EVENT
        See Also:
      • EMPTY_MESSAGE

        protected static final String EMPTY_MESSAGE
        See Also:
      • WILD_CARD

        protected static final String WILD_CARD
        See Also:
      • REFERENECE_SELECTOR_SCLASS

        protected static final String REFERENECE_SELECTOR_SCLASS
        See Also:
      • REFERENECE_SELECTOR_LISTBOX_ODD_ROWS

        protected static final String REFERENECE_SELECTOR_LISTBOX_ODD_ROWS
        See Also:
      • REFERENECE_SELECTOR_AUTOCOMPLETE

        protected static final String REFERENECE_SELECTOR_AUTOCOMPLETE
        See Also:
      • REFERENECE_SELECTOR_AUTOCOMPLETE_POPUP

        protected static final String REFERENECE_SELECTOR_AUTOCOMPLETE_POPUP
        See Also:
      • REFERENECE_SELECTOR_AUTOCOMPLETE_LIST

        protected static final String REFERENECE_SELECTOR_AUTOCOMPLETE_LIST
        See Also:
      • REFERENECE_SELECTOR_AUTOCOMPLETE_CELLITEM

        protected static final String REFERENECE_SELECTOR_AUTOCOMPLETE_CELLITEM
        See Also:
      • autoCompleteList

        protected transient org.zkoss.zul.Listbox autoCompleteList
      • newItemButton

        protected transient org.zkoss.zul.Toolbarbutton newItemButton
      • autoCompleteComponent

        protected transient org.zkoss.zul.Bandbox autoCompleteComponent
      • autoCompletePopup

        protected transient org.zkoss.zul.Bandpopup autoCompletePopup
      • listView

        protected transient UIListView listView
      • container

        protected transient org.zkoss.zul.Vbox container
      • componentContainer

        protected transient org.zkoss.zul.Div componentContainer
      • mainHbox

        protected transient org.zkoss.zul.Hbox mainHbox
      • openPopupEditorBtn

        protected org.zkoss.zul.Toolbarbutton openPopupEditorBtn
    • Constructor Details

      • SimpleReferenceSelector

        public SimpleReferenceSelector()
    • Method Details

      • isInitialized

        public boolean isInitialized()
      • setFocus

        public void setFocus(boolean focus)
        Override default focus handling in order to deliver custom behavior for simple reference selector
        Overrides:
        setFocus in class org.zkoss.zk.ui.HtmlBasedComponent
        Parameters:
        focus - - flag that indicates whether particular component should be focused
      • showAutoCompletePopup

        public void showAutoCompletePopup()
        Description copied from interface: UISimpleReferenceSelector
        Shows auto complete component where suggested values are shown
      • update

        public boolean update()
        Description copied from interface: UIViewComponent
        Updates this view component completely.
        Returns:
        true if update was successful, false otherwise
      • updateMode

        public void updateMode()
        Description copied from interface: UISimpleReferenceSelector
        Updates component when mode has changed. There are three modes as follow:

      • View Mode - default mode
      • Normal Mode - auto complete mode
      • Advanced Mode - advanced search mode
      • updateAutoCompleteResult

        public void updateAutoCompleteResult()
        Description copied from interface: UISimpleReferenceSelector
        Updates auto completes result list
      • updateSearchResult

        public void updateSearchResult()
        Description copied from interface: UISimpleReferenceSelector
        Updates search result list - used in advanced search mode
      • fireSelectorNormalMode

        protected void fireSelectorNormalMode()
        Description copied from class: AbstractSimpleReferenceSelector
        Fire normal mode on particular component
        Overrides:
        fireSelectorNormalMode in class AbstractSimpleReferenceSelector
      • initialize

        public boolean initialize()
        Description copied from interface: UIViewComponent
        Initializes this view component.

        Note: Should not be called during object creation i.e. from constructor.

        Returns:
        true if initialize was successful, false otherwise
      • createAdvancedSearchButton

        protected org.zkoss.zul.Toolbarbutton createAdvancedSearchButton()
      • updateEditButtonVisibility

        protected void updateEditButtonVisibility()
      • getCreateContext

        public CreateContext getCreateContext()
      • updateItems

        public void updateItems()
        Description copied from interface: UISimpleReferenceSelector
        Invoked when current value changed
      • setModel

        public void setModel(SimpleReferenceSelectorModel model)
        Description copied from interface: UISimpleReferenceSelector
        Sets model associated with current simple reference component
        Parameters:
        model - - given model
      • getModel

        Returns model currently associated with component
        Returns:
        current model
      • updateRootTypeChanged

        public void updateRootTypeChanged()
        Description copied from interface: UISimpleReferenceSelector
        Invoked when root type has changed
      • updateRootSearchTypeChanged

        public void updateRootSearchTypeChanged()
        Description copied from interface: UISimpleReferenceSelector
        Invoked when root search type has changed
      • doModalDialogSaveClicked

        public void doModalDialogSaveClicked()
        Responsible for save selected value from advanced search dialog
      • saveCurrentValue

        public void saveCurrentValue(Object currentValue)
        Sets current value and notify sufficient controllers
        Parameters:
        currentValue -
      • addEventSelectorListener

        public void addEventSelectorListener(String event, org.zkoss.zk.ui.event.EventListener listener)
        Adds sufficient event listeners to current component
        Parameters:
        event - - given event
        listener - - given listener
      • isDisabled

        public boolean isDisabled()
      • setDisabled

        public void setDisabled(boolean disabled)
      • isAutocompletionAllowed

        public boolean isAutocompletionAllowed()
      • setAutocompletionAllowed

        public void setAutocompletionAllowed(boolean allowed)
      • setInitString

        public void setInitString(String initStr)
      • isAllowcreate

        public Boolean isAllowcreate()
      • setAllowcreate

        public void setAllowcreate(Boolean allowcreate)
      • setCreateContext

        public void setCreateContext(CreateContext createContext)
      • fireSaveActualSelected

        public void fireSaveActualSelected()
        Saves actual selected element
      • isEntrySelected

        public boolean isEntrySelected(Object value)
      • autoCompleteListItemRenderer

        protected org.zkoss.zul.ListitemRenderer autoCompleteListItemRenderer()
        Returns sufficient renderer for auto complete list
        Returns:
        sufficient renderer
      • updateAutoCompleteItemList

        protected void updateAutoCompleteItemList()
        Updates auto complete list
      • showReferenceSelectorModalDialog

        protected void showReferenceSelectorModalDialog()
        Shows reference selector modal dialog
      • getPredefinedValues

        protected Map<String,Object> getPredefinedValues(Map<String,? extends Object> parameters)
      • computeLabel

        protected String computeLabel(Object typedObject)
        Returns readable name for current element
        Parameters:
        typedObject - - current element
        Returns:
        readable name
      • selectOrDeselectAutoCompleteItems

        protected void selectOrDeselectAutoCompleteItems(int index)
        Responsible for selecting object at specified index
        Parameters:
        index - - specified index
      • getDefaultAutocompleteTimeout

        public int getDefaultAutocompleteTimeout()
        Returns:
        the defaultAutocompleteTimeout
      • getSearchTerm

        public String getSearchTerm()
      • setSearchTerm

        public void setSearchTerm(String searchTerm)
      • isShowEditButton

        public boolean isShowEditButton()
      • setShowEditButton

        public void setShowEditButton(boolean showEditButton)
      • getInitialRowsNumber

        protected int getInitialRowsNumber()