eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'SelectionInTree':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: SelectionInTree


Inheritance:

   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

Description:


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.

copyright

COPYRIGHT (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.

Class protocol:

defaults
o  defaultItemClass
returns the default item class or nil (the default)

instance creation
o  new
(comment from inherited method)
return an instance of myself without indexed variables


Instance protocol:

accessing
o  list
get the list of currently shown objects

o  root
get the root node

o  root: aRoot
set a new root

o  value

accessing hierarchy new
o  doMakeVisible: itemOrCollectionOfItems
make an item or collection of items visible

accessing-behavior
o  childrenAction
get the children action block.
This is called by tree items to retrieve the children of a node

o  childrenAction: aBlock
set the children action block
This is called by tree items to retrieve the children of a node

o  contentsAction
get contents action block
This is called by tree items to retrieve the contents of a node

o  contentsAction: aBlock
set contents action block
This is called by tree items to retrieve the contents of a node

o  iconAction
get icon action block
This is called by tree items to retrieve the icon of a node

o  iconAction: aBlock
set icon action block
This is called by tree items to retrieve the icon of a node

o  labelAction
get label action block
This is called by tree items to retrieve the label of a node

o  labelAction: aBlock
set label action block
This is called by tree items to retrieve the label of a node

o  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

o  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
o  collapse: something
collapse a node or collection of nodes

o  expand
expand the root

o  expand: something
expand a node or collection of nodes

accessing-hierarchy new
o  doCollapse: something
collapse all children under an item or a sequence of items;
if the list changed, a change notifications are sent

o  doCollapseAll: something
collapse all children and subChildren under an item or sequence of items;
if the list changed, a change notifications are sent

o  doExpand: something
expand all children under an item or collection of items;
if the list changed, a change notifications are sent

o  doExpandAll: something
expand all children and subChildren under an item or sequence of items;
if the list changed, change notifications are sent

adding & removing
o  add: something after: aChild
add a node or collection of nodes to the parent of aChild
after that child in the sublist

o  add: something afterIndex: anIndex below: aParent
add a node or collection of nodes to parent after an index

o  add: something before: aChild
add a node or collection of nodes to before a child

o  add: something beforeIndex: anIndex below: aParent
add a node or collection of nodes to aParents children
before anIndex (which is a child-index)

o  add: something below: aParent
add a node or collection of nodes to parent

o  remove: something
remove a node or collection of nodes.
Change notifications are sent

o  removeAllOtherThanRoot
remove all children from the root
Change notifications are sent

o  removeIndex: something
remove a node at index or collection of indexed nodes.
Change notifications are sent

o  removeSelection
remove selected nodes.
Change notifications are sent

o  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
o  invalidate
called whenever something changed that requires a redraw but no recomputation.
For example a name or icon

o  update: something with: aParameter from: aModel
(comment from inherited method)
dependent is notified of some change -
Default is to try update:with:

enumerating
o  each: itemOrCollectionOfItems do: aOneArgBlock
evaluate a block for something or in case of a collection for each
element in the collection

initialization
o  initialize
(comment from inherited method)
just to ignore initialize to objects which do not need it

private
o  recomputeList
Travers the tree and build a new list.

private-hierarchy
o  collapseItem: anItem do: collapseBlock
collapse all children under an item;
send a change notification if the list changed

o  expandItem: anItem do: expandBlock
expand all children under an item;
send out change a notification if the list changed

o  listFromRoot
Traverse the tree and build a new list;
no change notification are sent

queries
o  indexOf: anItem
returns the index of an item or 0

searching
o  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.

o  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.

o  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
o  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.

o  selectNodes: aCollectionOfNodes
select a given set of nodes (by identity - not by index)

o  selectedNode
returns the first selected node or nil

o  selectedNodes
returns a collection of selected nodes or nil

o  selectedNodesDo: aOneArgBlock
evaluate the block on each node selected

o  selection
get the selection index or nil

o  selection: indexesOrNil
set the selection index

o  selectionIndex
get the selection index or nil

o  selectionIndex: indexesOrNil
set the selection index (or nil to deselect)

o  setSelection: indexesOrNil
set the selection index without sending out change notifications

o  setSelectionIndex: indexesOrNil
set the selection index without sending out change notifications

update indication task
o  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.

o  stopIndicatorValidationFor: aNodeOrList
remove a node or list of nodes from the list of automatically monitored nodes.

o  stopRunningTasks
stop the running update task

o  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)



ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Sat, 14 Dec 2024 19:29:27 GMT