|
jacquard 1.12.0 by The Web Engineering Factory and Toolworks | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectuk.co.weft.htform.ResourceConsumerImpl
uk.co.weft.domutil.NodeGeneratorImpl
uk.co.weft.htform.Widget
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.
| 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 |
public static final java.lang.String MANDATORYCSSCLASS
public static final java.lang.String OPTIONALCSSCLASS
public static final java.lang.String ACTIONCSSCLASS
public static final java.lang.String DANGEROUSCSSCLASS
public static final java.lang.String PREVIOUSVALUESUFFIX
public static final java.lang.String CONTEXTATTRIBUTESSUFFIX
public static final java.lang.String NAMETOKEN
public static final java.lang.String PROMPTTOKEN
public static final java.lang.String HELPTOKEN
public static final java.lang.String TYPETOKEN
public static final java.lang.String ISMANDATORYTOKEN
public static final java.lang.String DEFAULTTOKEN
public static final java.lang.String SIZETOKEN
public static final java.lang.String ISIMMUTABLETOKEN
public static final int GENERATEASHTML
generateAs,
Constant Field Valuespublic static final int GENERATEASXML
generateAs,
Constant Field Valuespublic static final int GENERATEASXFORM
generateAs,
Constant Field Valuesprotected Context attrs
protected Form form
protected java.lang.Object dflt
protected java.lang.String cssClass
protected java.lang.String help
protected java.lang.String mandatory
protected java.lang.String prompt
protected java.lang.String akprompt
protected java.lang.String name
protected java.lang.String type
protected boolean debug
protected boolean immutable
protected int generateAs
protected int maxVisibleSize
protected int size
| Constructor Detail |
public Widget()
init(Context)public Widget(java.lang.String myname)
public Widget(java.lang.String myname,
java.lang.String myprompt)
public Widget(java.lang.String myname,
boolean mute)
setImmutable(boolean)
public Widget(java.lang.String myname,
java.lang.String myprompt,
boolean mute)
setImmutable(boolean)
public Widget(java.lang.String myname,
java.lang.String myprompt,
java.lang.String myhelp)
public Widget(java.lang.String myname,
java.lang.String myprompt,
java.lang.String myhelp,
boolean mute)
setImmutable(boolean)
public Widget(java.lang.String myname,
java.lang.String myprompt,
java.lang.String myhelp,
boolean mute,
int mysize)
setSize(int),
setImmutable(boolean)| Method Detail |
public void setAttribute(java.lang.String attrName,
java.lang.Object attrVal)
public void setContextAttribute(Context context,
java.lang.String attribute,
java.lang.Object value)
context - the context ( service context) in which to set the valueattribute - the attribute whose value is to be setvalue - the value to be set
public java.lang.Object getContextAttribute(Context context,
java.lang.String attribute)
context - the contextattribute - the attribute
public void setCssClass(java.lang.String cssClass)
public java.lang.String getCssClass()
public void setDebug(boolean debug)
setDebug in interface NodeGeneratorsetDebug in class NodeGeneratorImpldebug - whether or not to set debugging modepublic void setDefault(java.lang.Object value)
public int getHeight(Context context)
public void setHelp(java.lang.String value)
public java.lang.String getHelp(Context context)
throws javax.servlet.ServletException
javax.servlet.ServletExceptionpublic void setImmutable(boolean value)
public void setMandatory(boolean value)
value - true if I am mandatory, else false.public void setMandatory(java.lang.String value)
value - the special message to be shown to prompt users to supply
a value for this widget.public void setName(java.lang.String value)
public java.lang.String getName()
getName in interface NodeGeneratorgetName in class NodeGeneratorImplpublic void setPrompt(java.lang.String value)
public java.lang.String getPrompt(Context context)
public void setSize(int value)
public void setType(java.lang.String mytype)
public java.lang.String getType()
public int getWidth(Context context)
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
java.lang.CloneNotSupportedException
public Node generate(Document doc,
Context context)
throws GenerationException
generate in interface NodeGeneratorgenerate in class NodeGeneratorImpldoc - the document of which the new node will form partcontext - the context in which the operation is to be performed
GenerationException - may throw a GenerationException if the
generation cannot be completed.
public Node generateHTML(Document doc,
Context context)
throws GenerationException
GenerationExceptionlayout(Context)
public Element generateHTMLPrompt(Document doc,
Context context)
public Node generateInnerHTML(Document doc,
Context context)
throws GenerationException
doc - the document within which I am to be createdcontext - the context in which I am to be created.
GenerationExceptionlayout(Context),
generateHTML(Document, Context)
public Node generateValue(Document doc,
Context context)
throws GenerationException
doc - context -
GenerationExceptionlayoutValue(Context)
public Node generateXML(Document doc,
Context context)
throws GenerationException
doc - the document of which the new node will form partcontext - the context in which the operation is to be performed
GenerationException
public void init(Context config)
throws InitialisationException
init in interface NodeGeneratorinit in class NodeGeneratorImplconfig - a context containing a value for Widget.NAMETOKEN, and
preferably values for Widget.PROMPTTOKEN and Widget.HELPTOKEN
as well
InitialisationException - if anything goes wrong.
public final void layout(Context context)
throws DataStoreException,
javax.servlet.ServletException,
java.io.IOException
DataStoreException
javax.servlet.ServletException
java.io.IOException
public void layout(Context context,
int tabIndex)
throws DataStoreException,
javax.servlet.ServletException,
java.io.IOException
context - the service contexttabIndex - the tabindex to use, ot the tab index of my first
sub-widget if I have more than one
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
public final boolean maybeLayout(Context context)
throws DataStoreException,
javax.servlet.ServletException,
java.io.IOException
DataStoreException
javax.servlet.ServletException
java.io.IOException
public final boolean maybeLayout(Context context,
int tabIndex)
throws DataStoreException,
javax.servlet.ServletException,
java.io.IOException
context - the service contexttabIndex - the tabindex to use, ot the tab index of my first
sub-widget if I have more than one
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 streampublic int getTabPlaces(Context context)
context - the service context
public java.lang.String onloadRequest()
public java.lang.String onloadRequest(Context context)
throws java.lang.Exception
context - the context in which the onloadRequest is to be
delivered
java.lang.Exceptionpublic java.lang.String scriptRequest()
public java.lang.String scriptRequest(Context context)
throws java.lang.Exception
java.lang.Exceptionprotected final void generateAttributes(Element node)
protected final void generateAttributes(Element node,
Context context)
protected final void layout(Context context,
java.lang.String inputType)
throws DataFormatException,
javax.servlet.ServletException,
java.io.IOException
DataFormatException
javax.servlet.ServletException
java.io.IOException
protected void layout(Context context,
java.lang.String inputType,
int tabIndex)
throws DataFormatException,
javax.servlet.ServletException,
java.io.IOException
context - the service contextinputType - the input type to lay me out astabIndex - the tabindex to use, ot the tab index of my first
sub-widget if I have more than one
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
protected void layoutAttribute(javax.servlet.ServletOutputStream out,
java.lang.String name,
java.lang.Object value)
throws java.io.IOException
out - the stream to print it onname - the name of the attributevalue - the value of the attribute
java.io.IOException - if the world goes foom
protected void layoutAttributes(Context context)
throws javax.servlet.ServletException,
java.io.IOException
javax.servlet.ServletException
java.io.IOException
protected void layoutValue(Context context)
throws DataFormatException,
javax.servlet.ServletException,
java.io.IOException
DataFormatException
javax.servlet.ServletException
java.io.IOException
protected void makeReady(Context context)
throws DataStoreException,
javax.servlet.ServletException
no - , this doesn't actually throw any exceptions. But things
which specialise it may want to.
DataStoreException
javax.servlet.ServletException
protected void postProcess(Context context)
throws DataStoreException,
javax.servlet.ServletException
no - , this doesn't actually throw any exceptions. But things
which specialise it may want to.
DataStoreException
javax.servlet.ServletExceptionLinkTableWidget
protected void preProcess(Context context)
throws DataStoreException,
javax.servlet.ServletException
context - the Context of the service in which I'm called
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 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||