eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'TreeItem':

Home

everywhere
www.exept.de
for:
[back]

Class: TreeItem


Inheritance:

   Object
   |
   +--TreeItem
      |
      +--FileSelectionItem
      |
      +--TreeItemWithImage

Package:
stx:libwidg2
Category:
Interface-Support
Version:
rev: 1.49 date: 2009/05/20 06:38:48
user: cg
file: TreeItem.st directory: libwidg2
module: stx stc-classLibrary: libwidg2
Author:
W. Olberding
Claus Atzkern

Description:


class to build up tree-like structures to represent file-trees, class tress etc.

Especially suited for use with SelectionInTree and SelectionInTreeView.

NOTICE: 
    this class has been obsoleted by HierarchicalItem with its corresponding
    view class HierarchicalListView. Please use these new ones.


Related information:

    SelectionInTree
    SelectionInTreeView

Class protocol:

class initialization
o  initialize

default icons
o  keysAndIcons
returns an IdentityDictionary containing a list of images and keys used
by any file entry; could be redefined by subclass

example-instance creation
o  newAsTreeFromSmalltalkClass: aClass
create a tree of nodes with aClass and all its
subclasses as contents. Set the initial level as given.

instance creation
o  contents: aContents

o  name: aName

o  name: aName contents: aContents

o  name: aName value: aContents

o  new


Instance protocol:

accessing
o  contents
get the contents;
usually, the contents is computed lazily i.e. #retrieveContents
is invoked when the contents has not yet been set.

o  contents: something
set contents

o  editor
returns an editor on the editable value or nil

o  hide

o  hide: aBoolean
set hide flag

o  icon
get the icon

o  level
get level

o  middleButtonMenu
returns the middleButtonMenu of the item or nil

o  name
get name

o  name: aString

o  parent
get parent

o  parent: something
set parent

o  value
get contents

o  value: something
set contents

accessing-children
o  basicLastChild
returns the last child without checking for valid sequence

o  children
get list of children

o  children: aCollection
set children

o  firstChild
returns first child in sequence

o  lastChild
returns the last child in sequence

o  readChildren: aBoolean
set read children flag

accessing-dimensions
o  childrenWidthOn: aDevice
returns the maximum name length of my children

accessing-hierarchy
o  collapse
hide all my children

o  collapseAll
hide all my children and sub children

o  expand
show all my children

o  expandAll
show all my children and sub children

accessing-mvc
o  model
get my model (an instance of selection in tree) or nil

o  model: aSelectionInTree
set my model (an instance of selection in tree) or nil

o  tree
get my model (an instance of selection in tree) or nil

o  tree: aSelectionInTree
set my model (an instance of selection in tree) or nil

adding & removing
o  add: something
add a child or collection of children add end

o  add: something after: aChild
add a child or collection of children add end

o  add: something afterIndex: anIndex
add a child or collection after an index

o  add: something before: aChild
add a child or collection of children add end

o  add: something beforeIndex: anIndex
add a child or collection before an index

o  addFirst: something
add a child at the beginning

o  remove: something
remove a child or collection of children

o  removeAll
remove all children

o  removeChild: aChild
remove a aChild

o  removeIndex: anIndex
remove child at index

change & update
o  changed
node changed; raise notification to model

o  changed: what
node changed; raise notification to model

o  changedSelected
called if the node is selected

o  update: something with: aParameter from: anItem
raise change notification to my model

converting
o  fromLiteralArrayEncoding: aLiteralEncodedArray
read my contents from a aLiteralEncodedArray.

o  literalArrayEncoding
return myself encoded as a literal array

copying
o  copy

enumerating
o  allChildrenDo: aOneArgBlock
evaluate a block on each children and subchildren

o  allWithParentAndChildrenDo: aTwoArgBlock

o  childrenDo: aOneArgBlock
evaluate a block on each children( excluding sub-children )

o  detectParent: aBlock
evaluate aBlock for my parent-chain; return the parent for which it returns true

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

initialization & release
o  initialize
setup defaults

printing & storing
o  asString
sometimes used by the SelectionInListView to get the name

o  displayString

o  printOn: aStream
sometimes used by the SelectionInListView to get the name

o  printString
sometimes used by the SelectionInListView to get the name

o  printableEditValue
returns the printable edit value or nil

queries
o  canEdit
returns true if field is editable

o  hasChildren
returns true if any child exists

o  hasChildrenWithSubChildren
returns true if any child exists and has children too

o  hasExpandedChildren
returns true if any of my children is expanded

o  hidden
returns true if node is not visible

o  isCollapsable
is collabsable; children existing and shown

o  isContainedByParent: aParent
returns true if contained in subtree of a parent

o  isExpandable
is expandable; children existing and hidden

o  isExpanded
return true if I am expanded

o  numberOfChildren
returns number of children

o  showIndicator
returns true if children exists

o  shown
returns true if node is visible

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

o  numberOfAllVisibleChildren
returns number of all visible children including all the children of children

retrieving
o  childrenAction
get children action block

o  contentsAction
get contents action block

o  iconAction
get icon action block

o  labelAction
get label action block

o  retrieveAll
retrieve all values from model

o  retrieveAndEvaluate: aBlockSymbol
retrieve a specific value from model; if no model exists, nil is returned

o  retrieveChildren
retrieve children from model

o  retrieveContents
retrieve contents value from model;

o  retrieveLabel
retrieve label from model

searching
o  childAt: anIndex
get child at an index or nil

o  detectChild: aOneArgBlock
evaluate the block on each child;
returns the child's node or nil.
This searches my children only - not walking down sublevels.

o  detectChild: aTwoArgBlock arguments: args
detect a child 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 node-level ...
I.e. for each sublevel, a different block arg can be specified.
The number of arguments also defines the search level.
i.e. if you pass (1 to:10) as args, the block will get the sub-level
as second argument and stop the search after 10 levels.

o  detectFirstChild: anOneArgBlock
detect the first child which evaluation of anOneArgBlock returns true.
Recursively walks down the node-tree.

o  indexOfChild: aChild
get index of a child or 0

searching-private
o  detectChild: aTwoArgBlock arguments: args index: idxArgs
helper for limited search.
detect a child 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 an index.
This one recursively walks down the tree searching for a node.



ST/X 6.1.1; WebServer 1.620 at exept:8081; Thu, 24 May 2012 04:38:09 GMT