cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gary Larsen" <gary.lar...@envisn.com>
Subject RE: Change widget label in action listener
Date Thu, 17 Jul 2008 20:25:19 GMT
Hi Chris,

 

Thanks for your expertise on this issue.  I think I may do a cheap fix on
this though, by creating two action widgets and hiding the one not
appropriate at the time.  

 

gary

 

  _____  

From: Christofer Dutz [mailto:christofer.dutz@c-ware.de] 
Sent: Thursday, July 17, 2008 1:06 PM
To: users@cocoon.apache.org
Subject: AW: Change widget label in action listener

 

Hi Gary,

 

I just had a look at your problem since the question sounded interesting. I
think I have to disappoint you here.

The label stuff is dealt with not in the Widget itself, but the
WidgetDefinition class, which is used to encapsulate the form-definition. 

As far as I could see it the label is initialized in the initializeForm
method, which sort of directly processes the form definition and the
setDisplayData method.

The only chance to modify the label seems to be, not to initialize it in the
form definition (No fd:label element) and then Passing a Map with you custom
label bound to the key "label" to the setDisplayData method:

 

Map labelMap = new HashMap();

labelMap.put("label", "my-cool-label");

((AbstractWidgetDefinition)
widget.getDefinition()).setDisplayData(labelMap);

 

Have to admit, that I reverse engineered this approach from the Cocoon
2.1.10 source and haven't tired it . would be very interested if it worked
though ;)

 

Chris

 

 

 

Von: Gary Larsen [mailto:gary.larsen@envisn.com] 
Gesendet: Donnerstag, 17. Juli 2008 17:28
An: users@cocoon.apache.org
Betreff: RE: Change widget label in action listener

 

I'm using Cocoon 2.1.9

 

  _____  

From: Gary Larsen [mailto:gary.larsen@envisn.com] 
Sent: Thursday, July 17, 2008 10:52 AM
To: users@cocoon.apache.org
Subject: Change widget label in action listener

 

I'm trying to change the label on an Action widget as part of the action.
There does not seem to be a 'label' member or Widget so I guessed it would
be an attribute, but these do not work:

 

                widget.setAttribute("label", new I18nMessage("text"));

 

                widget.setAttribute("widget-label", new
I18nMessage("text"));

 

Thanks for any suggestions.

 

gary


Mime
View raw message