Overview | File | Class | Tree | Index | Help
| The Gravey 2.5 Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## Class MVCSelectionModel

    Object
       |
       +--GrvObject
             |
             +--MVCObserver
                   |
                   +--MVCModel
                         |
                         +--MVCScalarModel
                               |
                               +--MVCSelectionModel

Direct Known Subclasses:
  EDOHolderSelectionModel

class MVCSelectionModel
extends MVCScalarModel

This class encapsulates the data model for a selector which indicates the currently selected item in a specified MVCCollection data model. This means that the range of legal values for this model's value is [0..Collection.getCount()-1] plus a "nothing selected" value.
Version: 2.0
Author: Bruce Wallace (PolyGlotInc.com)
See:

- konstructor()

Defined in grvMVC.js

Field Summary
`<static> Object` | `kNothingSelected`
`<static> Object` | `kPropertyIdSelect`

Constructor Summary
`MVCSelectionModel ()`

Method Summary
`void` | `_select(<Object> k,<boolean> optLenient)` select the specified Collection item but dont publish
`void` | `_selectNothing()` select "nothing" but dont publish
`void` | `_unselect( )` select the zero-th item (NOT "nothing selected") but dont publish
`Object` | `getCount( )` return the size of our MVCCollection model
`String` | `getDescription(i)` return the specified MVCCollection item formatted as description
`int` | `getIndex( optKey )` return the index into the MVCCollection model of the specified key (or the current selection if no key specified)
`Object` | `getItem(<Object> i)` return the specified item in our Collection
`Collection` | `getList( )` return our Collection model
`Object` | `getMemento()` return a memento of the current state of "this"
`Object` | `getSelection( )` return the currently selected MVCCollection item or undefined if nothing selected
`String` | `getSelectionStr( )` return the currently selected MVCCollection item formatted as string
`boolean` | `hasSelection( )` return whether there is currently a selection
`void` | `konstructor( <Object> collModel, <String> optName )`
`void` | `reselect( )` re-select the current value and publish
`void` | `select(<Object> k,<boolean> optLenient)` select the specified MVCCollection item and publish
`void` | `selectNothing()` select "nothing" and publish
`void` | `setMemento(<Object> m)` update "this" based on the given memento
`void` | `unselect( )` select the zero-th item (NOT "nothing selected") and publish
`void` | `update( )` handle MVCCollection model update event by "unselect"ing

Methods inherited from class MVCScalarModel
`_setValue, setValue, getValue, _setValidity, getValidity`

Methods inherited from class MVCModel
`dumpSubscribers, toString, dirty, clean, publish, GET, _SET, SET, updateStamp, BeginTransaction, EndTransaction, addObserver, delObserver, notifyObservers`

Methods inherited from class MVCObserver
`subscribe`

Methods inherited from class GrvObject
`souper, souper_, isInstanceOf`

Field Detail

### kNothingSelected

    <static> Object kNothingSelected

### kPropertyIdSelect

    <static> Object kPropertyIdSelect

Constructor Detail

### MVCSelectionModel

    MVCSelectionModel()

Version: 2.0
Author: Bruce Wallace (PolyGlotInc.com)
See:

- konstructor()

Method Detail

### _select

    void _select(<Object> k,<boolean> optLenient)

select the specified Collection item but dont publish

Parameters:

`k` - key of item to select

`optLenient` - optional flag to allow out of range to selectNothing

### _selectNothing

    void _selectNothing()

select "nothing" but dont publish

### _unselect

    void _unselect( )

select the zero-th item (NOT "nothing selected") but dont publish

### getCount

    Object getCount( )

return the size of our MVCCollection model

### getDescription

    String getDescription(i)

return the specified MVCCollection item formatted as description

### getIndex

    int getIndex( optKey )

return the index into the MVCCollection model of the specified key (or the current selection if no key specified)

Returns:

-1 if not found

### getItem

    Object getItem(<Object> i)

return the specified item in our Collection

Parameters:

`i` - item key

### getList

    Collection getList( )

return our Collection model

### getMemento

    Object getMemento()

return a memento of the current state of "this"

### getSelection

    Object getSelection( )

return the currently selected MVCCollection item or undefined if nothing selected

### getSelectionStr

    String getSelectionStr( )

return the currently selected MVCCollection item formatted as string

### hasSelection

    boolean hasSelection( )

return whether there is currently a selection

### konstructor

    void konstructor( <Object> collModel, <String> optName )

Parameters:

`collModel` - Collection data model we select from

`optName` - optional name of this instance

### reselect

    void reselect( )

re-select the current value and publish

### select

    void select(<Object> k,<boolean> optLenient)

select the specified MVCCollection item and publish

Parameters:

`k` - key of item to select

`optLenient` - optional flag to allow out of range to selectNothing

### selectNothing

    void selectNothing()

select "nothing" and publish

### setMemento

    void setMemento(<Object> m)

update "this" based on the given memento

Parameters:

`m` - the memento

### unselect

    void unselect( )

select the zero-th item (NOT "nothing selected") and publish

### update

    void update( )

handle MVCCollection model update event by "unselect"ing

Overview | File | Class | Tree | Index | Help
| The Gravey 2.5 Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Documentation generated by JSDoc on Thu Jan 6 12:47:09 2011