|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.davesag.jsf.AbstractContextAwareBean
com.davesag.jsf.AbstractHandler
The AbstractHandler is a base class for you to develop your own
handler Managed Beans. To implement a specific handler for your
own data types simply fill in the methods to do the following:
loadById(Object id) - returns an object, given some
unique id.modelToView - map data from the handled object
to the form fields
Handlers correspond to a read only controller
component of the MVC pattern.
| Field Summary | |
static String |
CANCEL
cancel indicates the user released the item without saving. |
static String |
ERROR
error indicates an error occured |
static String |
SUCCESS
success indicates that the action was performed okay |
protected Map |
theFields
A Map of Public facing properties that are referenced by the JSF tags. |
protected Object |
theItem
The object being handled by this handler. |
| Constructor Summary | |
AbstractHandler()
Default Constructor that resets the map and item. |
|
| Method Summary | |
protected void |
clear()
resets the active item back to null and the form fields map to empty; |
Map |
getFields()
Gets the map containing form fields |
Object |
getItem()
gets the item. |
boolean |
isActive()
is there currently a bean being handled? |
String |
load()
Loads the item with an id obtained from the request string. |
protected abstract Object |
loadById(Object id)
Loads the item with the given an id. |
protected abstract Map |
modelToView(Object model,
Map view)
populate a field map with data from an object. |
String |
view()
an alias for load(). |
| Methods inherited from class com.davesag.jsf.AbstractContextAwareBean |
addMessage, getContext, getMessageBundleName, getRequestParameter, getServletContext, getSession |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final String ERROR
public static final String CANCEL
public static final String SUCCESS
protected Object theItem
protected Map theFields
| Constructor Detail |
public AbstractHandler()
session managed beans under a JSF framework. Hence
they are only constructed once and then repeatedly cleared.
| Method Detail |
protected abstract Object loadById(Object id)
throws Exception
id - The unique id, or query object of the obejct/s you wish to load.
Exception - if anything bad happens.
protected abstract Map modelToView(Object model,
Map view)
javax.faces.ConverterException?
model - The object whose data you wish to map to the view.view - The map of properties captured from the user interface.
public Map getFields()
getFields in interface Handlerpublic boolean isActive()
isActive in interface Handlerpublic Object getItem()
getItem in interface Handlerpublic String load()
load in interface Handlerpublic String view()
load().
protected void clear()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||