Class ExplorerTreeController

  • All Implemented Interfaces:
    WidgetController, WidgetDragAndDropAware, WidgetInstanceManagerAware, java.io.Serializable, org.zkoss.zk.ui.event.EventListener, org.zkoss.zk.ui.event.SerializableEventListener, org.zkoss.zk.ui.util.ComponentActivationListener, org.zkoss.zk.ui.util.ComponentCloneListener, org.zkoss.zk.ui.util.Composer<org.zkoss.zk.ui.Component>, org.zkoss.zk.ui.util.ComposerExt<org.zkoss.zk.ui.Component>

    public class ExplorerTreeController
    extends DefaultWidgetController
    Explorer tree widget controller.
    See Also:
    Serialized Form
    • Field Detail

      • SOCKET_IN_NODE_ID_SELECTED

        public static final java.lang.String SOCKET_IN_NODE_ID_SELECTED
        See Also:
        Constant Field Values
      • SOCKET_IN_SET_TREE_CONTEXT

        public static final java.lang.String SOCKET_IN_SET_TREE_CONTEXT
        See Also:
        Constant Field Values
      • SOCKET_IN_SELECTION_CONTEXT

        public static final java.lang.String SOCKET_IN_SELECTION_CONTEXT
        See Also:
        Constant Field Values
      • DYNAMIC_NODE_SELECTION_CONTEXT

        public static final java.lang.String DYNAMIC_NODE_SELECTION_CONTEXT
        See Also:
        Constant Field Values
      • EXPLORER_TREE_COMPONENT

        public static final java.lang.String EXPLORER_TREE_COMPONENT
        See Also:
        Constant Field Values
      • FILTER_TEXTBOX_COMPONENT_ID

        public static final java.lang.String FILTER_TEXTBOX_COMPONENT_ID
        See Also:
        Constant Field Values
      • ON_NODE_SELECTION_REQUEST

        public static final java.lang.String ON_NODE_SELECTION_REQUEST
        See Also:
        Constant Field Values
      • ON_NODE_REFRESH_REQUEST

        public static final java.lang.String ON_NODE_REFRESH_REQUEST
        See Also:
        Constant Field Values
      • SOCKET_OUT_NODE_SELECTED

        public static final java.lang.String SOCKET_OUT_NODE_SELECTED
        See Also:
        Constant Field Values
      • SOCKET_OUT_DATA_SELECTED

        public static final java.lang.String SOCKET_OUT_DATA_SELECTED
        See Also:
        Constant Field Values
      • ON_EXPLORER_TREE_FILTER_CHANGE

        public static final java.lang.String ON_EXPLORER_TREE_FILTER_CHANGE
        See Also:
        Constant Field Values
      • SETTING_CONFIGURATION_CONTEXT

        public static final java.lang.String SETTING_CONFIGURATION_CONTEXT
        See Also:
        Constant Field Values
      • MODEL_FILTER_CHANGING_TEXT

        public static final java.lang.String MODEL_FILTER_CHANGING_TEXT
        See Also:
        Constant Field Values
      • MODEL_FILTER_SETTING_MODE

        public static final java.lang.String MODEL_FILTER_SETTING_MODE
        See Also:
        Constant Field Values
      • MODEL_SELECTION_CONTEXT

        public static final java.lang.String MODEL_SELECTION_CONTEXT
        See Also:
        Constant Field Values
      • REFRESH_STRATEGIES_SETTING

        public static final java.lang.String REFRESH_STRATEGIES_SETTING
        See Also:
        Constant Field Values
      • SETTING_MIN_SEARCH_INPUT_LENGTH

        public static final java.lang.String SETTING_MIN_SEARCH_INPUT_LENGTH
        See Also:
        Constant Field Values
      • SETTING_FILTER_SETTING_MODE

        public static final java.lang.String SETTING_FILTER_SETTING_MODE
        See Also:
        Constant Field Values
      • RELATED_OBJECTS_TO_UPDATE_CTX_PROPERTY

        public static final java.lang.String RELATED_OBJECTS_TO_UPDATE_CTX_PROPERTY
        See Also:
        Constant Field Values
      • TREE_ITEM_RENDERER_SETTING

        public static final java.lang.String TREE_ITEM_RENDERER_SETTING
        See Also:
        Constant Field Values
      • CANNOT_RETRIEVE_EXPLORER_TREE_WIDGET_CONFIGURATION_MSG

        public static final java.lang.String CANNOT_RETRIEVE_EXPLORER_TREE_WIDGET_CONFIGURATION_MSG
        See Also:
        Constant Field Values
      • SELECTED_OBJECT_EXPRESSION

        public static final java.lang.String SELECTED_OBJECT_EXPRESSION
        See Also:
        Constant Field Values
      • SETTING_TRAVERSED_ITEMS_LIMIT_DURING_FILTER

        public static final java.lang.String SETTING_TRAVERSED_ITEMS_LIMIT_DURING_FILTER
        See Also:
        Constant Field Values
      • SETTING_EXPANDED_ITEMS_SOFT_LIMIT_AFTER_FILTER

        public static final java.lang.String SETTING_EXPANDED_ITEMS_SOFT_LIMIT_AFTER_FILTER
        See Also:
        Constant Field Values
      • SETTING_ACTIONS_COMPONENT

        public static final java.lang.String SETTING_ACTIONS_COMPONENT
        See Also:
        Constant Field Values
      • FILTER_EXCEEDED_TRAVERSED_ITEMS_LIMIT_EVENT_TYPE

        @Deprecated(since="2005",
                    forRemoval=true)
        public static final java.lang.String FILTER_EXCEEDED_TRAVERSED_ITEMS_LIMIT_EVENT_TYPE
        Deprecated, for removal: This API element is subject to removal in a future version.
        since 2005, no longer used - tree accepts all nodes after hitting the limit instead of throwing exception
        See Also:
        Constant Field Values
      • SETTING_AUTO_SEARCH_ENABLED

        public static final java.lang.String SETTING_AUTO_SEARCH_ENABLED
        See Also:
        Constant Field Values
      • SETTING_AUTO_SORT_ENABLED

        public static final java.lang.String SETTING_AUTO_SORT_ENABLED
        See Also:
        Constant Field Values
    • Constructor Detail

      • ExplorerTreeController

        public ExplorerTreeController()
    • Method Detail

      • createTreeModel

        protected org.zkoss.zul.AbstractTreeModel<NavigationNode> createTreeModel()
      • createFilteredNavigationTreeModel

        protected org.zkoss.zul.AbstractTreeModel<NavigationNode> createFilteredNavigationTreeModel()
        Creates an instance of the tree model. Override this method to create your own tree model.
        Returns:
        the tree model
      • createNavigationTree

        protected NavigationTree createNavigationTree​(CockpitContext context)
        Constructs the navigation tree structure. Override this method to construct your own custom navigation tree structure. To allow search on the tree wrap all nodes in NavigationNodeDecorator
        Returns:
        new navigation tree structure
      • loadExplorerTreeConfiguration

        protected java.util.Optional<ExplorerTree> loadExplorerTreeConfiguration()
      • createTreeItemRenderer

        protected org.zkoss.zul.TreeitemRenderer<NavigationNode> createTreeItemRenderer()
        Creates the tree item renderer. It will try to load the renderer defined in by the TREE_ITEM_RENDERER_SETTING widget setting. If no valid renderer for the given type will be found, then the TreeitemRenderer will be used instead.
        Returns:
        new tree item renderer
      • getTreeModel

        public org.zkoss.zul.AbstractTreeModel<NavigationNode> getTreeModel()
        Returns the tree model associated with the tree.
        Returns:
        tree model associated with the tree
      • handleOpen

        public boolean handleOpen​(org.zkoss.zk.ui.event.Event event,
                                  org.zkoss.zul.Treeitem treeItem)
        Handles the tree item open event. Called by the view (renderer).
        Parameters:
        event - the open event
        treeItem - the related tree item
        Returns:
        true if node was opened, false otherwise
      • handleTreeSelection

        public boolean handleTreeSelection​(org.zkoss.zk.ui.event.Event event,
                                           org.zkoss.zul.Treeitem treeItem)
        Handles the tree selection. Called by the view (renderer).
        Parameters:
        event - the selection event
        treeItem - the related tree item
        Returns:
        true if code was selected, false otherwise
      • showMessageBoxNoPermission

        protected void showMessageBoxNoPermission()
      • handleExternalNodeIdSelection

        public void handleExternalNodeIdSelection​(TreeNodeSelector treeNodeSelector)
      • handleSelectionContext

        public void handleSelectionContext​(java.util.Map<java.lang.String,​java.lang.Object> selectionContext)
      • onNodeSelectionRequest

        public void onNodeSelectionRequest​(org.zkoss.zk.ui.event.Event event)
      • disableFilterTextAndInvokeTreeFilter

        public void disableFilterTextAndInvokeTreeFilter​(org.zkoss.zk.ui.event.InputEvent event)
      • isSeachOnChangingEnabled

        protected boolean isSeachOnChangingEnabled()
      • onEnterPressed

        public void onEnterPressed​(org.zkoss.zk.ui.event.KeyEvent event)
      • onChangingFilterText

        public void onChangingFilterText​(org.zkoss.zk.ui.event.Event event)
      • processFilterTextChange

        protected void processFilterTextChange​(java.lang.String filterText)
      • restoreFilterTextbox

        protected void restoreFilterTextbox​(int cursorPosition)
      • hasAccessToTheNode

        public boolean hasAccessToTheNode​(NavigationNode selectedNode)
        Checks whether user has access to the given node.
        Parameters:
        selectedNode - node to checked
        Returns:
        true, if user has the access, false otherwise
      • select

        protected boolean select​(NavigationNode nodeToSelect,
                                 boolean open)
        Selects the given node.
        Parameters:
        nodeToSelect - node to be selected
        open - if true the node will be also opened
        Returns:
        true if code was selected, false otherwise
      • toggleOpen

        protected void toggleOpen​(NavigationNode node)
        Toggles the open state of the given node.
        Parameters:
        node - the node to open/close
      • expandDefaultNode

        protected void expandDefaultNode()
      • findExpandedByDefaultNode

        protected NavigationNode findExpandedByDefaultNode()
      • expandNodesMatchingFilter

        protected void expandNodesMatchingFilter()
      • expandAllLeaves

        protected void expandAllLeaves()
      • getAllLeaves

        protected java.util.List<NavigationNode> getAllLeaves()
      • refreshTree

        protected void refreshTree()
      • setTreeContext

        public void setTreeContext​(java.util.Collection<java.lang.Object> contextAttribute)
      • clear

        public void clear()
      • getTreeContextFromModel

        protected CockpitContext getTreeContextFromModel()
      • handleObjectsUpdatedEvent

        public void handleObjectsUpdatedEvent​(CockpitEvent event)
      • processFilterTextChange

        protected void processFilterTextChange​(java.util.Collection<NavigationNode> nodesToRefresh)
      • handleObjectsDeletedEvent

        public void handleObjectsDeletedEvent​(CockpitEvent event)
      • clearSelection

        protected void clearSelection​(CockpitEvent event)
      • handleObjectsModification

        protected void handleObjectsModification​(CockpitEvent event)
      • refreshNode

        protected void refreshNode​(NavigationNode nodeToUpdate)
      • sendOutputEventsForSelectedNode

        protected void sendOutputEventsForSelectedNode​(NavigationNode node)
      • refreshDynamicNode

        protected void refreshDynamicNode​(NavigationNode nodeToUpdate)
      • reloadItemModel

        protected java.lang.Object reloadItemModel​(java.lang.Object modelToRefresh)
      • findItemModelsToExpandAfterModification

        protected java.util.List<java.lang.Object> findItemModelsToExpandAfterModification()
      • findItemsToUpdateInRefreshStrategy

        protected java.util.Set<java.lang.Object> findItemsToUpdateInRefreshStrategy​(CockpitEvent event)
      • extractItemModelsToRefresh

        protected java.util.List<java.lang.Object> extractItemModelsToRefresh​(CockpitEvent event)
      • extractModifiedObjectFromEvent

        protected java.util.List<java.lang.Object> extractModifiedObjectFromEvent​(CockpitEvent event)
      • onNodeRefreshRequest

        protected void onNodeRefreshRequest​(org.zkoss.zk.ui.event.Event event)
      • expandObject

        protected void expandObject​(java.lang.Object object)
      • scrollToObject

        protected void scrollToObject​(java.lang.Object object)
      • scrollToObject

        protected void scrollToObject​(NavigationNode node)
      • getLabelService

        public LabelService getLabelService()
        Returns:
        the labelService
      • setLabelService

        public void setLabelService​(LabelService labelService)
        Parameters:
        labelService - the labelService to set
      • setPermissionFacade

        public void setPermissionFacade​(PermissionFacade permissionFacade)
      • getTypeFacade

        public TypeFacade getTypeFacade()
      • setTypeFacade

        public void setTypeFacade​(TypeFacade typeFacade)
      • setObjectFacade

        public void setObjectFacade​(ObjectFacade objectFacade)
      • getExplorerTree

        public org.zkoss.zul.Tree getExplorerTree()
      • getFilterDiv

        public org.zkoss.zul.Div getFilterDiv()
      • getMainCnt

        public org.zkoss.zul.Vlayout getMainCnt()
      • getFilterTextbox

        public org.zkoss.zul.Bandbox getFilterTextbox()
      • getSearchMode

        public org.zkoss.zul.Checkbox getSearchMode()
      • getToolbarContainer

        public org.zkoss.zul.Div getToolbarContainer()
      • getPrimaryActions

        public Actions getPrimaryActions()
      • getSecondaryActions

        public Actions getSecondaryActions()
      • getToolbarSlot

        public Widgetslot getToolbarSlot()
      • setTreeModel

        public void setTreeModel​(org.zkoss.zul.AbstractTreeModel<NavigationNode> treeModel)
      • setNotificationService

        public void setNotificationService​(NotificationService notificationService)