| |
PluggableCollectionMorph
category: Genie-UI
superclass: AlignmentMorph
subclasses:
This class allows the user to inspect (and modify) any kind of collection (flat collection, but also Dictionaries, etc.). Instances are morphs with a few navigate buttons. Whenever a collection element has to be shown, it converts this element to a morph and shows it. As all the other Pluggable components in Squeak, a PluggableCollectionMorph can be based on a model and there are a lot selectors that can be set to specify a special behavior.
Examples: Per default, all collection elements that are not already Morphs are just converted into a StringMorph. To refine this behavior, just set a selector for 'valueMorphSelector' (resp. keyMorphSelector) and implement your one conversion method in the model.
To allow a user to add and remove elements in the collection, the selectors 'assSelector' and 'deleteSelector' have to be set.
This class is used for big parts of the Genie UI. Sometimes, even nested pluggable collection morphs are used.
Instance variables:
collection <OrderedCollection>
A collection that holds the elements of the inspected collection. However, this collection
is for internal use and is not necessarily the same as the inspected collection.
collectionKeys <OrderedCollection>
If the source collection of a Dictionary, the keys are the dictionary keys. If not, the keys
are just the numbers from 1 to the size of the collction. This concept is used to treat usual
collection and dictionaries the same way.
currentIndex <SmallInteger>
The index of the element currently shown.
model
The model. Selectors are sent to this receiver.
collectionOrSelector
Either the source collection (the collection to inspect) or a selector to retrieve the collection
from the model.
okaySelector
Selector is sent to the model when okay button is pressed. (If selector undefinied, no okay
button is available). The selectors must have one argument. When the selector is
invoked, the invoking PluggableCollectionMorph itself is sent as the argument.
Then, methods as currentValue or currentKey can be used to determine the current state of
the morph.
cancelSelector
Similar to okaySelector.
addSelector
Similar to okaySelector.
deleteSelector
Similar to okaySelector.
changeSelector
It is invoked before a change is executed. Return false if the change shouldn't be allowed.
Rest is similar to okaySelector.
valueMorphSelector
Is called whenever a collection element has to be wrapped into a morph.
Must take two arguments: 1) object to be wrapped, 2) sending PluggableCollectionMorph.
keyMorphSelector
Is called whenever a key element has to be wrapped into a morph.
Must take two arguments: 1) object to be wrapped, 2) sending PluggableCollectionMorph.
menuSelector
Is invoked whenever the user hits the menu button. Should return the menu. See also
method resendMenuAction:
gotoSelector
Similar to okaySelector. Primitive goto is available even if selector is nil.
objectToStringSelector
Selector toconvert an object to a string. Usually not used.
releaseSelector
Gets invoked whenever a morph is not shown anymore. (E.g. when the currently shown
collection element changes). It must take 3 arguments: 1) The released morph, 2) the morph
replacing the released morph, 3) the sending PluggableCollectionMorph.
Usually not used.
valueMorph
The morph currently shown as the value at the current collection position.
keyMorph
The morph currently shown as the key at the current collection position.




|
|