org.ceryle.ui
Class EditorArea

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.text.JTextComponent
                  extended by javax.swing.JTextArea
                      extended by org.ceryle.ui.EditorArea
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, Scrollable

public class EditorArea
extends JTextArea

A subclass of JTextArea providing an editable text area with additional presentation features. Scrolling, content dirtiness and the undo manager are managed by the parent EditorPanel.

NOTE: The default for activeEditor is currently false, but when true a listener is attached (only upon instantiation) for keypresses intended to mimic a small subset of vi commands. This is a feature in early development.

Since:
JDK1.4
Version:
$Id: EditorArea.java,v 3.2 2007-06-15 12:09:36 altheim Exp $
Author:
Murray Altheim
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JTextArea
JTextArea.AccessibleJTextArea
 
Nested classes/interfaces inherited from class javax.swing.text.JTextComponent
JTextComponent.AccessibleJTextComponent, JTextComponent.KeyBinding
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  boolean activeCommand
          When true, the vi-like command mode features are active.
static Color COLOR_HL_BLUE
           
static Color COLOR_HL_GREEN
           
static Color COLOR_HL_PINK
           
static Color COLOR_HL_YELLOW
           
static Color COLOR_PALE_BLUE
           
static Color COLOR_PALE_GREEN
           
static Color COLOR_PALE_PINK
           
static Color COLOR_PALE_YELLOW
           
static String CS_BLUE
          The color spec used as background color on pale blue notes.
static String CS_GREEN
          The color spec used as background color on pale green notes.
static String CS_PINK
          The color spec used as background color on pale pink notes.
static String CS_YELLOW
          The color spec used as background color on pale yellow notes.
static String HLS_BLUE
          The color spec used as hilight color on pale blue notes.
static String HLS_GREEN
          The color spec used as hilight color on pale green notes.
static String HLS_PINK
          The color spec used as hilight color on pale pink notes.
static String HLS_YELLOW
          The color spec used as hilight color on pale yellow notes.
protected  int m_gutter
           
protected  EditorArea m_instance
           
protected  PropertyManager pm
           
 
Fields inherited from class javax.swing.text.JTextComponent
DEFAULT_KEYMAP, FOCUS_ACCELERATOR_KEY
 
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
EditorArea(boolean editable)
          Constructor.
 
Method Summary
 Point getCaretPositionAsPoint()
          Returns the caret position of the editor text area as a Point.
 void setCaretPosition(Point pos)
          Sets the caret position of the editor text area.
 void setEditable(boolean editable)
          Set the editability of the editor text area to editable.
 void setEditorColorScheme(int index)
          Sets the color scheme of the editor text area to the color indicated by index.
 void setGutter(int gutter)
          Sets the editor gutter to the int gutter.
 
Methods inherited from class javax.swing.JTextArea
append, createDefaultModel, getAccessibleContext, getColumns, getColumnWidth, getLineCount, getLineEndOffset, getLineOfOffset, getLineStartOffset, getLineWrap, getPreferredScrollableViewportSize, getPreferredSize, getRowHeight, getRows, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getTabSize, getUIClassID, getWrapStyleWord, insert, paramString, replaceRange, setColumns, setFont, setLineWrap, setRows, setTabSize, setWrapStyleWord
 
Methods inherited from class javax.swing.text.JTextComponent
addCaretListener, addInputMethodListener, addKeymap, copy, cut, fireCaretUpdate, getActions, getCaret, getCaretColor, getCaretListeners, getCaretPosition, getDisabledTextColor, getDocument, getDragEnabled, getFocusAccelerator, getHighlighter, getInputMethodRequests, getKeymap, getKeymap, getMargin, getNavigationFilter, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getSelectedText, getSelectedTextColor, getSelectionColor, getSelectionEnd, getSelectionStart, getText, getText, getToolTipText, getUI, isEditable, loadKeymap, modelToView, moveCaretPosition, paste, processInputMethodEvent, read, removeCaretListener, removeKeymap, removeNotify, replaceSelection, select, selectAll, setCaret, setCaretColor, setCaretPosition, setComponentOrientation, setDisabledTextColor, setDocument, setDragEnabled, setFocusAccelerator, setHighlighter, setKeymap, setMargin, setNavigationFilter, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setText, setUI, updateUI, viewToModel, write
 
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, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, 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, 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
 
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, 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, 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, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, 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

HLS_YELLOW

public static final String HLS_YELLOW
The color spec used as hilight color on pale yellow notes.

See Also:
Constant Field Values

HLS_GREEN

public static final String HLS_GREEN
The color spec used as hilight color on pale green notes.

See Also:
Constant Field Values

HLS_BLUE

public static final String HLS_BLUE
The color spec used as hilight color on pale blue notes.

See Also:
Constant Field Values

HLS_PINK

public static final String HLS_PINK
The color spec used as hilight color on pale pink notes.

See Also:
Constant Field Values

CS_YELLOW

public static final String CS_YELLOW
The color spec used as background color on pale yellow notes.

See Also:
Constant Field Values

CS_GREEN

public static final String CS_GREEN
The color spec used as background color on pale green notes.

See Also:
Constant Field Values

CS_BLUE

public static final String CS_BLUE
The color spec used as background color on pale blue notes.

See Also:
Constant Field Values

CS_PINK

public static final String CS_PINK
The color spec used as background color on pale pink notes.

See Also:
Constant Field Values

COLOR_PALE_YELLOW

public static final Color COLOR_PALE_YELLOW

COLOR_HL_YELLOW

public static final Color COLOR_HL_YELLOW

COLOR_PALE_GREEN

public static final Color COLOR_PALE_GREEN

COLOR_HL_GREEN

public static final Color COLOR_HL_GREEN

COLOR_PALE_BLUE

public static final Color COLOR_PALE_BLUE

COLOR_HL_BLUE

public static final Color COLOR_HL_BLUE

COLOR_PALE_PINK

public static final Color COLOR_PALE_PINK

COLOR_HL_PINK

public static final Color COLOR_HL_PINK

activeCommand

protected boolean activeCommand
When true, the vi-like command mode features are active. When false, acts like a normal JTextArea.


pm

protected PropertyManager pm

m_instance

protected final EditorArea m_instance

m_gutter

protected int m_gutter
Constructor Detail

EditorArea

public EditorArea(boolean editable)
Constructor. If the boolean editable is false, the EditorArea will be read-only and not attach a key listener.

Method Detail

setEditable

public void setEditable(boolean editable)
Set the editability of the editor text area to editable. If the original state upon instantiation was editable, calls to this method are ignored.

Overrides:
setEditable in class JTextComponent

setEditorColorScheme

public void setEditorColorScheme(int index)
Sets the color scheme of the editor text area to the color indicated by index. Index values set the background color as:

setGutter

public void setGutter(int gutter)
Sets the editor gutter to the int gutter. Values outside the permitted range (0-200) are ignored.


setCaretPosition

public void setCaretPosition(Point pos)
Sets the caret position of the editor text area.


getCaretPositionAsPoint

public Point getCaretPositionAsPoint()
Returns the caret position of the editor text area as a Point.



The Ceryle Project. Copyright ©2001-2007 Murray Altheim, All Rights Reserved. See LICENSE included with distribution.