WebObjects/Web Applications/Development/Examples/Calendar Component
Here is a little example on how to write a "calendar" component:
So you have a specific month, some of the dates are links (that will depend on what the calendar is for) and some basics navigations (next/previous month, year).
That's how the html could look like:
<webobject name = "Table"> <tr> <td align = "left" valign = "top" colspan = "7"> <webobject name = "Month"></webobject> <webobject name = "HasNavigation"> <webobject name = "YearLink"><webobject name = "Year"></webobject></webobject> </webobject> </td> </tr> <webobject name = "Rows"> <tr> <webobject name = "Columns"> <td align = "right" valign = "top"> <webobject name = "HasLink"> <webobject name = "IsCurrentDay"></webobject><webobject name = "Link"><webobject name = "Day"></webobject></webobject><webobject name = "IsCurrentDay"></webobject> </webobject> <webobject name = "HasNoLink"> <webobject name = "Day"></webobject> </webobject> </td> </webobject> </tr> </webobject> <webobject name = "HasNavigation"> <tr> <td align = "left" valign = "top" colspan ="3"> <webobject name = "HasPreviousMonth"> <small><webobject name = "PreviousMonthLink"><webobject name = "PreviousMonth"></webobject></webobject></small> </webobject> </td> <td align = "left" valign = "top"> </td> <td align = "right" valign = "top" colspan ="3"> <webobject name = "HasNextMonth"> <small><webobject name = "NextMonthLink"><webobject name = "NextMonth"></webobject></webobject></small> </webobject> </td> </tr> </webobject> </webobject>
And here is the wod:
Table: WOGenericContainer{ elementName = "table"; border = "0"; cellSpacing = "0"; cellPadding = "0"; }; HasNavigation: WOConditional { condition = hasNavigation; }; YearLink: WOHyperlink{ action = displayYear; }; Year: SpanString{ value = month.year; isBold = true; isSmall = true; class = "Label"; }; Rows: WORepetition{ count = rowCount; index = rowIndex; }; Columns: WORepetition{ count = columnCount; index = columnIndex; }; Month: SpanString{ value = month.monthName.toUpperCase; isBold = true; isSmall = true; class = "Label"; }; DayName: SpanString{ value = dayName; isSmall = true; class = "Label"; }; HasLink: WOConditional{ condition = hasLink; }; HasNoLink: WOConditional{ condition = hasLink; negate = true; }; IsCurrentDay: WOConditional{ condition = isCurrentDay; }; Link: WOHyperlink{ action = displayDay; }; Day: SpanString{ value = day.day; isSmall = true; isBold = isCurrentDay; isItalic = isCurrentDay; class = "Label"; }; HasNextMonth: WOConditional{ condition = hasNextMonth; }; NextMonthLink: WOHyperlink{ action = displayNextMonth; }; NextMonth: SpanString { value = nextMonthName; isSmall = true; class = "Label"; }; HasPreviousMonth: WOConditional{ condition = hasPreviousMonth; }; PreviousMonthLink: WOHyperlink{ action = displayPreviousMonth; }; PreviousMonth: SpanString{ value = previousMonthName; isSmall = true; class = "Label"; };
The component implementation is left to the imagination