Eclipse Rich Ajax Platform

org.eclipse.rwt.lifecycle
Class AbstractWidgetLCA

java.lang.Object
  extended by org.eclipse.rwt.lifecycle.AbstractWidgetLCA
All Implemented Interfaces:
ILifeCycleAdapter, IWidgetLifeCycleAdapter

public abstract class AbstractWidgetLCA
extends java.lang.Object
implements IWidgetLifeCycleAdapter

Abstract implementation of a widget life cycle adapter. All widget LCAs should inherit from this class.

Since:
1.0

Constructor Summary
AbstractWidgetLCA()
           
 
Method Summary
 Rectangle adjustCoordinates(Widget widget, Rectangle bounds)
          Deprecated. Adjustment of the widget bounds is now handled on the client.
 void doRedrawFake(Control control)
           As a side effect to redraw calls some native widgets trigger events like resize for example.
abstract  void preserveValues(Widget widget)
          Preserves the current state of the widget in order to be able to keep track of changes.
 void render(Widget widget)
          Writes JavaScript code to the response that renders the changes that has been made to the widget.
abstract  void renderChanges(Widget widget)
          Writes JavaScript code to the response that applies the state changes of the widget to the client.
abstract  void renderDispose(Widget widget)
          Writes JavaScript code to the response that renders the disposal of the widget.
abstract  void renderInitialization(Widget widget)
          Writes JavaScript code to the response that creates a new widget instance and initializes it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.rwt.lifecycle.IWidgetLifeCycleAdapter
readData
 

Constructor Detail

AbstractWidgetLCA

public AbstractWidgetLCA()
Method Detail

render

public final void render(Widget widget)
                  throws java.io.IOException
Description copied from interface: IWidgetLifeCycleAdapter
Writes JavaScript code to the response that renders the changes that has been made to the widget.

Specified by:
render in interface IWidgetLifeCycleAdapter
Parameters:
widget - the widget to render changes for
Throws:
java.io.IOException

adjustCoordinates

@Deprecated
public Rectangle adjustCoordinates(Widget widget,
                                              Rectangle bounds)
Deprecated. Adjustment of the widget bounds is now handled on the client.

Translates the bounds of a widget that is enclosed in the widget handled by this LCA. The default implementation does not modify the given bounds. Subclasses may override.

Parameters:
widget - the enclosed widget whose bounds to adjust
bounds - the actual bounds of the enclosed widget
Returns:
the adjusted bounds

preserveValues

public abstract void preserveValues(Widget widget)
Description copied from interface: IWidgetLifeCycleAdapter
Preserves the current state of the widget in order to be able to keep track of changes. This method is called after the Read Data phase but before the Process Action phase of the request life cycle. Thus, the client and server state is in sync. By preserving the current state of the widget, it is later possible to identify the properties that have been modified during the processing of the request.

Implementors can use the method IWidgetAdapter.preserve(String, Object). As a rule of thumb, every property that is written in render must be preserved in this method.

Specified by:
preserveValues in interface IWidgetLifeCycleAdapter
Parameters:
widget - the widget, the properties of which are preserved

renderInitialization

public abstract void renderInitialization(Widget widget)
                                   throws java.io.IOException
Writes JavaScript code to the response that creates a new widget instance and initializes it. This method is called only once for every widget, before renderChanges is called for the first time.

Parameters:
widget - the widget to initialize
Throws:
java.io.IOException

renderChanges

public abstract void renderChanges(Widget widget)
                            throws java.io.IOException
Writes JavaScript code to the response that applies the state changes of the widget to the client. Implementations must only render those properties that have been changed during the processing of the current request.

Parameters:
widget - the widget to render changes for
Throws:
java.io.IOException

renderDispose

public abstract void renderDispose(Widget widget)
                            throws java.io.IOException
Writes JavaScript code to the response that renders the disposal of the widget.

Parameters:
widget - the widget to dispose
Throws:
java.io.IOException

doRedrawFake

public void doRedrawFake(Control control)

As a side effect to redraw calls some native widgets trigger events like resize for example. To simulate this behaviour subclasses may override this method. The method takes as parameter type Control, since the redraw methods are only available at the Control subclasses of Widgets.

Note that the redraw fake takes place between the process action and the render phase.

Parameters:
control - the control on which redraw was called.

Eclipse Rich Ajax Platform

Copyright (c) EclipseSource and others 2002, 2012. All rights reserved.