Class DefaultGridLook

java.lang.Object
org.eclipse.nebula.paperclips.core.grid.DefaultGridLook
All Implemented Interfaces:
GridLook

public class DefaultGridLook
extends java.lang.Object
implements GridLook
A GridLook which draws a border around grid cells, with configurable background colors for body, header, and footer cells.
  • Field Details

  • Constructor Details

    • DefaultGridLook

      public DefaultGridLook()
      Constructs a DefaultGridLook with no border, no cell spacing, and no background colors.
    • DefaultGridLook

      public DefaultGridLook​(int horizontalSpacing, int verticalSpacing)
      Constructs a DefaultGridLook with the given cell spacing, and no border or background colors.
      Parameters:
      horizontalSpacing - the horizontal cell spacing.
      verticalSpacing - the vertical cell spacing.
  • Method Details

    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class java.lang.Object
    • equals

      public boolean equals​(java.lang.Object obj)
      Overrides:
      equals in class java.lang.Object
    • getCellBorder

      public Border getCellBorder()
      Returns the cell border. Default is an empty border with no margins.
      Returns:
      the cell border.
    • setCellBorder

      public void setCellBorder​(Border border)
      Sets the cell border.
      Parameters:
      border - the cell border.
    • getCellSpacing

      public org.eclipse.swt.graphics.Point getCellSpacing()
      Returns the border spacing, in points, between adjacent grid cells. Default is (x=BORDER_OVERLAP, y=BORDER_OVERLAP).
      Returns:
      the border spacing, in points, between adjacent grid cells.
    • setCellSpacing

      public void setCellSpacing​(org.eclipse.swt.graphics.Point cellSpacing)
      Sets the border spacing, in points, between adjacent grid cells. A value of BORDER_OVERLAP causes the borders to overlap, making the border appear continuous throughout the grid. A value of 0 or more causes the cell borders to be spaced that many points apart. 72 points = 1".
      Parameters:
      cellSpacing - a point whose x and y elements indicate the horizontal and vertical spacing between grid cells.
    • setCellSpacing

      public void setCellSpacing​(int horizontal, int vertical)
      Sets the border spacing, in points, between adjacent grid cells. A value of BORDER_OVERLAP causes the borders to overlap, making the border appear continuous throughout the grid. A value of 0 or more causes the cell borders to be spaced that many points apart. 72 points = 1".
      Parameters:
      horizontal - the horizontal cell spacing.
      vertical - the vertical cell spacing.
    • getCellPadding

      public org.eclipse.swt.graphics.Rectangle getCellPadding()
      Returns a rectangle whose public fields denote the left (x), top (y), right (width) and bottom (height) cell padding, expressed in points. 72 points = 1" = 2.54cm.
      Returns:
      a rectangle whose public fields denote the cell padding at each edge.
    • setCellPadding

      public void setCellPadding​(org.eclipse.swt.graphics.Rectangle cellPadding)
      Sets the cell padding to the values in the public fields of the argument.
      Parameters:
      cellPadding - the new cell padding.
    • setCellPadding

      public void setCellPadding​(int horizontalPadding, int verticalPadding)
      Sets the cell padding to the given horizontal and vertical values. This is equivalent to calling setCellPadding(horizontalPadding, verticalPadding, horizontalPadding, verticalPadding).
      Parameters:
      horizontalPadding - the amount of padding to add to the left and right of each cell, in points.
      verticalPadding - the amount padding to add to the top and bottom each cell, in points.
    • setCellPadding

      public void setCellPadding​(int left, int top, int right, int bottom)
      Sets the cell padding to the specified values.
      Parameters:
      left - the left cell padding, in points.
      top - the top cell padding, in points.
      right - the right cell padding, in points.
      bottom - the bottom cell padding, in points.
    • getHeaderBackground

      public org.eclipse.swt.graphics.RGB getHeaderBackground()
      Returns the header background color. If null, the body background color is used. Default is null.
      Returns:
      the header background color.
    • setHeaderBackground

      public void setHeaderBackground​(org.eclipse.swt.graphics.RGB headerBackground)
      Sets the header background color. Calls to this method override any previous calls to setHeaderBackgroundProvider(...).
      Parameters:
      headerBackground - the new background color. If null, the body background color will be used.
    • getHeaderBackgroundProvider

      public CellBackgroundProvider getHeaderBackgroundProvider()
      Returns the header background color provider.
      Returns:
      the header background color provider.
    • setHeaderBackgroundProvider

      public void setHeaderBackgroundProvider​(CellBackgroundProvider headerBackgroundProvider)
      Sets the header background color provider. Calls to this method override any previous calls to setHeaderBackground(RGB). Setting this property to null restores the default background provider.
      Parameters:
      headerBackgroundProvider - the new background color provider.
    • getHeaderGap

      public int getHeaderGap()
      Returns the vertical gap between the header and body cells. Default is BORDER_OVERLAP.
      Returns:
      the vertical gap between the header and body cells.
    • setHeaderGap

      public void setHeaderGap​(int headerGap)
      Sets the vertical gap between the header and body cells. A value of BORDER_OVERLAP causes the borders to overlap, making the border appear continuous in the transition from the header cells to the body cells.
      Parameters:
      headerGap - the new header gap.
    • getBodyBackground

      public org.eclipse.swt.graphics.RGB getBodyBackground()
      Returns the body background color. Default is null (no background color).
      Returns:
      the body background color.
    • setBodyBackground

      public void setBodyBackground​(org.eclipse.swt.graphics.RGB bodyBackground)
      Sets the body background color. Calls to this method override any previous calls to setBodyBackgroundProvider(...).
      Parameters:
      bodyBackground - the new background color.
    • getBodyBackgroundProvider

      public CellBackgroundProvider getBodyBackgroundProvider()
      Returns the body background color provider.
      Returns:
      the body background color provider.
    • setBodyBackgroundProvider

      public void setBodyBackgroundProvider​(CellBackgroundProvider bodyBackgroundProvider)
      Sets the body background color provider. Calls to this method override any previous calls to setBodyBackground(RGB). Setting this property to null restores the default background provider.
      Parameters:
      bodyBackgroundProvider - the new background color provider.
    • getFooterGap

      public int getFooterGap()
      Returns the vertical gap between the body and footer cells. Default is BORDER_OVERLAP.
      Returns:
      the vertical gap between the header and body cells.
    • setFooterGap

      public void setFooterGap​(int footerGap)
      Sets the vertical gap between the header and body cells. A value of BORDER_OVERLAP causes the borders to overlap, making the border appear continuous in the transition from the body cells to the footer cells.
      Parameters:
      footerGap -
    • getFooterBackground

      public org.eclipse.swt.graphics.RGB getFooterBackground()
      Returns the footer background color. If null, the body background color is used. Default is null.
      Returns:
      the footer background color.
    • setFooterBackground

      public void setFooterBackground​(org.eclipse.swt.graphics.RGB footerBackground)
      Sets the footer background color. Calls to this method override any previous calls to setFooterBackgroundProvider(...).
      Parameters:
      footerBackground - the new background color. If null, the body background color will be used.
    • getFooterBackgroundProvider

      public CellBackgroundProvider getFooterBackgroundProvider()
      Returns the footer background color provider.
      Returns:
      the footer background color provider.
    • setFooterBackgroundProvider

      public void setFooterBackgroundProvider​(CellBackgroundProvider footerBackgroundProvider)
      Sets the footer background color provider. Calls to this method override any previous calls to setFooterBackground(RGB). Setting this property to null restores the default background provider.
      Parameters:
      footerBackgroundProvider - the new background color provider.
    • getPainter

      public GridLookPainter getPainter​(org.eclipse.swt.graphics.Device device, org.eclipse.swt.graphics.GC gc)
      Description copied from interface: GridLook
      Returns a GridLookPainter for painting the GridLook.
      Specified by:
      getPainter in interface GridLook
      Parameters:
      device - the device to paint on.
      gc - the graphics context for painting.
      Returns:
      a GridLookPainter for painting the GridLook.