Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.maryanovsky.gwtutils.client.ui
Class Form

    java.lang.Object
      com.google.gwt.user.client.ui.UIObject
          com.google.gwt.user.client.ui.Widget
              com.google.gwt.user.client.ui.Composite
                  com.maryanovsky.gwtutils.client.ui.Form

All Implemented Interfaces:
  HasAttachHandlers, HasHandlers, EventListener, HasVisibility, IsRenderable, IsWidget

    public class Form

extends Composite

A panel which manages most of the tedious work behind setting up a well-arranged and properly aligned form. A form consists of 3 main elements: a title, a set of named fields and a set of buttons.

Author:
  Maryanovsky Alexander

Nested Class Summary

Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
`UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled`

Field Summary

Fields inherited from class com.google.gwt.user.client.ui.UIObject
`DEBUG_ID_PREFIX`

Constructor Summary
`Form()` Creates a new `Form`.

Method Summary
`void` | `addField(String name, HasVerticalAlignment.VerticalAlignmentConstant nameVerticalAlignment, HasHorizontalAlignment.HorizontalAlignmentConstant nameHorizontalAlignment, Widget field, HasVerticalAlignment.VerticalAlignmentConstant fieldVerticalAlignment, HasHorizontalAlignment.HorizontalAlignmentConstant fieldHorizontalAlignment, String suffix, HasVerticalAlignment.VerticalAlignmentConstant suffixVerticalAlignment, HasHorizontalAlignment.HorizontalAlignmentConstant suffixHorizontalAlignment)` Adds a field with the specified name and suffix.
`void` | `addField(String name, Widget field)` Adds a field with the specified name.
`void` | `addField(String name, Widget field, String suffix)` Adds a field with the specified name and suffix.
`void` | `addRelatedFieldGap()` Adds a related gap following the last field.
`void` | `addUnrelatedFieldGap()` Adds an unrelated gap following the last field.
`int` | `getFieldRow(Widget field)` Returns the index of the field with the specified widget; `-1` if none.
`protected void` | `onLoad()` Invoked when this widget is attached to the DOM.
`void` | `removeField(Widget field)` Removes the specified field from the form.
`void` | `removeRow(int row)` Removes the specified row.
`void` | `setButtons(Button okButton, Button cancelButton)` Sets the form buttons.
`void` | `setClickOkOnEnter(boolean isClickOkOnEnter)` Sets whether the "OK" button will be clicked programmatically when the user hits ENTER.
`void` | `setDefaultFocusedWidget(Focusable widget)` Sets the widget to get the focus by default.
`void` | `setFieldVisible(Widget field, boolean isVisible)` Sets the visibility of the specified field.
`void` | `setFormTitle(String title)` Sets the title of this form.

Methods inherited from class com.google.gwt.user.client.ui.Composite
`claimElement, getWidget, initializeClaimedElement, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, render, render, resolvePotentialElement, setWidget`

Methods inherited from class com.google.gwt.user.client.ui.Widget
`addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onUnload, removeFromParent, setLayoutData, sinkEvents`

Methods inherited from class com.google.gwt.user.client.ui.UIObject
`addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString, unsinkEvents`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### Form

    public Form()

  Creates a new `Form`.

Method Detail

### setClickOkOnEnter

    public void setClickOkOnEnter(boolean isClickOkOnEnter)

  Sets whether the "OK" button will be clicked programmatically when the user hits ENTER.

### setFormTitle

    public void setFormTitle(String title)

  Sets the title of this form.

### addField

    public void addField(String name,
                         Widget field)

  Adds a field with the specified name.

### addField

    public void addField(String name,
                         Widget field,
                         String suffix)

  Adds a field with the specified name and suffix. The suffix is displayed after the field.

### addField

    public void addField(String name,
                         HasVerticalAlignment.VerticalAlignmentConstant nameVerticalAlignment,
                         HasHorizontalAlignment.HorizontalAlignmentConstant nameHorizontalAlignment,
                         Widget field,
                         HasVerticalAlignment.VerticalAlignmentConstant fieldVerticalAlignment,
                         HasHorizontalAlignment.HorizontalAlignmentConstant fieldHorizontalAlignment,
                         String suffix,
                         HasVerticalAlignment.VerticalAlignmentConstant suffixVerticalAlignment,
                         HasHorizontalAlignment.HorizontalAlignmentConstant suffixHorizontalAlignment)

  Adds a field with the specified name and suffix. The elements are aligned as specified. Vertical `null` alignments are interpreted as `HasVerticalAlignment.ALIGN_MIDDLE`. Horizontal `null` alignments are interpreted as textual leading alignment, except that field names are aligned to the trailing side.

### addUnrelatedFieldGap

    public void addUnrelatedFieldGap()

  Adds an unrelated gap following the last field.

### addRelatedFieldGap

    public void addRelatedFieldGap()

  Adds a related gap following the last field.

### setButtons

    public void setButtons(Button okButton,
                           Button cancelButton)

  Sets the form buttons. Either or both of the two buttons may be `null`.

### getFieldRow

    public int getFieldRow(Widget field)

  Returns the index of the field with the specified widget; `-1` if none.

### removeField

    public void removeField(Widget field)

  Removes the specified field from the form.

### removeRow

    public void removeRow(int row)

  Removes the specified row. Unlike `removeField(Widget)`, this method can be used to remove gaps.

### setFieldVisible

    public void setFieldVisible(Widget field,
                                boolean isVisible)

  Sets the visibility of the specified field.

### setDefaultFocusedWidget

    public void setDefaultFocusedWidget(Focusable widget)

  Sets the widget to get the focus by default.

### onLoad

    protected void onLoad()

  Invoked when this widget is attached to the DOM.

  Overrides:
    `onLoad` in class `Widget`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD