|
|
Class: HierarchicalItem
Object
|
+--HierarchicalItem
|
+--AbstractVersionDiffBrowserItem
|
+--ClassNameItem
|
+--HierarchicalFileList::HierarchicalFileItem
|
+--HierarchicalItem::Example
|
+--HierarchicalItemWithLabel
|
+--VersionDiffBrowser::ClassChangeSet
- Package:
- stx:libwidg2
- Category:
- Views-Support
- Version:
- rev:
1.90
date: 2010/03/03 18:31:52
- user: cg
- file: HierarchicalItem.st directory: libwidg2
- module: stx stc-classLibrary: libwidg2
- Author:
- Claus Atzkern
Hierarchical Items are mostly like Models, but the list of
dependencies are kept by its HierarchicalList.
The class is used to build up hierarchical trees.
[Instance variables:]
parent <Item, List or nil> parent or my HierarchicalList.
children <Collection or nil> list of children
isExpanded <Boolean> indicates whether the item is
expanded or collapsed
HierarchicalList
HierarchicalListView
instance creation
-
new
-
-
parent: aParent
-
protocol
-
doResetExtentOnChange
-
true: the extent of the item is reset if a change
notification is raised from the item. the default is true
accessing
-
getChildren
-
returns the children at it is; not going to the model ...
-
level
-
returns the level starting with 1
-
parent
-
returns the parent or nil
-
parent: aParent
-
set the parent (or the model if the item is the root item)
-
rootItem
-
returns the root item
accessing-children
-
at: anIndex
-
return the child at anIndex if valid;
if the index is invalid, nil is returned
-
at: anIndex ifAbsent: exceptionBlock
-
return the child at anIndex if valid; if the index is
invalid, the result of evaluating the exceptionBlock is returned.
-
at: anIndex put: anItem
-
replace a child by a new item. return anItem (sigh)
-
children: aListOfChildren
-
set a new list of children
-
first
-
returns the first child
-
last
-
returns the last child
-
second
-
returns the second child
accessing-hierarchy
-
collapse
-
hide all my subitems
-
enforcedExpand
-
expand children - even if there are no children,
the item is initially expanded (but this might be undone later,
when we know that no children are there
-
expand
-
expand children - but only if there are children
(i.e. this cannot be used before the childInfo is valid;
aka not before the updateTask came along this item)
-
expand: enforced
-
expand children
-
makeVisible
-
expand all my parents
-
recursiveCollapse
-
collapse all item and sub items
**** must be expanded
-
recursiveExpand
-
expand children and sub-children
**** must be collapsed
-
recursiveToggleExpand
-
if the item is collapsed, the item and all its sub-items
are expanded otherwise collapsed
-
toggleExpand
-
if the item is collapsed, the item is expanded otherwise
collapsed
accessing-mvc
-
application
-
returns the responsible application or nil
-
applicationsDo: aOneArgBlock
-
evaluate the block for each dependent application
-
model
-
returns the hierachicalList model or nil
adding & removing
-
add: aChildItem
-
add a child at end
-
add: aChildItem after: aChild
-
add an item after an existing item
-
add: aChildItem afterIndex: anIndex
-
add an item after an index
-
add: aChildItem before: aChild
-
add an item before an existing item
-
add: aChildItem beforeIndex: anIndex
-
add an item before an index
-
add: aChild sortBlock: aBlock
-
add a child sorted
-
addAll: aList
-
add children at the end
-
addAll: aList before: aChild
-
add an item before an existing item
-
addAll: aList beforeIndex: anIndex
-
add children before an index
-
addAll: aList sortBlock: aBlock
-
add children sorted
-
addAllFirst: aCollectionOfItems
-
add children at the beginning
-
addAllLast: aCollectionOfItems
-
add children at the end
-
addFirst: aChildItem
-
add a child at the beginning
-
addLast: anItem
-
add a child at the end
-
remove
-
remove the item
-
remove: aChild
-
remove a child
-
removeAll
-
remove all children
-
removeAll: aList
-
remove all children in the collection
-
removeFromIndex: startIndex
-
remove the children from startIndex up to end of children
-
removeFromIndex: startIndex toIndex: stopIndex
-
remove the children from startIndex up to and including
the child under stopIndex.
-
removeIndex: anIndex
-
remove the child at an index
basic adding & removing
-
basicAdd: aChild sortBlock: aBlock
-
add a child sorted
-
basicAddAll: aList beforeIndex: anIndex
-
add children before an index
-
basicRemoveFromIndex: startIndex toIndex: stopIndex
-
remove the children from startIndex up to and including
the child under stopIndex.
change & update
-
changed: what with: anArgument
-
the item changed; raise change notification
#icon icon is modified; height and width are unchanged
#hierarchy collapsed/expanded; height and width are unchanged
#redraw redraw but height and width are unchanged
....... all others: the height and width are reset
-
childrenOrderChanged
-
called if the order of the children changed by a user
operation. Update the model and raise a change notification for
each item which has changed its position
triggered by the user operation !
-
fontChanged
-
called if the font has changed.
Clear the precomputed width and height
-
hierarchyChanged
-
hierarchy changed; optimize redrawing
-
iconChanged
-
icon changed; optimize redrawing
enumerating
-
collect: aBlock
-
for each child in the receiver, evaluate the argument, aBlock
and return a new collection with the results
-
contains: aBlock
-
return true if aBlock returns true for any of the receivers items
-
do: aOneArgBlock
-
evaluate a block for each child
-
from: startIndex do: aOneArgBlock
-
evaluate a block on each child starting with the
child at startIndex to the end.
-
from: startIndex reverseDo: aOneArgBlock
-
evaluate a block on each child starting at end to the startIndex
-
from: startIndex to: endIndex do: aOneArgBlock
-
evaluate a block on each child starting with the
child at startIndex to the endIndex.
-
from: startIndex to: endIndex reverseDo: aOneArgBlock
-
evaluate a block on each child starting with the
child at endIndex to the startIndex.
-
keysAndValuesDo: aTwoArgBlock
-
evaluate the argument, aBlock for every child,
passing both index and element as arguments.
-
keysAndValuesReverseDo: aTwoArgBlock
-
evaluate the argument, aBlock in reverse order for every
child, passing both index and element as arguments.
-
recursiveCollect: aBlock
-
for each child in the receiver, evaluate the argument, aBlock
and return a new collection with the results
-
recursiveDo: aOneArgBlock
-
evaluate a block on each item and all the sub-items
-
recursiveReverseDo: aOneArgBlock
-
evaluate a block on each item and all the sub-items;
proccesing children in reverse direction
-
recursiveSelect: aBlock
-
return a new collection with all children and subChildren from the receiver, for which
the argument aBlock evaluates to true.
-
reverseDo: aOneArgBlock
-
evaluate a block on each child in reverse direction
-
select: aBlock
-
return a new collection with all items from the receiver, for which
the argument aBlock evaluates to true.
-
withAllDo: aOneArgBlock
-
evaluate the block on each item and subitem including self
enumerating parents
-
parentsDetect: aBlock
-
find the first parent, for which evaluation of the block returns
true; if none does so, report an error
-
parentsDetect: aBlock ifNone: anExceptionBlock
-
find the first parent, for which evaluation of the block returns
true; if none does so, return the evaluation of anExceptionBlock
-
parentsDo: aBlock
-
evaluate a block on each parent
initialization
-
initialize
-
private
-
addVisibleChildrenTo: aList
-
add all visible children and sub-children to the list
-
clearExpandedWhenLastChildWasRemoved
-
-
criticalDo: aBlock
-
-
listIndex
-
returns the visible index or nil; for a none visible root
0 is returned
-
numberOfVisibleChildren
-
returns number of all visible children including subchildren
-
parentOrModel
-
returns the parent without checking for item or model
-
setExpanded: aBoolean
-
set expanded flag without any computation or notification
private-displaying
-
displayLabel: aLabel h: lH on: aGC x: x y: y h: h
-
display the label at x@y
-
heightOf: aLabel on: aGC
-
returns the height of the label or 0
-
widthOf: aLabel on: aGC
-
returns the height of the label or 0
private-enumerating
-
nonCriticalDo: aOneArgBlock
-
evaluate a block noncritical on each child.
-
nonCriticalFrom: startIndex to: endIndex do: aOneArgBlock
-
evaluate a block noncritical on each child starting with the
child at startIndex to the endIndex (if nil to end of list).
-
nonCriticalFrom: startIndex to: endIndex reverseDo: aOneArgBlock
-
evaluate a block non critical on each child starting with the
child at endIndex (if nil to end of list) to startIndex.
-
nonCriticalKeysAndValuesReverseDo: aOneArgBlock
-
evaluate the argument, aBlock in reverse order for every
child, passing both index and element as arguments.
-
nonCriticalRecursiveDo: anOneArgBlock
-
evaluate the block non critical on each item and all the sub-items
-
nonCriticalRecursiveReverseDo: anOneArgBlock
-
evaluate the block non critical on each item and all the sub-items;
proccesing children in reverse direction
-
nonCriticalRecursiveSort: aSortBlock
-
evaluate a block noncritical on each child.
private-hierarchy
-
recursiveSetCollapsed
-
collapse all children and sub-children without notifications
-
recursiveSetCollapsedHelper
-
private helper.
collapse all children and sub-children without notifications.
Helper only - does not lock
-
recursiveSetExpandedAndAddToList: aList
-
expand all children and sub-children without notifications;
add children to list
-
recursiveSetExpandedAndAddToListHelper: aList
-
private helper.
expand all children and sub-children without notifications; adds children to aList
Helper only - does not lock
protocol-accessing
-
children
-
returns a list of children
*** to optimize: redefine by subClass
-
icon
-
returns the icon or nil;
*** to optimize:redefine by subClass
-
label
-
returns the label displayed on aGC;
*** to optimize:redefine by subClass
-
middleButtonMenu
-
returns the items middleButtonMenu or nil if no menu is defined.
If nil is returned, the view is asked for a menu.
-
recursiveSortChildren: aSortBlock
-
-
sortChildren: aSortBlock
-
sort the children inplace using the 2-arg block sortBlock for comparison
** This is an obsolete interface - do not use it (it may vanish in future versions) **
protocol-displaying
-
displayIcon: anIcon atX: x y: y on: aGC
-
called to draw the icon - canbe redefined to manupulate the icon
-
displayOn: aGC x: x y: y h: h
-
draw the receiver in the graphicsContext, aGC.
-
heightOn: aGC
-
return the width of the receiver, if it is to be displayed on aGC
-
widthOn: aGC
-
return the width of the receiver, if it is to be displayed on aGC
protocol-event processing
-
processButtonPress: button x: x y: y
-
a mouse button was pressed in my label.
Return true, if the event is eaten (ignored by the gc).
On default false is returned (should be handled by the gc).
-
processButtonPress: button x: x y: y on: aGC
-
a mouse button was pressed in my label.
Return true, if the event is eaten (ignored by the gc).
On default false is returned (should be handled by the gc).
-
processButtonPressOnIcon: button on: aGC
-
a mouse button was pressed in my icon.
Return true, if the event is eaten (ignored by the gc).
On default false is returned (should be handled by the gc).
protocol-monitoring
-
monitoringCycle
-
called all 'n' seconds by the model, if the monitoring
cycle is enabled. The item can perform some checks, ..
**** can be redefined by subclass to perform some actions
protocol-queries
-
canCollapse
-
called before collapsing the item; can be redefined
by subclass to omit the collapse operation
-
canExpand
-
called before expanding the item; can be redefined
by subclass to omit the expand operation
-
canRecursiveCollapse
-
called before collapsing the item; can be redefined
by subclass to omit the collapse operation
-
canRecursiveExpand
-
called before expanding the item; can be redefined
by subclass to omit the collapse operation
-
drawHorizontalLineUpToText
-
draw the horizizontal line for the selected item up to the text
or on default to the start of the the vertical line; only used by
the hierarchical view
-
hasChildren
-
checks whether the item has children;
the list needs not to be loaded yet( example. FileDirectory ).
*** to optimize: redefine in subClass
-
hasIndicator
-
on default the indicator is drawn if the item
has children
-
isSelectable
-
returns true if the item is selectable otherwise false
-
string
-
access the printable string used for steping through a list
searching for an entry starting with a character.
*** to optimize:redefine by subClass
queries
-
isChildOf: anItem
-
returns true if the item is a child of anItem
-
isCollapsed
-
returns true if the item is collapsed
-
isDirectoryItem
-
-
isExpanded
-
returns true if the item is expanded
-
isHierarchicalItem
-
used to decide if the parent is a hierarchical item
or the model
-
isRealChildOf: anItem
-
returns true if the item is a child of anItem
-
isRootItem
-
returns true if the item is the root item
-
size
-
return the number of children
searching
-
detect: aOneArgBlock
-
find the first child, for which evaluation of the block returns
true; if none does so, report an error
-
detect: aOneArgBlock ifNone: exceptionBlock
-
find the first child, for which evaluation of the block returns
true; if none does so, return the evaluation of anExceptionBlock
-
detectLast: aOneArgBlock
-
find the last child, for which evaluation of the block returns
true; if none does so, an exception is raised
-
detectLast: anOneArgBlock ifNone: anExceptionBlock
-
find the last child, for which evaluation of the block returns
true; if none does so, return the evaluation of anExceptionBlock
-
findFirst: aOneArgBlock
-
find the first child, for which evaluation of the argument, aOneArgBlock
returns true; return its index or 0 if none detected.
-
findLast: anOneArgBlock
-
find the last child, for which evaluation of the argument, aOneArgBlock
returns true; return its index or 0 if none detected.
-
identityIndexOf: aChild
-
return the index of aChild or 0 if not found. Compare using ==
-
identityIndexOf: aChild startingAt: startIndex
-
return the index of aChild, starting search at startIndex.
Compare using ==; return 0 if not found
-
recursiveDetect: aOneArgBlock
-
recursive find the first child, for which evaluation
of the block returns true; if none nil is returned
-
recursiveDetectLast: aBlock
-
find the last child, for which evaluation of the block returns
true; if none does so, nil id returned
-
withAllDetect: aOneArgBlock
-
recursive find the first item including self, for which evaluation
of the block returns true; if none nil is returned
sorting & reordering
-
recursiveSort: aSortBlock
-
recursive sort the children inplace using the 2-arg block sortBlock for comparison
-
sort: aSortBlock
-
sort the children inplace using the 2-arg block sortBlock for comparison
Example
|