Uses of Interface
com.arsdigita.cms.DomainObjectSelectionModel

Packages that use DomainObjectSelectionModel
com.arsdigita.cms Contains the core classes for the Red Hat Content Management System (CMS), classes that persist the fundamental objects for CMS such as content items, templates, content sections, and content types
 

Uses of DomainObjectSelectionModel in com.arsdigita.cms
 

Classes in com.arsdigita.cms that implement DomainObjectSelectionModel
 class ACSObjectSelectionModel
          Deprecated. Use ACSObjectSelectionModel

Loads a subclass of an ACSObject from the database. By default, uses a BigDecimal state parameter in order to store and retrieve the item ID.

The getSelectedKey(PageState state) method will return the BigDecimal ID of the currently selected object. This method will return the ID even if the object with this ID does not actually exist.

The getSelectedObject(PageState state) method will return the object whose ID is getSelectedKey(PageState state). If the object does not actually exist, the method will return null.

Thus, it is possible to implement the following pattern:

ACSObjectSelectionModel model = new ACSObjectSelectionModel(....);
 // ....
 ACSObject obj;
 if(model.isSelected(state)) {
   obj = (ACSObject) model.getSelectedObject(state);
   if (obj == null) {
     // Create a new object
     obj = model.createObject(model.getSelectedKey(state));
     model.setSelectedObject(state, obj);
   }
 }

The createObject method is merely a convenience method for instantiating the right subclass of ACSObject.

Advanced Usage: The ACSObjectSelectionModel is actually just a wrapper for a SingleSelectionModel which maintains the currently selected object's ID as a BigDecimal. By default, a new ParameterSingleSelectionModel is wrapped in this way; however, any SingleSelectionModel may be wrapped. Thus, it becomes possible to use the ACSObjectSelectionModel even if the currently selected ID is not stored in a state parameter.

 



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