jacquard 1.12.0 by The Web Engineering Factory and Toolworks

uk.co.weft.htform
Class CalendarPseudoWidget

java.lang.Object
  extended byuk.co.weft.htform.ResourceConsumerImpl
      extended byuk.co.weft.domutil.NodeGeneratorImpl
          extended byuk.co.weft.htform.Widget
              extended byuk.co.weft.htform.TimeStampWidget
                  extended byuk.co.weft.htform.DateWidget
                      extended byuk.co.weft.htform.CalendarPseudoWidget
All Implemented Interfaces:
java.lang.Cloneable, NodeGenerator, ResourceConsumer
Direct Known Subclasses:
EventsDiaryPseudoWidget

public class CalendarPseudoWidget
extends DateWidget
implements NodeGenerator

Not really a widget at all, but inheriting from widget so that it can be layed out in forms. Shows a month view of a calendar.

Version:
$Revision: 1.7.4.4 $ This revision: $Author: simon $
Author:
Simon Brooke (simon[at]jasmine.org.uk), Dimitrios Barpakis (dimitrios[at]weft.co.uk)

Field Summary
 
Fields inherited from class uk.co.weft.htform.TimeStampWidget
allowUnset, AMPMSUFFIX, DAYSUFFIX, DEFAULTSECONDS, HOURSUFFIX, maxYear, MINUTESUFFIX, minYear, monthname, MONTHSUFFIX, nullMarker, SECONDSUFFIX, showAmPm, showDayWidget, showSecWidget, showYearWidget, YEARSUFFIX
 
Fields inherited from class uk.co.weft.htform.Widget
ACTIONCSSCLASS, akprompt, attrs, CONTEXTATTRIBUTESSUFFIX, cssClass, DANGEROUSCSSCLASS, debug, DEFAULTTOKEN, dflt, form, generateAs, GENERATEASHTML, GENERATEASXFORM, GENERATEASXML, help, HELPTOKEN, immutable, ISIMMUTABLETOKEN, ISMANDATORYTOKEN, mandatory, MANDATORYCSSCLASS, maxVisibleSize, name, NAMETOKEN, OPTIONALCSSCLASS, PREVIOUSVALUESUFFIX, prompt, PROMPTTOKEN, size, SIZETOKEN, type, TYPETOKEN
 
Fields inherited from class uk.co.weft.domutil.NodeGeneratorImpl
namespaceURI
 
Fields inherited from class uk.co.weft.htform.ResourceConsumerImpl
resourceBundleName
 
Fields inherited from interface uk.co.weft.domutil.NodeGenerator
NAMESPACEURIMAGICTOKEN
 
Fields inherited from interface uk.co.weft.htform.ResourceConsumer
RESOURCEBUNDLEMAGICTOKEN
 
Constructor Summary
CalendarPseudoWidget()
          Creates a new CalendarPseudoWidget object.
CalendarPseudoWidget(java.lang.String name, java.lang.String prompt, java.lang.String help)
          Construct a CalendarPseudoWidget with the normal default widget stuff; Nothing special here.
 
Method Summary
protected  void formatBackControl(Context context)
          Format a 'previous month' control for output.
protected  void formatBackControl(Context context, int tabIndex)
          Layout a 'previous' control.
protected  void formatDate(Calendar when, Context context)
          Format the content of the cell for an individual date for printing.
protected  void formatDateCell(Calendar when, int month, Context context)
          Format an individual date for printing, with it's enclosing table data tags.
protected  void formatEndOfWeek(Calendar when, int month, int week, Context context)
          Specialise this to add extra stuff at the end of a week row - you may, perhaps, want to do a 'view week' control.
protected  void formatNextControl(Context context)
          Format a 'next month' control for output.
protected  void formatNextControl(Context context, int tabIndex)
          Layout a 'previous' control.
 int getTabPlaces(Context context)
          Specialisation:
protected  boolean isWeekend(int day)
          Return true if day is a weekend day
 void layout(Context context, int tabIndex)
          layout just the widget, without prompt, help, or surrounding context
protected  void preProcess(Context context)
          Check for 'previous' and 'next' controls and handle them server-side
 
Methods inherited from class uk.co.weft.htform.DateWidget
generateInnerHTML, getWidth, layoutValue, scriptRequest
 
Methods inherited from class uk.co.weft.htform.TimeStampWidget
getDateTabPlaces, getTimeTabPlaces, layoutDatePart, layoutDatePart, layoutDateValue, layoutTimePart, layoutTimePart, layoutTimeValue, onloadRequest, postProcess, preProcessDate, preProcessTime
 
Methods inherited from class uk.co.weft.htform.Widget
clone, generate, generateAttributes, generateAttributes, generateHTML, generateHTMLPrompt, generateValue, generateXML, getContextAttribute, getCssClass, getHeight, getHelp, getName, getPrompt, getType, init, layout, layout, layout, layoutAttribute, layoutAttributes, makeReady, maybeLayout, maybeLayout, onloadRequest, scriptRequest, setAttribute, setContextAttribute, setCssClass, setDebug, setDefault, setHelp, setImmutable, setMandatory, setMandatory, setName, setPrompt, setSize, setType
 
Methods inherited from class uk.co.weft.domutil.NodeGeneratorImpl
getNamespaceURI, setNamespaceURI
 
Methods inherited from class uk.co.weft.htform.ResourceConsumerImpl
getContextOrResource, getResource, getResourceOrContext, getResourceString, grs, grs
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface uk.co.weft.domutil.NodeGenerator
generate, getName, getNamespaceURI, init, setDebug
 

Constructor Detail

CalendarPseudoWidget

public CalendarPseudoWidget()
Creates a new CalendarPseudoWidget object.


CalendarPseudoWidget

public CalendarPseudoWidget(java.lang.String name,
                            java.lang.String prompt,
                            java.lang.String help)
Construct a CalendarPseudoWidget with the normal default widget stuff; Nothing special here.

Method Detail

formatBackControl

protected void formatBackControl(Context context)
                          throws java.io.IOException
Format a 'previous month' control for output. Must have name widgetname + '_prev'. Default is just a button. Specialise if you want an image widget

Throws:
unlikely - to throw IOException unless something is horribly broken;
java.io.IOException

formatBackControl

protected void formatBackControl(Context context,
                                 int tabIndex)
                          throws java.io.IOException
Layout a 'previous' control. This is /horrible/ and won't play at all well with i18n; it should be rewritten

Parameters:
context - the service context
tabIndex - the tab index of the pseudo widget to be laid out
Throws:
java.io.IOException - if can't write to the output

formatDate

protected void formatDate(Calendar when,
                          Context context)
                   throws java.io.IOException,
                          DataStoreException
Format the content of the cell for an individual date for printing. You will probably choose to override this to change appearance, but see also formatDateCell

Throws:
unlikely - to throw IOException unless something is horribly broken;
doesn - 't actually throw DataStoreException but things which specialise it may want to.
java.io.IOException
DataStoreException

formatDateCell

protected void formatDateCell(Calendar when,
                              int month,
                              Context context)
                       throws java.io.IOException,
                              DataStoreException
Format an individual date for printing, with it's enclosing table data tags. You may override this to change appearance, but see also formatDate which is probably a better choice.

Throws:
unlikely - to throw IOException unless something is horribly broken;
java.io.IOException
DataStoreException

formatEndOfWeek

protected void formatEndOfWeek(Calendar when,
                               int month,
                               int week,
                               Context context)
                        throws java.io.IOException,
                               DataFormatException
Specialise this to add extra stuff at the end of a week row - you may, perhaps, want to do a 'view week' control. If so you need to ouput tags for a table cell with your content inside. Default version does nothing.

Throws:
unlikely - to throw IOException unless something is horribly broken;
doesn - 't actually throw DataStoreException but things which specialise it may want to.
java.io.IOException
DataFormatException

formatNextControl

protected void formatNextControl(Context context)
                          throws java.io.IOException
Format a 'next month' control for output. Must have name widgetname + '_next'. Default is just a button. Specialise if you want an image widget

Throws:
unlikely - to throw IOException unless something is horribly broken;
java.io.IOException

formatNextControl

protected void formatNextControl(Context context,
                                 int tabIndex)
                          throws java.io.IOException
Layout a 'previous' control. This is /horrible/ and won't play at all well with i18n; it should be rewritten

Parameters:
context - the service context
tabIndex - the tab index of the pseudo widget to be laid out
Throws:
java.io.IOException - if can't write to the output

getTabPlaces

public int getTabPlaces(Context context)
Specialisation:

Overrides:
getTabPlaces in class DateWidget
Parameters:
context -
Returns:
See Also:
DateWidget.getTabPlaces(uk.co.weft.dbutil.Context)

isWeekend

protected boolean isWeekend(int day)
Return true if day is a weekend day


layout

public void layout(Context context,
                   int tabIndex)
            throws java.io.IOException,
                   DataStoreException
layout just the widget, without prompt, help, or surrounding context

Overrides:
layout in class DateWidget
Parameters:
context - the service context
tabIndex - the tabindex to use, ot the tab index of my first sub-widget if I have more than one
Throws:
DataStoreException - I don't, but things which specialise me may
javax.servlet.ServletException - I don't, but things which specialise me may
java.io.IOException - if can't write to the output stream
See Also:
TimeStampWidget.layout(uk.co.weft.dbutil.Context,int)

preProcess

protected void preProcess(Context context)
                   throws DataStoreException,
                          javax.servlet.ServletException
Check for 'previous' and 'next' controls and handle them server-side

Overrides:
preProcess in class DateWidget
Parameters:
context - the service context
Throws:
javax.servlet.ServletException
DataStoreException
See Also:
TimeStampWidget.preProcess(uk.co.weft.dbutil.Context)

jacquard 1.12.0 by The Web Engineering Factory and Toolworks