jacquard 1.12.0 by The Web Engineering Factory and Toolworks

uk.co.weft.htform
Class FormLayout

java.lang.Object
  extended byuk.co.weft.htform.Layout
      extended byuk.co.weft.htform.FormLayout
Direct Known Subclasses:
HTML2FormLayout, OrderedLayout

public class FormLayout
extends Layout

A layout engine for a form. This default one lays out widgets in an HTML 4.0 table decorated with style-sheets, in the classic Weft four column layout with prompt on the left, widget in the middle and help on the right.

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

Field Summary
protected  java.lang.String halign
          vertical alignment of fields in row
static int MAX_NARROW
          constants to declare how much space a widget wants on the output page.
static int MAX_STANDARD
          ...a standard widget is less than MAX_STANDARD characters wide...
static int MAX_WIDE
          ...and a wide one is less than MAX_WIDE.
static int MIN_WIDGETS
          the minimum number of widgets a widget set can really have.
static java.lang.String TABINDEXMAGICTOKEN
          for backwards compatibility purposes only - the new tab index mechanism does not use this
protected  java.lang.String valign
          horizontal alignment of fields in row
 
Fields inherited from class uk.co.weft.htform.Layout
page
 
Constructor Summary
FormLayout()
          Do not use this variant! I know I'm doing something wrong, but I don't know what...
FormLayout(Form page)
          set up my page
 
Method Summary
protected  java.lang.String getPrompt(Context context, Widget w)
          Deprecated. use Widget.getPrompt( Context)
 WidgetSet getSelectedWidgetSet(Context context)
          get the widget set to layout in this context
 void layout(Context context)
          layout my form in this context.
protected  void layoutAction(Context context, Widget w, javax.servlet.ServletOutputStream out)
          Deprecated. use variant with tabIndex
protected  void layoutAction(Context context, Widget w, javax.servlet.ServletOutputStream out, int tabIndex)
          layout an action widget on the output stream.
protected  void layoutNarrow(Context context, Widget w, javax.servlet.ServletOutputStream out)
          Deprecated. use variant with tabIndex
protected  void layoutNarrow(Context context, Widget w, javax.servlet.ServletOutputStream out, int tabIndex)
          layout a widget which has advertised itself as 'narrow' on the output stream in three column layout.
protected  void layoutNoHelp(Context context, Widget w, javax.servlet.ServletOutputStream out)
          Deprecated. use variant with tabIndex
protected  void layoutNoHelp(Context context, Widget w, javax.servlet.ServletOutputStream out, int tabIndex)
          layout a widget which has advertised itself as 'narrow' or 'standard', and which has no help text
protected  void layoutStandard(Context context, Widget w, javax.servlet.ServletOutputStream out)
          Deprecated. use variant with tabIndex
protected  void layoutStandard(Context context, Widget w, javax.servlet.ServletOutputStream out, int tabIndex)
          layout a widget which has advertised itself as 'standard' on the output stream in three column layout.
protected  void layoutUltraWide(Context context, Widget w, javax.servlet.ServletOutputStream out)
          Deprecated. use variant with tabIndex
protected  void layoutUltraWide(Context context, Widget w, javax.servlet.ServletOutputStream out, int tabIndex)
          layout a widget which has advertised itself as 'ultra-wide'.
protected  void layoutWide(Context context, Widget w, javax.servlet.ServletOutputStream out)
          Deprecated. use variant with tabIndex
protected  void layoutWide(Context context, Widget w, javax.servlet.ServletOutputStream out, int tabIndex)
          layout a widget which has advertised itself as 'wide'.
protected  void layoutWidget(Context context, ActionWidget action, int tabIndex)
          Action widgets are laid out with not reference to wheir width, being assumed to be fairly small.
protected  void layoutWidget(Context context, HiddenWidget hidden)
          Hidden widgets are laid out without any surrounding prompt or decoration.
protected  void layoutWidget(Context context, Widget w)
          Deprecated. use variant with tabIndex
protected  void layoutWidget(Context context, Widget w, int tabIndex)
          layout one widget
protected  void layoutWidgets(WidgetSet ws, Context context)
          Lay my visible widgets out in the order they were added, appending the hidden ones
 
Methods inherited from class uk.co.weft.htform.Layout
getPage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MIN_WIDGETS

public static final int MIN_WIDGETS
the minimum number of widgets a widget set can really have. I think it's 1 because any connected WidgetSet has at least a hidden selected_widget_set widget.

See Also:
Constant Field Values

TABINDEXMAGICTOKEN

public static final java.lang.String TABINDEXMAGICTOKEN
for backwards compatibility purposes only - the new tab index mechanism does not use this

See Also:
Constant Field Values

MAX_NARROW

public static final int MAX_NARROW
constants to declare how much space a widget wants on the output page. A narrow widget is less than MAX_NARROW characters wide...

See Also:
Constant Field Values

MAX_STANDARD

public static final int MAX_STANDARD
...a standard widget is less than MAX_STANDARD characters wide...

See Also:
Constant Field Values

MAX_WIDE

public static final int MAX_WIDE
...and a wide one is less than MAX_WIDE.

See Also:
Constant Field Values

halign

protected java.lang.String halign
vertical alignment of fields in row


valign

protected java.lang.String valign
horizontal alignment of fields in row

Constructor Detail

FormLayout

public FormLayout()
Do not use this variant! I know I'm doing something wrong, but I don't know what... in any case, arity 0 constructor is insisted on by the compiler but you can't use it.


FormLayout

public FormLayout(Form page)
set up my page

Method Detail

getSelectedWidgetSet

public WidgetSet getSelectedWidgetSet(Context context)
get the widget set to layout in this context


layout

public void layout(Context context)
            throws java.lang.Exception
layout my form in this context. TODO the pass-around mechanism for hidden widgets is pretty ugly and it certainly shouldn't impact on HTML2FormLayout the way it does. Rewrite.

Specified by:
layout in class Layout
Throws:
java.lang.Exception

getPrompt

protected java.lang.String getPrompt(Context context,
                                     Widget w)
Deprecated. use Widget.getPrompt( Context)

get the prompt for a widget,


layoutAction

protected void layoutAction(Context context,
                            Widget w,
                            javax.servlet.ServletOutputStream out)
                     throws DataStoreException,
                            javax.servlet.ServletException,
                            java.io.IOException
Deprecated. use variant with tabIndex

layout an action widget on the output stream.

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

layoutAction

protected void layoutAction(Context context,
                            Widget w,
                            javax.servlet.ServletOutputStream out,
                            int tabIndex)
                     throws DataStoreException,
                            javax.servlet.ServletException,
                            java.io.IOException
layout an action widget on the output stream.

Parameters:
context - the service context
w - the widget to lay out
out - the stream to lay it out on
tabIndex - the initial tab index to use
Throws:
DataStoreException - if the widget does
javax.servlet.ServletException - if the widget does
java.io.IOException - if the widget does

layoutNarrow

protected void layoutNarrow(Context context,
                            Widget w,
                            javax.servlet.ServletOutputStream out)
                     throws DataStoreException,
                            javax.servlet.ServletException,
                            java.io.IOException
Deprecated. use variant with tabIndex

layout a widget which has advertised itself as 'narrow' on the output stream in three column layout. The overall layout actually has four columns, of which the help column occupies two in this layout

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

layoutNarrow

protected void layoutNarrow(Context context,
                            Widget w,
                            javax.servlet.ServletOutputStream out,
                            int tabIndex)
                     throws DataStoreException,
                            javax.servlet.ServletException,
                            java.io.IOException
layout a widget which has advertised itself as 'narrow' on the output stream in three column layout. The overall layout actually has four columns, of which the help column occupies two in this layout

Parameters:
context - the service context
w - the widget to lay out
out - the stream to lay it out on
tabIndex - the initial tab index to use
Throws:
DataStoreException - if the widget does
javax.servlet.ServletException - if the widget does
java.io.IOException - if the widget does

layoutNoHelp

protected void layoutNoHelp(Context context,
                            Widget w,
                            javax.servlet.ServletOutputStream out)
                     throws DataStoreException,
                            javax.servlet.ServletException,
                            java.io.IOException
Deprecated. use variant with tabIndex

layout a widget which has advertised itself as 'narrow' or 'standard', and which has no help text

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

layoutNoHelp

protected void layoutNoHelp(Context context,
                            Widget w,
                            javax.servlet.ServletOutputStream out,
                            int tabIndex)
                     throws DataStoreException,
                            javax.servlet.ServletException,
                            java.io.IOException
layout a widget which has advertised itself as 'narrow' or 'standard', and which has no help text

Parameters:
context - the service context
w - the widget to lay out
out - the stream to lay it out on
tabIndex - the initial tab index to use
Throws:
DataStoreException - if the widget does
javax.servlet.ServletException - if the widget does
java.io.IOException - if the widget does

layoutStandard

protected void layoutStandard(Context context,
                              Widget w,
                              javax.servlet.ServletOutputStream out)
                       throws DataStoreException,
                              javax.servlet.ServletException,
                              java.io.IOException
Deprecated. use variant with tabIndex

layout a widget which has advertised itself as 'standard' on the output stream in three column layout. The overall layout actually has four columns, of which the widget column occupies two in this layout

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

layoutStandard

protected void layoutStandard(Context context,
                              Widget w,
                              javax.servlet.ServletOutputStream out,
                              int tabIndex)
                       throws DataStoreException,
                              javax.servlet.ServletException,
                              java.io.IOException
layout a widget which has advertised itself as 'standard' on the output stream in three column layout. The overall layout actually has four columns, of which the widget column occupies two in this layout

Parameters:
context - the service context
w - the widget to lay out
out - the stream to lay it out on
tabIndex - the initial tab index to use
Throws:
DataStoreException - if the widget does
javax.servlet.ServletException - if the widget does
java.io.IOException - if the widget does

layoutUltraWide

protected void layoutUltraWide(Context context,
                               Widget w,
                               javax.servlet.ServletOutputStream out)
                        throws DataStoreException,
                               javax.servlet.ServletException,
                               java.io.IOException
Deprecated. use variant with tabIndex

layout a widget which has advertised itself as 'ultra-wide'. Layout, over all four columns, the prompt, the widget, and the helptext as successive rows.

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

layoutUltraWide

protected void layoutUltraWide(Context context,
                               Widget w,
                               javax.servlet.ServletOutputStream out,
                               int tabIndex)
                        throws DataStoreException,
                               javax.servlet.ServletException,
                               java.io.IOException
layout a widget which has advertised itself as 'ultra-wide'. Layout, over all four columns, the prompt, the widget, and the helptext as successive rows.

Parameters:
context - the service context
w - the widget to lay out
out - the stream to lay it out on
tabIndex - the initial tab index to use
Throws:
DataStoreException - if the widget does
javax.servlet.ServletException - if the widget does
java.io.IOException - if the widget does

layoutWide

protected void layoutWide(Context context,
                          Widget w,
                          javax.servlet.ServletOutputStream out)
                   throws DataStoreException,
                          javax.servlet.ServletException,
                          java.io.IOException
Deprecated. use variant with tabIndex

layout a widget which has advertised itself as 'wide'. The left hand column is used for the prompt; the remaining three columns show the widget over the help text in two rows.

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

layoutWide

protected void layoutWide(Context context,
                          Widget w,
                          javax.servlet.ServletOutputStream out,
                          int tabIndex)
                   throws DataStoreException,
                          javax.servlet.ServletException,
                          java.io.IOException
layout a widget which has advertised itself as 'wide'. The left hand column is used for the prompt; the remaining three columns show the widget over the help text in two rows.

Parameters:
context - the service context
w - the widget to lay out
out - the stream to lay it out on
tabIndex - the initial tab index to use
Throws:
DataStoreException - if the widget does
javax.servlet.ServletException - if the widget does
java.io.IOException - if the widget does

layoutWidget

protected void layoutWidget(Context context,
                            HiddenWidget hidden)
                     throws DataStoreException,
                            javax.servlet.ServletException,
                            java.io.IOException
Hidden widgets are laid out without any surrounding prompt or decoration. Hidden widgets don't appear in the tab traversal so no need to pass tab indexes about.

Parameters:
context - the context in which this widget is to be laid out
hidden - the widget to lay out
Throws:
DataStoreException - if unsuitable data in context (unlikely)
javax.servlet.ServletException - if something goes wrong in the servlet layer (unlikely)
java.io.IOException - if can't find or can't write to output stream
Since:
Jacquard 1.10.12

layoutWidget

protected void layoutWidget(Context context,
                            ActionWidget action,
                            int tabIndex)
                     throws DataStoreException,
                            javax.servlet.ServletException,
                            java.io.IOException
Action widgets are laid out with not reference to wheir width, being assumed to be fairly small. The surrounding decoration is also different

Parameters:
context - the context in which this widget is to be laid out
action - the widget to lay out
Throws:
DataStoreException - if unsuitable data in context (unlikely)
javax.servlet.ServletException - if something goes wrong in the servlet layer (unlikely)
java.io.IOException - if can't find or can't write to output stream
Since:
Jacquard 1.10.12

layoutWidget

protected void layoutWidget(Context context,
                            Widget w)
                     throws DataStoreException,
                            javax.servlet.ServletException,
                            java.io.IOException
Deprecated. use variant with tabIndex

lay out a widget. This is one of the methods which specialisations should override in order to change appearance.

Parameters:
context - the context in which the widget should be laid out
w - the widget to lay out
Throws:
DataStoreException
javax.servlet.ServletException
java.io.IOException
Since:
Jacquard 1.10.12

layoutWidget

protected void layoutWidget(Context context,
                            Widget w,
                            int tabIndex)
                     throws DataStoreException,
                            javax.servlet.ServletException,
                            java.io.IOException
layout one widget

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

layoutWidgets

protected void layoutWidgets(WidgetSet ws,
                             Context context)
                      throws javax.servlet.ServletException,
                             java.io.IOException
Lay my visible widgets out in the order they were added, appending the hidden ones

Parameters:
ws - the WidgetSet to lay out
context - the context to lay it out in
Throws:
javax.servlet.ServletException
java.io.IOException
Since:
Jacquard 1.10.12

jacquard 1.12.0 by The Web Engineering Factory and Toolworks