uk.ac.starlink.vo
Class RegistryPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by uk.ac.starlink.vo.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:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class javax.swing.JComponent
accessibleContext, 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
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
 
Constructor Summary
RegistryPanel(RegistryQueryFactory queryFactory, boolean showCapabilities)
          Constructs a RegistryPanel.
 
Method Summary
 void addActionListener(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(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.
 ListSelectionModel getCapabilitySelectionModel()
          Returns the selection model used by the user to select capability items from a completed query.
 JComponent getControlBox()
          Returns a container into which (small) additional controls can be added.
 RegResource[] getResources()
          Returns an array of all the results from the most recently completed registry query.
 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.
 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.
 JMenu makeColumnVisibilityMenu(String name)
          Constructs a menu which allows the user to select which attributes of each displayed resource are visible.
 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.
 void performQuery(RegistryQuery query, String workingMessage)
          Submits a query and inserts the results, when ready, into this panel.
 void removeActionListener(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, 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, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, 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, transferFocusBackward, 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, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, 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, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, 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(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,
                         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

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


Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.