org.kuali.student.lum.lu.ui.course.client.controllers
Class CourseProposalController

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.common.ui.client.configurable.mvc.layouts.MenuEditableSectionController
                              extended by org.kuali.student.lum.lu.ui.course.client.controllers.CourseProposalController
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, ContentNavLayoutController, DocumentLayoutController, ViewLayoutController, BreadcrumbSupport, HistorySupport, View, ReportExport, RequiresAuthorization, WorkflowEnhancedNavController, HasRequirements
Direct Known Subclasses:
CourseAdminController

public class CourseProposalController
extends MenuEditableSectionController
implements RequiresAuthorization, WorkflowEnhancedNavController, HasRequirements

Controller for course proposal screens. This controller controls all functions of the course proposal process and contains the data model and is responsible for retrieving its data and metadata from the server. In addition, this controller is responsible for course proposal save events and updating its ui accordingly.

Author:
Kuali Student Team

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  CourseProposalConfigurer cfg
           
protected  DataModel cluProposalModel
           
protected  CreditCourseProposalRpcServiceAsync cluProposalRpcServiceAsync
           
protected  DataModel comparisonModel
           
protected  CourseRpcServiceAsync courseServiceAsync
           
protected  String currentDocType
           
protected  String currentTitle
           
private  DateFormat df
           
private  boolean initialized
           
private  BlockingTask initializingTask
           
protected  boolean isNew
           
protected  BlockingTask loadDataTask
           
private  WorkQueue modelRequestQueue
           
private static String MSG_GROUP
           
protected  String proposalPath
           
protected  CourseRequirementsDataModel reqDataModel
           
protected  CourseRequirementsDataModel reqDataModelComp
           
private  BlockingTask saving
           
private static String UPDATED_KEY
           
private static String VERSION_KEY
           
protected  WorkflowUtilities workflowUtil
           
 
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
CourseProposalController()
           
 
Method Summary
 void addPermissionAttributes(Map<String,String> attributes)
          This method adds any permission attributes required for checking permissions
 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.
 void checkAuthorization(AuthorizationCallback authCallback)
           
protected  void configureScreens(DataModelDefinition modelDefinition, Callback<Boolean> onReadyCallback)
           
private  void createCopyCourseModel(String originalCluId, ModelRequestCallback callback, Callback<Boolean> workCompleteCallback)
           
private  void createCopyCourseProposalModel(String originalProposalId, ModelRequestCallback callback, Callback<Boolean> workCompleteCallback)
           
private  void createModifyCluProposalModel(String versionComment, ModelRequestCallback callback, Callback<Boolean> workCompleteCallback)
           
protected  void createNewCluProposalModel(ModelRequestCallback callback, Callback<Boolean> workCompleteCallback)
           
 void doSaveAction(SaveActionEvent saveActionEvent)
           
 KSButton getCancelButton(Enum<?> summaryView)
           
protected  void getCluProposalFromProposalId(String id, ModelRequestCallback callback, Callback<Boolean> workCompleteCallback)
           
private  void getCluProposalFromWorkflowId(ModelRequestCallback callback, Callback<Boolean> workCompleteCallback)
           
protected  void getCourseComparisonModelAndReqs(ModelRequestCallback proposalModelRequestCallback, Callback<Boolean> workCompleteCallback)
           
 String getCourseId()
           
 CourseProposalConfigurer getCourseProposalConfigurer()
           
protected  BaseDataOrchestrationRpcServiceAsync getCourseProposalRpcService()
          This method exists to allow the save/get implementations defined in this CourseProposalController in this controller to be reused in the CourseAdminWithoutVersion controller.
 String getCourseState()
           
protected  void getCurrentModel(ModelRequestCallback<DataModel> callback, Callback<Boolean> workCompleteCallback)
           
 DataModel getExportDataModel()
          This method needs to be implemented on every controller that want's to export the data
 List<ExportElement> getExportElementsFromView()
          This method returns array of ExportElements which represent the elements on the view that must be exported
 String getExportTemplateName()
          This overridden method only needs to be implemented if the Generic Export reports has to be overwritten for a particular COntroller.
 String getMessage(String courseMessageKey)
           
 void getMetadataForFinalState(KSAsyncCallback<Metadata> callback)
           
private  String getProposalTitle()
           
 CourseRequirementsDataModel getReqDataModel()
           
 CourseRequirementsDataModel getReqDataModelComp()
           
 KSButton getSaveButton()
           
protected  String getStateforSaveAction(DataModel model)
          This method is used to determine which state the dto will be when making the save call.
 WorkflowUtilities getWfUtilities()
           
private  boolean hasTitles(String proposalTitle, String courseTitle)
           
protected  void initializeController()
           
private  void intializeView(Callback<Boolean> onReadyCallback)
           
 boolean isAuthorizationRequired()
           
 boolean isExportButtonActive()
          This method needs to be implemented only on views that want the export button to display.
 boolean isNew()
           
 void onHistoryEvent(String historyStack)
          The onHistoryEvent implementation in controller reads the history stack it receives and determines if the next token/view to be processed is a controller, if it is, it hands off the rest of the history stack to that controller after showing it.
private  void populateModel(ModelRequestCallback<DataModel> callback, Callback<Boolean> workCompleteCallback)
          Used to populate the proposal model based on the view context.
protected  void progressiveEnableFields()
          This progressively enables/disables screen fields based on other fields present in the screens.
protected  void registerModelsAndHandlers()
           
 void requestModel(Class modelType, ModelRequestCallback callback)
          Called by child views and controllers to request a model reference.
 void saveProposalClu(SaveActionEvent saveActionEvent)
           
 void setAuthorizationRequired(boolean required)
           
protected  void setHeaderTitle()
           
 void setLastUpdated()
           
 void setParentController(Controller controller)
          Sets the controller's parent controller.
 void setViewContext(ViewContext viewContext)
          Sets the view context.
 void showDefaultView(Callback<Boolean> onReadyCallback)
          Shows the default view.
<V extends Enum<?>>
void
showView(V viewType, Callback<Boolean> onReadyCallback)
          Directs the controller to display the specified view.
 boolean startSectionRequired()
           
 
Methods inherited from class org.kuali.student.common.ui.client.configurable.mvc.layouts.MenuEditableSectionController
addCommonEditButton, addMenuItem, attachEditLink, generateEditLink, setEditable, setEditMode
 
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, 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, getHistoryToken, getParentController, getView, getViewContext, registerModel, requestModel, requestModel, resetCurrentView, setCurrentViewEnum, setDefaultModelId, 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, 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.ContentNavLayoutController
addButtonForView, addCommonButton, addCommonButton, addMenu, addMenuItem, addSpecialMenuItem, removeMenuNavigation
 
Methods inherited from interface org.kuali.student.common.ui.client.configurable.mvc.layouts.DocumentLayoutController
addContentWidget, setContentInfo, setContentTitle
 
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
 

Field Detail

cluProposalRpcServiceAsync

protected CreditCourseProposalRpcServiceAsync cluProposalRpcServiceAsync

courseServiceAsync

protected CourseRpcServiceAsync courseServiceAsync

cluProposalModel

protected final DataModel cluProposalModel

comparisonModel

protected final DataModel comparisonModel

cfg

protected CourseProposalConfigurer cfg

modelRequestQueue

private WorkQueue modelRequestQueue

workflowUtil

protected WorkflowUtilities workflowUtil

initialized

private boolean initialized

isNew

protected boolean isNew

UPDATED_KEY

private static final String UPDATED_KEY
See Also:
Constant Field Values

VERSION_KEY

private static final String VERSION_KEY
See Also:
Constant Field Values

MSG_GROUP

private static final String MSG_GROUP
See Also:
Constant Field Values

currentDocType

protected String currentDocType

proposalPath

protected String proposalPath

currentTitle

protected String currentTitle

df

private final DateFormat df

initializingTask

private final BlockingTask initializingTask

loadDataTask

protected final BlockingTask loadDataTask

saving

private final BlockingTask saving

reqDataModel

protected CourseRequirementsDataModel reqDataModel

reqDataModelComp

protected CourseRequirementsDataModel reqDataModelComp
Constructor Detail

CourseProposalController

public CourseProposalController()
Method Detail

initializeController

protected void initializeController()

registerModelsAndHandlers

protected void registerModelsAndHandlers()

populateModel

private void populateModel(ModelRequestCallback<DataModel> callback,
                           Callback<Boolean> workCompleteCallback)
Used to populate the proposal model based on the view context.

Parameters:
callback -
workCompleteCallback -

getCurrentModel

protected void getCurrentModel(ModelRequestCallback<DataModel> callback,
                               Callback<Boolean> workCompleteCallback)

intializeView

private void intializeView(Callback<Boolean> onReadyCallback)

getMetadataForFinalState

public void getMetadataForFinalState(KSAsyncCallback<Metadata> callback)
Specified by:
getMetadataForFinalState in interface WorkflowEnhancedNavController

configureScreens

protected void configureScreens(DataModelDefinition modelDefinition,
                                Callback<Boolean> onReadyCallback)

progressiveEnableFields

protected void progressiveEnableFields()
This progressively enables/disables screen fields based on other fields present in the screens. NOTE: This metod must be caled after cfg.configure() is called, otherwise path to field mappings won't exist in ApplicationContext


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

getCluProposalFromWorkflowId

private void getCluProposalFromWorkflowId(ModelRequestCallback callback,
                                          Callback<Boolean> workCompleteCallback)

getCluProposalFromProposalId

protected void getCluProposalFromProposalId(String id,
                                            ModelRequestCallback callback,
                                            Callback<Boolean> workCompleteCallback)

getCourseComparisonModelAndReqs

protected void getCourseComparisonModelAndReqs(ModelRequestCallback proposalModelRequestCallback,
                                               Callback<Boolean> workCompleteCallback)

createNewCluProposalModel

protected void createNewCluProposalModel(ModelRequestCallback callback,
                                         Callback<Boolean> workCompleteCallback)

createModifyCluProposalModel

private void createModifyCluProposalModel(String versionComment,
                                          ModelRequestCallback callback,
                                          Callback<Boolean> workCompleteCallback)

createCopyCourseModel

private void createCopyCourseModel(String originalCluId,
                                   ModelRequestCallback callback,
                                   Callback<Boolean> workCompleteCallback)

createCopyCourseProposalModel

private void createCopyCourseProposalModel(String originalProposalId,
                                           ModelRequestCallback callback,
                                           Callback<Boolean> workCompleteCallback)

doSaveAction

public void doSaveAction(SaveActionEvent saveActionEvent)

startSectionRequired

public boolean startSectionRequired()

hasTitles

private boolean hasTitles(String proposalTitle,
                          String courseTitle)

saveProposalClu

public void saveProposalClu(SaveActionEvent saveActionEvent)

setLastUpdated

public void setLastUpdated()

beforeShow

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

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

showView

public <V extends Enum<?>> void showView(V viewType,
                                         Callback<Boolean> onReadyCallback)
Description copied from class: Controller
Directs the controller to display the specified view. The parameter must be an enum value, based on an enum defined in the controller implementation. For example, a "Search" controller might have an enumeration of: public enum SearchViews { SIMPLE_SEARCH, ADVANCED_SEARCH, SEARCH_RESULTS } The implementing class must define a getView(V viewType) method that will cast the generic enum to the view specific enum.

Overrides:
showView in class MenuEditableSectionController
Type Parameters:
V - view enum type
Parameters:
viewType - enum value representing the view to show
onReadyCallback - the callback to invoke when the method has completed execution

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.

Overrides:
showDefaultView in class LayoutController

setParentController

public void setParentController(Controller controller)
Description copied from class: Controller
Sets the controller's parent controller. In most cases, this can be omitted as the controller will be automatically detected via the DOM in cases where it is not specified. The only time that the controller needs to be manually set is in cases where the logical controller hierarchy differs from the physical DOM hierarchy. For example, if a nested controller is rendered in a PopupPanel, then the parent controller must be set manually using this method

Overrides:
setParentController in class Controller
Parameters:
controller - the parent controller

checkAuthorization

public void checkAuthorization(AuthorizationCallback authCallback)
Specified by:
checkAuthorization in interface RequiresAuthorization

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

addPermissionAttributes

public void addPermissionAttributes(Map<String,String> attributes)
This method adds any permission attributes required for checking permissions


isAuthorizationRequired

public boolean isAuthorizationRequired()
Specified by:
isAuthorizationRequired in interface RequiresAuthorization

setAuthorizationRequired

public void setAuthorizationRequired(boolean required)
Specified by:
setAuthorizationRequired in interface RequiresAuthorization

setHeaderTitle

protected void setHeaderTitle()

getWfUtilities

public WorkflowUtilities getWfUtilities()
Specified by:
getWfUtilities in interface WorkflowEnhancedNavController

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)

getSaveButton

public KSButton getSaveButton()

getCancelButton

public KSButton getCancelButton(Enum<?> summaryView)

onHistoryEvent

public void onHistoryEvent(String historyStack)
Description copied from class: Controller
The onHistoryEvent implementation in controller reads the history stack it receives and determines if the next token/view to be processed is a controller, if it is, it hands off the rest of the history stack to that controller after showing it. Otherwise, it shows the view and allows that view to perform any onHistoryEvent actions it may need to take.

For example the historyStack /HOME/CURRICULUM_HOME/COURSE_PROPOSAL would start at the root controller, and hand it off to the home controller, then the curriculum home controller, then the course proposal controller and stop there. Along the way each of those controller would show themselves visually in the UI, if they contain any layout (some do not).

Specified by:
onHistoryEvent in interface HistorySupport
Overrides:
onHistoryEvent in class Controller
See Also:
HistorySupport.onHistoryEvent(java.lang.String)

getProposalTitle

private String getProposalTitle()

getCourseId

public String getCourseId()

getCourseState

public String getCourseState()

isNew

public boolean isNew()

getReqDataModel

public CourseRequirementsDataModel getReqDataModel()
Specified by:
getReqDataModel in interface HasRequirements

getReqDataModelComp

public CourseRequirementsDataModel getReqDataModelComp()

getExportDataModel

public DataModel getExportDataModel()
Description copied from interface: ReportExport
This method needs to be implemented on every controller that want's to export the data

Specified by:
getExportDataModel in interface ReportExport
Overrides:
getExportDataModel in class Controller
Returns:

getExportTemplateName

public String getExportTemplateName()
Description copied from interface: ReportExport
This overridden method only needs to be implemented if the Generic Export reports has to be overwritten for a particular COntroller.

Specified by:
getExportTemplateName in interface ReportExport
Overrides:
getExportTemplateName in class Controller
See Also:
ReportExport.getExportTemplateName()

getExportElementsFromView

public List<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:

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:

getStateforSaveAction

protected String getStateforSaveAction(DataModel model)
This method is used to determine which state the dto will be when making the save call. The information is used by the metadata service (along with workflow node) to determine the appropriate required indicators for field elements.


getMessage

public String getMessage(String courseMessageKey)

getCourseProposalRpcService

protected BaseDataOrchestrationRpcServiceAsync getCourseProposalRpcService()
This method exists to allow the save/get implementations defined in this CourseProposalController in this controller to be reused in the CourseAdminWithoutVersion controller. This is in an attempt prevent duplication of a large chunk of code in the CourseAdminWithoutVersion controller. Rather than have a save wrapped with proposal information, the CourseAdminWithoutVersion will override this method and return the standard course rpc service which does not use filters for proposal data.

Returns:
the course rpc service to use

getCourseProposalConfigurer

public CourseProposalConfigurer getCourseProposalConfigurer()


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