com.arsdigita.cms
Class ItemSelectionModel

java.lang.Object
  extended bycom.arsdigita.kernel.ui.ACSObjectSelectionModel
      extended bycom.arsdigita.cms.ItemSelectionModel
All Implemented Interfaces:
com.arsdigita.kernel.ui.DomainObjectSelectionModel, com.arsdigita.bebop.SingleSelectionModel
Direct Known Subclasses:
FolderSelectionModel, SingleImageSelectionModel

public class ItemSelectionModel
extends com.arsdigita.kernel.ui.ACSObjectSelectionModel

Loads a subclass of a ContentItem from the database. This model should be used as a parameter to the constructor of authoring kit components.

It is possible to instantiate this model with a ContentType as a constructor parameter. In this case, the model will only instantiate items that have are of the specified content type, or one of it subclasses.

Version:
$Revision: #16 $ $DateTime: 2004/04/07 16:07:11 $
Author:
Stanislav Freidin (stas@arsdigita.com)
See Also:
ACSObjectSelectionModel, SingleSelectionModel

Field Summary
static String versionId
           
 
Constructor Summary
ItemSelectionModel(com.arsdigita.bebop.parameters.BigDecimalParameter parameter)
          Construct a new ItemSelectionModel.
ItemSelectionModel(ContentType type, com.arsdigita.bebop.parameters.BigDecimalParameter parameter)
          Construct a new ItemSelectionModel
ItemSelectionModel(ContentType type, com.arsdigita.bebop.SingleSelectionModel model)
          Construct a new ItemSelectionModel
ItemSelectionModel(ContentType type, String parameterName)
          Construct a new ItemSelectionModel
ItemSelectionModel(com.arsdigita.bebop.SingleSelectionModel model)
          Construct a new ItemSelectionModel.
ItemSelectionModel(String parameterName)
          Construct a new ItemSelectionModel.
ItemSelectionModel(String itemClass, String objectType, com.arsdigita.bebop.parameters.BigDecimalParameter parameter)
          Construct a new ItemSelectionModel
ItemSelectionModel(String itemClass, String objectType, com.arsdigita.bebop.SingleSelectionModel model)
          Construct a new ItemSelectionModel
ItemSelectionModel(String itemClass, String objectType, String parameterName)
          Construct a new ItemSelectionModel
 
Method Summary
 com.arsdigita.kernel.ACSObject createACSObject()
          A utility function which creates a new item.
 com.arsdigita.kernel.ACSObject createACSObject(BigDecimal id)
          Deprecated. Use createACSObject() instead
 ContentItem createItem()
          A utility function which creates a new item.
 ContentItem createItem(BigDecimal id)
          Deprecated. use createItem() instead
 ContentType getContentType()
           
 ContentItem getSelectedItem(com.arsdigita.bebop.PageState s)
          A convenience method that gets the currently selected object and casts it to a ContentItem
 
Methods inherited from class com.arsdigita.kernel.ui.ACSObjectSelectionModel
addChangeListener, clearSelection, getJavaClass, getObjectType, getSelectedKey, getSelectedObject, getSingleSelectionModel, getStateParameter, isInitialized, isSelected, loadACSObject, removeChangeListener, setSelectedKey, setSelectedObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

versionId

public static final String versionId
See Also:
Constant Field Values
Constructor Detail

ItemSelectionModel

public ItemSelectionModel(com.arsdigita.bebop.parameters.BigDecimalParameter parameter)
Construct a new ItemSelectionModel. This model will produce instances of ContentItem by automatically instantiating the correct Java subclass using the DomainObjectFactory.

Parameters:
parameter - The state parameter which should be used to store the object ID

ItemSelectionModel

public ItemSelectionModel(String parameterName)
Construct a new ItemSelectionModel. This model will produce instances of ContentItem by automatically instantiating the correct Java subclass using the DomainObjectFactory.

Parameters:
parameterName - The name of the state parameter which will be used to store the object ID.

ItemSelectionModel

public ItemSelectionModel(com.arsdigita.bebop.SingleSelectionModel model)
Construct a new ItemSelectionModel. This model will produce instances of ContentItem by automatically instantiating the correct Java subclass using the DomainObjectFactory.

Parameters:
model - The SingleSelectionModel which will supply a BigDecimal ID of the currently selected item

ItemSelectionModel

public ItemSelectionModel(ContentType type,
                          String parameterName)
Construct a new ItemSelectionModel

Parameters:
type - The content type for the items this model will generate
parameterName - The name of the state parameter which will be used to store the item.

ItemSelectionModel

public ItemSelectionModel(ContentType type,
                          com.arsdigita.bebop.parameters.BigDecimalParameter parameter)
Construct a new ItemSelectionModel

Parameters:
type - The content type for the items this model will generate
parameter - The state parameter which should be used by this item

ItemSelectionModel

public ItemSelectionModel(ContentType type,
                          com.arsdigita.bebop.SingleSelectionModel model)
Construct a new ItemSelectionModel

Parameters:
type - The content type for the items this model will generate
model - The SingleSelectionModel which will supply a BigDecimal id of the currently selected object

ItemSelectionModel

public ItemSelectionModel(String itemClass,
                          String objectType,
                          String parameterName)
Construct a new ItemSelectionModel

Parameters:
itemClass - The name of the Java class which represents the content item. Must be a subclass of ContentItem. In addition, the class must have a constructor with a single OID parameter.
objectType - The name of the persistence metadata object type which represents the content item. In practice, will often be the same as the itemClass.
parameterName - The name of the state parameter which will be used to store the item.

ItemSelectionModel

public ItemSelectionModel(String itemClass,
                          String objectType,
                          com.arsdigita.bebop.parameters.BigDecimalParameter parameter)
Construct a new ItemSelectionModel

Parameters:
itemClass - The name of the Java class which represents the content item. Must be a subclass of ContentItem. In addition, the class must have a constructor with a single OID parameter.
objectType - The name of the persistence metadata object type which represents the content item. In practice, will often be the same as the itemClass.
parameter - The state parameter which should be used by this item

ItemSelectionModel

public ItemSelectionModel(String itemClass,
                          String objectType,
                          com.arsdigita.bebop.SingleSelectionModel model)
Construct a new ItemSelectionModel

Parameters:
itemClass - The name of the Java class which represents the content item. Must be a subclass of ContentItem. In addition, the class must have a constructor with a single OID parameter.
objectType - The name of the persistence metadata object type which represents the content item. In practice, will often be the same as the itemClass.
model - The SingleSelectionModel which will supply a BigDecimal id of the currently selected object
Method Detail

createItem

public ContentItem createItem(BigDecimal id)
                       throws javax.servlet.ServletException
Deprecated. use createItem() instead

A utility function which creates a new item with the given ID. Uses reflection to create the instance of the class supplied in the constructor to this ItemSelectionModel.

Parameters:
id - The id of the new item -- this is now ignored
Returns:
The newly created item
Throws:
javax.servlet.ServletException

createItem

public ContentItem createItem()
                       throws javax.servlet.ServletException
A utility function which creates a new item. Uses reflection to create the instance of the class supplied in the constructor to this ItemSelectionModel.

Returns:
The newly created item
Throws:
javax.servlet.ServletException

getSelectedItem

public final ContentItem getSelectedItem(com.arsdigita.bebop.PageState s)
A convenience method that gets the currently selected object and casts it to a ContentItem

Parameters:
s - the current page state
Returns:
the currently selected ContentItem, or null if no item was selected.

createACSObject

public com.arsdigita.kernel.ACSObject createACSObject(BigDecimal id)
                                               throws javax.servlet.ServletException
Deprecated. Use createACSObject() instead

A utility function which creates a new item with the given ID. Uses reflection to create the instance of the class supplied in the constructor to this ItemSelectionModel.

Parameters:
id - The id of the new item -- this is now ignored
Returns:
The newly created item
Throws:
javax.servlet.ServletException

createACSObject

public com.arsdigita.kernel.ACSObject createACSObject()
                                               throws javax.servlet.ServletException
A utility function which creates a new item. Uses reflection to create the instance of the class supplied in the constructor to this ItemSelectionModel.

Returns:
The newly created item
Throws:
javax.servlet.ServletException

getContentType

public ContentType getContentType()
Returns:
The content type of the items which are produced by this model, or null if the content type has not been specified in the constructor.


Copyright (c) 2004 Red Hat, Inc. Corporation. All Rights Reserved. Generated at July 21 2004:2352 UTC