Class CmsCategoryTree

java.lang.Object
com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.Widget
com.google.gwt.user.client.ui.Composite
org.opencms.gwt.client.ui.input.category.CmsCategoryTree
All Implemented Interfaces:
com.google.gwt.event.logical.shared.HasAttachHandlers, com.google.gwt.event.logical.shared.HasValueChangeHandlers<List<String>>, com.google.gwt.event.shared.HasHandlers, com.google.gwt.user.client.EventListener, com.google.gwt.user.client.ui.HasVisibility, com.google.gwt.user.client.ui.IsRenderable, com.google.gwt.user.client.ui.IsWidget, I_CmsTruncable

public class CmsCategoryTree extends com.google.gwt.user.client.ui.Composite implements I_CmsTruncable, com.google.gwt.event.logical.shared.HasValueChangeHandlers<List<String>>
Builds the category tree.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    Sorting parameters.

    Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject

    com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    Map of categories.
    protected List<CmsTreeItem>
    All category tree items, including duplicates with the same category path.
    protected List<org.opencms.gwt.shared.CmsCategoryTreeEntry>
    List of categories selected from the server.
    protected Map<String,List<String>>
    Map from category paths to the paths of their children.
    protected com.google.gwt.user.client.ui.HasText
    A label for displaying additional information about the tab.
    protected boolean
    Vale to store the widget mode.
    protected boolean
    Vale to store the view mode.
    protected com.google.gwt.user.client.ui.FlowPanel
    The option panel.
    protected CmsTextBox
    The quick search box.
    protected CmsList<CmsTreeItem>
    List of categories.
    protected CmsPushButton
    The quick search button.
    protected Collection<String>
    List of all selected categories.
    protected String
    Result string for single selection.
    protected CmsSelectBox
    The select box to change the sort order.

    Fields inherited from class com.google.gwt.user.client.ui.UIObject

    DEBUG_ID_PREFIX
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default Constructor.
    CmsCategoryTree(Collection<String> selectedCategories, int height, boolean isSingleValue, List<org.opencms.gwt.shared.CmsCategoryTreeEntry> categories)
    Constructor to collect all categories and build a view tree.
    CmsCategoryTree(Collection<String> selectedCategories, int height, boolean isSingleValue, List<org.opencms.gwt.shared.CmsCategoryTreeEntry> categories, boolean showCollapsed)
    Constructor to collect all categories and build a view tree.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addChildren(CmsTreeItem parent, List<org.opencms.gwt.shared.CmsCategoryTreeEntry> children, Collection<String> selectedCategories)
    Adds children item to the category tree and select the categories.
    com.google.gwt.event.shared.HandlerRegistration
    addValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler<List<String>> handler)
     
    protected void
    Cancels the quick filter timer.
    protected void
    Checks the quick search input and enables/disables the search button accordingly.
    protected void
    Creates the quick search/finder box.
    protected CmsList<CmsTreeItem>
    Creates the list which should contain the list items of the tab.
    void
    disable(String disabledReason)
    Disabled the category selection.
    void
    Enables the category selection.
    void
    Represents a value change event.
    Returns a list of all selected values.
    Returns a list of all selected values as Sidepath.
    protected List<CmsTreeItem>
    Gets the filtered list of categories.
    Returns the scrollpanel of this widget.
    Returns the last selected value.
    List of all sort parameters.
    protected boolean
    Returns true if this widget hat an QuickFilter.
    protected void
    Call after all handlers have been set.
    boolean
    Returns if the category selection is enabled.
    void
    Goes up the tree and opens the parents of the item.
    protected void
    Sets the search query an selects the result tab.
    protected void
    Removes the quick search/finder box.
    protected void
    Schedules the quick filter action.
    void
    Shows the tab list is empty label.
    protected void
    Sorts a list of tree items according to the sort parameter.
    protected void
    toggleSelection(CmsTreeItem item, boolean changeState)
    Called if a category is selected/deselected.
    void
    truncate(String textMetricsKey, int clientWidth)
    Truncates long text and sets the original text to the title attribute.
    void
    Updates the content of the categories list.
    void
    updateContentTree(boolean removeUnused)
    Updates the content of the categories tree.

    Methods inherited from class com.google.gwt.user.client.ui.Composite

    claimElement, getWidget, initializeClaimedElement, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, render, render, resolvePotentialElement, setWidget

    Methods inherited from class com.google.gwt.user.client.ui.Widget

    addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents, unsinkEvents

    Methods inherited from class com.google.gwt.user.client.ui.UIObject

    addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface com.google.gwt.event.shared.HasHandlers

    fireEvent
  • Field Details

  • Constructor Details

    • CmsCategoryTree

      public CmsCategoryTree()
      Default Constructor.

    • CmsCategoryTree

      public CmsCategoryTree(Collection<String> selectedCategories, int height, boolean isSingleValue, List<org.opencms.gwt.shared.CmsCategoryTreeEntry> categories)
      Constructor to collect all categories and build a view tree.

      Parameters:
      selectedCategories - A list of all selected categories
      height - The height of this widget
      isSingleValue - Sets the modes of this widget
      categories - the categories
    • CmsCategoryTree

      public CmsCategoryTree(Collection<String> selectedCategories, int height, boolean isSingleValue, List<org.opencms.gwt.shared.CmsCategoryTreeEntry> categories, boolean showCollapsed)
      Constructor to collect all categories and build a view tree.

      Parameters:
      selectedCategories - A list of all selected categories
      height - The height of this widget
      isSingleValue - Sets the modes of this widget
      categories - the categories
      showCollapsed - if true, the category tree will be collapsed when opened.
  • Method Details

    • addChildren

      public void addChildren(CmsTreeItem parent, List<org.opencms.gwt.shared.CmsCategoryTreeEntry> children, Collection<String> selectedCategories)
      Adds children item to the category tree and select the categories.

      Parameters:
      parent - the parent item
      children - the list of children
      selectedCategories - the list of categories to select
    • addValueChangeHandler

      public com.google.gwt.event.shared.HandlerRegistration addValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler<List<String>> handler)
      Specified by:
      addValueChangeHandler in interface com.google.gwt.event.logical.shared.HasValueChangeHandlers<List<String>>
      See Also:
      • HasValueChangeHandlers.addValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler)
    • disable

      public void disable(String disabledReason)
      Disabled the category selection.

      Parameters:
      disabledReason - the disable reason, will be displayed as check box title
    • enable

      public void enable()
      Enables the category selection.

    • fireValueChange

      public void fireValueChange()
      Represents a value change event.

    • getAllSelected

      Returns a list of all selected values.

      Returns:
      a list of selected values
    • getAllSelectedSitePath

      Returns a list of all selected values as Sidepath.

      Returns:
      a list of selected values
    • getScrollPanel

      Returns the scrollpanel of this widget.

      Returns:
      CmsScrollPanel the scrollpanel of this widget
    • getSelected

      public List<String> getSelected()
      Returns the last selected value.

      Returns:
      the last selected value
    • isEnabled

      public boolean isEnabled()
      Returns if the category selection is enabled.

      Returns:
      true if the category selection is enabled
    • openWithParents

      public void openWithParents(CmsTreeItem item)
      Goes up the tree and opens the parents of the item.

      Parameters:
      item - the child item to start from
    • showIsEmptyLabel

      public void showIsEmptyLabel()
      Shows the tab list is empty label.

    • truncate

      public void truncate(String textMetricsKey, int clientWidth)
      Description copied from interface: I_CmsTruncable
      Truncates long text and sets the original text to the title attribute.

      Specified by:
      truncate in interface I_CmsTruncable
      Parameters:
      textMetricsKey - the key identifying the text metrics to use
      clientWidth - the width to use in pixels
      See Also:
    • updateContentList

      public void updateContentList(List<CmsTreeItem> treeItemsToShow)
      Updates the content of the categories list.

      Parameters:
      treeItemsToShow - the updates list of categories tree item beans
    • updateContentTree

      public void updateContentTree(boolean removeUnused)
      Updates the content of the categories tree.

      Parameters:
      removeUnused - if true, only show used categories, with all levels opened
    • cancelQuickFilterTimer

      protected void cancelQuickFilterTimer()
      Cancels the quick filter timer.

    • checkQuickSearchStatus

      protected void checkQuickSearchStatus()
      Checks the quick search input and enables/disables the search button accordingly.

    • createQuickBox

      protected void createQuickBox()
      Creates the quick search/finder box.

    • createScrollList

      Creates the list which should contain the list items of the tab.

      Returns:
      the newly created list widget
    • getFilteredCategories

      Gets the filtered list of categories.

      Parameters:
      filter - the search string to use for filtering
      Returns:
      the filtered category beans
    • getSortList

      List of all sort parameters.

      Returns:
      List of all sort parameters
    • hasQuickFilter

      protected boolean hasQuickFilter()
      Returns true if this widget hat an QuickFilter.

      Returns:
      true if this widget hat an QuickFilter
    • init

      protected void init()
      Call after all handlers have been set.

    • quickSearch

      protected void quickSearch()
      Sets the search query an selects the result tab.

    • removeQuickBox

      protected void removeQuickBox()
      Removes the quick search/finder box.

    • scheduleQuickFilterTimer

      protected void scheduleQuickFilterTimer()
      Schedules the quick filter action.

    • sort

      protected void sort(List<CmsTreeItem> items, CmsCategoryTree.SortParams sort)
      Sorts a list of tree items according to the sort parameter.

      Parameters:
      items - the items to sort
      sort - the sort parameter
    • toggleSelection

      protected void toggleSelection(CmsTreeItem item, boolean changeState)
      Called if a category is selected/deselected. The checkbox state of the selected/deselected item has to be the state BEFORE toggling.
      Parameters:
      item - the tree item that should be selected/deselected.
      changeState - flag, indicating if the checkbox state should be changed.