Squeak Class Documentation category index | class index  
 
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.

instance methods
  accessing
  addSelector
addSelector:
balloonTextSelector
balloonTextSelector:
cancelSelector
cancelSelector:
changeSelector
changeSelector:
collectionOrSelector
collectionOrSelector:
collectionOrSelector:key:
currentKey
currentKeyMorph
currentValue
currentValueMorph
deleteSelector
deleteSelector:
ensureLayout
gotoSelector
gotoSelector:
hasLayout
keyMorphSelector
keyMorphSelector:
menuSelector
menuSelector:
model
model:
objectToStringSelector
objectToStringSelector:
okaySelector
okaySelector:
releaseSelector
releaseSelector:
setKey:
setKey:toString:
setToValue:
valueMorphSelector
valueMorphSelector:

  buttons
  addButton
basicButton
cancelButton
deleteButton
gotoButton
menuButton
nextButton
okayButton
prevButton

  initialize-release
  addButtonsTo:space:
initialize
layout
openInWorld:

  model access
  addAction
balloonText:
cancelAction
changeRequest
deleteAction
getCollection
gotoAction
menuAction
nextAction
objectToString:
okayAction
prevAction
release:
release:replaceBy:
resendMenuAction:
wrap:into:modelSelector:

  private
  arrayOfDictionaryKeys:
close
collection
collection:
collectionKeys
collectionKeys:
currentIndex
currentIndex:
decrementIndex
incrementIndex
indexOfKey:toString:
isAddAvailable
isBalloonTextAvailable
isCancelAvailable
isChangeAvailable
isCurrentIndexValid
isDeleteAvailable
isGotoAvailable
isIndexValid:
isMenuAvailable
isModelAvailable
isObjectToStringAvailable
isOkayAvailable
isReleaseAvailable
keyAtIndex:
keyMorph
keyMorph:
normalizeCurrentIndexRotate:
normalizeIndex:in:rotate:
normalizeIndex:rotate:
objectToMorph:
setCollection:
setCollection:key:
setKeyNoUpdate:
setKeyNoUpdate:toString:
setModel:collectionOrSelector:okaySelector:cancelSelector:addSelector:deleteSelector:gotoSelector:menuSelector:changeSelector:valueMorphSelector:keyMorphSelector:objectToStringSelector:releaseSelector:balloonTextSelector:
valueAtIndex:
valueAtKey:
valueMorph
valueMorph:

  submorphs-add/remove
  delete

  updating
  update:
updateAll
updateCollection
updateContents

class methods
  instance creation
  collection:
model:collectionOrSelector:okaySelector:cancelSelector:addSelector:deleteSelector:gotoSelector:menuSelector:changeSelector:valueMorphSelector:keyMorphSelector:objectToStringSelector:releaseSelector:balloonTextSelector:

instance methods
  accessing top  
 

addSelector


 

addSelector:


 

balloonTextSelector

Answer balloon text selector item in the extension, nil if none


 

balloonTextSelector:


 

cancelSelector


 

cancelSelector:


 

changeSelector


 

changeSelector:


 

collectionOrSelector


 

collectionOrSelector:


 

collectionOrSelector:key:

Set the collection and jump to the spcified key if available


 

currentKey

The currently shown key


 

currentKeyMorph

The morph for the currently shown key


 

currentValue

The currently shown value


 

currentValueMorph

The morph for the currently shown value


 

deleteSelector


 

deleteSelector:


 

ensureLayout

Ensure that the layout method was called at leat once


 

gotoSelector


 

gotoSelector:


 

hasLayout


 

keyMorphSelector


 

keyMorphSelector:


 

menuSelector


 

menuSelector:


 

model


 

model:


 

objectToStringSelector


 

objectToStringSelector:


 

okaySelector


 

okaySelector:


 

releaseSelector


 

releaseSelector:


 

setKey:

Switch to the given key


 

setKey:toString:

Switch to the given key. If aBoolean is true, all th keys are converted to
strings before they are compared to anObject


 

setToValue:

Switch to the given value


 

valueMorphSelector


 

valueMorphSelector:


  buttons top  
 

addButton


 

basicButton


 

cancelButton


 

deleteButton


 

gotoButton


 

menuButton


 

nextButton


 

okayButton


 

prevButton


  initialize-release top  
 

addButtonsTo:space:


 

initialize


 

layout

Define the morphs layout and add the submorphs


 

openInWorld:

Add this morph to the requested World.


  model access top  
 

addAction


 

balloonText:


 

cancelAction


 

changeRequest


 

deleteAction


 

getCollection


 

gotoAction


 

menuAction


 

nextAction


 

objectToString:


 

okayAction


 

prevAction


 

release:


 

release:replaceBy:


 

resendMenuAction:


 

wrap:into:modelSelector:


  private top  
 

arrayOfDictionaryKeys:


 

close


 

collection

Internal representation of the inspected collection


 

collection:


 

collectionKeys

Internal representation of the inspected collection's keys.
If the inspected collection is not a Dictionary, the keys are just numbers


 

collectionKeys:


 

currentIndex


 

currentIndex:


 

decrementIndex


 

incrementIndex


 

indexOfKey:toString:


 

isAddAvailable


 

isBalloonTextAvailable


 

isCancelAvailable


 

isChangeAvailable


 

isCurrentIndexValid


 

isDeleteAvailable


 

isGotoAvailable


 

isIndexValid:


 

isMenuAvailable


 

isModelAvailable


 

isObjectToStringAvailable


 

isOkayAvailable


 

isReleaseAvailable


 

keyAtIndex:


 

keyMorph


 

keyMorph:


 

normalizeCurrentIndexRotate:


 

normalizeIndex:in:rotate:


 

normalizeIndex:rotate:


 

objectToMorph:


 

setCollection:


 

setCollection:key:

Set aCllection as the inspected collection and goto the key keyObject if available


 

setKeyNoUpdate:


 

setKeyNoUpdate:toString:


 

setModel:collectionOrSelector:okaySelector:cancelSelector:addSelector:deleteSelector:gotoSelector:menuSelector:changeSelector:valueMorphSelector:keyMorphSelector:objectToStringSelector:releaseSelector:balloonTextSelector:


 

valueAtIndex:


 

valueAtKey:


 

valueMorph


 

valueMorph:


  submorphs-add/remove top  
 

delete

Remove the receiver as a submorph of its owner and make its new owner be nil.


  updating top  
 

update:

Receive a change notice from an object of whom the receiver is a
dependent. The default behavior is to do nothing; a subclass might want
to change itself in some way.


 

updateAll


 

updateCollection


 

updateContents


class methods
  instance creation top  
 

collection:


 

model:collectionOrSelector:okaySelector:cancelSelector:addSelector:deleteSelector:gotoSelector:menuSelector:changeSelector:valueMorphSelector:keyMorphSelector:objectToStringSelector:releaseSelector:balloonTextSelector: