Class GridView

All Implemented Interfaces:
Styleable, Event­Target, Skinnable

@DefaultProperty("image") public class GridView extends Control
A view of numerical values in a Rendered­Image. The rendered image is typically a two dimensional slice of a Grid­Coverage. The number of rows is the image height and the number of columns is the image width. The view shows one band at a time, but the band to show can be changed (thus providing a navigation in a third dimension).

This class is designed for large images, with tiles loaded in a background thread only when first needed. This is not a general purpose grid viewer; for matrices of relatively small size (e.g. less than 100 columns), consider using the standard JavaFX Table­View instead.

Since:
1.1
See Also:
  • Field Details

    • imageProperty

      public final ObjectProperty<RenderedImage> imageProperty
      The data shown in this table. Note that setting this property to a non-null value may not modify the grid content immediately. Instead, a background process will request the tiles.
      See Also:
    • bandProperty

      public final IntegerProperty bandProperty
      The image band to show in the table. It should be a number between 0 inclusive and Sample­Model​.get­Num­Bands() exclusive.
      See Also:
    • headerWidth

      public final DoubleProperty headerWidth
      Width of header cells to be shown in the first column. The first (header) column contains the row indices, or sometimes the coordinate values. This size includes the cell spacing. It shall be a number strictly greater than zero.

      API note

      We do not provide getter/setter for this property; use Writable­Double­Value​.set(double) directly instead. We omit the "Property" suffix for making this operation more natural.
    • cellWidth

      public final DoubleProperty cellWidth
      Width of data cell to be shown in other columns than the header column. This size includes the cell spacing. It shall be a number strictly greater than zero.

      API note

      We do not provide getter/setter for this property; use Writable­Double­Value​.set(double) directly instead. We omit the "Property" suffix for making this operation more natural.
    • cellHeight

      public final DoubleProperty cellHeight
      Height of all rows in the grid. It shall be a number strictly greater than zero.

      API note

      We do not provide getter/setter for this property; use Writable­Double­Value​.set(double) directly instead. We omit the "Property" suffix for making this operation more natural.
    • cellSpacing

      public final DoubleProperty cellSpacing
      Horizontal space between cells, as a number equals or greater than zero. There is no property for vertical cell spacing because increasing the cell height should be sufficient.

      API note

      We do not provide getter/setter for this property; use Writable­Double­Value​.set(double) directly instead. We omit the "Property" suffix for making this operation more natural.
    • headerBackground

      public final ObjectProperty<Paint> headerBackground
      The background color of row and column headers.

      API note

      We do not provide getter/setter for this property; use Writable­Object­Value​.set(Object) directly instead. We omit the "Property" suffix for making this operation more natural.
  • Constructor Details

    • GridView

      public GridView()
      Creates an initially empty grid view. The content can be set after construction by a call to set­Image(Rendered­Image).
  • Method Details

    • getImage

      public final RenderedImage getImage()
      Returns the source of sample values for this table. This method, like all other methods in this class, shall be invoked from the JavaFX thread.
      Returns:
      the image shown in this table, or null if none.
      See Also:
    • setImage

      public final void setImage(RenderedImage image)
      Sets the image to show in this table. This method shall be invoked from JavaFX thread and returns quickly; it does not attempt to fetch any tile. Calls to Rendered­Image​.get­Tile(int, int) will be done in a background thread when first needed.
      Parameters:
      image - the image to show in this table, or null if none.
      See Also:
    • setImage

      public void setImage(ImageRequest source)
      Loads image in a background thread from the given source. This method shall be invoked from JavaFX thread and returns immediately. The grid content may appear unmodified after this method returns; the modifications will appear after an undetermined amount of time.
      Parameters:
      source - the coverage or resource to load, or null if none.
      See Also:
    • getBand

      public final int getBand()
      Returns the index of the band shown in this grid view.
      Returns:
      index of the currently visible band number.
      See Also:
    • setBand

      public final void setBand(int index)
      Sets the number of the band to show in this grid view. This value should be from 0 (inclusive) to the number of bands in the image (exclusive).
      Parameters:
      index - the band to make visible.
      Throws:
      Illegal­Argument­Exception - if the given band index is out of bounds.
    • cellFormatPattern

      public final Optional<StringProperty> cellFormatPattern()
      The property for the pattern of values in cells. Note that this pattern depends on current locale. It is provided for user interactions (i.e. in a GUI control) instead of programmatic action.
      Returns:
      the localized format pattern property, or an empty value if the Number­Format used for writing cell values is not an instance of Decimal­Format.
      See Also:
    • createDefaultSkin

      protected final Skin<GridView> createDefaultSkin()
      Creates a new instance of the skin responsible for rendering this grid view. From the perspective of this Control, the Skin is a black box. It listens and responds to changes in state of this grid view. This method is called if no skin is provided via CSS or Control​.set­Skin(Skin).
      Overrides:
      create­Default­Skin in class Control
      Returns:
      the renderer of this grid view.