public abstract class RenderPolicy extends Object
A render policy is associated to a single desktop.
A render policy provides a method to render the desktop on the display. This method is used by the desktop in order to perform the initial rendering of the complete widget hierarchy.
A render policy also provides a method to handle render requests targeting specific widgets of the desktop. The goal of this method is to render only a part of the widget hierarchy considering that an old representation of the desktop is already visible on the display. The most naive implementation would be to render the whole hierarchy of the desktop.
Modifier and Type | Class and Description |
---|---|
static interface |
RenderPolicy.RenderListener
Listener for render events (when it is requested and when it is actually executed).
|
Modifier and Type | Field and Description |
---|---|
protected static String |
DEBUG_RENDER_ENABLED_CONSTANT
BON boolean constant to enable/disable the render debug. |
protected static String |
DEBUG_RENDER_MONITOR_CONSTANT
BON Class constant to set the render monitor. |
protected static RenderPolicy.RenderListener |
MONITOR
RenderPolicy.RenderListener instance to be used by all RenderPolicy implementations. |
Modifier | Constructor and Description |
---|---|
protected |
RenderPolicy(Desktop desktop)
Creates a render policy.
|
Modifier and Type | Method and Description |
---|---|
Desktop |
getDesktop()
Returns the desktop managed by this render policy.
|
abstract void |
renderDesktop()
Renders the desktop on the display.
|
protected void |
renderWidget(GraphicsContext g,
Widget widget)
Performs the increment render of the widget.
|
abstract void |
requestRender(Widget widget,
int x,
int y,
int width,
int height)
Requests a rendering of the given widget on the display.
|
protected static final String DEBUG_RENDER_ENABLED_CONSTANT
BON boolean constant
to enable/disable the render debug.
If enabled, "ej.mwt.debug.render.monitor" must also be set.
protected static final String DEBUG_RENDER_MONITOR_CONSTANT
BON Class constant
to set the render monitor.
Set it to the FQN of an implementation of RenderPolicy.RenderListener
to monitor rendering.
@Nullable protected static final RenderPolicy.RenderListener MONITOR
RenderPolicy.RenderListener
instance to be used by all RenderPolicy
implementations.
It is null
if "ej.mwt.debug.render.enabled" is false
.
protected RenderPolicy(Desktop desktop)
desktop
- the desktop to render.public Desktop getDesktop()
public abstract void renderDesktop()
This method should be called in the MicroUI thread as the rendering of the widget is performed synchronously.
protected void renderWidget(GraphicsContext g, Widget widget)
g
- the graphics context.widget
- the widget to render.public abstract void requestRender(Widget widget, int x, int y, int width, int height)
This method returns immediately and the rendering of the widget is performed asynchronously in the MicroUI thread.
The given bounds are relative to the widget.
widget
- the widget to render.x
- the x coordinate of the area to render.y
- the y coordinate of the area to render.width
- the width of the area to render.height
- the height of the area to render.