Class AbstractRenderer

  • Direct Known Subclasses:
    CSSShelfRenderer, PaletteShelfRenderer, RedmondShelfRenderer

    public abstract class AbstractRenderer
    extends java.lang.Object

    NOTE: THIS WIDGET AND ITS API ARE STILL UNDER DEVELOPMENT. THIS IS A PRE-RELEASE ALPHA VERSION. USERS SHOULD EXPECT API CHANGES IN FUTURE VERSIONS.

    Renders a single visual unit.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private org.eclipse.swt.graphics.Rectangle bounds
      The bounds the renderer paints on.
      private boolean disposed  
      private boolean expanded
      Expansion state.
      private boolean focus
      Renderer has focus.
      private boolean hover
      Hover state.
      private boolean mouseDown
      Mouse down on the renderer area.
      private boolean selected
      Selection state.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract org.eclipse.swt.graphics.Point computeSize​(org.eclipse.swt.graphics.GC gc, int wHint, int hHint, java.lang.Object value)
      Returns the size of the given value's visual representation.
      void dispose()
      Disposes of any resources managed by this renderer.
      org.eclipse.swt.graphics.Rectangle getBounds()
      Returns the bounds.
      org.eclipse.swt.graphics.Point getSize()
      Returns the size.
      abstract void initialize​(org.eclipse.swt.widgets.Control parent)
      Performs any initialization logic (such as creating new colors or fonts).
      boolean isDisposed()  
      boolean isExpanded()
      Returns the expansion state.
      boolean isFocus()
      Returns a boolean value indicating if this renderer has focus.
      boolean isHover()
      Returns the hover state.
      boolean isMouseDown()
      Returns the boolean value indicating if the renderer has the mouseDown state.
      boolean isSelected()
      Returns the boolean state indicating if the selected state is set.
      abstract void paint​(org.eclipse.swt.graphics.GC gc, java.lang.Object value)
      Paints the visual representation of the given value on the given GC.
      void setBounds​(int x, int y, int width, int height)
      Sets the bounds of the drawing.
      void setBounds​(org.eclipse.swt.graphics.Rectangle bounds)
      Sets the bounds of the drawing.
      protected void setDisposed​(boolean disposed)  
      void setExpanded​(boolean expanded)
      Sets the expansion state of this renderer.
      void setFocus​(boolean focus)
      Sets focus state.
      void setHover​(boolean hover)
      Sets the hover state.
      void setLocation​(int x, int y)
      Sets the location of the drawing.
      void setLocation​(org.eclipse.swt.graphics.Point location)
      Sets the location of the drawing.
      void setMouseDown​(boolean mouseDown)
      Sets the mouse down state.
      void setSelected​(boolean selected)
      Sets the selected state.
      void setSize​(int width, int height)
      Sets the area of the drawing.
      void setSize​(org.eclipse.swt.graphics.Point size)
      Sets the area of the drawing.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • hover

        private boolean hover
        Hover state.
      • focus

        private boolean focus
        Renderer has focus.
      • mouseDown

        private boolean mouseDown
        Mouse down on the renderer area.
      • selected

        private boolean selected
        Selection state.
      • expanded

        private boolean expanded
        Expansion state.
      • bounds

        private org.eclipse.swt.graphics.Rectangle bounds
        The bounds the renderer paints on.
      • disposed

        private boolean disposed
    • Constructor Detail

      • AbstractRenderer

        public AbstractRenderer()
    • Method Detail

      • getBounds

        public org.eclipse.swt.graphics.Rectangle getBounds()
        Returns the bounds.
        Returns:
        Rectangle describing the bounds.
      • setBounds

        public void setBounds​(int x,
                              int y,
                              int width,
                              int height)
        Sets the bounds of the drawing.
        Parameters:
        x - X coordinate.
        y - Y coordinate.
        width - Width.
        height - Height.
      • setBounds

        public void setBounds​(org.eclipse.swt.graphics.Rectangle bounds)
        Sets the bounds of the drawing.
        Parameters:
        bounds - Bounds.
      • getSize

        public org.eclipse.swt.graphics.Point getSize()
        Returns the size.
        Returns:
        size of the renderer.
      • setLocation

        public void setLocation​(int x,
                                int y)
        Sets the location of the drawing.
        Parameters:
        x - X.
        y - Y.
      • setLocation

        public void setLocation​(org.eclipse.swt.graphics.Point location)
        Sets the location of the drawing.
        Parameters:
        location - Location.
      • setSize

        public void setSize​(int width,
                            int height)
        Sets the area of the drawing.
        Parameters:
        width - Width.
        height - Height.
      • setSize

        public void setSize​(org.eclipse.swt.graphics.Point size)
        Sets the area of the drawing.
        Parameters:
        size - Size.
      • isFocus

        public boolean isFocus()
        Returns a boolean value indicating if this renderer has focus.
        Returns:
        True/false if has focus.
      • setFocus

        public void setFocus​(boolean focus)
        Sets focus state.
        Parameters:
        focus - focus state.
      • isHover

        public boolean isHover()
        Returns the hover state.
        Returns:
        Is the renderer in the hover state.
      • setHover

        public void setHover​(boolean hover)
        Sets the hover state.
        Parameters:
        hover - Hover state.
      • isMouseDown

        public boolean isMouseDown()
        Returns the boolean value indicating if the renderer has the mouseDown state.
        Returns:
        mouse down state.
      • setMouseDown

        public void setMouseDown​(boolean mouseDown)
        Sets the mouse down state.
        Parameters:
        mouseDown - Mouse state.
      • isSelected

        public boolean isSelected()
        Returns the boolean state indicating if the selected state is set.
        Returns:
        selected state.
      • setSelected

        public void setSelected​(boolean selected)
        Sets the selected state.
        Parameters:
        selected - Selection state.
      • isExpanded

        public boolean isExpanded()
        Returns the expansion state.
        Returns:
        Returns the expanded.
      • setExpanded

        public void setExpanded​(boolean expanded)
        Sets the expansion state of this renderer.
        Parameters:
        expanded - The expanded to set.
      • paint

        public abstract void paint​(org.eclipse.swt.graphics.GC gc,
                                   java.lang.Object value)
        Paints the visual representation of the given value on the given GC. The actual class of the value object is determined by the use of the implementing class.

        Implementors need to respect the bounds values that may have been specified. The bounds values may affect the x and y values for all drawing operations as well as the width and heights. Implementors may use a Transform to translate the coordinates of all the drawing operations, otherwise they will need to offset each draw.

        Parameters:
        gc - GC to paint with
        value - the value being painted
      • computeSize

        public abstract org.eclipse.swt.graphics.Point computeSize​(org.eclipse.swt.graphics.GC gc,
                                                                   int wHint,
                                                                   int hHint,
                                                                   java.lang.Object value)
        Returns the size of the given value's visual representation.
        Parameters:
        gc - convenience GC for string and text extents
        wHint - given width (or SWT.DEFAULT)
        hHint - given height (or SWT.DEFAULT)
        value - value to be sized
        Returns:
        the size
      • initialize

        public abstract void initialize​(org.eclipse.swt.widgets.Control parent)
        Performs any initialization logic (such as creating new colors or fonts).
        Parameters:
        parent - control that is using the renderer
      • dispose

        public void dispose()
        Disposes of any resources managed by this renderer.
      • isDisposed

        public boolean isDisposed()
        Returns:
        the disposed
      • setDisposed

        protected void setDisposed​(boolean disposed)
        Parameters:
        disposed - the disposed to set