com.sapportals.htmlb

Class DateNavigator

java.lang.Object
  extended bycom.sapportals.htmlb.Component
      extended bycom.sapportals.htmlb.DateNavigator

public class DateNavigator
extends Component

The DateNavigator class is used to render calendars. Calendars consist of one or more complete months including year, month name, week numbers, weekdays and days of months. A month is rendered using locales to get the month names, weekday names and the day that begins a week in the browsers locale or an explicitely specified locale. WARNING: All month values used here are conformant to java.util.Calendar. This means January has a month value of Calendar.JANUARY which equals to 0 and not 1 as could be suspected!
Copyright 2004 SAP AG

See Also:
Locale, Calendar

Field Summary
static String UI_ID
           
 
Constructor Summary
DateNavigator()
          Create DateNavigatorModel.
DateNavigator(IPageContext pc)
          Create DateNavigator.
 
Method Summary
 String getAccessibilityDescription()
           
 Calendar getCalendar()
          Get Calendar instance used by DateNavigator.
 Integer getCenteredMonth()
          Get centered month.
 Integer getCenteredYear()
          Get centered year.
 Locale getLocale()
          Get locale.
 DateNavigatorModel getModel()
          Get model.
 int getMonthsPerColumn()
          Get number of months to be rendered one upon the other.
 int getMonthsPerRow()
          Get number of months to be rendered next to each other.
 String getOnDayClick()
          Get event String for DayClick events.
 String getOnMonthClick()
          Get event String for MonthClick events.
 String getOnNavigate()
          Get event String for Navigate events.
 String getOnWeekClick()
          Get event String for WeekClick events.
 DayRanges getSelectedDays()
          Get the DayRanges instance.
 Date getToday()
          Get the day that should be rendered as the current date.
 String getUI()
          Get String specifier for this component.
 String setAccessibilityDescription(String accessibilityDescription)
           
 void setCenteredMonth(int centeredMonth)
          Set Month that should be centered on rendering.
 void setCenteredYear(int centeredYear)
          Set year of month that should be centered on rendering.
 void setLocale(Locale l)
          Set fixed locale to use for Date calculations and rendering.
 void setModel(DateNavigatorModel model)
          Set Model.
 void setMonthsPerColumn(int monthsPerColumn)
          Set number of months to be rendered one upon the other.
 void setMonthsPerRow(int monthsPerRow)
          Set number of months to be rendered next to each other.
 void setOnDayClick(String onDayClick)
          Set event String for DayClick events.
 void setOnMonthClick(String onMonthClick)
          Set event String for MonthClick events.
 void setOnNavigate(String onNavigate)
          Set event String for Navigate events.
 void setOnWeekClick(String onWeekClick)
          Set event String for WeekClick events.
 void setSelectedDays(DayRanges selectedDays)
          Set the DayRanges instance.
 void setToday(Date today)
          Set the day that should be rendered as the current date.
 
Methods inherited from class com.sapportals.htmlb.Component
getEncodedIdForForm, getId, getParent, initFromPageContext, initFromShortId, initializeFromId, isJsObjectNeeded, preRender, render, renderAsString, requiresForm, setId, setJsObjectNeeded, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UI_ID

public static final String UI_ID
See Also:
Constant Field Values
Constructor Detail

DateNavigator

public DateNavigator(IPageContext pc)
Create DateNavigator. The page context is used to get the browsers default locale.

Parameters:
pc - IPageContext used to look up locale

DateNavigator

public DateNavigator()
Create DateNavigatorModel. The page context is used to get the servers locale. During rendering the browsers default locale will be used. Better to use the constructor that specifies the page context. Some date calculations may be incorrect for your locale.

Method Detail

setLocale

public void setLocale(Locale l)
Set fixed locale to use for Date calculations and rendering. Disables use of browsers default locale for the DateNavigator, so use this method with caution. Usage of Default locale is generally better than setting the locale explicitely to allow Users to be able to determine locale by browser settings.

Parameters:
l - Locale to be used for date calculations and rendering

getModel

public DateNavigatorModel getModel()
Get model.

Returns:
current model

setModel

public void setModel(DateNavigatorModel model)
Set Model.

Parameters:
model - model to be set

getMonthsPerColumn

public int getMonthsPerColumn()
Get number of months to be rendered one upon the other.

Returns:
number of months per column (defaults to 1 if never set)

setMonthsPerColumn

public void setMonthsPerColumn(int monthsPerColumn)
Set number of months to be rendered one upon the other.

Parameters:
monthsPerColumn - int specifying number of months per column (defaults to 1 if never set)

getMonthsPerRow

public int getMonthsPerRow()
Get number of months to be rendered next to each other.

Returns:
number of months per row (defaults to 1 if never set)

setMonthsPerRow

public void setMonthsPerRow(int monthsPerRow)
Set number of months to be rendered next to each other.

Parameters:
monthsPerRow - int specifying number of months per row (defaults to 1 if never set)

getCenteredMonth

public Integer getCenteredMonth()
Get centered month.

Returns:
currently centered month (int as defined by java.util.Calendar), possibly null if never set

setCenteredMonth

public void setCenteredMonth(int centeredMonth)
Set Month that should be centered on rendering. This setting determines the month that will be displayed in a center position among all the months that are displayed. If only one month is displayed, this selects the month to be rendered. If the centered month is not set, it defaults to the current month in the current year.

Parameters:
centeredMonth - int defining the month to be centered (see java.util.Calendar)

getCenteredYear

public Integer getCenteredYear()
Get centered year.

Returns:
year of centered month, possibly null if year was never set

setCenteredYear

public void setCenteredYear(int centeredYear)
Set year of month that should be centered on rendering. This setting determines the month that will be displayed in a center position among all the months that are displayed. If only one month is displayed, this selects the month to be rendered. If the centered year is not set, it defaults to the current year.

Parameters:
centeredYear - int specifying the year of the centered month

getToday

public Date getToday()
Get the day that should be rendered as the current date.

Returns:
the last date set as today, (defaults to creation date if never set)

setToday

public void setToday(Date today)
Set the day that should be rendered as the current date.

Parameters:
today - Date specifying the current date

getSelectedDays

public DayRanges getSelectedDays()
Get the DayRanges instance. DayRanges specify which day should be rendered in one of the selected modes.

Returns:
DayRanges instance

setSelectedDays

public void setSelectedDays(DayRanges selectedDays)
Set the DayRanges instance. DayRanges specify which day should be rendered in one of the selected modes.

Parameters:
selectedDays - DayRanges instance

getUI

public String getUI()
Get String specifier for this component.

Specified by:
getUI in class Component
Returns:
a unique identification string for this Component

getCalendar

public Calendar getCalendar()
Get Calendar instance used by DateNavigator. This Calendar is initialized to the same locale as the DateNavigator itself. Use this calendar to create java.util.Date instances and for manipulating dates.


getLocale

public Locale getLocale()
Get locale. This will to be the default locale (taken from IPageContext) if not explicitely set by resetLocale().

Returns:
locale (see java.util.Locale)

getOnNavigate

public String getOnNavigate()
Get event String for Navigate events.

Returns:
String that will be set for navigate event

setOnNavigate

public void setOnNavigate(String onNavigate)
Set event String for Navigate events.

Parameters:
onNavigate - String that will be set for Navigate events

getOnDayClick

public String getOnDayClick()
Get event String for DayClick events.

Returns:
String that will be set for DayClick event

setOnDayClick

public void setOnDayClick(String onDayClick)
Set event String for DayClick events.

Parameters:
onDayClick - String that will be set for DayClick events

getOnWeekClick

public String getOnWeekClick()
Get event String for WeekClick events.

Returns:
String that will be set for WeekClick event

setOnWeekClick

public void setOnWeekClick(String onWeekClick)
Set event String for WeekClick events.

Parameters:
onWeekClick - String that will be set for WeekClick events

getOnMonthClick

public String getOnMonthClick()
Get event String for MonthClick events.

Returns:
String that will be set for MonthClick event

setOnMonthClick

public void setOnMonthClick(String onMonthClick)
Set event String for MonthClick events.

Parameters:
onMonthClick - String that will be set for MonthClick events

getAccessibilityDescription

public String getAccessibilityDescription()

setAccessibilityDescription

public String setAccessibilityDescription(String accessibilityDescription)


Copyright 2006 SAP AG Complete Copyright Notice