Re: Usage of ACSObjectSelectionModel

Jeff Hoffman <[email protected]>
Newsgroups gmane.linux.redhat.ccm.general
Message-ID <[email protected]>
srini wrote:

> Hi,
> 
>     Could someone provide me with an example of the usage of 
> ACSObjectSelectionModel class in the com.arsdigita.kernel.ui package?

Srini,

Add the following component to a page of your choice. For 
m_model.isSelected() to return true, the item_id parameter must be 
specified. Any ID of a CMS article would be appropriate in this example.

class MyComponent extends SimpleComponent {
   ACSObjectSelectionModel m_model;

   public MyComponent() {
     super();
     m_model = new ACSObjectSelectionModel(
         "com.arsdigita.cms.Article",
         "com.arsdigita.cms.Article",
         "item_id");
   }

   public void register(Page p) {
     super.register(p);
     p.addComponentStateParam(this, m_model.getStateParameter());
   }

   public void doSomethingUseful(PageState s) {
     if (m_model.isSelected(s)) {
       Article item =
         (Article)m_model.getSelectedObject(s);
       // Do something with item..
     }
   }
}

Hope this helps.

Jeff K. Hoffman
Chief Technology Officer
Planned Giving Design Center


-- 
Redhat-ccm-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/redhat-ccm-list
Archives: https://www.redhat.com/pipermail/redhat-ccm-list/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.