On Wed, Apr 22, 2009 at 9:36 AM, Döring Markus
<[email protected]> wrote:
> Hi all,
>
>
>
> my goal is to have an EJB backing bean like the following:
>
>
>
> @Entity
>
> public class EntityBean {
>
>                 //… id stuff and else properties
>
>
>
>                 private String color;
>
>
>
>                 public String getColor() {
>
>                                 return color;
>
>                 }
>
>                 public void setColor(String color) {
>
>                                this.color = color;
>
>                 }
>
> }
>
>
>
> and directly getting / setting the value from / to and <tr:inputColor>
>
>
>
> <ui:composition>
>
> <tr:panelFormLayout>
>
> <tr:inputColor label=”Select color” value=”#{entity.color}”>
>
> </tr:panelFormLayout>
>
> </ui:composition>
>
>
>
> Is is in some possible?
>
> I already tried it with the <tr:convertColor> converter, but the value that
> is passed to the entity is always a java.awt.color instance (causing an
> argument type mismatch on submit of the form).
>
> One way I can think of is to put @Transient getter / setter in the
> EntityBean that convert from color to string and vice versa. But this would
> be ugly because there will be more than one color in the EntityBean what
> would result in A LOT OF duplicated getter/setter just for converting stuff.

have you tried a custom converter that internally uses the Trinidad
ColorConverter
but returns a String of the java.awt.Color ?

Like:

getAsObject(...)
{
...
Color c = ctrinidadColorConv.getAsObject(...);
return c.toString();
}

-M

>
>
>
> Any easy way to handle this?
>
>
>
> Thanks for help
>
> Markus
>
>
>
> PS. I’m using JBoss 4.2.2, Myfaces 1.1.5, Trinindad 1.0.7, Facelets 1.1.13



-- 
Matthias Wessendorf

blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
twitter: http://twitter.com/mwessendorf

Reply via email to