org.gwtbootstrap3.client.ui.base.form
Class AbstractForm

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.google.gwt.user.client.ui.Panel
              extended by com.google.gwt.user.client.ui.ComplexPanel
                  extended by org.gwtbootstrap3.client.ui.base.form.FormElementContainer
                      extended by org.gwtbootstrap3.client.ui.base.form.AbstractForm
All Implemented Interfaces:
HasAttachHandlers, HasHandlers, EventListener, HasVisibility, HasWidgets, HasWidgets.ForIsWidget, com.google.gwt.user.client.ui.impl.FormPanelImplHost, IndexedPanel, IndexedPanel.ForIsWidget, IsWidget, Iterable<Widget>, HasResponsiveness
Direct Known Subclasses:
Form, NavbarForm

public abstract class AbstractForm
extends FormElementContainer
implements com.google.gwt.user.client.ui.impl.FormPanelImplHost

Author:
Sven Jacobs, Steven Jardine

Nested Class Summary
static class AbstractForm.SubmitCompleteEvent
          Fired when a form has been submitted successfully.
static interface AbstractForm.SubmitCompleteHandler
          Handler for AbstractForm.SubmitCompleteEvent events.
static class AbstractForm.SubmitEvent
          Fired when the form is submitted.
static interface AbstractForm.SubmitHandler
          Handler for FormPanel.SubmitEvent events.
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
 
Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.IndexedPanel
IndexedPanel.ForIsWidget
 
Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasWidgets
HasWidgets.ForIsWidget
 
Field Summary
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
  AbstractForm()
           
  AbstractForm(boolean createIFrame)
           
protected AbstractForm(Element element, boolean createIFrame)
          This constructor may be used by subclasses to explicitly use an existing element.
 
Method Summary
 HandlerRegistration addSubmitCompleteHandler(AbstractForm.SubmitCompleteHandler handler)
          Adds a AbstractForm.SubmitCompleteEvent handler.
 HandlerRegistration addSubmitHandler(AbstractForm.SubmitHandler handler)
          Adds a AbstractForm.SubmitEvent handler.
 String getAction()
          Gets the 'action' associated with this form.
protected  List<HasValidators<?>> getChildrenWithValidators(Widget widget)
          Get this forms child input elements with validators.
 String getEncoding()
          Gets the encoding used for submitting this form.
 String getMethod()
          Gets the HTTP method used for submitting this form.
 String getTarget()
          Gets the form's 'target'.
protected  void onAttach()
           
protected  void onDetach()
           
 boolean onFormSubmit()
           
 void onFrameLoad()
           
 void reset()
          Resets form
 void setAction(SafeUri url)
          Sets the 'action' associated with this form.
 void setAction(String action)
          Sets the 'action' associated with this form.
 void setEncoding(String encodingType)
          Sets the encoding used for submitting this form.
 void setMethod(String method)
          Sets the HTTP method used for submitting this form.
 void submit()
          Submits form
 boolean validate()
           
 boolean validate(boolean show)
           
 
Methods inherited from class org.gwtbootstrap3.client.ui.base.form.FormElementContainer
add, setHiddenOn, setVisibleOn
 
Methods inherited from class com.google.gwt.user.client.ui.ComplexPanel
add, add, adjustIndex, checkIndexBoundsForAccess, checkIndexBoundsForInsertion, getChildren, getWidget, getWidgetCount, getWidgetIndex, getWidgetIndex, insert, insert, iterator, remove, remove
 
Methods inherited from class com.google.gwt.user.client.ui.Panel
add, adopt, clear, doAttachChildren, doDetachChildren, orphan, remove
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onBrowserEvent, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents, unsinkEvents
 
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, resolvePotentialElement, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractForm

public AbstractForm()

AbstractForm

public AbstractForm(boolean createIFrame)

AbstractForm

protected AbstractForm(Element element,
                       boolean createIFrame)
This constructor may be used by subclasses to explicitly use an existing element. This element must be a <form> element.

If the createIFrame parameter is set to true, then the wrapped form's target attribute will be set to a hidden iframe. If not, the form's target will be left alone, and the FormSubmitComplete event will not be fired.

Parameters:
element - the element to be used
createIFrame - true to create an <iframe> element that will be targeted by this form
Method Detail

onAttach

protected void onAttach()
Overrides:
onAttach in class Widget

onDetach

protected void onDetach()
Overrides:
onDetach in class Widget

onFormSubmit

public boolean onFormSubmit()
Specified by:
onFormSubmit in interface com.google.gwt.user.client.ui.impl.FormPanelImplHost

onFrameLoad

public void onFrameLoad()
Specified by:
onFrameLoad in interface com.google.gwt.user.client.ui.impl.FormPanelImplHost

addSubmitCompleteHandler

public HandlerRegistration addSubmitCompleteHandler(AbstractForm.SubmitCompleteHandler handler)
Adds a AbstractForm.SubmitCompleteEvent handler.

Parameters:
handler - the handler
Returns:
the handler registration used to remove the handler

addSubmitHandler

public HandlerRegistration addSubmitHandler(AbstractForm.SubmitHandler handler)
Adds a AbstractForm.SubmitEvent handler.

Parameters:
handler - the handler
Returns:
the handler registration used to remove the handler

getAction

public String getAction()
Gets the 'action' associated with this form. This is the URL to which it will be submitted.

Returns:
the form's action

setAction

public void setAction(String action)
Sets the 'action' associated with this form. This is the URL to which it will be submitted.

Parameters:
url - the form's action

setAction

public void setAction(SafeUri url)
Sets the 'action' associated with this form. This is the URL to which it will be submitted.

Parameters:
url - the form's action

getMethod

public String getMethod()
Gets the HTTP method used for submitting this form. This should be either #METHOD_GET or #METHOD_POST.

Returns:
the form's method

setMethod

public void setMethod(String method)
Sets the HTTP method used for submitting this form. This should be either #METHOD_GET or #METHOD_POST.

Parameters:
method - the form's method

getTarget

public String getTarget()
Gets the form's 'target'. This is the name of the NamedFrame that will receive the results of submission, or null if none has been specified.

Returns:
the form's target.

getEncoding

public String getEncoding()
Gets the encoding used for submitting this form. This should be either #ENCODING_MULTIPART or #ENCODING_URLENCODED.

Returns:
the form's encoding

setEncoding

public void setEncoding(String encodingType)
Sets the encoding used for submitting this form. This should be either #ENCODING_MULTIPART or #ENCODING_URLENCODED.

Parameters:
encodingType - the form's encoding

submit

public void submit()
Submits form


reset

public void reset()
Resets form


validate

public boolean validate()
Returns:
true if the child input elements are all valid.

validate

public boolean validate(boolean show)
Returns:
true if the child input elements are all valid.

getChildrenWithValidators

protected List<HasValidators<?>> getChildrenWithValidators(Widget widget)
Get this forms child input elements with validators.

Parameters:
widget - the widget
Returns:
the children with validators


Copyright © 2015. All rights reserved.