org.kuali.student.common.ui.client.configurable.mvc
Class LayoutController

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.kuali.student.common.ui.client.mvc.Controller
                  extended by org.kuali.student.common.ui.client.configurable.mvc.LayoutController
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.IsWidget, ViewLayoutController, BreadcrumbSupport, HistorySupport, View, ReportExport
Direct Known Subclasses:
ApplicationController, BasicLayout, BasicLayoutWithContentHeader, CurriculumHomeController, HomeController, MenuSectionController, TabbedSectionLayout, TabMenuController

public abstract class LayoutController
extends Controller
implements ViewLayoutController, View

The LayoutController is a central piece of the UIF. This controller is also itself a view. As such, LayoutControllers can also have other LayoutControllers as their views.

Author:
Kuali Student Team
See Also:
Controller

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  Enum<?> defaultView
           
protected  String name
           
protected  View startPopupView
           
protected  KSLightBox startViewWindow
           
protected  Map<String,Enum<?>> viewEnumMap
           
protected  Map<Enum<?>,View> viewMap
           
protected  Enum<?> viewType
           
 
Fields inherited from class org.kuali.student.common.ui.client.mvc.Controller
context, NO_OP_CALLBACK, parentController
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Fields inherited from interface org.kuali.student.common.ui.client.reporting.ReportExport
exportTemplateName
 
Constructor Summary
LayoutController()
          Constructor Sets up event handlers fro section update events and validation request events.
 
Method Summary
 void addStartViewPopup(View view)
          Creates a popup window with the view, that can be shown when needed for additional information needed from the user
 void addView(View view)
          Add a view to this LayoutController.
 com.google.gwt.user.client.ui.Widget asWidget()
          Get the attachable widget which represents this view
 boolean beforeHide()
          Called by the controller before the view is hidden to allow the view to perform cleanup or request confirmation from the user, etc.
 void beforeShow(Callback<Boolean> onReadyCallback)
          Default implementation does nothing on before show.
 void beforeViewChange(Enum<?> viewChangingTo, Callback<Boolean> okToChange)
          This particular implementation of beforeViewChange checks to see if all its view contains a Controller and if it does checks with that controller to see if it is ok to change the view.
 ValidationResultInfo.ErrorLevel checkForErrors(List<ValidationResultInfo> list)
          Check to see if the list of validation results have an error.
 void clear()
          Can be called to reset a view to a cleared state.
protected  void clearAllWarnings()
          This clears all warnings that currently displayed on all fields and sections.
 void collectBreadcrumbNames(List<String> names)
          Adds a human readable name(s) to the list passed in for use in the breadcrumb
static LayoutController findParentLayout(com.google.gwt.user.client.ui.Widget w)
          Finds the first parent LayoutController of this LayoutController, returns null if this is the top level LayoutController.
 Controller getController()
          Returns the controller associated with the view
 Enum<?> getDefaultView()
           
 String getName()
          Returns the view's name
 KSLightBox getStartPopup()
           
 View getStartPopupView()
           
<V extends Enum<?>>
void
getView(V viewType, Callback<View> callback)
          Returns the view associated with the specified enum value.
 Enum<?> getViewEnum()
           
 Enum<?> getViewEnumValue(String enumValue)
           
 boolean isExportButtonActive()
          This method needs to be implemented only on views that want the export button to display.
 boolean isStartViewShowing()
           
 boolean isValid(List<ValidationResultInfo> validationResults, boolean checkCurrentSectionOnly)
          Check to see if current/all section(s) is valid (ie.
 boolean isValid(List<ValidationResultInfo> validationResults, boolean checkCurrentSectionOnly, boolean allFields)
           
 void setController(Controller controller)
           
<V extends Enum<?>>
void
setDefaultView(V viewType)
          Set the view with the viewType enum passed in to the be the default view.
 void setName(String name)
          Sets the name of this LayoutController.
 void setViewEnum(Enum<?> viewType)
           
 void showDefaultView(Callback<Boolean> onReadyCallback)
          Shows the default view.
 void showExport(boolean show)
           
 void showFirstView(Callback<Boolean> onReadyCallback)
          Show the view that was the first one added and will likely be the first one in a layout's menu, for example.
 void showStartPopup(Callback<Boolean> onReadyCallback)
           
protected  void showWarnings()
          Shows warnings stored to the application context (i.e: dark-yellow highlighting of conflicts during review of a Course Proposal)
abstract  void updateModel()
          Updates the model with information from this view.
 void updateModelFromCurrentView()
          Update a the model from the view that is currently being shown by this controller
 void updateModelFromView(Enum<?> viewType)
          Update the model with a single views information
 
Methods inherited from class org.kuali.student.common.ui.client.mvc.Controller
addApplicationEventHandler, collectHistory, doReportExport, findController, fireApplicationEvent, fireNavigationEvent, getCurrentView, getCurrentViewEnum, getDefaultModelId, getExportDataModel, getExportElementsFromView, getExportTemplateName, getHistoryToken, getParentController, getView, getViewContext, hideView, onHistoryEvent, registerModel, renderView, requestModel, requestModel, requestModel, resetCurrentView, setCurrentViewEnum, setDefaultModelId, setParentController, setViewContext, showView, showView
 
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, 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.kuali.student.common.ui.client.configurable.mvc.layouts.ViewLayoutController
showView
 
Methods inherited from interface org.kuali.student.common.ui.client.mvc.history.HistorySupport
collectHistory, onHistoryEvent
 

Field Detail

viewMap

protected Map<Enum<?>,View> viewMap

viewEnumMap

protected Map<String,Enum<?>> viewEnumMap

defaultView

protected Enum<?> defaultView

name

protected String name

viewType

protected Enum<?> viewType

startPopupView

protected View startPopupView

startViewWindow

protected KSLightBox startViewWindow
Constructor Detail

LayoutController

public LayoutController()
Constructor Sets up event handlers fro section update events and validation request events.

Method Detail

checkForErrors

public ValidationResultInfo.ErrorLevel checkForErrors(List<ValidationResultInfo> list)
Check to see if the list of validation results have an error.

Parameters:
list -
Returns:

findParentLayout

public static LayoutController findParentLayout(com.google.gwt.user.client.ui.Widget w)
Finds the first parent LayoutController of this LayoutController, returns null if this is the top level LayoutController.

Parameters:
w -
Returns:

addStartViewPopup

public void addStartViewPopup(View view)
Description copied from interface: ViewLayoutController
Creates a popup window with the view, that can be shown when needed for additional information needed from the user

Specified by:
addStartViewPopup in interface ViewLayoutController
See Also:
ViewLayoutController.addStartViewPopup(org.kuali.student.common.ui.client.mvc.View)

isStartViewShowing

public boolean isStartViewShowing()
Returns:
true if the start popup is showing

getStartPopupView

public View getStartPopupView()

showStartPopup

public void showStartPopup(Callback<Boolean> onReadyCallback)

getStartPopup

public KSLightBox getStartPopup()

addView

public void addView(View view)
Description copied from interface: ViewLayoutController
Add a view to this LayoutController. A view's "key" is defined by its viewType enumeration.

Specified by:
addView in interface ViewLayoutController
See Also:
ViewLayoutController.addView(org.kuali.student.common.ui.client.mvc.View)

setDefaultView

public <V extends Enum<?>> void setDefaultView(V viewType)
Description copied from interface: ViewLayoutController
Set the view with the viewType enum passed in to the be the default view. What the default view does varies on controller implementation, but will likely be the first view visible.

Specified by:
setDefaultView in interface ViewLayoutController
See Also:
ViewLayoutController.setDefaultView(java.lang.Enum)

getDefaultView

public Enum<?> getDefaultView()

updateModel

public abstract void updateModel()
Description copied from interface: View
Updates the model with information from this view. If this view does not need to update the model leave this method empty.

Specified by:
updateModel in interface View
See Also:
View.updateModel()

updateModelFromView

public void updateModelFromView(Enum<?> viewType)
Update the model with a single views information

Parameters:
viewType -

updateModelFromCurrentView

public void updateModelFromCurrentView()
Update a the model from the view that is currently being shown by this controller


getView

public <V extends Enum<?>> void getView(V viewType,
                                        Callback<View> callback)
Description copied from class: Controller
Returns the view associated with the specified enum value. See showView(V viewType) above for a full description

Specified by:
getView in class Controller

getViewEnumValue

public Enum<?> getViewEnumValue(String enumValue)
Specified by:
getViewEnumValue in class Controller

showDefaultView

public void showDefaultView(Callback<Boolean> onReadyCallback)
Description copied from class: Controller
Shows the default view. Must be implemented by subclass, in order to define the default view.

Specified by:
showDefaultView in class Controller

showFirstView

public void showFirstView(Callback<Boolean> onReadyCallback)
Show the view that was the first one added and will likely be the first one in a layout's menu, for example. Note that this is different than show default view.

Parameters:
onReadyCallback -

isValid

public boolean isValid(List<ValidationResultInfo> validationResults,
                       boolean checkCurrentSectionOnly)
Check to see if current/all section(s) is valid (ie. does not contain any errors) - also displays them in the ui if possible

Parameters:
validationResults - List of validation results for the layouts model.
checkCurrentSectionOnly - true if errors should be checked on current section only, false if all sections should be checked
Returns:
true if the specified sections (all or current) has any validation errors

isValid

public boolean isValid(List<ValidationResultInfo> validationResults,
                       boolean checkCurrentSectionOnly,
                       boolean allFields)
Parameters:
validationResults -
checkCurrentSectionOnly -
allFields -
Returns:
See Also:
isValid(List, boolean)

clearAllWarnings

protected void clearAllWarnings()
This clears all warnings that currently displayed on all fields and sections.


beforeViewChange

public void beforeViewChange(Enum<?> viewChangingTo,
                             Callback<Boolean> okToChange)
This particular implementation of beforeViewChange checks to see if all its view contains a Controller and if it does checks with that controller to see if it is ok to change the view. OkToChange callback will be exec with true if the view is allowed to be changed at this time. This method can be overriden to provide additional functionality to stop a view from being changed when there is some additional processing that needs to occur in the ui before the view changes.

Overrides:
beforeViewChange in class Controller
See Also:
Controller.beforeViewChange(java.lang.Enum, org.kuali.student.common.ui.client.mvc.Callback)

showWarnings

protected void showWarnings()
Shows warnings stored to the application context (i.e: dark-yellow highlighting of conflicts during review of a Course Proposal)


asWidget

public com.google.gwt.user.client.ui.Widget asWidget()
Description copied from interface: View
Get the attachable widget which represents this view

Specified by:
asWidget in interface com.google.gwt.user.client.ui.IsWidget
Specified by:
asWidget in interface View
Overrides:
asWidget in class com.google.gwt.user.client.ui.Widget
See Also:
SectionView

beforeHide

public boolean beforeHide()
Description copied from interface: View
Called by the controller before the view is hidden to allow the view to perform cleanup or request confirmation from the user, etc. Can cancel the action by returning false.

Specified by:
beforeHide in interface View
Returns:
true if the view can be hidden, or false to cancel the action.

beforeShow

public void beforeShow(Callback<Boolean> onReadyCallback)
Default implementation does nothing on before show. Override to do other things before THIS view is shown.

Specified by:
beforeShow in interface View
See Also:
View.beforeShow(org.kuali.student.common.ui.client.mvc.Callback)

getController

public Controller getController()
Description copied from interface: View
Returns the controller associated with the view

Specified by:
getController in interface View
Returns:

getName

public String getName()
Description copied from interface: View
Returns the view's name

Specified by:
getName in interface View
Returns:

getViewEnum

public Enum<?> getViewEnum()
Specified by:
getViewEnum in interface View

setViewEnum

public void setViewEnum(Enum<?> viewType)

setName

public void setName(String name)
Sets the name of this LayoutController. This name is used in the breadcrumb and window's title. Setting the name to the empty string will omit the breadcrumb - this is sometimes desired.

Parameters:
name -

setController

public void setController(Controller controller)

collectBreadcrumbNames

public void collectBreadcrumbNames(List<String> names)
Description copied from interface: BreadcrumbSupport
Adds a human readable name(s) to the list passed in for use in the breadcrumb

Specified by:
collectBreadcrumbNames in interface BreadcrumbSupport

clear

public void clear()
Description copied from interface: View
Can be called to reset a view to a cleared state.

Specified by:
clear in interface View

isExportButtonActive

public boolean isExportButtonActive()
Description copied from interface: View
This method needs to be implemented only on views that want the export button to display. The default implementation is not to display the export button

Specified by:
isExportButtonActive in interface View
Returns:

showExport

public void showExport(boolean show)
Specified by:
showExport in interface View


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