|
Class: SelectionInTreeView
Object
|
+--GraphicsMedium
|
+--DisplaySurface
|
+--SimpleView
|
+--View
|
+--ListView
|
+--SelectionInListView
|
+--SelectionInTreeView
|
+--FileSelectionTree
- Package:
- stx:libwidg2
- Category:
- Views-Trees
- Version:
- rev:
1.133
date: 2019/03/01 15:11:10
- user: cg
- file: SelectionInTreeView.st directory: libwidg2
- module: stx stc-classLibrary: libwidg2
- Author:
- Claus Atzkern
OBSOLETE, please use HierarchicalListView.
somewhat like a SelectionInListView; but specialized for hierarchical (i.e. tree-like)
lists and adds the functions to show/hide subtrees.
Requires SelectionInTree as model and TreeItem (or compatible) list entries.
Notice:
This class obsoletes SelectionInHierarchyView, which is no longer
maintained but kept for backward compatibility.
Notice2:
Even for this class, an improved replacement now exists:
HierarchicalListView.
Please consider using that one.
(however, this class is kept for backward compatibility).
SelectionInTree
TreeItem
SelectionInListView
FileSelectionTree
constants
-
minImageInset
-
returns minimum inset from directory indication to image
defaults
-
defaultModelClass
-
returns the default model
-
updateStyleCache
-
extract values from the styleSheet and cache them in class variables
usage example(s):
resources
-
closeIndicator
-
returns a little [+] bitmap
-
imageClosed
-
returns a closed file-directory bitmap
-
imageItem
-
returns a regular file bitmap
-
imageOpened
-
returns an opened file-directory bitmap
-
openIndicator
-
returns a little [-] bitmap
accessing
-
highlightMode
-
get the mode how to draw a selected line:
#line draw whole line selected
#label draw label selected
-
highlightMode: aMode
-
set the mode how to draw a selected line:
#line draw whole line selected
#label draw label selected
-
itemClass
-
returns current itemClass used
-
itemClass: anItemClass
-
set itemClass to be used
-
lineColor
-
returns user configured line color or nil
-
lineColor: aColor
-
returns user configured line color or nil
-
nodeAtIndex: anIndex
-
returns node at an index or nil
-
root
-
gets the root of the model; the first item into list.
-
root: aRoot
-
sets the root of the model; the first item into list.
-
textInset
-
get the left inset of the text label
-
textInset: anInset
-
set the left inset of the text label
accessing-behavior
-
drawVLinesFromLevel
-
returns the level vertical lines are drawn from;
starting at 1 up to n
-
drawVLinesFromLevel: aLevel
-
set the level vertical lines are drawn from;
starting at 1 up to n
-
supportsExpandAll
-
-
supportsExpandAll: aBool
-
-
validateDoubleClickBlock
-
return the conditionBlock; this block is evaluated before a doubleClick action
on a node will be performed. In case of returning false, the doubleClick will
not be handled.
-
validateDoubleClickBlock: aOneArgBlock
-
set the conditionBlock; this block is evaluated before a doubleClick action
on a node will be performed. In case of returning false, the doubleClick will
not be handled.
-
validateExpandabilityBlock
-
return the expand conditionBlock; this block is evaluated before an expand due to
a doubleClick on a node will be performed. In case of returning false,
the node will not be expanded.
-
validateExpandabilityBlock: aOneArgBlock
-
set the expand conditionBlock; this block is evaluated before an expand due to
a doubleClick on a node will be performed. In case of returning false,
the node will not be expanded.
accessing-channels
-
rootHolder
-
get the holder which keeps the hierarchical list entry or nil
-
rootHolder: aValueHolder
-
set the holder which keeps the hierarchical list entry or nil
-
selectionHolder
-
get the holder which keeps a list of selected items or nil
-
selectionHolder: aHolder
-
set the holder which keeps a list of selected items or nil
accessing-images
-
closeIndicator
-
return the bitmap image shown for expandable tree items (a little right arrow)
(initialized to a right arrow)
-
closeIndicator: aBitmapIcon
-
set the bitmap image shown for expandable tree items
(defaults to a right arrow)
-
imageClosed
-
return the value of the instance variable 'imageClosed'.
That's the (default) bitmap image shown for closed folders
(initialized to a file-directory bitmap)
-
imageClosed: anIconImage
-
set the instance variable 'imageClosed'.
That's the (default) bitmap image shown for closed folders
(if nil, a class-specific open file-directory bitmap will be used).
Must be set early (before opening the view)
-
imageItem
-
return the value of the instance variable 'imageItem'.
That's the (default) bitmap image shown for regular items
(initialized to a plain-file bitmap)
-
imageItem: anIconImage
-
set the instance variable 'imageItem'.
That's the (default) bitmap image shown for non-folders
(if nil, a class-specific file bitmap will be used).
Must be set early (before opening the view)
-
imageOnMyDevice: anImage
-
associate image to device and returns the new image.
-
imageOpened
-
return the value of the instance variable 'imageOpened'.
That's the (default) bitmap image shown for opened folders
(initialized to an open file-directory bitmap)
-
imageOpened: anIconImage
-
set the instance variable 'imageOpened'.
That's the (default) bitmap image shown for opened folders
(if nil, a class-specific open file-directory bitmap will be used).
Must be set early (before opening the view)
-
openIndicator
-
return the bitmap image shown for expanded tree items (a little down arrow)
(initialized to a down arrow)
-
openIndicator: aBitmapIcon
-
set the bitmap image shown for expanded tree items
(defaults to a down arrow)
accessing-look
-
showDirectoryIndicator
-
returns true if items with children have an open/closed indicator
-
showDirectoryIndicator: aBoolean
-
show or hide open/closed indicators for items with children
-
showDirectoryIndicatorForRoot
-
returns true if the root item has an open/closed indicator
(showing requires that the general showDirectoryIndicator is also enabled)
-
showDirectoryIndicatorForRoot: aBoolean
-
show/hide the root item's open/closed indicator
(showing requires that the the common showDirectoryIndicator is also enabled)
-
showLines
-
returns true if lines are shown
-
showLines: aBoolean
-
show or hide lines
-
showLinesForRoot
-
returns true if root-lines are shown
-
showLinesForRoot: aBoolean
-
show or hide lines for root(s)
-
showRoot
-
show or hide the root item?
-
showRoot: aBoolean
-
show or hide the root item
change & update
-
modelChanged: what with: aPara
-
hierarchical list changed
-
update: something with: aParameter from: aModel
-
one of my models changed its value
drawing
-
drawLine: line atX: atX inVisible: visLineNr with: fg and: bg
-
-
drawLine: line fromX: x inVisible: visLineNr with: fg and: bg
-
-
drawLine: line inVisible: visLineNr with: fg and: bg
-
-
drawVisibleLine: visLineNr col: col with: fg and: bg
-
-
drawVisibleLine: visLineNr from: startCol to: endCol with: fg and: bg
-
-
drawVisibleLine: visLineNr from: startCol with: fg and: bg
-
-
redrawFromVisibleLine: startVisLineNr to: endVisLineNr
-
-
redrawIconAndIndicatorAt: aLnNr
-
-
redrawIndicatorLine: aLineNr
-
redraw the directory indicator for a line
-
redrawVisibleLine: visLineNr
-
-
redrawVisibleLine: visLineNr from: startCol to: endCol
-
drawing basics
-
drawFromVisibleLine: startVisLineNr to: endVisLineNr with: fg and: bg
-
redraw a visible line range with clearing the background
-
drawVHLinesX: x0 y: y0 toX: x1 start: start stop: stop
-
redraw from line to line without clearing the background
-
drawVisibleLineSelected: visLineNr with: fg and: bg
-
redraw a single line as selected.
-
paintOnIsSelected: isSelected
-
-
redrawElement: anIndex
-
-
redrawLabelAt: x y: yTop index: anIndex
-
-
redrawLinesX: x0 y: y0 toX: x1 start: start stop: stop
-
redraw from line to line without clearing the background
-
redrawSelFrameAtX: x0 y: y0 toX: x1
-
redraw selection frame for a line
-
redrawX: x y: y width: w height: h
-
a region must be redrawn
enumerating
-
detectNode: aOneArgBlock
-
evaluate the argument, aBlock for each node in the list until
the block returns true; in this case return the node which caused
the true evaluation. If none node is detected, nil is returned.
-
selectedNodesDo: aOneArgBlock
-
evaluate the block on each node selected
event handling
-
activateMenu
-
menu receiver:appl. -- now done in findGuiResources ...
-
buttonMotion: buttonMask x: x y: y
-
mouse-move while button was pressed - handle selection changes
-
buttonMultiPress: button x: x y: y
-
discard doubleClick on indicator
-
buttonPress: button x: x y: y
-
handle button press event
-
buttonRelease: button x: x y: y
-
stop any autoscroll
-
doubleClicked
-
handle a double click; collapse or expand selected entry
in case of having children
-
handleSelectButtonAtX: x y: y
-
handle a select button click
-
indicatiorLineForButton: aButton atX: x y: y
-
returns linenumber assigned to indicator at x/y or 0
-
isCtrlMetaAltOrShiftPressed
-
returns true if CTRL, META, ALT or SHIFT is pressed
-
key: key select: index x: x y: y
-
select an entry by a keyboard action. This is treated like a doubleClick
on that entry.
Add on: In case that the entry is not selectable, scroll to the entry
usage example(s):
^ super key:key select:index x:x y:y
|
-
keyPress: key x: x y: y
-
handle keyboard input
initialization & release
-
create
-
-
fetchDefaultImages
-
returns a directory with default keys and images;
could be redefined by subclass.
-
fetchDeviceResources
-
initialize heavily used device resources - to avoid rendering
images again and again later
-
fetchImageResources
-
initialize heavily used device resources - to avoid rendering
images again and again later;
returns the maximum extent of the images used.
Could be redefined by subclass
-
getFontParameters
-
save old computed height derived from images
-
initStyle
-
setup viewStyle specifics
-
initialize
-
setup instance attributes
-
realize
-
-
recomputeDirectoryIndicator
-
setup attributes used by directory indicator
-
refetchDeviceResources
-
reinitialize heavily used device resources - to avoid rendering
images again and again later
-
release
-
remove dependencies
model
-
getListFromModel
-
if I have a model, get my list from it using the listMessage.
If listMessage is nil, try aspectMessage for backward compatibilty.
-
listFromModel
-
get list from model and return the new list.
If listMessage is nil, try aspectMessage for backward compatibilty.
-
model: aModel
-
check whether given new model is nil;
then a default model is created
-
rootFromModel
-
update hierarchical list from root model; 'rootHolder'
-
selectionFromModel
-
set the selection derived from the selectionHolder
-
selectionToModel
-
write selection to selection holder
private
-
closeEditor
-
close the editor
-
list: aList keepSelection: keepSelection
-
setup new list; keep selection dependent on the boolean state
keepSelection
-
openEditor
-
open an editor on selection
private-drag and drop
-
collectionOfDragObjects
-
returns collection of dragable objects assigned to selection
Here, by default, a collection of text-dragObjects is generated;
however, if a dragObjectConverter is defined, that one gets a chance
to convert as appropriate.
-
dragObjectForNode: aNode
-
returns the dragable object for a node; could be redefined in subclass
-
startDragX: x y: y
-
start drag
private-queries
-
lengthOfLongestLineBetween: firstLine and: lastLine
-
return the length (in characters) of the longest line in a line-range
-
smallestLevelOfNodesBetween: start and: stop
-
returns the smallest level of the nodes in a line range
-
widthOfContents
-
return the width of the contents in pixels
- used for scrollbar interface
-
widthOfLongestLine
-
return the width of the longest line in pixels
private-redefinitions
-
expandTabs
-
nothing to do
-
list: aCollection expandTabs: expand scanForNonStrings: scan
-
-
withoutRedrawAt: anIndex put: aString
-
change a line without redisplay and WITHOUT any sizeChange notifications.
Somewhat dangerous, since scrollBars will not be informed about contents-changes.
Use only if multiple lines are to be changed, and a sizeChanged is invoked by some other
means at the end.
queries
-
figureFor: aNode
-
return a (bitmap) figure for a node
-
indexOfNode: aNode
-
returns index of a node
-
xOfFigureLevel: aLevel
-
origin x where to draw the icon
-
xOfFigureNode: aNode
-
origin x where to draw the icon
-
xOfStringLevel: aLevel
-
origin x where to draw the text( label )
-
xOfStringNode: aNode
-
origin x where to draw the text( label )
-
xOfValueNode: aNode
-
returns the left x position of the start of the value
scrolling
-
needScrollToMakeLine: aListLineNr
-
redefined to scroll whenever line is not in top half
-
originChanged: delta
-
sent after scrolling - have to update origin of editor
selection
-
selectNode: aNode
-
change selection to a node
-
selectNode: aNode withNotify: withNotify
-
change selection to a node
-
selectNodes: aCollectionOfNodes
-
-
selectNodes: aCollectionOfNodes withNotify: withNotify
-
first := true.
-
selectedIndex
-
get single selected index or 0
-
selectedNode
-
get the single selected node or nil
-
selectedNodes
-
get a collection of selected nodes
-
selectionChangedFrom: oldSelection
-
update selectionHolder if not nil
-
setSelection: aSelection
-
if no selection exists, close the editor
selection actions
-
selectedNodeAdd: something
-
add a node or collection of nodes after selected node
-
selectedNodeBecomeChildOfNext
-
make the selected node a child of the next node
-
selectedNodeBecomeChildOfPrevious
-
make the selected node a child of the previous node
-
selectedNodeBecomeSisterOfParent
-
become node a sister of its current parent
-
selectedNodeChangeSequenceOrder: anOffset
-
move child 'anOffset' forward or backward in list of children
-
selectedNodeExpand: doExpand
-
collapse or expand selected node
-
selectedNodesBecomeChildrenOfNext
-
make the selected nodes children of the next node
-
selectedNodesBecomeSistersOfParent
-
move selected nodes up (out of their parent to their grandparent).
I.e. nodes become sisters of their current parent
-
selectedNodesRemove
-
remove selected nodes
shows the tree of smalltalk classes:
|top sel|
top := StandardSystemView new; extent:300@300.
sel := SelectionInTreeView new.
sel root:(TreeItem newAsTreeFromSmalltalkClass:Object).
sel action:[:nr | Transcript show:'selected:'; showCR:nr].
top add:(ScrollableView forView:sel) in:((0.0 @ 0.0 ) corner:( 1.0 @ 1.0)).
top open.
|
same, including nil-subclasses (i.e. really all classes):
|top sel|
top := StandardSystemView new; extent:300@300.
sel := SelectionInTreeView new.
sel root:(TreeItem newAsTreeFromSmalltalkClass:nil).
sel action:[:nr | Transcript show:'selected:'; showCR:nr].
sel lineColor:(Color red).
top add:(ScrollableView forView:sel) in:((0.0 @ 0.0 ) corner:( 1.0 @ 1.0)).
top open.
|
shows the tree of smalltalk classes; show directory indication and no
lines.
|top sel|
top := StandardSystemView new; extent:300@300.
sel := SelectionInTreeView new.
sel showLines:false.
sel showDirectoryIndicator:true.
sel root:(TreeItem newAsTreeFromSmalltalkClass:Object).
sel action:[:nr | Transcript show:'selected:'; showCR:nr].
top add:(ScrollableView forView:sel) in:((0.0 @ 0.0 ) corner:( 1.0 @ 1.0)).
top open.
|
|