# Class WindowHandler

Object
WindowHandler

public abstract class WindowHandler extends Object
A separated window for visualizing a resource managed by `ResourceExplorer`. A window provides the area where the data are shown and where the user interacts. The window can be a JavaFX top-level window (`Stage`), but not necessarily. It may also be a tile in a mosaic of windows.

Since:
  1.3

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `final WindowManager`
  `manager`
  The window manager which contains this handler.
  `final StringProperty`
  `title`
  The property for a label that identify the view.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static WindowHandler`
  `create(CoverageExplorer widget)`
  Creates a new handler for the window which is showing the given coverage viewer.
  `static WindowHandler`
  `create(FeatureTable widget)`
  Creates a new handler for the window which is showing the given table of features.
  `abstract WindowHandler`
  `duplicate()`
  Prepares a new window with the same content as the window managed by this handler.
  `abstract Optional<MapCanvas>`
  `getCanvas()`
  Returns the canvas (if any) where the resource is shown.
  `void`
  `show()`
  Shows the window and brings it to the front.

  ### Methods inherited from class Object

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

- ## Field Details

  - ### manager

    public final WindowManager manager
    The window manager which contains this handler. The manager contains the list of all windows created for the same widget.

  - ### title

    public final StringProperty title
    The property for a label that identify the view. If the resource is shown in a top-level window, then this is typically the title of that window.

- ## Method Details

  - ### create

    public static WindowHandler create(CoverageExplorer widget)
    Creates a new handler for the window which is showing the given coverage viewer.
    Parameters:
      `widget` - the widget for which to create a handler.
    Returns:
      a handler for the window of the given widget.

  - ### create

    public static WindowHandler create(FeatureTable widget)
    Creates a new handler for the window which is showing the given table of features.
    Parameters:
      `widget` - the widget for which to create a handler.
    Returns:
      a handler for the window of the given widget.

  - ### duplicate

    public abstract WindowHandler duplicate()
    Prepares a new window with the same content as the window managed by this handler. This method can be used for creating many windows over the same data. Each window can do pans, zooms and rotations independently of other windows, or be synchronized with other windows, at user's choice.

    The new view is added to the `WindowManager​.windows` list and will be removed from that list if the window is closed. If the resource is closed in the window manager, then all windows showing that resource will be closed.

    The new window is not initially visible. To show the window, invoke `show()` on the returned handler.

    Returns:
      information about the new window.

  - ### getCanvas

    public abstract Optional<MapCanvas> getCanvas()
    Returns the canvas (if any) where the resource is shown. Canvas exists for some kinds of view such as `CoverageExplorer`, but not for every kinds. For example, tabular data such as `FeatureTable` have no canvas.
    Returns:
      the canvas where the resource is shown.
    See Also:
      - `CoverageExplorer​.getCanvas()`

  - ### show

    public void show()
    Shows the window and brings it to the front. For handlers created by a `create(…)` method, this `show()` method can be invoked at any time. For handlers created by `duplicate()`, this `show()` method can be invoked as long as the window has not been closed. After a duplicated window has been closed, it is not possible to show it again.
    Throws:
      `IllegalStateException` - if this handler is a duplicate and the window has been closed.