jadex.swing.sequence
Class SequenceDisplay

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--jadex.swing.sequence.SequenceDisplay
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, javax.swing.Scrollable, java.io.Serializable

public class SequenceDisplay
extends javax.swing.JComponent
implements javax.swing.Scrollable

SequenceDisplay.java: Graphics Sequence display designed based on Swing MVC model and renderer method.

See Also:
Serialized Form

Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
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
SequenceDisplay()
          Default constructor
SequenceDisplay(SequenceModel model)
          Second constructor.
 
Method Summary
 void clear()
          Clear up and force to release all resources.
 void clearSelection()
          Clear all selected sequences.
 void deSelectSequence(org.jdom.Element sequence)
          Remove selected sequence.
 void firePropertyChange(java.lang.String name, java.lang.Object oldValue, java.lang.Object newValue)
          Release proteced access to public, so its package class can call it.
 GeneRenderer getGeneRenderer()
          Get the gene renderer.
 SequenceLayoutModel getLayoutModel()
          Get the layoutModel used in this SequenceDisplay.
 MapRange getMapRange()
          Get the current maprange
 SequenceModel getModel()
          Get the sequence model.
 void getMouseAt()
          Get the mouse position in bp unit
 javax.swing.JPopupMenu getPopup()
          Expose the popup to the classes at the same package
 java.awt.Dimension getPreferredScrollableViewportSize()
          Returns the preferred size of the viewport for a view component.
 SequenceRenderer getRenderer()
          Get the sequence renderer.
 int getScrollableBlockIncrement(java.awt.Rectangle p1, int p2, int p3)
          Components that display logical rows or columns should compute the scroll increment that will completely expose one block of rows or columns, depending on the value of orientation.
 boolean getScrollableTracksViewportHeight()
          Horizontal is always in a whole view
 boolean getScrollableTracksViewportWidth()
          Return true if a viewport should always force the width of this Scrollable to match the width of the viewport.
 int getScrollableUnitIncrement(java.awt.Rectangle p1, int p2, int p3)
          Components that display logical rows or columns should compute the scroll increment that will completely expose one new row or column, depending on the value of orientation.
 org.jdom.Element getSelectedSequence()
          Get the selected sequence element.
 java.util.List getSelectedSequences()
          Get the selected sequence elemnet list.
 SequenceSelectionModel getSelectionModel()
          Get the selectionModel used in this SequenceDisplay.
 SequenceUI getUI()
          Get the SequenceUI used in this SequenceDisplay.
static void main(java.lang.String[] args)
           
 void search(java.lang.String name)
          Search a sequence element with the name of name.
 void setGeneRenderer(GeneRenderer renderer)
          Set gene renderer.
 void setLayoutModel(SequenceLayoutModel model)
          Set the layoutModel
 void setMapRange(MapRange range)
          Specify a maprange for this display
 void setModel(SequenceModel model)
          Set the sequence model.
 void setMouseAt(long p)
          Set the mouseAt position in bp unit
 void setPopup(javax.swing.JPopupMenu pop)
          Set up a popup menu
 void setRenderer(SequenceRenderer renderer)
          Set the sequence renderer.
 void setSelectedSequence(org.jdom.Element sequence)
          Set one and only one selected Sequence element.
 void setSelectedSequences(java.util.List list)
          Set a list of selected sequence elements.
 void setSelectionModel(SequenceSelectionModel model)
          Set the selection model
 void setUI(SequenceUI ui)
          Set the SequenceUI.
 void updateUI()
          Create and set SequenceUI for this SequenceDisplay.
 
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, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getUIClassID, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SequenceDisplay

public SequenceDisplay()
Default constructor

SequenceDisplay

public SequenceDisplay(SequenceModel model)
Second constructor.
Parameters:
model - the data model for this SequenceDisplay.
Method Detail

setModel

public void setModel(SequenceModel model)
Set the sequence model.
Parameters:
model - the data model for this SequenceDisplay.

getModel

public SequenceModel getModel()
Get the sequence model.
Returns:
the data model used in this SequenceDisplay.

setRenderer

public void setRenderer(SequenceRenderer renderer)
Set the sequence renderer.
Parameters:
renderer - the SequenceRenderer used for rendering Seqeunce objects in this SequenceDisplay.

getRenderer

public SequenceRenderer getRenderer()
Get the sequence renderer.

setGeneRenderer

public void setGeneRenderer(GeneRenderer renderer)
Set gene renderer.

getGeneRenderer

public GeneRenderer getGeneRenderer()
Get the gene renderer.

setUI

public void setUI(SequenceUI ui)
Set the SequenceUI.
Parameters:
ui - the SequenceUI used in the SequenceDisplay.

getUI

public SequenceUI getUI()
Get the SequenceUI used in this SequenceDisplay.

updateUI

public void updateUI()
Create and set SequenceUI for this SequenceDisplay. This method should be called explicitly for correctly displaying.
Overrides:
updateUI in class javax.swing.JComponent
Following copied from class: javax.swing.JComponent
See Also:
JComponent.setUI(javax.swing.plaf.ComponentUI), UIManager#getLookAndFeel, UIManager#getUI

clear

public void clear()
Clear up and force to release all resources.

setPopup

public void setPopup(javax.swing.JPopupMenu pop)
Set up a popup menu

getPopup

public javax.swing.JPopupMenu getPopup()
Expose the popup to the classes at the same package

setSelectionModel

public void setSelectionModel(SequenceSelectionModel model)
Set the selection model

getSelectionModel

public SequenceSelectionModel getSelectionModel()
Get the selectionModel used in this SequenceDisplay.

setLayoutModel

public void setLayoutModel(SequenceLayoutModel model)
Set the layoutModel

getLayoutModel

public SequenceLayoutModel getLayoutModel()
Get the layoutModel used in this SequenceDisplay.

setSelectedSequence

public void setSelectedSequence(org.jdom.Element sequence)
Set one and only one selected Sequence element.
Parameters:
sequence - the selected seqeunce element.

setSelectedSequences

public void setSelectedSequences(java.util.List list)
Set a list of selected sequence elements.
Parameters:
list - the selected seqeunce element list.

getSelectedSequence

public org.jdom.Element getSelectedSequence()
Get the selected sequence element.
Returns:
the selected sequence element.

getSelectedSequences

public java.util.List getSelectedSequences()
Get the selected sequence elemnet list.
Returns:
the list of the selected sequence elements.

deSelectSequence

public void deSelectSequence(org.jdom.Element sequence)
Remove selected sequence.
Parameters:
sequence - the sequence element to be removed from the selection.

clearSelection

public void clearSelection()
Clear all selected sequences.

setMapRange

public void setMapRange(MapRange range)
Specify a maprange for this display
Parameters:
range - the maprange to be layouted

getMapRange

public MapRange getMapRange()
Get the current maprange
Returns:
the current maprange

setMouseAt

public void setMouseAt(long p)
Set the mouseAt position in bp unit

getMouseAt

public void getMouseAt()
Get the mouse position in bp unit

search

public void search(java.lang.String name)
Search a sequence element with the name of name.
Parameters:
name - the searching key.

firePropertyChange

public void firePropertyChange(java.lang.String name,
                               java.lang.Object oldValue,
                               java.lang.Object newValue)
Release proteced access to public, so its package class can call it.
Overrides:
firePropertyChange in class javax.swing.JComponent
Following copied from class: javax.swing.JComponent
Parameters:
propertyName - the programmatic name of the property that was changed
oldValue - the old value of the property
newValue - the new value of the property
See Also:
PropertyChangeSupport

main

public static void main(java.lang.String[] args)

getScrollableTracksViewportHeight

public boolean getScrollableTracksViewportHeight()
Horizontal is always in a whole view
Specified by:
getScrollableTracksViewportHeight in interface javax.swing.Scrollable
Following copied from interface: javax.swing.Scrollable
Returns:
True if a viewport should force the Scrollables height to match its own.

getScrollableUnitIncrement

public int getScrollableUnitIncrement(java.awt.Rectangle p1,
                                      int p2,
                                      int p3)
Description copied from interface: javax.swing.Scrollable
Components that display logical rows or columns should compute the scroll increment that will completely expose one new row or column, depending on the value of orientation. Ideally, components should handle a partially exposed row or column by returning the distance required to completely expose the item.

Scrolling containers, like JScrollPane, will use this method each time the user requests a unit scroll.

Specified by:
getScrollableUnitIncrement in interface javax.swing.Scrollable
Following copied from interface: javax.swing.Scrollable
Parameters:
visibleRect - The view area visible within the viewport
orientation - Either SwingConstants.VERTICAL or SwingConstants.HORIZONTAL.
direction - Less than zero to scroll up/left, greater than zero for down/right.
Returns:
The "unit" increment for scrolling in the specified direction
See Also:
JScrollBar.setUnitIncrement(int)

getScrollableBlockIncrement

public int getScrollableBlockIncrement(java.awt.Rectangle p1,
                                       int p2,
                                       int p3)
Description copied from interface: javax.swing.Scrollable
Components that display logical rows or columns should compute the scroll increment that will completely expose one block of rows or columns, depending on the value of orientation.

Scrolling containers, like JScrollPane, will use this method each time the user requests a block scroll.

Specified by:
getScrollableBlockIncrement in interface javax.swing.Scrollable
Following copied from interface: javax.swing.Scrollable
Parameters:
visibleRect - The view area visible within the viewport
orientation - Either SwingConstants.VERTICAL or SwingConstants.HORIZONTAL.
direction - Less than zero to scroll up/left, greater than zero for down/right.
Returns:
The "block" increment for scrolling in the specified direction.
See Also:
JScrollBar.setBlockIncrement(int)

getPreferredScrollableViewportSize

public java.awt.Dimension getPreferredScrollableViewportSize()
Description copied from interface: javax.swing.Scrollable
Returns the preferred size of the viewport for a view component. For example the preferredSize of a JList component is the size required to acommodate all of the cells in its list however the value of preferredScrollableViewportSize is the size required for JList.getVisibleRowCount() rows. A component without any properties that would effect the viewport size should just return getPreferredSize() here.
Specified by:
getPreferredScrollableViewportSize in interface javax.swing.Scrollable
Following copied from interface: javax.swing.Scrollable
Returns:
The preferredSize of a JViewport whose view is this Scrollable.
See Also:
JComponent.getPreferredSize()

getScrollableTracksViewportWidth

public boolean getScrollableTracksViewportWidth()
Description copied from interface: javax.swing.Scrollable
Return true if a viewport should always force the width of this Scrollable to match the width of the viewport. For example a noraml text view that supported line wrapping would return true here, since it would be undesirable for wrapped lines to disappear beyond the right edge of the viewport. Note that returning true for a Scrollable whose ancestor is a JScrollPane effectively disables horizontal scrolling.

Scrolling containers, like JViewport, will use this method each time they are validated.

Specified by:
getScrollableTracksViewportWidth in interface javax.swing.Scrollable
Following copied from interface: javax.swing.Scrollable
Returns:
True if a viewport should force the Scrollables width to match its own.