public abstract class View extends Object implements HasViewResizeHandlers, HasWindowCloseHandlers, HasViewActivateHandlers, HasOrientationChangeHandler, HasViewLoadHandlers
| Modifier and Type | Class and Description |
|---|---|
static interface |
View.RenderCallback |
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
active |
protected FastList<ViewActivateHandler> |
attachHandlers |
protected org.cruxframework.crux.core.client.screen.views.DataBindingHandler |
dataBindingHandler |
protected FastList<ViewDeactivateHandler> |
detachHandlers |
protected String |
height |
protected FastList<com.google.gwt.event.logical.shared.ValueChangeHandler<String>> |
historyHandlers |
protected Map<String> |
lazyWidgets |
protected boolean |
loaded |
protected FastList<ViewLoadHandler> |
loadHandlers |
protected FastList<OrientationChangeHandler> |
orientationHandlers |
protected FastList<com.google.gwt.event.logical.shared.ResizeHandler> |
resizeHandlers |
protected FastList<ViewUnloadHandler> |
unloadHandlers |
protected FastMap<com.google.gwt.user.client.ui.Widget> |
widgets |
protected String |
width |
protected FastList<com.google.gwt.event.logical.shared.CloseHandler<com.google.gwt.user.client.Window>> |
windowCloseHandlers |
protected FastList<com.google.gwt.user.client.Window.ClosingHandler> |
windowClosingHandlers |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addDataObjectBinder(DataObjectBinder<?> dataObjectBinder,
String dataObjectAlias) |
com.google.gwt.event.shared.HandlerRegistration |
addResizeHandler(com.google.gwt.event.logical.shared.ResizeHandler handler) |
protected static void |
addResource(String id,
com.google.gwt.resources.client.ClientBundle resource) |
static void |
addToHistory(String token)
Adds a new token for history control.
|
static void |
addToHistory(String token,
boolean issueEvent)
Adds a new token for history control.
|
com.google.gwt.event.shared.HandlerRegistration |
addViewActivateHandler(ViewActivateHandler handler) |
com.google.gwt.event.shared.HandlerRegistration |
addViewDeactivateHandler(ViewDeactivateHandler handler) |
com.google.gwt.event.shared.HandlerRegistration |
addViewLoadHandler(ViewLoadHandler handler) |
com.google.gwt.event.shared.HandlerRegistration |
addViewUnloadHandler(ViewUnloadHandler handler) |
void |
addWidget(String id,
com.google.gwt.user.client.ui.IsWidget widget)
Add a new widget into this view
|
void |
addWidget(String id,
com.google.gwt.user.client.ui.Widget widget)
Add a new widget into this view
|
com.google.gwt.event.shared.HandlerRegistration |
addWindowCloseHandler(com.google.gwt.event.logical.shared.CloseHandler<com.google.gwt.user.client.Window> handler) |
com.google.gwt.event.shared.HandlerRegistration |
addWindowClosingHandler(com.google.gwt.user.client.Window.ClosingHandler handler) |
com.google.gwt.event.shared.HandlerRegistration |
addWindowHistoryChangedHandler(com.google.gwt.event.logical.shared.ValueChangeHandler<String> handler) |
com.google.gwt.event.shared.HandlerRegistration |
addWindowOrientationChangeHandler(OrientationChangeHandler handler) |
protected void |
checkRuntimeLazyDependency(String id,
String lazyPanelId)
When we have multi-level inner lazy panels, the most inside panel is dependent from the most outside one.
|
protected void |
cleanLazyDependentWidgets(String widgetId) |
protected void |
clearViewObjects()
When view is unloaded, we must free its allocated memory.
|
static boolean |
containsResource(String id)
Returns true if a resource associated with the given identifiers was loaded by application
|
boolean |
containsWidget(String id)
Verify if the view contains an widget associated with the given identifier
|
void |
copyTo(Object dataObject)
Update the given dataObject with the values contained on UI elements of this View.
|
abstract DataSource<?> |
createDataSource(String dataSource)
Create a new DataSource instance
|
protected abstract void |
createWidgets()
Called by View container to create the view widgets
|
protected void |
fireHistoryChangeEvent(com.google.gwt.event.logical.shared.ValueChangeEvent<String> event) |
protected void |
fireLoadEvent(Object paramenter)
Fires the load event
|
protected void |
fireOrientationEvent() |
protected void |
fireResizeEvent(com.google.gwt.event.logical.shared.ResizeEvent event) |
protected boolean |
fireUnloadEvent()
Fires the unload event.
|
protected void |
fireWindowCloseEvent(com.google.gwt.event.logical.shared.CloseEvent<com.google.gwt.user.client.Window> event) |
protected void |
fireWindowClosingEvent(com.google.gwt.user.client.Window.ClosingEvent event) |
ViewContainer |
getContainer()
Retrieve the container that holds this view
|
<T> T |
getController(String controller)
Retrieve the requested controller from this view
|
protected <T> DataObjectBinder<T> |
getDataObjectBinder(Class<T> dataObjectClass) |
protected <T> DataObjectBinder<T> |
getDataObjectBinder(String dataObjectAlias) |
String |
getHeight()
Retrieve the view height;
|
String |
getId()
Retrieve the view identifier
|
abstract IocContainer |
getIocContainer()
Retrieve the IoCContainer instance associated with this view
|
protected String |
getPrefix()
Retrieve the view prefix.
|
abstract RegisteredControllers |
getRegisteredControllers()
Retrieve the list of controllers registered into this view
|
static com.google.gwt.resources.client.ClientBundle |
getResource(String id)
Retrieve the client bundle associated with the given id.
|
String |
getTitle()
Retrieve the view title
|
static <T extends View> |
getView(String id)
Retrieve the view by its identifier
|
abstract com.google.gwt.user.client.ui.HTMLPanel |
getViewPanel()
Retrieve the main panel that contains all the components described into this view.
|
com.google.gwt.user.client.ui.Widget |
getWidget(String id)
Retrieve a widget contained on this view.
|
com.google.gwt.user.client.ui.Widget |
getWidget(String id,
boolean checkLazyDependencies)
Retrieve a widget contained on this screen.
|
<T extends com.google.gwt.user.client.ui.IsWidget> |
getWidget(String id,
Class<T> clazz)
Retrieve a widget contained on this screen, casting it to the given class
|
String |
getWidth()
Retrieve the view width;
|
protected boolean |
hasHistoryHandlers() |
protected boolean |
hasOrientationChangeHandlers() |
protected boolean |
hasResizeHandlers() |
protected boolean |
hasWindowCloseHandlers() |
protected boolean |
hasWindowClosingHandlers() |
protected abstract Map<String> |
initializeLazyDependencies()
Called when the view are loaded to initialize the lazy dependencies map
|
protected boolean |
initializeLazyDependentWidget(String widgetId)
Call the
LazyPanel.ensureWidget() method of the given lazyPanel. |
boolean |
isActive()
Reads the active property.
|
boolean |
isLoaded()
Return true if the view was loaded into a container.
|
static boolean |
isOrientationChangeSupported() |
FastList<com.google.gwt.user.client.ui.Widget> |
listWidgets() |
FastList<String> |
listWidgetsId() |
protected void |
load(Object paramenter)
Called by the
ViewContainer when the view is added to the container. |
static <T extends View> |
of(Object viewAware)
Retrieve the current view associated with a controller, datasource, or other ViewAware object
|
protected void |
prepareViewObjects() |
<T> T |
read(Class<T> dataObjectClass)
Read the dataObject bound to the given class from this View.
|
<T> T |
read(String dataObjectAlias)
Read the dataObject bound to the given alias from this View.
|
protected abstract void |
registerDataObjectBinders()
Called when the view are loaded to initialize the dataObjectBinders
|
protected void |
registerLoadedView()
Register current view into the loaded views list
|
boolean |
removeFromContainer()
Remove the current view from its container, if the view is loaded into a container
|
void |
removeWidget(String id)
Removes the given widget from this view.
|
void |
removeWidget(String id,
boolean removeFromDOM)
Removes the given widget from this view.
|
protected abstract void |
render(com.google.gwt.user.client.ui.Panel rootPanel,
View.RenderCallback renderCallback)
Called by View container to render the view into the screen
|
protected void |
setActive(Object parameter)
Mark this view as active
|
protected void |
setContainer(ViewContainer viewContainer)
Bind the view to a container.
|
protected boolean |
setDeactivated(boolean skipEvent)
Mark this view as active
|
void |
setHeight(String height)
Set the views height;
|
void |
setTitle(String title) |
void |
setWidth(String width)
Set the view width;
|
protected boolean |
unload()
Called by the
ViewContainer when the view is removed from the container. |
protected void |
unregisterLoadedView()
Remove current view from the loaded views list
|
protected abstract void |
updateViewHeight(String height) |
protected abstract void |
updateViewWidth(String width) |
FastList<String> |
widgetsIdList()
Retrieve a list with all widgets identifiers present into this view
|
FastList<com.google.gwt.user.client.ui.Widget> |
widgetsList()
Retrieve a list with all widgets present into this view
|
void |
write(Object dataObject)
Write the given dataObject into this view.
|
void |
writeAll(Object... dataObjects)
Write the given dataObjects into this view.
|
protected FastMap<com.google.gwt.user.client.ui.Widget> widgets
protected FastList<com.google.gwt.event.logical.shared.ResizeHandler> resizeHandlers
protected FastList<com.google.gwt.event.logical.shared.CloseHandler<com.google.gwt.user.client.Window>> windowCloseHandlers
protected FastList<com.google.gwt.user.client.Window.ClosingHandler> windowClosingHandlers
protected FastList<ViewActivateHandler> attachHandlers
protected FastList<ViewDeactivateHandler> detachHandlers
protected FastList<com.google.gwt.event.logical.shared.ValueChangeHandler<String>> historyHandlers
protected FastList<OrientationChangeHandler> orientationHandlers
protected FastList<ViewLoadHandler> loadHandlers
protected FastList<ViewUnloadHandler> unloadHandlers
protected org.cruxframework.crux.core.client.screen.views.DataBindingHandler dataBindingHandler
protected boolean active
protected boolean loaded
protected String width
protected String height
public View(String id)
id - public String getId()
public String getTitle()
public void setTitle(String title)
title - public boolean isLoaded()
public String getWidth()
public void setWidth(String width)
public String getHeight()
public void setHeight(String height)
protected abstract void updateViewHeight(String height)
protected abstract void updateViewWidth(String width)
public abstract DataSource<?> createDataSource(String dataSource)
dataSource - dataSource name, declared with @DataSource annotationpublic void addWidget(String id, com.google.gwt.user.client.ui.Widget widget)
id - widget identifierwidget - the widgetpublic void addWidget(String id, com.google.gwt.user.client.ui.IsWidget widget)
id - widget identifierwidget - the widgetpublic boolean containsWidget(String id)
id - widget identifierpublic static void addToHistory(String token)
token - public static void addToHistory(String token, boolean issueEvent)
token - issueEvent - public com.google.gwt.user.client.ui.Widget getWidget(String id)
lazyWidgets map) and try again.id - widget identifierpublic <T> T getController(String controller)
T - Controller typecontroller - Controller namepublic ViewContainer getContainer()
public com.google.gwt.user.client.ui.Widget getWidget(String id, boolean checkLazyDependencies)
id - widget identifiercheckLazyDependencies - if false, lazy dependencies will not be loadedpublic <T extends com.google.gwt.user.client.ui.IsWidget> T getWidget(String id, Class<T> clazz)
T - id - widget identifierclazz - The class to be used to cast the widgetpublic void removeWidget(String id)
id - widget identifierpublic void removeWidget(String id, boolean removeFromDOM)
id - widget identifierremoveFromDOM - if true, also removes the widget from this parent widgetpublic FastList<com.google.gwt.user.client.ui.Widget> listWidgets()
public boolean isActive()
isActive in interface HasViewActivateHandlerspublic com.google.gwt.event.shared.HandlerRegistration addResizeHandler(com.google.gwt.event.logical.shared.ResizeHandler handler)
addResizeHandler in interface HasViewResizeHandlershandler - public static boolean isOrientationChangeSupported()
public com.google.gwt.event.shared.HandlerRegistration addWindowOrientationChangeHandler(OrientationChangeHandler handler)
addWindowOrientationChangeHandler in interface HasOrientationChangeHandlerpublic com.google.gwt.event.shared.HandlerRegistration addWindowCloseHandler(com.google.gwt.event.logical.shared.CloseHandler<com.google.gwt.user.client.Window> handler)
addWindowCloseHandler in interface HasWindowCloseHandlershandler - public com.google.gwt.event.shared.HandlerRegistration addWindowClosingHandler(com.google.gwt.user.client.Window.ClosingHandler handler)
handler - public com.google.gwt.event.shared.HandlerRegistration addViewActivateHandler(ViewActivateHandler handler)
addViewActivateHandler in interface HasViewActivateHandlerspublic com.google.gwt.event.shared.HandlerRegistration addViewDeactivateHandler(ViewDeactivateHandler handler)
addViewDeactivateHandler in interface HasViewActivateHandlerspublic com.google.gwt.event.shared.HandlerRegistration addViewLoadHandler(ViewLoadHandler handler)
addViewLoadHandler in interface HasViewLoadHandlerspublic com.google.gwt.event.shared.HandlerRegistration addViewUnloadHandler(ViewUnloadHandler handler)
addViewUnloadHandler in interface HasViewLoadHandlerspublic com.google.gwt.event.shared.HandlerRegistration addWindowHistoryChangedHandler(com.google.gwt.event.logical.shared.ValueChangeHandler<String> handler)
handler - public FastList<String> widgetsIdList()
public FastList<com.google.gwt.user.client.ui.Widget> widgetsList()
public boolean removeFromContainer()
protected boolean hasResizeHandlers()
protected boolean hasOrientationChangeHandlers()
protected boolean hasWindowCloseHandlers()
protected boolean hasWindowClosingHandlers()
protected boolean hasHistoryHandlers()
protected void fireResizeEvent(com.google.gwt.event.logical.shared.ResizeEvent event)
event - protected void fireOrientationEvent()
protected void fireWindowCloseEvent(com.google.gwt.event.logical.shared.CloseEvent<com.google.gwt.user.client.Window> event)
event - protected void fireWindowClosingEvent(com.google.gwt.user.client.Window.ClosingEvent event)
event - protected void fireHistoryChangeEvent(com.google.gwt.event.logical.shared.ValueChangeEvent<String> event)
event - protected void fireLoadEvent(Object paramenter)
protected boolean fireUnloadEvent()
protected void setActive(Object parameter)
parameter - to be passed to activate eventprotected boolean setDeactivated(boolean skipEvent)
skipEvent - protected void load(Object paramenter)
ViewContainer when the view is added to the container.
This method creates the view widgetsparameter - parameter sent to view and accessible through ViewLoadEvent eventprotected boolean unload()
ViewContainer when the view is removed from the container.protected void registerLoadedView()
protected void unregisterLoadedView()
protected void prepareViewObjects()
protected void clearViewObjects()
protected void cleanLazyDependentWidgets(String widgetId)
widgetId - protected void checkRuntimeLazyDependency(String id, String lazyPanelId)
id - lazyPanelId - protected boolean initializeLazyDependentWidget(String widgetId)
LazyPanel.ensureWidget() method of the given lazyPanel.
This method can trigger other dependent lazyPanel initialization, through
a recursive call to View.getWidget(String).widgetId - lazyPanel to be loadedpublic abstract RegisteredControllers getRegisteredControllers()
public abstract IocContainer getIocContainer()
protected abstract void render(com.google.gwt.user.client.ui.Panel rootPanel,
View.RenderCallback renderCallback)
rootPanel - The root element where the view elements will be rendered.protected abstract void createWidgets()
throws InterfaceConfigException
InterfaceConfigExceptionprotected abstract Map<String> initializeLazyDependencies()
protected abstract void registerDataObjectBinders()
protected String getPrefix()
protected void setContainer(ViewContainer viewContainer)
ViewContainer add method.viewContainer - public static <T extends View> T getView(String id)
id - view identifierpublic static <T extends View> T of(Object viewAware)
viewAware - public static com.google.gwt.resources.client.ClientBundle getResource(String id)
Resource annotationid - protected static void addResource(String id, com.google.gwt.resources.client.ClientBundle resource)
id - resource - public static boolean containsResource(String id)
id - public void write(Object dataObject)
dataObject - the data object to writepublic void writeAll(Object... dataObjects)
dataObjects - the data objects to writepublic void copyTo(Object dataObject)
dataObject - the object that will be updatedpublic <T> T read(Class<T> dataObjectClass)
dataObjectClass - dataObject classpublic <T> T read(String dataObjectAlias)
dataObjectAlias - dataObject aliaspublic abstract com.google.gwt.user.client.ui.HTMLPanel getViewPanel()
protected void addDataObjectBinder(DataObjectBinder<?> dataObjectBinder, String dataObjectAlias)
protected <T> DataObjectBinder<T> getDataObjectBinder(String dataObjectAlias)
protected <T> DataObjectBinder<T> getDataObjectBinder(Class<T> dataObjectClass)
Copyright © 2015. All rights reserved.