apollo.dataadapter.chado
Class ChadoAdapterGUI

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 org.bdgp.swing.AbstractDataAdapterUI
                      extended by apollo.dataadapter.chado.ChadoAdapterGUI
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.ItemListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, org.bdgp.io.DataAdapterUI

public class ChadoAdapterGUI
extends org.bdgp.swing.AbstractDataAdapterUI
implements java.awt.event.ActionListener, java.awt.event.ItemListener

In the Apollo data adapter specification each data adapter has two parts: a class that implements the graphical user interface, and a class that interacts with the data source (as directed by the user via the GUI). This is an implementation of the graphical user interface for the corresponding adapter class apollo.dataadapter.chado.ChadoAdapter.

Version:
$Revision: 1.42 $ $Date: 2008-03-05 18:51:44 $ $Author: gk_fan $
Author:
Jonathan Crabtree
See Also:
ChadoAdapter, 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.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  ChadoDatabase[] chado_dbs
          List of Chado databases read by the ChadoAdapter from its configuration file.
protected  javax.swing.JLabel chadoDbPrompt
           
protected  javax.swing.JTextField chadoDbTextField
           
protected static java.lang.String CUSTOM_DB_PROMPT
          Prompt for the pull-down menu that allows the user to select a Chado database from among those read from the Chado adapter's configuration file.
protected static java.lang.String CUSTOM_SEQ_PROMPT
          Prompt for the area in which the user can enter the ID of the sequence he/she wishes to load.
protected  javax.swing.JLabel databaseChoicePrompt
           
protected  javax.swing.JComboBox databaseComboBox
           
protected static java.lang.String[] DRIVER_CLASSES
          NOTE - subclasses of JdbcChadoAdapter must be explicitly added to this list in order to be usable in the Chado adapter.
protected  javax.swing.JComboBox driverClassComboBox
           
protected  javax.swing.JLabel driverClassPrompt
           
protected  javax.swing.JLabel jdbcUrlPrompt
           
protected  javax.swing.JTextField jdbcUrlTextField
           
protected static org.apache.log4j.Logger logger
           
protected  org.bdgp.io.IOOperation operation
          The IOOperation (e.g.
protected  javax.swing.JLabel passwordPrompt
           
protected  javax.swing.JPasswordField passwordTextField
           
protected  javax.swing.JButton seqChoiceButton
           
protected  javax.swing.JComboBox seqChoiceComboBox
           
protected  javax.swing.JLabel seqChoicePrompt
           
protected  javax.swing.JLabel seqIdPrompt
           
protected  javax.swing.JTextField seqIdTextField
          Where seq ids are entered - this should be changed to a drop down list of history
protected  javax.swing.JComboBox seqTypeComboBox
           
protected  javax.swing.JLabel seqTypePrompt
           
protected  java.lang.String[] seqTypes
           
protected  javax.swing.JLabel usernamePrompt
           
protected  javax.swing.JTextField usernameTextField
          Where logins are entered - make this a dropdown history list
 
Fields inherited from class org.bdgp.swing.AbstractDataAdapterUI
driver
 
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
ChadoAdapterGUI(org.bdgp.io.IOOperation operation, ChadoDatabase[] chado_dbs)
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
protected  void clearSeqChoiceComboBox()
          Reset the seqChoiceComboBox to its original state; called when the current database changes.
 void doLayout()
          If this JPanel is not displayed in the parent component, setVisible(boolean) will not have any effect.
 java.lang.Object doOperation(java.lang.Object values)
          The method that actually performs the data adapter operation (presumably by delegating to a data adapter).
protected  ChadoDatabase getChadoDatabaseByName(java.lang.String name)
          Retrieve one of the objects in this.chado_dbs by name.
protected  java.lang.String getComboBoxValue(javax.swing.JComboBox cb)
          Method that extracts the currently-selected value of a JComboBox.
protected  java.lang.String getDriverClass()
           
protected  java.lang.String getJdbcUrl()
           
protected  org.bdgp.io.IOOperation getOperation()
           
protected  java.lang.String getPassword()
           
 java.awt.Dimension getPreferredSize()
          Need a height of 200 to accomodate different UI's for each db.
 java.util.Properties getProperties()
          Returns the UI properties for this DataAdapterUI.
protected  java.lang.String getSelectedSeqType()
           
protected  java.lang.String getSequenceId()
           
protected  java.lang.String getUsername()
           
 void itemStateChanged(java.awt.event.ItemEvent e)
           
protected  void makeReadDataUI()
          Creates the user interface for OP_READ_DATA.
protected  void makeUI()
          Create the UI appropriate for this.op.
 void setProperties(java.util.Properties props)
          Sets UI properties for this DataAdapterUI.
 
Methods inherited from class org.bdgp.swing.AbstractDataAdapterUI
setDataAdapter, setInput
 
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, 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, setEnabled, 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, 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
 

Field Detail

logger

protected static final org.apache.log4j.Logger logger

DRIVER_CLASSES

protected static java.lang.String[] DRIVER_CLASSES
NOTE - subclasses of JdbcChadoAdapter must be explicitly added to this list in order to be usable in the Chado adapter. This is a limitation that could be removed if necessary. Yes - this should come from config.


CUSTOM_DB_PROMPT

protected static java.lang.String CUSTOM_DB_PROMPT
Prompt for the pull-down menu that allows the user to select a Chado database from among those read from the Chado adapter's configuration file.


CUSTOM_SEQ_PROMPT

protected static java.lang.String CUSTOM_SEQ_PROMPT
Prompt for the area in which the user can enter the ID of the sequence he/she wishes to load.


operation

protected org.bdgp.io.IOOperation operation
The IOOperation (e.g. reading/writing) that this object was created to support.


chado_dbs

protected ChadoDatabase[] chado_dbs
List of Chado databases read by the ChadoAdapter from its configuration file.

See Also:
ChadoAdapter.readConfigFile

databaseChoicePrompt

protected javax.swing.JLabel databaseChoicePrompt

databaseComboBox

protected javax.swing.JComboBox databaseComboBox

driverClassPrompt

protected javax.swing.JLabel driverClassPrompt

driverClassComboBox

protected javax.swing.JComboBox driverClassComboBox

jdbcUrlPrompt

protected javax.swing.JLabel jdbcUrlPrompt

jdbcUrlTextField

protected javax.swing.JTextField jdbcUrlTextField

chadoDbPrompt

protected javax.swing.JLabel chadoDbPrompt

chadoDbTextField

protected javax.swing.JTextField chadoDbTextField

usernamePrompt

protected javax.swing.JLabel usernamePrompt

usernameTextField

protected javax.swing.JTextField usernameTextField
Where logins are entered - make this a dropdown history list


passwordPrompt

protected javax.swing.JLabel passwordPrompt

passwordTextField

protected javax.swing.JPasswordField passwordTextField

seqTypes

protected java.lang.String[] seqTypes

seqTypePrompt

protected javax.swing.JLabel seqTypePrompt

seqTypeComboBox

protected javax.swing.JComboBox seqTypeComboBox

seqChoicePrompt

protected javax.swing.JLabel seqChoicePrompt

seqChoiceComboBox

protected javax.swing.JComboBox seqChoiceComboBox

seqChoiceButton

protected javax.swing.JButton seqChoiceButton

seqIdPrompt

protected javax.swing.JLabel seqIdPrompt

seqIdTextField

protected javax.swing.JTextField seqIdTextField
Where seq ids are entered - this should be changed to a drop down list of history

Constructor Detail

ChadoAdapterGUI

public ChadoAdapterGUI(org.bdgp.io.IOOperation operation,
                       ChadoDatabase[] chado_dbs)
Parameters:
operation - The IOOperation that this GUI was invoked to perform.
chado_dbs - A list of Chado database descriptors from which the user may choose.
Method Detail

doLayout

public void doLayout()
If this JPanel is not displayed in the parent component, setVisible(boolean) will not have any effect. So seqQueryPanel will be displayed if it is never displayed for writing operation.

Overrides:
doLayout in class java.awt.Container

getPreferredSize

public java.awt.Dimension getPreferredSize()
Need a height of 200 to accomodate different UI's for each db. May or may not have login. If switch from not having to having a login panel, if the height is not explicitly set the newly added login panel will get squeezed out(as window size is not changing on db change). Is there a better way to do this? Will need to make height larger for databases that provide all the fields (tigr) - for release fixing at 200.

Overrides:
getPreferredSize in class javax.swing.JComponent

setProperties

public void setProperties(java.util.Properties props)
Description copied from interface: org.bdgp.io.DataAdapterUI
Sets UI properties for this DataAdapterUI. The source of these properties is up to the widget that displays the DataAdapterUI. Most of the time these properties will contain some sort of history information and will be loaded from a file. The Properties object may be null if there are no properties to set.

Specified by:
setProperties in interface org.bdgp.io.DataAdapterUI

getProperties

public java.util.Properties getProperties()
Description copied from interface: org.bdgp.io.DataAdapterUI
Returns the UI properties for this DataAdapterUI. These properties may be recorded by the widget that displays the DataAdapterUI and provided to the setDataAdapter method of later instances of the DataAdapterUI. This method may return null if there are no properties to record.

Specified by:
getProperties in interface org.bdgp.io.DataAdapterUI

doOperation

public java.lang.Object doOperation(java.lang.Object values)
                             throws ApolloAdapterException
Description copied from interface: org.bdgp.io.DataAdapterUI
The method that actually performs the data adapter operation (presumably by delegating to a data adapter). The input and outputs to this method are entirely dependant on the operation the data adapter is supposed to perform. The input or output of this method may be null.

Specified by:
doOperation in interface org.bdgp.io.DataAdapterUI
Throws:
ApolloAdapterException

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

itemStateChanged

public void itemStateChanged(java.awt.event.ItemEvent e)
Specified by:
itemStateChanged in interface java.awt.event.ItemListener

getChadoDatabaseByName

protected ChadoDatabase getChadoDatabaseByName(java.lang.String name)
Retrieve one of the objects in this.chado_dbs by name.

Parameters:
name - The human-readable name of one of the databases in chado_dbs
Returns:
The named Chado database descriptor.

makeUI

protected void makeUI()
Create the UI appropriate for this.op.


makeReadDataUI

protected void makeReadDataUI()
Creates the user interface for OP_READ_DATA.


getOperation

protected org.bdgp.io.IOOperation getOperation()
Returns:
The IOOperation this UI was instantiated to perform.

getComboBoxValue

protected java.lang.String getComboBoxValue(javax.swing.JComboBox cb)
Method that extracts the currently-selected value of a JComboBox.

Parameters:
cb - The aforementioned JComboBox
Returns:
The currently-selected String, or null if there is not a unique String-valued current selection.

clearSeqChoiceComboBox

protected void clearSeqChoiceComboBox()
Reset the seqChoiceComboBox to its original state; called when the current database changes.


getDriverClass

protected java.lang.String getDriverClass()

getJdbcUrl

protected java.lang.String getJdbcUrl()

getUsername

protected java.lang.String getUsername()

getPassword

protected java.lang.String getPassword()

getSelectedSeqType

protected java.lang.String getSelectedSeqType()

getSequenceId

protected java.lang.String getSequenceId()