BioLegato 0.7.3 GDE plugin

org.biolegato.gdesupport.canvas.textarea
Class GDETextArea

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
                      extended by org.biolegato.gdesupport.canvas.textarea.GDETextArea
All Implemented Interfaces:
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, GDEModelListener, GDECanvasObject
Direct Known Subclasses:
UndoableGDETextArea

public class GDETextArea
extends BLTextArea
implements GDECanvasObject

Custom text area for allowing box selection

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
 
Fields inherited from class org.biolegato.gdesupport.canvas.textarea.BLTextArea
blTextAreaSelf, column, currentMap, cursorListeners, datamodel, insertMode, invalidzone, modeListeners, popup, row, selectionMouse, selectionMove
 
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
GDETextArea(GDECanvas canvas)
          Constructs a new instance of GDETextArea.
 
Method Summary
 void changeCase()
          Changes the case of the currently selected sequence (if the sequence is of inconsistent case, the case of the entire sequence is changed to the opposite case of the first character in the sequence.
protected  void changePosition(boolean select, int newx, int newy)
          Updates/moves the cursor to the new position.
 void cut()
          Cuts content from the current Editable object.
 boolean delete(int x, int y, int w, int h)
          Removes text from a document.
 boolean getProtectAlignment(Cell seq, java.lang.String text)
          Checks a string against a sequence's alignment gap protection settings.
 boolean getProtectAmbiguous(Cell seq, java.lang.String text)
          Checks a string against a sequence's ambiguous character protection settings.
 boolean getProtectUnambiguous(Cell seq, java.lang.String text)
          Checks a string against a sequence's unambiguous character protection settings.
 boolean insert(int x, int y, java.lang.String text)
          Inserts a string into the textarea's underlying SeqDoc (NOTE: this should ONLY be called by sub-methods)
 boolean isProtectionsOn(Cell seq, java.lang.String text)
          Checks a string against all of a sequence's protection settings.
 boolean isSelectedLine(int y)
          This function is used to test if a line is selected.
 void linkCanvas(GDECanvas canvas)
           
 void paste()
          Pastes content into the current Editable object.
 boolean pdelete(int x, int y, int w, int h)
          Removes text from one line of a document (doesn't do any group processing - permission processing only).
 boolean pdeleteSelection()
          Used to delete the current selection before an insertion or as part of a deletion.
 
Methods inherited from class org.biolegato.gdesupport.canvas.textarea.BLTextArea
addCursorListener, addModeListener, addPopupMenuItem, clearSelection, copy, deleteSelection, getData, getDataModel, getInsertMode, getMaxSX, getMaxSY, getMinSX, getMinSY, insert, isSelectionEmpty, keyPressed, keyReleased, keyTyped, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, paintComponent, refreshSize, removePopupMenuItem, sequenceAdded, sequenceChanged, sequenceRemoved, setColourMap, setFont
 
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, setBackground, 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
 
Methods inherited from interface org.biolegato.gdesupport.canvas.GDECanvasObject
copy, getData
 

Constructor Detail

GDETextArea

public GDETextArea(GDECanvas canvas)
Constructs a new instance of GDETextArea.

Method Detail

changeCase

public void changeCase()
Changes the case of the currently selected sequence (if the sequence is of inconsistent case, the case of the entire sequence is changed to the opposite case of the first character in the sequence.

Specified by:
changeCase in interface GDECanvasObject

cut

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

Specified by:
cut in interface GDECanvasObject
Overrides:
cut in class BLTextArea

paste

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

Specified by:
paste in interface GDECanvasObject
Overrides:
paste in class BLTextArea

pdeleteSelection

public boolean pdeleteSelection()
Used to delete the current selection before an insertion or as part of a deletion. NOTE: ng stands for non-grouped

Returns:
whether or not the deletion was performed.

isSelectedLine

public boolean isSelectedLine(int y)
This function is used to test if a line is selected.

Overrides:
isSelectedLine in class BLTextArea
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.

isProtectionsOn

public boolean isProtectionsOn(Cell seq,
                               java.lang.String text)
Checks a string against all of a sequence's protection settings. This is done by obtaining the sequence's protection settings, the type of the sequence, and whether the text contains a character in any protected character class.

Parameters:
seq - the sequence to test against.
text - the text to test.
Returns:
true if the text violates the protection settings of the sequence.

getProtectAlignment

public boolean getProtectAlignment(Cell seq,
                                   java.lang.String text)
Checks a string against a sequence's alignment gap protection settings. This is done by obtaining the sequence's alignment gap protection settings, the type of the sequence, and whether the text contains a character in the alignment gap character class.

Parameters:
seq - the sequence to test against.
text - the text to test.
Returns:
true if the text violates the protection settings of the sequence.

getProtectAmbiguous

public boolean getProtectAmbiguous(Cell seq,
                                   java.lang.String text)
Checks a string against a sequence's ambiguous character protection settings. This is done by obtaining the sequence's ambiguous character protection settings, the type of the sequence, and whether the text contains a character in the ambiguous character class.

Parameters:
seq - the sequence to test against.
text - the text to test.
Returns:
true if the text violates the protection settings of the sequence.

getProtectUnambiguous

public boolean getProtectUnambiguous(Cell seq,
                                     java.lang.String text)
Checks a string against a sequence's unambiguous character protection settings. This is done by obtaining the sequence's unambiguous character protection settings, the type of the sequence, and whether the text contains a character in the unambiguous character class.

Parameters:
seq - the sequence to test against.
text - the text to test.
Returns:
true if the text violates the protection settings of the sequence.

insert

public boolean insert(int x,
                      int y,
                      java.lang.String text)
Inserts a string into the textarea's underlying SeqDoc (NOTE: this should ONLY be called by sub-methods)

Overrides:
insert in class BLTextArea
Parameters:
x - the X co-ordinate (column number) to insert the character at.
y - the Y co-ordinate (row number) to insert the character at.
text - the text to insert.
Returns:
whether or not the insertion was successful.

delete

public boolean delete(int x,
                      int y,
                      int w,
                      int h)
Removes text from a document.

Overrides:
delete in class BLTextArea
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:
whether the deletion was a success.

pdelete

public boolean pdelete(int x,
                       int y,
                       int w,
                       int h)
Removes text from one line of a document (doesn't do any group processing - permission processing only).

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).
Returns:
whether the deletion was a success.

linkCanvas

public void linkCanvas(GDECanvas canvas)

changePosition

protected void changePosition(boolean select,
                              int newx,
                              int newy)
Updates/moves the cursor to the new position.

Overrides:
changePosition in class BLTextArea
Parameters:
select - whether or not the position should maintain selection status (i.e. true for SHIFT key).
newx - the column co-ordinate of the new position.
newy - the row co-ordinate of the new position.

BioLegato 0.7.3 GDE plugin

Copyright © 2008-2010 University of Manitoba.