Class RegistryPanel

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class RegistryPanel extends JPanel
Displays the parameters of a registry query and its results. The URL of a registry and the text of a query are displayed at the top of the window, with query submit and cancel buttons. When the submit button is pushed, the specified query is performed asynchronously on the selected registry.

Subclasses can be notified of the completion of a successful query by overriding the gotData(uk.ac.starlink.vo.RegResource[]) method.

Since:
21 Dec 2004
Author:
Mark Taylor (Starlink)
See Also:
  • Constructor Details

    • RegistryPanel

      public RegistryPanel(RegistryQueryFactory queryFactory, boolean showCapabilities)
      Constructs a RegistryPanel.
      Parameters:
      queryFactory - object which supplies the query details; if it has a graphical component, that will be displayed for the user to interact with
      showCapabilities - true to display a selectable table of RegCapabilityInterfaces below the table of RegResources
  • Method Details

    • performAutoQuery

      public void performAutoQuery(String workingMsg)
      Invoking this method withdraws the parts of the GUI which permit the user to specify a registry query, and peforms a fixed query without further ado. This effect cannot be reversed.
      Parameters:
      workingMsg - message to display near progress bar while query is ongoing
    • gotData

      protected void gotData(RegResource[] resources)
      Called from the event dispatch thread when a successful registry query which returns 1 or more records has been completed. The default implementation does nothing.
      Parameters:
      resources - non-empty array of resources returned from a successful query
    • getResources

      public RegResource[] getResources()
      Returns an array of all the results from the most recently completed registry query.
      Returns:
      list of query results
    • getCapabilities

      public RegCapabilityInterface[] getCapabilities(RegResource resource)
      Returns an array of all the relevant capabilities of a given resource.
      Parameters:
      resource - resource
      Returns:
      capability list
    • getSelectedResources

      public RegResource[] getSelectedResources()
      Returns an array of any of the results from the most recent registry query which are currently selected by the user.
      Returns:
      list of any selected query results
    • getSelectedCapabilities

      public RegCapabilityInterface[] getSelectedCapabilities()
      Returns an array of all the capabilities associated with the currently selected resource which are themselves currently selected. In the case that there is no capabilities table displayed, it's assumed that all capabilities of the selected resource are selected.
      Returns:
      capability list
    • submitQuery

      public void submitQuery()
      Invoked when the Submit button is pressed. Performs an asynchronous query on the registry.
    • performQuery

      public void performQuery(RegistryQuery query, String workingMessage)
      Submits a query and inserts the results, when ready, into this panel.
      Parameters:
      query - query to execute
      workingMessage - text to display to user while query is running
    • cancelQuery

      public void cancelQuery()
      Invoked when the cancel button is pressed. Deactivates the current query.
    • getResourceSelectionModel

      public ListSelectionModel getResourceSelectionModel()
      Returns the selection model used by the user to select resource items from a completed query.
      Returns:
      selection model (each item will be a RegResource
    • getCapabilitySelectionModel

      public ListSelectionModel getCapabilitySelectionModel()
      Returns the selection model used by the user to select capability items from a completed query.
      Returns:
      selection model (each item will be a RegCapabilityInterface)
    • displayAdviceMessage

      public void displayAdviceMessage(String[] lines)
      Displays a user-directed message in the panel which contains the results table. This will be obliterated when a query starts or completes; it is intended to contain advice for the user before any query has been initiated.
      Parameters:
      lines - lines of message text (one element per screen line)
    • getSubmitQueryAction

      public Action getSubmitQueryAction()
      Returns the action for submitting the query described by this component's current state.
      Returns:
      submit query action
    • makeColumnVisibilityMenu

      public JMenu makeColumnVisibilityMenu(String name)
      Constructs a menu which allows the user to select which attributes of each displayed resource are visible.
      Parameters:
      name - menu name
    • getRegistryUpdateAction

      public Action getRegistryUpdateAction()
      Returns an action which will update the list of registries by making a search in the registry for suitable registry entries.
      Returns:
      registry update action
    • getControlBox

      public JComponent getControlBox()
      Returns a container into which (small) additional controls can be added.
      Returns:
      control box
    • addActionListener

      public void addActionListener(ActionListener listener)
      Adds a listener to be notified when one of the resources has been selected (currently, double-click or hit Enter).
      Parameters:
      listener - listener to add
    • removeActionListener

      public void removeActionListener(ActionListener listener)
      Removes a listener previously added by addActionListener.
      Parameters:
      listener - listener to remove
    • fireAction

      protected void fireAction()
      Sends an action event to all registered action listeners.
    • setEnabled

      public void setEnabled(boolean enabled)
      Overrides:
      setEnabled in class JComponent