KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > lucane > applications > calendar > web > CalendarHeaderWidget


1 /*
2  * Lucane - a collaborative platform
3  * Copyright (C) 2004 Vincent Fiack <vfiack@mail15.com>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  */

19 package org.lucane.applications.calendar.web;
20
21 import java.io.IOException JavaDoc;
22 import java.io.Writer JavaDoc;
23 import java.text.DateFormat JavaDoc;
24 import java.util.Date JavaDoc;
25 import java.util.Locale JavaDoc;
26
27 import org.lucane.common.concepts.UserConcept;
28 import org.lucane.webconnector.WebApp;
29 import org.lucane.webconnector.widgets.Widget;
30 import org.lucane.webconnector.security.LucanePrincipal;
31
32 public class CalendarHeaderWidget implements Widget
33 {
34     private WebApp app;
35     private boolean my;
36     private String JavaDoc user;
37     
38     public CalendarHeaderWidget(WebApp app, boolean my, String JavaDoc user)
39     {
40         this.app = app;
41         this.my = my;
42         this.user = user;
43     }
44     
45     public void render(Writer JavaDoc out) throws IOException JavaDoc
46     {
47         out.write("<div id='calendar_header'>\n");
48         
49         if(my)
50         {
51             out.write("<a class='calendar_button' HREF='new_event.jsp'>");
52             out.write("<img SRC='images/new.png' alt='' />");
53             out.write(app.tr("btn.newEvent"));
54             out.write("</a>\n");
55         }
56         else
57         {
58             out.write("<a class='calendar_button' HREF='index.jsp'>");
59             out.write("<img SRC='images/other.png' alt='' />");
60             out.write(user);
61             out.write("</a>\n");
62         }
63
64         out.write("<a class='calendar_button' HREF='month.jsp?username=" + user + "'>");
65         out.write("<img SRC='images/jumpTo.png' alt='' />");
66         out.write(app.tr("btn.thisMonth"));
67         out.write("</a>\n");
68         
69         out.write("<a class='calendar_button' HREF='week.jsp?username=" + user + "'>");
70         out.write("<img SRC='images/jumpTo.png' alt='' />");
71         out.write(app.tr("btn.thisWeek"));
72         out.write("</a>\n");
73         
74         out.write("<a class='calendar_button' HREF='day.jsp?username=" + user + "'>");
75         out.write("<img SRC='images/jumpTo.png' alt='' />");
76         out.write(app.tr("btn.today"));
77         out.write("</a>\n");
78         
79         if(my)
80         {
81             out.write("<a class='calendar_button' HREF='other_calendars.jsp'>");
82             out.write("<img SRC='images/other.png' alt='' />");
83             out.write(app.tr("btn.otherCalendars"));
84             out.write("</a>\n");
85         }
86         
87         out.write("</div>\n");
88     }
89 }
Popular Tags