# Class TapMetaTreeModel

java.lang.Object
uk.ac.starlink.vo.TapMetaTreeModel

All Implemented Interfaces:
  `TreeModel`

public class TapMetaTreeModel extends Object implements TreeModel
TreeModel for representing a TAP table set.

Since:
  11 Feb 2015
Author:
  Mark Taylor

## Constructor Summary

Constructors
Constructor
Description
`TapMetaTreeModel(SchemaMeta[] schemas, TapMetaOrder order)`
Constructs a tree model to display a given table set.

## Method Summary

Modifier and Type
Method
Description
`void`
`addTreeModelListener(TreeModelListener lnr)`
`Object`
`getChild(Object parent, int index)`
`int`
`getChildCount(Object parent)`
`int`
`getIndexOfChild(Object parent, Object child)`
`TapMetaOrder`
`getOrder()`
Returns the node ordering being used by this model.
`TreePath`
`getPathForTableName(String tname)`
Returns the path in this tree that corresponds to a given table name.
`Object`
`getRoot()`
`static SchemaMeta`
`getSchema(TreePath path)`
Acquires the schema metadata object, if any, associated with a given tree path.
`SchemaMeta[]`
`getSchemas()`
Returns the schemas array that forms the root of this tree model.
`static TableMeta`
`getTable(TreePath path)`
Acquires the table metadata object, if any, associated with a given tree path.
`boolean`
`isLeaf(Object node)`
`void`
`removeTreeModelListener(TreeModelListener lnr)`
`void`
`setOrder(TapMetaOrder order)`
Sets the node ordering to be used by this model.
`void`
`setSchemas(SchemaMeta[] schemas)`
Sets the content of this tree.
`void`
`valueForPathChanged(TreePath path, Object newValue)`

### Methods inherited from class Object

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

## Constructor Details

### TapMetaTreeModel

public TapMetaTreeModel(SchemaMeta[] schemas, TapMetaOrder order)
Constructs a tree model to display a given table set. Note this may reorder the schemas array in place, and the table ordering within each schema.

Parameters:
  `schemas` - schema array defining the table metadata to be represented
  `order` - initial ordering policy for contents

## Method Details

### setSchemas

public void setSchemas(SchemaMeta[] schemas)
Sets the content of this tree. Note this may reorder the schemas array in place, and the table ordering within each schema.

Parameters:
  `schemas` - schema array defining the table metadata to be represented

### getOrder

public TapMetaOrder getOrder()
Returns the node ordering being used by this model.

Returns:
  ordering

### setOrder

public void setOrder(TapMetaOrder order)
Sets the node ordering to be used by this model.

Parameters:
  `order` - ordering

### getSchemas

public SchemaMeta[] getSchemas()
Returns the schemas array that forms the root of this tree model.

Returns:
  schema array

### getPathForTableName

public TreePath getPathForTableName(String tname)
Returns the path in this tree that corresponds to a given table name.

Parameters:
  `tname` - table name
Returns:
  path in tree corresponding to table name, or null

### getRoot

public Object getRoot()

Specified by:
  `getRoot` in interface `TreeModel`

### isLeaf

public boolean isLeaf(Object node)

Specified by:
  `isLeaf` in interface `TreeModel`

### getChildCount

public int getChildCount(Object parent)

Specified by:
  `getChildCount` in interface `TreeModel`

### getChild

public Object getChild(Object parent, int index)

Specified by:
  `getChild` in interface `TreeModel`

### getIndexOfChild

public int getIndexOfChild(Object parent, Object child)

Specified by:
  `getIndexOfChild` in interface `TreeModel`

### valueForPathChanged

public void valueForPathChanged(TreePath path, Object newValue)

Specified by:
  `valueForPathChanged` in interface `TreeModel`

### addTreeModelListener

public void addTreeModelListener(TreeModelListener lnr)

Specified by:
  `addTreeModelListener` in interface `TreeModel`

### removeTreeModelListener

public void removeTreeModelListener(TreeModelListener lnr)

Specified by:
  `removeTreeModelListener` in interface `TreeModel`

### getTable

public static TableMeta getTable(TreePath path)
Acquires the table metadata object, if any, associated with a given tree path.

Parameters:
  `path` - tree path associated with an instance of this class
Returns:
  associated TableMeta object, or null

### getSchema

public static SchemaMeta getSchema(TreePath path)
Acquires the schema metadata object, if any, associated with a given tree path.

Parameters:
  `path` - tree path associated with an instance of this class
Returns:
  associated SchemaMeta object, or null