com.bradrydzewski.gwt.calendar.client
Class CalendarFormat

java.lang.Object
  extended by com.bradrydzewski.gwt.calendar.client.CalendarFormat

public class CalendarFormat
extends Object


Field Summary
static int HOURS_IN_DAY
           
static CalendarFormat INSTANCE
           
static CalendarConstants MESSAGES
           
 
Method Summary
 String getAm()
           
 com.google.gwt.i18n.client.DateTimeFormat getDateFormat()
           
 String[] getDayOfWeekAbbreviatedNames()
           
 String[] getDayOfWeekNames()
          Returns the names (labels) of the days of the week.
 int getFirstDayOfWeek()
          Returns the currently configured day to start weeks in the MonthView.
 String[] getHourLabels()
          Returns the configured labels for the 24 hours of the day.
 String getNoon()
          Returns the currently configured label for the noon (12 p.m.).
 String getPm()
           
 com.google.gwt.i18n.client.DateTimeFormat getTimeFormat()
           
 void setAm(String am)
           
 void setDateFormat(String formatPattern)
           
 void setDayOfMonthFormat(String formatPattern)
          Configures the formatting pattern to render the days of the month using DateTimeFormat.
 void setDayOfWeekAbbreviatedFormat(String formatPattern)
          Configures the formatting pattern to render the days of the week in an abbreviated manner using DateTimeFormat.
 void setDayOfWeekFormat(String formatPattern)
          Configures the formatting pattern to render the days of the week using DateTimeFormat.
 void setFirstDayOfWeek(int firstDayOfWeek)
          Configures the first day in the week when rendering the month view.
 void setHourLabels(String[] hourLabels)
          Allows programmatic configuration of the 24 hour labels in the calendar.
 void setNoon(String noon)
          Configures the label to show for the 12 p.m.
 void setPm(String pm)
           
 void setTimeFormat(String formatPattern)
          Sets the pattern used to format the displayed hours and re-generates all hour labels.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MESSAGES

public static final CalendarConstants MESSAGES

HOURS_IN_DAY

public static final int HOURS_IN_DAY
See Also:
Constant Field Values

INSTANCE

public static CalendarFormat INSTANCE
Method Detail

setDayOfWeekFormat

public void setDayOfWeekFormat(String formatPattern)
Configures the formatting pattern to render the days of the week using DateTimeFormat.

Parameters:
formatPattern - The pattern to format day names
See Also:
DateTimeFormat.getFormat(String)

getDayOfWeekNames

public String[] getDayOfWeekNames()
Returns the names (labels) of the days of the week.

Returns:
The days of the 7 days of the week, formatted with the current configuration

setDayOfWeekAbbreviatedFormat

public void setDayOfWeekAbbreviatedFormat(String formatPattern)
Configures the formatting pattern to render the days of the week in an abbreviated manner using DateTimeFormat.

Parameters:
formatPattern - The pattern to format day names
See Also:
DateTimeFormat.getFormat(String)

getDayOfWeekAbbreviatedNames

public String[] getDayOfWeekAbbreviatedNames()

setDayOfMonthFormat

public void setDayOfMonthFormat(String formatPattern)
Configures the formatting pattern to render the days of the month using DateTimeFormat. Most likely, formatPattern will contain at the minimum, the format to render the number of the corresponding day.

Parameters:
formatPattern - The pattern to format days in the month view
See Also:
DateTimeFormat.getFormat(String)

setDateFormat

public void setDateFormat(String formatPattern)

getDateFormat

public com.google.gwt.i18n.client.DateTimeFormat getDateFormat()

setTimeFormat

public void setTimeFormat(String formatPattern)
Sets the pattern used to format the displayed hours and re-generates all hour labels.

Parameters:
formatPattern - A legal format following the patterns in DateTimeFormat

getTimeFormat

public com.google.gwt.i18n.client.DateTimeFormat getTimeFormat()

setHourLabels

public void setHourLabels(String[] hourLabels)
Allows programmatic configuration of the 24 hour labels in the calendar.

Parameters:
hourLabels - The labels to be used as labels for the hours of the day.
Throws:
IllegalArgumentException - If the hourLabes array is null, does not have 24 elements, or any of the elements is null

getFirstDayOfWeek

public int getFirstDayOfWeek()
Returns the currently configured day to start weeks in the MonthView. The default value is read from the CalendarConstants i18n configuration file, but it can be changed through the setFirstDayOfWeek method of this class.

Returns:
The currently configured day to start weeks, 0 for Sunday, 1 for Monday, and so on.

setFirstDayOfWeek

public void setFirstDayOfWeek(int firstDayOfWeek)
Configures the first day in the week when rendering the month view.

Parameters:
firstDayOfWeek - The first day of the week, where Sunday is represented by 0, Monday by 1, and so on.

getAm

public String getAm()

setAm

public void setAm(String am)

getPm

public String getPm()

setPm

public void setPm(String pm)

getNoon

public String getNoon()
Returns the currently configured label for the noon (12 p.m.).

Returns:
The configured label for the 12 p.m. time either through the CalendarConstants or the setNoon method of this class.

setNoon

public void setNoon(String noon)
Configures the label to show for the 12 p.m.

Parameters:
noon - A label to show instead of 12 p.m.

getHourLabels

public String[] getHourLabels()
Returns the configured labels for the 24 hours of the day. Some labels will vary, depending con configuration, for example "Noon" instead of "12".

Returns:
An array of Strings with the corresponding labels for the hours in a day


Copyright © 2012. All Rights Reserved.