jacquard 1.12.0 by The Web Engineering Factory and Toolworks

uk.co.weft.htform
Class Widget

java.lang.Object
  extended byuk.co.weft.htform.ResourceConsumerImpl
      extended byuk.co.weft.domutil.NodeGeneratorImpl
          extended byuk.co.weft.htform.Widget
All Implemented Interfaces:
java.lang.Cloneable, NodeGenerator, ResourceConsumer
Direct Known Subclasses:
ActionWidget, BooleanWidget, CheckPasswordWidget, CurrencyWidget, DoubleWidget, FileMaybeUploadWidget, HiddenWidget, IntegerWidget, LabelPseudoWidget, LocationWidget, MenuWidget, PasswordWidget, ProgressMeterPseudoWidget, TextAreaWidget, TimeStampWidget, URLWidget

public class Widget
extends NodeGeneratorImpl
implements java.lang.Cloneable

A widget for a hypertext form. Little more than a place holder, really - all the functionality is in the sub-classes. A default widget is a minimal text...

Note that the API design here is poor but it's too late to change it until Jacquard 2. A Widgets's constructor really should be passed a handle on the form it is in.

Version:
$Revision: 1.70.4.11 $ This revision: $Author: simon $
Author:
Simon Brooke

Field Summary
static java.lang.String ACTIONCSSCLASS
          the CSS class I will use for action widgets
protected  java.lang.String akprompt
          the prompt with the access key spliced in
protected  Context attrs
          additional attributes for my input tag
static java.lang.String CONTEXTATTRIBUTESSUFFIX
          a suffix I shall append to widget names to form tokens on which to hold a context of any special attributes to set in the context
protected  java.lang.String cssClass
          A string output as the value of the class attribute in the HTML tags used to layout this widget: in effect a hack to allow you to decorate different actions differently.
static java.lang.String DANGEROUSCSSCLASS
          the CSS class I will use for action widgets
protected  boolean debug
          whether or not I'm in debug mode; if I am I may print debugging messages to System.err
static java.lang.String DEFAULTTOKEN
          magic token for config in init(): the value should be the default value of this widget
protected  java.lang.Object dflt
          My default value, if any
protected  Form form
          the form I am in
protected  int generateAs
          what sort of markup do I generate?
static int GENERATEASHTML
          magic symbol to indicate we generate as HTML:
static int GENERATEASXFORM
          magic symbol to indicate we generate as XForm:
static int GENERATEASXML
          magic symbol to indicate we generate as Jacquard XML:
protected  java.lang.String help
          help information to offer the user
static java.lang.String HELPTOKEN
          magic token for config in init(): the value should be the helptext for this widget
protected  boolean immutable
          whether my value can be changed if it is set
static java.lang.String ISIMMUTABLETOKEN
          magic token for config in init(): the value should be set only if this widget is immutable; if set should be 'true'.
static java.lang.String ISMANDATORYTOKEN
          magic token for config in init(): the value should be set only if this widget is mandatory; if set will become the errortext if a value for the widget is not given.
protected  java.lang.String mandatory
          whether or not the user is required to give me a value.
static java.lang.String MANDATORYCSSCLASS
          the CSS class I will use for widgets which have the mandatory flag set
protected  int maxVisibleSize
          the maximum size of a widget before we truncate it and set size less than maxlength
protected  java.lang.String name
          the name of this widget.
static java.lang.String NAMETOKEN
          magic token for config in init(): the value should be the name of this widget
static java.lang.String OPTIONALCSSCLASS
          the CSS class I will use for widgets which do not have the mandatory flag set
static java.lang.String PREVIOUSVALUESUFFIX
          a suffix I will append to widget names to form tokens on which the old value will be stored in the context
protected  java.lang.String prompt
          a prompt to offer the user
static java.lang.String PROMPTTOKEN
          magic token for config in init(): the value should be the prompt for this widget
protected  int size
          my size
static java.lang.String SIZETOKEN
          magic token for config in init(): the value should be the size of this widget, as an integer
protected  java.lang.String type
          my input type
static java.lang.String TYPETOKEN
          magic token for config in init(): the value should be the type of this widget
 
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
Widget()
          If you use this constructor, you are strongly advised to use the init() method.
Widget(java.lang.String myname)
          minimum initialisation is I must have a name
Widget(java.lang.String myname, boolean mute)
          Deprecated. there are too many constructors for widgets, and this one will not be supported in Jacquard 2.0. Use setImmutable( boolean) instead
Widget(java.lang.String myname, java.lang.String myprompt)
          name and prompt is better
Widget(java.lang.String myname, java.lang.String myprompt, boolean mute)
          Deprecated. there are too many constructors for widgets, and this one will not be supported in Jacquard 2.0. Use setImmutable( boolean) instead
Widget(java.lang.String myname, java.lang.String myprompt, java.lang.String myhelp)
          name, prompt and helptext is better still.
Widget(java.lang.String myname, java.lang.String myprompt, java.lang.String myhelp, boolean mute)
          Deprecated. there are too many constructors for widgets, and this one will not be supported in Jacquard 2.0. Use setImmutable(boolean) instead
Widget(java.lang.String myname, java.lang.String myprompt, java.lang.String myhelp, boolean mute, int mysize)
          Deprecated. there are too many constructors for widgets, and this one will not be supported in Jacquard 2.0. Use setSize and setImmutable
 
Method Summary
 java.lang.Object clone()
          A widget may be cloned
 Node generate(Document doc, Context context)
          generate a DOM Node representing this widget.
protected  void generateAttributes(Element node)
          Deprecated. use generateAttributes(Element,Context) instead.
protected  void generateAttributes(Element node, Context context)
          Generate arbitrary attributes for this node which represents this widget
 Node generateHTML(Document doc, Context context)
          Generate a node representing the XHTML 1.0 representation of this widget.
 Element generateHTMLPrompt(Document doc, Context context)
          Generate a suitable prompt for me in this context
 Node generateInnerHTML(Document doc, Context context)
          Generate a node representing the XHTML 1.0 representation of just this widget, without prompt, helptext or any accompanying guff, but including JavaScript support if necessary (in which case the element returned will be a span).
 Node generateValue(Document doc, Context context)
          generate just a value label rather than the actual widget control; analogous to layoutValue, q.v.
 Node generateXML(Document doc, Context context)
          generate a DOM Node representing this widget, in a Jacquard-specific XML dialect which is not yet finalised.
 java.lang.Object getContextAttribute(Context context, java.lang.String attribute)
          Fetch my value for this named attribute in this context
 java.lang.String getCssClass()
          Fetch my CSS class.
 int getHeight(Context context)
          How high does this widget want to be in this context? The returned value is the estimated number of default character line heights the widget will occupy.
 java.lang.String getHelp(Context context)
          Return my help string adapted if possible for this context.
 java.lang.String getName()
          Get my name
 java.lang.String getPrompt(Context context)
          Return my prompt string adapted if possible for this context.
 int getTabPlaces(Context context)
          How many tab places do I wish to use up in this context?
 java.lang.String getType()
          Return my type
 int getWidth(Context context)
          How wide does this widget want to be in this context? The returned value is the estimated number of monospace character widths the widget will occupy.
 void init(Context config)
          initialise me using values from this context.
 void layout(Context context)
          Deprecated. use layout( Context,int)
 void layout(Context context, int tabIndex)
          lay me out on the output stream implied by this context
protected  void layout(Context context, java.lang.String inputType)
          Deprecated. use layout( Context,String,int)
protected  void layout(Context context, java.lang.String inputType, int tabIndex)
          lay me out on the output stream in this context
protected  void layoutAttribute(javax.servlet.ServletOutputStream out, java.lang.String name, java.lang.Object value)
          print an attribute
protected  void layoutAttributes(Context context)
          layout additional attributes of the widget, other than name, type, and value
protected  void layoutValue(Context context)
          Layout just my value on this output stream.
protected  void makeReady(Context context)
          Do any second-stage inititlaisation which I need -- default is nothing
 boolean maybeLayout(Context context)
          Deprecated. use maybeLayout( Context, int)
 boolean maybeLayout(Context context, int tabIndex)
          Layout (editable) widget only on output stream if not immutable; otherwise layout value (non-editable)
 java.lang.String onloadRequest()
          Deprecated. use onloadRequest( Context) instead
 java.lang.String onloadRequest(Context context)
          Some widgets require some at-document-load-time initialisation.
protected  void postProcess(Context context)
          Perform processing on the value I return within it's context after application-layer processing.
protected  void preProcess(Context context)
          Perform processing on the value I return within it's context before making it available for application-layer processing.
 java.lang.String scriptRequest()
          Deprecated. use scriptRequest( Context) instead
 java.lang.String scriptRequest(Context context)
          Some widgets positively need JavaScript scripts to support them; others don't but could benefit (i.e.
 void setAttribute(java.lang.String attrName, java.lang.Object attrVal)
          Set additional attribute values.
 void setContextAttribute(Context context, java.lang.String attribute, java.lang.Object value)
          Set the value for this attribute in this context to this value.
 void setCssClass(java.lang.String cssClass)
          Set my CSS class.
 void setDebug(boolean debug)
          whether or not to set debugging mode.
 void setDefault(java.lang.Object value)
          Set my default value, to be offered to the user if no better value is available from the context.
 void setHelp(java.lang.String value)
          set my help
 void setImmutable(boolean value)
          Set my immutable flag
 void setMandatory(boolean value)
          make me mandatory (or not), and construct a string to prompt the user if (s)he does not provide a value.
 void setMandatory(java.lang.String value)
          make me mandatory, and use this string to prompt the user if (s)he does not provide a value.
 void setName(java.lang.String value)
          set my name
 void setPrompt(java.lang.String value)
          set my prompt
 void setSize(int value)
          set my size
 void setType(java.lang.String mytype)
          Deprecated. use appropriate sub-class instead.
 
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
 

Field Detail

MANDATORYCSSCLASS

public static final java.lang.String MANDATORYCSSCLASS
the CSS class I will use for widgets which have the mandatory flag set

See Also:
Constant Field Values

OPTIONALCSSCLASS

public static final java.lang.String OPTIONALCSSCLASS
the CSS class I will use for widgets which do not have the mandatory flag set

See Also:
Constant Field Values

ACTIONCSSCLASS

public static final java.lang.String ACTIONCSSCLASS
the CSS class I will use for action widgets

See Also:
Constant Field Values

DANGEROUSCSSCLASS

public static final java.lang.String DANGEROUSCSSCLASS
the CSS class I will use for action widgets

See Also:
Constant Field Values

PREVIOUSVALUESUFFIX

public static final java.lang.String PREVIOUSVALUESUFFIX
a suffix I will append to widget names to form tokens on which the old value will be stored in the context

See Also:
Constant Field Values

CONTEXTATTRIBUTESSUFFIX

public static final java.lang.String CONTEXTATTRIBUTESSUFFIX
a suffix I shall append to widget names to form tokens on which to hold a context of any special attributes to set in the context

See Also:
Constant Field Values

NAMETOKEN

public static final java.lang.String NAMETOKEN
magic token for config in init(): the value should be the name of this widget

Since:
Jacquard 1.9.0
See Also:
Constant Field Values

PROMPTTOKEN

public static final java.lang.String PROMPTTOKEN
magic token for config in init(): the value should be the prompt for this widget

Since:
Jacquard 1.9.0
See Also:
Constant Field Values

HELPTOKEN

public static final java.lang.String HELPTOKEN
magic token for config in init(): the value should be the helptext for this widget

Since:
Jacquard 1.9.0
See Also:
Constant Field Values

TYPETOKEN

public static final java.lang.String TYPETOKEN
magic token for config in init(): the value should be the type of this widget

Since:
Jacquard 1.9.0
See Also:
Constant Field Values

ISMANDATORYTOKEN

public static final java.lang.String ISMANDATORYTOKEN
magic token for config in init(): the value should be set only if this widget is mandatory; if set will become the errortext if a value for the widget is not given.

Since:
Jacquard 1.9.0
See Also:
Constant Field Values

DEFAULTTOKEN

public static final java.lang.String DEFAULTTOKEN
magic token for config in init(): the value should be the default value of this widget

Since:
Jacquard 1.9.0
See Also:
Constant Field Values

SIZETOKEN

public static final java.lang.String SIZETOKEN
magic token for config in init(): the value should be the size of this widget, as an integer

Since:
Jacquard 1.9.0
See Also:
Constant Field Values

ISIMMUTABLETOKEN

public static final java.lang.String ISIMMUTABLETOKEN
magic token for config in init(): the value should be set only if this widget is immutable; if set should be 'true'.

Since:
Jacquard 1.9.0
See Also:
Constant Field Values

GENERATEASHTML

public static final int GENERATEASHTML
magic symbol to indicate we generate as HTML:

Since:
Jacquard 1.9.0
See Also:
generateAs, Constant Field Values

GENERATEASXML

public static final int GENERATEASXML
magic symbol to indicate we generate as Jacquard XML:

Since:
Jacquard 1.9.0
See Also:
generateAs, Constant Field Values

GENERATEASXFORM

public static final int GENERATEASXFORM
magic symbol to indicate we generate as XForm:

Since:
Jacquard 1.9.0
See Also:
generateAs, Constant Field Values

attrs

protected Context attrs
additional attributes for my input tag


form

protected Form form
the form I am in


dflt

protected java.lang.Object dflt
My default value, if any


cssClass

protected java.lang.String cssClass
A string output as the value of the class attribute in the HTML tags used to layout this widget: in effect a hack to allow you to decorate different actions differently.


help

protected java.lang.String help
help information to offer the user


mandatory

protected java.lang.String mandatory
whether or not the user is required to give me a value. If null, the user is not. If set, the string to report to the user if (s)he fails to supply a value.


prompt

protected java.lang.String prompt
a prompt to offer the user


akprompt

protected java.lang.String akprompt
the prompt with the access key spliced in


name

protected java.lang.String name
the name of this widget. safe default, should be overrridden


type

protected java.lang.String type
my input type


debug

protected boolean debug
whether or not I'm in debug mode; if I am I may print debugging messages to System.err


immutable

protected boolean immutable
whether my value can be changed if it is set


generateAs

protected int generateAs
what sort of markup do I generate?


maxVisibleSize

protected int maxVisibleSize
the maximum size of a widget before we truncate it and set size less than maxlength


size

protected int size
my size

Constructor Detail

Widget

public Widget()
If you use this constructor, you are strongly advised to use the init() method.

See Also:
init(Context)

Widget

public Widget(java.lang.String myname)
minimum initialisation is I must have a name


Widget

public Widget(java.lang.String myname,
              java.lang.String myprompt)
name and prompt is better


Widget

public Widget(java.lang.String myname,
              boolean mute)
Deprecated. there are too many constructors for widgets, and this one will not be supported in Jacquard 2.0. Use setImmutable( boolean) instead

If a widget is 'immutable', then if it already has a value that value can't be changed.

See Also:
setImmutable(boolean)

Widget

public Widget(java.lang.String myname,
              java.lang.String myprompt,
              boolean mute)
Deprecated. there are too many constructors for widgets, and this one will not be supported in Jacquard 2.0. Use setImmutable( boolean) instead

See Also:
setImmutable(boolean)

Widget

public Widget(java.lang.String myname,
              java.lang.String myprompt,
              java.lang.String myhelp)
name, prompt and helptext is better still.


Widget

public Widget(java.lang.String myname,
              java.lang.String myprompt,
              java.lang.String myhelp,
              boolean mute)
Deprecated. there are too many constructors for widgets, and this one will not be supported in Jacquard 2.0. Use setImmutable(boolean) instead

As above, plus immutability.

See Also:
setImmutable(boolean)

Widget

public Widget(java.lang.String myname,
              java.lang.String myprompt,
              java.lang.String myhelp,
              boolean mute,
              int mysize)
Deprecated. there are too many constructors for widgets, and this one will not be supported in Jacquard 2.0. Use setSize and setImmutable

As above, plus size.

See Also:
setSize(int), setImmutable(boolean)
Method Detail

setAttribute

public void setAttribute(java.lang.String attrName,
                         java.lang.Object attrVal)
Set additional attribute values. If they aren't valid values for an HTML widget of the appropriate type, this is going to produce invalid HTML... If you want to produce an unvalued attribute (i.e. 'attribute' instead of 'attribute="value"') set the value to Boolean.TRUE.


setContextAttribute

public void setContextAttribute(Context context,
                                java.lang.String attribute,
                                java.lang.Object value)
Set the value for this attribute in this context to this value.

Parameters:
context - the context ( service context) in which to set the value
attribute - the attribute whose value is to be set
value - the value to be set

getContextAttribute

public java.lang.Object getContextAttribute(Context context,
                                            java.lang.String attribute)
Fetch my value for this named attribute in this context

Parameters:
context - the context
attribute - the attribute
Returns:
the value
Since:
Jacquard 1.10.17

setCssClass

public void setCssClass(java.lang.String cssClass)
Set my CSS class.


getCssClass

public java.lang.String getCssClass()
Fetch my CSS class.


setDebug

public void setDebug(boolean debug)
whether or not to set debugging mode. If true, the generator _may_ write debugging messages to System.err

Specified by:
setDebug in interface NodeGenerator
Overrides:
setDebug in class NodeGeneratorImpl
Parameters:
debug - whether or not to set debugging mode
Since:
Jacquard 1.10

setDefault

public void setDefault(java.lang.Object value)
Set my default value, to be offered to the user if no better value is available from the context. Also useful in hidden widgets for passing a single value, not in the context, to the next form.


getHeight

public int getHeight(Context context)
How high does this widget want to be in this context? The returned value is the estimated number of default character line heights the widget will occupy. Once again, there is nothing currently in a context which can influence this...


setHelp

public void setHelp(java.lang.String value)
set my help


getHelp

public java.lang.String getHelp(Context context)
                         throws javax.servlet.ServletException
Return my help string adapted if possible for this context. This might involve translation into different natural languages, for example

Throws:
javax.servlet.ServletException

setImmutable

public void setImmutable(boolean value)
Set my immutable flag


setMandatory

public void setMandatory(boolean value)
make me mandatory (or not), and construct a string to prompt the user if (s)he does not provide a value. Note that this will do i18n at initialisation time, not in the context of a particular request, and will consequently only get it's i18n from the server's default locale, not from the user's locale. Note: in Jacquard 2 handle mandatory differently.

Parameters:
value - true if I am mandatory, else false.

setMandatory

public void setMandatory(java.lang.String value)
make me mandatory, and use this string to prompt the user if (s)he does not provide a value. Use only if the default mandatory message would not fit this case; otherwise prefer setMandatory( boolean)

Parameters:
value - the special message to be shown to prompt users to supply a value for this widget.

setName

public void setName(java.lang.String value)
set my name


getName

public java.lang.String getName()
Get my name

Specified by:
getName in interface NodeGenerator
Overrides:
getName in class NodeGeneratorImpl
Returns:
my name

setPrompt

public void setPrompt(java.lang.String value)
set my prompt


getPrompt

public java.lang.String getPrompt(Context context)
Return my prompt string adapted if possible for this context. This might involve translation into different natural languages, for example


setSize

public void setSize(int value)
set my size


setType

public void setType(java.lang.String mytype)
Deprecated. use appropriate sub-class instead.

Set my type to this type, without checking whether it is a valid HTML INPUT type.


getType

public java.lang.String getType()
Return my type


getWidth

public int getWidth(Context context)
How wide does this widget want to be in this context? The returned value is the estimated number of monospace character widths the widget will occupy. There is nothing currently in a context which can influence this, but in some later version the context may be able to say 'and oh, hey, we're talking to a mobile phone iwth an itty-bitty screen here'


clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
A widget may be cloned

Throws:
java.lang.CloneNotSupportedException

generate

public Node generate(Document doc,
                     Context context)
              throws GenerationException
generate a DOM Node representing this widget. Jacquard-specific stuff is wrapped around an XHTML 1.0 representation of the Widget itself; this doesn't mean that XSL can't be used to transmogrify the widget at runtime, of course, merely that the thing will roughly work as XHTML even in the absence of a stylesheet.

Specified by:
generate in interface NodeGenerator
Specified by:
generate in class NodeGeneratorImpl
Parameters:
doc - the document of which the new node will form part
context - the context in which the operation is to be performed
Returns:
the element created.
Throws:
GenerationException - may throw a GenerationException if the generation cannot be completed.

generateHTML

public Node generateHTML(Document doc,
                         Context context)
                  throws GenerationException
Generate a node representing the XHTML 1.0 representation of this widget. Essentially this method is the Jacquard 2 replacement for Widget.layout(), q.v.

Throws:
GenerationException
See Also:
layout(Context)

generateHTMLPrompt

public Element generateHTMLPrompt(Document doc,
                                  Context context)
Generate a suitable prompt for me in this context


generateInnerHTML

public Node generateInnerHTML(Document doc,
                              Context context)
                       throws GenerationException
Generate a node representing the XHTML 1.0 representation of just this widget, without prompt, helptext or any accompanying guff, but including JavaScript support if necessary (in which case the element returned will be a span). Essentially this method is the Jacquard 2 replacement for Widget.layout(), q.v. When specialising you almost certainly want to specialise this and not generateHTML, q.v.

Parameters:
doc - the document within which I am to be created
context - the context in which I am to be created.
Returns:
an element representing either the INPUT element itself or a SPAN element containing the INPUT element and any other functionally supporting stuff (SCRIPTs, other INPUTs, APPLETs etc
Throws:
GenerationException
See Also:
layout(Context), generateHTML(Document, Context)

generateValue

public Node generateValue(Document doc,
                          Context context)
                   throws GenerationException
generate just a value label rather than the actual widget control; analogous to layoutValue, q.v.

Parameters:
doc -
context -
Returns:
a node (possibly a Text) representing just my value
Throws:
GenerationException
See Also:
layoutValue(Context)

generateXML

public Node generateXML(Document doc,
                        Context context)
                 throws GenerationException
generate a DOM Node representing this widget, in a Jacquard-specific XML dialect which is not yet finalised. We recommend you don not use or depend on this yet!

Parameters:
doc - the document of which the new node will form part
context - the context in which the operation is to be performed
Throws:
GenerationException

init

public void init(Context config)
          throws InitialisationException
initialise me using values from this context. If you use the zero-args constructor it is strongly advised that you follow it by calling this method. Specialisations are advised to call super.init(config) first, and then (provided that succeeds) do other stuff. Note tha this method should only be called on Widgets created with the zero-arg constructor

Specified by:
init in interface NodeGenerator
Specified by:
init in class NodeGeneratorImpl
Parameters:
config - a context containing a value for Widget.NAMETOKEN, and preferably values for Widget.PROMPTTOKEN and Widget.HELPTOKEN as well
Throws:
InitialisationException - if anything goes wrong.
Since:
Jacquard 1.8.0

layout

public final void layout(Context context)
                  throws DataStoreException,
                         javax.servlet.ServletException,
                         java.io.IOException
Deprecated. use layout( Context,int)

layout just the widget, without prompt, help, or surrounding context. One argument, the context in which I am to be laid out

Throws:
DataStoreException
javax.servlet.ServletException
java.io.IOException

layout

public void layout(Context context,
                   int tabIndex)
            throws DataStoreException,
                   javax.servlet.ServletException,
                   java.io.IOException
lay me out on the output stream implied by this context

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

maybeLayout

public final boolean maybeLayout(Context context)
                          throws DataStoreException,
                                 javax.servlet.ServletException,
                                 java.io.IOException
Deprecated. use maybeLayout( Context, int)

Layout (editable) widget only on output stream if not immutable; otherwise layout value (non-editable)

Returns:
true if widget was laid out.
Throws:
DataStoreException
javax.servlet.ServletException
java.io.IOException

maybeLayout

public final boolean maybeLayout(Context context,
                                 int tabIndex)
                          throws DataStoreException,
                                 javax.servlet.ServletException,
                                 java.io.IOException
Layout (editable) widget only on output stream if not immutable; otherwise layout value (non-editable)

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
Returns:
true if I was laid out
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

getTabPlaces

public int getTabPlaces(Context context)
How many tab places do I wish to use up in this context?

Parameters:
context - the service context
Returns:
the number of tab places needed to lay be out

onloadRequest

public java.lang.String onloadRequest()
Deprecated. use onloadRequest( Context) instead

Some widgets require some at-document-load-time initialisation. They can provide this by returning a string comprising a semi-colon terminated JavaScript statement or sequence of statements. If no such initialisation is required return null.


onloadRequest

public java.lang.String onloadRequest(Context context)
                               throws java.lang.Exception
Some widgets require some at-document-load-time initialisation. They can provide this by returning a string comprising a semi-colon terminated JavaScript statement or sequence of statements. If no such initialisation is required return null.

Parameters:
context - the context in which the onloadRequest is to be delivered
Throws:
java.lang.Exception

scriptRequest

public java.lang.String scriptRequest()
Deprecated. use scriptRequest( Context) instead

Some widgets positively need JavaScript scripts to support them; others don't but could benefit (i.e. for validation); still others don't at all. the scripts are held in files, by convention in a /scripts/ directory in the root of the HTML document space.


scriptRequest

public java.lang.String scriptRequest(Context context)
                               throws java.lang.Exception
Some widgets positively need JavaScript scripts to support them; others don't but could benefit (i.e. for validation); still others don't at all. the scripts are held in files, by convention in a /scripts/ directory in the root of the HTML document space.

Returns:
a comma separated list of JavaScript files which must be loaded to support this widget
Throws:
java.lang.Exception

generateAttributes

protected final void generateAttributes(Element node)
Deprecated. use generateAttributes(Element,Context) instead.

Generate arbitrary attributes for this node which represents this widget


generateAttributes

protected final void generateAttributes(Element node,
                                        Context context)
Generate arbitrary attributes for this node which represents this widget


layout

protected final void layout(Context context,
                            java.lang.String inputType)
                     throws DataFormatException,
                            javax.servlet.ServletException,
                            java.io.IOException
Deprecated. use layout( Context,String,int)

layout just the widget, without prompt, help, or surrounding context, coercing it to this type

Throws:
DataFormatException
javax.servlet.ServletException
java.io.IOException

layout

protected void layout(Context context,
                      java.lang.String inputType,
                      int tabIndex)
               throws DataFormatException,
                      javax.servlet.ServletException,
                      java.io.IOException
lay me out on the output stream in this context

Parameters:
context - the service context
inputType - the input type to lay me out as
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
DataFormatException

layoutAttribute

protected void layoutAttribute(javax.servlet.ServletOutputStream out,
                               java.lang.String name,
                               java.lang.Object value)
                        throws java.io.IOException
print an attribute

Parameters:
out - the stream to print it on
name - the name of the attribute
value - the value of the attribute
Throws:
java.io.IOException - if the world goes foom

layoutAttributes

protected void layoutAttributes(Context context)
                         throws javax.servlet.ServletException,
                                java.io.IOException
layout additional attributes of the widget, other than name, type, and value

Throws:
javax.servlet.ServletException
java.io.IOException

layoutValue

protected void layoutValue(Context context)
                    throws DataFormatException,
                           javax.servlet.ServletException,
                           java.io.IOException
Layout just my value on this output stream. Pass the value through as a hidden input.

Throws:
DataFormatException
javax.servlet.ServletException
java.io.IOException

makeReady

protected void makeReady(Context context)
                  throws DataStoreException,
                         javax.servlet.ServletException
Do any second-stage inititlaisation which I need -- default is nothing

Throws:
no - , this doesn't actually throw any exceptions. But things which specialise it may want to.
DataStoreException
javax.servlet.ServletException

postProcess

protected void postProcess(Context context)
                    throws DataStoreException,
                           javax.servlet.ServletException
Perform processing on the value I return within it's context after application-layer processing. This method is intended to be specialised; the default version does nothing.

Throws:
no - , this doesn't actually throw any exceptions. But things which specialise it may want to.
DataStoreException
javax.servlet.ServletException
See Also:
LinkTableWidget

preProcess

protected void preProcess(Context context)
                   throws DataStoreException,
                          javax.servlet.ServletException
Perform processing on the value I return within it's context before making it available for application-layer processing. This typically will include first-pass data validation. If first-pass validation fails, throw a DataFormatException. TODO: check for and deal with the three magic characters '<', '>' and '&' which upset XML parsers. Default behaviour: if I'm mandatory and my form was called with a post request, I should have data - so whinge if I don't.

Parameters:
context - the Context of the service in which I'm called
Throws:
DataFormatException - if data fails validation test
javax.servlet.ServletException - if the thing itself breaks
DataStoreException

jacquard 1.12.0 by The Web Engineering Factory and Toolworks