public abstract class WViewWidget extends WWebWidget
In principle, JWt widgets are self-contained and manage both their content,
behavior and layout. From the point of view of a Model-View-Controller (MVC)
design pattern, they implement each of these, except for the view widgets
that work in conjunction with
WAbstractItemModel. As a developer you
can chose to keep Model, View and Controller together or separate them as you
This widget facilitates separation of the View from the Model and Controller in a particular way. The View is rendered as a JWt widget. The use of this widget provides two benefits. The classic MVC benefit is a decoupling between view and model, which may allow easier maintainance of code. In addition, this widget enforces the View to be stateless, as it is only created transiently on the server. Therefore the View does not require session resources. This may increase scalability for Internet-deployments.
Currently, the View cannot enclose
would allow direct manipulation of the model (but we are working to remove
this limitation in the future, and let the Model/Controller handle editing
changes) and the View may only be updated by a complete rerendering of the
The View widget may contain event handling code, but only in one of the following ways:
This widget does not provide styling, and can be styled using inline or external CSS as appropriate.
|Constructor and Description|
Creates a new view widget.
Creates a new view widget.
|Modifier and Type||Method and Description|
Creates a widget that renders the View.
Loads content just before the widget is used.
Refresh the widget.
Renders the widget.
Updates the view.
public WViewWidget(WContainerWidget parent)
public void update()
Typically, the model will want to update the view when the model has changed.
This will trigger a call to
getRenderView() to ask for a new rendering of the view.
public void load()
This method is called after a widget is inserted in the widget hierarchy and fully constructed, but before the widget is rendered. Widgets that get inserted in the widget hierarchy will be rendered. Visible widgets are rendered immediately, and invisible widgets in the back-ground (or not for a plain HTML session). This method is called when the widget is directly or indirectly inserted into the widget tree.
The default implementation simply propagates the load signal to its children. You may want to override this method to delay loading of resource-intensive contents.
During the life-time of a widget, this method may be called multiple times, so you should make sure that you do a deferred initializiation only once.
public void render(java.util.EnumSet<RenderFlag> flags)
This function renders the widget (or an update for the widget), after
this has been scheduled using
public void refresh()
The refresh method is invoked when the locale is changed using
when the user hit the refresh button.
The widget must actualize its contents in response.
protected abstract WWidget getRenderView()
This method must be reimplemented to return a widget that renders the view. The returned widget will be deleted by WViewWidget.