wicket.markup.html.form.model
Class ChoiceList

java.lang.Object
  extended bywicket.markup.html.form.model.ChoiceList
All Implemented Interfaces:
IChoiceList, IDetachable, java.io.Serializable
Direct Known Subclasses:
DetachableChoiceList

public class ChoiceList
extends java.lang.Object
implements IChoiceList

Simple choice list backed by an ArrayList. This class implements IChoiceListso that it is easier to create subclasses and anonymous implementations.

Author:
Jonathan Locke
See Also:
Serialized Form

Nested Class Summary
protected  class ChoiceList.Choice
          Implementation of IChoice for simple objects.
 
Constructor Summary
ChoiceList()
          Constructor
ChoiceList(java.util.Collection choices)
          Constructor
ChoiceList(int initialCapacity)
          Constructor
 
Method Summary
 void add(java.lang.Object object)
           
 void addAll(java.util.Collection collection)
          Add all the elements from a collection to this choice list
 void attach()
          Attaches model for use.
 IChoice choiceForId(java.lang.String id)
          Gets an choice by id
 IChoice choiceForObject(java.lang.Object object)
           
 void clear()
          Clears this list
 void detach()
          Detaches model after use.
 IChoice get(int index)
           
 java.util.List getList()
           
protected  IChoice newChoice(java.lang.Object object, int index)
          IChoice factory method
 int size()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChoiceList

public ChoiceList()
Constructor


ChoiceList

public ChoiceList(java.util.Collection choices)
Constructor

Parameters:
choices - Choices to add to this list

ChoiceList

public ChoiceList(int initialCapacity)
Constructor

Parameters:
initialCapacity - Initial capacity of list
Method Detail

add

public void add(java.lang.Object object)
Parameters:
object - Object to add to list

addAll

public void addAll(java.util.Collection collection)
Add all the elements from a collection to this choice list

Parameters:
collection - The collection

attach

public void attach()
Description copied from interface: IChoiceList
Attaches model for use. This is generally used to fill in transient fields in a model which has been serialized during session replication.

Specified by:
attach in interface IChoiceList
See Also:
IChoiceList.attach()

choiceForId

public IChoice choiceForId(java.lang.String id)
Description copied from interface: IChoiceList
Gets an choice by id

Specified by:
choiceForId in interface IChoiceList
Parameters:
id - The choice's id
Returns:
The choice
See Also:
IChoiceList.choiceForId(java.lang.String)

choiceForObject

public IChoice choiceForObject(java.lang.Object object)
Specified by:
choiceForObject in interface IChoiceList
Parameters:
object - The object to find
Returns:
The choice for the object
See Also:
IChoiceList.choiceForObject(java.lang.Object)

clear

public void clear()
Clears this list


detach

public void detach()
Description copied from interface: IDetachable
Detaches model after use. This is generally used to null out transient references that can be re-attached later.

Specified by:
detach in interface IDetachable
See Also:
IDetachable.detach()

get

public IChoice get(int index)
Specified by:
get in interface IChoiceList
Parameters:
index - The index of the choice to get
Returns:
The choice
See Also:
IChoiceList.get(int)

getList

public java.util.List getList()
Returns:
Returns the list.

size

public int size()
Specified by:
size in interface IChoiceList
Returns:
Number of choices in the list
See Also:
IChoiceList.size()

newChoice

protected IChoice newChoice(java.lang.Object object,
                            int index)
IChoice factory method

Parameters:
object - Choice object
index - Index of choice
Returns:
The IChoice wrapper for the object at the given index


Copyright © 2004-2005 Wicket developers. All Rights Reserved.