com.sun.lwuit
Class Calendar

java.lang.Object
  extended by com.sun.lwuit.Component
      extended by com.sun.lwuit.Container
          extended by com.sun.lwuit.Calendar
All Implemented Interfaces:
Animation, StyleListener

public class Calendar
extends Container

Date widget for selecting a date/time value. To localize strings for month names use the values "Calendar.Month" using the 3 first characters of the month name in the resource localization e.g. "Calendar.Jan", "Calendar.Feb" etc... To localize strings for day names use the values "Calendar.Day" in the resource localization e.g. "Calendar.Sunday", "Calendar.Monday" etc...


Field Summary
 
Fields inherited from class com.sun.lwuit.Component
BOTTOM, BRB_CENTER_OFFSET, BRB_CONSTANT_ASCENT, BRB_CONSTANT_DESCENT, BRB_OTHER, CENTER, LEFT, RIGHT, TOP
 
Constructor Summary
Calendar()
          Constructs a calendar with the current date and time
Calendar(long time)
          Creates a new instance of Calendar set to the given date based on time since epoch (the java.util.Date convention)
Calendar(long time, java.util.TimeZone tmz)
          Creates a new instance of Calendar set to the given date based on time since epoch (the java.util.Date convention)
 
Method Summary
 void addActionListener(ActionListener l)
          Fires when a change is made to the month view of this component
 void addDataChangeListener(DataChangedListener l)
          Allows tracking selection changes in the calendar in real time
protected  Button createDay()
          This method creates the Day Button Component for the Month View
protected  Label createDayTitle(int day)
          This method creates the Day title Component for the Month View
 java.util.Date getDate()
          Return the date object matching the current selection
 Style getMonthViewSelectedStyle()
          Gets the selected style of the month view component within the calendar
 Style getMonthViewUnSelectedStyle()
          Gets the un selected style of the month view component within the calendar
 long getSelectedDay()
          Returns the time for the current calendar.
 java.util.TimeZone getTimeZone()
          Gets the Calendar timezone
 boolean isChangesSelectedDateEnabled()
          This flag determines if selected date can be changed by selecting an alternative date
 void removeActionListener(ActionListener l)
          Fires when a change is made to the month view of this component
 void removeDataChangeListener(DataChangedListener l)
          Allows tracking selection changes in the calendar in real time
 void setChangesSelectedDateEnabled(boolean changesSelectedDateEnabled)
          This flag determines if selected date can be changed by selecting an alternative date
 void setCurrentDate(java.util.Date d)
          Sets the Calendar view on the given date, only the the month and year are being considered.
 void setDate(java.util.Date d)
          Sets the current date in the view and the selected date to be the same.
 void setMonthViewSelectedStyle(Style s)
          Sets the selected style of the month view component within the calendar
 void setMonthViewUnSelectedStyle(Style s)
          Sets the un selected style of the month view component within the calendar
 void setSelectedDate(java.util.Date d)
          This method sets the Calendar selected day
 void setTimeZone(java.util.TimeZone tmz)
          Sets the Calendar timezone, if not specified Calendar will use the default timezone
protected  void updateButtonDayDate(Button dayButton, int currentMonth, int day)
          This method updates the Button day.
 
Methods inherited from class com.sun.lwuit.Container
addComponent, addComponent, addComponent, addComponent, animateLayout, animateLayoutAndWait, applyRTL, calcPreferredSize, contains, dragInitiated, drop, findFirstFocusable, flushReplace, getBottomGap, getComponentAt, getComponentAt, getComponentCount, getComponentIndex, getGridPosX, getGridPosY, getLayout, getLayoutHeight, getLayoutWidth, getLeadComponent, getLeadParent, getScrollIncrement, getSideGap, invalidate, isEnabled, isScrollableX, isScrollableY, keyPressed, keyReleased, layoutContainer, paint, paintBackground, paintGlass, paramString, pointerHover, pointerPressed, refreshTheme, removeAll, removeComponent, replace, replace, replaceAndWait, replaceAndWait, replaceAndWait, revalidate, scrollComponentToVisible, setCellRenderer, setEnabled, setLayout, setLeadComponent, setScrollable, setScrollableX, setScrollableY, setScrollIncrement, setShouldCalcPreferredSize, setShouldLayout
 
Methods inherited from class com.sun.lwuit.Component
addFocusListener, animate, calcScrollSize, contains, deinitialize, deinitializeCustomStyle, dragEnter, dragExit, draggingOver, drawDraggedImage, fireClicked, focusGained, focusLost, getAbsoluteX, getAbsoluteY, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentForm, getDirtyRegion, getDisabledStyle, getDragImage, getHeight, getLabelForComponent, getName, getNextFocusDown, getNextFocusLeft, getNextFocusRight, getNextFocusUp, getParent, getPreferredH, getPreferredSize, getPreferredW, getPressedStyle, getPropertyNames, getPropertyTypes, getPropertyValue, getScrollAnimationSpeed, getScrollDimension, getScrollOpacity, getScrollOpacityChangeSpeed, getScrollX, getScrollY, getSelectCommandText, getSelectedRect, getSelectedStyle, getStyle, getTensileLength, getUIID, getUnselectedStyle, getWidth, getVisibleBounds, getX, getY, growShrink, handlesInput, hasFocus, initComponent, initCustomStyle, installDefaultPainter, isAlwaysTensile, isDragActivated, isDragAndDropOperation, isDraggable, isDropTarget, isFlatten, isFocusable, isGrabsPointerEvents, isHideInPortrait, isInitialized, isRTL, isScrollable, isScrollVisible, isSelectableInteraction, isSmoothScrolling, isSnapToGrid, isTactileTouch, isTactileTouch, isTensileDragEnabled, isVisible, keyRepeated, laidOut, longKeyPress, longPointerPress, paintBackgrounds, paintBorder, paintComponent, paintComponent, paintLock, paintLockRelease, paintScrollbars, paintScrollbarX, paintScrollbarY, pointerDragged, pointerDragged, pointerHoverPressed, pointerHoverReleased, pointerPressed, pointerReleased, pointerReleased, putClientProperty, refreshTheme, removeFocusListener, repaint, repaint, requestFocus, scrollRectToVisible, scrollRectToVisible, setAlwaysTensile, setDirtyRegion, setDisabledStyle, setDraggable, setDropTarget, setFlatten, setFocus, setFocusable, setGrabsPointerEvents, setHandlesInput, setHeight, setHideInPortrait, setInitialized, setIsScrollVisible, setLabelForComponent, setName, setNextFocusDown, setNextFocusLeft, setNextFocusRight, setNextFocusUp, setPreferredH, setPreferredSize, setPreferredW, setPressedStyle, setPropertyValue, setRTL, setScrollAnimationSpeed, setScrollOpacityChangeSpeed, setScrollSize, setScrollVisible, setScrollX, setScrollY, setSelectCommandText, setSelectedStyle, setSize, setSmoothScrolling, setSnapToGrid, setTactileTouch, setTensileDragEnabled, setTensileLength, setUIID, setUnselectedStyle, setWidth, setVisible, setX, setY, styleChanged, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Calendar

public Calendar(long time)
Creates a new instance of Calendar set to the given date based on time since epoch (the java.util.Date convention)

Parameters:
time - time since epoch

Calendar

public Calendar()
Constructs a calendar with the current date and time


Calendar

public Calendar(long time,
                java.util.TimeZone tmz)
Creates a new instance of Calendar set to the given date based on time since epoch (the java.util.Date convention)

Parameters:
time - time since epoch
tmz - a reference timezone
Method Detail

getSelectedDay

public long getSelectedDay()
Returns the time for the current calendar.

Returns:
the time for the current calendar.

getDate

public java.util.Date getDate()
Return the date object matching the current selection

Returns:
the date object matching the current selection

setDate

public void setDate(java.util.Date d)
Sets the current date in the view and the selected date to be the same.

Parameters:
d - new date

setSelectedDate

public void setSelectedDate(java.util.Date d)
This method sets the Calendar selected day

Parameters:
d - the selected day

setCurrentDate

public void setCurrentDate(java.util.Date d)
Sets the Calendar view on the given date, only the the month and year are being considered.

Parameters:
d - the date to set the calendar view on.

setTimeZone

public void setTimeZone(java.util.TimeZone tmz)
Sets the Calendar timezone, if not specified Calendar will use the default timezone

Parameters:
tmz - the timezone

getTimeZone

public java.util.TimeZone getTimeZone()
Gets the Calendar timezone

Returns:
Calendar TimeZone

setMonthViewSelectedStyle

public void setMonthViewSelectedStyle(Style s)
Sets the selected style of the month view component within the calendar

Parameters:
s - style for the month view

setMonthViewUnSelectedStyle

public void setMonthViewUnSelectedStyle(Style s)
Sets the un selected style of the month view component within the calendar

Parameters:
s - style for the month view

getMonthViewSelectedStyle

public Style getMonthViewSelectedStyle()
Gets the selected style of the month view component within the calendar

Returns:
the style of the month view

getMonthViewUnSelectedStyle

public Style getMonthViewUnSelectedStyle()
Gets the un selected style of the month view component within the calendar

Returns:
the style of the month view

addActionListener

public void addActionListener(ActionListener l)
Fires when a change is made to the month view of this component

Parameters:
l - listener to add

removeActionListener

public void removeActionListener(ActionListener l)
Fires when a change is made to the month view of this component

Parameters:
l - listener to remove

addDataChangeListener

public void addDataChangeListener(DataChangedListener l)
Allows tracking selection changes in the calendar in real time

Parameters:
l - listener to add

removeDataChangeListener

public void removeDataChangeListener(DataChangedListener l)
Allows tracking selection changes in the calendar in real time

Parameters:
l - listener to remove

setChangesSelectedDateEnabled

public void setChangesSelectedDateEnabled(boolean changesSelectedDateEnabled)
This flag determines if selected date can be changed by selecting an alternative date

Parameters:
changesSelectedDateEnabled - if true pressing on a date will cause the selected date to be changed to the pressed one

isChangesSelectedDateEnabled

public boolean isChangesSelectedDateEnabled()
This flag determines if selected date can be changed by selecting an alternative date

Returns:
true if enabled

createDay

protected Button createDay()
This method creates the Day Button Component for the Month View

Returns:
a Button that corresponds to the Days Components

createDayTitle

protected Label createDayTitle(int day)
This method creates the Day title Component for the Month View

Parameters:
day - the relevant day values are 0-6 where 0 is sunday.
Returns:
a Label that corresponds to the relevant Day

updateButtonDayDate

protected void updateButtonDayDate(Button dayButton,
                                   int currentMonth,
                                   int day)
This method updates the Button day.

Parameters:
dayButton - the button to be updated
day - the new button day