com.sapportals.htmlb

Class DateNavigatorModel

java.lang.Object
  extended bycom.sapportals.htmlb.DateNavigatorModel

public class DateNavigatorModel
extends Object

Provide model for the DateNavigator. This is mainly of interest for JSPs that want to pass an object that contains all data the DateNavigator tag needs. This prevents from specifying complex data such as DayRanges with JSP tags.


Constructor Summary
DateNavigatorModel()
          Create DateNavigatorModel.
DateNavigatorModel(IPageContext pc)
          Create DateNavigatorModel.
 
Method Summary
 Calendar getCalendar()
          Get Calendar instance used by DateNavigatorModel.
 Integer getCenteredMonth()
          Get centered month.
 Integer getCenteredYear()
          Get centered year.
 Locale getLocale()
          Get locale.
 DayRanges getSelectedDays()
          Get the DayRanges instance.
 Date getToday()
          Get the day that should be rendered as the current date.
 boolean isLocaleUnknown()
          Indicate if the locale has not been explicitely set and should switch to browsers default locale during rendering.
 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.
protected  void setLocaleUnknown(boolean localeUnknown)
          specify whether locale has not been explicitely set and should switch to browsers default locale during rendering.
 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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DateNavigatorModel

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

Parameters:
pc - IPageContext used to look up locale

DateNavigatorModel

public DateNavigatorModel()
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.


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

getCalendar

public Calendar getCalendar()
Get Calendar instance used by DateNavigatorModel. 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)

isLocaleUnknown

public boolean isLocaleUnknown()
Indicate if the locale has not been explicitely set and should switch to browsers default locale during rendering.

Returns:
boolean indicating if locale should be switched

setLocaleUnknown

protected void setLocaleUnknown(boolean localeUnknown)
specify whether locale has not been explicitely set and should switch to browsers default locale during rendering.

Parameters:
localeUnknown - indicating if locale should be switched


Copyright 2006 SAP AG Complete Copyright Notice