-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi all,
by implementing a DateFormatter Class for the zk calendar, i need information about the getCaptionByPopup() method.
I can not assign it to a visible date in the calendar. Can somebody explain me for what this is used?
@Override public String getCaptionByPopup(Date date, Locale locale, TimeZone timezone) { // TODO Auto-generated method stub return null; }
thanks
Stephan
According to:
http://docs.zkoss.org/wiki/ZK_Calendar
getCaptionByPopup() Returns the caption of the popup title
To use your own it is possible to utilize the function setDateFormatter() of the Calendar to change the implementation.
Hmmmm,
yes, i have implemented a custom DateFormatter.
But there is nothing that pops up.
I can see that the getCaptionByPopup() method is triggered automatically for every day by going in the month mold.
And i don't see at any place a string that i hardcoded as a return value.
Further i'm missing the place where the title should appears.
thanks
Stephan
Hi Stephan
I have created a sample
<zscript><![CDATA[ DateFormatter df = new SimpleDateFormatter(){ public String getCaptionByPopup(Date date, Locale locale, TimeZone timezone) { SimpleDateFormat df = new SimpleDateFormat("EEE, MMM/d", locale); df.setTimeZone(timezone); return "my " + df.format(date); } }; ]]></zscript> <calendars ...ignore.. dateFormatter="${df}">
You have to change to month view, and create event until "more" appear,
then click on "more", you will see the title of the popup has been changed
I can see that the getCaptionByPopup() method is triggered automatically for every day by going in the month mold.
It just send the all of text to client side, and reuse when the text be used
If you update the return value, you have to create a new instant of DateFormatter
due to
public void setDateFormatter(DateFormatter dfmater) { if (_dfmter != dfmater) {
maybe I can improve the part of process in further future.
Many thanks Jimmy,
this explaination should be written in the calendar docs/wiki where the DateFormatter methods are explained.
thanks
Stephan
Hi, All
I'm using the title variable
sce.setTitle(title);
to show same information and it is showed in day and week event.
but when I implement a dateFormatter in order to internalization the date format of the calendar like:
calendars.setDateFormatter(new DateFormatter() {
public String getCaptionByWeekOfYear(Date date, Locale locale, TimeZone timezone) {
SimpleDateFormat df = new SimpleDateFormat("w", locale);
df.setTimeZone(timezone);
return df.format(date);
}
public String getCaptionByTimeOfDay(Date date, Locale locale, TimeZone timezone) {
return "";
}
public String getCaptionByPopup(Date date, Locale locale, TimeZone timezone) {
SimpleDateFormat df = new SimpleDateFormat("EEE d MMM ", locale);
df.setTimeZone(timezone);
return df.format(date);
}
public String getCaptionByDayOfWeek(Date date, Locale locale, TimeZone timezone) {
SimpleDateFormat df = new SimpleDateFormat("EEE", locale);
df.setTimeZone(timezone);
return df.format(date);
}
public String getCaptionByDateOfMonth(Date date, Locale locale, TimeZone timezone) {
SimpleDateFormat df = new SimpleDateFormat("d MMM", locale);
df.setTimeZone(timezone);
return df.format(date);
}
public String getCaptionByDate(Date date, Locale locale, TimeZone timezone) {
SimpleDateFormat df = new SimpleDateFormat("EEE d MMM ", locale);
df.setTimeZone(timezone);
return df.format(date);
}
});
the title is not show any more.
is it a Bug, or there are same wrong in my code?
Thanks for your response.
Best Regards.
*/ public class DateFormatter extends SimpleDateFormatter implements DateFormatter, Serializable { . . . @Override public String getCaptionByDate(Date date, Locale locale, TimeZone timezone) { . . .
Hello ripoll
I have the same problem as described here
I am happy to see that you got it. Can you please explain me how did you resolved this ?
Asked: 2010-09-15 08:52:29 +0800
Seen: 804 times
Last updated: Mar 02 '15