de.enough.polish.calendar
Class CalendarItem

java.lang.Object
  extended by javax.microedition.lcdui.Item
      extended by javax.microedition.lcdui.CustomItem
          extended by de.enough.polish.ui.FakeCustomItem
              extended by de.enough.polish.ui.FakeContainerCustomItem
                  extended by de.enough.polish.ui.TableItem
                      extended by de.enough.polish.calendar.CalendarItem

public class CalendarItem
extends TableItem

Displays a calendar for a specific month

Copyright Enough Software 2009-2010

Author:
Robert Virkus, j2mepolish@enough.de

Field Summary
static int SHOW_MODE_ITEM
          Show mode for displaying the current month and year within the item that has been specified with setMonthItem().
static int SHOW_MODE_LABEL
          Show mode for displaying the current month and year within the label of this CalendarItem.
static int SHOW_MODE_NONE
          Show mode for not displaying the current month and year.
static int SHOW_MODE_TITLE
          Show mode for displaying the current month and year within the title of this CalendarItem's screen.
 
Fields inherited from class de.enough.polish.ui.TableItem
columnWidths, completeWidth, font, fontColor, LINE_STYLE_DOTTED, LINE_STYLE_INVISIBLE, LINE_STYLE_SOLID, lineColor, lineStroke, rowHeights, selectedBackground, selectedColumnBackground, selectedRowBackground, SELECTION_MODE_CELL, SELECTION_MODE_COLUMN, SELECTION_MODE_INTERACTIVE, SELECTION_MODE_NONE, SELECTION_MODE_NONEMPTY, SELECTION_MODE_ROW, selectionMode, tableData, targetXOffset, xOffset
 
Fields inherited from class de.enough.polish.ui.FakeContainerCustomItem
allowCycling, autoFocusEnabled, autoFocusIndex, containerView, enableScrolling, focusAllStyle, focusedIndex, focusedItem, focusedStyleFirst, focusedStyleLast, isExpandItems, itemsList, itemStyle, lastPointerPressTime, lastPointerPressY, lastPointerPressYOffset, plainStyle, SCROLL_DEFAULT, SCROLL_SMOOTH, scrollHeight, scrollSmooth, targetYOffset, yOffset
 
Fields inherited from class de.enough.polish.ui.FakeCustomItem
_bbField, appearanceMode, availableHeight, availableWidth, availContentHeight, availContentWidth, background, backgroundHeight, backgroundWidth, backgroundYOffset, beforeWidth, bgBorder, border, BUTTON, cacheItemImage, colSpan, commands, completeBackground, completeBackgroundPadding, completeBorder, contentHeight, contentWidth, contentX, contentXAdjustment, contentY, contentYAdjustment, cssHeight, cssSelector, cssWidth, defaultCommand, focusedStyle, HORIZONTAL, HYPERLINK, ignoreRepaintRequests, includeLabel, INTERACTIVE, internalHeight, internalWidth, internalX, internalY, isContentVisible, isFocused, isInlineLabel, isInvisible, isLayoutCenter, isLayoutExpand, isLayoutRight, isPressed, isShown, isStyleInitialised, itemCommandListener, itemHeight, itemWidth, label, labelStyle, landscapeStyle, layout, LAYOUT_2, LAYOUT_BOTTOM, LAYOUT_CENTER, LAYOUT_DEFAULT, LAYOUT_EXPAND, LAYOUT_LEFT, LAYOUT_NEWLINE_AFTER, LAYOUT_NEWLINE_BEFORE, LAYOUT_RIGHT, LAYOUT_SHRINK, LAYOUT_TOP, LAYOUT_VCENTER, LAYOUT_VEXPAND, LAYOUT_VSHRINK, marginBottom, marginLeft, marginRight, marginTop, maximumHeight, maximumItemHeight, maximumItemWidth, maximumWidth, minimumHeight, minimumItemHeight, minimumItemWidth, minimumWidth, nativeItem, NO_POSITION_SET, opacity, opacityPaintNormally, opacityRgbData, paddingBottom, paddingHorizontal, paddingLeft, paddingRight, paddingTop, paddingVertical, parent, PLAIN, portraitStyle, preferredHeight, preferredWidth, preserveViewType, relativeX, relativeY, rowSpan, screen, setView, style, TRANSPARENT, useSingleRow, VERTICAL, view, xAdjustment, yAdjustment
 
Fields inherited from class javax.microedition.lcdui.CustomItem
KEY_PRESS, KEY_RELEASE, KEY_REPEAT, NONE, POINTER_DRAG, POINTER_PRESS, POINTER_RELEASE, TRAVERSE_HORIZONTAL, TRAVERSE_VERTICAL
 
Constructor Summary
CalendarItem()
          Creates a new Calendar Item with the current month shown.
CalendarItem(Calendar cal)
          Creates a new Calendar Item.
CalendarItem(Calendar cal, Style style)
          Creates a new Calendar Item.
CalendarItem(Style style)
          Creates a new Calendar Item with the current month shown.
CalendarItem(TimePoint timePoint)
          Creates a new Calendar Item.
CalendarItem(TimePoint originalDay, CalendarEntryModel model)
          Creates a new Calendar Item.
CalendarItem(TimePoint originalDay, CalendarEntryModel model, Style style)
          Creates a new Calendar Item.
CalendarItem(TimePoint originalDay, Style style)
          Creates a new Calendar Item.
 
Method Summary
protected  void buildCalendar(TimePoint forMonth)
          Builds up this calendar for the specified point in time
static Item createCalendaryDay(TimePoint day, TimePoint currentMonth, TimePoint originalCurrentDay, CalendarEntry[] entriesForTheDay, CalendarItem parent)
          Creates an item that represents a day within this CalendarItem
protected  Item createCalendaryDay(TimePoint day, TimePoint currentMonth, TimePoint originalCurrentDay, CalendarEntry[] entriesForTheDay, int col, int row)
          Creates an item that represents a day within this CalendarItem
 Style getCalendarCurrentdayStyle()
          Gets the style for the currently selected calendar day entry, if different from .calendarCurrentDay
 Style getCalendarDayInactiveStyle()
          Gets the style for days of another month, if different from .calendarDayInactive
 Style getCalendarDayStyle()
          Gets the style for a normal calendar day entry, if different from .calendarDay
 Style getCalendarWeekdayStyle()
          Gets the style for the headings of this calendar, if different from .calendarWeekday
 Calendar getCellCalendar(int row, int col)
          Retrieves the Calendar of the given row and column within the shown Calendar
 TimePoint getCellTimePoint(int row, int col)
          Retrieves the TimePoint of the given row and column within the shown Calendar
 int getColumn(TimePoint day)
          Retrieves the column for the specified day
 int getDaysInMonth()
          Retrieves the days within the currently shown month
static int getDaysInMonth(Calendar cal)
          Deprecated.  
static int getFirstDayOfWeek()
          Retrieves the first day of the week, typically either Calendar.SUNDAY or Calendar.MONDAY.
 CalendarEntryModel getModel()
          Retrieves the model used in this CalendarItem
static String getMonths()
          Retrieves the names of the month in a comma separated list.
 int getRow(TimePoint day)
          Retrieves the row for the specified day
 Calendar getSelectedCalendar()
          Retrieves the currently selected day as a Calendar
 Date getSelectedDate()
          Retrieves the currently selected day as a Date
 TimePoint getSelectedTimePoint()
          Retrieves the currently selected day as a TimePoint
 int getShowMode()
          Retrieves the visualization for the year and month
 int getShownMonth()
          Retrieves the shown month
 TimePoint getShownTimePoint()
          Retrieves the shown month as a TimePoint
 TimePeriod getValidPeriod()
          Retrieves the time range that is valid for this instance.
static String getWeekDayAbbreviations()
          Retrieves a comma separated list of abbreviations for week days.
 void go(TimePoint day)
          Goes to the specified day.
 boolean goNextMonth()
          Moves this calendar to the next month
 boolean goPreviousMonth()
          Moves this calendar to the previous month
protected  boolean handleKeyPressed(int keyCode, int gameAction)
          Handles the key-pressed event.
protected  boolean handlePointerReleased(int relX, int relY)
          Handles the event when a pointer has been released at the specified position.
protected  void initContent(int firstLineWidth, int availWidth, int availHeight)
          Initialises this item.
 void setCalendarCurrentdayStyle(Style calendarCurrentdayStyle)
          Sets the style for the currently selected calendar day entry
 void setCalendarDayInactiveStyle(Style calendarDayInactiveStyle)
          Sets the style for days of another month
 void setCalendarDayStyle(Style calendarDayStyle)
          Sets the style for a normal calendar day entry
 void setCalendarInactiveDaysAreInteractive(boolean isInteractive)
          Specifies whether days that are outside of the current month can be selected
 void setCalendarWeekdayStyle(Style calendarWeekdayStyle)
          Sets the style for the headings of this calendar
 void setDayDefaultCommand(Command cmd)
          Sets the default command for days.
 void setDayDefaultCommand(Command cmd)
          Sets the default command for days.
 void setEditable(boolean isInteractive)
          Enables or disables the interactivity state of this calendar item.
static void setFirstDayOfWeek(int firstDayOfWeek)
          Sets the first day of the week, typically this is either Monday (ISO, Europe) or Sunday (e.g.
 void setModel(CalendarEntryModel model)
          Sets a data model that contains calendar events for this CalendarItem.
 void setModelLimitToEnabledCategories(boolean limit)
          Specifies whether only enabled categories should be displayed in this CalendarItem
 void setMonthNameSelectable(boolean isSelectable)
          Specifies whether the user can select the label that displays the month names.
static void setMonths(String months)
          Sets the names of the month in a comma separated list.
 void setRenderer(CalendarRenderer renderer)
          Specifies a renderer for this CalendarItem
 void setShowMode(int mode)
          Specifies the visualization for the year and month
 void setStyle(Style style)
          Sets the style of this item.
 void setStyleCurrentDay(Style dayStyle)
          Sets the style for the current day
 void setStyleDay(Style dayStyle)
          Sets the style for days of the current month
 void setStyleInactiveDay(Style dayStyle)
          Sets the style for days that do not belong to the current month
 void setStyleInvalidDay(Style dayStyle)
          Sets the style for days for days that are not valid
 void setValidPeriod(TimePeriod validPeriod)
          Sets the time range that is valid for this instance.
static void setWeekDayAbbreviations(String abbreviations)
          Sets the comma separated list of abbreviations for week days
 
Methods inherited from class de.enough.polish.ui.TableItem
add, add, addColumn, addRow, animate, contains, createCssSelector, defocus, focus, get, get, getChildWidth, getColumnIndex, getColumnIndex, getItemAreaHeight, getItemAt, getNumberOfColumns, getNumberOfRows, getRowIndex, getRowIndex, getSelectedBackground, getSelectedCell, getSelectedColumn, getSelectedColumnBackground, getSelectedRow, getSelectedRowBackground, getSelectionMode, handleKeyReleased, handleKeyRepeated, handlePointerDragged, handlePointerPressed, indexOf, insertColumn, insertRow, moveToNextColumn, moveToNextRow, paintBackground, paintContent, remove, removeColumn, removeRow, set, set, set, setCellContainerStyle, setDimension, setLineStyle, setRow, setRow, setSelectedBackground, setSelectedCell, setSelectedCell, setSelectedColumnBackground, setSelectedRowBackground, setSelectionMode, setStyle, setTableData, size, updateInternalArea
 
Methods inherited from class de.enough.polish.ui.FakeContainerCustomItem
add, add, add, add, add, add, addRepaintArea, changeChildStyles, changeChildStyles, clear, destroy, fireEvent, focusChild, focusChild, focusClosestItem, focusClosestItemAbove, getChildAt, getChildAtImpl, getChildHeight, getCurrentScrollYOffset, getFocusedChild, getFocusedIndex, getFocusedItem, getFocusedStyle, getFocusListener, getInternalArray, getItems, getNumberOfInteractiveItems, getPosition, getRelativeScrollYOffset, getScrollHeight, getScrollYOffset, getSynchronizationLock, getView, getView, handleCommand, handleNavigate, handlePointerDragged, handlePointerScrollReleased, handlePointerTouchDown, handlePointerTouchUp, hideNotify, initLayout, initMargin, isInItemArea, isScrolling, notifyItemPressedEnd, notifyItemPressedStart, onScreenSizeChanged, paintBackgroundAndBorder, parseIndexUrl, releaseResources, remove, requestDefocus, requestFullInit, scroll, scroll, scroll, set, set, setAppearanceMode, setContentHeight, setContentWidth, setFocusListener, setItemsList, setItemWidth, setScrollHeight, setScrollYOffset, setScrollYOffset, setStyleWithBackground, setView, showCommands, showNotify, startScroll, toString, updateInternalPosition
 
Methods inherited from class de.enough.polish.ui.FakeCustomItem
addCommand, addCommand, addCommand, addCommands, addRelativeToBackgroundRegion, addRelativeToBackgroundRegion, addRelativeToContentRegion, animate, containsCommand, getAbsoluteX, getAbsoluteY, getAppearanceMode, getAttribute, getAttributes, getAvailableContentHeight, getAvailableContentWidth, getAvailableHeight, getAvailableWidth, getBackgroundHeight, getBackgroundWidth, getBackgroundX, getBackgroundY, getBorderWidthBottom, getBorderWidthLeft, getBorderWidthRight, getBorderWidthTop, getContentHeight, getContentWidth, getContentX, getContentY, getDefaultCommand, getFocusedStyle, getInternalHeight, getInternalWidth, getInternalX, getInternalY, getItemCommandListener, getItemCommands, getItemHeight, getItemHeight, getItemStateListener, getItemWidth, getItemWidth, getLabel, getLabelItem, getLayout, getMaximumHeight, getMaximumHeight, getMaximumWidth, getMaximumWidth, getMinContentHeight, getMinContentWidth, getMinimumHeight, getMinimumHeight, getMinimumWidth, getMinimumWidth, getNativeItem, getParent, getPrefContentHeight, getPrefContentWidth, getpreferredHeight, getpreferredWidth, getRgbData, getRgbData, getScreen, getStyle, getUiEventListener, handleCommand, handleGesture, handleGestureHold, handleGestureSwipeLeft, handleGestureSwipeRight, init, initPadding, initStyle, isFocused, isInContentArea, isInContentWithPaddingArea, isInItemArea, isInitialized, isInteractive, isLayoutBottom, isLayoutCenter, isLayoutExpand, isLayoutLeft, isLayoutNewlineAfter, isLayoutNewlineBefore, isLayoutRight, isLayoutShrink, isLayoutTop, isLayoutVerticalCenter, isLayoutVerticalExpand, isLayoutVerticalShrink, isPressed, isVisible, notifyStateChanged, notifyUnvisited, notifyValueChanged, notifyVisited, paint, paint, paintBorder, paintCommands, paintFilter, removeAttribute, removeCommand, repaintFully, requestInit, setAbsoluteY, setAttribute, setBackground, setBorder, setDefaultCommand, setDefaultCommand, setInitialized, setItemCommandListener, setItemCommandListener, setItemHeight, setItemStateListener, setItemTransition, setLabel, setLayout, setNativeItem, setParent, setParent, setpreferredSize, setStyle, setUiEventListener, setVisible, show, toImage, toRgbImage
 
Methods inherited from class javax.microedition.lcdui.CustomItem
getGameAction, getInteractionModes, invalidate, keyPressed, keyReleased, keyRepeated, pointerDragged, pointerPressed, pointerReleased, repaint, repaint, sizeChanged, traverse, traverseOut
 
Methods inherited from class javax.microedition.lcdui.Item
getPreferredHeight, getPreferredWidth, removeCommand, setPreferredSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SHOW_MODE_LABEL

public static final int SHOW_MODE_LABEL
Show mode for displaying the current month and year within the label of this CalendarItem.

See Also:
Constant Field Values

SHOW_MODE_TITLE

public static final int SHOW_MODE_TITLE
Show mode for displaying the current month and year within the title of this CalendarItem's screen.

See Also:
Constant Field Values

SHOW_MODE_ITEM

public static final int SHOW_MODE_ITEM
Show mode for displaying the current month and year within the item that has been specified with setMonthItem().

See Also:
Constant Field Values

SHOW_MODE_NONE

public static final int SHOW_MODE_NONE
Show mode for not displaying the current month and year.

See Also:
Constant Field Values
Constructor Detail

CalendarItem

public CalendarItem()
Creates a new Calendar Item with the current month shown.


CalendarItem

public CalendarItem(Style style)
Creates a new Calendar Item with the current month shown.

Parameters:
style - the style of the calendar item

CalendarItem

public CalendarItem(Calendar cal)
Creates a new Calendar Item.

Parameters:
cal - the month that should be displayed by default.

CalendarItem

public CalendarItem(Calendar cal,
                    Style style)
Creates a new Calendar Item.

Parameters:
cal - the month that should be displayed by default.
style - the style of the calendar item

CalendarItem

public CalendarItem(TimePoint timePoint)
Creates a new Calendar Item.

Parameters:
timePoint - the month that should be displayed by default.

CalendarItem

public CalendarItem(TimePoint originalDay,
                    Style style)
Creates a new Calendar Item.

Parameters:
originalDay - the month that should be displayed by default.
style - the style of the calendar item

CalendarItem

public CalendarItem(TimePoint originalDay,
                    CalendarEntryModel model)
Creates a new Calendar Item.

Parameters:
originalDay - the month that should be displayed by default.
model - the model that contains events for this CalendarItem

CalendarItem

public CalendarItem(TimePoint originalDay,
                    CalendarEntryModel model,
                    Style style)
Creates a new Calendar Item.

Parameters:
originalDay - the month that should be displayed by default.
model - the model that contains any calendar entries that might get visualized. Can be null.
style - the style of the calendar item
Method Detail

getFirstDayOfWeek

public static int getFirstDayOfWeek()
Retrieves the first day of the week, typically either Calendar.SUNDAY or Calendar.MONDAY.

Returns:
the first day of the week in Calendar format

setFirstDayOfWeek

public static void setFirstDayOfWeek(int firstDayOfWeek)
Sets the first day of the week, typically this is either Monday (ISO, Europe) or Sunday (e.g. US)

Parameters:
firstDayOfWeek - the first day of the week, e.g. Calendar.MONDAY

getWeekDayAbbreviations

public static String getWeekDayAbbreviations()
Retrieves a comma separated list of abbreviations for week days.

Returns:
the day abbreviations, by default "M,T,W,T,F,S,S"

setWeekDayAbbreviations

public static void setWeekDayAbbreviations(String abbreviations)
Sets the comma separated list of abbreviations for week days

Parameters:
abbreviations - the list of abbreviations, e.g. "Mo,Tu,We,Th,Fr,Sa,Su"

getMonths

public static String getMonths()
Retrieves the names of the month in a comma separated list.

Returns:
the names of the months, by default "January,February,March,..."

setMonths

public static void setMonths(String months)
Sets the names of the month in a comma separated list.

Parameters:
months - the names of the months, e.g. "Jan,Feb,Mar,..."

buildCalendar

protected void buildCalendar(TimePoint forMonth)
Builds up this calendar for the specified point in time

Parameters:
forMonth - the point in time (most notably the month that should be shown)

createCalendaryDay

protected Item createCalendaryDay(TimePoint day,
                                  TimePoint currentMonth,
                                  TimePoint originalCurrentDay,
                                  CalendarEntry[] entriesForTheDay,
                                  int col,
                                  int row)
Creates an item that represents a day within this CalendarItem

Parameters:
day - the corresponding day
currentMonth - the month that is currently shown
originalCurrentDay - the original day (e.g. today) that was used to initialize this CalendarItem (should be highlighted in most cases)
entriesForTheDay - the events for the day, may be null
col - the table column for which the item is generated, you cannot expect a certain column for a specific day due to possible design and architecture changes
row - the table row for which the item is generated, you cannot expect a certain row for a specific day due to possible design and architecture changes
Returns:
the created item, must not be null

createCalendaryDay

public static Item createCalendaryDay(TimePoint day,
                                      TimePoint currentMonth,
                                      TimePoint originalCurrentDay,
                                      CalendarEntry[] entriesForTheDay,
                                      CalendarItem parent)
Creates an item that represents a day within this CalendarItem

Parameters:
day - the corresponding day
currentMonth - the month that is currently shown
originalCurrentDay - the original day (e.g. today) that was used to initialize this CalendarItem (should be highlighted in most cases)
entriesForTheDay - the events for the day, may be null
parent - the parent calendar item, can be null
Returns:
the created item, must not be null

setRenderer

public void setRenderer(CalendarRenderer renderer)
Specifies a renderer for this CalendarItem

Parameters:
renderer - a renderer that is responsible for creating calendar items

setDayDefaultCommand

public void setDayDefaultCommand(Command cmd)
Sets the default command for days. This can be used for using the calendar item for an easy day picker.

Parameters:
cmd - the command that is triggered when a day is selected

setDayDefaultCommand

public void setDayDefaultCommand(Command cmd)
Sets the default command for days. This can be used for using the calendar item for an easy day picker.

Parameters:
cmd - the command that is triggered when a day is selected

getColumn

public int getColumn(TimePoint day)
Retrieves the column for the specified day

Parameters:
day - the day
Returns:
the column for the day

getRow

public int getRow(TimePoint day)
Retrieves the row for the specified day

Parameters:
day - the day
Returns:
the row for the day

getDaysInMonth

public int getDaysInMonth()
Retrieves the days within the currently shown month

Returns:
the number of days within the month that is currently shown.

getDaysInMonth

public static int getDaysInMonth(Calendar cal)
Deprecated. 

Deprecated method to retrieve the number of days of a given calendar

Parameters:
cal - the calendar
Returns:
the number of days within the month of the given calendar
See Also:
TimePoint.getDaysInMonth()

handleKeyPressed

protected boolean handleKeyPressed(int keyCode,
                                   int gameAction)
Description copied from class: FakeCustomItem
Handles the key-pressed event. Please note, that implementation should first try to handle the given key-code, before the game-action is processed. The default implementation just handles the FIRE game-action when a default-command and an item-command-listener have been registered.

Overrides:
handleKeyPressed in class TableItem
Parameters:
keyCode - the code of the pressed key, e.g. Canvas.KEY_NUM2
gameAction - the corresponding game-action, e.g. Canvas.UP
Returns:
true when the key has been handled / recognized

goNextMonth

public boolean goNextMonth()
Moves this calendar to the next month

Returns:
true when the previous month is in the valid period or when no valid range is specified

goPreviousMonth

public boolean goPreviousMonth()
Moves this calendar to the previous month

Returns:
true when the previous month is in the valid period or when no valid range is specified

go

public void go(TimePoint day)
Goes to the specified day. When the day is outside of the scope of the specified date range, it will be either moved to the beginning of the valid range or to its end.

Parameters:
day - the day that should be shown
See Also:
setValidPeriod(TimePeriod)

handlePointerReleased

protected boolean handlePointerReleased(int relX,
                                        int relY)
Description copied from class: FakeCustomItem
Handles the event when a pointer has been released at the specified position. The default method discards this event when relX/relY is outside of the item's area. When the event took place inside of the content area, the pointer-event is translated into an artificial FIRE game-action keyReleased event, which is subsequently handled bu the handleKeyPressed(-1, Canvas.FIRE) method. This method needs should be overwritten only when the "polish.hasPointerEvents" preprocessing symbol is defined: "//#ifdef polish.hasPointerEvents".

Overrides:
handlePointerReleased in class TableItem
Parameters:
relX - the x position of the pointer pressing relative to this item's left position
relY - the y position of the pointer pressing relative to this item's top position
Returns:
true when the pressing of the pointer was actually handled by this item.
See Also:
this method is used for determining whether the event belongs to this item, for a helper method for determining whether the event took place into the actual content area, FakeCustomItem.handleKeyPressed(int, int), for calculating the horizontal position relative to the content (relX - contentX), for calculating the vertical position relative to the content (relY - contentY)

getCellTimePoint

public TimePoint getCellTimePoint(int row,
                                  int col)
Retrieves the TimePoint of the given row and column within the shown Calendar

Parameters:
row - the row index
col - the column index
Returns:
the corresponding TimePoint

getCellCalendar

public Calendar getCellCalendar(int row,
                                int col)
Retrieves the Calendar of the given row and column within the shown Calendar

Parameters:
row - the row index
col - the column index
Returns:
the corresponding Calendar

getSelectedTimePoint

public TimePoint getSelectedTimePoint()
Retrieves the currently selected day as a TimePoint

Returns:
a TimePoint representing the currently selected day
See Also:
go(TimePoint)

getSelectedCalendar

public Calendar getSelectedCalendar()
Retrieves the currently selected day as a Calendar

Returns:
a Calendar representing the currently selected day
See Also:
go(TimePoint)

getSelectedDate

public Date getSelectedDate()
Retrieves the currently selected day as a Date

Returns:
a Date representing the currently selected day
See Also:
go(TimePoint)

setEditable

public void setEditable(boolean isInteractive)
Enables or disables the interactivity state of this calendar item.

Parameters:
isInteractive - true when the item should be editable and selectable

setMonthNameSelectable

public void setMonthNameSelectable(boolean isSelectable)
Specifies whether the user can select the label that displays the month names. When the user can select the month name, she can move between the months using LEFT and RIGHT key actions.

Parameters:
isSelectable - true when the user should be able to select the month names, by default this is false

initContent

protected void initContent(int firstLineWidth,
                           int availWidth,
                           int availHeight)
Description copied from class: FakeCustomItem
Initialises this item. The implementation needs to calculate and set the contentWidth and contentHeight fields. The implementation should take the fields preferredWidth and preferredHeight into account.

Overrides:
initContent in class TableItem
Parameters:
firstLineWidth - the maximum width of the first line
availWidth - the available maximum width of this item in pixels
availHeight - the available maximum height of this item in pixels
See Also:
FakeCustomItem.contentWidth, FakeCustomItem.contentHeight, FakeCustomItem.preferredWidth, FakeCustomItem.preferredHeight

getCalendarWeekdayStyle

public Style getCalendarWeekdayStyle()
Gets the style for the headings of this calendar, if different from .calendarWeekday

Returns:
the style

setCalendarWeekdayStyle

public void setCalendarWeekdayStyle(Style calendarWeekdayStyle)
Sets the style for the headings of this calendar

Parameters:
calendarWeekdayStyle - the style

getCalendarDayInactiveStyle

public Style getCalendarDayInactiveStyle()
Gets the style for days of another month, if different from .calendarDayInactive

Returns:
the style

setCalendarDayInactiveStyle

public void setCalendarDayInactiveStyle(Style calendarDayInactiveStyle)
Sets the style for days of another month

Parameters:
calendarDayInactiveStyle - the style

getCalendarDayStyle

public Style getCalendarDayStyle()
Gets the style for a normal calendar day entry, if different from .calendarDay

Returns:
the style

setCalendarDayStyle

public void setCalendarDayStyle(Style calendarDayStyle)
Sets the style for a normal calendar day entry

Parameters:
calendarDayStyle - the style

getCalendarCurrentdayStyle

public Style getCalendarCurrentdayStyle()
Gets the style for the currently selected calendar day entry, if different from .calendarCurrentDay

Returns:
the style

setCalendarCurrentdayStyle

public void setCalendarCurrentdayStyle(Style calendarCurrentdayStyle)
Sets the style for the currently selected calendar day entry

Parameters:
calendarCurrentdayStyle - the style

setCalendarInactiveDaysAreInteractive

public void setCalendarInactiveDaysAreInteractive(boolean isInteractive)
Specifies whether days that are outside of the current month can be selected

Parameters:
isInteractive - true when they should be selectable (this is the default state), false if not.

setStyle

public void setStyle(Style style)
Description copied from class: FakeCustomItem
Sets the style of this item.

Overrides:
setStyle in class TableItem
Parameters:
style - the new style for this item.

setStyleCurrentDay

public void setStyleCurrentDay(Style dayStyle)
Sets the style for the current day

Parameters:
dayStyle - the style for the current day

setStyleInactiveDay

public void setStyleInactiveDay(Style dayStyle)
Sets the style for days that do not belong to the current month

Parameters:
dayStyle - the style for days that don't belong to the current month

setStyleDay

public void setStyleDay(Style dayStyle)
Sets the style for days of the current month

Parameters:
dayStyle - the style for days of the current month

setStyleInvalidDay

public void setStyleInvalidDay(Style dayStyle)
Sets the style for days for days that are not valid

Parameters:
dayStyle - the style for days that are in the current month but not valid
See Also:
setValidPeriod(TimePeriod)

getShownMonth

public int getShownMonth()
Retrieves the shown month

Returns:
the shown month as in java.util.Calendar, e.g. java.util.Calendar.JANUARY

getShownTimePoint

public TimePoint getShownTimePoint()
Retrieves the shown month as a TimePoint

Returns:
the currently shown month as a TimePoint

setModel

public void setModel(CalendarEntryModel model)
Sets a data model that contains calendar events for this CalendarItem.

Parameters:
model - the model use null to remove the model
See Also:
setModelLimitToEnabledCategories(boolean)

getModel

public CalendarEntryModel getModel()
Retrieves the model used in this CalendarItem

Returns:
the model used, can be null

setModelLimitToEnabledCategories

public void setModelLimitToEnabledCategories(boolean limit)
Specifies whether only enabled categories should be displayed in this CalendarItem

Parameters:
limit - true when only enabled categories should be shown
See Also:
setModel(CalendarEntryModel)

setShowMode

public void setShowMode(int mode)
Specifies the visualization for the year and month

Parameters:
mode - the mode
See Also:
SHOW_MODE_ITEM, SHOW_MODE_LABEL, SHOW_MODE_NONE, SHOW_MODE_TITLE, getShowMode()

getShowMode

public int getShowMode()
Retrieves the visualization for the year and month

Returns:
the mode
See Also:
SHOW_MODE_ITEM, SHOW_MODE_LABEL, SHOW_MODE_NONE, SHOW_MODE_TITLE, setShowMode(int)

setValidPeriod

public void setValidPeriod(TimePeriod validPeriod)
Sets the time range that is valid for this instance. The user cannot navigate outside of the specified validity period.

Parameters:
validPeriod - the valid range, use null to remove any boundaries
See Also:
getValidPeriod()

getValidPeriod

public TimePeriod getValidPeriod()
Retrieves the time range that is valid for this instance.

Returns:
the specified time period, may be null
See Also:
setValidPeriod(TimePeriod)