Class NoOpGrid

java.lang.Object
com.levigo.jadice.web.client.grid.NoOpGrid
All Implemented Interfaces:
Grid

public final class NoOpGrid extends Object implements Grid
A "no-op" grid with a Cell width and height of 1.

When calling snap(Point2D, SnapTo), this grid will simply return the original point.

  • Constructor Details

    • NoOpGrid

      public NoOpGrid()
  • Method Details

    • getCellWidth

      public double getCellWidth()
      Description copied from interface: Grid
      Returns the cell width of the grid.
      Specified by:
      getCellWidth in interface Grid
    • getCellHeight

      public double getCellHeight()
      Description copied from interface: Grid
      Returns the cell height of the grid.
      Specified by:
      getCellHeight in interface Grid
    • getCell

      public Cell getCell(Point2D point)
      Description copied from interface: Grid
      Returns the Cell corresponding to the given point. A point located on the border of two cells belongs to the right / bottom cell.
      Specified by:
      getCell in interface Grid
      Parameters:
      point - the point in jadice document units to get the cell for
      Returns:
      the Cell
    • getCellBounds

      public Rectangle2D getCellBounds(Cell cell)
      Description copied from interface: Grid
      Returns a rectangle in jadice document units which represents the grid at the given Cell.
      Specified by:
      getCellBounds in interface Grid
      Parameters:
      cell - the cell
      Returns:
      the rectangle representing the bounds of the given cell in jadice document units
    • snap

      public Point2D snap(Point2D point, Grid.SnapTo snapTo)
      Description copied from interface: Grid
      Returns an aligned point which is residing on its corresponding Cell at the position determined by Grid.SnapTo.
      Specified by:
      snap in interface Grid
      Parameters:
      point - the point in jadice document units to be aligned
      snapTo - where the aligned point shall reside (e.g. center of grid element, top_left, etc)
      Returns:
      the aligned point
    • getBounds

      public Rectangle2D getBounds()
      Description copied from interface: Grid
      Returns the full grid bounds as a Rectangle2D.

      This makes it possible to create margins/offsets. E.g. if the page size is 100x100, the grid bounds could be set to (10, 10, 80, 80) to specify a border of 10 on each edge.

      Specified by:
      getBounds in interface Grid
      Returns:
      the grid bounds or null if no bounds are set