|
Class: SelectionInTree
Object
|
+--Model
|
+--SelectionInTree
- Package:
- stx:libwidg2
- Category:
- Interface-Support-Models
- Version:
- rev:
1.46
date: 2023/07/15 18:31:51
- user: cg
- file: SelectionInTree.st directory: libwidg2
- module: stx stc-classLibrary: libwidg2
list and selection holder for hierarchical list structures.
Used to buildup file-trees, class trees etc.
Especially suited for use with SelectionInTreeView.
Notice: this class replaces SelectionInHierarchy,
which provides similar (but less sophisticated) functionality.
copyrightCOPYRIGHT (c) 1997 by eXept Software AG / Claus Gittinger
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
defaults
-
defaultItemClass
-
returns the default item class or nil (the default)
instance creation
-
new
-
(comment from inherited method)
return an instance of myself without indexed variables
accessing
-
list
-
get the list of currently shown objects
-
root
-
get the root node
-
root: aRoot
-
set a new root
-
value
-
accessing hierarchy new
-
doMakeVisible: itemOrCollectionOfItems
-
make an item or collection of items visible
accessing-behavior
-
childrenAction
-
get the children action block.
This is called by tree items to retrieve the children of a node
-
childrenAction: aBlock
-
set the children action block
This is called by tree items to retrieve the children of a node
-
contentsAction
-
get contents action block
This is called by tree items to retrieve the contents of a node
-
contentsAction: aBlock
-
set contents action block
This is called by tree items to retrieve the contents of a node
-
iconAction
-
get icon action block
This is called by tree items to retrieve the icon of a node
-
iconAction: aBlock
-
set icon action block
This is called by tree items to retrieve the icon of a node
-
labelAction
-
get label action block
This is called by tree items to retrieve the label of a node
-
labelAction: aBlock
-
set label action block
This is called by tree items to retrieve the label of a node
-
showRoot
-
return true if the root is shown.
controls if the list is shown with or without root.
Notice that technically, there is always one single root item;
however, its visibility can be suppressed to make the tree look like a list
on the top level
-
showRoot: aBoolean
-
controls if the list is shown with or without root.
Notice that technically, there is always one single root item;
however, its visibility can be suppressed to make the tree look like a list
on the top level
accessing-hierarchy
-
collapse: something
-
collapse a node or collection of nodes
-
expand
-
expand the root
-
expand: something
-
expand a node or collection of nodes
accessing-hierarchy new
-
doCollapse: something
-
collapse all children under an item or a sequence of items;
if the list changed, a change notifications are sent
-
doCollapseAll: something
-
collapse all children and subChildren under an item or sequence of items;
if the list changed, a change notifications are sent
-
doExpand: something
-
expand all children under an item or collection of items;
if the list changed, a change notifications are sent
-
doExpandAll: something
-
expand all children and subChildren under an item or sequence of items;
if the list changed, change notifications are sent
adding & removing
-
add: something after: aChild
-
add a node or collection of nodes to the parent of aChild
after that child in the sublist
-
add: something afterIndex: anIndex below: aParent
-
add a node or collection of nodes to parent after an index
-
add: something before: aChild
-
add a node or collection of nodes to before a child
-
add: something beforeIndex: anIndex below: aParent
-
add a node or collection of nodes to aParents children
before anIndex (which is a child-index)
-
add: something below: aParent
-
add a node or collection of nodes to parent
-
remove: something
-
remove a node or collection of nodes.
Change notifications are sent
-
removeAllOtherThanRoot
-
remove all children from the root
Change notifications are sent
-
removeIndex: something
-
remove a node at index or collection of indexed nodes.
Change notifications are sent
-
removeSelection
-
remove selected nodes.
Change notifications are sent
-
replaceNode: aNode with: aNewNode
-
replace a node by a new node; if the new node is nil, the node and its
children are removed.
Otherwise the children are taken over to the new node.
change & update
-
invalidate
-
called whenever something changed that requires a redraw but no recomputation.
For example a name or icon
-
update: something with: aParameter from: aModel
-
(comment from inherited method)
dependent is notified of some change -
Default is to try update:with:
enumerating
-
each: itemOrCollectionOfItems do: aOneArgBlock
-
evaluate a block for something or in case of a collection for each
element in the collection
initialization
-
initialize
-
(comment from inherited method)
just to ignore initialize to objects which do not need it
private
-
recomputeList
-
Travers the tree and build a new list.
private-hierarchy
-
collapseItem: anItem do: collapseBlock
-
collapse all children under an item;
send a change notification if the list changed
-
expandItem: anItem do: expandBlock
-
expand all children under an item;
send out change a notification if the list changed
-
listFromRoot
-
Traverse the tree and build a new list;
no change notification are sent
queries
-
indexOf: anItem
-
returns the index of an item or 0
searching
-
detectFirstItem: aOneArgBlock
-
detect an item the evaluation of the block returns true.
The argument to the block is the item.
This recursively enumerates the tree for the first item for which
the block returns true.
-
detectItem: aOneArgBlock
-
detect an item the evaluation of the block returns true.
The argument to the block is the item.
This searches top-level items only.
-
detectItem: aTwoArgBlock arguments: aListOfArgs
-
detect an item the evaluation of the block returns true.
The first argument to the block is the item, the second argument
the value derived from the argument list at level.
This recursively walks down the tree up to aListOfArgs size levels;
i.e. if you pass (1 to:10) as aListOfArgs, the block will get the sub-level
as second argument and stop the search after 10 levels.
selection
-
selectNode: aNode
-
select a given node (by identity - not by index).
Notice, that the node must be visible - i.e. its parent chain must be
currently expanded.
-
selectNodes: aCollectionOfNodes
-
select a given set of nodes (by identity - not by index)
-
selectedNode
-
returns the first selected node or nil
-
selectedNodes
-
returns a collection of selected nodes or nil
-
selectedNodesDo: aOneArgBlock
-
evaluate the block on each node selected
-
selection
-
get the selection index or nil
-
selection: indexesOrNil
-
set the selection index
-
selectionIndex
-
get the selection index or nil
-
selectionIndex: indexesOrNil
-
set the selection index (or nil to deselect)
-
setSelection: indexesOrNil
-
set the selection index without sending out change notifications
-
setSelectionIndex: indexesOrNil
-
set the selection index without sending out change notifications
update indication task
-
startIndicatorValidationFor: aNode
-
add a node to the list of nodes which are automatically
monitored for changes in their children list (by a background task),
and which will then update their 'has-children' arrow indicator icon.
This is typically used to check for changed folders in file trees,
data in databases etc.
-
stopIndicatorValidationFor: aNodeOrList
-
remove a node or list of nodes from the list of automatically monitored nodes.
-
stopRunningTasks
-
stop the running update task
-
taskCycle
-
run one cycle fetching indicator state.
This is done in the background to avoid long startup
delays, in case the indicator information takes long to
gather (i.e. when reading network directories)
|