org.apache.wicket.extensions.yui.calendar
Class AbstractCalendar

java.lang.Object
  extended by org.apache.wicket.Component
      extended by org.apache.wicket.markup.html.WebComponent
          extended by org.apache.wicket.extensions.yui.calendar.AbstractCalendar
All Implemented Interfaces:
java.io.Serializable, IClusterable, IConverterLocator

public abstract class AbstractCalendar
extends WebComponent

Abstract calendar component based on the YUI (Yahoo User Interface library) javascript widget.

Although this component by itself is fully functional, it doesn't do much other than just displaying the calendar. Hence, this class is abstract.

An easy way to build upon this component is to override appendToInit(String, String, String, StringBuffer) and add event handlers etc. in the YUI widget's initialization function.

See YUI's calendar documentation for more info.

Author:
eelcohillenius
See Also:
CalendarPopup, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.wicket.Component
Component.ComponentModelChange, Component.EnabledChange, Component.IVisitor, Component.VisibilityChange
 
Field Summary
static java.text.DateFormat FORMAT_DATE
          Format to be used when configuring YUI calendar.
static java.text.DateFormat FORMAT_PAGEDATE
          For specifying which page (month/year) to show in the calendar, use this format for the date.
 
Fields inherited from class org.apache.wicket.Component
ENABLE, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED6, FLAG_RESERVED7, FLAG_RESERVED8, PATH_SEPARATOR, RENDER
 
Constructor Summary
AbstractCalendar(java.lang.String id)
          Construct.
AbstractCalendar(java.lang.String id, boolean contributeDependencies)
          Construct.
 
Method Summary
protected  void appendToInit(java.lang.String markupId, java.lang.String javascriptId, java.lang.String javascriptWidgetId, java.lang.StringBuffer b)
          Append javascript to the initialization function for the YUI widget.
protected  void configureWidgetProperties(java.util.Map widgetProperties)
          Gives overriding classes the option of adding (or even changing/ removing) configuration properties for the javascript widget.
 java.lang.String getJavascriptId()
          Gets the id of the javascript widget.
 java.lang.String getJavascriptWidgetId()
          The name spaced id of the widget.
 
Methods inherited from class org.apache.wicket.markup.html.WebComponent
onRender
 
Methods inherited from class org.apache.wicket.Component
add, addStateChange, afterRender, beforeRender, callOnBeforeRenderIfNotVisible, checkComponentTag, checkComponentTagAttribute, checkHierarchyChange, continueToOriginalDestination, debug, detach, detachBehaviors, detachModel, detachModels, determineVisibility, error, exceptionMessage, fatal, findMarkupStream, findPage, findParent, findParentWithAssociatedMarkup, getApplication, getBehaviors, getBehaviors, getBehaviorsRawList, getClassRelativePath, getComponentBorder, getConverter, getConverter, getEscapeModelStrings, getFeedbackMessage, getFlag, getFlag, getId, getInnermostModel, getInnermostModel, getLocale, getLocalizer, getMarkupAttributes, getMarkupId, getMarkupId, getMetaData, getModel, getModelComparator, getModelObject, getModelObjectAsString, getModelObjectAsString, getOutputMarkupId, getOutputMarkupPlaceholderTag, getPage, getPageFactory, getPageRelativePath, getParent, getPath, getRenderBodyOnly, getRequest, getRequestCycle, getResponse, getSession, getSizeInBytes, getStatelessHint, getString, getString, getString, getStyle, getVariation, hasBeenRendered, hasErrorMessage, hasFeedbackMessage, info, initModel, internalAttach, internalDetach, internalOnAttach, internalOnDetach, internalOnModelChanged, isActionAuthorized, isAncestorOf, isAttached, isBehaviorAccepted, isEnableAllowed, isEnabled, isIgnoreAttributeModifier, isRenderAllowed, isStateless, isVersioned, isVisibilityAllowed, isVisible, isVisibleInHierarchy, locateMarkupStream, markAttached, markRendering, modelChanged, modelChanging, newPage, newPage, onAfterRender, onAttach, onBeforeRender, onBeginRequest, onComponentTag, onComponentTagBody, onDetach, onEndRequest, onModelChanged, onModelChanging, prepareForRender, redirectToInterceptPage, remove, remove, render, render, renderComponent, renderComponent, renderComponentTag, rendered, renderHead, replaceComponentTagBody, replaceWith, sameInnermostModel, sameInnermostModel, setAuto, setComponentBorder, setEnabled, setEscapeModelStrings, setFlag, setFlag, setIgnoreAttributeModifier, setMarkupId, setMarkupStream, setMetaData, setModel, setModelObject, setOutputMarkupId, setOutputMarkupPlaceholderTag, setRedirect, setRenderBodyOnly, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisibilityAllowed, setVisible, toString, toString, urlFor, urlFor, urlFor, urlFor, urlFor, urlFor, visitParents, warn, wrap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FORMAT_DATE

public static final java.text.DateFormat FORMAT_DATE
Format to be used when configuring YUI calendar. Can be used when using the "selected" property.


FORMAT_PAGEDATE

public static final java.text.DateFormat FORMAT_PAGEDATE
For specifying which page (month/year) to show in the calendar, use this format for the date. This is to be used together with the property "pagedate"

Constructor Detail

AbstractCalendar

public AbstractCalendar(java.lang.String id)
Construct. Contributes packaged dependencies.

Parameters:
id - The component id

AbstractCalendar

public AbstractCalendar(java.lang.String id,
                        boolean contributeDependencies)
Construct.

Parameters:
id - The component id
contributeDependencies - Whether to contribute the packaged dependencies. Pass false in case you want to include the dependencies manually in your own page, e.g. when you want to keep them in your web application dir. To contribute yourself (in case you want to pass false), your page header should look like:
         <script type="text/javascript" src="yahoo.js"></script>
         <script type="text/javascript" src="dom.js"></script>
         <script type="text/javascript" src="event.js"></script>
         <script type="text/javascript" src="calendar.js"></script>
         <link rel="stylesheet" type="text/css" href="calendar.css" />
 
Method Detail

getJavascriptId

public final java.lang.String getJavascriptId()
Gets the id of the javascript widget. Note that this is the non-namespaced id, so depending on what you want to do with it, you may need to prepend 'YAHOO.wicket.' to it. Or you can call getJavascriptWidgetId().

Returns:
The javascript id
See Also:
getJavascriptWidgetId()

getJavascriptWidgetId

public final java.lang.String getJavascriptWidgetId()
The name spaced id of the widget.

Returns:
The widget id
See Also:
getJavascriptId()

appendToInit

protected void appendToInit(java.lang.String markupId,
                            java.lang.String javascriptId,
                            java.lang.String javascriptWidgetId,
                            java.lang.StringBuffer b)
Append javascript to the initialization function for the YUI widget. Can be used by subclasses to conveniently extend configuration without having to write a separate contribution.

Parameters:
markupId - The markup id of the calendar component
javascriptId - the non-name spaced javascript id of the widget
javascriptWidgetId - the name space id of the widget
b - the buffer to append the script to

configureWidgetProperties

protected void configureWidgetProperties(java.util.Map widgetProperties)
Gives overriding classes the option of adding (or even changing/ removing) configuration properties for the javascript widget. See the widget's documentation for the available options. If you want to override/ remove properties, you obviously should call super#setWidgetProperties(Properties) first.

Parameters:
widgetProperties - the current widget properties


Copyright © 2004-2010 Apache Software Foundation. All Rights Reserved.