Module org.apache.sis.gui
Package org.apache.sis.gui.dataset

# Class ResourceExplorer

Object
Widget
ResourceExplorer

All Implemented Interfaces:
  `Localized`

public class ResourceExplorer extends Widget
A panel showing a tree of resources together with their metadata and data views. This panel also contains a "new window" button for creating new windows showing the same data but potentially a different locations and times. `ResourceExplorer` contains a list of windows created by this widget.

Since:
  1.1

- ## Property Summary

  Properties
  Type
  Property
  Description
  `final ReadOnlyProperty<Resource>`
  `selectedResource`
  Returns the property for currently selected resource.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ResourceExplorer()`
  Creates a new panel for exploring resources.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `final Locale`
  `getLocale()`
  Returns the locale for controls and messages.
  `EventHandler<ResourceEvent>`
  `getOnResourceClosed()`
  Returns the function to be called when a resource is closed.
  `EventHandler<ResourceEvent>`
  `getOnResourceLoaded()`
  Returns the function to be called after a resource has been loaded from a file or URL.
  `final Resource`
  `getSelectedResource()`
  Returns the currently selected resource.
  `final Region`
  `getView()`
  Returns the region containing the resource tree, metadata panel and any other control managed by this `ResourceExplorer`.
  `void`
  `loadResources(Collection<?> files)`
  Loads all given sources in background threads and add them to the resource tree.
  `void`
  `removeAndClose(Resource resource)`
  Removes the given resource from the tree and eventually closes it.
  `final ReadOnlyProperty<Resource>`
  `selectedResourceProperty()`
  Returns the property for currently selected resource.
  `void`
  `setOnResourceClosed(EventHandler<ResourceEvent> handler)`
  Specifies a function to be called when a resource is closed.
  `void`
  `setOnResourceLoaded(EventHandler<ResourceEvent> handler)`
  Specifies a function to be called after a resource has been loaded from a file or URL.

  ### Methods inherited from class Object

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

- ## Property Details

  - ### selectedResource

    public final ReadOnlyProperty<Resource> selectedResourceProperty
    Returns the property for currently selected resource.
    See Also:
      - `selectedResourceProperty()`

- ## Constructor Details

  - ### ResourceExplorer

    public ResourceExplorer()
    Creates a new panel for exploring resources.

- ## Method Details

  - ### getLocale

    public final Locale getLocale()
    Returns the locale for controls and messages.
    Specified by:
      `getLocale` in interface `Localized`
    Overrides:
      `getLocale` in class `Widget`
    Returns:
      the locale for controls in this widget.

  - ### getView

    public final Region getView()
    Returns the region containing the resource tree, metadata panel and any other control managed by this `ResourceExplorer`. The subclass is implementation dependent and may change in any future version.
    Specified by:
      `getView` in class `Widget`
    Returns:
      the region to show.

  - ### getOnResourceLoaded

    public EventHandler<ResourceEvent> getOnResourceLoaded()
    Returns the function to be called after a resource has been loaded from a file or URL. This is an accessor for the `ResourceTree​.onResourceLoaded` property value.
    Returns:
      current function to be called after a resource has been loaded, or `null` if none.
    See Also:
      - `ResourceTree​.onResourceLoaded`

  - ### setOnResourceLoaded

    public void setOnResourceLoaded(EventHandler<ResourceEvent> handler)
    Specifies a function to be called after a resource has been loaded from a file or URL. This is a setter for the `ResourceTree​.onResourceLoaded` property value. If this method is never invoked, then the default value is `null`.
    Parameters:
      `handler` - new function to be called after a resource has been loaded, or `null` if none.
    See Also:
      - `ResourceTree​.onResourceLoaded`

  - ### getOnResourceClosed

    public EventHandler<ResourceEvent> getOnResourceClosed()
    Returns the function to be called when a resource is closed. This is an accessor for the `ResourceTree​.onResourceClosed` property value.
    Returns:
      current function to be called when a resource is closed, or `null` if none.
    Since:
      1.2
    See Also:
      - `ResourceTree​.onResourceClosed`

  - ### setOnResourceClosed

    public void setOnResourceClosed(EventHandler<ResourceEvent> handler)
    Specifies a function to be called when a resource is closed. This is a setter for the `ResourceTree​.onResourceClosed` property value. If this method is never invoked, then the default value is `null`.
    Parameters:
      `handler` - new function to be called when a resource is closed, or `null` if none.
    Since:
      1.2
    See Also:
      - `ResourceTree​.onResourceClosed`

  - ### loadResources

    public void loadResources(Collection<?> files)
    Loads all given sources in background threads and add them to the resource tree. The given collection typically contains files to load, but may also contain `Resource` instances to add directly. This method forwards the files to `ResourceTree​.loadResource(Object)`, which will allocate a background thread for each resource to load.
    Parameters:
      `files` - the source of the resource to load. They are usually `File` or `Path` instances.
    See Also:
      - `ResourceTree​.loadResource(Object)`

  - ### removeAndClose

    public void removeAndClose(Resource resource)
    Removes the given resource from the tree and eventually closes it. If the given resource is not in this tree explorer or cannot be removed, then this method does nothing.
    Parameters:
      `resource` - the resource to remove, or `null`.
    See Also:
      - `ResourceTree​.removeAndClose(Resource)`

  - ### getSelectedResource

    public final Resource getSelectedResource()
    Returns the currently selected resource.
    Returns:
      the currently selected resource, or `null` if none.

  - ### selectedResourceProperty

    public final ReadOnlyProperty<Resource> selectedResourceProperty()
    Returns the property for currently selected resource.
    Returns:
      property for currently selected resource.