I'm not sure if I got you right. But I guess it would be a good idea
creating the getAction() method in your MenuTreeNode class instead of
the keyAccountProfileEditorController. The MenuTreeNode would just
delegate to the appropriate controller (which has been injected
before) based on its configuration through its properties.
As for the required icon, you can hide it easily by adding the
following stylesheet:
.AFRequiredIconStyle {display:none;}
On 11/8/06, Böhringer Jochen <[EMAIL PROTECTED]> wrote:
Hello,
I have adapted the example from the Trinidad documentation
(http://incubator.apache.org/adffaces/devguide/navigation.html) about Navigation to
fit my needs, but I have one major problem. I want to use the approach to have the
navigation hierarchy configured in the facelets-config.xml as a tree of managed beans
describing the label and action of the menu items. This way I can easily use
components like <tr:breadCrumbs> to render the way the user walked down the
navigation path.
This works pretty good if I specifiy an outcome in this configuration for every
item like this snippets shows:
<managed-bean>
<managed-bean-name>mtn_kape_editKeyAccount</managed-bean-name>
<managed-bean-class>de.tccproducts.kn.jsf.model.MenuTreeNode</managed-bean-class>
<managed-bean-scope>none</managed-bean-scope>
<managed-property>
<property-name>action</property-name>
<property-class>java.lang.String</property-class>
<value>showSearchKeyAccount</value>
</managed-property>
<managed-property>
<property-name>description</property-name>
<property-class>java.lang.String</property-class>
<value/>
</managed-property>
<managed-property>
<property-name>icon</property-name>
<property-class>java.lang.String</property-class>
<value/>
</managed-property>
<managed-property>
<property-name>label</property-name>
<property-class>java.lang.String</property-class>
<value>Edit Key Account</value>
</managed-property>
<managed-property>
<property-name>viewId</property-name>
<property-class>java.lang.String</property-class>
<value>/kape_editKeyAccount.xhtml</value>
</managed-property>
</managed-bean>
But I want to be able to use action methods instead of outcomes in the
configuration, because I have to do initialization work before showing some of
my screens.
<managed-property>
<property-name>action</property-name>
<property-class>java.lang.String</property-class>
<value>#{keyAccountProfileEditorController.showSearchKeyAccount}</value>
</managed-property>
But if I try to define a method binding in the action property of the managed
bean I get this exception:
Caused by: javax.faces.FacesException: Property action references object in a
scope with shorter lifetime than the target scope none
at
org.apache.myfaces.config.ManagedBeanBuilder.initializeProperties(ManagedBeanBuilder.java:164)
The reason is clear. The managed bean keyAccountProfileEditorController is on
session scope an the navigation is defined in scope none. But even if I switch
all navigation items to the session scope I get exceptions because the engine
tries to evaluate the expression as a bean property and not as a method
binding. So the engine tries to find a method getShowSearchKeyAccount in my
controller bean. Is there a workaround to realize what I want to do or do I
have to rethink about my design.
Btw. how can I disable the star in front of an inputText field which is marked
as required. I have tried to set the content in my skin, but this does not
help. Only setting the color to the same as the background is not sufficient
for me, because the layout is broken.
/** Style class that styles the .AFRequiredIcon icon. */
.AFRequiredIconStyle { content:""; }
Regards
Jochen