SelectionInHierarchyView.st
author Claus Gittinger <cg@exept.de>
Sun, 07 Mar 1999 14:30:12 +0100
changeset 1233 ba2244433fd4
parent 443 fdff91162cac
child 1431 0cc20a8f2f7c
permissions -rw-r--r--
category change
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
254
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
     1
"
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
     2
 COPYRIGHT (c) 1994 by AEG Industry Automation
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
     3
 COPYRIGHT (c) 1994 by Claus Gittinger
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
     4
	      All Rights Reserved
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
     5
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
     6
 This software is furnished under a license and may be used
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
     7
 only in accordance with the terms of that license and with the
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
     8
 inclusion of the above copyright notice.   This software may not
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
     9
 be provided or otherwise made available to, or used by, any
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    10
 other person.  No title to or ownership of the software is
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    11
 hereby transferred.
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    12
"
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    13
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
SelectionInListView subclass:#SelectionInHierarchyView
361
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
    15
	instanceVariableNames:'itemList showConnectingLines itemClass indent itemPrintConverter'
252
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    16
	classVariableNames:''
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    17
	poolDictionaries:''
1233
ba2244433fd4 category change
Claus Gittinger <cg@exept.de>
parents: 443
diff changeset
    18
	category:'Views-Trees'
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
!
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
259
f930922963ce commentary - mhmh
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    21
!SelectionInHierarchyView class methodsFor:'documentation'!
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
254
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    23
copyright 
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    24
"
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    25
 COPYRIGHT (c) 1994 by AEG Industry Automation
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    26
 COPYRIGHT (c) 1994 by Claus Gittinger
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    27
	      All Rights Reserved
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    28
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    29
 This software is furnished under a license and may be used
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    30
 only in accordance with the terms of that license and with the
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    31
 inclusion of the above copyright notice.   This software may not
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    32
 be provided or otherwise made available to, or used by, any
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    33
 other person.  No title to or ownership of the software is
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    34
 hereby transferred.
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    35
"
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    36
!
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
documentation
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
"
443
fdff91162cac added obsoleteness warning
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
    40
    [warning:]
fdff91162cac added obsoleteness warning
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
    41
        this class has been more or less obsoleted by
fdff91162cac added obsoleteness warning
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
    42
        the SelectionInTreeView class.
fdff91162cac added obsoleteness warning
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
    43
        SelectionInHierarchyView remains in the system for backward
fdff91162cac added obsoleteness warning
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
    44
        compatibility, but will be no longer maintained.
fdff91162cac added obsoleteness warning
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
    45
        New applications should use SelectionInTreeView.
fdff91162cac added obsoleteness warning
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
    46
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
    somewhat like a SelectionInListView; but specialized for hierarchical (i.e. tree-like)
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
    lists and adds the functions to show/hide subtrees. 
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
    Requires SelectionInHierarchy as model and HierarchyNode (or compatible) list entries.
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
    See examples.
252
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    51
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    52
    [Author:]
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    53
        W. Olberding AEG Factory Automation
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    54
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    55
    [See also:]
443
fdff91162cac added obsoleteness warning
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
    56
        SelectionInTreeView
361
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
    57
        SelectionInHierarchy HierarchyNode
252
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    58
        SelectionInListView
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
"
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
!
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
examples
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
"
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
    shows the tree of smalltalk classes:
252
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    65
                                                                        [exBegin]
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
      |top hierarchy hierarchyV scroller|
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
      hierarchy := SelectionInHierarchy new.
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
      hierarchy root:(HierarchyNode newAsTreeFromSmalltalkClass:Object).
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
      hierarchy setHideToChildren:true startingAt:hierarchy root.
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
      top := StandardSystemView new.
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
      top extent:300@300.
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
      hierarchyV := SelectionInHierarchyView new.
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
      hierarchyV model: hierarchy.
184
13a2f3677c68 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
    77
      hierarchyV action:[:nr | Transcript show:'selected:'; showCR:nr].
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
      top add:(ScrollableView forView:hierarchyV)
252
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    80
          in:((0.0 @ 0.0 ) corner:( 1.0 @ 1.0)).
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
      top open.
252
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    82
                                                                        [exEnd]
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    83
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
    same, with nice connecting links:
259
f930922963ce commentary - mhmh
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    85
    (sorry - this works only with some fonts - see comment in #getListFromModel)
252
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    86
                                                                        [exBegin]
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
      |top hierarchy hierarchyV scroller|
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    89
      hierarchy := SelectionInHierarchy new.
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
      hierarchy root:(HierarchyNode newAsTreeFromSmalltalkClass:Object).
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
      hierarchy setHideToChildren:true startingAt:hierarchy root.
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
      top := StandardSystemView new.
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
      top extent:300@300.
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
      hierarchyV := SelectionInHierarchyView new.
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    97
      hierarchyV showConnectingLines:true.
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
      hierarchyV model: hierarchy.
184
13a2f3677c68 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
    99
      hierarchyV action:[:nr | Transcript show:'selected:'; showCR:nr].
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   101
      top add:(ScrollableView forView:hierarchyV)
252
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   102
          in:((0.0 @ 0.0 ) corner:( 1.0 @ 1.0)).
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   103
      top open.
252
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   104
                                                                        [exEnd]
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   105
"
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   106
! !
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   107
361
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   108
!SelectionInHierarchyView methodsFor:'accessing - selection'!
252
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   109
254
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   110
selectElement:anObject
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   111
    "select the element with same printString as the argument, anObject"
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   112
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   113
    |index|
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   114
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   115
    index:= 1.
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   116
    list notNil ifTrue:[
361
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   117
        list do:[:each|
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   118
          ((each withoutSpaces) = (anObject printString)) ifTrue:[
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   119
              self selection:index.
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   120
              ^ index
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   121
          ].
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   122
          index:= index + 1.
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   123
        ]. 
254
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   124
    ].
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   125
    ^index
252
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   126
361
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   127
    "Modified: 10.10.1994 / 16:13:39 / W.Olberding"
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   128
    "Modified: 16.4.1997 / 12:40:05 / cg"
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   129
!
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   130
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   131
selection: anIndex
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   132
	"Pass the selection along to the model."
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   133
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   134
	super selection:  anIndex.
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   135
	model selection:  anIndex.
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   136
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   137
	"Modified: 10.10.94 / 16:13:38 / W.Olberding"!
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   138
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   139
selectionIndex: anIndex
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   140
        "Pass the selection along to the model."
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   141
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   142
        super selection:  anIndex.
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   143
        model selection:  anIndex.
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   144
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   145
        "Modified: 10.10.94 / 16:13:38 / W.Olberding"
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   146
! !
252
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   147
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   148
!SelectionInHierarchyView methodsFor:'event handling'!
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   149
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   150
buttonPress:button x:x y:y
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   151
    |oldSelection listLineNr|
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   152
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   153
    ((button == 1) or:[button == #select]) ifTrue:[
252
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   154
        enabled ifTrue:[
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   155
            oldSelection := selection.
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   156
            listLineNr := self visibleLineToListLine:(self visibleLineOfY:y).
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   157
            (selectConditionBlock isNil or:[selectConditionBlock value:listLineNr]) ifTrue:[
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   158
                listLineNr notNil ifTrue: [
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   159
                    self selectWithoutScroll:listLineNr
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   160
                ].
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   161
                ((ignoreReselect not and:[selection notNil])
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   162
                 or:[selection ~= oldSelection]) ifTrue:[
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   163
                    "actionBlock notNil ifTrue:[actionBlock value:selection]."
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   164
                    "the ST-80 way of doing things"
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   165
                    model notNil ifTrue:[
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   166
                        model perform:#selectionIndex: with:(selection)
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   167
                    ]
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   168
                ].
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   169
                clickLine := listLineNr
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   170
            ]
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   171
        ]
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   172
    ] ifFalse:[
252
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   173
        super buttonPress:button x:x y:y
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   174
    ]
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   175
252
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   176
        "Modified: 10.10.94 / 17:13:38 / W.Olberding"
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   177
        "Modified: 08.11.94 / 15:38:43 / R.Sailer"
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   178
!
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   179
254
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   180
keyPress:key x:x y:y
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   181
    "a key was pressed - handle [-][+][*] here"
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   182
254
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   183
    (key == $-)    ifTrue: [^ model collapse]. 
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   184
    (key == $+)    ifTrue: [^ model expand]. 
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   185
    (key == $*)    ifTrue: [^ model expandAll]. 
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   186
    (key == $.)    ifTrue: [^ model collapseAll]. 
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   187
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   188
    super keyPress:key x:x y:y
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   189
361
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   190
	"Modified: 10.10.94 / 16:13:38 / W.Olberding"! !
252
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   191
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   192
!SelectionInHierarchyView methodsFor:'initialization'!
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   193
254
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   194
initialize
252
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   195
254
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   196
    super initialize.
361
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   197
254
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   198
    showConnectingLines := true.
361
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   199
    indent := 2.
252
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   200
254
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   201
    self  doubleClickAction: 
361
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   202
          [:selection | model doubleClickSelection: selection ].
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   203
          "this will usualy initiate a hide/show operation"
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   204
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   205
    "Modified: 10.10.1994 / 16:13:39 / W.Olberding"
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   206
    "Modified: 16.4.1997 / 12:37:38 / cg"
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   207
!
252
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   208
361
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   209
itemPrintConverter:aBlock
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   210
    "set a converter block, which returns a listEntry
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   211
     for a passed node. If left undefined, an indented string
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   212
     based upon the nodes name is generated."
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   213
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   214
    itemPrintConverter := aBlock
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   215
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   216
    "Modified: 16.4.1997 / 13:06:22 / cg"
252
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   217
!
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   218
254
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   219
showConnectingLines:aBoolean
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   220
    showConnectingLines := aBoolean
252
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   221
! !
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   222
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   223
!SelectionInHierarchyView methodsFor:'model access'!
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   224
254
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   225
getListAttributes
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   226
      "get list attributes (selectable, disabled ...) from model)"
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   227
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   228
       ^Array new: 0.
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   229
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   230
	"Modified: 10.10.94 / 16:13:38 / W.Olberding"!
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   231
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   232
getListFromModel
259
f930922963ce commentary - mhmh
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   233
    "Get list entries from model.
f930922963ce commentary - mhmh
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   234
     Answer them as idented Text."
254
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   235
361
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   236
    |listOfNodes itemList textLine treeLevels isLastOnLevel oldLevel
259
f930922963ce commentary - mhmh
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   237
     blockGraphicCharacters|
254
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   238
259
f930922963ce commentary - mhmh
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   239
    listOfNodes := model list.
f930922963ce commentary - mhmh
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   240
    listOfNodes isNil ifTrue:[^ #()].
254
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   241
361
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   242
    itemPrintConverter notNil ifTrue:[
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   243
        "/ externally provided node-to-listentry converter
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   244
        "/ allows hierarchyNodes to be presented in any
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   245
        "/ programmer defined way ...
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   246
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   247
        itemList := listOfNodes collect:[:aNode |
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   248
            itemPrintConverter value:aNode
259
f930922963ce commentary - mhmh
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   249
        ].
361
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   250
    ] ifFalse:[    
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   251
        showConnectingLines ifFalse:[
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   252
            itemList := listOfNodes collect: [ :aNode |
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   253
                textLine := ReadWriteStream on: String new.
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   254
                aNode level timesRepeat: [
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   255
                    textLine spaces:indent.
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   256
                ].
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   257
                textLine nextPutAll: aNode name.
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   258
                aNode isExpandable ifTrue: [
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   259
                    textLine nextPutAll: ' ...'.
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   260
                ].
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   261
                textLine contents.
259
f930922963ce commentary - mhmh
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   262
            ].
361
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   263
        ] ifTrue:[
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   264
            "/ claus:
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   265
            "/ mhmh - the AEG code depends on those blockGraphic
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   266
            "/        characters being in the font.
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   267
            "/
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   268
            "/ how can we find out what characters there are ?
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   269
            "/ (X maps missing chars to a space).
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   270
            "/ we should really rewrite this to use a private bitmap font ...
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   271
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   272
            blockGraphicCharacters := Array with:$|
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   273
                                            with:$+
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   274
                                            with:$+
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   275
                                            with:$-.
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   276
361
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   277
    "/        blockGraphicCharacters := Array with:(Character value:25)
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   278
    "/                                        with:(Character value:14)
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   279
    "/                                        with:(Character value:21)
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   280
    "/                                        with:(Character value:18).
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   281
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   282
            isLastOnLevel:=Set new.
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   283
            treeLevels:=Set new.
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   284
            oldLevel:=0.
259
f930922963ce commentary - mhmh
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   285
361
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   286
            listOfNodes reverseDo: [ :aNode |
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   287
                (treeLevels includes:(aNode level)) ifFalse:[
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   288
                    isLastOnLevel add:aNode.
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   289
                    treeLevels add:(aNode level).
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   290
                ].
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   291
                aNode level < oldLevel ifTrue:[
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   292
                    treeLevels remove:oldLevel.
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   293
                ].
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   294
                oldLevel:=aNode level.
259
f930922963ce commentary - mhmh
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   295
            ].
361
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   296
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   297
            treeLevels:=Set new.
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   298
            oldLevel:=0.
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   299
            itemList := listOfNodes collect: [ :aNode |
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   300
                textLine := ReadWriteStream on: String new.
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   301
361
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   302
                1 to:((aNode level)-1) do: [ :l |
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   303
                    (treeLevels includes:l) ifTrue:[
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   304
                        textLine space; nextPut:(blockGraphicCharacters at:1); space.
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   305
                    ]ifFalse:[
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   306
                        textLine space; space; space.
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   307
                    ]
259
f930922963ce commentary - mhmh
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   308
                ].
361
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   309
                treeLevels add:(aNode level).
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   310
                oldLevel:=aNode level.
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   311
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   312
                (aNode = (listOfNodes first)) ifFalse:[
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   313
                    textLine space.
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   314
                    (isLastOnLevel includes:aNode)ifTrue:[
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   315
                         textLine nextPut:(blockGraphicCharacters at:2).
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   316
                         treeLevels remove:(aNode level).
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   317
                    ] ifFalse:[
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   318
                        textLine nextPut:(blockGraphicCharacters at:3).
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   319
                    ].
259
f930922963ce commentary - mhmh
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   320
                    textLine nextPut:(blockGraphicCharacters at:4).
f930922963ce commentary - mhmh
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   321
                ].
361
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   322
                aNode isExpandable ifTrue: [
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   323
                    textLine nextPutAll: '[+]'.
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   324
                ] ifFalse:[
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   325
                    aNode isCollapsable ifTrue: [
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   326
                       textLine nextPutAll: '[-]'.
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   327
                    ] ifFalse:[
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   328
                        textLine nextPut:(blockGraphicCharacters at:4).
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   329
                    ].
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   330
                ].
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   331
361
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   332
                textLine nextPutAll:' ', aNode name.
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   333
                textLine contents.
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   334
            ].
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   335
        ]
259
f930922963ce commentary - mhmh
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   336
    ].
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   337
361
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   338
   ^itemList
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   339
361
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   340
    "Modified: 10.10.1994 / 16:13:39 / W.Olberding"
207e06f3d47e added an itemConverterBlock, which can generate ListEntries
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
   341
    "Modified: 16.4.1997 / 12:43:20 / cg"
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   342
!
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   343
252
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   344
getSelectionFromModel
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   345
      "Get the current list selection from model. "
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   346
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   347
    ^  model selectionIndex
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   348
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   349
        "Modified: 10.10.94 / 16:13:39 / W.Olberding"
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   350
!
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   351
254
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   352
model:aModel
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   353
    super model:aModel.
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   354
    self setNewList
252
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   355
! !
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   356
252
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   357
!SelectionInHierarchyView methodsFor:'private'!
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   358
254
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   359
setNewList
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   360
	"Build a completely new hierarchy list."
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   361
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   362
254
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   363
       self setList: (self getListFromModel).
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   364
"/       self attributes: (self getListAttributes).
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   365
       self selection: (self getSelectionFromModel).
252
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   366
254
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   367
	"Modified: 10.10.94 / 17:13:38 / W.Olberding"
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   368
	"Modified: 08.11.94 / 15:28:03 / R.Sailer"! !
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   369
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   370
!SelectionInHierarchyView methodsFor:'updating'!
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   371
254
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   372
update: aSymbol with:aParameter from:changedObject
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   373
      "Change my apperance according to the occurred change."
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   374
254
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   375
     aSymbol==#list 
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   376
	ifTrue: [^self setNewList].
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   377
     aSymbol==#selection 
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   378
	ifTrue: [^self selection: self getSelectionFromModel].
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   379
     aSymbol==#attributes 
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   380
	ifTrue: [].
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   381
254
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
   382
	"Modified: 10.10.94 / 16:13:38 / W.Olberding"! !
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   383
259
f930922963ce commentary - mhmh
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   384
!SelectionInHierarchyView class methodsFor:'documentation'!
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   385
252
4db843d36c46 comment & #selectionIndex:
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   386
version
1233
ba2244433fd4 category change
Claus Gittinger <cg@exept.de>
parents: 443
diff changeset
   387
    ^ '$Header: /cvs/stx/stx/libwidg2/SelectionInHierarchyView.st,v 1.10 1999-03-07 13:29:53 cg Exp $'
84
4478ea2d40c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   388
! !