net.agmodel.utilBean
Class DataSourceBean

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JPanel
                          |
                          +--net.agmodel.utilBean.DataSourceBean
All Implemented Interfaces:
Accessible, EventListener, ImageObserver, MenuContainer, Resourceable, Serializable, ServiceBeanListener
Direct Known Subclasses:
ChizuSourceBean, DEMSourceBean, MetSourceBean

public abstract class DataSourceBean
extends JPanel
implements Serializable, ServiceBeanListener, Resourceable

An abstract class for allowing a user to select from a list of the data sources (databases) connected to a broker.
Sends DataSourceEvents to registered listeners.

See Also:
Serialized Form

Nested Class Summary
protected  class DataSourceBean.ConnectThread
           
 
Field Summary
protected  JComboBox dataSourceList
           
protected  ArrayList dataSourceListeners
           
protected  boolean forceEventPropagation
           
protected  ActionListener sourceComboListener
           
 
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
DataSourceBean()
          Creates a data source bean.
 
Method Summary
 void addDataSourceListener(DataSourceListener l)
          Adds a listener to be informed when a different data source is selected
protected  void clearRequestedIDs()
           
protected  void dataSourceList_actionPerformed(ActionEvent e)
           
protected  void fireDataSourceEvent(DataSourceEvent evt)
           
protected abstract  void fireSourceSpecificEvent(DataSourceListener listener, DataSourceEvent evt)
           
protected  DataSourceEvent getHTTPEvent()
           
protected  DataSourceEvent getRMIEvent()
           
 void newConnection(ServiceBeanEvent evt)
          Called by a broker when a new connection is established.
 void removeDataSourceListener(DataSourceListener l)
           
protected  void setBeanText()
           
protected  void setCurrentDataSource(DataSourceDetail source)
          Sets the currently selected DataSource.
 void setResourceServerBean(ResourceBean bean)
          The component should register its internal text elements with the ResourceBean
 void setSource(String sourceID)
          Lets a calling application set the combo box to a particular source.
protected  boolean setSourceCombo(String requestedSourceID)
          Sets the SourceCombo to the requested value, if it can find it.
protected  void setUpBean()
           
 
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

forceEventPropagation

protected transient volatile boolean forceEventPropagation

dataSourceListeners

protected transient volatile ArrayList dataSourceListeners

dataSourceList

protected JComboBox dataSourceList

sourceComboListener

protected transient ActionListener sourceComboListener
Constructor Detail

DataSourceBean

public DataSourceBean()
Creates a data source bean.

Method Detail

setBeanText

protected void setBeanText()

setUpBean

protected void setUpBean()

fireDataSourceEvent

protected void fireDataSourceEvent(DataSourceEvent evt)

fireSourceSpecificEvent

protected abstract void fireSourceSpecificEvent(DataSourceListener listener,
                                                DataSourceEvent evt)

addDataSourceListener

public void addDataSourceListener(DataSourceListener l)
Adds a listener to be informed when a different data source is selected

Parameters:
l - the listener to register

removeDataSourceListener

public void removeDataSourceListener(DataSourceListener l)

clearRequestedIDs

protected void clearRequestedIDs()

dataSourceList_actionPerformed

protected void dataSourceList_actionPerformed(ActionEvent e)

setSourceCombo

protected boolean setSourceCombo(String requestedSourceID)
Sets the SourceCombo to the requested value, if it can find it. Otherwise sets it to the first value


newConnection

public void newConnection(ServiceBeanEvent evt)
Called by a broker when a new connection is established. Initiates the downloading of data source details from the broker.

Specified by:
newConnection in interface ServiceBeanListener
Parameters:
evt - contact details for the server.

getRMIEvent

protected DataSourceEvent getRMIEvent()

getHTTPEvent

protected DataSourceEvent getHTTPEvent()

setCurrentDataSource

protected void setCurrentDataSource(DataSourceDetail source)
Sets the currently selected DataSource.
This is a bound property.


setSource

public void setSource(String sourceID)
Lets a calling application set the combo box to a particular source.
Sets the SourceCombo to the requested value, if it can find it.
Otherwise sets it to the first value.
Has no effect if the bean has not yet established a connection to the broker.
Note that newConnection() must have been called by the broker bean in order to load the list of values from the broker before this method can be used.

Parameters:
sourceID - the id of the source.

setResourceServerBean

public void setResourceServerBean(ResourceBean bean)
Description copied from interface: Resourceable
The component should register its internal text elements with the ResourceBean

Specified by:
setResourceServerBean in interface Resourceable