org.geotoolkit.image.io.metadata
Class MetadataTreeTable

Object
  extended by MetadataTreeTable
All Implemented Interfaces:
Localized

public class MetadataTreeTable
extends Object
implements Localized

A view of an IIOMetadata instance as a tree table. The tree structure is determined by an IIOMetadataFormat, which must be provided to the constructor. After the construction, different instances of IIOMetadata can be given to this MetadataTreeTable in order to generate tables with different values. If no IIOMetadata instance is given, then this object represents only the structure of the format with its restrictions (expected type, range of values, etc.) but no values.

The root of the tree is obtained by getRootNode(). The table contains at most 7 columns, described below:

  1. A human-readable name of the nodes.
  2. A description of the node.
  3. The simple class names of values.
  4. The range of occurrences (how many time the node can be repeated).
  5. The node value (this column is omitted if the tree is for IIOMetadataFormat instead than IIOMetadata).
  6. The default value.
  7. A description of valid values (either as a range or as an enumeration).

This class works with arbitrary implementations of IIOMetadata; it doesn't need to be the specialized implementations defined in Geotk.

Since:
3.04
Version:
3.16
Author:
Martin Desruisseaux (Geomatys)
See Also:
IIOMetadataPanel
Module:
coverage/geotk-coverageio (download)    View source code for this class

Field Summary
static int COLUMN_COUNT
          The number of columns in the table (7), when every columns are present.
static int VALUE_COLUMN
          The column which contains the values.
 
Constructor Summary
MetadataTreeTable(IIOMetadataFormat format)
          Creates a new metadata tree for the given format.
 
Method Summary
 Locale getLocale()
          Returns the locale for which localization will be attempted.
 IIOMetadata getMetadata()
          Returns the metadata to be formatted as a tree table.
 IIOMetadataFormat getMetadataFormat()
          Returns the metadata format specified at construction time.
 MetadataTreeNode getRootNode()
          Returns the root of the Tree Table representation of the metadata.
 boolean getSimplificationAllowed()
          Returns true if the tree returned by getRootNode() can be simplified.
 void setLocale(Locale locale)
          Sets the locale for which localization will be attempted.
 void setMetadata(IIOMetadata metadata)
          Sets the metadata to be formatted as a tree table.
 void setSimplificationAllowed(boolean allowed)
          Sets whatever the tree returned by getRootNode() can be simplified.
 String toString()
          Returns a string representation of this tree table.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

COLUMN_COUNT

public static final int COLUMN_COUNT
The number of columns in the table (7), when every columns are present. Note that the value column is omitted if this MetadataTreeTable is given only an IIOMetadataFormat without any IIOMetadata instance for providing the actual values.

See Also:
Constant Field Values

VALUE_COLUMN

public static final int VALUE_COLUMN
The column which contains the values. This is the column which is omitted if this table describe only an IIOMetadataFormat without IIOMetadata.

Since:
3.05
See Also:
Constant Field Values
Constructor Detail

MetadataTreeTable

public MetadataTreeTable(IIOMetadataFormat format)
Creates a new metadata tree for the given format.

Parameters:
format - The expected format of IIOMetadata instances.
Method Detail

getMetadataFormat

public IIOMetadataFormat getMetadataFormat()
Returns the metadata format specified at construction time.

Returns:
The metadata format.
Since:
3.05

getMetadata

public IIOMetadata getMetadata()
Returns the metadata to be formatted as a tree table.

Returns:
The current metadata, or null if none.

setMetadata

public void setMetadata(IIOMetadata metadata)
                 throws IllegalArgumentException
Sets the metadata to be formatted as a tree table. This method invalidates any root node obtained before the call to this method.

Parameters:
metadata - The new metadata, or null if none.
Throws:
IllegalArgumentException - If the given metadata does not support the format given to the MetadataTreeTable constructor.

getLocale

public Locale getLocale()
Returns the locale for which localization will be attempted.

Specified by:
getLocale in interface Localized
Returns:
The locale for which localization will be attempted.

setLocale

public void setLocale(Locale locale)
Sets the locale for which localization will be attempted. This change applies to future MetadataTreeNode instances to be created by getRootNode(). The effect on previous instances (if any) is undefined - some will take the change in account, other will ignore.

Parameters:
locale - The locale for which localization will be attempted.

getSimplificationAllowed

public boolean getSimplificationAllowed()
Returns true if the tree returned by getRootNode() can be simplified. Simplification are convenient for GUI purpose, but usually not appropriate for programmatic purpose. The simplifications, if allowed, are:

The default value is false.

Returns:
true if the tree can be simplified.
Since:
3.05

setSimplificationAllowed

public void setSimplificationAllowed(boolean allowed)
Sets whatever the tree returned by getRootNode() can be simplified. This parameter is ignored if there is no IIOMetadata instance associated with this MetadataTreeTable.

Parameters:
allowed - true if the tree can be simplified.
Since:
3.05

getRootNode

public MetadataTreeNode getRootNode()
Returns the root of the Tree Table representation of the metadata. If there is no IIOMetadata instance currently set, then returns a representation of the IIOMetadataFormat.

Returns:
The root of a tree representation of the metadata.

toString

public String toString()
Returns a string representation of this tree table. The current implementation formats a tree, but it could change in future Geotk version. Consequently this method should be used for debugging purpose only.

Overrides:
toString in class Object
Since:
3.16


Copyright © 2009-2012 Geotoolkit.org. All Rights Reserved.