Class RegistryPanel

  • All Implemented Interfaces:
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

    public class RegistryPanel
    extends javax.swing.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:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class javax.swing.JPanel

        javax.swing.JPanel.AccessibleJPanel
      • Nested classes/interfaces inherited from class javax.swing.JComponent

        javax.swing.JComponent.AccessibleJComponent
      • Nested classes/interfaces inherited from class java.awt.Container

        java.awt.Container.AccessibleAWTContainer
      • Nested classes/interfaces inherited from class java.awt.Component

        java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
    • Field Summary

      • Fields inherited from class javax.swing.JComponent

        listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • Fields inherited from class java.awt.Component

        accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • Fields inherited from interface java.awt.image.ImageObserver

        ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addActionListener​(java.awt.event.ActionListener listener)
      Adds a listener to be notified when one of the resources has been selected (currently, double-click or hit Enter).
      void cancelQuery()
      Invoked when the cancel button is pressed.
      void displayAdviceMessage​(java.lang.String[] lines)
      Displays a user-directed message in the panel which contains the results table.
      protected void fireAction()
      Sends an action event to all registered action listeners.
      RegCapabilityInterface[] getCapabilities​(RegResource resource)
      Returns an array of all the relevant capabilities of a given resource.
      javax.swing.ListSelectionModel getCapabilitySelectionModel()
      Returns the selection model used by the user to select capability items from a completed query.
      javax.swing.JComponent getControlBox()
      Returns a container into which (small) additional controls can be added.
      javax.swing.Action getRegistryUpdateAction()
      Returns an action which will update the list of registries by making a search in the registry for suitable registry entries.
      RegResource[] getResources()
      Returns an array of all the results from the most recently completed registry query.
      javax.swing.ListSelectionModel getResourceSelectionModel()
      Returns the selection model used by the user to select resource items from a completed query.
      RegCapabilityInterface[] getSelectedCapabilities()
      Returns an array of all the capabilities associated with the currently selected resource which are themselves currently selected.
      RegResource[] getSelectedResources()
      Returns an array of any of the results from the most recent registry query which are currently selected by the user.
      javax.swing.Action getSubmitQueryAction()
      Returns the action for submitting the query described by this component's current state.
      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.
      javax.swing.JMenu makeColumnVisibilityMenu​(java.lang.String name)
      Constructs a menu which allows the user to select which attributes of each displayed resource are visible.
      void performAutoQuery​(java.lang.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.
      void performQuery​(RegistryQuery query, java.lang.String workingMessage)
      Submits a query and inserts the results, when ready, into this panel.
      void removeActionListener​(java.awt.event.ActionListener listener)
      Removes a listener previously added by addActionListener.
      void setEnabled​(boolean enabled)  
      void submitQuery()
      Invoked when the Submit button is pressed.
      • Methods inherited from class javax.swing.JPanel

        getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
      • Methods inherited from class javax.swing.JComponent

        addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
      • Methods inherited from class java.awt.Container

        add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
      • Methods inherited from class java.awt.Component

        action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • 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 Detail

      • performAutoQuery

        public void performAutoQuery​(java.lang.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 -
        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,
                                 java.lang.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 javax.swing.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 javax.swing.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​(java.lang.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 javax.swing.Action getSubmitQueryAction()
        Returns the action for submitting the query described by this component's current state.
        Returns:
        submit query action
      • makeColumnVisibilityMenu

        public javax.swing.JMenu makeColumnVisibilityMenu​(java.lang.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 javax.swing.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 javax.swing.JComponent getControlBox()
        Returns a container into which (small) additional controls can be added.
        Returns:
        control box
      • addActionListener

        public void addActionListener​(java.awt.event.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​(java.awt.event.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 javax.swing.JComponent