pivot.wtk
Class Form

java.lang.Object
  extended by pivot.wtk.Component
      extended by pivot.wtk.Container
          extended by pivot.wtk.Form
All Implemented Interfaces:
Iterable<Component>, Sequence<Component>, ConstrainedVisual, Visual

public class Form
extends Container

A container that arranges field components in a form layout. Each field has an optional text label associated with it and may be flagged as requiring attention using one of several flag types and an optional flag message (for use during form validation, for example).

TODO Add a label alignment attribute (vertical).

Author:
gbrown

Nested Class Summary
static class Form.Flag
          Represents an message alert associated with a form field.
protected static class Form.FormAttributes
          Defines form field attributes.
static class Form.Section
          Class representing a menu section.
 class Form.SectionSequence
          Section sequence implementation.
 
Nested classes/interfaces inherited from class pivot.wtk.Component
Component.Attributes, Component.ComponentDictionary, Component.DecoratorSequence, Component.StyleDictionary, Component.UserDataDictionary
 
Nested classes/interfaces inherited from interface pivot.collections.Sequence
Sequence.Search, Sequence.Sort, Sequence.Tree
 
Constructor Summary
Form()
          Creates a new form.
 
Method Summary
static Form.Flag getFlag(Component component)
           
 int getFlaggedFieldCount(MessageType messageType)
          Returns the number of fields that are flagged with a given flag type.
 ListenerList<FormAttributeListener> getFormAttributeListeners()
          Returns the form attribute listener list.
 ListenerList<FormListener> getFormListeners()
          Returns the form listener list.
static String getName(Component component)
           
static Form.Section getSection(Component component)
           
 Form.SectionSequence getSections()
          Returns the form's field sequence.
 Sequence<Component> remove(int index, int count)
          Removes one or more items from the sequence.
static void setFlag(Component component, Form.Flag flag)
           
static void setFlag(Component component, String flag)
           
static void setName(Component component, String name)
           
 
Methods inherited from class pivot.wtk.Container
add, containsFocus, get, getComponentAt, getContainerListeners, getContainerMouseListeners, getContextKey, getDescendantAt, getFocusTraversalPolicy, getLength, indexOf, insert, isAncestor, isFocusable, iterator, load, mouseClick, mouseDown, mouseMove, mouseOut, mouseUp, mouseWheel, move, paint, remove, removeAll, requestFocus, setContextKey, setEnabled, setFocusTraversalPolicy, setParent, setTooltip, setVisible, store, update, validate
 
Methods inherited from class pivot.wtk.Component
clearFocus, clearFocus, finalize, getAttributes, getBounds, getComponentClassListeners, getComponentDataListeners, getComponentDecoratorListeners, getComponentDragDropListeners, getComponentKeyListeners, getComponentLayoutListeners, getComponentListeners, getComponentMouseButtonListeners, getComponentMouseListeners, getComponentMouseWheelListeners, getComponents, getComponentStateListeners, getCursor, getDecoratedBounds, getDecorators, getDisplay, getDragSource, getDropTarget, getFocusedComponent, getGraphics, getHandle, getHeight, getLocation, getParent, getPreferredHeight, getPreferredHeight, getPreferredSize, getPreferredWidth, getPreferredWidth, getSize, getSkin, getStyles, getTooltipText, getUserData, getVisibleArea, getVisibleArea, getVisibleArea, getWidth, getWindow, getX, getY, installSkin, invalidate, isBlocked, isDisplayable, isEnabled, isFocused, isMouseOver, isOpaque, isPreferredHeightSet, isPreferredSizeSet, isPreferredWidthSet, isShowing, isValid, isVisible, keyPressed, keyReleased, keyTyped, load, mapPointFromAncestor, mapPointToAncestor, mouseOver, repaint, repaint, repaint, repaint, repaint, repaint, requestFocus, scrollAreaToVisible, scrollAreaToVisible, setAttributes, setCursor, setCursor, setDisplayable, setDragSource, setDropTarget, setFocused, setHeight, setLocation, setLocation, setPreferredHeight, setPreferredSize, setPreferredSize, setPreferredWidth, setSize, setSize, setSkin, setStyles, setStyles, setStyles, setTooltipText, setWidth, setX, setY, store, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Form

public Form()
Creates a new form.

Method Detail

getSections

public Form.SectionSequence getSections()
Returns the form's field sequence.

Returns:
The form's field sequence.

getFlaggedFieldCount

public int getFlaggedFieldCount(MessageType messageType)
Returns the number of fields that are flagged with a given flag type.

Parameters:
messageType - The message type to count, or null to return the count of all flagged fields regardless of message type.

remove

public Sequence<Component> remove(int index,
                                  int count)
Description copied from interface: Sequence
Removes one or more items from the sequence.

Specified by:
remove in interface Sequence<Component>
Overrides:
remove in class Container
Parameters:
index - The starting index to remove.
count - The number of items to remove, beginning with index.
Returns:
A sequence containing the items that were removed.

getFormListeners

public ListenerList<FormListener> getFormListeners()
Returns the form listener list.

Returns:
The form listener list.

getFormAttributeListeners

public ListenerList<FormAttributeListener> getFormAttributeListeners()
Returns the form attribute listener list.

Returns:
The form attribute listener list.

getSection

public static Form.Section getSection(Component component)

getName

public static String getName(Component component)

setName

public static void setName(Component component,
                           String name)

getFlag

public static Form.Flag getFlag(Component component)

setFlag

public static void setFlag(Component component,
                           Form.Flag flag)

setFlag

public static final void setFlag(Component component,
                                 String flag)