eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'HierarchicalItem':

Home

everywhere
www.exept.de
for:
[back]

Class: HierarchicalItem


Inheritance:

   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

Description:


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


Related information:

    HierarchicalList
    HierarchicalListView

Class protocol:

instance creation
o  new

o  parent: aParent

protocol
o  doResetExtentOnChange
true: the extent of the item is reset if a change
notification is raised from the item. the default is true


Instance protocol:

accessing
o  getChildren
returns the children at it is; not going to the model ...

o  level
returns the level starting with 1

o  parent
returns the parent or nil

o  parent: aParent
set the parent (or the model if the item is the root item)

o  rootItem
returns the root item

accessing-children
o  at: anIndex
return the child at anIndex if valid;
if the index is invalid, nil is returned

o  at: anIndex ifAbsent: exceptionBlock
return the child at anIndex if valid; if the index is
invalid, the result of evaluating the exceptionBlock is returned.

o  at: anIndex put: anItem
replace a child by a new item. return anItem (sigh)

o  children: aListOfChildren
set a new list of children

o  first
returns the first child

o  last
returns the last child

o  second
returns the second child

accessing-hierarchy
o  collapse
hide all my subitems

o  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

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

o  expand: enforced
expand children

o  makeVisible
expand all my parents

o  recursiveCollapse
collapse all item and sub items
**** must be expanded

o  recursiveExpand
expand children and sub-children
**** must be collapsed

o  recursiveToggleExpand
if the item is collapsed, the item and all its sub-items
are expanded otherwise collapsed

o  toggleExpand
if the item is collapsed, the item is expanded otherwise
collapsed

accessing-mvc
o  application
returns the responsible application or nil

o  applicationsDo: aOneArgBlock
evaluate the block for each dependent application

o  model
returns the hierachicalList model or nil

adding & removing
o  add: aChildItem
add a child at end

o  add: aChildItem after: aChild
add an item after an existing item

o  add: aChildItem afterIndex: anIndex
add an item after an index

o  add: aChildItem before: aChild
add an item before an existing item

o  add: aChildItem beforeIndex: anIndex
add an item before an index

o  add: aChild sortBlock: aBlock
add a child sorted

o  addAll: aList
add children at the end

o  addAll: aList before: aChild
add an item before an existing item

o  addAll: aList beforeIndex: anIndex
add children before an index

o  addAll: aList sortBlock: aBlock
add children sorted

o  addAllFirst: aCollectionOfItems
add children at the beginning

o  addAllLast: aCollectionOfItems
add children at the end

o  addFirst: aChildItem
add a child at the beginning

o  addLast: anItem
add a child at the end

o  remove
remove the item

o  remove: aChild
remove a child

o  removeAll
remove all children

o  removeAll: aList
remove all children in the collection

o  removeFromIndex: startIndex
remove the children from startIndex up to end of children

o  removeFromIndex: startIndex toIndex: stopIndex
remove the children from startIndex up to and including
the child under stopIndex.

o  removeIndex: anIndex
remove the child at an index

basic adding & removing
o  basicAdd: aChild sortBlock: aBlock
add a child sorted

o  basicAddAll: aList beforeIndex: anIndex
add children before an index

o  basicRemoveFromIndex: startIndex toIndex: stopIndex
remove the children from startIndex up to and including
the child under stopIndex.

change & update
o  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

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

o  fontChanged
called if the font has changed.
Clear the precomputed width and height

o  hierarchyChanged
hierarchy changed; optimize redrawing

o  iconChanged
icon changed; optimize redrawing

enumerating
o  collect: aBlock
for each child in the receiver, evaluate the argument, aBlock
and return a new collection with the results

o  contains: aBlock
return true if aBlock returns true for any of the receivers items

o  do: aOneArgBlock
evaluate a block for each child

o  from: startIndex do: aOneArgBlock
evaluate a block on each child starting with the
child at startIndex to the end.

o  from: startIndex reverseDo: aOneArgBlock
evaluate a block on each child starting at end to the startIndex

o  from: startIndex to: endIndex do: aOneArgBlock
evaluate a block on each child starting with the
child at startIndex to the endIndex.

o  from: startIndex to: endIndex reverseDo: aOneArgBlock
evaluate a block on each child starting with the
child at endIndex to the startIndex.

o  keysAndValuesDo: aTwoArgBlock
evaluate the argument, aBlock for every child,
passing both index and element as arguments.

o  keysAndValuesReverseDo: aTwoArgBlock
evaluate the argument, aBlock in reverse order for every
child, passing both index and element as arguments.

o  recursiveCollect: aBlock
for each child in the receiver, evaluate the argument, aBlock
and return a new collection with the results

o  recursiveDo: aOneArgBlock
evaluate a block on each item and all the sub-items

o  recursiveReverseDo: aOneArgBlock
evaluate a block on each item and all the sub-items;
proccesing children in reverse direction

o  recursiveSelect: aBlock
return a new collection with all children and subChildren from the receiver, for which
the argument aBlock evaluates to true.

o  reverseDo: aOneArgBlock
evaluate a block on each child in reverse direction

o  select: aBlock
return a new collection with all items from the receiver, for which
the argument aBlock evaluates to true.

o  withAllDo: aOneArgBlock
evaluate the block on each item and subitem including self

enumerating parents
o  parentsDetect: aBlock
find the first parent, for which evaluation of the block returns
true; if none does so, report an error

o  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

o  parentsDo: aBlock
evaluate a block on each parent

initialization
o  initialize

private
o  addVisibleChildrenTo: aList
add all visible children and sub-children to the list

o  clearExpandedWhenLastChildWasRemoved

o  criticalDo: aBlock

o  listIndex
returns the visible index or nil; for a none visible root
0 is returned

o  numberOfVisibleChildren
returns number of all visible children including subchildren

o  parentOrModel
returns the parent without checking for item or model

o  setExpanded: aBoolean
set expanded flag without any computation or notification

private-displaying
o  displayLabel: aLabel h: lH on: aGC x: x y: y h: h
display the label at x@y

o  heightOf: aLabel on: aGC
returns the height of the label or 0

o  widthOf: aLabel on: aGC
returns the height of the label or 0

private-enumerating
o  nonCriticalDo: aOneArgBlock
evaluate a block noncritical on each child.

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

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

o  nonCriticalKeysAndValuesReverseDo: aOneArgBlock
evaluate the argument, aBlock in reverse order for every
child, passing both index and element as arguments.

o  nonCriticalRecursiveDo: anOneArgBlock
evaluate the block non critical on each item and all the sub-items

o  nonCriticalRecursiveReverseDo: anOneArgBlock
evaluate the block non critical on each item and all the sub-items;
proccesing children in reverse direction

o  nonCriticalRecursiveSort: aSortBlock
evaluate a block noncritical on each child.

private-hierarchy
o  recursiveSetCollapsed
collapse all children and sub-children without notifications

o  recursiveSetCollapsedHelper
private helper.
collapse all children and sub-children without notifications.
Helper only - does not lock

o  recursiveSetExpandedAndAddToList: aList
expand all children and sub-children without notifications;
add children to list

o  recursiveSetExpandedAndAddToListHelper: aList
private helper.
expand all children and sub-children without notifications; adds children to aList
Helper only - does not lock

protocol-accessing
o  children
returns a list of children
*** to optimize: redefine by subClass

o  icon
returns the icon or nil;
*** to optimize:redefine by subClass

o  label
returns the label displayed on aGC;
*** to optimize:redefine by subClass

o  middleButtonMenu
returns the items middleButtonMenu or nil if no menu is defined.
If nil is returned, the view is asked for a menu.

o  recursiveSortChildren: aSortBlock

o  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
o  displayIcon: anIcon atX: x y: y on: aGC
called to draw the icon - canbe redefined to manupulate the icon

o  displayOn: aGC x: x y: y h: h
draw the receiver in the graphicsContext, aGC.

o  heightOn: aGC
return the width of the receiver, if it is to be displayed on aGC

o  widthOn: aGC
return the width of the receiver, if it is to be displayed on aGC

protocol-event processing
o  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).

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

o  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
o  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
o  canCollapse
called before collapsing the item; can be redefined
by subclass to omit the collapse operation

o  canExpand
called before expanding the item; can be redefined
by subclass to omit the expand operation

o  canRecursiveCollapse
called before collapsing the item; can be redefined
by subclass to omit the collapse operation

o  canRecursiveExpand
called before expanding the item; can be redefined
by subclass to omit the collapse operation

o  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

o  hasChildren
checks whether the item has children;
the list needs not to be loaded yet( example. FileDirectory ).
*** to optimize: redefine in subClass

o  hasIndicator
on default the indicator is drawn if the item
has children

o  isSelectable
returns true if the item is selectable otherwise false

o  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
o  isChildOf: anItem
returns true if the item is a child of anItem

o  isCollapsed
returns true if the item is collapsed

o  isDirectoryItem

o  isExpanded
returns true if the item is expanded

o  isHierarchicalItem
used to decide if the parent is a hierarchical item
or the model

o  isRealChildOf: anItem
returns true if the item is a child of anItem

o  isRootItem
returns true if the item is the root item

o  size
return the number of children

searching
o  detect: aOneArgBlock
find the first child, for which evaluation of the block returns
true; if none does so, report an error

o  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

o  detectLast: aOneArgBlock
find the last child, for which evaluation of the block returns
true; if none does so, an exception is raised

o  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

o  findFirst: aOneArgBlock
find the first child, for which evaluation of the argument, aOneArgBlock
returns true; return its index or 0 if none detected.

o  findLast: anOneArgBlock
find the last child, for which evaluation of the argument, aOneArgBlock
returns true; return its index or 0 if none detected.

o  identityIndexOf: aChild
return the index of aChild or 0 if not found. Compare using ==

o  identityIndexOf: aChild startingAt: startIndex
return the index of aChild, starting search at startIndex.
Compare using ==; return 0 if not found

o  recursiveDetect: aOneArgBlock
recursive find the first child, for which evaluation
of the block returns true; if none nil is returned

o  recursiveDetectLast: aBlock
find the last child, for which evaluation of the block returns
true; if none does so, nil id returned

o  withAllDetect: aOneArgBlock
recursive find the first item including self, for which evaluation
of the block returns true; if none nil is returned

sorting & reordering
o  recursiveSort: aSortBlock
recursive sort the children inplace using the 2-arg block sortBlock for comparison

o  sort: aSortBlock
sort the children inplace using the 2-arg block sortBlock for comparison


Private classes:

    Example


ST/X 6.1.1; WebServer 1.620 at exept:8081; Wed, 23 May 2012 19:16:23 GMT