org.kuali.student.lum.program.client
Class ProgramController

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
                      extended by org.kuali.student.common.ui.client.configurable.mvc.layouts.MenuSectionController
                          extended by org.kuali.student.lum.program.client.ProgramController
All Implemented Interfaces:
com.google.gwt.event.shared.HasHandlers, com.google.gwt.user.client.EventListener, ContentNavLayoutController, DocumentLayoutController, ViewLayoutController, BreadcrumbSupport, HistorySupport, View, ReportExport
Direct Known Subclasses:
CoreController, CredentialController, MajorController, VariationController

public abstract class ProgramController
extends MenuSectionController

Author:
Igor

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  AbstractProgramConfigurer configurer
           
protected  com.google.gwt.event.shared.HandlerManager eventBus
           
protected  boolean initialized
           
protected  ProgramStatus lastLoadedStatus
           
private  boolean needToLoadOldModel
           
protected  boolean processBeforeShow
           
protected  DataModel programModel
           
protected  MajorDisciplineRpcServiceAsync programRemoteService
           
protected  boolean reloadMetadata
           
protected  ProgramSideBar sideBar
           
protected  com.google.gwt.user.client.ui.Label statusLabel
           
 
Fields inherited from class org.kuali.student.common.ui.client.configurable.mvc.layouts.MenuSectionController
leftPanel, menu, menuViewMap, rightPanel, topLevelMenuItems, viewMenuItemMap
 
Fields inherited from class org.kuali.student.common.ui.client.configurable.mvc.LayoutController
defaultView, name, startPopupView, startViewWindow, viewEnumMap, viewMap, 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
ProgramController(String name, DataModel programModel, ViewContext viewContext, com.google.gwt.event.shared.HandlerManager eventBus)
          Constructor.
 
Method Summary
protected  void afterMetadataLoaded(Callback<Boolean> onReadyCallback)
          Called when metadata is loaded.
 void beforeShow(Callback<Boolean> onReadyCallback)
          Got invoked by framework before showing the view of the controller.
 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.
protected  void configureView()
           
protected  com.google.gwt.user.client.ui.Widget createCommentPanel()
           
protected  MajorDisciplineRpcServiceAsync createProgramRemoteService()
          Create a ProgramRpcServiceAsync appropriate for this Controller
protected  void doSave()
           
protected  void fireUpdateEvent(Callback<Boolean> okToChange)
           
protected  Data getDataProperty(String key)
           
 ArrayList<ExportElement> getExportElementsFromView()
          This method returns array of ExportElements which represent the elements on the view that must be exported
 DataModel getProgramModel()
           
 String getProgramName()
           
private  String getProgramViewLocation(String pgmType)
           
protected  String getStringProperty(String key)
           
private  void initializeModel()
          Initialized model of the controller.
 boolean isExportButtonActive()
          This method needs to be implemented only on views that want the export button to display.
protected  void loadMetadata(Callback<Boolean> onReadyCallback)
          Loads metadata from the server.
protected  boolean loadMetadataCondition()
          We should only load metadata if the status of model is changed.
protected  void loadModel(ModelRequestCallback<DataModel> callback)
          Loads data model from the server.
 void onModelLoadedEvent()
           
 void refreshModelAndView(DataSaveResult result)
          This method will refresh the model and view with the data sent back from the server.
 void requestModel(Class modelType, ModelRequestCallback callback)
          Called by child views and controllers to request a model reference.
protected  void resetFieldInteractionFlag()
           
protected  void resetModel()
           
protected  void setHeaderTitle()
           
private  void setModelData()
           
protected  void setStatus()
           
 void setViewContext(ViewContext viewContext)
          Sets the view context.
protected  void updateState(String state, Callback<Boolean> okCallback)
          Update the state of the program and all of its statements.
 
Methods inherited from class org.kuali.student.common.ui.client.configurable.mvc.layouts.MenuSectionController
addButtonForView, addCommonButton, addCommonButton, addContentWidget, addInfoWidget, addMenu, addMenuItem, addSpecialMenuItem, addStartMenuItem, addStyleName, addTopButtonForView, hideView, removeMenuNavigation, renderView, revealMenuItems, setContentInfo, setContentTitle, setContentWarning, setSideBarWidget, showExport, showNextViewOnMenu, showPrint, updateModel
 
Methods inherited from class org.kuali.student.common.ui.client.configurable.mvc.LayoutController
addStartViewPopup, addView, asWidget, beforeHide, checkForErrors, clear, clearAllWarnings, collectBreadcrumbNames, findParentLayout, getController, getDefaultView, getName, getStartPopup, getStartPopupView, getView, getViewEnum, getViewEnumValue, isStartViewShowing, isValid, isValid, setController, setDefaultView, setName, setViewEnum, showDefaultView, showFirstView, showStartPopup, showWarnings, updateModelFromCurrentView, updateModelFromView
 
Methods inherited from class org.kuali.student.common.ui.client.mvc.Controller
addApplicationEventHandler, collectHistory, doReportExport, findController, fireApplicationEvent, fireNavigationEvent, getCurrentView, getCurrentViewEnum, getDefaultModelId, getExportDataModel, getExportTemplateName, getHistoryToken, getParentController, getView, getViewContext, onHistoryEvent, registerModel, requestModel, requestModel, resetCurrentView, setCurrentViewEnum, setDefaultModelId, setParentController, 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
addDomHandler, addHandler, 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, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setElement, setElement, setHeight, setPixelSize, setSize, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, 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
addStartViewPopup, addView, setDefaultView, showView
 
Methods inherited from interface org.kuali.student.common.ui.client.mvc.history.HistorySupport
collectHistory, onHistoryEvent
 

Field Detail

programRemoteService

protected MajorDisciplineRpcServiceAsync programRemoteService

initialized

protected boolean initialized

programModel

protected DataModel programModel

configurer

protected AbstractProgramConfigurer configurer

eventBus

protected com.google.gwt.event.shared.HandlerManager eventBus

statusLabel

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

sideBar

protected ProgramSideBar sideBar

needToLoadOldModel

private boolean needToLoadOldModel

lastLoadedStatus

protected ProgramStatus lastLoadedStatus

reloadMetadata

protected boolean reloadMetadata

processBeforeShow

protected boolean processBeforeShow
Constructor Detail

ProgramController

public ProgramController(String name,
                         DataModel programModel,
                         ViewContext viewContext,
                         com.google.gwt.event.shared.HandlerManager eventBus)
Constructor.

Parameters:
programModel -
Method Detail

createProgramRemoteService

protected MajorDisciplineRpcServiceAsync createProgramRemoteService()
Create a ProgramRpcServiceAsync appropriate for this Controller


beforeViewChange

public void beforeViewChange(Enum<?> viewChangingTo,
                             Callback<Boolean> okToChange)
Description copied from class: LayoutController
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 LayoutController
See Also:
Controller.beforeViewChange(java.lang.Enum, org.kuali.student.common.ui.client.mvc.Callback)

fireUpdateEvent

protected void fireUpdateEvent(Callback<Boolean> okToChange)

resetModel

protected void resetModel()

resetFieldInteractionFlag

protected void resetFieldInteractionFlag()

initializeModel

private void initializeModel()
Initialized model of the controller.


requestModel

public void requestModel(Class modelType,
                         ModelRequestCallback callback)
Description copied from class: Controller
Called by child views and controllers to request a model reference. By default it delegates calls to the parent controller if one is found. Override this method to declare a model local to the controller. Always make sure to delegate the call to the superclass if the requested type is not one which is defined locally. For example:

Overrides:
requestModel in class Controller

loadModel

protected void loadModel(ModelRequestCallback<DataModel> callback)
Loads data model from the server.

Parameters:
callback - we have to invoke this callback when model is loaded or failed.

setModelData

private void setModelData()

getProgramViewLocation

private String getProgramViewLocation(String pgmType)

setStatus

protected void setStatus()

getProgramName

public String getProgramName()

beforeShow

public void beforeShow(Callback<Boolean> onReadyCallback)
Got invoked by framework before showing the view of the controller.

Specified by:
beforeShow in interface View
Overrides:
beforeShow in class LayoutController
Parameters:
onReadyCallback -
See Also:
View.beforeShow(org.kuali.student.common.ui.client.mvc.Callback)

loadMetadataCondition

protected boolean loadMetadataCondition()
We should only load metadata if the status of model is changed.

Returns:

loadMetadata

protected void loadMetadata(Callback<Boolean> onReadyCallback)
Loads metadata from the server.

Parameters:
onReadyCallback -

configureView

protected void configureView()

setViewContext

public void setViewContext(ViewContext viewContext)
Description copied from class: Controller
Sets the view context. This is important for determining the permission for seeing views under this controllers scope, what the id and id type of the model the controller handles are defined here. Additional attributes that the controller and it's views need to know about are also defined in the viewContext.

Overrides:
setViewContext in class Controller

afterMetadataLoaded

protected void afterMetadataLoaded(Callback<Boolean> onReadyCallback)
Called when metadata is loaded.

Parameters:
onReadyCallback -

setHeaderTitle

protected void setHeaderTitle()

createCommentPanel

protected com.google.gwt.user.client.ui.Widget createCommentPanel()

doSave

protected void doSave()

updateState

protected void updateState(String state,
                           Callback<Boolean> okCallback)
Update the state of the program and all of its statements.

This is only called when the state change event fires.

There are several types of programs (majorDiscipline, core, credential). The state of each program changes when buttons are pressed. For example, pressing the activate button may change the state of the program from draft to active.

This method is triggered when the state changes. It will pass the new state to the controller servlet, which will then use it to update the state by calling the web services.

Note that state and status are different.

It is placed in ProgramController so core, credential, etc all have access it.

Parameters:
programModel - a map containing data representing the program
state - the state we changed to
callback - will return true if update succeeded

refreshModelAndView

public void refreshModelAndView(DataSaveResult result)
This method will refresh the model and view with the data sent back from the server.


getProgramModel

public DataModel getProgramModel()

onModelLoadedEvent

public void onModelLoadedEvent()

getStringProperty

protected String getStringProperty(String key)

getDataProperty

protected Data getDataProperty(String key)

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
Overrides:
isExportButtonActive in class LayoutController
Returns:

getExportElementsFromView

public ArrayList<ExportElement> getExportElementsFromView()
Description copied from interface: ReportExport
This method returns array of ExportElements which represent the elements on the view that must be exported

Specified by:
getExportElementsFromView in interface ReportExport
Overrides:
getExportElementsFromView in class MenuSectionController
Returns:


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