org.cruxframework.crux.core.client.screen.views
Class BindableView<T>

java.lang.Object
  extended by org.cruxframework.crux.core.client.screen.views.View
      extended by org.cruxframework.crux.core.client.screen.views.BindableView<T>
All Implemented Interfaces:
HasOrientationChangeHandler, HasViewActivateHandlers, HasViewLoadHandlers, HasViewResizeHandlers, HasWindowCloseHandlers

public abstract class BindableView<T>
extends View

BindableViews are Views that support data binding to given data objects. You can define a BindableView using the dataObject attribute on view declaration.

 <v:view dataObject="MyDataObject">
 </gwt:textBox id="textBox1" dataBind="property1.innerProperty">
 </v:view>
 

You must annotate your Data Object with DataObject annotation.

 @DataObject("MyDataObject")
 public class MyDTO 
 {
    ...//getters and setters
 }
 

And you can access your BindableView through ViewAccessor.

 public interface Views extends ViewAccessor 
 {
    BindableView myViewId();
 }
 

Author:
Thiago da Rosa de Bustamante

Nested Class Summary
static interface BindableView.PropertyBinder<T>
          Interface for data binding between dataObjects and widgets in this view.
 
Nested classes/interfaces inherited from class org.cruxframework.crux.core.client.screen.views.View
View.RenderCallback
 
Field Summary
protected  FastMap<BindableView.PropertyBinder<T>> binders
           
 
Fields inherited from class org.cruxframework.crux.core.client.screen.views.View
active, attachHandlers, detachHandlers, height, historyHandlers, lazyWidgets, loaded, loadHandlers, orientationHandlers, resizeHandlers, unloadHandlers, widgets, width, windowCloseHandlers, windowClosingHandlers
 
Constructor Summary
BindableView(String id)
           
 
Method Summary
 void addWidget(String id, com.google.gwt.user.client.ui.IsWidget widget, BindableView.PropertyBinder<T> binder)
          Add a widget to this view and use the given binder to bound it with target dataObjet
protected abstract  T createDataObject()
          Used by Crux to instantiate target data object
 T getData()
          Retrieve a DataObject instance, filled with data received from the widgets on this view.
 void removeWidget(String id, boolean removeFromDOM)
          Removes the given widget from this view.
 void setData(T dataObject)
          Update bound widgets on this view with dataObject information
 
Methods inherited from class org.cruxframework.crux.core.client.screen.views.View
addResizeHandler, addResource, addToHistory, addToHistory, addViewActivateHandler, addViewDeactivateHandler, addViewLoadHandler, addViewUnloadHandler, addWidget, addWidget, addWindowCloseHandler, addWindowClosingHandler, addWindowHistoryChangedHandler, addWindowOrientationChangeHandler, checkRuntimeLazyDependency, cleanLazyDependentWidgets, clearViewObjects, containsResource, containsWidget, createDataSource, createWidgets, fireHistoryChangeEvent, fireLoadEvent, fireOrientationEvent, fireResizeEvent, fireUnloadEvent, fireWindowCloseEvent, fireWindowClosingEvent, getContainer, getController, getHeight, getId, getIocContainer, getPrefix, getRegisteredControllers, getResource, getTitle, getView, getWidget, getWidget, getWidget, getWidth, hasHistoryHandlers, hasOrientationChangeHandlers, hasResizeHandlers, hasWindowCloseHandlers, hasWindowClosingHandlers, initializeLazyDependencies, initializeLazyDependentWidget, isActive, isLoaded, isOrientationChangeSupported, listWidgets, listWidgetsId, load, of, prepareViewObjects, registerLoadedView, removeFromContainer, removeWidget, render, setActive, setContainer, setDeactivated, setHeight, setTitle, setWidth, unload, unregisterLoadedView, updateViewHeight, updateViewWidth, widgetsIdList, widgetsList
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

binders

protected FastMap<BindableView.PropertyBinder<T>> binders
Constructor Detail

BindableView

public BindableView(String id)
Parameters:
id -
Method Detail

createDataObject

protected abstract T createDataObject()
Used by Crux to instantiate target data object

Returns:

getData

public T getData()
Retrieve a DataObject instance, filled with data received from the widgets on this view.

Returns:

setData

public void setData(T dataObject)
Update bound widgets on this view with dataObject information

Parameters:
dataObject -

addWidget

public void addWidget(String id,
                      com.google.gwt.user.client.ui.IsWidget widget,
                      BindableView.PropertyBinder<T> binder)
Add a widget to this view and use the given binder to bound it with target dataObjet

Parameters:
id -
widget -
binder -

removeWidget

public void removeWidget(String id,
                         boolean removeFromDOM)
Description copied from class: View
Removes the given widget from this view.

Overrides:
removeWidget in class View
Parameters:
id - widget identifier
removeFromDOM - if true, also removes the widget from this parent widget


Copyright © 2014. All rights reserved.