uk.org.ogsadai.client.databrowser
Class DBDataServiceView

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JPanel
                          |
                          +--uk.org.ogsadai.client.databrowser.DBDataServiceView
All Implemented Interfaces:
javax.accessibility.Accessible, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.util.Observer, java.io.Serializable, javax.swing.event.TreeSelectionListener

public class DBDataServiceView
extends javax.swing.JPanel
implements java.util.Observer, javax.swing.event.TreeSelectionListener

View panel for displaying the available data services. A View in the MVC pattern. Registers itself as an observer of the Model for updates. In this case updates occur when the data services list maintained in the model changes. Maintains a list of previously accessed data services.

Author:
Paul J Graham, EPCC
See Also:
Serialized Form

Nested Class Summary
private  class DBDataServiceView.DataServiceViewObservable
          Inner class to allow this Observer to be Observed.
 
Field Summary
private static java.lang.String COPYRIGHT_NOTICE
          Copyright statement
private static java.lang.String DATA_SERVICES_HISTORY_FILE
           
private  javax.swing.JTree mActiveTree
          List of the currently displayed DAISGR
private  java.util.Vector mHistoryList
          List of previously used DAISGR
private  DBDataServiceView.DataServiceViewObservable mObservable
           
private static int NUM_VISIBLE_ROWS
           
 
Fields inherited from class javax.swing.JPanel
 
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.Container
 
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
DBDataServiceView(java.util.Observable model)
          Construct a panel displaying the current list of service group registries.
 
Method Summary
 void addObserver(java.util.Observer observer)
          Add an observer to this class to be notified of tree selection changes.
private  void compare()
          Compares the DAISGR URLs in the historyList_ with those in the activeList_.
 DBDataService[] getDataServices()
           
 DBDataResource getSelectedDataResource()
          Returns the currently selected data resource
 DBDataService getSelectedDataService()
           
 java.util.Vector getURLs()
          Returns the list of previously used data service URLs
private  void initialise()
          Initialise this view
private  void loadDataServices()
          Loads previously used DAISGR from file.
private  void saveDataServices()
          Saves the list of previously used DAISGR including any new additions.
 void update(java.util.Observable observable, java.lang.Object updatedObject)
           
 void valueChanged(javax.swing.event.TreeSelectionEvent event)
           
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, 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, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, 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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, 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
 

Field Detail

COPYRIGHT_NOTICE

private static final java.lang.String COPYRIGHT_NOTICE
Copyright statement

See Also:
Constant Field Values

DATA_SERVICES_HISTORY_FILE

private static final java.lang.String DATA_SERVICES_HISTORY_FILE
See Also:
Constant Field Values

NUM_VISIBLE_ROWS

private static final int NUM_VISIBLE_ROWS
See Also:
Constant Field Values

mActiveTree

private javax.swing.JTree mActiveTree
List of the currently displayed DAISGR


mHistoryList

private java.util.Vector mHistoryList
List of previously used DAISGR


mObservable

private DBDataServiceView.DataServiceViewObservable mObservable
Constructor Detail

DBDataServiceView

public DBDataServiceView(java.util.Observable model)
Construct a panel displaying the current list of service group registries.

Parameters:
model - The model containing the DAISGR list that this view will observe
Method Detail

loadDataServices

private void loadDataServices()
Loads previously used DAISGR from file.


saveDataServices

private void saveDataServices()
Saves the list of previously used DAISGR including any new additions.


initialise

private void initialise()
Initialise this view


getSelectedDataService

public DBDataService getSelectedDataService()
Returns:
The currently selected data service or null if none is selected

getSelectedDataResource

public DBDataResource getSelectedDataResource()
Returns the currently selected data resource

Returns:
the currently selected data resource or null

update

public void update(java.util.Observable observable,
                   java.lang.Object updatedObject)
Specified by:
update in interface java.util.Observer

compare

private void compare()
Compares the DAISGR URLs in the historyList_ with those in the activeList_. If they are not already in the history then they are added to the list and saved.


getURLs

public java.util.Vector getURLs()
Returns the list of previously used data service URLs

Returns:
a list of URLs

getDataServices

public DBDataService[] getDataServices()

addObserver

public void addObserver(java.util.Observer observer)
Add an observer to this class to be notified of tree selection changes.

Parameters:
observer - The observer to be updated

valueChanged

public void valueChanged(javax.swing.event.TreeSelectionEvent event)
Specified by:
valueChanged in interface javax.swing.event.TreeSelectionListener