Class RenderPolicy
- java.lang.Object
-
- ej.mwt.render.RenderPolicy
-
- Direct Known Subclasses:
DefaultRenderPolicy
public abstract class RenderPolicy extends java.lang.ObjectA render policy is responsible of rendering the widgets of a desktop on the display.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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceRenderPolicy.RenderListenerListener for render events (when it is requested and when it is actually executed).
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.StringDEBUG_RENDER_ENABLED_CONSTANTBON boolean constantto enable/disable the render debug.protected static java.lang.StringDEBUG_RENDER_MONITOR_CONSTANTBON Class constantto set the render monitor.protected static RenderPolicy.RenderListenerMONITORRenderPolicy.RenderListenerinstance to be used by allRenderPolicyimplementations.
-
Constructor Summary
Constructors Constructor Description RenderPolicy(Desktop desktop)Creates a render policy.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description DesktopgetDesktop()Returns the desktop managed by this render policy.abstract voidrenderDesktop()Renders the desktop on the display.protected voidrenderWidget(ej.microui.display.GraphicsContext g, Widget widget)Performs the increment render of the widget.abstract voidrequestRender(Widget widget, int x, int y, int width, int height)Requests a rendering of the given widget on the display.
-
-
-
Field Detail
-
DEBUG_RENDER_ENABLED_CONSTANT
protected static final java.lang.String DEBUG_RENDER_ENABLED_CONSTANT
BON boolean constantto enable/disable the render debug.If enabled, "ej.mwt.debug.render.monitor" must also be set.
- See Also:
- Constant Field Values
-
DEBUG_RENDER_MONITOR_CONSTANT
protected static final java.lang.String DEBUG_RENDER_MONITOR_CONSTANT
BON Class constantto set the render monitor.Set it to the FQN of an implementation of
RenderPolicy.RenderListenerto monitor rendering.- See Also:
- Constant Field Values
-
MONITOR
@Nullable protected static final RenderPolicy.RenderListener MONITOR
RenderPolicy.RenderListenerinstance to be used by allRenderPolicyimplementations.It is
nulliff "ej.mwt.debug.render.enabled" isfalse.
-
-
Constructor Detail
-
RenderPolicy
public RenderPolicy(Desktop desktop)
Creates a render policy.- Parameters:
desktop- the desktop to render.
-
-
Method Detail
-
getDesktop
public Desktop getDesktop()
Returns the desktop managed by this render policy.- Returns:
- the desktop managed by this render policy.
-
renderDesktop
public abstract void renderDesktop()
Renders the desktop on the display. This method is used by the desktop in order to perform the initial rendering of the complete widget hierarchy.This method should be called in the MicroUI thread as the rendering of the widget is performed synchronously.
-
requestRender
public abstract void requestRender(Widget widget, int x, int y, int width, int height)
Requests a rendering of the given widget on the display. 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.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.
- Parameters:
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.
-
renderWidget
protected void renderWidget(ej.microui.display.GraphicsContext g, Widget widget)Performs the increment render of the widget.- Parameters:
g- the graphics context.widget- the widget to render.
-
-