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 ClassesNested 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
FieldsModifier and TypeFieldDescriptionprotected Map<String,
CmsTreeItem> 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.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
ConstructorsConstructorDescriptionDefault 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 TypeMethodDescriptionvoid
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
Disabled the category selection.void
enable()
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>
getFilteredCategories
(String filter) Gets the filtered list of categories.Returns the scrollpanel of this widget.Returns the last selected value.protected LinkedHashMap<String,
String> List of all sort parameters.protected boolean
Returns true if this widget hat an QuickFilter.protected void
init()
Call after all handlers have been set.boolean
Returns if the category selection is enabled.void
openWithParents
(CmsTreeItem item) 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
sort
(List<CmsTreeItem> items, CmsCategoryTree.SortParams sort) 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
Truncates long text and sets the original text to the title attribute.void
updateContentList
(List<CmsTreeItem> treeItemsToShow) 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
-
m_categories
Map of categories. -
m_categoriesAsList
All category tree items, including duplicates with the same category path. -
m_categoryBeans
List of categories selected from the server. -
m_childrens
Map from category paths to the paths of their children. -
m_infoLabel
A label for displaying additional information about the tab. -
m_isSingleSelection
Vale to store the widget mode. True means the single selection. -
m_listView
Vale to store the view mode. True means the list view. -
m_options
The option panel. -
m_quickSearch
The quick search box. -
m_scrollList
List of categories. -
m_searchButton
The quick search button. -
m_selectedCategories
List of all selected categories.IMPORTANT: This may unfortunately contain either category paths or category site paths.
-
m_singleResult
Result string for single selection. -
m_sortSelectBox
The select box to change the sort order.
-
-
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 categoriesheight
- The height of this widgetisSingleValue
- Sets the modes of this widgetcategories
- 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 categoriesheight
- The height of this widgetisSingleValue
- Sets the modes of this widgetcategories
- the categoriesshowCollapsed
- 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 itemchildren
- the list of childrenselectedCategories
- the list of categories to select
-
disable
Disabled the category selection.- Parameters:
disabledReason
- the disable reason, will be displayed as check box title
-
enable
Enables the category selection. -
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
Returns the last selected value.- Returns:
- the last selected value
-
isEnabled
Returns if the category selection is enabled.- Returns:
true
if the category selection is enabled
-
openWithParents
Goes up the tree and opens the parents of the item.- Parameters:
item
- the child item to start from
-
showIsEmptyLabel
Shows the tab list is empty label. -
truncate
Description copied from interface:I_CmsTruncable
Truncates long text and sets the original text to the title attribute.- Specified by:
truncate
in interfaceI_CmsTruncable
- Parameters:
textMetricsKey
- the key identifying the text metrics to useclientWidth
- the width to use in pixels- See Also:
-
updateContentList
Updates the content of the categories list.- Parameters:
treeItemsToShow
- the updates list of categories tree item beans
-
updateContentTree
Updates the content of the categories tree.- Parameters:
removeUnused
- if true, only show used categories, with all levels opened
-
cancelQuickFilterTimer
Cancels the quick filter timer. -
checkQuickSearchStatus
Checks the quick search input and enables/disables the search button accordingly. -
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
Returns true if this widget hat an QuickFilter.- Returns:
- true if this widget hat an QuickFilter
-
init
Call after all handlers have been set. -
quickSearch
Sets the search query an selects the result tab. -
removeQuickBox
Removes the quick search/finder box. -
scheduleQuickFilterTimer
Schedules the quick filter action. -
sort
Sorts a list of tree items according to the sort parameter.- Parameters:
items
- the items to sortsort
- the sort parameter
-
toggleSelection
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.
-