Package ej.mwt.render

Class RenderPolicy

  • Direct Known Subclasses:
    DefaultRenderPolicy

    public abstract class RenderPolicy
    extends java.lang.Object
    A 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.

    • 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.