BrightSide Workbench Full Report + Source Code
org.turro.html.calendar.HTMLCalendar Class Reference
Inheritance diagram for org.turro.html.calendar.HTMLCalendar:
Collaboration diagram for org.turro.html.calendar.HTMLCalendar:

Public Member Functions

 HTMLCalendar (IElement iel) throws IOException
 
Date getCurrentDate ()
 
void setDayRenderer (IDayRenderer dayRenderer)
 
void renderMonth ()
 
- Public Member Functions inherited from org.turro.html.HTMLComponent
 HTMLComponent (IElement iel) throws IOException
 
 HTMLComponent (IElement iel, boolean toString) throws IOException
 
void writeDate (Date date, String mode)
 
void writeNumber (Number number, String mode)
 
void writeBytes (long bytes)
 
void writeBoolean (boolean value)
 
void configureInPlaceEditor (IElement element, String ident, String component, String action, String params, int rows)
 
void configureFeditor (IElement element, String ident, String component, String action, String params, int rows)
 
String toString ()
 
void startElement (int mode)
 
void endElement (int mode)
 
void writeElement (int mode)
 
String strElement (int mode)
 
void setEditable (boolean editable)
 
- Public Member Functions inherited from org.turro.html.HTMLHelper
 HTMLHelper (IConstructor constructor, Writer out)
 
 HTMLHelper (IConstructor constructor)
 
 HTMLHelper (Writer out)
 
HTMLGenerator write (String value)
 
void writeMacro (String value)
 
void writeln (String value)
 
- Public Member Functions inherited from org.turro.html.HTMLGenerator
 HTMLGenerator ()
 
 HTMLGenerator (Writer out)
 
void setOut (Writer out)
 
void setExtraAttributes (String extraAttributes)
 
HTMLGenerator doTag (String tag)
 
HTMLGenerator doTag (String tag, String attributes)
 
HTMLGenerator doTag (String tag, String[] attributes)
 
HTMLGenerator startTag (String tag)
 
HTMLGenerator startTag (String tag, String attributes)
 
HTMLGenerator startTag (String tag, String[] attributes)
 
HTMLGenerator startExtAnchor (String url, String hint)
 
HTMLGenerator startTargetAnchor (String url, String target, String hint)
 
HTMLGenerator startAnchor (String url, String hint)
 
HTMLGenerator startAnchor (String url, String hint, String cssClass)
 
HTMLGenerator startAnchor (String url, String hint, String cssClass, String onClick)
 
HTMLGenerator startTable (String attributes)
 
HTMLGenerator startTable (String[] attributes)
 
HTMLGenerator endTable ()
 
HTMLGenerator startTableRow (String attributes)
 
HTMLGenerator startTableRow (String[] attributes)
 
HTMLGenerator endTableRow ()
 
HTMLGenerator startTableCol (String attributes)
 
HTMLGenerator startTableCol (String[] attributes)
 
HTMLGenerator endTableCol ()
 
HTMLGenerator endTag ()
 
HTMLGenerator endTag (String tag)
 
HTMLGenerator endBeforeTag (String tag)
 
HTMLGenerator endAllTags ()
 
boolean checkTag (String tag)
 
HTMLGenerator writeNewLine ()
 
HTMLGenerator writeSeparator ()
 
HTMLGenerator writeHorizontalStrut (int pixels)
 
HTMLGenerator startJavaScript ()
 
HTMLGenerator endJavaScript ()
 
HTMLGenerator startCSS ()
 
HTMLGenerator endCSS ()
 
HTMLGenerator addCSSLink (String cssFile)
 
HTMLGenerator addJavaScriptLink (String jsFile)
 
- Public Member Functions inherited from org.turro.html.IHTMLRenderable
void setOut (Writer out)
 

Protected Attributes

IDayRenderer dayRenderer = null
 
Date date
 
Locale locale
 
String[] dayNames
 
- Protected Attributes inherited from org.turro.html.HTMLComponent
IElement iel
 
boolean editable = false
 
StringWriter sw = null
 
- Protected Attributes inherited from org.turro.html.HTMLHelper
IConstructor constructor = null
 
- Protected Attributes inherited from org.turro.html.HTMLGenerator
Stack tags = new Stack()
 
Writer out = null
 

Additional Inherited Members

- Static Public Attributes inherited from org.turro.html.IHTMLRenderable
static final int MODE_FULL = 0
 
static final int MODE_MEDIUM = 1
 
static final int MODE_SMALL = 2
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 34 of file HTMLCalendar.java.

Constructor & Destructor Documentation

◆ HTMLCalendar()

org.turro.html.calendar.HTMLCalendar.HTMLCalendar ( IElement  iel) throws IOException

Creates a new instance of HTMLCalendar

Definition at line 41 of file HTMLCalendar.java.

41  {
42  super(iel);
44  locale = I_.api().used();
45  dayNames = CalendarUtil.getDayNames(locale, true);
46  monthNames = CalendarUtil.getMonthNames(locale, false);
47 
48  // Calendar state
49  String sdate = constructor.getParameter("caldate");
50  if(sdate != null) {
51  date = (Date) ObjectString.parseString(sdate, ObjectString.COMPRESSED_DATE_PATTERN, Date.class, true);
53  }
54  else {
55  date = (Date)constructor.getSessionAttribute("caldate");
56  }
57  if(date == null) date = new Date();
58  }
void setSessionAttribute(String key, Object value)
Here is the call graph for this function:

Member Function Documentation

◆ getCurrentDate()

Date org.turro.html.calendar.HTMLCalendar.getCurrentDate ( )

Definition at line 60 of file HTMLCalendar.java.

60  {
61  // hour and minute to current
62  Calendar today = Calendar.getInstance(locale);
63  Calendar cal = Calendar.getInstance(locale);
64  cal.setTime(date);
65  cal.set(Calendar.HOUR_OF_DAY, today.get(Calendar.HOUR_OF_DAY));
66  cal.set(Calendar.MINUTE, today.get(Calendar.MINUTE));
67  cal.set(Calendar.SECOND, 0);
68  return date;
69  }

◆ renderMonth()

void org.turro.html.calendar.HTMLCalendar.renderMonth ( )

Definition at line 75 of file HTMLCalendar.java.

75  {
76  Calendar cal = Calendar.getInstance(locale);
77  cal.setTime(date);
78  int day = cal.get(Calendar.DAY_OF_MONTH),
79  month = cal.get(Calendar.MONTH),
80  year = cal.get(Calendar.YEAR);
81  renderMonthTitle();
82  startTag("table", new String[] {
83  "cellspacing=1",
84  "cellpadding=0",
85  "class='wcalendar'"
86  });
87  startTag("thead");
88  startTag("tr");
89  startTag("td", "class='week'");
90  endTag();
91  for(int i = 0; i < 7; i++) {
92  startTag("td");
93  write(dayNames[i]);
94  endTag();
95  }
96  endTag();
97  endTag();
98  startTag("tbody");
99  CalendarUtil.positionFirstCell(cal);
100  while(true) {
101  startTag("tr");
102  startTag("td", "class='week'");
103  startAnchor(
104  "?calweek=" + cal.get(Calendar.WEEK_OF_YEAR),
105  "",
106  "daymonth"
107  );
108  write("" + cal.get(Calendar.WEEK_OF_YEAR));
109  endTag();
110  endTag();
111  for(int i = 0; i < 7; i++) {
112  if(cal.get(Calendar.MONTH) == month) {
113  if(cal.get(Calendar.DAY_OF_MONTH) == day) {
114  startTag("td", "class='selected'");
115  }
116  else {
117  startTag("td", "class='inmonth'");
118  }
119  }
120  else {
121  startTag("td", "class='outmonth'");
122  }
123  startAnchor(
124  "?caldate=" + ObjectString.formatObject(cal.getTime(), ObjectString.COMPRESSED_DATE_PATTERN, false),
125  "",
126  "daymonth"
127  );
128  write("" + cal.get(Calendar.DAY_OF_MONTH));
129  endTag();
130  if(dayRenderer != null) dayRenderer.renderDay(cal.getTime(), this);
131  cal.add(Calendar.DAY_OF_MONTH, 1);
132  }
133  endTag();
134  if(cal.get(Calendar.MONTH) > month || cal.get(Calendar.YEAR) > year) break;
135  }
136  endAllTags();
137  startTag("div", "class='wcalfooter'");
138  renderToday();
139  renderPreviousMonth();
140  renderNextMonth();
141  endTag();
142  }
HTMLGenerator startTag(String tag)
HTMLGenerator startAnchor(String url, String hint)
HTMLGenerator write(String value)
Definition: HTMLHelper.java:69
void renderDay(Date date, HTMLCalendar calendar)
Here is the call graph for this function:

◆ setDayRenderer()

void org.turro.html.calendar.HTMLCalendar.setDayRenderer ( IDayRenderer  dayRenderer)

Definition at line 71 of file HTMLCalendar.java.

71  {
72  this.dayRenderer = dayRenderer;
73  }

Member Data Documentation

◆ date

Date org.turro.html.calendar.HTMLCalendar.date
protected

Definition at line 36 of file HTMLCalendar.java.

◆ dayNames

String [] org.turro.html.calendar.HTMLCalendar.dayNames
protected

Definition at line 38 of file HTMLCalendar.java.

◆ dayRenderer

IDayRenderer org.turro.html.calendar.HTMLCalendar.dayRenderer = null
protected

Definition at line 35 of file HTMLCalendar.java.

◆ locale

Locale org.turro.html.calendar.HTMLCalendar.locale
protected

Definition at line 37 of file HTMLCalendar.java.


The documentation for this class was generated from the following file: