|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.myfaces.orchestra.viewController.DefaultViewControllerNameMapper
public class DefaultViewControllerNameMapper
Map view-ids to bean names, using a dirSubdirPage style format.
The strategy of this mapper is as follows:
RESERVED_WORDS
are prefixed with an underscore ('_');Examples:
Using a bean naming scheme provides the following benefits:
In particular, the separation between "UI designer" and "coder" remains; the UI designer can move and rearrange views without touching java code. They do need to change the bean mapping files, but that is not so significant.
The following limitations apply to this approach:
Some dependency-injection frameworks allow bean-name "aliases" to be defined, ie for a single managed-bean to have multiple names. This can be used to define one name that expressions reference the bean through, and a separate name that is used only in order to link that bean with the corresponding view. With this configuration, moving a view simply requires changing the name of the alias. If appropriate these aliases can be defined in a different configuration file from the "real" bean definitions (eg for the use of UI Designers). This approach does increase the number of managed-bean declarations required, so should only be applied where useful.
It is possible to define a very simple request-scoped bean for viewcontroller event handling that just delegates to another bean that is injected into it. This has the same effect as "bean aliasing" although it is implementable without "aliasing" support (and particularly, in plain JSF 1.1). This simple bean can be named after the view it controls, while the "real" backing bean can be named however it wishes. The same benefits and drawbacks apply as for the "aliases" approach described above.
It may be possible to also define aliases within the page definitions. In particular, for JSF the Apache Myfaces Tomahawk AliasBean can be used to define a local alias for a bean. If this is done at the top of a file, then when the view is moved, only that alias entry in the page needs to be altered rather than all expressions in the page.
Constructor Summary | |
---|---|
DefaultViewControllerNameMapper()
|
Method Summary | |
---|---|
String |
mapViewId(String viewId)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultViewControllerNameMapper()
Method Detail |
---|
public String mapViewId(String viewId)
mapViewId
in interface ViewControllerNameMapper
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |