Hi Stefan,

ULCTree displays values from its node's model so it does not help to set
value on a renderer.

As Etienne pointed out in
http://www.jroller.com/page/ulc/?anchor=renderer_limitations, you will need
to decorate the model.

In your case you can decorate your TreeNode or your User Object (that is set
in TreeNode) and return a locale based text in the toString() method of the
decorator.

I hope this helps.

Thanks and regards,

Janak


>-----Original Message-----
>From: [EMAIL PROTECTED]
>[mailto:[EMAIL PROTECTED] Behalf Of
>[EMAIL PROTECTED]
>Sent: Friday, May 12, 2006 12:10 PM
>To: [email protected]
>Subject: [ULC-developer] ULCTree always uses toString()
>
>
>
>Hello
>
>I'm using an ULCTree with a custom TreeCellRenderer.
>In the TreeCellRenderer I like to set the text for each item, based on the
>locale.
>This does not work, because the method MyElement>>toString() is always used
>to get the text for the tree.
>
>Is there a possibilty that the ULCTree does not use toString(), but the
>text which I set in the CellRenderer?
>Or is something that I'm doing wrong?
>
>Thanks for any help
>
>Please find here MyTreeCellRenderer:
>*******************************************************************
>************************
>public class MyTreeCellRenderer extends DefaultTreeCellRenderer {
>
>public Locale currentLocale;
>
>public IRendererComponent getTreeCellRendererComponent(ULCTree tree, Object
>value, boolean selected, boolean expanded, boolean leaf, boolean hasFocus)
>{
>
>      super.getTreeCellRendererComponent(tree, value, selected, expanded,
>leaf, hasFocus);
>
>      MyElement element = (MyElement) value;
>
>      /* gets the text for the currentLocale, MyElement doesn't know the
>currentLocale*/
>      String text = element.getText(currentLocale);
>      setText(text);
>
>      return this;
>}
>}
>
>***********************************
>********************************************************
>
>Stefan Marti
>DV Bern AG
>
>--
>mailto:[EMAIL PROTECTED]  /  http://www.dvbern.ch
>Nussbaumstrasse 21, Postfach 106, CH-3000 Bern 22
>Telefon:  ++41 +31 378 24 24 / Telefax:  ++41 +31 378 24 74
>
>_______________________________________________
>ULC-developer mailing list
>[email protected]
>http://lists.canoo.com/mailman/listinfo/ulc-developer

_______________________________________________
ULC-developer mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/ulc-developer

Reply via email to