|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.microedition.lcdui.Item
javax.microedition.lcdui.CustomItem
de.enough.polish.ui.FakeCustomItem
de.enough.polish.ui.FakeContainerCustomItem
de.enough.polish.ui.TableItem
de.enough.polish.calendar.CalendarItem
public class CalendarItem
Displays a calendar for a specific month
Copyright Enough Software 2009-2010
| 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 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 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 |
|---|
public static final int SHOW_MODE_LABEL
public static final int SHOW_MODE_TITLE
public static final int SHOW_MODE_ITEM
public static final int SHOW_MODE_NONE
| Constructor Detail |
|---|
public CalendarItem()
public CalendarItem(Style style)
style - the style of the calendar itempublic CalendarItem(Calendar cal)
cal - the month that should be displayed by default.
public CalendarItem(Calendar cal,
Style style)
cal - the month that should be displayed by default.style - the style of the calendar itempublic CalendarItem(TimePoint timePoint)
timePoint - the month that should be displayed by default.
public CalendarItem(TimePoint originalDay,
Style style)
originalDay - the month that should be displayed by default.style - the style of the calendar item
public CalendarItem(TimePoint originalDay,
CalendarEntryModel model)
originalDay - the month that should be displayed by default.model - the model that contains events for this CalendarItem
public CalendarItem(TimePoint originalDay,
CalendarEntryModel model,
Style style)
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 |
|---|
public static int getFirstDayOfWeek()
public static void setFirstDayOfWeek(int firstDayOfWeek)
firstDayOfWeek - the first day of the week, e.g. Calendar.MONDAYpublic static String getWeekDayAbbreviations()
public static void setWeekDayAbbreviations(String abbreviations)
abbreviations - the list of abbreviations, e.g. "Mo,Tu,We,Th,Fr,Sa,Su"public static String getMonths()
public static void setMonths(String months)
months - the names of the months, e.g. "Jan,Feb,Mar,..."protected void buildCalendar(TimePoint forMonth)
forMonth - the point in time (most notably the month that should be shown)
protected Item createCalendaryDay(TimePoint day,
TimePoint currentMonth,
TimePoint originalCurrentDay,
CalendarEntry[] entriesForTheDay,
int col,
int row)
day - the corresponding daycurrentMonth - the month that is currently shownoriginalCurrentDay - 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 nullcol - 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 changesrow - 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
public static Item createCalendaryDay(TimePoint day,
TimePoint currentMonth,
TimePoint originalCurrentDay,
CalendarEntry[] entriesForTheDay,
CalendarItem parent)
day - the corresponding daycurrentMonth - the month that is currently shownoriginalCurrentDay - 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 nullparent - the parent calendar item, can be null
public void setRenderer(CalendarRenderer renderer)
renderer - a renderer that is responsible for creating calendar itemspublic void setDayDefaultCommand(Command cmd)
cmd - the command that is triggered when a day is selectedpublic void setDayDefaultCommand(Command cmd)
cmd - the command that is triggered when a day is selectedpublic int getColumn(TimePoint day)
day - the day
public int getRow(TimePoint day)
day - the day
public int getDaysInMonth()
public static int getDaysInMonth(Calendar cal)
cal - the calendar
TimePoint.getDaysInMonth()
protected boolean handleKeyPressed(int keyCode,
int gameAction)
FakeCustomItem
handleKeyPressed in class TableItemkeyCode - the code of the pressed key, e.g. Canvas.KEY_NUM2gameAction - the corresponding game-action, e.g. Canvas.UP
public boolean goNextMonth()
public boolean goPreviousMonth()
public void go(TimePoint day)
day - the day that should be shownsetValidPeriod(TimePeriod)
protected boolean handlePointerReleased(int relX,
int relY)
FakeCustomItem
handlePointerReleased in class TableItemrelX - the x position of the pointer pressing relative to this item's left positionrelY - the y position of the pointer pressing relative to this item's top position
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)
public TimePoint getCellTimePoint(int row,
int col)
row - the row indexcol - the column index
public Calendar getCellCalendar(int row,
int col)
row - the row indexcol - the column index
public TimePoint getSelectedTimePoint()
go(TimePoint)public Calendar getSelectedCalendar()
go(TimePoint)public Date getSelectedDate()
go(TimePoint)public void setEditable(boolean isInteractive)
isInteractive - true when the item should be editable and selectablepublic void setMonthNameSelectable(boolean isSelectable)
isSelectable - true when the user should be able to select the month names, by default this is false
protected void initContent(int firstLineWidth,
int availWidth,
int availHeight)
FakeCustomItem
initContent in class TableItemfirstLineWidth - the maximum width of the first lineavailWidth - the available maximum width of this item in pixelsavailHeight - the available maximum height of this item in pixelsFakeCustomItem.contentWidth,
FakeCustomItem.contentHeight,
FakeCustomItem.preferredWidth,
FakeCustomItem.preferredHeightpublic Style getCalendarWeekdayStyle()
public void setCalendarWeekdayStyle(Style calendarWeekdayStyle)
calendarWeekdayStyle - the stylepublic Style getCalendarDayInactiveStyle()
public void setCalendarDayInactiveStyle(Style calendarDayInactiveStyle)
calendarDayInactiveStyle - the stylepublic Style getCalendarDayStyle()
public void setCalendarDayStyle(Style calendarDayStyle)
calendarDayStyle - the stylepublic Style getCalendarCurrentdayStyle()
public void setCalendarCurrentdayStyle(Style calendarCurrentdayStyle)
calendarCurrentdayStyle - the stylepublic void setCalendarInactiveDaysAreInteractive(boolean isInteractive)
isInteractive - true when they should be selectable (this is the default state), false if not.public void setStyle(Style style)
FakeCustomItem
setStyle in class TableItemstyle - the new style for this item.public void setStyleCurrentDay(Style dayStyle)
dayStyle - the style for the current daypublic void setStyleInactiveDay(Style dayStyle)
dayStyle - the style for days that don't belong to the current monthpublic void setStyleDay(Style dayStyle)
dayStyle - the style for days of the current monthpublic void setStyleInvalidDay(Style dayStyle)
dayStyle - the style for days that are in the current month but not validsetValidPeriod(TimePeriod)public int getShownMonth()
public TimePoint getShownTimePoint()
public void setModel(CalendarEntryModel model)
model - the model use null to remove the modelsetModelLimitToEnabledCategories(boolean)public CalendarEntryModel getModel()
public void setModelLimitToEnabledCategories(boolean limit)
limit - true when only enabled categories should be shownsetModel(CalendarEntryModel)public void setShowMode(int mode)
mode - the modeSHOW_MODE_ITEM,
SHOW_MODE_LABEL,
SHOW_MODE_NONE,
SHOW_MODE_TITLE,
getShowMode()public int getShowMode()
SHOW_MODE_ITEM,
SHOW_MODE_LABEL,
SHOW_MODE_NONE,
SHOW_MODE_TITLE,
setShowMode(int)public void setValidPeriod(TimePeriod validPeriod)
validPeriod - the valid range, use null to remove any boundariesgetValidPeriod()public TimePeriod getValidPeriod()
setValidPeriod(TimePeriod)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||