|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.faces.application.ViewHandler org.apache.shale.tiles.TilesViewHandler
public class TilesViewHandler
This view handler strips the suffix off of the view ID and looks for a tile whose name matches the resulting string. For example, if the view ID is /tiles/test.jsp, this view handler will look for a tile named /tiles/test. If the tile is found, it is rendered; otherwise, this view handler delegates to the default JSF view handler.
To render a tile, this view handler first locates the tile by name. Then it creates or accesses the Tile Context, and stores the tile's attributes in the context. Finally, it dispatches the request to the tile's layout by calling JSF'sExternalContext.dispatch()
. Layouts typically
contain <tiles:insert> tags that include dynamic content.
If the request does not reference a tile, this view handler delegates
view rendering to the default view handler. That means that URLs like this:
http://localhost:8080/example/index.faces
will work as
expected.
Most of the methods in this class simply delegate to the default view
handler, which JSF passes to this view handler's constructor. The only
method that has a meaningful implementation is void
renderView(FacesContext, UIViewRoot)
, which renders the current
view in accordance with the algorithm discussed above.
Note: This Tiles view handler is tied to the standalone
version of Tiles, which resides in the Struts sandbox. This view handler
will not work with Struts Tiles.
Field Summary |
---|
Fields inherited from class javax.faces.application.ViewHandler |
---|
CHARACTER_ENCODING_KEY, DEFAULT_SUFFIX, DEFAULT_SUFFIX_PARAM_NAME |
Constructor Summary | |
---|---|
TilesViewHandler(javax.faces.application.ViewHandler defaultViewHandler)
Stores the reference to the default view handler for later use. |
Method Summary | |
---|---|
Locale |
calculateLocale(javax.faces.context.FacesContext context)
Pass through to the default view handler. |
String |
calculateRenderKitId(javax.faces.context.FacesContext context)
Pass through to the default view handler. |
javax.faces.component.UIViewRoot |
createView(javax.faces.context.FacesContext context,
String viewId)
Pass through to the default view handler. |
String |
getActionURL(javax.faces.context.FacesContext context,
String viewId)
Pass through to the default view handler. |
String |
getResourceURL(javax.faces.context.FacesContext context,
String path)
Pass through to the default view handler. |
void |
renderView(javax.faces.context.FacesContext facesContext,
javax.faces.component.UIViewRoot viewToRender)
Render a view according to the algorithm described in this class's description: Based on the view Id of the viewToRender ,
this method either renders a tile or delegates rendering to the default
view handler, which takes care of business as usual. |
javax.faces.component.UIViewRoot |
restoreView(javax.faces.context.FacesContext context,
String viewId)
Pass through to the default view handler. |
void |
writeState(javax.faces.context.FacesContext context)
Pass through to the default view handler. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TilesViewHandler(javax.faces.application.ViewHandler defaultViewHandler)
Stores the reference to the default view handler for later use.
defaultViewHandler
- The default view handlerMethod Detail |
---|
public void renderView(javax.faces.context.FacesContext facesContext, javax.faces.component.UIViewRoot viewToRender) throws IOException, javax.faces.FacesException
Render a view according to the algorithm described in this class's
description: Based on the view Id of the viewToRender
,
this method either renders a tile or delegates rendering to the default
view handler, which takes care of business as usual.
renderView
in class javax.faces.application.ViewHandler
facesContext
- The faces context object for this requestviewToRender
- The view that we're rendering
IOException
javax.faces.FacesException
public javax.faces.component.UIViewRoot createView(javax.faces.context.FacesContext context, String viewId)
Pass through to the default view handler.
createView
in class javax.faces.application.ViewHandler
public Locale calculateLocale(javax.faces.context.FacesContext context)
Pass through to the default view handler.
calculateLocale
in class javax.faces.application.ViewHandler
public String calculateRenderKitId(javax.faces.context.FacesContext context)
Pass through to the default view handler.
calculateRenderKitId
in class javax.faces.application.ViewHandler
public String getActionURL(javax.faces.context.FacesContext context, String viewId)
Pass through to the default view handler.
getActionURL
in class javax.faces.application.ViewHandler
public String getResourceURL(javax.faces.context.FacesContext context, String path)
Pass through to the default view handler.
getResourceURL
in class javax.faces.application.ViewHandler
public javax.faces.component.UIViewRoot restoreView(javax.faces.context.FacesContext context, String viewId)
Pass through to the default view handler.
restoreView
in class javax.faces.application.ViewHandler
public void writeState(javax.faces.context.FacesContext context) throws IOException
Pass through to the default view handler.
writeState
in class javax.faces.application.ViewHandler
IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |