You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Volker Weber <v....@inexso.de> on 2008/07/01 17:27:05 UTC

Re: date conversion in tooltip ?

Hi Michael,


2008/6/30 Michael Heinen <mh...@recommind.com>:
> I have to format a date inside a tooltip (or title attribute).
>
> Is there any way to apply a converter for a tooltip ?

afaik no.

>
> Or is it possible to call a converter via EL ?

afaik no.

>
>
>
> I fear that converters are always used with the value attribute of the outer
> tag.
>
> Any ideas ?

just one:

You can do many things using a managedBean implementing a java.util.Map.

class MyDateConverter extends AbstractMap {

  private SimpleDateFormat format = new SimpleDateFormat("dd.MM.yyyy hh:mm");

public Object get(Object key) {
   if (key instanceof Date) {
      return format.format((Date)key);
   }

  return null;
}

public Set entrySet() {}

}


tip="The date is #{myDateConverter[userBean.date]}"





>
>
>
> Michael



Regards,
    Volker


-- 
inexso - information exchange solutions GmbH
Bismarckstraße 13 | 26122 Oldenburg
Tel.: +49 441 4082 356 |
FAX: +49 441 4082 355 | www.inexso.de

RE: date conversion in tooltip ?

Posted by Michael Heinen <mh...@recommind.com>.
Thanks Volker.

That's exactly the way I did it also yesterday.
This is very often the last chance for some shortcomings in EL or JSF.

Michael

-----Original Message-----
From: weber.volker@googlemail.com [mailto:weber.volker@googlemail.com] On Behalf Of Volker Weber
Sent: Dienstag, 1. Juli 2008 17:27
To: MyFaces Discussion
Subject: Re: date conversion in tooltip ?

Hi Michael,


2008/6/30 Michael Heinen <mh...@recommind.com>:
> I have to format a date inside a tooltip (or title attribute).
>
> Is there any way to apply a converter for a tooltip ?

afaik no.

>
> Or is it possible to call a converter via EL ?

afaik no.

>
>
>
> I fear that converters are always used with the value attribute of the outer
> tag.
>
> Any ideas ?

just one:

You can do many things using a managedBean implementing a java.util.Map.

class MyDateConverter extends AbstractMap {

  private SimpleDateFormat format = new SimpleDateFormat("dd.MM.yyyy hh:mm");

public Object get(Object key) {
   if (key instanceof Date) {
      return format.format((Date)key);
   }

  return null;
}

public Set entrySet() {}

}


tip="The date is #{myDateConverter[userBean.date]}"





>
>
>
> Michael



Regards,
    Volker


-- 
inexso - information exchange solutions GmbH
Bismarckstraße 13 | 26122 Oldenburg
Tel.: +49 441 4082 356 |
FAX: +49 441 4082 355 | www.inexso.de