org.opennms.gwt.web.ui.asset.client.tools.fieldsets
Class AbstractFieldSet

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.Composite
              extended by org.opennms.gwt.web.ui.asset.client.tools.fieldsets.AbstractFieldSet
All Implemented Interfaces:
com.google.gwt.event.dom.client.ChangeHandler, com.google.gwt.event.dom.client.FocusHandler, com.google.gwt.event.logical.shared.HasAttachHandlers, com.google.gwt.event.shared.EventHandler, com.google.gwt.event.shared.HasHandlers, com.google.gwt.user.client.EventListener, com.google.gwt.user.client.ui.IsWidget, FieldSet
Direct Known Subclasses:
FieldSetDateBox, FieldSetListBox, FieldSetPasswordBox, FieldSetSuggestBox, FieldSetTextArea, FieldSetTextBox, FieldSetTextDisplay

public abstract class AbstractFieldSet
extends com.google.gwt.user.client.ui.Composite
implements FieldSet

Author:
Markus Neumann Implementation of FieldSet that creats an GWT Composite and Panel based FieldSet. The abstract implementation contains no field for value or value-input. Just extensions of abstract FieldSet will support values. The FieldSet contains label, help text, warning mechanism, error mechanism, change mechanism. Warning- and errors-mechanism contains Validators, results will be displayed and marked up by css. Change-mechanism will markup fields by css if the value was changed by the user and is differed then original value.

Nested Class Summary
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled
 
Field Summary
protected  Boolean changed
           
protected  Boolean enabled
           
protected  com.google.gwt.user.client.ui.Label errorLabel
           
protected  ArrayList<Validator> errorValidators
           
protected  String helpText
           
protected  Object inititalValue
           
protected  com.google.gwt.user.client.ui.Label label
           
protected  com.google.gwt.user.client.ui.VerticalPanel mainPanel
           
protected  com.google.gwt.user.client.ui.HorizontalPanel panel
           
protected  com.google.gwt.user.client.ui.DecoratedPopupPanel popPanel
           
protected  com.google.gwt.user.client.ui.Label warningLabel
           
protected  ArrayList<Validator> warningValidators
           
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
AbstractFieldSet(String name, String helpText)
           
 
Method Summary
 void addErrorValidator(Validator validator)
           
 void addWarningValidator(Validator validator)
           
 boolean checkField()
          checks if the value of fieldset has changed and starts validation if necessary.
 void clearChanged()
          Clears the status changed from a FieldSet.
 void clearErrors()
          clears all error strings from a FieldSet.
 void clearErrorValidators()
           
 void clearWarnings()
          clears all warning strings from a FieldSet.
 void clearWarningValidators()
           
 Boolean getEnabled()
           
 String getError()
          Get the complete error string for the FieldSet.
 ArrayList<Validator> getErrorValidators()
           
 String getLabel()
          Get the description/label text of the FieldSet.
 String getWarning()
          Get the complete warning string for the FieldSet.
 void onChange(com.google.gwt.event.dom.client.ChangeEvent event)
           
 void onFocus(com.google.gwt.event.dom.client.FocusEvent event)
           
 void setError(String error)
          Set a error string to the FieldSet.
 void setErrors(ArrayList<String> errors)
           
 void setErrorValidators(ArrayList<Validator> validators)
           
 void setLabel(String lable)
          Sets a text into the description/label of the FieldSet.
 void setWarning(String warning)
          Set a warning string to the FieldSet.
 void setWarnings(ArrayList<String> warnings)
           
 void setWarningValidators(ArrayList<Validator> validators)
           
protected  void validate(Object object)
          Validates FieldSet.
 
Methods inherited from class com.google.gwt.user.client.ui.Composite
getWidget, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, 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, onLoad, 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
 
Methods inherited from interface org.opennms.gwt.web.ui.asset.client.tools.fieldsets.FieldSet
getValue, setEnabled, setValue
 

Field Detail

mainPanel

protected com.google.gwt.user.client.ui.VerticalPanel mainPanel

panel

protected com.google.gwt.user.client.ui.HorizontalPanel panel

label

protected com.google.gwt.user.client.ui.Label label

enabled

protected Boolean enabled

changed

protected Boolean changed

errorLabel

protected com.google.gwt.user.client.ui.Label errorLabel

warningLabel

protected com.google.gwt.user.client.ui.Label warningLabel

helpText

protected String helpText

popPanel

protected com.google.gwt.user.client.ui.DecoratedPopupPanel popPanel

errorValidators

protected ArrayList<Validator> errorValidators

warningValidators

protected ArrayList<Validator> warningValidators

inititalValue

protected Object inititalValue
Constructor Detail

AbstractFieldSet

public AbstractFieldSet(String name,
                        String helpText)
Method Detail

addErrorValidator

public void addErrorValidator(Validator validator)

addWarningValidator

public void addWarningValidator(Validator validator)

checkField

public boolean checkField()
checks if the value of fieldset has changed and starts validation if necessary.

Returns:
true if fieldset was changed to a state not equales the initioal state of the value.

clearChanged

public void clearChanged()
Description copied from interface: FieldSet
Clears the status changed from a FieldSet.

Specified by:
clearChanged in interface FieldSet

clearErrors

public void clearErrors()
Description copied from interface: FieldSet
clears all error strings from a FieldSet.

Specified by:
clearErrors in interface FieldSet

clearErrorValidators

public void clearErrorValidators()

clearWarnings

public void clearWarnings()
Description copied from interface: FieldSet
clears all warning strings from a FieldSet.

Specified by:
clearWarnings in interface FieldSet

clearWarningValidators

public void clearWarningValidators()

getEnabled

public Boolean getEnabled()
Specified by:
getEnabled in interface FieldSet
Returns:
boolean enabled if writing/changes are allowed/active.

getError

public String getError()
Description copied from interface: FieldSet
Get the complete error string for the FieldSet.

Specified by:
getError in interface FieldSet
Returns:
String error

getErrorValidators

public ArrayList<Validator> getErrorValidators()

getLabel

public String getLabel()
Description copied from interface: FieldSet
Get the description/label text of the FieldSet.

Specified by:
getLabel in interface FieldSet
Returns:
String label

getWarning

public String getWarning()
Description copied from interface: FieldSet
Get the complete warning string for the FieldSet.

Specified by:
getWarning in interface FieldSet
Returns:
String warning

onChange

public void onChange(com.google.gwt.event.dom.client.ChangeEvent event)
Specified by:
onChange in interface com.google.gwt.event.dom.client.ChangeHandler

onFocus

public void onFocus(com.google.gwt.event.dom.client.FocusEvent event)
Specified by:
onFocus in interface com.google.gwt.event.dom.client.FocusHandler

setError

public void setError(String error)
Description copied from interface: FieldSet
Set a error string to the FieldSet.

Specified by:
setError in interface FieldSet

setErrors

public void setErrors(ArrayList<String> errors)

setErrorValidators

public void setErrorValidators(ArrayList<Validator> validators)

setLabel

public void setLabel(String lable)
Description copied from interface: FieldSet
Sets a text into the description/label of the FieldSet.

Specified by:
setLabel in interface FieldSet

setWarning

public void setWarning(String warning)
Description copied from interface: FieldSet
Set a warning string to the FieldSet.

Specified by:
setWarning in interface FieldSet

setWarnings

public void setWarnings(ArrayList<String> warnings)

setWarningValidators

public void setWarningValidators(ArrayList<Validator> validators)

validate

protected void validate(Object object)
Validates FieldSet. Warnings and errors will be checked. CSS tags will be set if necessary.

Parameters:
object -


Copyright © 2011. All Rights Reserved.