org.apache.shale.usecases.rolodex
Class Rolodex

java.lang.Object
  extended by org.apache.shale.view.AbstractFacesBean
      extended by org.apache.shale.view.AbstractViewController
          extended by org.apache.shale.usecases.rolodex.Rolodex
All Implemented Interfaces:
org.apache.shale.view.ViewController

public class Rolodex
extends org.apache.shale.view.AbstractViewController

The ViewController for the rolodex use case. This is a contacts list that is to demonstrate the reuse ability for the Clay component.


Constructor Summary
Rolodex()
           
 
Method Summary
 String changeTab()
           This action event is fired when clicking on a tab link.
protected  org.apache.shale.clay.config.beans.ElementBean createCommandLinkMetadata(javax.faces.model.SelectItem item, javax.faces.context.FacesContext context)
           Creates an object graph uses to build the rolodex folder tabs dynamically.
 void createTabs(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, Object displayElementRoot)
           This is a method binding event fired from the Clay component before building the component tree.
protected  org.apache.shale.clay.config.beans.ElementBean createVerbatimMetadata(String html, javax.faces.context.FacesContext context)
           This mehtod builds a simple verbatim meta tag.
protected  org.apache.shale.clay.config.beans.ElementBean createVerbatimMetadata(String html, String renderExp, javax.faces.context.FacesContext context)
           This method builds a verbatim meta tag.
 String deleteContact()
           Removes a Contact from the mock data store.
 List getContactsForTab()
           This is called by the data table component to return a list of Contacts that belong within the selected index.
 Contact getSelectedContact()
           Returns the selected contact for edit.
 int getSelectedTab()
           Returns the current tab index.
 String newContact()
           Creates a new Contact instance to be entered and saved.
 String saveContact()
           Saves a Contact to the mock data store.
 String selectContact()
           This is an action event fired from clicking on a contact in the data grid.
 void setSelectedContact(Contact contact)
           Sets the selected contact for edit.
 void setSelectedTab(int index)
           Records a change in tab index.
 
Methods inherited from class org.apache.shale.view.AbstractViewController
destroy, init, isPostBack, preprocess, prerender, setPostBack
 
Methods inherited from class org.apache.shale.view.AbstractFacesBean
erase, error, error, fatal, fatal, getApplication, getApplicationMap, getBean, getExternalContext, getFacesContext, getLifecycle, getRequestHeaderMap, getRequestMap, getRequestParameter, getRequestParameterMap, getRequestParameterValues, getSessionMap, getValue, info, info, log, log, retrieveData, saveData, setBean, setValue, warn, warn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Rolodex

public Rolodex()
Method Detail

getSelectedTab

public int getSelectedTab()

Returns the current tab index.


getSelectedContact

public Contact getSelectedContact()

Returns the selected contact for edit.


setSelectedContact

public void setSelectedContact(Contact contact)

Sets the selected contact for edit.


setSelectedTab

public void setSelectedTab(int index)

Records a change in tab index.


createCommandLinkMetadata

protected org.apache.shale.clay.config.beans.ElementBean createCommandLinkMetadata(javax.faces.model.SelectItem item,
                                                                                   javax.faces.context.FacesContext context)

Creates an object graph uses to build the rolodex folder tabs dynamically.

Parameters:
item - - SelectItem holding the information to create the tab link
context - - FacesContext
Returns:
returns a top level clay meta component bean

createVerbatimMetadata

protected org.apache.shale.clay.config.beans.ElementBean createVerbatimMetadata(String html,
                                                                                String renderExp,
                                                                                javax.faces.context.FacesContext context)

This method builds a verbatim meta tag. It is passed a "rendered" expression that will be evaluated to determine if the component is visible.

Parameters:
html - The HTML tag to write to the document
renderExp - A value binding EL for the "rendered" attribute.
context - faces context
Returns:
A clay element bean used to construct a faces outputText component.

createVerbatimMetadata

protected org.apache.shale.clay.config.beans.ElementBean createVerbatimMetadata(String html,
                                                                                javax.faces.context.FacesContext context)

This mehtod builds a simple verbatim meta tag. The value will not be escaped.

Parameters:
html - HTML tag to write to the document
context - - faces context
Returns:
A clay element bean used to construct a faces outputText component.

changeTab

public String changeTab()

This action event is fired when clicking on a tab link. The selectedTab is set with the value of the tabIndex request parameter.


createTabs

public void createTabs(javax.faces.context.FacesContext context,
                       javax.faces.component.UIComponent component,
                       Object displayElementRoot)

This is a method binding event fired from the Clay component before building the component tree. The method signature is a "Validator" event signature and the binding attribute is shapeValidator.

Parameters:
context - facesContext
component -
displayElementRoot -

getContactsForTab

public List getContactsForTab()

This is called by the data table component to return a list of Contacts that belong within the selected index.


selectContact

public String selectContact()

This is an action event fired from clicking on a contact in the data grid. The latest contact is located using the data access object and is set as the "select" contact.


saveContact

public String saveContact()

Saves a Contact to the mock data store.


deleteContact

public String deleteContact()

Removes a Contact from the mock data store.


newContact

public String newContact()

Creates a new Contact instance to be entered and saved.



Copyright © 2004-2007 Apache Software Foundation. All Rights Reserved.