com.sapportals.htmlb.type

Class DayRanges

java.lang.Object
  extended bycom.sapportals.htmlb.type.DayRanges

public class DayRanges
extends Object

The DayRanges class is used in association with the DateNavigator class to specify any number of days that should be rendered in a selected state and can be accompanied with tooltips. 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 int SELECTION_MODE_IT1EMP
          Selection mode It1Emp.
static int SELECTION_MODE_IT2EMP
          Default selection mode It2Emp.
static int SELECTION_MODE_IT3EMP
          Selection mode It3Emp.
static int SELECTION_MODE_IT4EMP
          Selection mode It4Emp.
static int SELECTION_MODE_NONE
          Selection mode for indication that no mode is selected at all.
static int SELECTION_MODE_SELNOT
          Selection mode SelNot.
 
Constructor Summary
DayRanges()
          Create DayRanges.
DayRanges(IPageContext pc)
          Create DayRanges.
 
Method Summary
 void add(Date day)
          Add Date to this instance of DayRanges
 void add(Date begin, Date end)
          Add a range of Dates to this instance of DayRanges.
 void add(Date begin, Date end, int selection)
          Add a range of Dates to this instance of DayRanges.
 void add(Date begin, Date end, String tooltip)
          Add a range of Dates to this instance of DayRanges.
 void add(Date begin, Date end, String tooltip, int selection)
          Add a range of Dates to this instance of DayRanges.
 void add(Date day, int selection)
          Add Date to this instance of DayRanges
 void add(Date day, String tooltip)
          Add Date to this instance of DayRanges
 void add(Date day, String tooltip, int selection)
          Add Date to this instance of DayRanges
 void addMonth(int month, int year)
          Add all days of a month to this instance of DayRanges.
 void addMonth(int month, int year, int selection)
          Add all days of a month to this instance of DayRanges.
 void addMonth(int month, int year, String tooltip)
          Add all days of a month to this instance of DayRanges.
 void addMonth(int month, int year, String tooltip, int selection)
          Add all days of a month to this instance of DayRanges.
 void addWeek(int week, int year)
          Add all days of a week to this instance of DayRanges.
 void addWeek(int week, int year, int selection)
          Add all days of a week to this instance of DayRanges.
 void addWeek(int week, int year, String tooltip)
          Add all days of a week to this instance of DayRanges.
 void addWeek(int week, int year, String tooltip, int selection)
          Add all days of a week to this instance of DayRanges.
static void deleteTimeInfo(Calendar calendar)
          Utility method to delete all time info in a calendar.
 Calendar getCalendar()
          Get Calendar instance associated with this DayRanges instance.
 Date getDate(int day, int month, int year)
          Utility method to construct a java.util.Date from day/month/year.
 int getSelectionMode(Date date)
          Get selection mode that has been set for a Date.
 String getTooltip(Date date)
          Get the tooltip that has been set for a Date.
 boolean isInRange(Date date)
          Check if some Date had been added to this DayRanges.
 boolean isInRange(int day, int month, int year)
          Check if some Date had been added to this DayRanges.
 boolean isLocaleUnknown()
          Indicate if the locale has not been explicitely set and should switch to browsers default locale during rendering.
static Date normalizeDate(Calendar calendar, Date date)
          Utility method to delete all time info in a Date.
 void setLocale(Locale l)
          Set fixed locale to use for Date calculations.
protected  void setLocaleUnknown(boolean localeUnknown)
          specify whether locale has not been explicitely set and should switch to browsers default locale during rendering.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SELECTION_MODE_NONE

public static final int SELECTION_MODE_NONE
Selection mode for indication that no mode is selected at all. The last selection mode set for a specific day before rendering determines the rendering mode.

See Also:
Constant Field Values

SELECTION_MODE_SELNOT

public static final int SELECTION_MODE_SELNOT
Selection mode SelNot. Nobody knows what this means. Try out. The last selection mode set for a specific day before rendering determines the rendering mode.

See Also:
Constant Field Values

SELECTION_MODE_IT1EMP

public static final int SELECTION_MODE_IT1EMP
Selection mode It1Emp. Nobody knows what this means. Try out. The last selection mode set for a specific day before rendering determines the rendering mode.

See Also:
Constant Field Values

SELECTION_MODE_IT2EMP

public static final int SELECTION_MODE_IT2EMP
Default selection mode It2Emp. Nobody knows what this means. Try out. The last selection mode set for a specific day before rendering determines the rendering mode.

See Also:
Constant Field Values

SELECTION_MODE_IT3EMP

public static final int SELECTION_MODE_IT3EMP
Selection mode It3Emp. Nobody knows what this means. Try out. The last selection mode set for a specific day before rendering determines the rendering mode.

See Also:
Constant Field Values

SELECTION_MODE_IT4EMP

public static final int SELECTION_MODE_IT4EMP
Selection mode It4Emp. Nobody knows what this means. Try out. The last selection mode set for a specific day before rendering determines the rendering mode.

See Also:
Constant Field Values
Constructor Detail

DayRanges

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

Parameters:
pc - IPageContext used to look up locale

DayRanges

public DayRanges()
Create DayRanges. 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. Disables use of browsers default locale for DayRanges, 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. This should be set to the same locale as the accompanied DateNavigator.

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

isInRange

public boolean isInRange(int day,
                         int month,
                         int year)
Check if some Date had been added to this DayRanges.

Parameters:
day - int specifying the day of month
month - int specifying the month (as defined by java.util.Calendar)
year - int specifying the year
Returns:
true if specified day could be found in this DayRanges

isInRange

public boolean isInRange(Date date)
Check if some Date had been added to this DayRanges.

Parameters:
date - Date too look for
Returns:
true if specified day could be found in this DayRanges

getDate

public Date getDate(int day,
                    int month,
                    int year)
Utility method to construct a java.util.Date from day/month/year. Uses java.util.Calendar to construct in a locale specific manner. All time info in the constructed date will be zero. It is save to compare Dates returned by this method using equals(). This will yield true for all Dates that have been constructed for the same day/month/year.

Parameters:
day - int specifying the day of month
month - int specifying the month (as defined by java.util.Calendar)
year - int specifying the year
Returns:
java.util.Date constructed by the underlying calendar

add

public void add(Date day)
Add Date to this instance of DayRanges

Parameters:
day - java.util.Date specifying the date to be added

add

public void add(Date day,
                String tooltip)
Add Date to this instance of DayRanges

Parameters:
day - java.util.Date specifying the date to be added
tooltip - String specifying the tooltip to be rendered for the added Date

add

public void add(Date day,
                int selection)
Add Date to this instance of DayRanges

Parameters:
day - java.util.Date specifying the date to be added
selection - selection mode

add

public void add(Date day,
                String tooltip,
                int selection)
Add Date to this instance of DayRanges

Parameters:
day - java.util.Date specifying the date to be added
tooltip - String specifying the tooltip to be rendered for the added Date
selection - selection mode

add

public void add(Date begin,
                Date end)
Add a range of Dates to this instance of DayRanges. The start date, the end date and every day that lies between these days will be added.

Parameters:
begin - java.util.Date specifying the start of the range to be added
end - java.util.Date specifying the end of the range to be added

add

public void add(Date begin,
                Date end,
                String tooltip)
Add a range of Dates to this instance of DayRanges. The start date, the end date and every day that lies between these days will be added.

Parameters:
begin - java.util.Date specifying the start of the range to be added
end - java.util.Date specifying the end of the range to be added
tooltip - String specifying the tooltip to be rendered for the added Date

add

public void add(Date begin,
                Date end,
                int selection)
Add a range of Dates to this instance of DayRanges. The start date, the end date and every day that lies between these days will be added.

Parameters:
begin - java.util.Date specifying the start of the range to be added
end - java.util.Date specifying the end of the range to be added
selection - selection mode

add

public void add(Date begin,
                Date end,
                String tooltip,
                int selection)
Add a range of Dates to this instance of DayRanges. The start date, the end date and every day that lies between these days will be added.

Parameters:
begin - java.util.Date specifying the start of the range to be added
end - java.util.Date specifying the end of the range to be added
tooltip - String specifying the tooltip to be rendered for the added Date

addMonth

public void addMonth(int month,
                     int year)
Add all days of a month to this instance of DayRanges.

Parameters:
month - int specifying the month (as defined by java.util.Calendar)
year - int specifying the year

addMonth

public void addMonth(int month,
                     int year,
                     String tooltip)
Add all days of a month to this instance of DayRanges.

Parameters:
month - int specifying the month (as defined by java.util.Calendar)
year - int specifying the year
tooltip - String specifying the tooltip to be rendered for the added Date

addMonth

public void addMonth(int month,
                     int year,
                     int selection)
Add all days of a month to this instance of DayRanges.

Parameters:
month - int specifying the month (as defined by java.util.Calendar)
year - int specifying the year
selection - selection mode

addMonth

public void addMonth(int month,
                     int year,
                     String tooltip,
                     int selection)
Add all days of a month to this instance of DayRanges.

Parameters:
month - int specifying the month (as defined by java.util.Calendar)
year - int specifying the year
tooltip - String specifying the tooltip to be rendered for the added Date
selection - selection mode

addWeek

public void addWeek(int week,
                    int year)
Add all days of a week to this instance of DayRanges. WARNING: if no locale specified for this instance the result may be incorrect!

Parameters:
week - int specifying the week of year
year - int specifying the year

addWeek

public void addWeek(int week,
                    int year,
                    int selection)
Add all days of a week to this instance of DayRanges. WARNING: if no locale specified for this instance the result may be incorrect!

Parameters:
week - int specifying the week of year
year - int specifying the year
selection - selection mode

addWeek

public void addWeek(int week,
                    int year,
                    String tooltip)
Add all days of a week to this instance of DayRanges. WARNING: if no locale specified for this instance the result may be incorrect!

Parameters:
week - int specifying the week of year
year - int specifying the year
tooltip - String specifying the tooltip to be rendered for the added Date

addWeek

public void addWeek(int week,
                    int year,
                    String tooltip,
                    int selection)
Add all days of a week to this instance of DayRanges. WARNING: if no locale specified for this instance the result may be incorrect!

Parameters:
week - int specifying the week of year
year - int specifying the year
tooltip - String specifying the tooltip to be rendered for the added Date

deleteTimeInfo

public static void deleteTimeInfo(Calendar calendar)
Utility method to delete all time info in a calendar. This sets the hour of day, minute, second and millisecond to zero and leaves the date fields unchanged.

Parameters:
calendar - Calendar whose time info should be cleared

normalizeDate

public static Date normalizeDate(Calendar calendar,
                                 Date date)
Utility method to delete all time info in a Date. The given calendar is used to savely convert the given Date to a Date with the same day/month/year but with all time fields zeroed. The calendar instance will not be modified inany way ba this method (i.e. the inherent time info inside the calendar will be preserved)

Parameters:
calendar - Calendar used for generating the new Date
date - Date whose time info should be cleared
Returns:
Date with all time fields cleared

getSelectionMode

public int getSelectionMode(Date date)
Get selection mode that has been set for a Date.

Parameters:
date - get the tooltip of this Date
Returns:
selection mode for this date, SELECTION_MODE_NONE will be returned if none set or date not found

getTooltip

public String getTooltip(Date date)
Get the tooltip that has been set for a Date.

Parameters:
date - get the tooltip of this Date
Returns:
tooltip String, will be null if date is not in range or no tooltip has been added for this date.

getCalendar

public Calendar getCalendar()
Get Calendar instance associated with this DayRanges instance.


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.

Returns:
boolean indicating if locale should be switched


Copyright 2006 SAP AG. All rights reserved. No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG. The information contained herein may be changed without prior notice. Microsoft, Windows, Outlook, and PowerPoint are registered trademarks of Microsoft Corporation. Oracle is a registered trademark of Oracle Corporation. UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group. Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are trademarks or registered trademarks of Citrix Systems, Inc. HTML, XML, XHTML and W3C are trademarks or registered trademarks of W3C, World Wide Web Consortium, Massachusetts Institute of Technology. Java is a registered trademark of Sun Microsystems, Inc. JavaScript is a registered trademark of Sun Microsystems, Inc., used under license for technology invented and implemented by Netscape. MaxDB is a trademark of MySQL AB, Sweden. SAP, R/3, mySAP, mySAP.com, xApps, xApp, SAP NetWeaver, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary. These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies ("SAP Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.