|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.JTree com.alee.laf.tree.WebTree<E> com.alee.extended.tree.WebCheckBoxTree<E>
public class WebCheckBoxTree<E extends javax.swing.tree.DefaultMutableTreeNode>
This WebTree extension class provides additional checkbox tree functionality. Basically this tree puts its own rendered behind the one specified by developer and uses it to render checkboxes.
Nested Class Summary | |
---|---|
protected class |
WebCheckBoxTree.Handler
WebCheckBoxTree mouse and key actions handler. |
Nested classes/interfaces inherited from class javax.swing.JTree |
---|
javax.swing.JTree.AccessibleJTree, javax.swing.JTree.DropLocation, javax.swing.JTree.DynamicUtilTreeNode, javax.swing.JTree.EmptySelectionModel, javax.swing.JTree.TreeModelHandler, javax.swing.JTree.TreeSelectionRedirector |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
javax.swing.JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
java.awt.Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
---|---|
protected javax.swing.tree.TreeCellRenderer |
actualCellRenderer
Actual content renderer; |
protected CheckBoxTreeCellRenderer |
checkBoxCellRenderer
Checkbox cell renderer. |
protected java.lang.Integer |
checkBoxRendererGap
|
protected java.lang.Boolean |
checkBoxVisible
|
protected java.lang.Boolean |
checkingEnabled
|
protected TreeCheckingModel<E> |
checkingModel
Cusstom checking model. |
protected java.lang.Boolean |
checkMixedOnToggle
|
protected java.util.List<CheckStateChangeListener<E>> |
checkStateChangeListeners
Checkbox tree check state change listeners. |
protected StateProvider<E> |
enabledStateProvider
Checkbox enabled state provider. |
protected WebCheckBoxTree.Handler |
handler
Tree actions handler. |
protected java.lang.Boolean |
recursiveChecking
Style settings. |
protected StateProvider<E> |
visibleStateProvider
Checkbox visibility state provider. |
Fields inherited from class com.alee.laf.tree.WebTree |
---|
cellEditorListeners, CONTIGUOUS_TREE_SELECTION, DISCONTIGUOUS_TREE_SELECTION, scrollToSelectionListener, SINGLE_TREE_SELECTION |
Fields inherited from class javax.swing.JTree |
---|
ANCHOR_SELECTION_PATH_PROPERTY, CELL_EDITOR_PROPERTY, CELL_RENDERER_PROPERTY, cellEditor, cellRenderer, editable, EDITABLE_PROPERTY, EXPANDS_SELECTED_PATHS_PROPERTY, INVOKES_STOP_CELL_EDITING_PROPERTY, invokesStopCellEditing, LARGE_MODEL_PROPERTY, largeModel, LEAD_SELECTION_PATH_PROPERTY, ROOT_VISIBLE_PROPERTY, rootVisible, ROW_HEIGHT_PROPERTY, rowHeight, SCROLLS_ON_EXPAND_PROPERTY, scrollsOnExpand, SELECTION_MODEL_PROPERTY, selectionModel, selectionRedirector, SHOWS_ROOT_HANDLES_PROPERTY, showsRootHandles, TOGGLE_CLICK_COUNT_PROPERTY, toggleClickCount, TREE_MODEL_PROPERTY, treeModel, treeModelListener, VISIBLE_ROW_COUNT_PROPERTY, visibleRowCount |
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
WebCheckBoxTree()
Constructs tree with default sample model. |
|
WebCheckBoxTree(E root)
Constructs tree with model based on specified root node. |
|
WebCheckBoxTree(E root,
boolean asksAllowsChildren)
Constructs tree with model based on specified root node and which decides whether a node is a leaf node in the specified manner. |
|
WebCheckBoxTree(java.util.Hashtable<?,?> value)
Constructs tree with model based on specified values. |
|
WebCheckBoxTree(java.lang.Object[] value)
Constructs tree with model based on specified values. |
|
WebCheckBoxTree(javax.swing.tree.TreeModel newModel)
Constructs tree with specified model. |
|
WebCheckBoxTree(java.util.Vector<?> value)
Constructs tree with model based on specified values. |
Method Summary | |
---|---|
void |
addCheckStateChangeListener(CheckStateChangeListener<E> listener)
Adds check state change listener. |
void |
checkAll()
Checks all tree nodes. |
protected WebCheckBoxTreeCellRenderer |
createCheckBoxTreeCellRenderer()
Creates and returns checkbox tree cell renderer. |
protected TreeCheckingModel<E> |
createDefaultCheckingModel(WebCheckBoxTree<E> checkBoxTree)
Creates and returns new default checking model for the specified checkbox tree. |
void |
fireCheckStateChanged(java.util.List<CheckStateChange<E>> stateChanges)
Informs about single or multiply check state changes. |
javax.swing.tree.TreeCellRenderer |
getActualRenderer()
Returns actual tree cell renderer. |
java.awt.Rectangle |
getCheckBoxBounds(E node)
Returns checkbox bounds for the specified tree node. |
java.awt.Rectangle |
getCheckBoxBounds(javax.swing.tree.TreePath treePath)
Returns checkbox bounds for the specified tree path. |
CheckBoxTreeCellRenderer |
getCheckBoxCellRenderer()
Returns checkbox tree cell renderer. |
int |
getCheckBoxRendererGap()
Returns gap between checkbox and actual tree renderer. |
java.util.List<E> |
getCheckedNodes()
Returns optimized list of checked nodes. |
java.util.List<E> |
getCheckedNodes(boolean optimize)
Returns list of checked nodes. |
TreeCheckingModel<E> |
getCheckingModel()
Returns tree checking model. |
CheckState |
getCheckState(E node)
Returns specified tree node check state. |
java.util.List<E> |
getMixedNodes()
Returns list of nodes in mixed state. |
protected void |
init()
Initializes additional tree settings. |
void |
invertCheck(E node)
Inverts tree node check. |
void |
invertCheck(java.util.List<E> nodes)
Inverts tree node check. |
boolean |
isCheckBoxEnabled(E node)
Returns whether checkbox for the specified node should be enabled or not. |
boolean |
isCheckBoxVisible()
Returns whether checkboxes are visible in the tree or not. |
boolean |
isCheckBoxVisible(E node)
Returns whether checkbox for the specified node should be visible or not. |
boolean |
isChecked(E node)
Returns whether the specified tree node is checked or not. |
boolean |
isCheckingByUserEnabled()
Returns whether user can change checkbox states or not. |
boolean |
isCheckingEnabled()
Returns whether user can interact with checkboxes to change their check state or not. |
boolean |
isCheckMixedOnToggle()
Returns whether partially checked node should be checked or unchecked on toggle. |
boolean |
isMixed(E node)
Returns whether the specified tree node is partially checked or not. |
boolean |
isRecursiveCheckingEnabled()
Returns whether checked or unchecked node childs should be checked or unchecked recursively or not. |
boolean |
isUnchecked(E node)
Returns whether the specified tree nod is unchecked or not. |
void |
removeCheckStateChangeListener(CheckStateChangeListener listener)
Removes check state change listener. |
void |
setCellRenderer(javax.swing.tree.TreeCellRenderer renderer)
|
void |
setCheckBoxEnabledStateProvider(StateProvider<E> provider)
Sets enabled state provider. |
void |
setCheckBoxRendererGap(int gap)
Sets gap between checkbox and actual tree renderer. |
void |
setCheckBoxTreeCellRenderer(CheckBoxTreeCellRenderer renderer)
Sets special checkbox tree cell renderer. |
void |
setCheckBoxVisible(boolean visible)
Sets whether checkboxes are visible in the tree or not. |
void |
setCheckBoxVisibleStateProvider(StateProvider<E> provider)
Sets visibility state provider. |
void |
setChecked(java.util.Collection<E> nodes,
boolean checked)
Sets specified nodes state to checked. |
void |
setChecked(E node,
boolean checked)
Sets whether the specified tree node is checked or not. |
void |
setCheckingEnabled(boolean enabled)
Sets whether user can interact with checkboxes to change their check state or not. |
void |
setCheckingModel(TreeCheckingModel<E> checkingModel)
Sets tree checking model. |
void |
setCheckMixedOnToggle(boolean checkMixedOnToggle)
Sets whether partially checked node should be checked or unchecked on toggle. |
void |
setRecursiveChecking(boolean recursive)
Sets whether checked or unchecked node childs should be checked or unchecked recursively or not. |
void |
uncheckAll()
Unchecks all tree nodes. |
Methods inherited from class javax.swing.JTree |
---|
addSelectionInterval, addSelectionPath, addSelectionPaths, addSelectionRow, addSelectionRows, addTreeExpansionListener, addTreeSelectionListener, addTreeWillExpandListener, cancelEditing, clearSelection, clearToggledPaths, collapsePath, collapseRow, convertValueToText, createTreeModelListener, expandPath, expandRow, fireTreeCollapsed, fireTreeExpanded, fireTreeWillCollapse, fireTreeWillExpand, fireValueChanged, getAccessibleContext, getAnchorSelectionPath, getCellEditor, getCellRenderer, getClosestPathForLocation, getClosestRowForLocation, getDescendantToggledPaths, getDragEnabled, getDropLocation, getDropMode, getEditingPath, getExpandedDescendants, getExpandsSelectedPaths, getInvokesStopCellEditing, getLastSelectedPathComponent, getLeadSelectionPath, getLeadSelectionRow, getMaxSelectionRow, getMinSelectionRow, getModel, getNextMatch, getPathBetweenRows, getPathBounds, getPathForLocation, getPathForRow, getPreferredScrollableViewportSize, getRowBounds, getRowCount, getRowForLocation, getRowForPath, getRowHeight, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getScrollsOnExpand, getSelectionCount, getSelectionModel, getSelectionPath, getSelectionPaths, getSelectionRows, getShowsRootHandles, getToggleClickCount, getToolTipText, getTreeExpansionListeners, getTreeSelectionListeners, getTreeWillExpandListeners, getUI, getUIClassID, getVisibleRowCount, hasBeenExpanded, isCollapsed, isCollapsed, isEditable, isEditing, isExpanded, isExpanded, isFixedRowHeight, isLargeModel, isPathEditable, isPathSelected, isRootVisible, isRowSelected, isSelectionEmpty, isVisible, makeVisible, paramString, removeDescendantSelectedPaths, removeDescendantToggledPaths, removeSelectionInterval, removeSelectionPath, removeSelectionPaths, removeSelectionRow, removeSelectionRows, removeTreeExpansionListener, removeTreeSelectionListener, removeTreeWillExpandListener, scrollPathToVisible, scrollRowToVisible, setAnchorSelectionPath, setDragEnabled, setDropMode, setEditable, setExpandedState, setExpandsSelectedPaths, setInvokesStopCellEditing, setLargeModel, setLeadSelectionPath, setModel, setRootVisible, setRowHeight, setScrollsOnExpand, setSelectionInterval, setSelectionModel, setSelectionPath, setSelectionPaths, setSelectionRow, setSelectionRows, setShowsRootHandles, setToggleClickCount, setUI, setVisibleRowCount, startEditingAtPath, stopEditing, treeDidChange |
Methods inherited from class javax.swing.JComponent |
---|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected java.lang.Boolean recursiveChecking
protected java.lang.Integer checkBoxRendererGap
protected java.lang.Boolean checkBoxVisible
protected java.lang.Boolean checkingEnabled
protected java.lang.Boolean checkMixedOnToggle
protected TreeCheckingModel<E extends javax.swing.tree.DefaultMutableTreeNode> checkingModel
protected CheckBoxTreeCellRenderer checkBoxCellRenderer
protected javax.swing.tree.TreeCellRenderer actualCellRenderer
protected StateProvider<E extends javax.swing.tree.DefaultMutableTreeNode> enabledStateProvider
protected StateProvider<E extends javax.swing.tree.DefaultMutableTreeNode> visibleStateProvider
protected WebCheckBoxTree.Handler handler
protected java.util.List<CheckStateChangeListener<E extends javax.swing.tree.DefaultMutableTreeNode>> checkStateChangeListeners
Constructor Detail |
---|
public WebCheckBoxTree()
public WebCheckBoxTree(java.lang.Object[] value)
value
- tree datapublic WebCheckBoxTree(java.util.Vector<?> value)
value
- tree datapublic WebCheckBoxTree(java.util.Hashtable<?,?> value)
value
- tree datapublic WebCheckBoxTree(E root)
root
- tree root nodepublic WebCheckBoxTree(E root, boolean asksAllowsChildren)
root
- tree root nodeasksAllowsChildren
- false if any node can have children, true if each node is asked to see if it can have childrenpublic WebCheckBoxTree(javax.swing.tree.TreeModel newModel)
newModel
- tree modelMethod Detail |
---|
protected void init()
init
in class WebTree<E extends javax.swing.tree.DefaultMutableTreeNode>
public CheckBoxTreeCellRenderer getCheckBoxCellRenderer()
public javax.swing.tree.TreeCellRenderer getActualRenderer()
public void setCellRenderer(javax.swing.tree.TreeCellRenderer renderer)
setCellRenderer
in class javax.swing.JTree
public void setCheckBoxTreeCellRenderer(CheckBoxTreeCellRenderer renderer)
renderer
- checkbox tree cell rendererprotected WebCheckBoxTreeCellRenderer createCheckBoxTreeCellRenderer()
public int getCheckBoxRendererGap()
public void setCheckBoxRendererGap(int gap)
gap
- gap between checkbox and actual tree rendererpublic CheckState getCheckState(E node)
node
- tree node to process
public boolean isUnchecked(E node)
node
- tree node to process
public boolean isChecked(E node)
node
- tree node to process
public boolean isMixed(E node)
node
- tree node to process
public java.util.List<E> getCheckedNodes()
public java.util.List<E> getCheckedNodes(boolean optimize)
optimize
- whether should optimize the resulting list by removing checked node childs or not
public java.util.List<E> getMixedNodes()
public void setChecked(java.util.Collection<E> nodes, boolean checked)
nodes
- nodes to checkchecked
- whether the specified tree nodes should be checked or notpublic void setChecked(E node, boolean checked)
node
- tree node to processchecked
- whether the specified tree node is checked or notpublic void invertCheck(E node)
node
- tree node to processpublic void invertCheck(java.util.List<E> nodes)
nodes
- tree node to processpublic void uncheckAll()
public void checkAll()
public TreeCheckingModel<E> getCheckingModel()
public void setCheckingModel(TreeCheckingModel<E> checkingModel)
checkingModel
- tree checking modelprotected TreeCheckingModel<E> createDefaultCheckingModel(WebCheckBoxTree<E> checkBoxTree)
checkBoxTree
- checkbox tree to process
public boolean isCheckBoxEnabled(E node)
node
- tree node to process
public void setCheckBoxEnabledStateProvider(StateProvider<E> provider)
provider
- enabled state providerpublic boolean isCheckBoxVisible(E node)
node
- tree node to process
public void setCheckBoxVisibleStateProvider(StateProvider<E> provider)
provider
- new visibility state providerpublic boolean isRecursiveCheckingEnabled()
public void setRecursiveChecking(boolean recursive)
recursive
- whether checked or unchecked node childs should be checked or unchecked recursively or notpublic boolean isCheckBoxVisible()
public void setCheckBoxVisible(boolean visible)
visible
- whether checkboxes are visible in the tree or notpublic boolean isCheckingEnabled()
public void setCheckingEnabled(boolean enabled)
enabled
- whether user can interact with checkboxes to change their check state or notpublic boolean isCheckMixedOnToggle()
public void setCheckMixedOnToggle(boolean checkMixedOnToggle)
checkMixedOnToggle
- whether partially checked node should be checked or unchecked on togglepublic java.awt.Rectangle getCheckBoxBounds(E node)
node
- tree node to process
public java.awt.Rectangle getCheckBoxBounds(javax.swing.tree.TreePath treePath)
treePath
- tree path to process
public boolean isCheckingByUserEnabled()
public void addCheckStateChangeListener(CheckStateChangeListener<E> listener)
listener
- check state change listener to addpublic void removeCheckStateChangeListener(CheckStateChangeListener listener)
listener
- check state change listener to removepublic void fireCheckStateChanged(java.util.List<CheckStateChange<E>> stateChanges)
stateChanges
- check state changes list
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |