# Class GridView

Object
Node
Parent
Region
Control
GridView

All Implemented Interfaces:
  `Styleable`, `EventTarget`, `Skinnable`

@DefaultProperty("image") public class GridView extends Control
A view of numerical values in a `RenderedImage`. The rendered image is typically a two dimensional slice of a `GridCoverage`. 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.

Since:
  1.1
See Also:
  - `CoverageExplorer`

- ## Property Summary

  ### Properties inherited from class Control

  `contextMenu, skin, tooltip`

  ### Properties inherited from class Region

  `background, border, cacheShape, centerShape, height, insets, maxHeight, maxWidth, minHeight, minWidth, opaqueInsets, padding, prefHeight, prefWidth, scaleShape, shape, snapToPixel, width`

  ### Properties inherited from class Parent

  `needsLayout`

  ### Properties inherited from class Node

  `accessibleHelp, accessibleRoleDescription, accessibleRole, accessibleText, blendMode, boundsInLocal, boundsInParent, cacheHint, cache, clip, cursor, depthTest, disabled, disable, effectiveNodeOrientation, effect, eventDispatcher, focused, focusTraversable, focusVisible, focusWithin, hover, id, inputMethodRequests, layoutBounds, layoutX, layoutY, localToParentTransform, localToSceneTransform, managed, mouseTransparent, nodeOrientation, onContextMenuRequested, onDragDetected, onDragDone, onDragDropped, onDragEntered, onDragExited, onDragOver, onInputMethodTextChanged, onKeyPressed, onKeyReleased, onKeyTyped, onMouseClicked, onMouseDragEntered, onMouseDragExited, onMouseDragged, onMouseDragOver, onMouseDragReleased, onMouseEntered, onMouseExited, onMouseMoved, onMousePressed, onMouseReleased, onRotate, onRotationFinished, onRotationStarted, onScrollFinished, onScroll, onScrollStarted, onSwipeDown, onSwipeLeft, onSwipeRight, onSwipeUp, onTouchMoved, onTouchPressed, onTouchReleased, onTouchStationary, onZoomFinished, onZoom, onZoomStarted, opacity, parent, pickOnBounds, pressed, rotate, rotationAxis, scaleX, scaleY, scaleZ, scene, style, translateX, translateY, translateZ, viewOrder, visible`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `final IntegerProperty`
  `bandProperty`
  The image band to show in the table.
  `final DoubleProperty`
  `cellHeight`
  Height of all rows in the grid.
  `final DoubleProperty`
  `cellSpacing`
  Horizontal space between cells, as a number equals or greater than zero.
  `final DoubleProperty`
  `cellWidth`
  Width of data cell to be shown in other columns than the header column.
  `final ObjectProperty<Paint>`
  `headerBackground`
  The background color of row and column headers.
  `final DoubleProperty`
  `headerWidth`
  Width of header cells to be shown in the first column.
  `final ObjectProperty<RenderedImage>`
  `imageProperty`
  The data shown in this table.

  ### Fields inherited from class Region

  `USE_COMPUTED_SIZE, USE_PREF_SIZE`

  ### Fields inherited from class Node

  `BASELINE_OFFSET_SAME_AS_HEIGHT`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `GridView()`
  Creates an initially empty grid view.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `final Optional<StringProperty>`
  `cellFormatPattern()`
  The property for the pattern of values in cells.
  `protected final Skin<GridView>`
  `createDefaultSkin()`
  Creates a new instance of the skin responsible for rendering this grid view.
  `final String`
  `formatCoordinateValue(long index)`
  Formats a x or y pixel coordinate values.
  `final String`
  `formatSampleValue(long x, long y)`
  Formats the sample value at the image coordinates.
  `final int`
  `getBand()`
  Returns the index of the band shown in this grid view.
  `final RenderedImage`
  `getImage()`
  Returns the source of sample values for this table.
  `final void`
  `setBand(int index)`
  Sets the number of the band to show in this grid view.
  `final void`
  `setImage(RenderedImage image)`
  Sets the image to show in this table.
  `void`
  `setImage(ImageRequest source)`
  Loads image in a background thread from the given source.

  ### Methods inherited from class Control

  `computeMaxHeight, computeMaxWidth, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, contextMenuProperty, executeAccessibleAction, getBaselineOffset, getClassCssMetaData, getContextMenu, getControlCssMetaData, getCssMetaData, getInitialFocusTraversable, getSkin, getTooltip, isResizable, layoutChildren, queryAccessibleAttribute, setContextMenu, setSkin, setTooltip, skinProperty, tooltipProperty`

  ### Methods inherited from class Region

  `backgroundProperty, borderProperty, cacheShapeProperty, centerShapeProperty, getBackground, getBorder, getHeight, getInsets, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getOpaqueInsets, getPadding, getPrefHeight, getPrefWidth, getShape, getUserAgentStylesheet, getWidth, heightProperty, insetsProperty, isCacheShape, isCenterShape, isScaleShape, isSnapToPixel, layoutInArea, layoutInArea, layoutInArea, layoutInArea, maxHeight, maxHeightProperty, maxWidth, maxWidthProperty, minHeight, minHeightProperty, minWidth, minWidthProperty, opaqueInsetsProperty, paddingProperty, positionInArea, positionInArea, prefHeight, prefHeightProperty, prefWidth, prefWidthProperty, resize, scaleShapeProperty, setBackground, setBorder, setCacheShape, setCenterShape, setHeight, setMaxHeight, setMaxSize, setMaxWidth, setMinHeight, setMinSize, setMinWidth, setOpaqueInsets, setPadding, setPrefHeight, setPrefSize, setPrefWidth, setScaleShape, setShape, setSnapToPixel, setWidth, shapeProperty, snappedBottomInset, snappedLeftInset, snappedRightInset, snappedTopInset, snapPosition, snapPositionX, snapPositionY, snapSize, snapSizeX, snapSizeY, snapSpace, snapSpaceX, snapSpaceY, snapToPixelProperty, widthProperty`

  ### Methods inherited from class Parent

  `getChildren, getChildrenUnmodifiable, getManagedChildren, getStylesheets, isNeedsLayout, layout, lookup, needsLayoutProperty, requestLayout, requestParentLayout, setNeedsLayout, updateBounds`

  ### Methods inherited from class Node

  `accessibleHelpProperty, accessibleRoleDescriptionProperty, accessibleRoleProperty, accessibleTextProperty, addEventFilter, addEventHandler, applyCss, autosize, blendModeProperty, boundsInLocalProperty, boundsInParentProperty, buildEventDispatchChain, cacheHintProperty, cacheProperty, clipProperty, computeAreaInScreen, contains, contains, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectiveNodeOrientationProperty, effectProperty, eventDispatcherProperty, fireEvent, focusedProperty, focusTraversableProperty, focusVisibleProperty, focusWithinProperty, getAccessibleHelp, getAccessibleRole, getAccessibleRoleDescription, getAccessibleText, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClip, getContentBias, getCursor, getDepthTest, getEffect, getEffectiveNodeOrientation, getEventDispatcher, getId, getInitialCursor, getInputMethodRequests, getLayoutBounds, getLayoutX, getLayoutY, getLocalToParentTransform, getLocalToSceneTransform, getNodeOrientation, getOnContextMenuRequested, getOnDragDetected, getOnDragDone, getOnDragDropped, getOnDragEntered, getOnDragExited, getOnDragOver, getOnInputMethodTextChanged, getOnKeyPressed, getOnKeyReleased, getOnKeyTyped, getOnMouseClicked, getOnMouseDragEntered, getOnMouseDragExited, getOnMouseDragged, getOnMouseDragOver, getOnMouseDragReleased, getOnMouseEntered, getOnMouseExited, getOnMouseMoved, getOnMousePressed, getOnMouseReleased, getOnRotate, getOnRotationFinished, getOnRotationStarted, getOnScroll, getOnScrollFinished, getOnScrollStarted, getOnSwipeDown, getOnSwipeLeft, getOnSwipeRight, getOnSwipeUp, getOnTouchMoved, getOnTouchPressed, getOnTouchReleased, getOnTouchStationary, getOnZoom, getOnZoomFinished, getOnZoomStarted, getOpacity, getParent, getProperties, getPseudoClassStates, getRotate, getRotationAxis, getScaleX, getScaleY, getScaleZ, getScene, getStyle, getStyleableParent, getStyleClass, getTransforms, getTranslateX, getTranslateY, getTranslateZ, getTypeSelector, getUserData, getViewOrder, hasProperties, hoverProperty, idProperty, inputMethodRequestsProperty, intersects, intersects, isCache, isDisable, isDisabled, isFocused, isFocusTraversable, isFocusVisible, isFocusWithin, isHover, isManaged, isMouseTransparent, isPickOnBounds, isPressed, isVisible, layoutBoundsProperty, layoutXProperty, layoutYProperty, localToParent, localToParent, localToParent, localToParent, localToParent, localToParentTransformProperty, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToSceneTransformProperty, localToScreen, localToScreen, localToScreen, localToScreen, localToScreen, lookupAll, managedProperty, mouseTransparentProperty, nodeOrientationProperty, notifyAccessibleAttributeChanged, onContextMenuRequestedProperty, onDragDetectedProperty, onDragDoneProperty, onDragDroppedProperty, onDragEnteredProperty, onDragExitedProperty, onDragOverProperty, onInputMethodTextChangedProperty, onKeyPressedProperty, onKeyReleasedProperty, onKeyTypedProperty, onMouseClickedProperty, onMouseDragEnteredProperty, onMouseDragExitedProperty, onMouseDraggedProperty, onMouseDragOverProperty, onMouseDragReleasedProperty, onMouseEnteredProperty, onMouseExitedProperty, onMouseMovedProperty, onMousePressedProperty, onMouseReleasedProperty, onRotateProperty, onRotationFinishedProperty, onRotationStartedProperty, onScrollFinishedProperty, onScrollProperty, onScrollStartedProperty, onSwipeDownProperty, onSwipeLeftProperty, onSwipeRightProperty, onSwipeUpProperty, onTouchMovedProperty, onTouchPressedProperty, onTouchReleasedProperty, onTouchStationaryProperty, onZoomFinishedProperty, onZoomProperty, onZoomStartedProperty, opacityProperty, parentProperty, parentToLocal, parentToLocal, parentToLocal, parentToLocal, parentToLocal, pickOnBoundsProperty, pressedProperty, pseudoClassStateChanged, relocate, removeEventFilter, removeEventHandler, requestFocus, requestFocusTraversal, resizeRelocate, rotateProperty, rotationAxisProperty, scaleXProperty, scaleYProperty, scaleZProperty, sceneProperty, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, screenToLocal, screenToLocal, screenToLocal, setAccessibleHelp, setAccessibleRole, setAccessibleRoleDescription, setAccessibleText, setBlendMode, setCache, setCacheHint, setClip, setCursor, setDepthTest, setDisable, setDisabled, setEffect, setEventDispatcher, setEventHandler, setFocused, setFocusTraversable, setHover, setId, setInputMethodRequests, setLayoutX, setLayoutY, setManaged, setMouseTransparent, setNodeOrientation, setOnContextMenuRequested, setOnDragDetected, setOnDragDone, setOnDragDropped, setOnDragEntered, setOnDragExited, setOnDragOver, setOnInputMethodTextChanged, setOnKeyPressed, setOnKeyReleased, setOnKeyTyped, setOnMouseClicked, setOnMouseDragEntered, setOnMouseDragExited, setOnMouseDragged, setOnMouseDragOver, setOnMouseDragReleased, setOnMouseEntered, setOnMouseExited, setOnMouseMoved, setOnMousePressed, setOnMouseReleased, setOnRotate, setOnRotationFinished, setOnRotationStarted, setOnScroll, setOnScrollFinished, setOnScrollStarted, setOnSwipeDown, setOnSwipeLeft, setOnSwipeRight, setOnSwipeUp, setOnTouchMoved, setOnTouchPressed, setOnTouchReleased, setOnTouchStationary, setOnZoom, setOnZoomFinished, setOnZoomStarted, setOpacity, setPickOnBounds, setPressed, setRotate, setRotationAxis, setScaleX, setScaleY, setScaleZ, setStyle, setTranslateX, setTranslateY, setTranslateZ, setUserData, setViewOrder, setVisible, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, toBack, toFront, toString, translateXProperty, translateYProperty, translateZProperty, usesMirroring, viewOrderProperty, visibleProperty`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

  ### Methods inherited from interface Styleable

  `getStyleableNode`

- ## 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:
      - `getImage()`
      - `setImage(RenderedImage)`
      - `setImage(ImageRequest)`

  - ### bandProperty

    public final IntegerProperty bandProperty
    The image band to show in the table. It should be a number between 0 inclusive and `SampleModel​.getNumBands()` exclusive.
    See Also:
      - `getBand()`
      - `setBand(int)`

  - ### 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 `WritableDoubleValue​.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 `WritableDoubleValue​.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 `WritableDoubleValue​.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 `WritableDoubleValue​.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 `WritableObjectValue​.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 `setImage(RenderedImage)`.

- ## 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:
      - `imageProperty`

  - ### setImage

    public final void setImage(RenderedImage image)
    Sets the image to show in this table. This method shall be invoked from the JavaFX thread. This method returns quickly, it does not attempt to fetch any tile. Calls to `RenderedImage​.getTile(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:
      - `imageProperty`

  - ### 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:
      - `CoverageExplorer​.setCoverage(ImageRequest)`

  - ### 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:
      - `bandProperty`

  - ### 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:
      `IllegalArgumentException` - if the given band index is out of bounds.

  - ### formatSampleValue

    public final String formatSampleValue(long x, long y)
    Formats the sample value at the image coordinates. If the tile is not available at the time that this method is invoked, then the tile will be loaded in a background thread and the grid view will be refreshed when the tile become available.
    Parameters:
      `x` - image x coordinate of the sample value to get.
      `y` - image y coordinate of the sample value to get.
    Returns:
      the sample value at the specified coordinates, or `null` if not available.
    Since:
      1.5
    See Also:
      - `formatCoordinateValue(long)`

  - ### formatCoordinateValue

    public final String formatCoordinateValue(long index)
    Formats a x or y pixel coordinate values. They are the values to write in the header row or header column.
    Parameters:
      `index` - the pixel coordinate to format.
    Returns:
      string representation of the given pixel coordinate.
    Since:
      1.5

  - ### 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 `NumberFormat` used for writing cell values is not an instance of `DecimalFormat`.
    See Also:
      - `DecimalFormat​.toLocalizedPattern()`

  - ### 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​.setSkin(Skin)`.
    Overrides:
      `createDefaultSkin` in class `Control`
    Returns:
      the renderer of this grid view.