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.protectedTapServiceTreeModel(String rootLabel, TapServiceFinder.Service[] services, Map<TapServiceFinder.Service, TapServiceFinder.Table[]> tableMap) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidstatic TreeCellRendererReturns a cell renderer suitable for rendering nodes of a JTree using a model of this class.intgetChildCount(Object parent) intgetIndexOfChild(Object parent, Object child) getRoot()static TapServiceFinder.ServicegetService(TreePath path) Returns a service in the ancestry of a supplied path.static TreePathgetServicePath(TreePath path) Returns a tree path which correponds to a TAP service, and which is an ancestor of the supplied path.booleanstatic TapServiceTreeModelreadTreeModel(TapServiceFinder.Service[] allServices, TapServiceFinder finder, TapServiceFinder.Constraint constraint) Constructs a tree model based on some given constraints.voidvoidvalueForPathChanged(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:
getChildCountin interfaceTreeModel
-
getChild
-
getIndexOfChild
- Specified by:
getIndexOfChildin interfaceTreeModel
-
valueForPathChanged
- Specified by:
valueForPathChangedin interfaceTreeModel
-
addTreeModelListener
- Specified by:
addTreeModelListenerin interfaceTreeModel
-
removeTreeModelListener
- Specified by:
removeTreeModelListenerin 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
-
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
-