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<java.util.List<java.lang.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<java.util.List<java.lang.String>>
Builds the category tree.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CmsCategoryTree.SortParams
Sorting parameters.
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<java.lang.String,CmsTreeItem>
m_categories
Map of categories.protected java.util.Map<java.lang.String,java.util.List<java.lang.String>>
m_childrens
Map from category paths to the paths of their children.protected com.google.gwt.user.client.ui.HasText
m_infoLabel
A label for displaying additional information about the tab.protected boolean
m_isSingleSelection
Vale to store the widget mode.protected boolean
m_listView
Vale to store the view mode.protected com.google.gwt.user.client.ui.FlowPanel
m_options
The option panel.protected CmsTextBox
m_quickSearch
The quick search box.protected java.util.List<org.opencms.gwt.shared.CmsCategoryTreeEntry>
m_resultList
List of categories selected from the server.protected CmsList<CmsTreeItem>
m_scrollList
List of categories.protected CmsPushButton
m_searchButton
The quick search button.protected java.util.Collection<java.lang.String>
m_selectedCategories
List of all selected categories.protected java.lang.String
m_singleResult
Result string for single selection.protected CmsSelectBox
m_sortSelectBox
The select box to change the sort order.
-
Constructor Summary
Constructors Constructor Description CmsCategoryTree()
Default Constructor.CmsCategoryTree(java.util.Collection<java.lang.String> selectedCategories, int height, boolean isSingleValue, java.util.List<org.opencms.gwt.shared.CmsCategoryTreeEntry> categories)
Constructor to collect all categories and build a view tree.CmsCategoryTree(java.util.Collection<java.lang.String> selectedCategories, int height, boolean isSingleValue, java.util.List<org.opencms.gwt.shared.CmsCategoryTreeEntry> categories, boolean showCollapsed)
Constructor to collect all categories and build a view tree.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addChildren(CmsTreeItem parent, java.util.List<org.opencms.gwt.shared.CmsCategoryTreeEntry> children, java.util.Collection<java.lang.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<java.util.List<java.lang.String>> handler)
protected void
cancelQuickFilterTimer()
Cancels the quick filter timer.protected void
checkQuickSearchStatus()
Checks the quick search input and enables/disables the search button accordingly.protected void
createQuickBox()
Creates the quick search/finder box.protected CmsList<CmsTreeItem>
createScrollList()
Creates the list which should contain the list items of the tab.void
disable(java.lang.String disabledReason)
Disabled the category selection.void
enable()
Enables the category selection.void
fireValueChange()
Represents a value change event.java.util.List<java.lang.String>
getAllSelected()
Returns a list of all selected values.java.util.List<java.lang.String>
getAllSelectedSitePath()
Returns a list of all selected values as Sidepath.protected java.util.List<CmsTreeItem>
getFilteredCategories(java.lang.String filter)
Gets the filtered list of categories.CmsScrollPanel
getScrollPanel()
Returns the scrollpanel of this widget.java.util.List<java.lang.String>
getSelected()
Returns the last selected value.protected java.util.LinkedHashMap<java.lang.String,java.lang.String>
getSortList()
List of all sort parameters.protected boolean
hasQuickFilter()
Returns true if this widget hat an QuickFilter.protected void
init()
Call after all handlers have been set.boolean
isEnabled()
Returns if the category selection is enabled.void
openWithParents(CmsTreeItem item)
Goes up the tree and opens the parents of the item.protected void
quickSearch()
Sets the search query an selects the result tab.protected void
removeQuickBox()
Removes the quick search/finder box.protected void
scheduleQuickFilterTimer()
Schedules the quick filter action.void
showIsEmptyLabel()
Shows the tab list is empty label.protected void
sort(java.util.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
truncate(java.lang.String textMetricsKey, int clientWidth)
Truncates long text and sets the original text to the title attribute.void
updateContentList(java.util.List<CmsTreeItem> treeItemsToShow)
Updates the content of the categories list.void
updateContentTree()
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
-
-
-
-
Field Detail
-
m_categories
protected java.util.Map<java.lang.String,CmsTreeItem> m_categories
Map of categories.
-
m_childrens
protected java.util.Map<java.lang.String,java.util.List<java.lang.String>> m_childrens
Map from category paths to the paths of their children.
-
m_infoLabel
protected com.google.gwt.user.client.ui.HasText m_infoLabel
A label for displaying additional information about the tab.
-
m_isSingleSelection
protected boolean m_isSingleSelection
Vale to store the widget mode. True means the single selection.
-
m_listView
protected boolean m_listView
Vale to store the view mode. True means the list view.
-
m_options
@UiField protected com.google.gwt.user.client.ui.FlowPanel m_options
The option panel.
-
m_quickSearch
protected CmsTextBox m_quickSearch
The quick search box.
-
m_resultList
protected java.util.List<org.opencms.gwt.shared.CmsCategoryTreeEntry> m_resultList
List of categories selected from the server.
-
m_scrollList
protected CmsList<CmsTreeItem> m_scrollList
List of categories.
-
m_searchButton
protected CmsPushButton m_searchButton
The quick search button.
-
m_selectedCategories
protected java.util.Collection<java.lang.String> m_selectedCategories
List of all selected categories.IMPORTANT: This may unfortunately contain either category paths or category site paths.
-
m_singleResult
protected java.lang.String m_singleResult
Result string for single selection.
-
m_sortSelectBox
protected CmsSelectBox m_sortSelectBox
The select box to change the sort order.
-
-
Constructor Detail
-
CmsCategoryTree
public CmsCategoryTree()
Default Constructor.
-
CmsCategoryTree
public CmsCategoryTree(java.util.Collection<java.lang.String> selectedCategories, int height, boolean isSingleValue, java.util.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(java.util.Collection<java.lang.String> selectedCategories, int height, boolean isSingleValue, java.util.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 Detail
-
addChildren
public void addChildren(CmsTreeItem parent, java.util.List<org.opencms.gwt.shared.CmsCategoryTreeEntry> children, java.util.Collection<java.lang.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
-
addValueChangeHandler
public com.google.gwt.event.shared.HandlerRegistration addValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler<java.util.List<java.lang.String>> handler)
- Specified by:
addValueChangeHandler
in interfacecom.google.gwt.event.logical.shared.HasValueChangeHandlers<java.util.List<java.lang.String>>
- See Also:
HasValueChangeHandlers.addValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler)
-
disable
public void disable(java.lang.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
public java.util.List<java.lang.String> getAllSelected()
Returns a list of all selected values.- Returns:
- a list of selected values
-
getAllSelectedSitePath
public java.util.List<java.lang.String> getAllSelectedSitePath()
Returns a list of all selected values as Sidepath.- Returns:
- a list of selected values
-
getScrollPanel
public CmsScrollPanel getScrollPanel()
Returns the scrollpanel of this widget.- Returns:
- CmsScrollPanel the scrollpanel of this widget
-
getSelected
public java.util.List<java.lang.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(java.lang.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 interfaceI_CmsTruncable
- Parameters:
textMetricsKey
- the key identifying the text metrics to useclientWidth
- the width to use in pixels- See Also:
I_CmsTruncable.truncate(java.lang.String, int)
-
updateContentList
public void updateContentList(java.util.List<CmsTreeItem> treeItemsToShow)
Updates the content of the categories list.- Parameters:
treeItemsToShow
- the updates list of categories tree item beans
-
updateContentTree
public void updateContentTree()
Updates the content of the categories tree.
-
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
protected CmsList<CmsTreeItem> createScrollList()
Creates the list which should contain the list items of the tab.- Returns:
- the newly created list widget
-
getFilteredCategories
protected java.util.List<CmsTreeItem> getFilteredCategories(java.lang.String filter)
Gets the filtered list of categories.- Parameters:
filter
- the search string to use for filtering- Returns:
- the filtered category beans
-
getSortList
protected java.util.LinkedHashMap<java.lang.String,java.lang.String> 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(java.util.List<CmsTreeItem> items, CmsCategoryTree.SortParams sort)
Sorts a list of tree items according to the sort parameter.- Parameters:
items
- the items to sortsort
- 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.
-
-