de.unibi.techfak.jpredictor.gui
Class MainPanel

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 de.unibi.techfak.jpredictor.gui.MainPanel
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible

public class MainPanel
extends javax.swing.JPanel
implements java.awt.event.ActionListener

The main panel for the GUI, usable in a frame or window or in an applett.

See Also:
Serialized Form

Nested Class Summary
(package private)  class MainPanel.ActionThread
          The thread for doing searching and scoring.
 
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
(package private)  javax.swing.JButton bCancel
           
(package private)  javax.swing.JButton bCutoffCalc
           
(package private)  javax.swing.JButton bMotifMaker
          The global action buttons.
(package private)  javax.swing.JButton bNegBrowse
           
(package private)  javax.swing.JButton bNegSet
           
(package private)  javax.swing.JButton bOutBrowse
           
(package private)  javax.swing.JButton bPosBrowse
           
(package private)  javax.swing.JButton bPosSet
           
(package private)  javax.swing.JButton bScoreSequ
           
(package private)  javax.swing.JButton bSearchMotifs
           
(package private)  javax.swing.JButton bSequBrowse
           
(package private)  javax.swing.JButton bSequSet
          Some global buttons for sequences.
(package private)  java.lang.String[] buttonTexts
          The text for the buttons.
(package private)  javax.swing.JButton bWeightMotifs
           
(package private)  javax.swing.JCheckBox cbAppend
           
(package private)  javax.swing.JCheckBox cbGraphOutput
           
(package private)  javax.swing.JCheckBox cbLengthNorm
           
(package private)  javax.swing.JCheckBox cbMotifOcc
           
(package private)  javax.swing.JCheckBox cbNegFile
           
(package private)  javax.swing.JCheckBox cbOverwrite
           
(package private)  javax.swing.JCheckBox cbPosFile
           
(package private)  javax.swing.JCheckBox cbSelectMulti
           
(package private)  javax.swing.JCheckBox cbSelectSingle
           
(package private)  javax.swing.JCheckBox cbSequFile
          Checkboxes.
(package private)  javax.swing.JCheckBox cbTextOutput
           
protected  ICommunicator comm
          The saved communicator, used to 'talk' to the operator, what means, doing all settings and gettings through it.
(package private) static java.lang.String ERROR
          The string "Error" for varios uses.
(package private)  javax.swing.JFileChooser fileChooser
          The file chooser used in this window, its always used the same filechooser when browsing for files.
(package private)  javax.swing.JMenuBar menuBar
          Global setting whether a menu is already created or not.
protected  MotifMaker motifMaker
          The motif maker to be used by this class.
(package private)  MotifCheckTree motifTree
          The tree of motifs in a panel.
protected  Operator op
          The saved operator, which performs all tasks on the sequences by using the motifs.
(package private)  java.awt.Window parent
          The parent of this panel.
(package private) static java.lang.String PASTED_SEQU
          The string which is shown in the file text fields, when a sequence was pasted instead of a set filename.
(package private)  TextInsertDialog sequenceInput
          The input form for the sequences.
(package private)  javax.swing.JTextArea taError
          The text area for the error messages.
(package private)  javax.swing.JTextArea taOutput
          The text area for the output.
(package private)  javax.swing.JTextField tfCutoff
           
(package private)  javax.swing.JTextField tfNegFile
           
(package private)  javax.swing.JTextField tfOutFile
           
(package private)  javax.swing.JTextField tfPosFile
           
(package private)  javax.swing.JTextField tfSequFile
          The textfields.
(package private)  javax.swing.JTextField tfWindowShift
           
(package private)  javax.swing.JTextField tfWindowWidth
           
 
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, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
MainPanel(java.awt.Window parent, ICommunicator comm, Operator op)
           Simple constructor.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          Handles the events thrown when a button is pressed.
private  void createJMenuBar(MouseOverHintManager hints)
          Creates a JMenu for this panel which may be added to any frame or dialog, preferably to the parent of this panel.
private  javax.swing.JPanel getInputOutputForm(MouseOverHintManager hints)
          Creates and returns the panel for the sequence motif
 javax.swing.JMenuBar getJMenuBar()
          After constructing this class the menu bar can be obtained.
private  javax.swing.JPanel getSettingsForm(MouseOverHintManager hints)
          Creates and returns the panel for the settings
private  void putCommunicatorToForms()
          Stores all information from the static communicator associated with this class in the main windows input forms.
private  boolean putFormsToCommunicator(boolean output)
          Stores all information from the main windows input forms in the static communicator associated with this class.
 
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, 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, 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
 

Field Detail

comm

protected ICommunicator comm
The saved communicator, used to 'talk' to the operator, what means, doing all settings and gettings through it. Given to and set by the constructor.


op

protected Operator op
The saved operator, which performs all tasks on the sequences by using the motifs. Set by the constructor.


PASTED_SEQU

static final java.lang.String PASTED_SEQU
The string which is shown in the file text fields, when a sequence was pasted instead of a set filename.

See Also:
Constant Field Values

ERROR

static final java.lang.String ERROR
The string "Error" for varios uses.

See Also:
Constant Field Values

motifMaker

protected MotifMaker motifMaker
The motif maker to be used by this class. Should only be instanciated if it is null.


parent

java.awt.Window parent
The parent of this panel. If it is an applet it is null.


buttonTexts

java.lang.String[] buttonTexts
The text for the buttons.


bSequSet

javax.swing.JButton bSequSet
Some global buttons for sequences.


bPosSet

javax.swing.JButton bPosSet

bNegSet

javax.swing.JButton bNegSet

bSequBrowse

javax.swing.JButton bSequBrowse

bPosBrowse

javax.swing.JButton bPosBrowse

bNegBrowse

javax.swing.JButton bNegBrowse

bOutBrowse

javax.swing.JButton bOutBrowse

bCancel

javax.swing.JButton bCancel

bMotifMaker

javax.swing.JButton bMotifMaker
The global action buttons.


bSearchMotifs

javax.swing.JButton bSearchMotifs

bWeightMotifs

javax.swing.JButton bWeightMotifs

bScoreSequ

javax.swing.JButton bScoreSequ

bCutoffCalc

javax.swing.JButton bCutoffCalc

tfSequFile

javax.swing.JTextField tfSequFile
The textfields.


tfPosFile

javax.swing.JTextField tfPosFile

tfNegFile

javax.swing.JTextField tfNegFile

tfOutFile

javax.swing.JTextField tfOutFile

tfWindowWidth

javax.swing.JTextField tfWindowWidth

tfWindowShift

javax.swing.JTextField tfWindowShift

tfCutoff

javax.swing.JTextField tfCutoff

cbSequFile

javax.swing.JCheckBox cbSequFile
Checkboxes.


cbPosFile

javax.swing.JCheckBox cbPosFile

cbNegFile

javax.swing.JCheckBox cbNegFile

cbLengthNorm

javax.swing.JCheckBox cbLengthNorm

cbMotifOcc

javax.swing.JCheckBox cbMotifOcc

cbAppend

javax.swing.JCheckBox cbAppend

cbOverwrite

javax.swing.JCheckBox cbOverwrite

cbTextOutput

javax.swing.JCheckBox cbTextOutput

cbGraphOutput

javax.swing.JCheckBox cbGraphOutput

cbSelectSingle

javax.swing.JCheckBox cbSelectSingle

cbSelectMulti

javax.swing.JCheckBox cbSelectMulti

taOutput

javax.swing.JTextArea taOutput
The text area for the output.


taError

javax.swing.JTextArea taError
The text area for the error messages.


motifTree

MotifCheckTree motifTree
The tree of motifs in a panel.


fileChooser

javax.swing.JFileChooser fileChooser
The file chooser used in this window, its always used the same filechooser when browsing for files. This garantees, that the user works always in the directory he changed into for the first time.


sequenceInput

TextInsertDialog sequenceInput
The input form for the sequences.


menuBar

javax.swing.JMenuBar menuBar
Global setting whether a menu is already created or not. Per default menuBar is set in the constructor. If not, it is null and no menu will be drawn.

Constructor Detail

MainPanel

public MainPanel(java.awt.Window parent,
                 ICommunicator comm,
                 Operator op)

Simple constructor. Inits the panel and all components. The communicator and the operator are used to build up certain components, just like the tree of available motifs. If the communicator contains no motif list it is created and inserted.

If the parent is not a window (frame or dialog, which is disposable), set it to null, which means, that no "Close"-button is shown and the parent is not disposed.

Parameters:
parent - The parent of the panel.
comm - The communicator interface.
op - An operator for calling the specified tasks.
Method Detail

getJMenuBar

public javax.swing.JMenuBar getJMenuBar()
After constructing this class the menu bar can be obtained. Calling this method will cause the created menu bar to be returned.

Returns:
The menu bar how it was build while class construction.

createJMenuBar

private void createJMenuBar(MouseOverHintManager hints)
Creates a JMenu for this panel which may be added to any frame or dialog, preferably to the parent of this panel. Should be the last to be called after the file chooser was set.

Parameters:
hints - The manager to register the hints.

getInputOutputForm

private javax.swing.JPanel getInputOutputForm(MouseOverHintManager hints)
Creates and returns the panel for the sequence motif

Parameters:
hints - The manager to register the hints.
Returns:
A panel with all components.

getSettingsForm

private javax.swing.JPanel getSettingsForm(MouseOverHintManager hints)
Creates and returns the panel for the settings

Parameters:
hints - The manager to register the hints.
Returns:
Returns a panel.

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Handles the events thrown when a button is pressed. Must not be called from others than the event dispatching thread due to unintended behaviour.

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
e - The event description.

putCommunicatorToForms

private void putCommunicatorToForms()
Stores all information from the static communicator associated with this class in the main windows input forms.


putFormsToCommunicator

private boolean putFormsToCommunicator(boolean output)
Stores all information from the main windows input forms in the static communicator associated with this class. Prints proper error messages to comm.err(), if wished Corrects wrong input (e.g. for windowWidth and windowShift) with the previous set one.

Parameters:
output - Decides whether error output should be written to comm.err()
Returns:
true iff all forms could be recognized properly, false otherwise.
See Also:
ICommunicator.err()