Package org.eclipse.gef.mvc.fx.models

# Class GridModel

java.lang.Object
org.eclipse.gef.mvc.fx.models.GridModel

public class GridModel extends Object
The `GridModel` stores information about a background grid, i.e. cell width and cell height. It also stores flags indicating if the grid should be visible, if the grid should zoom with the contents, and if contents should snap to the grid.

## Property Summary

Properties
Type
Property
Description
`DoubleProperty`
`gridCellHeight`
Returns a double property representing the grid cell height.
`DoubleProperty`
`gridCellWidth`
Returns a double property representing the grid cell width.
`BooleanProperty`
`showGrid`
Returns a boolean property whose value indicates whether grid is to be shown.
`BooleanProperty`
`zoomGrid`
Returns a boolean property whose value indicates whether grid is to be zoomed.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final double`
`GRID_CELL_HEIGHT_DEFAULT`
The default grid cell height.
`static final String`
`GRID_CELL_HEIGHT_PROPERTY`
Name of the "grid cell height" property.
`static final double`
`GRID_CELL_WIDTH_DEFAULT`
The default grid cell width.
`static final String`
`GRID_CELL_WIDTH_PROPERTY`
Name of the "grid cell width" property.
`static final boolean`
`SHOW_GRID_DEFAULT`
The default value for `isShowGrid()`.
`static final String`
`SHOW_GRID_PROPERTY`
Name of the "show grid" property.
`static final boolean`
`ZOOM_GRID_DEFAULT`
The default value for `isZoomGrid()`.
`static final String`
`ZOOM_GRID_PROPERTY`
Name of the "zoom grid" property.

## Constructor Summary

Constructors
Constructor
Description
`GridModel()`

## Method Summary

Modifier and Type
Method
Description
`double`
`getGridCellHeight()`
Returns the grid cell height.
`double`
`getGridCellWidth()`
Returns the grid cell width.
`DoubleProperty`
`gridCellHeightProperty()`
Returns a double property representing the grid cell height.
`DoubleProperty`
`gridCellWidthProperty()`
Returns a double property representing the grid cell width.
`boolean`
`isShowGrid()`
Returns `true` if the grid is visible, otherwise `false`.
`boolean`
`isZoomGrid()`
Returns `true` if the grid is zooming with the contents, otherwise `false`.
`void`
`setGridCellHeight(double gridCellHeight)`
Sets the grid cell height to the given value.
`void`
`setGridCellWidth(double gridCellWidth)`
Sets the grid cell width to the given value.
`void`
`setShowGrid(boolean showGrid)`
Shows/Hides the grid depending on the given value.
`void`
`setZoomGrid(boolean zoomGrid)`
Enables/Disables grid zooming depending on the given value.
`BooleanProperty`
`showGridProperty()`
Returns a boolean property whose value indicates whether grid is to be shown.
`BooleanProperty`
`zoomGridProperty()`
Returns a boolean property whose value indicates whether grid is to be zoomed.

### Methods inherited from class java.lang.Object

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

## Property Details

### gridCellHeight

public DoubleProperty gridCellHeightProperty
Returns a double property representing the grid cell height.

See Also:
  - `getGridCellHeight()`
  - `setGridCellHeight(double)`

### gridCellWidth

public DoubleProperty gridCellWidthProperty
Returns a double property representing the grid cell width.

See Also:
  - `getGridCellWidth()`
  - `setGridCellWidth(double)`

### showGrid

public BooleanProperty showGridProperty
Returns a boolean property whose value indicates whether grid is to be shown.

See Also:
  - `isShowGrid()`
  - `setShowGrid(boolean)`

### zoomGrid

public BooleanProperty zoomGridProperty
Returns a boolean property whose value indicates whether grid is to be zoomed.

See Also:
  - `isZoomGrid()`
  - `setZoomGrid(boolean)`

## Field Details

### ZOOM_GRID_DEFAULT

public static final boolean ZOOM_GRID_DEFAULT
The default value for `isZoomGrid()`.

See Also:
  - Constant Field Values

### SHOW_GRID_DEFAULT

public static final boolean SHOW_GRID_DEFAULT
The default value for `isShowGrid()`.

See Also:
  - Constant Field Values

### GRID_CELL_HEIGHT_DEFAULT

public static final double GRID_CELL_HEIGHT_DEFAULT
The default grid cell height.

See Also:
  - Constant Field Values

### GRID_CELL_WIDTH_DEFAULT

public static final double GRID_CELL_WIDTH_DEFAULT
The default grid cell width.

See Also:
  - Constant Field Values

### GRID_CELL_WIDTH_PROPERTY

public static final String GRID_CELL_WIDTH_PROPERTY
Name of the "grid cell width" property.

See Also:
  - Constant Field Values

### GRID_CELL_HEIGHT_PROPERTY

public static final String GRID_CELL_HEIGHT_PROPERTY
Name of the "grid cell height" property.

See Also:
  - Constant Field Values

### SHOW_GRID_PROPERTY

public static final String SHOW_GRID_PROPERTY
Name of the "show grid" property.

See Also:
  - Constant Field Values

### ZOOM_GRID_PROPERTY

public static final String ZOOM_GRID_PROPERTY
Name of the "zoom grid" property.

See Also:
  - Constant Field Values

## Constructor Details

### GridModel

public GridModel()

## Method Details

### getGridCellHeight

public double getGridCellHeight()
Returns the grid cell height.

Returns:
  The grid cell height.

### getGridCellWidth

public double getGridCellWidth()
Returns the grid cell width.

Returns:
  The grid cell width.

### gridCellHeightProperty

public DoubleProperty gridCellHeightProperty()
Returns a double property representing the grid cell height.

See Also:
  - `getGridCellHeight()`
  - `setGridCellHeight(double)`

### gridCellWidthProperty

public DoubleProperty gridCellWidthProperty()
Returns a double property representing the grid cell width.

See Also:
  - `getGridCellWidth()`
  - `setGridCellWidth(double)`

### isShowGrid

public boolean isShowGrid()
Returns `true` if the grid is visible, otherwise `false`.

Returns:
  `true` if the grid is visible, otherwise `false`.

### isZoomGrid

public boolean isZoomGrid()
Returns `true` if the grid is zooming with the contents, otherwise `false`.

Returns:
  `true` if the grid is zooming with the contents, otherwise `false`.

### setGridCellHeight

public void setGridCellHeight(double gridCellHeight)
Sets the grid cell height to the given value.

Parameters:
  `gridCellHeight` - The new grid cell height.

### setGridCellWidth

public void setGridCellWidth(double gridCellWidth)
Sets the grid cell width to the given value.

Parameters:
  `gridCellWidth` - The new grid cell width.

### setShowGrid

public void setShowGrid(boolean showGrid)
Shows/Hides the grid depending on the given value.

Parameters:
  `showGrid` - `true` in order to show the grid, or `false` in order to hide it.

### setZoomGrid

public void setZoomGrid(boolean zoomGrid)
Enables/Disables grid zooming depending on the given value.

Parameters:
  `zoomGrid` - `true` in order to zoom the grid with the contents, or `false` in order to not zoom the grid.

### showGridProperty

public BooleanProperty showGridProperty()
Returns a boolean property whose value indicates whether grid is to be shown.

See Also:
  - `isShowGrid()`
  - `setShowGrid(boolean)`

### zoomGridProperty

public BooleanProperty zoomGridProperty()
Returns a boolean property whose value indicates whether grid is to be zoomed.

See Also:
  - `isZoomGrid()`
  - `setZoomGrid(boolean)`