public abstract class Controller extends com.google.gwt.user.client.ui.Composite implements HistorySupport, BreadcrumbSupport, ReportExport
Modifier and Type | Field and Description |
---|---|
protected ViewContext |
context |
static Callback<Boolean> |
NO_OP_CALLBACK |
protected Controller |
parentController |
exportTemplateName
Modifier | Constructor and Description |
---|---|
protected |
Controller() |
Modifier and Type | Method and Description |
---|---|
com.google.gwt.event.shared.HandlerRegistration |
addApplicationEventHandler(com.google.gwt.event.shared.GwtEvent.Type type,
ApplicationEventHandler handler)
Registers an application eventhandler.
|
void |
beforeViewChange(Enum<?> viewChangingTo,
Callback<Boolean> okToChangeCallback)
If a controller which extends this class must perform some action or check before a view
is changed, then override this method.
|
String |
collectHistory(String historyStack)
This particular implementation appends to the history stack the name of the current view shown by
this controller and view context (in string format) to that historyStack and passes the stack to
be processed to the currentView.
|
void |
doReportExport(List<ExportElement> exportElements,
String format,
String reportTitle)
This method implement the "Generic Export" of a windows content to Jasper based on the format the user selected.
|
static Controller |
findController(com.google.gwt.user.client.ui.Widget w)
Attempts to find the parent controller of a given widget via the DOM
|
void |
fireApplicationEvent(ApplicationEvent event)
Fires an application event.
|
protected void |
fireNavigationEvent() |
View |
getCurrentView()
Returns the currently displayed view
|
Enum<?> |
getCurrentViewEnum() |
String |
getDefaultModelId() |
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.
|
protected String |
getHistoryToken() |
Controller |
getParentController()
Returns the parent controller.
|
protected abstract <V extends Enum<?>> |
getView(V viewType,
Callback<View> callback)
Returns the view associated with the specified enum value.
|
protected <V extends Enum<?>> |
getView(V viewType,
Callback<View> callback,
Map<String,String> tokenMap)
Returns the view associated with the specified enum value.
|
ViewContext |
getViewContext() |
abstract Enum<?> |
getViewEnumValue(String enumValue) |
protected abstract void |
hideView(View view)
Must be implemented by the subclass to hide the view.
|
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.
|
<T extends Model> |
registerModel(String modelId,
ModelProvider<T> provider) |
protected abstract void |
renderView(View view)
Must be implemented by the subclass to render the view.
|
void |
requestModel(Class modelType,
ModelRequestCallback callback)
Called by child views and controllers to request a model reference.
|
void |
requestModel(ModelRequestCallback callback) |
void |
requestModel(String modelId,
ModelRequestCallback callback) |
void |
resetCurrentView() |
void |
setCurrentViewEnum(Enum<?> currentViewEnum) |
void |
setDefaultModelId(String defaultModelId) |
void |
setParentController(Controller controller)
Sets the controller's parent controller.
|
void |
setViewContext(ViewContext viewContext)
Sets the view context.
|
abstract void |
showDefaultView(Callback<Boolean> onReadyCallback)
Shows the default view.
|
<V extends Enum<?>> |
showView(V viewType)
Simple Version of showView, no callback
|
<V extends Enum<?>> |
showView(V viewType,
Callback<Boolean> onReadyCallback)
Directs the controller to display the specified view.
|
getWidget, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, setWidget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
collectBreadcrumbNames
public static final Callback<Boolean> NO_OP_CALLBACK
protected Controller parentController
protected ViewContext context
protected Controller()
public <V extends Enum<?>> void showView(V viewType)
V
- view enum typeviewType
- enum value representing the view to showpublic <V extends Enum<?>> void showView(V viewType, Callback<Boolean> onReadyCallback)
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.V
- view enum typeviewType
- enum value representing the view to showonReadyCallback
- the callback to invoke when the method has completed executionprotected void fireNavigationEvent()
public View getCurrentView()
public Enum<?> getCurrentViewEnum()
public void setCurrentViewEnum(Enum<?> currentViewEnum)
public void setParentController(Controller controller)
controller
- the parent controllerpublic Controller getParentController()
public static Controller findController(com.google.gwt.user.client.ui.Widget w)
w
- the widget for which to find the parent controllerpublic void requestModel(Class modelType, ModelRequestCallback callback)
modelType
- callback
- public void requestModel(String modelId, ModelRequestCallback callback)
public void requestModel(ModelRequestCallback callback)
public <T extends Model> void registerModel(String modelId, ModelProvider<T> provider)
public String getDefaultModelId()
public void setDefaultModelId(String defaultModelId)
public com.google.gwt.event.shared.HandlerRegistration addApplicationEventHandler(com.google.gwt.event.shared.GwtEvent.Type type, ApplicationEventHandler handler)
type
- handler
- public void fireApplicationEvent(ApplicationEvent event)
event
- protected abstract void renderView(View view)
view
- protected abstract void hideView(View view)
view
- protected <V extends Enum<?>> void getView(V viewType, Callback<View> callback, Map<String,String> tokenMap)
V
- viewType
- callback
- tokenMap
- optionally passed in token map if you need tokens from the history managerprotected abstract <V extends Enum<?>> void getView(V viewType, Callback<View> callback)
V
- viewType
- public void beforeViewChange(Enum<?> viewChangingTo, Callback<Boolean> okToChangeCallback)
okToChangeCallback
- public abstract void showDefaultView(Callback<Boolean> onReadyCallback)
public abstract Enum<?> getViewEnumValue(String enumValue)
public String collectHistory(String historyStack)
collectHistory
in interface HistorySupport
HistorySupport.collectHistory(java.lang.String)
protected String getHistoryToken()
public void onHistoryEvent(String historyStack)
onHistoryEvent
in interface HistorySupport
HistorySupport.onHistoryEvent(java.lang.String)
public void setViewContext(ViewContext viewContext)
viewContext
- public ViewContext getViewContext()
public void resetCurrentView()
public void doReportExport(List<ExportElement> exportElements, String format, String reportTitle)
doReportExport
in interface ReportExport
ReportExport.doReportExport(java.util.List, String format, String reportTitle)
public DataModel getExportDataModel()
ReportExport
getExportDataModel
in interface ReportExport
public String getExportTemplateName()
ReportExport
getExportTemplateName
in interface ReportExport
ReportExport.getExportTemplateName()
public List<ExportElement> getExportElementsFromView()
ReportExport
getExportElementsFromView
in interface ReportExport
Copyright © 2004-2013 The Kuali Foundation. All Rights Reserved.