com.infoengine.modeler.UI
Class EditorTextComponent

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.text.JTextComponent
                  extended byjavax.swing.JEditorPane
                      extended byjavax.swing.JTextPane
                          extended bycom.infoengine.modeler.UI.EditorTextComponent
All Implemented Interfaces:
Accessible, AWTEventListener, EventListener, ImageObserver, KeyListener, MenuContainer, MouseListener, MouseMotionListener, Scrollable, Serializable

public class EditorTextComponent
extends JTextPane
implements MouseListener, MouseMotionListener, AWTEventListener, KeyListener

See Also:
Serialized Form

Nested Class Summary
(package private)  class EditorTextComponent.IEStyledDocument
           
(package private)  class EditorTextComponent.ShortCharStack
           
 
Nested classes inherited from class javax.swing.JEditorPane
JEditorPane.AccessibleJEditorPane, JEditorPane.AccessibleJEditorPaneHTML, JEditorPane.JEditorPaneAccessibleHypertextSupport
 
Nested classes inherited from class javax.swing.text.JTextComponent
JTextComponent.AccessibleJTextComponent, JTextComponent.KeyBinding
 
Nested classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
(package private)  Cursor crossHairCursor
           
private  int defaultBlinkRate
           
(package private)  int lastPseudoCaret
           
private static int LEFT_MARGIN
           
(package private)  Cursor marginCursor
           
(package private)  Cursor moveCursor
           
private  Caret myCaret
           
(package private)  EditorTextComponent.IEStyledDocument myDocument
           
private  int nSelect
           
(package private)  int pseudoCaret
           
(package private)  int selEnd
           
(package private)  int selStart
           
private static boolean STYLE_DEBUG
           
(package private)  Hashtable styles
           
(package private)  Cursor textCursor
           
 
Fields inherited from class javax.swing.JTextPane
 
Fields inherited from class javax.swing.JEditorPane
 
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.Container
 
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
(package private) EditorTextComponent()
           
 
Method Summary
 Style addStyle(String name, Style s)
           
(package private)  void autoIndent(KeyEvent e)
           
private  void drawPseudoCaret()
           
 void eventDispatched(AWTEvent awe)
           
 Color getAttributeColor()
           
 Color getAttributeValueColor()
           
 Color getCommentColor()
           
 Color getEqualsColor()
           
 String getIndent(int from)
           
 Color getScriptletColor()
           
 boolean getScrollableTracksViewportWidth()
           
 Hashtable getStyles()
           
 String getText()
           
 Color getXmlTagColor()
           
private  void initTextPane()
           
private  boolean inMargin(MouseEvent e)
           
private  boolean inSelectionBounds(MouseEvent e)
           
private  void insert(int offset, String string)
           
 void keyPressed(KeyEvent e)
           
 void keyReleased(KeyEvent e)
           
 void keyTyped(KeyEvent e)
           
(package private)  void matchBraces(KeyEvent e)
          if the cursor is touching a brace character then attempt to move the cursor to the appropriate matching brace...
 void mouseClicked(MouseEvent e)
           
 void mouseDragged(MouseEvent e)
           
 void mouseEntered(MouseEvent e)
           
 void mouseExited(MouseEvent e)
           
 void mouseMoved(MouseEvent e)
           
 void mousePressed(MouseEvent e)
           
 void mouseReleased(MouseEvent e)
           
 void paint(Graphics g)
           
 void refresh()
           
 void removeStyle(String name)
           
 void replaceSelection(String content)
           
 void restyle()
           
 void setAttributeColor(Color c)
           
 void setAttributeValueColor(Color c)
           
 void setBackground(Color c)
           
 void setCommentColor(Color c)
           
 void setEqualsColor(Color c)
           
 void setFont(Font f)
           
 void setScriptletColor(Color c)
           
 void setXmlTagColor(Color c)
           
private  void smartHome(KeyEvent e)
          Home key pressed
private  void smartTab(KeyEvent e)
          Tab key pressed...
private  String stripCRs(String string)
           
 
Methods inherited from class javax.swing.JTextPane
createDefaultEditorKit, getCharacterAttributes, getInputAttributes, getLogicalStyle, getParagraphAttributes, getStyle, getStyledDocument, getStyledEditorKit, getUIClassID, insertComponent, insertIcon, paramString, setCharacterAttributes, setDocument, setEditorKit, setLogicalStyle, setParagraphAttributes, setStyledDocument
 
Methods inherited from class javax.swing.JEditorPane
addHyperlinkListener, createEditorKitForContentType, fireHyperlinkUpdate, getAccessibleContext, getContentType, getEditorKit, getEditorKitClassNameForContentType, getEditorKitForContentType, getHyperlinkListeners, getPage, getPreferredSize, getScrollableTracksViewportHeight, getStream, read, registerEditorKitForContentType, registerEditorKitForContentType, removeHyperlinkListener, scrollToReference, setContentType, setEditorKitForContentType, setPage, setPage, setText
 
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, getPreferredScrollableViewportSize, getScrollableBlockIncrement, getScrollableUnitIncrement, getSelectedText, getSelectedTextColor, getSelectionColor, getSelectionEnd, getSelectionStart, getText, getToolTipText, getUI, isEditable, loadKeymap, modelToView, moveCaretPosition, paste, processInputMethodEvent, read, removeCaretListener, removeKeymap, removeNotify, select, selectAll, setCaret, setCaretColor, setCaretPosition, setComponentOrientation, setDisabledTextColor, setDragEnabled, setEditable, setFocusAccelerator, setHighlighter, setKeymap, setMargin, setNavigationFilter, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setUI, updateUI, viewToModel, write
 
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, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setForeground, 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, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, 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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, 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

LEFT_MARGIN

private static final int LEFT_MARGIN
See Also:
Constant Field Values

selStart

int selStart

selEnd

int selEnd

lastPseudoCaret

int lastPseudoCaret

pseudoCaret

int pseudoCaret

textCursor

Cursor textCursor

moveCursor

Cursor moveCursor

marginCursor

Cursor marginCursor

crossHairCursor

Cursor crossHairCursor

myCaret

private Caret myCaret

defaultBlinkRate

private int defaultBlinkRate

myDocument

EditorTextComponent.IEStyledDocument myDocument

nSelect

private int nSelect

STYLE_DEBUG

private static boolean STYLE_DEBUG

styles

Hashtable styles
Constructor Detail

EditorTextComponent

EditorTextComponent()
Method Detail

initTextPane

private void initTextPane()

getScrollableTracksViewportWidth

public boolean getScrollableTracksViewportWidth()
Specified by:
getScrollableTracksViewportWidth in interface Scrollable

refresh

public void refresh()

stripCRs

private String stripCRs(String string)

getText

public String getText()

setBackground

public void setBackground(Color c)

eventDispatched

public void eventDispatched(AWTEvent awe)
Specified by:
eventDispatched in interface AWTEventListener

mouseClicked

public void mouseClicked(MouseEvent e)
Specified by:
mouseClicked in interface MouseListener

mouseEntered

public void mouseEntered(MouseEvent e)
Specified by:
mouseEntered in interface MouseListener

mouseExited

public void mouseExited(MouseEvent e)
Specified by:
mouseExited in interface MouseListener

mousePressed

public void mousePressed(MouseEvent e)
Specified by:
mousePressed in interface MouseListener

mouseReleased

public void mouseReleased(MouseEvent e)
Specified by:
mouseReleased in interface MouseListener

mouseMoved

public void mouseMoved(MouseEvent e)
Specified by:
mouseMoved in interface MouseMotionListener

mouseDragged

public void mouseDragged(MouseEvent e)
Specified by:
mouseDragged in interface MouseMotionListener

inMargin

private boolean inMargin(MouseEvent e)

inSelectionBounds

private boolean inSelectionBounds(MouseEvent e)

drawPseudoCaret

private void drawPseudoCaret()

paint

public void paint(Graphics g)

smartHome

private void smartHome(KeyEvent e)
Home key pressed


insert

private void insert(int offset,
                    String string)

smartTab

private void smartTab(KeyEvent e)
Tab key pressed...


matchBraces

void matchBraces(KeyEvent e)
if the cursor is touching a brace character then attempt to move the cursor to the appropriate matching brace... triggered by -]


autoIndent

void autoIndent(KeyEvent e)

getIndent

public String getIndent(int from)

keyReleased

public void keyReleased(KeyEvent e)
Specified by:
keyReleased in interface KeyListener

keyTyped

public void keyTyped(KeyEvent e)
Specified by:
keyTyped in interface KeyListener

keyPressed

public void keyPressed(KeyEvent e)
Specified by:
keyPressed in interface KeyListener

replaceSelection

public void replaceSelection(String content)

getXmlTagColor

public Color getXmlTagColor()

setXmlTagColor

public void setXmlTagColor(Color c)

getCommentColor

public Color getCommentColor()

setCommentColor

public void setCommentColor(Color c)

getScriptletColor

public Color getScriptletColor()

setScriptletColor

public void setScriptletColor(Color c)

getEqualsColor

public Color getEqualsColor()

setEqualsColor

public void setEqualsColor(Color c)

getAttributeColor

public Color getAttributeColor()

setAttributeColor

public void setAttributeColor(Color c)

getAttributeValueColor

public Color getAttributeValueColor()

setAttributeValueColor

public void setAttributeValueColor(Color c)

setFont

public void setFont(Font f)

getStyles

public Hashtable getStyles()

addStyle

public Style addStyle(String name,
                      Style s)

removeStyle

public void removeStyle(String name)

restyle

public void restyle()