|
BioLegato 0.7.0 GDE Canvas plugin | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
org.biolegato.gdesupport.canvas.textarea.BLComponent
org.biolegato.gdesupport.canvas.textarea.BLTextArea
public class BLTextArea
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.
| 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 |
|---|
protected boolean insertMode
protected boolean selectionMove
protected boolean selectionMouse
protected int row
protected int column
protected ColourMap normalMap
protected ColourMap greyedOutMap
protected ColourMap currentMap
protected javax.swing.JPopupMenu popup
protected java.util.LinkedList<CursorListener> cursorListeners
protected java.util.LinkedList<ModeListener> modeListeners
protected final java.awt.Color invalidzone
public final BLTextArea blTextAreaSelf
public static final ColourMap defaultColourMap
public static final ColourMap defaultGreyColourMap
public static final long serialVersionUID
| Constructor Detail |
|---|
public BLTextArea()
| Method Detail |
|---|
public void addCursorListener(CursorListener listener)
listener - the cursor listener to add.public void addModeListener(ModeListener listener)
listener - the cursor listener to add.
public void changePosition(int newColumn,
int newRow)
newColumn - the column co-ordinate of the new position.newRow - the row co-ordinate of the new position.public org.biolegato.core.data.seqdoc.SeqDoc getSeqDoc()
public void setColourMap(ColourMap c)
c - the colour map to usepublic void setGreyColourMap(ColourMap c)
c - the colour map to usepublic void setBackground(java.awt.Color c)
setBackground in class javax.swing.JComponentc - the new colour for the normal canvas background.public org.biolegato.core.data.sequence.Sequence[] getData()
public void paintComponent(java.awt.Graphics gfx)
paintComponent in class javax.swing.JComponentgfx - the graphics instance to paint the window to.public void setFont(java.awt.Font font)
setFont in class BLComponentfont - the new font to handle.public void keyTyped(java.awt.event.KeyEvent event)
keyTyped in interface java.awt.event.KeyListenerevent - the KeyEvent for the key typedpublic void keyPressed(java.awt.event.KeyEvent event)
keyPressed in interface java.awt.event.KeyListenerevent - the KeyEvent for the key pressedpublic void keyReleased(java.awt.event.KeyEvent event)
keyReleased in interface java.awt.event.KeyListenerevent - the KeyEvent for the key releasedpublic void mouseClicked(java.awt.event.MouseEvent event)
mouseClicked in interface java.awt.event.MouseListenerevent - the MouseEvent object corresponding to the click.public void mousePressed(java.awt.event.MouseEvent event)
mousePressed in interface java.awt.event.MouseListenerevent - the MouseEvent object corresponding to the press.public void mouseReleased(java.awt.event.MouseEvent event)
mouseReleased in interface java.awt.event.MouseListenerevent - the MouseEvent object corresponding to the release.public void mouseEntered(java.awt.event.MouseEvent event)
mouseEntered in interface java.awt.event.MouseListenerevent - the MouseEvent object corresponding to the enter.public void mouseExited(java.awt.event.MouseEvent event)
mouseExited in interface java.awt.event.MouseListenerevent - the MouseEvent object corresponding to the exit.public void mouseDragged(java.awt.event.MouseEvent event)
mouseDragged in interface java.awt.event.MouseMotionListenerevent - the MouseEvent object corresponding to the drag.public void mouseMoved(java.awt.event.MouseEvent event)
mouseMoved in interface java.awt.event.MouseMotionListenerevent - the MouseEvent object corresponding to the movement.protected void refreshSize()
refreshSize in class BLComponentpublic void addPopupMenuItem(javax.swing.JMenuItem act)
act - the menu item to add.public void removePopupMenuItem(javax.swing.JMenuItem act)
act - the menu item to remove.public void copy()
copy in interface Editablepublic void cut()
cut in interface Editablepublic void paste()
paste in interface Editablepublic void selectAll()
public boolean insert(int x,
int y,
java.lang.String data)
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.
public boolean insert(int x,
int y,
org.biolegato.core.data.sequence.Sequence[] data)
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.
public boolean delete(int x,
int y,
int w,
int h)
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).
public boolean deleteSelection()
public boolean getInsertMode()
public void sequenceAdded(org.biolegato.core.data.seqdoc.SeqDoc source,
int index,
org.biolegato.core.data.sequence.Sequence sequence)
sequenceAdded in interface org.biolegato.core.data.seqdoc.SeqDocListenerindex - the location the sequence was added.sequence - the sequence added.
public void sequenceChanged(org.biolegato.core.data.seqdoc.SeqDoc source,
int index,
org.biolegato.core.data.sequence.Sequence sequence,
java.lang.String key)
sequenceChanged in interface org.biolegato.core.data.seqdoc.SeqDocListenerindex - the location of the sequence.sequence - the sequence modified.key - the value modified.
public void sequenceRemoved(org.biolegato.core.data.seqdoc.SeqDoc source,
int index,
org.biolegato.core.data.sequence.Sequence sequence)
sequenceRemoved in interface org.biolegato.core.data.seqdoc.SeqDocListenerindex - the location (line number) where the sequence was removed from.sequence - the sequence removed from the SeqDoc.public void focusGained(java.awt.event.FocusEvent e)
focusGained in interface java.awt.event.FocusListenere - this parameter is currently ignoredpublic void focusLost(java.awt.event.FocusEvent e)
focusLost in interface java.awt.event.FocusListenere - this parameter is currently ignoredpublic void resetSelection()
public void moveSelection(int newx,
int newy)
newx - the new X co-ordinate the selection has been moved to.newy - the new Y co-ordinate the selection has been moved to.
public void stretchSelection(int newx,
int newy)
newx - the new X co-ordinate the selection has been stretched to.newy - the new Y co-ordinate the selection has been stretched to.protected boolean isEmptySelection()
public int getMinSX()
public int getMaxSX()
public int getMinSY()
public int getMaxSY()
public int getSX1()
public int getSY1()
public int getSX2()
public int getSY2()
public boolean isSelectedLine(int y)
y - the Y co-ordinate (or line number) to test.
|
BioLegato 0.7.0 GDE Canvas plugin | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||