|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.faces.render.Renderer org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlRenderer org.apache.myfaces.custom.calendar.HtmlCalendarRenderer
public class HtmlCalendarRenderer
Render a "calendar" which the user can use to choose a specific day.
This renderer behaves quite differently for "inline" and "popup" calendars.
When inline, this component automatically creates child components (text and link components) to represent all the dates, scrollers, etc. within itself and renders those children. Clicking on any link in the component causes the surrounding form to immediately submit.
When popup, this component just renders an empty span with the component id, and a dozen or so lines of javascript which create an instance of a "tomahawk calendar object", set its properties from the properties on the associated HtmlInputCalendar component, and then invoke it. That javascript object then dynamically builds DOM objects and attaches them to the empty span. This component also renders a button or image that toggles the visibility of that empty span, thereby making the popup appear and disappear.
Note that the two ways of generating the calendar use totally different code; one implementation is here and the other is in a javascript resource file. For obvious reasons the appearance of the two calendars should be similar, so if a feature is added in one place it is recommended that the other be updated also.
The behaviour of both of the Calendar objects varies depending upon the "current locale". This is derived from getViewRoot().getLocale(), which is normally set according to the browser preferences; users whose browsers have "english" as the preferred language will get the "en" locale, while users with "deutsch" as the preferred language will get the "de" locale. One specific example is the "first day of week" (ie the day displayed at the left of each week row); this is "sunday" for the english locale, and "monday" for the german locale. There is currently no way for the calendar component to be configured to force a specific firstDayOfWeek to be used for all users.
Nested Class Summary | |
---|---|
static class |
HtmlCalendarRenderer.CalendarDateTimeConverter
|
static interface |
HtmlCalendarRenderer.DateConverter
|
Constructor Summary | |
---|---|
HtmlCalendarRenderer()
|
Method Summary | |
---|---|
static void |
addScriptAndCSSResources(javax.faces.context.FacesContext facesContext,
javax.faces.component.UIComponent component)
Used by the x:inputDate renderer : HTMLDateRenderer |
void |
decode(javax.faces.context.FacesContext facesContext,
javax.faces.component.UIComponent component)
|
void |
encodeEnd(javax.faces.context.FacesContext facesContext,
javax.faces.component.UIComponent component)
|
Object |
getConvertedValue(javax.faces.context.FacesContext facesContext,
javax.faces.component.UIComponent uiComponent,
Object submittedValue)
|
static String |
getLocalizedLanguageScript(javax.faces.context.FacesContext facesContext,
DateFormatSymbols symbols,
int firstDayOfWeek,
javax.faces.component.UIComponent uiComponent,
String popupCalendarVariable)
Creates and returns a String which contains the initialisation data for the popup calendar control as a sequence of javascript commands that assign values to properties of a javascript object whose name is in parameter popupCalendarVariable. |
static void |
getScriptBtn(javax.faces.context.ResponseWriter writer,
javax.faces.context.FacesContext facesContext,
javax.faces.component.UIComponent uiComponent,
String dateFormat,
String popupButtonString,
FunctionCallProvider prov)
|
protected static boolean |
isDisabled(javax.faces.context.FacesContext facesContext,
javax.faces.component.UIComponent uiComponent)
|
static String[] |
mapMonths(DateFormatSymbols symbols)
|
static String[] |
mapShortMonths(DateFormatSymbols symbols)
|
Methods inherited from class org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlRenderer |
---|
getActionUrl, getChildCount, getChildren, getClientId, renderId, shouldRenderId, toUri |
Methods inherited from class javax.faces.render.Renderer |
---|
convertClientId, encodeBegin, encodeChildren, getRendersChildren |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HtmlCalendarRenderer()
Method Detail |
---|
public void encodeEnd(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent component) throws IOException
encodeEnd
in class javax.faces.render.Renderer
IOException
public static void addScriptAndCSSResources(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent component)
public static String getLocalizedLanguageScript(javax.faces.context.FacesContext facesContext, DateFormatSymbols symbols, int firstDayOfWeek, javax.faces.component.UIComponent uiComponent, String popupCalendarVariable)
firstDayOfWeek
- is in java.util.Calendar form, ie Sun=1, Mon=2, Sat=7public static void getScriptBtn(javax.faces.context.ResponseWriter writer, javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent uiComponent, String dateFormat, String popupButtonString, FunctionCallProvider prov) throws IOException
IOException
public static String[] mapMonths(DateFormatSymbols symbols)
public static String[] mapShortMonths(DateFormatSymbols symbols)
public void decode(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent component)
decode
in class javax.faces.render.Renderer
protected static boolean isDisabled(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent uiComponent)
public Object getConvertedValue(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent uiComponent, Object submittedValue) throws javax.faces.convert.ConverterException
getConvertedValue
in class javax.faces.render.Renderer
javax.faces.convert.ConverterException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |