org.richfaces.renderkit
Class CalendarRendererBase

java.lang.Object
  extended by javax.faces.render.Renderer
      extended by org.ajax4jsf.renderkit.RendererBase
          extended by org.ajax4jsf.renderkit.HeaderResourcesRendererBase
              extended by org.richfaces.renderkit.TemplateEncoderRendererBase
                  extended by org.richfaces.renderkit.CalendarRendererBase
All Implemented Interfaces:
org.ajax4jsf.renderkit.ChameleonRenderer, org.ajax4jsf.renderkit.HeaderResourceProducer, org.ajax4jsf.renderkit.HeaderResourceProducer2, org.ajax4jsf.resource.ResourceProduser
Direct Known Subclasses:
CalendarRenderer

public class CalendarRendererBase
extends org.richfaces.renderkit.TemplateEncoderRendererBase

Author:
Nick Belaevski - mailto:nbelaevski@exadel.com created 08.06.2007

Field Summary
static java.lang.String CALENDAR_BUNDLE
           
static java.lang.String CURRENT_DATE_INPUT
          The constant used to resolve id of hidden input placed on the page for storing current date in "MM/yyyy" format.
protected static java.lang.String MARKUP_SUFFIX
           
protected static java.lang.String MONTH_LABELS
           
protected static java.lang.String MONTH_LABELS_SHORT
           
protected static java.lang.String WEEK_DAY_LABELS
           
protected static java.lang.String WEEK_DAY_LABELS_SHORT
           
 
Fields inherited from class org.ajax4jsf.renderkit.RendererBase
JAVASCRIPT_NAMESPACE
 
Constructor Summary
CalendarRendererBase()
           
 
Method Summary
 void addPopupToAjaxRendered(javax.faces.context.FacesContext context, UICalendar component)
           
protected static javax.faces.convert.Converter createDefaultConverter()
          Creates default DateTimeConverter for the calendar
 void dayCellClass(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
           
protected  void doDecode(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
           
 void encodeChildren(javax.faces.context.FacesContext context, javax.faces.component.UIComponent calendar)
           
static java.lang.Object formatDate(java.util.Date date)
           
static java.lang.Object formatSelectedDate(java.util.Date date)
           
protected  java.lang.Class<? extends javax.faces.component.UIComponent> getComponentClass()
           
 java.lang.Object getConvertedValue(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.lang.Object submittedValue)
           
 java.lang.String getCurrentDate(javax.faces.context.FacesContext context, UICalendar calendar, java.util.Date date)
           
 java.lang.String getCurrentDateAsString(javax.faces.context.FacesContext context, UICalendar calendar, java.util.Date date)
           
 java.lang.String getFirstWeekDay(javax.faces.context.FacesContext context, UICalendar calendar)
           
protected  java.lang.String getFormattedValue(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.lang.Object currentValue)
           
protected  java.lang.String getFormattedValue(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.lang.Object currentValue, javax.faces.convert.Converter converter)
          Overloads getFormattedValue to take a advantage of a previously obtained converter.
 java.lang.String getInputValue(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
           
 java.lang.String getMinDaysInFirstWeek(javax.faces.context.FacesContext context, UICalendar calendar)
           
 java.lang.String getPreparedDefaultTime(UICalendar calendar)
          Returns hours and minutes from "defaultTime" attribute as a String with special format: hours:"value_hours",minutes:"value_minutes"
 java.lang.String getSelectedDate(javax.faces.context.FacesContext context, UICalendar calendar)
           
protected  java.util.Map<java.lang.String,java.lang.String[]> getSymbolsMap(javax.faces.context.FacesContext facesContext, UICalendar calendar)
           
protected static javax.faces.convert.Converter setupDefaultConverter(javax.faces.convert.Converter converter, UICalendar calendar)
          Setup the default converter provided by JSF API (DateTimeConverter) with the component settings
 void writeClass(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
           
 void writeDayCellClass(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
           
 void writeDayStyleClass(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
           
 void writeEventHandlerFunction(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.lang.String eventName)
           
 void writeFacetMarkupScriptBody(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.lang.String facetName)
           
 void writeIsDayEnabled(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
           
 void writeLabels(javax.faces.context.FacesContext context, UICalendar calendar)
           
 void writeMarkupScriptBody(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, boolean children)
           
 void writeOptionalFacetMarkupScriptBody(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.lang.String facetName)
           
 void writePreloadBody(javax.faces.context.FacesContext context, UICalendar calendar)
           
 void writeStringFoundInBundle(java.lang.String name, java.lang.String value, javax.faces.context.ResponseWriter writer)
           
 void writeStringsFromBundle(java.util.ResourceBundle bundle1, java.util.ResourceBundle bundle2, java.lang.String name, javax.faces.context.ResponseWriter writer)
          Write labels used in the Calendar component, taken from message bundles.
 void writeSubmitFunction(javax.faces.context.FacesContext context, UICalendar calendar)
           
 void writeSymbols(javax.faces.context.FacesContext facesContext, UICalendar calendar)
           
 
Methods inherited from class org.richfaces.renderkit.TemplateEncoderRendererBase
createContentHandler, getRendersChildren, main, writeScriptBody, writeScriptBody
 
Methods inherited from class org.ajax4jsf.renderkit.HeaderResourcesRendererBase
encodeResourcesArray, encodeToHead, getHeaderScripts, getHeaderStyles, getScripts, getStyles
 
Methods inherited from class org.ajax4jsf.renderkit.RendererBase
addResource, decode, doEncodeBegin, doEncodeChildren, doEncodeEnd, encodeBegin, encodeEnd, getResource, getSkin, getUtils, preDecode, preEncodeBegin, renderChild, renderChildren
 
Methods inherited from class javax.faces.render.Renderer
convertClientId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MONTH_LABELS_SHORT

protected static final java.lang.String MONTH_LABELS_SHORT
See Also:
Constant Field Values

MONTH_LABELS

protected static final java.lang.String MONTH_LABELS
See Also:
Constant Field Values

WEEK_DAY_LABELS_SHORT

protected static final java.lang.String WEEK_DAY_LABELS_SHORT
See Also:
Constant Field Values

WEEK_DAY_LABELS

protected static final java.lang.String WEEK_DAY_LABELS
See Also:
Constant Field Values

CURRENT_DATE_INPUT

public static final java.lang.String CURRENT_DATE_INPUT
The constant used to resolve id of hidden input placed on the page for storing current date in "MM/yyyy" format. Actual id of hidden input used on the page is #{clientId}InputCurrentDate

See Also:
Constant Field Values

MARKUP_SUFFIX

protected static final java.lang.String MARKUP_SUFFIX
See Also:
Constant Field Values

CALENDAR_BUNDLE

public static final java.lang.String CALENDAR_BUNDLE
See Also:
Constant Field Values
Constructor Detail

CalendarRendererBase

public CalendarRendererBase()
Method Detail

getComponentClass

protected java.lang.Class<? extends javax.faces.component.UIComponent> getComponentClass()
Specified by:
getComponentClass in class org.ajax4jsf.renderkit.RendererBase

addPopupToAjaxRendered

public void addPopupToAjaxRendered(javax.faces.context.FacesContext context,
                                   UICalendar component)

getConvertedValue

public java.lang.Object getConvertedValue(javax.faces.context.FacesContext context,
                                          javax.faces.component.UIComponent component,
                                          java.lang.Object submittedValue)
                                   throws javax.faces.convert.ConverterException
Overrides:
getConvertedValue in class javax.faces.render.Renderer
Throws:
javax.faces.convert.ConverterException

getPreparedDefaultTime

public java.lang.String getPreparedDefaultTime(UICalendar calendar)
Returns hours and minutes from "defaultTime" attribute as a String with special format: hours:"value_hours",minutes:"value_minutes"

Parameters:
calendar - - UICalendar
Returns:
hours and minutes from "defaultTime" attribute

getFormattedValue

protected java.lang.String getFormattedValue(javax.faces.context.FacesContext context,
                                             javax.faces.component.UIComponent component,
                                             java.lang.Object currentValue,
                                             javax.faces.convert.Converter converter)
                                      throws javax.faces.convert.ConverterException
Overloads getFormattedValue to take a advantage of a previously obtained converter.

Parameters:
context - the FacesContext for the current request
component - UIComponent of interest
currentValue - the current value of component
converter - the component's converter
Returns:
the currentValue after any associated Converter has been applied
Throws:
javax.faces.convert.ConverterException - if the value cannot be converted

getFormattedValue

protected java.lang.String getFormattedValue(javax.faces.context.FacesContext context,
                                             javax.faces.component.UIComponent component,
                                             java.lang.Object currentValue)
                                      throws javax.faces.convert.ConverterException
Parameters:
context - the FacesContext for the current request
component - UIComponent of interest
currentValue - the current value of component
Returns:
the currentValue after any associated Converter has been applied
Throws:
javax.faces.convert.ConverterException - if the value cannot be converted

createDefaultConverter

protected static javax.faces.convert.Converter createDefaultConverter()
Creates default DateTimeConverter for the calendar

Parameters:
calendar - - calendar component
Returns:
created converter

setupDefaultConverter

protected static javax.faces.convert.Converter setupDefaultConverter(javax.faces.convert.Converter converter,
                                                                     UICalendar calendar)
Setup the default converter provided by JSF API (DateTimeConverter) with the component settings

Parameters:
converter -
calendar -
Returns:

doDecode

protected void doDecode(javax.faces.context.FacesContext context,
                        javax.faces.component.UIComponent component)
Overrides:
doDecode in class org.ajax4jsf.renderkit.RendererBase

encodeChildren

public void encodeChildren(javax.faces.context.FacesContext context,
                           javax.faces.component.UIComponent calendar)
                    throws java.io.IOException
Overrides:
encodeChildren in class org.richfaces.renderkit.TemplateEncoderRendererBase
Throws:
java.io.IOException

writeClass

public void writeClass(javax.faces.context.FacesContext context,
                       javax.faces.component.UIComponent component)
                throws java.io.IOException
Throws:
java.io.IOException

writeDayStyleClass

public void writeDayStyleClass(javax.faces.context.FacesContext context,
                               javax.faces.component.UIComponent component)
                        throws java.io.IOException
Throws:
java.io.IOException

writeIsDayEnabled

public void writeIsDayEnabled(javax.faces.context.FacesContext context,
                              javax.faces.component.UIComponent component)
                       throws java.io.IOException
Throws:
java.io.IOException

writeMarkupScriptBody

public void writeMarkupScriptBody(javax.faces.context.FacesContext context,
                                  javax.faces.component.UIComponent component,
                                  boolean children)
                           throws java.io.IOException
Throws:
java.io.IOException

writeOptionalFacetMarkupScriptBody

public void writeOptionalFacetMarkupScriptBody(javax.faces.context.FacesContext context,
                                               javax.faces.component.UIComponent component,
                                               java.lang.String facetName)
                                        throws java.io.IOException
Throws:
java.io.IOException

dayCellClass

public void dayCellClass(javax.faces.context.FacesContext context,
                         javax.faces.component.UIComponent component)
                  throws java.io.IOException
Throws:
java.io.IOException

writeDayCellClass

public void writeDayCellClass(javax.faces.context.FacesContext context,
                              javax.faces.component.UIComponent component)
                       throws java.io.IOException
Throws:
java.io.IOException

writeFacetMarkupScriptBody

public void writeFacetMarkupScriptBody(javax.faces.context.FacesContext context,
                                       javax.faces.component.UIComponent component,
                                       java.lang.String facetName)
                                throws java.io.IOException
Throws:
java.io.IOException

writePreloadBody

public void writePreloadBody(javax.faces.context.FacesContext context,
                             UICalendar calendar)
                      throws java.io.IOException
Throws:
java.io.IOException

writeSubmitFunction

public void writeSubmitFunction(javax.faces.context.FacesContext context,
                                UICalendar calendar)
                         throws java.io.IOException
Throws:
java.io.IOException

writeEventHandlerFunction

public void writeEventHandlerFunction(javax.faces.context.FacesContext context,
                                      javax.faces.component.UIComponent component,
                                      java.lang.String eventName)
                               throws java.io.IOException
Throws:
java.io.IOException

getInputValue

public java.lang.String getInputValue(javax.faces.context.FacesContext context,
                                      javax.faces.component.UIComponent component)

writeSymbols

public void writeSymbols(javax.faces.context.FacesContext facesContext,
                         UICalendar calendar)
                  throws java.io.IOException
Throws:
java.io.IOException

getSymbolsMap

protected java.util.Map<java.lang.String,java.lang.String[]> getSymbolsMap(javax.faces.context.FacesContext facesContext,
                                                                           UICalendar calendar)

getFirstWeekDay

public java.lang.String getFirstWeekDay(javax.faces.context.FacesContext context,
                                        UICalendar calendar)
                                 throws java.io.IOException
Throws:
java.io.IOException

getMinDaysInFirstWeek

public java.lang.String getMinDaysInFirstWeek(javax.faces.context.FacesContext context,
                                              UICalendar calendar)
                                       throws java.io.IOException
Throws:
java.io.IOException

getCurrentDateAsString

public java.lang.String getCurrentDateAsString(javax.faces.context.FacesContext context,
                                               UICalendar calendar,
                                               java.util.Date date)
                                        throws java.io.IOException
Throws:
java.io.IOException

getCurrentDate

public java.lang.String getCurrentDate(javax.faces.context.FacesContext context,
                                       UICalendar calendar,
                                       java.util.Date date)
                                throws java.io.IOException
Throws:
java.io.IOException

getSelectedDate

public java.lang.String getSelectedDate(javax.faces.context.FacesContext context,
                                        UICalendar calendar)
                                 throws java.io.IOException
Throws:
java.io.IOException

formatDate

public static java.lang.Object formatDate(java.util.Date date)

formatSelectedDate

public static java.lang.Object formatSelectedDate(java.util.Date date)

writeStringsFromBundle

public void writeStringsFromBundle(java.util.ResourceBundle bundle1,
                                   java.util.ResourceBundle bundle2,
                                   java.lang.String name,
                                   javax.faces.context.ResponseWriter writer)
                            throws java.io.IOException
Write labels used in the Calendar component, taken from message bundles. Try to use bundle1 at first. If the 1st bundle is null or it doesn't contain requested message key, use the bundle2.

Parameters:
bundle1 - - 1st bundle to be used as a source for messages
bundle2 - - 2nd bundle to be used as a source for messages
name - - name of the requested label
writer - - response writer
Throws:
java.io.IOException

writeStringFoundInBundle

public void writeStringFoundInBundle(java.lang.String name,
                                     java.lang.String value,
                                     javax.faces.context.ResponseWriter writer)
                              throws java.io.IOException
Throws:
java.io.IOException

writeLabels

public void writeLabels(javax.faces.context.FacesContext context,
                        UICalendar calendar)
                 throws java.io.IOException
Throws:
java.io.IOException


Copyright © 2009. All Rights Reserved.