org.kuali.student.common.ui.client.configurable.mvc.sections
Class BaseSection

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.kuali.student.common.ui.client.widgets.field.layout.element.SpanPanel
                      extended by org.kuali.student.common.ui.client.configurable.mvc.sections.BaseSection
All Implemented Interfaces:
com.google.gwt.event.logical.shared.HasAttachHandlers, com.google.gwt.event.shared.HasHandlers, com.google.gwt.user.client.EventListener, com.google.gwt.user.client.ui.HasWidgets, com.google.gwt.user.client.ui.HasWidgets.ForIsWidget, com.google.gwt.user.client.ui.IndexedPanel, com.google.gwt.user.client.ui.IndexedPanel.ForIsWidget, com.google.gwt.user.client.ui.IsWidget, Iterable<com.google.gwt.user.client.ui.Widget>, HasLayoutController, Section, ReportExportWidget
Direct Known Subclasses:
CollapsableSection, GroupSection, HorizontalSection, MultiplicityGroupItem, MultiplicitySection, SectionView, SwapSection, SwitchSection, TableSection, VerticalSection

public abstract class BaseSection
extends SpanPanel
implements Section

The base section is the base implementation of the section interface.

Author:
Kuali Student

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
 
Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.IndexedPanel
com.google.gwt.user.client.ui.IndexedPanel.ForIsWidget
 
Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasWidgets
com.google.gwt.user.client.ui.HasWidgets.ForIsWidget
 
Field Summary
protected  ArrayList<FieldDescriptor> fields
           
protected  boolean isDirty
           
protected  boolean isValidationEnabled
           
protected  FieldLayout layout
           
protected  LayoutController layoutController
           
protected  ArrayList<Section> sections
           
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
BaseSection()
           
 
Method Summary
 void add(com.google.gwt.user.client.ui.Widget w)
          DO NOT use this method for adding sections, fields, or widgets to sections
 String addField(FieldDescriptor fieldDescriptor)
          Adds a field to this section.
 String addSection(Section section)
          Adds a section to this section's layout.
 String addSection(String key, Section section)
          Same as addSection except with an option user defined key (for retrieval of the section if necessary).
 void addStyleName(String style)
          Adds a style to this section's underlying layout.
 String addWidget(com.google.gwt.user.client.ui.Widget w)
          Use this to add widgets to a sections layout.
protected  void clearValidationErrors()
          Clear all validation errors from the layout (removes all red highlight and error text shown on the screen)
 void clearValidationWarnings()
          Clear all validation warnings from the layout (removes all yellow highlight and warning text shown on the screen)
protected static void enableField(Boolean isEnabled, FieldDescriptor fd)
          Used to enable,disable widget defined in field descriptor
 void enableValidation(boolean enableValidation)
          A section can turn off all validation by setting this flag
protected  boolean ensureDirtyFlagPath(Data root, QueryPath path)
           
 FieldDescriptor getField(String fieldKey)
           
 List<FieldDescriptor> getFields()
          Gets all the fields in a section and its subsections.
 FieldLayout getLayout()
          Gets this sections fieldLayout.
 LayoutController getLayoutController()
          Gets the defined controller for this section if one exists.
 Section getSection(String sectionKey)
           
 List<Section> getSections()
          Gets all nested sections contained in this section
 List<FieldDescriptor> getUnnestedFields()
          Gets all the fields in this section, but does not include fields in its nested sections.
 boolean isDirty()
          Returns true if this this section is considered dirty (the user may have entered data into this section)
 boolean isValidationEnabled()
           
 ValidationResult.ErrorLevel processValidationResults(List<ValidationResultInfo> results)
          Same as processValidationResults(results, true)
 ValidationResult.ErrorLevel processValidationResults(List<ValidationResultInfo> results, boolean clearErrors)
          Processes the validation results passed in and displays the appropriate message on the screen next to the corresponding field or section.
static void progressiveEnableAndRequireFields(Boolean isRequiredAndEnabled, FieldDescriptor... fieldDescriptors)
          This will progressively enable/disable and require/unrequire a set of fields
static void progressiveEnableFields(Boolean isEnabled, FieldDescriptor... fieldDescriptors)
          This will progressively enable/disable a set of fields
static void progressiveRequireFields(Boolean isRequired, FieldDescriptor... fieldDescriptors)
          This will progressively require/unrequire a set of fields
 void removeField(FieldDescriptor field)
           
 void removeField(String fieldKey)
           
 void removeSection(Section section)
          Removes a section from this section's layout.
 void removeSection(String sectionKey)
           
 void removeWidget(String key)
           
 void removeWidget(com.google.gwt.user.client.ui.Widget widget)
           
 void resetDirtyFlags()
           
 void resetFieldInteractionFlags()
          Resets all the dirty and focus flags on fields.
 void setFieldHasHadFocusFlags(boolean hadFocus)
          Sets the fields has had focus flag.
 void setHelp(String html)
          Sets help for this entire section (appears next to section title)
 void setInstructions(String html)
          Sets instructions for this entire section (appears next to section title)
 void setIsDirty(boolean state)
           
 void setLayoutController(LayoutController controller)
           
 void setRequired(AbbrPanel required)
          Sets required for this entire section (appears next to section title)
 void setSectionId(String id)
           
 void setStyleName(String style)
           
 void updateModel(DataModel model)
          Update the model passed in with data from the fields on this section.
 void updateWidgetData(DataModel model)
          Updates the section's fields with data from the model passed in.
 
Methods inherited from class org.kuali.student.common.ui.client.widgets.field.layout.element.SpanPanel
getExportElementSubset, getExportFieldValue, getText, insert, isExportElement, setExportElement, setHTML, setText
 
Methods inherited from class com.google.gwt.user.client.ui.ComplexPanel
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, adopt, clear, disown, 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, onAttach, onBrowserEvent, onDetach, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, 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, 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
 

Field Detail

layout

protected FieldLayout layout

sections

protected ArrayList<Section> sections

fields

protected ArrayList<FieldDescriptor> fields

layoutController

protected LayoutController layoutController

isValidationEnabled

protected boolean isValidationEnabled

isDirty

protected boolean isDirty
Constructor Detail

BaseSection

public BaseSection()
Method Detail

addField

public String addField(FieldDescriptor fieldDescriptor)
Adds a field to this section. Adds the field to this section's layout. Attaches an event handler for lost focus events on the field widget to validate against the metadata defined in its FieldDescriptor as well as firing events for dirty field handling. Note if a field has been marked as hidden in the dictionary, this method will not add this field to the layout. If it is not visible the key returned by making call to addField is null.

Specified by:
addField in interface Section
Parameters:
field -
Returns:
key/path of this field

ensureDirtyFlagPath

protected boolean ensureDirtyFlagPath(Data root,
                                      QueryPath path)

addSection

public String addSection(Section section)
Adds a section to this section's layout.

Specified by:
addSection in interface Section
See Also:
Section.addSection(org.kuali.student.common.ui.client.configurable.mvc.sections.Section)

removeSection

public void removeSection(Section section)
Removes a section from this section's layout.

Specified by:
removeSection in interface Section
See Also:
Section.removeSection(org.kuali.student.common.ui.client.configurable.mvc.sections.Section)

clearValidationErrors

protected void clearValidationErrors()
Clear all validation errors from the layout (removes all red highlight and error text shown on the screen)


clearValidationWarnings

public void clearValidationWarnings()
Clear all validation warnings from the layout (removes all yellow highlight and warning text shown on the screen)

Specified by:
clearValidationWarnings in interface Section

getFields

public List<FieldDescriptor> getFields()
Gets all the fields in a section and its subsections.

Specified by:
getFields in interface Section
See Also:
Section.getFields()

getUnnestedFields

public List<FieldDescriptor> getUnnestedFields()
Gets all the fields in this section, but does not include fields in its nested sections.

Specified by:
getUnnestedFields in interface Section
See Also:
Section.getUnnestedFields()

getSections

public List<Section> getSections()
Gets all nested sections contained in this section

Specified by:
getSections in interface Section
See Also:
Section.getSections()

processValidationResults

public ValidationResult.ErrorLevel processValidationResults(List<ValidationResultInfo> results,
                                                            boolean clearErrors)
Processes the validation results passed in and displays the appropriate message on the screen next to the corresponding field or section. If clearAllValidation is true, it will clear all validation before displaying the errors (otherwise will append these errors to the ones already visible on the section).

Specified by:
processValidationResults in interface Section
See Also:
Section.processValidationResults(java.util.List, boolean)

processValidationResults

public ValidationResult.ErrorLevel processValidationResults(List<ValidationResultInfo> results)
Same as processValidationResults(results, true)

Specified by:
processValidationResults in interface Section
See Also:
Section.processValidationResults(java.util.List)

getLayoutController

public LayoutController getLayoutController()
Gets the defined controller for this section if one exists.

Specified by:
getLayoutController in interface HasLayoutController
See Also:
HasLayoutController.getLayoutController()

setLayoutController

public void setLayoutController(LayoutController controller)
Specified by:
setLayoutController in interface HasLayoutController

addWidget

public String addWidget(com.google.gwt.user.client.ui.Widget w)
Use this to add widgets to a sections layout. DO NOT use the add(Widget widget) call.

Specified by:
addWidget in interface Section
See Also:
Section.addWidget(com.google.gwt.user.client.ui.Widget)

setFieldHasHadFocusFlags

public void setFieldHasHadFocusFlags(boolean hadFocus)
Sets the fields has had focus flag. This flag is used for determining if the user has interacted with any fields on the page or if the fields need to be assumed to have been interacted with. Used for determining when validation is necessary on a particular section.

Specified by:
setFieldHasHadFocusFlags in interface Section
See Also:
Section.setFieldHasHadFocusFlags(boolean)

enableValidation

public void enableValidation(boolean enableValidation)
A section can turn off all validation by setting this flag

Specified by:
enableValidation in interface Section
See Also:
Section.enableValidation(boolean)

isValidationEnabled

public boolean isValidationEnabled()
Specified by:
isValidationEnabled in interface Section

updateModel

public void updateModel(DataModel model)
Update the model passed in with data from the fields on this section. This method will use the modelWidgetBinding defined in each of this sections fields to determine how to add this data to the model.

Specified by:
updateModel in interface Section
See Also:
Section.updateModel(org.kuali.student.common.ui.client.mvc.DataModel)

updateWidgetData

public void updateWidgetData(DataModel model)
Updates the section's fields with data from the model passed in. This effects all the data input and display widgets on the particular section. This method will use the modelWidgetBinding defined in each of this sections fields to determine how to interpret data from the model and display it on the fields corresponding widget.

Specified by:
updateWidgetData in interface Section
See Also:
Section.updateWidgetData(org.kuali.student.common.ui.client.mvc.DataModel)

resetFieldInteractionFlags

public void resetFieldInteractionFlags()
Resets all the dirty and focus flags on fields.

Specified by:
resetFieldInteractionFlags in interface Section
See Also:
Section.resetFieldInteractionFlags()

resetDirtyFlags

public void resetDirtyFlags()
Specified by:
resetDirtyFlags in interface Section

addSection

public String addSection(String key,
                         Section section)
Same as addSection except with an option user defined key (for retrieval of the section if necessary).

Specified by:
addSection in interface Section
See Also:
Section.addSection(java.lang.String, org.kuali.student.common.ui.client.configurable.mvc.sections.Section)

getField

public FieldDescriptor getField(String fieldKey)
Specified by:
getField in interface Section

getLayout

public FieldLayout getLayout()
Gets this sections fieldLayout. The fieldLayout is used to determine how sections will layout the ui and contains things such as the title and validation panels.

Specified by:
getLayout in interface Section
See Also:
Section.getLayout()

getSection

public Section getSection(String sectionKey)
Specified by:
getSection in interface Section

removeField

public void removeField(String fieldKey)
Specified by:
removeField in interface Section

removeField

public void removeField(FieldDescriptor field)
Specified by:
removeField in interface Section

removeSection

public void removeSection(String sectionKey)
Specified by:
removeSection in interface Section

removeWidget

public void removeWidget(com.google.gwt.user.client.ui.Widget widget)
Specified by:
removeWidget in interface Section

removeWidget

public void removeWidget(String key)
Specified by:
removeWidget in interface Section

isDirty

public boolean isDirty()
Returns true if this this section is considered dirty (the user may have entered data into this section)

Specified by:
isDirty in interface Section
See Also:
Section.isDirty()

setIsDirty

public void setIsDirty(boolean state)

add

public void add(com.google.gwt.user.client.ui.Widget w)
DO NOT use this method for adding sections, fields, or widgets to sections

Specified by:
add in interface com.google.gwt.user.client.ui.HasWidgets
Overrides:
add in class SpanPanel
Parameters:
w - the widget to be added

addStyleName

public void addStyleName(String style)
Adds a style to this section's underlying layout.

Overrides:
addStyleName in class com.google.gwt.user.client.ui.UIObject
See Also:
UIObject.addStyleName(java.lang.String)

setStyleName

public void setStyleName(String style)
Overrides:
setStyleName in class com.google.gwt.user.client.ui.UIObject

setInstructions

public void setInstructions(String html)
Sets instructions for this entire section (appears next to section title)

Parameters:
html -

setHelp

public void setHelp(String html)
Sets help for this entire section (appears next to section title)

Parameters:
html -

setRequired

public void setRequired(AbbrPanel required)
Sets required for this entire section (appears next to section title)

Parameters:
required -

setSectionId

public void setSectionId(String id)

progressiveEnableFields

public static void progressiveEnableFields(Boolean isEnabled,
                                           FieldDescriptor... fieldDescriptors)
This will progressively enable/disable a set of fields

Parameters:
isEnabled - if the fields should be enabled or disabled
fieldDescriptor - List of field descriptors to enable/disable

progressiveEnableAndRequireFields

public static void progressiveEnableAndRequireFields(Boolean isRequiredAndEnabled,
                                                     FieldDescriptor... fieldDescriptors)
This will progressively enable/disable and require/unrequire a set of fields

Parameters:
isEnabled -
fieldDescriptors -

progressiveRequireFields

public static void progressiveRequireFields(Boolean isRequired,
                                            FieldDescriptor... fieldDescriptors)
This will progressively require/unrequire a set of fields

Parameters:
isRequired -
fieldDescriptors -

enableField

protected static void enableField(Boolean isEnabled,
                                  FieldDescriptor fd)
Used to enable,disable widget defined in field descriptor

Parameters:
isEnabled -
fd -


Copyright © 2004-2012 The Kuali Foundation. All Rights Reserved.