Class QueryTreeBrowser

java.lang.Object
com.pixelmed.query.QueryTreeBrowser
Direct Known Subclasses:
DicomCleaner.OurQueryTreeBrowser, DoseUtility.OurQueryTreeBrowser, DownloadOrTransmit.OurQueryTreeBrowser

public class QueryTreeBrowser extends 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());
                                        }
                                }
                        }
                };
        }
 
See Also:
  • Constructor Details

    • QueryTreeBrowser

      public QueryTreeBrowser(QueryInformationModel q, QueryTreeModel m, JScrollPane treeBrowserScrollPane, JScrollPane attributeBrowserScrollPane) throws DicomException

      Build and display a graphical user interface view of a database information model.

      Parameters:
      q - the query information model
      m - 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 rendered
      attributeBrowserScrollPane - the scrolling pane in which the tabular view of the currently selected level will be rendered
      Throws:
      DicomException - thrown if the information cannot be extracted
    • QueryTreeBrowser

      public QueryTreeBrowser(QueryInformationModel q, QueryTreeModel m, Container content) throws DicomException

      Build and display a graphical user interface view of a database information model.

      Parameters:
      q - the query information model
      m - 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 views
      Throws:
      DicomException - thrown if the information cannot be extracted
    • QueryTreeBrowser

      public QueryTreeBrowser(QueryInformationModel q, QueryTreeModel m, JFrame frame) throws DicomException

      Build and display a graphical user interface view of a database information model.

      Parameters:
      q - the query information model
      m - 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 views
      Throws:
      DicomException - thrown if the information cannot be extracted
  • Method Details

    • getSelectionPaths

      public QueryTreeRecord[] getSelectionPaths()

      Return the records currently selected.

      Returns:
      the records currently selected
    • buildTreeSelectionListenerToDoSomethingWithSelectedLevel

      protected 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.

    • buildTreeSelectionListenerToDisplayAttributesOfSelectedRecord

      protected TreeSelectionListener buildTreeSelectionListenerToDisplayAttributesOfSelectedRecord(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.

      Parameters:
      attributeBrowserScrollPane - the tabular attribute browser