Class Treeview
- All Implemented Interfaces:
Animatable<Treeview>
,CanDrop<Treeview>
,Clickable<Treeview>
,Draggable<Treeview>
,Fetchable<Treeview>
,HandleHotKey<Treeview>
,HandleMouseEvents<Treeview>
,BasedOnDataDescriptor<Treeview>
,Filterable<Treeview>
,Scrollable<Treeview>
,Touchable<Treeview>
Treeview component
The component enables you to visualize a hierarchical data structure in a tree view on the interface. The component is capable of selecting, expanding and collapsing individual nodes (items).
TThe component has a default renderer, that allows the the treeview item icon, component, name or label to be specified, but it is also possible to create a custom renderer that uses custom components to visualize a TreeView. Thus, a simple or complex tree can be displayed, in which the data hierarchy is visualized.
The component’s contents may be programmatically specified or automatically using a DataDescriptor. In this case the tree data originates from a DataDescriptor and is displayed based on individual parameter settings.
Supported events:
AnimationStart
AnimationEnd
,
Click
,
DoubleClick
,
MouseDown
,
MouseDown
,
MouseLeave
,
MouseMove
,
MouseOver
,
MouseOut
,
MouseUp
,
Wheel
,
Scrollable
TouchCancel
,
TouchEnd
,
TouchMove
,
TouchStart
,
Drop
,
DragStart
,
DragEnd
HotKey
- Since:
- 4.0
- Author:
- JBStrap
- See Also:
-
Field Summary
Fields inherited from class com.jbstrap.ui.Component
animation, attributes, backgroundColor, borderColor, color, defaultHotKeyHandler, handlers, hotKeys, styleClasses, textAlign, toolTip, toolTipPosition
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddComponent
(Component<?> component) No further component can be added to the treeview componentaddNode
(TreeviewNode node) Adds a node to the treeviewaddNodes
(TreeviewNode... nodes) Adds multiple nodes to the treeview componentfinal Treeview
Adds an ordering criterion to the criteria used for database queryfinal Treeview
Adds an ordering criterion to the list of criteria used for database queryclear()
Deletes all data from the component and sets the component back to default.final Treeview
Closes all nodes in the tree.This method implements actual data retrieval.Queries data from the database.final List<TreeviewNode>
find
(Predicate<TreeviewNode> filter) Gets all nodes from the component fulfilling the specified predicate.findByName
(String name) Gets a node by its name.findByTitle
(String title) Gets nodes from the tree by their title.final TreeviewNode
findFirst
(Predicate<TreeviewNode> filter) Gets the first node from the component that fulfils the specified criterion.Gets the name of the DataDescriptor column containing node icon colorGets the filter criterion used for the query.final TreeviewNode
Gets the current (highlighted) node.final DataDescriptor
Gets treeview DataDescriptorfinal Criteria
If the treeview retrieves its data from a DataDescriptor, the criterion used to query the data must be specified.Queries the icon of the default collapsed folderQueries the default expanded folder iconGets the default icon colorGets the default icon for the leaf nodes.Gets the filter criterion used to query data from the database.Gets the name of the DataDescriptor column containing the node icon nameGets the name of the column used to identify the DataDescriptor items.Gets a root node by its namefinal TreeviewNodeClickEvent
Gets the event handler associated with clicking on a node.final TreeviewNodeCloseEvent
Gets the event handler associated with collapsing a parent node.final TreeviewNodeCreator
Gets the renderer used to create nodesfinal TreeviewNodeOpenEvent
Gets the event handler associated with expanding a parent nodegetNodes()
Gets all root nodes not in the componentfinal TreeviewNodeSelectEvent
Gets the event handler associated with changing the selection of a node.Gets the ordering criterion used for data queryDataDescriptor parent ID column nameGets the selection mode for the treeview componentGets the DataDescriptor column name that contains the node label.boolean
Determines if the component can fetch data from the database automatically.final boolean
Sets if the clicked node is automatically highlighted in the componentboolean
Specifies if nodes of the treeview component are selectable or not.void
onShow()
The operations to be executed after the component is displayed on the clientfinal Treeview
Opens all the nodes in the tree.removeComponent
(Component<?> component) No component can be removed from the treeview componentremoveNode
(TreeviewNode node) Removes a root node from the component.removeNode
(String name) Removes a root node from the component by its name.removeNodes
(TreeviewNode... nodes) Removes multiple root nodes from the component.removeNodes
(String... names) Removes multiple root nodes from the component by name.setAutoFetchData
(boolean autoFetch) Sets if the data is to be queried automatically from the database upon component loading This function is disabled by default, that is, data is only queried if the methodfetchData()
is called.setColorColumnName
(String colorColumnName) Sets the name of the DataDescriptor column containing the node icon color.protected Treeview
setCurrentNode
(TreeviewNode node) setCustomFetch
(FetchEvent fetchEvent) Sets a custom query.final Treeview
setDataDescriptor
(DataDescriptor dataDescriptor) Sets the treeview DataDescriptorfinal Treeview
setDataDescriptor
(DataDescriptor dataDescriptor, TreeviewNodeCreator nodeCreator) Sets the treeview DataDescriptor and defines an own node renderer implementationfinal Treeview
setDefaultCriteria
(Criteria criteria) Sets the Default Criteria used for filtering the treeview items.setDefaultFolderIcon
(Icon defaultFolderIcon) Sets the icon of the default collapsed folder If no expanded folder is specified, the icon specified here is used also as an expanded folder icon.setDefaultFolderOpenIcon
(Icon defaultfolderOpenIcon) Sets the default expanded folder icon.final Treeview
setDefaultIconColor
(String color) Sets the default icon colorsetDefaultItemIcon
(Icon defaultItemIcon) Sets the default icon for the leaf nodes.setFilterCriteria
(Criteria criteria) If the treeview component retrieves its values from a DataDescriptor, a filter criterion to get the data must be specified.final Treeview
setHighlightingCurrentNode
(Boolean hilightingCurrentNode) Sets if the clicked node is highlighted or not.setIconColumnName
(String iconColumnName) Sets the name of the DataDescriptor containing the node icon In order to work properly, the DataDescriptor must contain a column by the name s specified here.setIdColumnName
(String idColumnName) Sets the node ID column namefinal Treeview
Sets the implementation of the event handler associated with clicking on a node.final Treeview
Sets the implementation of the event handler associated with collapsing a parent nodefinal Treeview
setNodeCreator
(TreeviewNodeCreator nodeCreator) Sets the node creator implementationfinal Treeview
setNodeOpenHandler
(TreeviewNodeOpenEvent handler) Sets the implementation of the event handler associated with expanding a parent nodefinal Treeview
Sets the event handler associated with changing the selection of a node.setParentColumnName
(String parentColumnName) Sets the name of the DataDescriptor column containing the parent node ID In order to work properly, the DataDescriptor must contain a column by the name specified here.setSelectable
(boolean selectable) Enables/disables whether a treeview component is selectable By default, nodes are not selectable.setSelectable
(boolean selectable, TreeviewSelectionTypes selectionType) Sets the selection mode for the treeview.setSelectionType
(TreeviewSelectionTypes selectionType) Sets the selection mode for the treeview.setTitleColumnName
(String titleColumnName) Sets the name of the DataDescriptor column containing the node label In order to work properly, the DataDescriptor must contain a column by the name specified here.boolean
writeHTML
(StringWriter writer) Creates the component's HTML equivalentMethods inherited from class com.jbstrap.ui.Component
_hide, _setAttribute, addAllowedRole, addComponent, addComponents, addDeniedRole, addHandler, addStyle, addStyleClass, addStyleClasses, afterDraw, clearfix, closeTag, combinateAccess, containsStyle, containsStyleClass, draw, drawSubComponents, error, flattendComponentTree, getAccess, getAccessMode, getAllowedRoles, getAttribute, getAttributes, getBackgroundColor, getBorderColor, getClient, getComponentById, getComponents, getComponents, getComponentsByClass, getData, getDeniedRoles, getHandlers, getId, getLanguageCode, getName, getParent, getParent, getRegisteredEvents, getStyle, getStyleClasses, getTextAlign, getTextColor, getToolTip, getToolTipPosition, getTypeName, getUI, init, insertComponentAfter, insertComponentBefore, isAccess, isDrawn, isEnabled, isEventBubbling, isVisible, onHide, onHotKeyEventHandler, openTag, redraw, removeAllComponents, removeAllowedRole, removeAllStyleClasses, removeAttribute, removeComponent, removeComponents, removeDeniedRole, removeHandler, removeStyle, removeStyle, removeStyleClass, removeStyleClasses, replaceComponent, replaceStyleClass, runAfterDraw, runJavaScript, runJavaScript, runJavaScript, runOnHide, runOnShow, say, setAttribute, setBackgroundColor, setBorder, setBorderColor, setData, setDisplayType, setEnabled, setEventBubbling, setFlex, setFloating, setHeight100, setHeight25, setHeight50, setHeight75, setHeightAuto, setLanguage, setMargin, setName, setOverflow, setPadding, setParent, setScrollable, setSelectionType, setShadow, setStyle, setTextAlign, setTextColor, setToolTip, setToolTipPosition, setVisible, setWidth100, setWidth25, setWidth50, setWidth75, setWidthAuto, showNotification, showNotification, showProcessIndicator, toggleStyleClass
Methods inherited from class com.jbstrap.core.messagebus.MessageBus
closeMessageBus, messageBusOpened, openMessageBus, renewSubscription, sendMessageToMessageBus, subscribeMessageBus, unsubscribeAllListeners, unsubscribeMessageBus
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.jbstrap.ui.Animatable
addAnimationEndHandler, addAnimationStartHandler, getAnimation, removeAnimation, setAnimation
Methods inherited from interface com.jbstrap.ui.CanDrop
addDropEventHandler
Methods inherited from interface com.jbstrap.ui.Clickable
addClickHandler, addDoubleClickHandler
Methods inherited from interface com.jbstrap.ui.Draggable
addDragEndEventHandler, addDragStartEventHandler, setDraggable
Methods inherited from interface com.jbstrap.ui.Fetchable
addFetchDoneHandler, fireFetchDoneEvent
Methods inherited from interface com.jbstrap.ui.HandleHotKey
addHotKey, addHotKey, removeHotKey, removeHotKeys
Methods inherited from interface com.jbstrap.ui.HandleMouseEvents
addMouseDownHandler, addMouseEnterHandler, addMouseLeaveHandler, addMouseMoveHandler, addMouseOutHandler, addMouseOverHandler, addMouseUpHandler, addMouseWheelHandler
Methods inherited from interface com.jbstrap.ui.Scrollable
addScrollHandler
Methods inherited from interface com.jbstrap.ui.Touchable
addTouchCancelHandler, addTouchEndHandler, addTouchMoveHandler, addTouchStartHandler
-
Constructor Details
-
Treeview
public Treeview()Creates an empty TreeView component -
Treeview
Creates an empty Treeview component based on the language settings- Parameters:
language
- Language code according to which the component is created. If not provided or the entered value isnull
, the component is created using the framework’s default language. The default language of the framework is set via the JBStrap parameterJBStrapParamType.DEFAULT_LANGUAGE
.
-
Treeview
Creates an empty Treeview component based on the language settings- Parameters:
id
- The component ID. The ID specified here will appear in the HTML tag as an ID attribute. If there are multiple components displayed, that have the same ID, the ID numbers will be numbered, in the order they are displayed. (For example, if the ID is 'COMPONENT' then it will be numbered like this: COMPONENT, COMPONENT_1, COMPONENT_2 etc.)language
- Language code according to which the component is created. If not provided or the entered value isnull
, the component is created using the framework’s default language. The default language of the framework is set via the JBStrap parameterJBStrapParamType.DEFAULT_LANGUAGE
.
-
-
Method Details
-
setSelectable
Sets the selection mode for the treeview. Items of the treeview component cannot be selected by default.- Parameters:
selectable
- Iftrue
is set, the treeview component’s items are selectable. If the items can be selected, a small tick box appears in front of them.selectionType
- Sets selection mode Available selection types are listed in the enumTreeviewSelectionTypes
. If thenull
value is set, the defaultTreeviewSelectionTypes.SINGLE_NODE_SELECT
mode is selected.- Returns:
- TreeView component
-
setSelectable
Enables/disables whether a treeview component is selectable By default, nodes are not selectable.- Parameters:
selectable
- If atrue
value is set, a checkbox appears in front of a treeview node, enabling the user to select individual nodes. If afalse
value is set, the checkbox is not displayed and the user is unable to select a node.- Returns:
- TreeView component
-
isSelectable
public boolean isSelectable()Specifies if nodes of the treeview component are selectable or not.- Returns:
- If
true
, the component’s nodes are selectable. Otherwisefalse
.
-
setSelectionType
Sets the selection mode for the treeview. The default selection setting isTreeviewSelectionTypes.SINGLE_NODE_SELECT
.- Parameters:
selectionType
- The selection mode to be set Available selection types are listed in the enumTreeviewSelectionTypes
. Ifnull
is set, the default selection mode is used.- Returns:
- TreeView component
-
getSelectionType
Gets the selection mode for the treeview component- Returns:
- The selection mode for the treeview component
-
addNode
Adds a node to the treeview- Parameters:
node
- An instance of the node we want to add to the treeview. The node specified here is added as a root node to the component- Returns:
- TreeView component
-
addNodes
Adds multiple nodes to the treeview component- Parameters:
nodes
- A list of nodes we want to add to the treeview component. All of the nodes specified here are added to the component as separate root nodes.- Returns:
- TreeView component
-
removeNode
Removes a root node from the component by its name. If no root node is found by that name on the component, the method does nothing.- Parameters:
name
- The name of the root node we want to remove from the component- Returns:
- TreeView component
-
removeNode
Removes a root node from the component. If the specified node does not exist on the component, the method does nothing.- Parameters:
node
- An instance of the node we want to remove from the component- Returns:
- TreeView component
-
removeNodes
Removes multiple root nodes from the component by name. If the list contains a name that references to root node in the component, it will be ignored.- Parameters:
names
- An enumeration of all nodes we want to remove from the component- Returns:
- TreeView component
-
removeNodes
Removes multiple root nodes from the component. If the enumeration contains a name that is not listed among the component’s root nodes, it will be ignored.- Parameters:
nodes
- An enumeration of all node instances we want to remove from the component- Returns:
- TreeView component
-
getNodes
Gets all root nodes not in the component- Returns:
- A collection containing all root nodes of the treeview component. If the treeview component does not contain any nodes, the result is
null
.
-
getNode
Gets a root node by its name- Parameters:
name
- The name of the root node we want to get from the component- Returns:
- The root node identified by the name or
null
if no root node exists by that name in the component
-
findFirst
Gets the first node from the component that fulfils the specified criterion. Search is performed in the entire tree.- Parameters:
filter
- The predicate based on which the first node is returned- Returns:
- The first node in the tree fulfilling the predicate or
null
if none of the nodes correspond to the entered predicate. - Throws:
NullPointerException
- Thrown if the specified predicate isnull
-
find
Gets all nodes from the component fulfilling the specified predicate. Search is performed in the entire tree.- Parameters:
filter
- The predicate based on which the corresponding nodes are returned- Returns:
- A list of the nodes corresponding the predicate. If no nodes correspond to the predicate, an empty list is returned.
- Throws:
NullPointerException
- Thrown if the specified predicate isnull
-
findByName
Gets a node by its name. The search is performed in the entire tree which means not necessarily the root node is returned.- Parameters:
name
- The name whose referenced node we want to get- Returns:
- The node with the specified name or
null
if there is no node by that name in the tree.
-
findByTitle
Gets nodes from the tree by their title. Search is performed in the entire tree.- Parameters:
title
- The title we want to use to get the nodes- Returns:
- A list of all nodes that have the specified title. If no node has the specified title, an empty list is returned.
-
openAllNodes
Opens all the nodes in the tree.- Returns:
- TreeView component
-
closeAllNodes
Closes all nodes in the tree.- Returns:
- TreeView component
-
setFilterCriteria
If the treeview component retrieves its values from a DataDescriptor, a filter criterion to get the data must be specified.- Specified by:
setFilterCriteria
in interfaceFilterable<Treeview>
- Parameters:
criteria
- The filter criterion used to query data from the database- Returns:
- TreeView component
-
getFilterCriteria
Gets the filter criterion used to query data from the database.- Returns:
- The current filter criterion or
null
if no filter criterion is set
-
setDefaultCriteria
Sets the Default Criteria used for filtering the treeview items.- Parameters:
criteria
- The default filter criteria. Ifnull
, no default criteria will be used, but if a simple criteria was specified, that will be applied- Returns:
- The treeview component
-
getDefaultCriteria
If the treeview retrieves its data from a DataDescriptor, the criterion used to query the data must be specified. The filter criterion specified here is concatenated with an ‘AND’ operator to the criterion specified in thesetFilterCriteria
method and then used in the query.- Returns:
- Default filter criterion
-
getCriteria
Gets the filter criterion used for the query.- Specified by:
getCriteria
in interfaceFilterable<Treeview>
- Returns:
- Filter criterion used for the query, containing the default and the specified filter criterion, concatenated using an ‘AND’ operator
-
fetchData
Queries data from the database. The method can only be used if the treeview is bound to a DataDescriptor.- Specified by:
fetchData
in interfaceFetchable<Treeview>
- Specified by:
fetchData
in interfaceFilterable<Treeview>
- Returns:
- The component
- Throws:
UnsupportedOperationException
- Thrown if there is no DataDescriptor defined for the componentIllegalArgumentException
- Thrown if either the name of the identifying column or the parent node ID column or the node label column is not specified.
-
getIdColumnName
Gets the name of the column used to identify the DataDescriptor items.- Returns:
- Name of the node ID column or
null
if not specified.
-
setIdColumnName
Sets the node ID column name- Parameters:
idColumnName
- The name of the column in the DataDescriptor in which node Ids are stored. The name specified here must be referenced in the DataDescriptor in order to work properly.- Returns:
- Treeview component
-
getParentColumnName
DataDescriptor parent ID column name- Returns:
- DataDescriptor parent ID column name or
null
if not specified
-
setParentColumnName
Sets the name of the DataDescriptor column containing the parent node ID In order to work properly, the DataDescriptor must contain a column by the name specified here.- Parameters:
parentColumnName
- The name of the DataDescriptor column containing parent node ID- Returns:
- Treeview component
-
getTitleColumnName
Gets the DataDescriptor column name that contains the node label.- Returns:
- The name of the DataDescriptor column that contains node label or
null
if not specified
-
setTitleColumnName
Sets the name of the DataDescriptor column containing the node label In order to work properly, the DataDescriptor must contain a column by the name specified here.- Parameters:
titleColumnName
- The name of the DataDescriptor column that contains the node title- Returns:
- Treeview component
-
getIconColumnName
Gets the name of the DataDescriptor column containing the node icon name- Returns:
- The name of the DataDescriptor column containing the node icon or
null
if not set
-
setIconColumnName
Sets the name of the DataDescriptor containing the node icon In order to work properly, the DataDescriptor must contain a column by the name s specified here.- Parameters:
iconColumnName
- The name of the column in the DataDescriptor containing the node icon- Returns:
- Treeview component
-
getColorColumnName
Gets the name of the DataDescriptor column containing node icon color- Returns:
- The name of the DataDescriptor column containing the node icon color or
null
if not set
-
setColorColumnName
Sets the name of the DataDescriptor column containing the node icon color. In order to work properly, the DataDescriptor must contain a column by the name specified here.- Parameters:
colorColumnName
- The name of the DataDescriptor column containing node icon color- Returns:
- Treeview component
-
getDataDescriptor
Gets treeview DataDescriptor- Specified by:
getDataDescriptor
in interfaceBasedOnDataDescriptor<Treeview>
- Returns:
- The DataDescriptor from where treeview data are retrieved, or
null
if no DataDescriptor is set
-
setDataDescriptor
Sets the treeview DataDescriptor- Specified by:
setDataDescriptor
in interfaceBasedOnDataDescriptor<Treeview>
- Parameters:
dataDescriptor
- The DataDescriptor instance from where treeview data is retrieved- Returns:
- Treeview component
-
setDataDescriptor
public final Treeview setDataDescriptor(DataDescriptor dataDescriptor, TreeviewNodeCreator nodeCreator) Sets the treeview DataDescriptor and defines an own node renderer implementation- Parameters:
dataDescriptor
- The DataDescriptor instance from where treeview data is retrievednodeCreator
- The node creator implementation- Returns:
- Treeview component
- See Also:
-
setNodeCreator
Sets the node creator implementation
If you do not want to use the default visualization, you can also write your own node renderer, which gives you the possibility to place any component into the nodes. The renderer defined here must implement the
TreeviewNodeCreator
interface.- Parameters:
nodeCreator
- Node renderer implementation- Returns:
- Treeview component
- See Also:
-
getNodeCreator
Gets the renderer used to create nodes- Returns:
- An own implementation of renderer used to create nodes
-
addComponent
No further component can be added to the treeview component- Overrides:
addComponent
in classComponent<Treeview>
- Parameters:
component
- The component to be added- Returns:
- The component
- Throws:
UnsupportedOperationException
- Every time the method is called
-
removeComponent
No component can be removed from the treeview component- Overrides:
removeComponent
in classComponent<Treeview>
- Parameters:
component
- The component instance- Returns:
- The component
- Throws:
UnsupportedOperationException
- Every time the method is called
-
getOrders
Gets the ordering criterion used for data query- Returns:
- A list of ordering criteria used for data query or
null
if no ordering criteria are used for database query
-
addOrder
Adds an ordering criterion to the criteria used for database query- Parameters:
columnName
- The name of the DataDescriptor column based on which data is queried in ascending order- Returns:
- Treeview component
-
addOrder
Adds an ordering criterion to the list of criteria used for database query- Parameters:
columnName
- The name of a DataDescriptor column based on which data is to be orderedorderType
- Ordering sequence Available ordering sequences are listed in the enumOrderType
- Returns:
- Treeview component
-
setDefaultIconColor
Sets the default icon color- Parameters:
color
- Default icon color as defined in the CSS3 standard- Returns:
- Treeview component
-
getDefaultIconColor
Gets the default icon color- Returns:
- The default icon color in the specified format or
null
if no default icon color is specified
-
getDefaultFolderIcon
Queries the icon of the default collapsed folder- Returns:
- The icon of the default collapsed folder or
null
if not specified
-
setDefaultFolderIcon
Sets the icon of the default collapsed folder If no expanded folder is specified, the icon specified here is used also as an expanded folder icon.- Parameters:
defaultFolderIcon
- The icon of the default collapsed folder Available icon are listed in the enumIcon
.- Returns:
- Treeview component
-
getDefaultFolderOpenIcon
Queries the default expanded folder icon- Returns:
- The default expanded folder icon, or
null
if not specified
-
setDefaultFolderOpenIcon
Sets the default expanded folder icon. If it is not specified, the default collapsed folder icon is displayed even when the folder is expanded.- Parameters:
defaultfolderOpenIcon
- The default expanded folder icon Available icon are listed in the enumIcon
.- Returns:
- Treeview component
-
getDefaultItemIcon
Gets the default icon for the leaf nodes.- Returns:
- The default icon for the leaf nodes or
null
if not specified
-
setDefaultItemIcon
Sets the default icon for the leaf nodes.- Parameters:
defaultItemIcon
- The default leaf node icon Available icons are listed in the enumIcon
.- Returns:
- Treeview component
-
setNodeOpenHandler
Sets the implementation of the event handler associated with expanding a parent node- Parameters:
handler
- The implementation of an event handler associated with expanding a parent node- Returns:
- Treeview component
-
getNodeOpenHandler
Gets the event handler associated with expanding a parent node- Returns:
- The implementation of an event handler associated with expanding a parent node or
null
if not specified
-
setNodeCloseHandler
Sets the implementation of the event handler associated with collapsing a parent node- Parameters:
handler
- The implementation of the event handler associated with collapsing a parent node- Returns:
- Treeview component
-
getNodeCloseHandler
Gets the event handler associated with collapsing a parent node.- Returns:
- The implementation of the event handler associated with collapsing a parent node or
null
if not specified
-
setNodeClickHandler
Sets the implementation of the event handler associated with clicking on a node.- Parameters:
handler
- The implementation of the event handler associated with clicking on a node- Returns:
- Treeview component
-
getNodeClickHandler
Gets the event handler associated with clicking on a node.- Returns:
- The implementation of the event handler associated with clicking on a node or
null
if not specified
-
setNodeSelectionChangedHandler
Sets the event handler associated with changing the selection of a node.- Parameters:
handler
- The implementation of the event handler associated with changing the selection of a node- Returns:
- Treeview component
-
getNodeSelectionChangedHandler
Gets the event handler associated with changing the selection of a node.- Returns:
- The implementaton of the event handler associated with changing the selection of a node or
null
if not specified
-
setAutoFetchData
Sets if the data is to be queried automatically from the database upon component loading This function is disabled by default, that is, data is only queried if the methodfetchData()
is called.- Specified by:
setAutoFetchData
in interfaceFetchable<Treeview>
- Specified by:
setAutoFetchData
in interfaceFilterable<Treeview>
- Parameters:
autoFetch
- Iftrue
, then the auto fetch is enabled. If disabled, the query must be started manually, through code.- Returns:
- The component
-
isAutoFetchData
public boolean isAutoFetchData()Description copied from interface:Fetchable
Determines if the component can fetch data from the database automatically.- Specified by:
isAutoFetchData
in interfaceFetchable<Treeview>
- Specified by:
isAutoFetchData
in interfaceFilterable<Treeview>
- Returns:
- If
true
, then the auto fetch is enabled.
-
onShow
public void onShow()Description copied from class:Component
The operations to be executed after the component is displayed on the clientBy default, this is an empty method. It has to be overwritten on a component or page, if additional operations have to be executed after the component is displayed. This method is nearly identical to the afterDraw() method, they differ in when they are executed. This method runs after the component is displayed on the client. Meaning that it is executed even if the component isn't redrawn, but only set to be visible after being hidden.
-
setHighlightingCurrentNode
Sets if the clicked node is highlighted or not. This option is disabled by default- Parameters:
hilightingCurrentNode
- Iftrue
is set, the clicked node is highlighted If the value is set tofalse
, the clicked node is not automatically highlighted- Returns:
- Treeview component
-
isHighlightingCurrentNode
public final boolean isHighlightingCurrentNode()Sets if the clicked node is automatically highlighted in the component- Returns:
- If
true
, the clicked node is automatically highlighted, otherwisefalse
.
-
setCurrentNode
- Parameters:
node
- The node we want to set as the current one- Returns:
- Treeview component
-
getCurrentNode
Gets the current (highlighted) node.- Returns:
- The current node or
null
if there is no current node
-
clear
Deletes all data from the component and sets the component back to default.- Returns:
- Treeview component
-
writeHTML
Description copied from class:Component
Creates the component's HTML equivalentThis method doesn't need to be used during application development. This method is used when developing a custom component. When creating a custom component, this method needs to be implemented. In the parameter (
StringWriter
class) the component's HTML equivalent must be specified, and the method has to return with a Boolean value. This boolean value determines if the component was drawn. If the user doesn't have access right to the component, or if the component couldn't be drawn, it should return withfalse
. Otherwise, it must return withtrue
. -
setCustomFetch
Sets a custom query. When calling the fetchData method, the specifiedFetchEvent
implementation is called, then callback methods are run on records returned by the
onFetch
method.- Parameters:
fetchEvent
- Custom query implementation
-
fetch
public List<Record> fetch(int startRow, int endRow, Criteria criteria, List<Order> orders, Client client) throws FindException, DataAccessException Description copied from interface:Fetchable
This method implements actual data retrieval. TheFetchable.fetchData()
function runs callback methods on the returned records.- Specified by:
fetch
in interfaceFetchable<Treeview>
- Parameters:
startRow
- The first row of the query that appears in the returned listendRow
- The last row of the query that appears in the returned listcriteria
- The criteria used during the query Ifnull
, no criteria will be used, every record is queried.orders
- The orderings that will be applied to the query results. Ifnull
, the data will not be ordered.client
- The client that started the query. Ifnull
, the query will happen without checking for access rights.- Returns:
- The list of records that meet the specified filter criteria.
- Throws:
FindException
- Occurs if an error was encountered during the queryDataAccessException
- Occurs if the user in the specified client has no access to read the data
-