Package uk.ac.starlink.vo
Class TapServiceTreeModel
java.lang.Object
uk.ac.starlink.vo.TapServiceTreeModel
- All Implemented Interfaces:
TreeModel
TreeModel implementation representing a particular set of tables
contained in a list of known TAP services.
- Since:
- 30 Jun 2015
- Author:
- Mark Taylor
-
Constructor Summary
ConstructorsModifierConstructorDescriptionTapServiceTreeModel
(String rootLabel) Constructs an instance with no entries.protected
TapServiceTreeModel
(String rootLabel, TapServiceFinder.Service[] services, Map<TapServiceFinder.Service, TapServiceFinder.Table[]> tableMap) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
static TreeCellRenderer
Returns a cell renderer suitable for rendering nodes of a JTree using a model of this class.int
getChildCount
(Object parent) int
getIndexOfChild
(Object parent, Object child) getRoot()
static TapServiceFinder.Service
getService
(TreePath path) Returns a service in the ancestry of a supplied path.static TreePath
getServicePath
(TreePath path) Returns a tree path which correponds to a TAP service, and which is an ancestor of the supplied path.static TapServiceFinder.Table
Returns a table that forms part of a supplied path.boolean
static TapServiceTreeModel
readTreeModel
(TapServiceFinder.Service[] allServices, TapServiceFinder finder, TapServiceFinder.Constraint constraint) Constructs a tree model based on some given constraints.void
void
valueForPathChanged
(TreePath path, Object newValue)
-
Constructor Details
-
TapServiceTreeModel
protected TapServiceTreeModel(String rootLabel, TapServiceFinder.Service[] services, Map<TapServiceFinder.Service, TapServiceFinder.Table[]> tableMap) Constructor.- Parameters:
rootLabel
- text label for root element (may be null)services
- list of services nodes in treetableMap
- array of tables providing child nodes for each service; may be null if no table children are required, but if not null must contain an entry for each service
-
TapServiceTreeModel
Constructs an instance with no entries.- Parameters:
rootLabel
- text label for root element (may be null)
-
-
Method Details
-
getRoot
-
isLeaf
-
getChildCount
- Specified by:
getChildCount
in interfaceTreeModel
-
getChild
-
getIndexOfChild
- Specified by:
getIndexOfChild
in interfaceTreeModel
-
valueForPathChanged
- Specified by:
valueForPathChanged
in interfaceTreeModel
-
addTreeModelListener
- Specified by:
addTreeModelListener
in interfaceTreeModel
-
removeTreeModelListener
- Specified by:
removeTreeModelListener
in interfaceTreeModel
-
getServicePath
Returns a tree path which correponds to a TAP service, and which is an ancestor of the supplied path. The supplied path counts as its own ancestor for these purposes.- Parameters:
path
- path to examine- Returns:
- path corresponding to a sub-path of the supplied one, for which the terminal element is a TapServiceFinder.Service, or null if no service appears in the ancestry
-
getService
Returns a service in the ancestry of a supplied path. The supplied path counts as its own ancestor for these purposes.- Parameters:
path
- path to examine- Returns:
- service owning the path, or null if no service appears in the ancestry
-
getTable
Returns a table that forms part of a supplied path.- Parameters:
path
- path to examine- Returns:
- table at the end of the path, or null if there isn't one
-
readTreeModel
public static TapServiceTreeModel readTreeModel(TapServiceFinder.Service[] allServices, TapServiceFinder finder, TapServiceFinder.Constraint constraint) throws IOException Constructs a tree model based on some given constraints. May require a read of service data, hence should not be executed on the Event Dispatch Thread.- Parameters:
allServices
- list of all services that may be relevantfinder
- object that can search for TAP servicesconstraint
- defines the services of interest; if null, all are used- Returns:
- tree model
- Throws:
IOException
-
createCellRenderer
Returns a cell renderer suitable for rendering nodes of a JTree using a model of this class.- Returns:
- tree cell renderer
-