google-code-export / zkcalendar

Automatically exported from code.google.com/p/zkcalendar
1 stars 1 forks source link

Event title #4

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

I have set a title of the event. The title is not displayed if the event is
"allday event" or in the "mold=month". I know I can change the event
renderer, but I think the default event renderer should use the event title
and not the content for displaying allday events and the mold=month.

FYI: The default SimpleEventRender uses getTitle() only in the drawDay()
method. The other methods drawAllDay(), drawAllDayByMonth() and
drawDayByMonth() uses only getContent() method. From my point of view, it
is an inconsistent behaviour. But I understand someone might done it on
purpose.

Original issue reported on code.google.com by xmed...@gmail.com on 19 Jan 2010 at 3:55

GoogleCodeExporter commented 9 years ago

Original comment by jumperc...@gmail.com on 20 Jan 2010 at 6:17

GoogleCodeExporter commented 9 years ago

Original comment by jumperc...@gmail.com on 3 Feb 2010 at 4:50

GoogleCodeExporter commented 9 years ago
The title text is 'xx-xx',
how to know what event was booked if them show on daylong,
maybe you want show 'xx-xx something', you can just set them in content

Original comment by jimmyshi...@gmail.com on 4 Feb 2010 at 7:10

GoogleCodeExporter commented 9 years ago
So you suppose, if the user created event with title: "My Event", she should 
also
start content as "My Event something ....". I do not find it as a good solution.

I have filled this bug just to warn you about a small inconsistency in the
SimpleEventRender. I do not care much about the solution of this issue - I can 
easily
change SimpleEventRender for anything else.

Original comment by xmed...@gmail.com on 4 Feb 2010 at 8:14

GoogleCodeExporter commented 9 years ago
I have solved this issue. I have made the method:

/**
     * Makes a title from event - takes an event title or a event content, if the event
title is empty.
     * 
     * @param event
     * @param maxchars
     *            Maximum chars returned. If less or equal to zero, then everything is
returned.
     * @return
     */
    private static String getTitle(CalendarEvent event, int maxchars) {
        String title = event.getTitle();
        if (Strings.isEmpty(title)) { // title empty, take content as title
            title = event.getContent();
            if (Strings.isEmpty(title)) {
                return title; // everything's empty
            }
        }
        // trim it
        title = title.trim();
        if (maxchars > 0 && title.length() > maxchars) {
            title = title.substring(0, maxchars);
        }
        return title;
    }

And I have placed "getTitle(self, xx)" instead of "self.getContent()" in
SimpleEventRenderer in the methods drawAllDay, drawAllDayByMonth, 
drawDayByMonth.

Original comment by xmed...@gmail.com on 23 Feb 2010 at 3:50

GoogleCodeExporter commented 9 years ago
Fixed in 1.0.0 experimental branch

Original comment by xmed...@gmail.com on 25 Feb 2010 at 1:13

GoogleCodeExporter commented 9 years ago

Original comment by jimmyshi...@gmail.com on 19 Jul 2011 at 9:07