public class QueryTreeBrowser
extends java.lang.Object
The QueryTreeBrowser
class implements a Swing graphical user interface
to browse the contents of QueryTreeModel
.
The browser is rendered as a tree view of the returned query identifier and a one row tabular representation of the contents of any level that the user selects in the tree. Constructors are provided to either add the browser to a frame and creating the tree and table, or to make use of a pair of existing scrolling panes.
Though a functional browser can be built using this class, to add application-specific behavior
to be applied when a user selects from the tree, a sub-class inheriting
from this class should be constructed that overrides the
buildTreeSelectionListenerToDoSomethingWithSelectedLevel
method The default implementation is as follows:
protected TreeSelectionListener buildTreeSelectionListenerToDoSomethingWithSelectedLevel() { return new TreeSelectionListener() { public void valueChanged(TreeSelectionEvent tse) { TreePath tp = tse.getNewLeadSelectionPath(); if (tp != null) { Object lastPathComponent = tp.getLastPathComponent(); if (lastPathComponent instanceof QueryTreeRecord) { QueryTreeRecord r = (QueryTreeRecord)lastPathComponent; System.err.println("TreeSelectionListener.valueChanged: "+r.getUniqueKeys()); } } } }; }
com.pixelmed.query
,
QueryTreeRecord
,
QueryTreeModel
,
TreePath
,
TreeSelectionListener
Constructor and Description |
---|
QueryTreeBrowser(QueryInformationModel q,
QueryTreeModel m,
java.awt.Container content)
Build and display a graphical user interface view of a database information model.
|
QueryTreeBrowser(QueryInformationModel q,
QueryTreeModel m,
javax.swing.JFrame frame)
Build and display a graphical user interface view of a database information model.
|
QueryTreeBrowser(QueryInformationModel q,
QueryTreeModel m,
javax.swing.JScrollPane treeBrowserScrollPane,
javax.swing.JScrollPane attributeBrowserScrollPane)
Build and display a graphical user interface view of a database information model.
|
Modifier and Type | Method and Description |
---|---|
protected javax.swing.event.TreeSelectionListener |
buildTreeSelectionListenerToDisplayAttributesOfSelectedRecord(javax.swing.JScrollPane attributeBrowserScrollPane)
By default this method populates the tabular attribute browser when an entity is selected in the tree browser.
|
protected javax.swing.event.TreeSelectionListener |
buildTreeSelectionListenerToDoSomethingWithSelectedLevel()
Override this method to perform application-specific behavior when an entity is selected in the tree browser.
|
QueryTreeRecord[] |
getSelectionPaths()
Return the records currently selected.
|
public QueryTreeBrowser(QueryInformationModel q, QueryTreeModel m, java.awt.Container content) throws DicomException
Build and display a graphical user interface view of a database information model.
q
- the query information modelm
- the query tree model (i.e. the results returned from an actual query)content
- content pane will to add scrolling panes containing tree and tabular selection viewsDicomException
- thrown if the information cannot be extractedpublic QueryTreeBrowser(QueryInformationModel q, QueryTreeModel m, javax.swing.JFrame frame) throws DicomException
Build and display a graphical user interface view of a database information model.
q
- the query information modelm
- the query tree model (i.e. the results returned from an actual query)frame
- a frame to whose content pane will be added scrolling panes containing tree and tabular selection viewsDicomException
- thrown if the information cannot be extractedpublic QueryTreeBrowser(QueryInformationModel q, QueryTreeModel m, javax.swing.JScrollPane treeBrowserScrollPane, javax.swing.JScrollPane attributeBrowserScrollPane) throws DicomException
Build and display a graphical user interface view of a database information model.
q
- the query information modelm
- the query tree model (i.e. the results returned from an actual query)treeBrowserScrollPane
- the scrolling pane in which the tree view of the query results will be renderedattributeBrowserScrollPane
- the scrolling pane in which the tabular view of the currently selected level will be renderedDicomException
- thrown if the information cannot be extractedprotected javax.swing.event.TreeSelectionListener buildTreeSelectionListenerToDisplayAttributesOfSelectedRecord(javax.swing.JScrollPane attributeBrowserScrollPane)
By default this method populates the tabular attribute browser when an entity is selected in the tree browser.
Override this method to perform application-specific behavior, perhaps if not all attributes in the query identifer for the selected level are to be displayed, or their values are to be rendered specially. The default implementation renders everything as strings.
attributeBrowserScrollPane
- the tabular attribute browserprotected javax.swing.event.TreeSelectionListener buildTreeSelectionListenerToDoSomethingWithSelectedLevel()
Override this method to perform application-specific behavior when an entity is selected in the tree browser.
By default this method dumps the string values of the unique keys to the console for level selection, which is pretty useless.
public QueryTreeRecord[] getSelectionPaths()
Return the records currently selected.