BioLegato 0.7.0 GDE Canvas plugin

org.biolegato.gdesupport.canvas.textarea
Class BLTextArea

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by org.biolegato.gdesupport.canvas.textarea.BLComponent
                  extended by org.biolegato.gdesupport.canvas.textarea.BLTextArea
All Implemented Interfaces:
java.awt.event.FocusListener, java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, org.biolegato.core.data.seqdoc.SeqDocListener, Editable
Direct Known Subclasses:
GDETextArea

public class BLTextArea
extends BLComponent
implements java.awt.event.FocusListener, Editable, org.biolegato.core.data.seqdoc.SeqDocListener, java.awt.event.KeyListener, java.awt.event.MouseMotionListener, java.awt.event.MouseListener

A general canvas with more functionality support than JTextArea. This canvas was originally created to support the rectangular selection model, and has since supported rectangular selections, different colour schemes, sequence documents, and many other features. Please add more generic feature support as necessary. Also if you wish to add any functionality or handling specific to a plugin, please feel free to subclass this textarea.

Author:
Graham Alvare, Brian Fristensky
See Also:
Serialized Form

Nested Class Summary
 
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
 BLTextArea blTextAreaSelf
          Self-reference for inner classes.
protected  int column
          The current column of the caret.
protected  ColourMap currentMap
          Handles printing text
protected  java.util.LinkedList<CursorListener> cursorListeners
          Linked list to store all cursor listeners
static ColourMap defaultColourMap
          The default colour map for regular text in BLTextAreas
static ColourMap defaultGreyColourMap
          The default colour map for greyed out text in BLTextAreas
protected  ColourMap greyedOutMap
          The colour map to use when the textarea is greyed out.
protected  boolean insertMode
          If true new text will overwrite existing text.
protected  java.awt.Color invalidzone
          The colour of invalid areas in the textarea.
protected  java.util.LinkedList<ModeListener> modeListeners
          Linked list to store all mode change listeners
protected  ColourMap normalMap
          The colour map to use when the textarea is not greyed out.
protected  javax.swing.JPopupMenu popup
          The right click menu for the text area.
protected  int row
          The current row of the caret
protected  boolean selectionMouse
          Used for mouse dragging.
protected  boolean selectionMove
          Used to track the shift key.
static long serialVersionUID
          This constant is used for serialization purposes.
 
Fields inherited from class org.biolegato.gdesupport.canvas.textarea.BLComponent
columnWidth, rowHeight
 
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
BLTextArea()
          Creates a new instance of BLTextArea
 
Method Summary
 void addCursorListener(CursorListener listener)
          Adds a cursor listener to the BLTextArea.
 void addModeListener(ModeListener listener)
          Adds a cursor listener to the BLTextArea.
 void addPopupMenuItem(javax.swing.JMenuItem act)
          Adds an item to the BLTextArea's right-click popup menu.
 void changePosition(int newColumn, int newRow)
          Updates/moves the cursor to the new position.
 void copy()
          Copies content from the current Editable object.
 void cut()
          Cuts content from the current Editable object.
 boolean delete(int x, int y, int w, int h)
          Deletes characters from the textarea's underlying SeqDoc NOTE: deletions are performed in a sequential manner
 boolean deleteSelection()
          Used to delete the current selection before an insertion or as part of a deletion.
 void focusGained(java.awt.event.FocusEvent e)
          Handles activating the text area (changing colours from greyed out to normal).
 void focusLost(java.awt.event.FocusEvent e)
          Handles deactivating the text area (changing colours from normal to greyed out).
 org.biolegato.core.data.sequence.Sequence[] getData()
          Used to obtain all of the text selected within the document.
 boolean getInsertMode()
          Returns the insertion mode status of the textarea.
 int getMaxSX()
          Gets the maximum X co-ordinate of the selection area.
 int getMaxSY()
          Gets the maximum Y co-ordinate of the selection area.
 int getMinSX()
          Gets the minimum X co-ordinate of the selection area.
 int getMinSY()
          Gets the minimum Y co-ordinate of the selection area.
 org.biolegato.core.data.seqdoc.SeqDoc getSeqDoc()
          Returns the SeqDoc associated with the BLTextArea
 int getSX1()
          Gets the starting X co-ordinate of the selection area.
 int getSX2()
          Gets the ending X co-ordinate of the selection area.
 int getSY1()
          Gets the starting Y co-ordinate of the selection area.
 int getSY2()
          Gets the ending Y co-ordinate of the selection area.
 boolean insert(int x, int y, org.biolegato.core.data.sequence.Sequence[] data)
          Inserts an array of sequences into the textarea's underlying SeqDoc
 boolean insert(int x, int y, java.lang.String data)
          Inserts a string into the textarea's underlying SeqDoc NOTE: this is a wrapper method for insert(x, y, data)
protected  boolean isEmptySelection()
          Tests if the selection shape is empty
 boolean isSelectedLine(int y)
          This function is used to test if a line is selected.
 void keyPressed(java.awt.event.KeyEvent event)
          Processes key presses within the text area
 void keyReleased(java.awt.event.KeyEvent event)
          Processes key releases within the text area
 void keyTyped(java.awt.event.KeyEvent event)
          Processes the typing of keys within the text area
 void mouseClicked(java.awt.event.MouseEvent event)
          Handles mouse clicks.
 void mouseDragged(java.awt.event.MouseEvent event)
          Handles mouse drags.
 void mouseEntered(java.awt.event.MouseEvent event)
          Handles the mouse entering the component.
 void mouseExited(java.awt.event.MouseEvent event)
          Handles the mouse exiting the component.
 void mouseMoved(java.awt.event.MouseEvent event)
          Handles mouse movements.
 void mousePressed(java.awt.event.MouseEvent event)
          Handles mouse button presses.
 void mouseReleased(java.awt.event.MouseEvent event)
          Handles mouse button releases.
 void moveSelection(int newx, int newy)
          Moves the start of a selection to a new co-ordinate
 void paintComponent(java.awt.Graphics gfx)
          Paints the current textarea (this uses the current clip bounds to determine the area to paint.
 void paste()
          Pastes content into the current Editable object.
protected  void refreshSize()
          Refreshes the size of the textarea (for scroll size purposes)
 void removePopupMenuItem(javax.swing.JMenuItem act)
          Removes an item from the BLTextArea's right-click popup menu.
 void resetSelection()
          Resets the current selection to (0,0 - 0,0)
 void selectAll()
          Selects all the sequences within the textarea.
 void sequenceAdded(org.biolegato.core.data.seqdoc.SeqDoc source, int index, org.biolegato.core.data.sequence.Sequence sequence)
          Called when a sequence is added to a SeqDoc.
 void sequenceChanged(org.biolegato.core.data.seqdoc.SeqDoc source, int index, org.biolegato.core.data.sequence.Sequence sequence, java.lang.String key)
          Called when a field in a sequence is modified.
 void sequenceRemoved(org.biolegato.core.data.seqdoc.SeqDoc source, int index, org.biolegato.core.data.sequence.Sequence sequence)
          Called when a sequence is removed from a SeqDoc.
 void setBackground(java.awt.Color c)
          Changes the background of the canvas.
 void setColourMap(ColourMap c)
          Changes the current colour map for unselected text.
 void setFont(java.awt.Font font)
          Updates the font for the canvas (ensures repaint)
 void setGreyColourMap(ColourMap c)
          Changes the current colour map for unselected text.
 void stretchSelection(int newx, int newy)
          Stretches the selection by changing the co-ordinate of the selection's end
 
Methods inherited from class org.biolegato.gdesupport.canvas.textarea.BLComponent
column2X, columnSize, maxColumns, maxRows, row2Y, rowSize, X2Column, Y2Row
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, 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, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, 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, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
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

insertMode

protected boolean insertMode
If true new text will overwrite existing text.


selectionMove

protected boolean selectionMove
Used to track the shift key. If this is false, cancel the current selection on moving using the direction arrows. If this is true, stretch the current selection on moving using the direction arrows.


selectionMouse

protected boolean selectionMouse
Used for mouse dragging. If this is true, dragging the mouse stretches the current selection; otherwise dragging the mouse starts a new selection.


row

protected int row
The current row of the caret


column

protected int column
The current column of the caret.


normalMap

protected ColourMap normalMap
The colour map to use when the textarea is not greyed out.


greyedOutMap

protected ColourMap greyedOutMap
The colour map to use when the textarea is greyed out.


currentMap

protected ColourMap currentMap
Handles printing text


popup

protected javax.swing.JPopupMenu popup
The right click menu for the text area.


cursorListeners

protected java.util.LinkedList<CursorListener> cursorListeners
Linked list to store all cursor listeners


modeListeners

protected java.util.LinkedList<ModeListener> modeListeners
Linked list to store all mode change listeners


invalidzone

protected final java.awt.Color invalidzone
The colour of invalid areas in the textarea.


blTextAreaSelf

public final BLTextArea blTextAreaSelf
Self-reference for inner classes.


defaultColourMap

public static final ColourMap defaultColourMap
The default colour map for regular text in BLTextAreas


defaultGreyColourMap

public static final ColourMap defaultGreyColourMap
The default colour map for greyed out text in BLTextAreas


serialVersionUID

public static final long serialVersionUID
This constant is used for serialization purposes.

See Also:
Constant Field Values
Constructor Detail

BLTextArea

public BLTextArea()
Creates a new instance of BLTextArea

Method Detail

addCursorListener

public void addCursorListener(CursorListener listener)
Adds a cursor listener to the BLTextArea.

Parameters:
listener - the cursor listener to add.

addModeListener

public void addModeListener(ModeListener listener)
Adds a cursor listener to the BLTextArea.

Parameters:
listener - the cursor listener to add.

changePosition

public void changePosition(int newColumn,
                           int newRow)
Updates/moves the cursor to the new position.

Parameters:
newColumn - the column co-ordinate of the new position.
newRow - the row co-ordinate of the new position.

getSeqDoc

public org.biolegato.core.data.seqdoc.SeqDoc getSeqDoc()
Returns the SeqDoc associated with the BLTextArea

Returns:
the SeqDoc object.

setColourMap

public void setColourMap(ColourMap c)
Changes the current colour map for unselected text.

Parameters:
c - the colour map to use

setGreyColourMap

public void setGreyColourMap(ColourMap c)
Changes the current colour map for unselected text.

Parameters:
c - the colour map to use

setBackground

public void setBackground(java.awt.Color c)
Changes the background of the canvas.

Overrides:
setBackground in class javax.swing.JComponent
Parameters:
c - the new colour for the normal canvas background.

getData

public org.biolegato.core.data.sequence.Sequence[] getData()
Used to obtain all of the text selected within the document.

Returns:
the text currently selected in the document.

paintComponent

public void paintComponent(java.awt.Graphics gfx)
Paints the current textarea (this uses the current clip bounds to determine the area to paint.

Overrides:
paintComponent in class javax.swing.JComponent
Parameters:
gfx - the graphics instance to paint the window to.

setFont

public void setFont(java.awt.Font font)
Updates the font for the canvas (ensures repaint)

Overrides:
setFont in class BLComponent
Parameters:
font - the new font to handle.

keyTyped

public void keyTyped(java.awt.event.KeyEvent event)
Processes the typing of keys within the text area

Specified by:
keyTyped in interface java.awt.event.KeyListener
Parameters:
event - the KeyEvent for the key typed

keyPressed

public void keyPressed(java.awt.event.KeyEvent event)
Processes key presses within the text area

Specified by:
keyPressed in interface java.awt.event.KeyListener
Parameters:
event - the KeyEvent for the key pressed

keyReleased

public void keyReleased(java.awt.event.KeyEvent event)
Processes key releases within the text area

Specified by:
keyReleased in interface java.awt.event.KeyListener
Parameters:
event - the KeyEvent for the key released

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent event)
Handles mouse clicks. This method sets the current caret and clears any selections (unless selectionMove is set, in which case it stretches the selection).

Specified by:
mouseClicked in interface java.awt.event.MouseListener
Parameters:
event - the MouseEvent object corresponding to the click.

mousePressed

public void mousePressed(java.awt.event.MouseEvent event)
Handles mouse button presses. This method sets the current caret and clears any selections (unless selectionMove is set).

Specified by:
mousePressed in interface java.awt.event.MouseListener
Parameters:
event - the MouseEvent object corresponding to the press.

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent event)
Handles mouse button releases. This method sets selectionMouse to false

Specified by:
mouseReleased in interface java.awt.event.MouseListener
Parameters:
event - the MouseEvent object corresponding to the release.

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent event)
Handles the mouse entering the component. Currently does nothing

Specified by:
mouseEntered in interface java.awt.event.MouseListener
Parameters:
event - the MouseEvent object corresponding to the enter.

mouseExited

public void mouseExited(java.awt.event.MouseEvent event)
Handles the mouse exiting the component. Currently does nothing

Specified by:
mouseExited in interface java.awt.event.MouseListener
Parameters:
event - the MouseEvent object corresponding to the exit.

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent event)
Handles mouse drags. Updates the selection and caret on drags.

Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener
Parameters:
event - the MouseEvent object corresponding to the drag.

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent event)
Handles mouse movements. Currently does nothing

Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener
Parameters:
event - the MouseEvent object corresponding to the movement.

refreshSize

protected void refreshSize()
Refreshes the size of the textarea (for scroll size purposes)

Specified by:
refreshSize in class BLComponent

addPopupMenuItem

public void addPopupMenuItem(javax.swing.JMenuItem act)
Adds an item to the BLTextArea's right-click popup menu.

Parameters:
act - the menu item to add.

removePopupMenuItem

public void removePopupMenuItem(javax.swing.JMenuItem act)
Removes an item from the BLTextArea's right-click popup menu.

Parameters:
act - the menu item to remove.

copy

public void copy()
Copies content from the current Editable object.

Specified by:
copy in interface Editable

cut

public void cut()
Cuts content from the current Editable object.

Specified by:
cut in interface Editable

paste

public void paste()
Pastes content into the current Editable object.

Specified by:
paste in interface Editable

selectAll

public void selectAll()
Selects all the sequences within the textarea.


insert

public boolean insert(int x,
                      int y,
                      java.lang.String data)
Inserts a string into the textarea's underlying SeqDoc NOTE: this is a wrapper method for insert(x, y, data)

Parameters:
x - the X co-ordinate (column number) to insert the string at.
y - the Y co-ordinate (row number) to insert the string at.
data - the string to insert.
Returns:
whether or not the insertion was successful.

insert

public boolean insert(int x,
                      int y,
                      org.biolegato.core.data.sequence.Sequence[] data)
Inserts an array of sequences into the textarea's underlying SeqDoc

Parameters:
x - the X co-ordinate (column number) to insert the sequences at.
y - the Y co-ordinate (row number) to insert the sequences at.
data - the array of sequences to insert.
Returns:
whether or not the insertion was successful.

delete

public boolean delete(int x,
                      int y,
                      int w,
                      int h)
Deletes characters from the textarea's underlying SeqDoc NOTE: deletions are performed in a sequential manner

Parameters:
x - the X-offset/column number to start the deletion from.
y - the Y-offset/line number to delete characters from.
w - the width of the deletion (measured in characters along the X-axis).
h - the height of the deletion (measured in sequences along the Y-axis).
Returns:
a boolean corresponding to the result of the deletion (true = successful deletion)

deleteSelection

public boolean deleteSelection()
Used to delete the current selection before an insertion or as part of a deletion.

Returns:
whether or not the deletion was performed.

getInsertMode

public boolean getInsertMode()
Returns the insertion mode status of the textarea. Insertion mode is invoked by hitting the "INSERT" key. While in insertion mode, if you type a character key in front of some text the character key inserted will replace the first character of the text in front of the insertion point.

Returns:
whether or not insertion mode is on.

sequenceAdded

public void sequenceAdded(org.biolegato.core.data.seqdoc.SeqDoc source,
                          int index,
                          org.biolegato.core.data.sequence.Sequence sequence)
Called when a sequence is added to a SeqDoc.

Specified by:
sequenceAdded in interface org.biolegato.core.data.seqdoc.SeqDocListener
Parameters:
index - the location the sequence was added.
sequence - the sequence added.

sequenceChanged

public void sequenceChanged(org.biolegato.core.data.seqdoc.SeqDoc source,
                            int index,
                            org.biolegato.core.data.sequence.Sequence sequence,
                            java.lang.String key)
Called when a field in a sequence is modified.

Specified by:
sequenceChanged in interface org.biolegato.core.data.seqdoc.SeqDocListener
Parameters:
index - the location of the sequence.
sequence - the sequence modified.
key - the value modified.

sequenceRemoved

public void sequenceRemoved(org.biolegato.core.data.seqdoc.SeqDoc source,
                            int index,
                            org.biolegato.core.data.sequence.Sequence sequence)
Called when a sequence is removed from a SeqDoc.

Specified by:
sequenceRemoved in interface org.biolegato.core.data.seqdoc.SeqDocListener
Parameters:
index - the location (line number) where the sequence was removed from.
sequence - the sequence removed from the SeqDoc.

focusGained

public void focusGained(java.awt.event.FocusEvent e)
Handles activating the text area (changing colours from greyed out to normal).

Specified by:
focusGained in interface java.awt.event.FocusListener
Parameters:
e - this parameter is currently ignored

focusLost

public void focusLost(java.awt.event.FocusEvent e)
Handles deactivating the text area (changing colours from normal to greyed out).

Specified by:
focusLost in interface java.awt.event.FocusListener
Parameters:
e - this parameter is currently ignored

resetSelection

public void resetSelection()
Resets the current selection to (0,0 - 0,0)


moveSelection

public void moveSelection(int newx,
                          int newy)
Moves the start of a selection to a new co-ordinate

Parameters:
newx - the new X co-ordinate the selection has been moved to.
newy - the new Y co-ordinate the selection has been moved to.

stretchSelection

public void stretchSelection(int newx,
                             int newy)
Stretches the selection by changing the co-ordinate of the selection's end

Parameters:
newx - the new X co-ordinate the selection has been stretched to.
newy - the new Y co-ordinate the selection has been stretched to.

isEmptySelection

protected boolean isEmptySelection()
Tests if the selection shape is empty

Returns:
true if the selection is empty

getMinSX

public int getMinSX()
Gets the minimum X co-ordinate of the selection area.

Returns:
Math.min(sx1, sx2)

getMaxSX

public int getMaxSX()
Gets the maximum X co-ordinate of the selection area.

Returns:
Math.max(sx1, sx2)

getMinSY

public int getMinSY()
Gets the minimum Y co-ordinate of the selection area.

Returns:
Math.min(sy1, sy2)

getMaxSY

public int getMaxSY()
Gets the maximum Y co-ordinate of the selection area.

Returns:
Math.max(y1, y2)

getSX1

public int getSX1()
Gets the starting X co-ordinate of the selection area.

Returns:
sx1

getSY1

public int getSY1()
Gets the starting Y co-ordinate of the selection area.

Returns:
sy1

getSX2

public int getSX2()
Gets the ending X co-ordinate of the selection area.

Returns:
sx2

getSY2

public int getSY2()
Gets the ending Y co-ordinate of the selection area.

Returns:
sy2

isSelectedLine

public boolean isSelectedLine(int y)
This function is used to test if a line is selected. Currently in this class, the test is just if the selection is within the bounds of sy1 and sy2.

Parameters:
y - the Y co-ordinate (or line number) to test.
Returns:
true if the line is within the selection area, and should be printed as such.

BioLegato 0.7.0 GDE Canvas plugin

Copyright © 2008-2010 University of Manitoba.