com.japisoft.xmlpad.bean
Class XMLEditor

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 bycom.japisoft.xmlpad.bean.XMLEditor
All Implemented Interfaces:
javax.accessibility.Accessible, javax.swing.event.CaretListener, java.util.EventListener, java.awt.event.FocusListener, java.awt.image.ImageObserver, java.awt.MenuContainer, javax.swing.Scrollable, java.io.Serializable

public class XMLEditor
extends javax.swing.JEditorPane
implements javax.swing.event.CaretListener, java.awt.event.FocusListener

Main class for the XMLEditor. This class uses an XMLEditorKit for working.

This class is a part of the XMLContainer. It manages a standard swing document and a view for XML

For general usage, you must use the XMLContainer rather than this class

UIManager properties :

  - xmlpad.editor.font
	- xmlpad.editor.dtdElementColor
	- xmlpad.editor.dtdAttributeColor
	- xmlpad.editor.dtdEntityColor
	- xmlpad.editor.tagBorderLineColor
	- xmlpad.editor.cdataColor
	- xmlpad.editor.entityColor
	- xmlpad.editor.commentColor
	- xmlpad.editor.declarationColor
	- xmlpad.editor.docTypeColor
	- xmlpad.editor.literalColor
	- xmlpad.editor.tagColor
	- xmlpad.editor.invalidColor
	- xmlpad.editor.textColor
	- xmlpad.editor.attributeColor
	- xmlpad.editor.attributeSeparatorColor
	- xmlpad.editor.selectionHighlightColor
  - xmlpad.editor.backgroundColor
 

Version:
2.0
Author:
(c)JAPISoft 2002,2003,2004 / Alexandre Brillant
See Also:
XMLContainer, XMLEditorKit, JEditorPane, Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.text.JTextComponent
javax.swing.text.JTextComponent.AccessibleJTextComponent, javax.swing.text.JTextComponent.KeyBinding
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Field Summary
 
Fields inherited from class javax.swing.text.JTextComponent
DEFAULT_KEYMAP, FOCUS_ACCELERATOR_KEY
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, 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
XMLEditor()
           
 
Method Summary
 void addNotify()
          This method will call the init method
 void asynchronousHighlightLine(int line)
          Highlight the line with an invokeLater
 void caretUpdate(javax.swing.event.CaretEvent e)
          Structure computing
 javax.swing.text.EditorKit createDefaultEditorKit()
           
 void dispose()
           
 void focusGained(java.awt.event.FocusEvent e)
          Each time the editor take the focus.
 void focusLost(java.awt.event.FocusEvent e)
          For the moment, nothing is done
 java.awt.Color getColorForAttribute()
          Colorize attribute <tag ATTRIBUTE="..." ...
 java.awt.Color getColorForAttributeSeparator()
          Colorize '='
 java.awt.Color getColorForCDATA()
          Color for CDATA section
 java.awt.Color getColorForComment()
          Colorize XML comment <!
 java.awt.Color getColorForDeclaration()
          Colorize XML declaration <?
 java.awt.Color getColorForDocType()
          Colorize DocType declaration <!
 java.awt.Color getColorForDTDAttribute()
           
 java.awt.Color getColorForDTDElement()
           
 java.awt.Color getColorForDTDEntity()
           
 java.awt.Color getColorForEntity()
          Colorize entity &ENTITY;
 java.awt.Color getColorForInvalid()
          Colorize error
 java.awt.Color getColorForLiteral()
          Colorize literal "..."
 java.awt.Color getColorForNameSpace()
          Colorize NameSpace
 java.awt.Color getColorForTag()
          Colorize tag <Tag...
 java.awt.Color getColorForTagBorderLine()
           
 java.awt.Color getColorForTagDelimiter()
          Colorize tag delimiter < or >
 java.awt.Color getColorForTagEnd()
          Colorize '/'
 java.awt.Color getColorForTagUnderline()
          Color for tag underline
 java.awt.Color getColorForText()
          Colorize text
 com.japisoft.fastparser.node.SimpleNode getCurrentNodeLocation()
           
 javax.swing.text.Document getDocument()
           
 javax.swing.text.EditorKit getEditorKit()
           
 XMLEntityResolver getEntityResolver()
           
 int getLineEnd(int caret)
           
 int getLineStart(int caret)
           
 java.awt.Color getSelectionHighlightColor()
           
 java.lang.String getText()
           
 java.lang.String getText(int from)
           
 javax.swing.undo.UndoManager getUndoManager()
           
 XMLContainer getXMLContainer()
           
 void highlightLine(int line)
          Highlight the line with the "selectionColor" property
 void initKeymap()
           
 void insertText(java.lang.String text)
          Insert a string at the current caret location
 boolean isAutoCloseTag()
          Does the closing tag is inserted automatically :true by default
 boolean isAutoResetAction()
           
 boolean isDocumentModified()
           
 boolean isEnabledRealTimeStructureChanged()
          Notify in real time any tree structure change.
 boolean isEnabledTreeLocationForCaret()
          Is Enabled the current tree location for a caret change ?.
 boolean isEnabledXPathLocation()
           
 void notifyCaretLocation()
           
 void notifyCurrentLocation()
          Notify to listener the current document location from the caret position.
 void notifyError(int line, java.lang.String message)
          Notify an error to the following line with the tied message
 void notifyNoError()
          Notify no error found
 void notifyStructureChanged()
          Notify that the structure has changed.
 void paint(java.awt.Graphics gc)
           
 void paintComponent(java.awt.Graphics gc)
           
 void redo()
          Redo last action
 void removeHighlightedErrorLine()
          Remove error line
 void removeNotify()
          This method will call the dispose method
 void resetDefaultLook()
          Reset the default color of the editor
 void resetDocument(XMLDocument doc)
           
 void resetDocumentState(boolean modified)
          Only for internal usage.
 void select(int selectionStart, int selectionEnd)
          Override of the standard JTextComponent.select Move caret to the start of the selection instead of the end
 void setAction(javax.swing.KeyStroke key, javax.swing.Action a)
           
 void setAutoCloseTag(boolean autoClose)
          Insert the closing tag while the user inserts the opening tag :true by default
 void setAutoResetAction(boolean reset)
          By default to true.
 void setColorForAttribute(java.awt.Color color)
          Colorize attribute <tag ATTRIBUTE="..." ...
 void setColorForAttributeSeparator(java.awt.Color color)
          Colorize '='
 void setColorForCDATA(java.awt.Color color)
          Colorize CDATA section
 void setColorForComment(java.awt.Color color)
          Colorize XML comment <!
 void setColorForDeclaration(java.awt.Color color)
          Colorize XML declaration <?
 void setColorForDocType(java.awt.Color color)
          Colorize DocType declaration <!
 void setColorForDTDAttribute(java.awt.Color color)
          Colorize !
 void setColorForDTDElement(java.awt.Color color)
          Colorize !
 void setColorForDTDEntity(java.awt.Color color)
          Colorize !
 void setColorForEntity(java.awt.Color color)
          Colorize entity &ENTITY;
 void setColorForInvalid(java.awt.Color color)
          Colorize error
 void setColorForLiteral(java.awt.Color color)
          Colorize literal "..."
 void setColorForNameSpace(java.awt.Color color)
          Colorize NameSpace
 void setColorForTag(java.awt.Color color)
          Colorize tag <Tag...
 void setColorForTagBorderLine(java.awt.Color color)
          Colorize the border line for tag delimiter
 void setColorForTagDelimiter(java.awt.Color color)
          Colorize tag delimiter < or >
 void setColorForTagEnd(java.awt.Color color)
          Colorize '/'
 void setColorForTagUnderline(java.awt.Color color)
          Colorize underline for current selection
 void setColorForText(java.awt.Color color)
          Colorize text
 void setEditorContext(EditorContext context)
          Case for communication with the container.
 void setEnabledRealTimeStructureChanged(boolean support)
          Notify in real time any tree structure change.
 void setEnabledTreeLocationForCaret(boolean rt)
          Enabled the current tree location for a caret change.
 void setEnabledXPathLocation(boolean enabled)
          Enabled XPath location each time the cursor change.
 void setEntityResolver(XMLEntityResolver resolver)
          Update the current entity resolver, it is useful for traducing char to entity while reading and the contrary when getting the current text
 void setErrorLineRenderer(LineRenderer renderer)
          Reset the renderer for error line.
static void setFocusBorder(javax.swing.border.Border border)
          Use this border when the editor has the focus.
 void setHighlightedErrorLine(int lineStart)
          Show the error line
 void setHighlightedXPathLine(java.util.List list)
           
 void setLineNumber(int num)
          reset the cart to the current line number
 void setSelectionHighlightColor(java.awt.Color selectionHighlightColor)
           
 void setSelectionLineRenderer(LineRenderer renderer)
          Reset the renderer for error line.
 void setText(java.io.InputStream input)
          Note : You must use setText on the XMLContainer rather than on this class Load the text from the inputstream.
 void setText(java.lang.String newText)
          Note : You must use setText on the XMLContainer rather than on this class
 void setUndoManager(javax.swing.undo.UndoManager undo)
          Reset the undo manager
 void setXMLContainer(XMLContainer container)
          Reset the container for this editor
 void setXPathLineRenderer(LineRenderer renderer)
           
 boolean showAttributeSyntaxHelperPopup(int offset)
          Show a popup for attributes syntax helping at this offset
 boolean showEntitySyntaxHelperPopup(int offset)
          Show a popup for entities syntax helping at this offset.
 boolean showSystemSyntaxHelperPopup(int offset)
          Show the popup for system syntax helping at this offset like comment or cdata
 boolean showTagSyntaxHelperPopup(int offset)
          Show the popup for tags syntax helping at this offset.
 void synchronousCurrentLocation(boolean waitTreeSynchro)
          Synchronous action for refreshing the current document location from the caret position
 void undo()
          Undo last action
 void unhighlightLine()
          Remove the highlight of the current line
 
Methods inherited from class javax.swing.JEditorPane
addHyperlinkListener, createEditorKitForContentType, fireHyperlinkUpdate, getAccessibleContext, getContentType, getEditorKitClassNameForContentType, getEditorKitForContentType, getHyperlinkListeners, getPage, getPreferredSize, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getUIClassID, read, registerEditorKitForContentType, registerEditorKitForContentType, removeHyperlinkListener, replaceSelection, scrollToReference, setContentType, setEditorKit, setEditorKitForContentType, setPage, setPage
 
Methods inherited from class javax.swing.text.JTextComponent
addCaretListener, addInputMethodListener, addKeymap, copy, cut, getActions, getCaret, getCaretColor, getCaretListeners, getCaretPosition, getDisabledTextColor, getDragEnabled, getFocusAccelerator, getHighlighter, getInputMethodRequests, getKeymap, getKeymap, getMargin, getNavigationFilter, getPreferredScrollableViewportSize, getScrollableBlockIncrement, getScrollableUnitIncrement, getSelectedText, getSelectedTextColor, getSelectionColor, getSelectionEnd, getSelectionStart, getText, getToolTipText, getUI, isEditable, loadKeymap, modelToView, moveCaretPosition, paste, read, removeCaretListener, removeKeymap, selectAll, setCaret, setCaretColor, setCaretPosition, setComponentOrientation, setDisabledTextColor, setDocument, setDragEnabled, setEditable, setFocusAccelerator, setHighlighter, setKeymap, setMargin, setNavigationFilter, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setUI, updateUI, viewToModel, write
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, 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, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, 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, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, 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, 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
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XMLEditor

public XMLEditor()
Method Detail

dispose

public void dispose()

addNotify

public void addNotify()
This method will call the init method


select

public void select(int selectionStart,
                   int selectionEnd)
Override of the standard JTextComponent.select Move caret to the start of the selection instead of the end


removeNotify

public void removeNotify()
This method will call the dispose method


showSystemSyntaxHelperPopup

public boolean showSystemSyntaxHelperPopup(int offset)
Show the popup for system syntax helping at this offset like comment or cdata

Parameters:
offset -
Returns:
false if the popup can't be show

showAttributeSyntaxHelperPopup

public boolean showAttributeSyntaxHelperPopup(int offset)
Show a popup for attributes syntax helping at this offset


showTagSyntaxHelperPopup

public boolean showTagSyntaxHelperPopup(int offset)
Show the popup for tags syntax helping at this offset.

Parameters:
offset -
Returns:
false if the popup can't be shown

getCurrentNodeLocation

public com.japisoft.fastparser.node.SimpleNode getCurrentNodeLocation()
Returns:
the current document location from the caret position

showEntitySyntaxHelperPopup

public boolean showEntitySyntaxHelperPopup(int offset)
Show a popup for entities syntax helping at this offset.

Parameters:
offset -
Returns:
false if the popup can't be shown

setXMLContainer

public void setXMLContainer(XMLContainer container)
Reset the container for this editor


getXMLContainer

public XMLContainer getXMLContainer()
Returns:
the container for this editor

getDocument

public javax.swing.text.Document getDocument()

resetDocument

public void resetDocument(XMLDocument doc)

setAutoResetAction

public void setAutoResetAction(boolean reset)
By default to true. This method will enable to reset the ActionModel each time the current editor take the focus. Thus all XMLAction will work with the good one.


isAutoResetAction

public boolean isAutoResetAction()
Returns:
true if a focusGained resets the ActionModel

focusGained

public void focusGained(java.awt.event.FocusEvent e)
Each time the editor take the focus. The actionModel wil be used to active all action on the current editor. User can change this behavior calling setAutoResetAction

Specified by:
focusGained in interface java.awt.event.FocusListener

setFocusBorder

public static void setFocusBorder(javax.swing.border.Border border)
Use this border when the editor has the focus. By default null


focusLost

public void focusLost(java.awt.event.FocusEvent e)
For the moment, nothing is done

Specified by:
focusLost in interface java.awt.event.FocusListener

setEnabledRealTimeStructureChanged

public void setEnabledRealTimeStructureChanged(boolean support)
Notify in real time any tree structure change. This is needed for real time tree synchronization


isEnabledRealTimeStructureChanged

public boolean isEnabledRealTimeStructureChanged()
Notify in real time any tree structure change. This is needed for real time tree synchronization


setAutoCloseTag

public void setAutoCloseTag(boolean autoClose)
Insert the closing tag while the user inserts the opening tag :true by default


isAutoCloseTag

public boolean isAutoCloseTag()
Does the closing tag is inserted automatically :true by default


resetDocumentState

public void resetDocumentState(boolean modified)
Only for internal usage. User shouldn't call it or override it


isDocumentModified

public boolean isDocumentModified()
Returns:
true if the current document has been modified once

notifyStructureChanged

public void notifyStructureChanged()
Notify that the structure has changed. This method should only appear in particular case like load a new document ...


paint

public void paint(java.awt.Graphics gc)

paintComponent

public void paintComponent(java.awt.Graphics gc)

setEditorContext

public void setEditorContext(EditorContext context)
Case for communication with the container. User shouldn't use it. Look at the LocationListener


notifyError

public void notifyError(int line,
                        java.lang.String message)
Notify an error to the following line with the tied message


notifyNoError

public void notifyNoError()
Notify no error found


resetDefaultLook

public void resetDefaultLook()
Reset the default color of the editor


getEditorKit

public javax.swing.text.EditorKit getEditorKit()

initKeymap

public void initKeymap()

setAction

public void setAction(javax.swing.KeyStroke key,
                      javax.swing.Action a)

setColorForDTDElement

public void setColorForDTDElement(java.awt.Color color)
Colorize !ELEMENT DTD definition


getColorForDTDElement

public java.awt.Color getColorForDTDElement()
Returns:
ELEMENT DTD color

setColorForDTDAttribute

public void setColorForDTDAttribute(java.awt.Color color)
Colorize !ATTRIBUTE DTD definition


getColorForDTDAttribute

public java.awt.Color getColorForDTDAttribute()
Returns:
ATTRIBUTE DTD color

setColorForDTDEntity

public void setColorForDTDEntity(java.awt.Color color)
Colorize !ENTITY DTD definition


getColorForDTDEntity

public java.awt.Color getColorForDTDEntity()
Returns:
ENTITY DTD color

setColorForTagBorderLine

public void setColorForTagBorderLine(java.awt.Color color)
Colorize the border line for tag delimiter


getColorForTagBorderLine

public java.awt.Color getColorForTagBorderLine()
Returns:
the color for the border line

setColorForCDATA

public void setColorForCDATA(java.awt.Color color)
Colorize CDATA section


setColorForTagUnderline

public void setColorForTagUnderline(java.awt.Color color)
Colorize underline for current selection


setColorForEntity

public void setColorForEntity(java.awt.Color color)
Colorize entity &ENTITY;


setColorForComment

public void setColorForComment(java.awt.Color color)
Colorize XML comment <!-- ... -->


setColorForDeclaration

public void setColorForDeclaration(java.awt.Color color)
Colorize XML declaration <? ... ?>


setColorForDocType

public void setColorForDocType(java.awt.Color color)
Colorize DocType declaration <! ... >


setColorForLiteral

public void setColorForLiteral(java.awt.Color color)
Colorize literal "..."


setColorForTag

public void setColorForTag(java.awt.Color color)
Colorize tag <Tag...


setColorForInvalid

public void setColorForInvalid(java.awt.Color color)
Colorize error


setColorForText

public void setColorForText(java.awt.Color color)
Colorize text


setColorForAttribute

public void setColorForAttribute(java.awt.Color color)
Colorize attribute <tag ATTRIBUTE="..." ...


setColorForTagDelimiter

public void setColorForTagDelimiter(java.awt.Color color)
Colorize tag delimiter < or >


setColorForAttributeSeparator

public void setColorForAttributeSeparator(java.awt.Color color)
Colorize '='


setColorForTagEnd

public void setColorForTagEnd(java.awt.Color color)
Colorize '/'


setColorForNameSpace

public void setColorForNameSpace(java.awt.Color color)
Colorize NameSpace


getColorForCDATA

public java.awt.Color getColorForCDATA()
Color for CDATA section


getColorForTagUnderline

public java.awt.Color getColorForTagUnderline()
Color for tag underline


getColorForNameSpace

public java.awt.Color getColorForNameSpace()
Colorize NameSpace


getColorForEntity

public java.awt.Color getColorForEntity()
Colorize entity &ENTITY;


getColorForComment

public java.awt.Color getColorForComment()
Colorize XML comment <!-- ... -->


getColorForDeclaration

public java.awt.Color getColorForDeclaration()
Colorize XML declaration <? ... ?>


getColorForDocType

public java.awt.Color getColorForDocType()
Colorize DocType declaration <! ... >


getColorForLiteral

public java.awt.Color getColorForLiteral()
Colorize literal "..."


getColorForTag

public java.awt.Color getColorForTag()
Colorize tag <Tag...


getColorForInvalid

public java.awt.Color getColorForInvalid()
Colorize error


getColorForText

public java.awt.Color getColorForText()
Colorize text


getColorForAttribute

public java.awt.Color getColorForAttribute()
Colorize attribute <tag ATTRIBUTE="..." ...


getColorForTagDelimiter

public java.awt.Color getColorForTagDelimiter()
Colorize tag delimiter < or >


getColorForAttributeSeparator

public java.awt.Color getColorForAttributeSeparator()
Colorize '='


getColorForTagEnd

public java.awt.Color getColorForTagEnd()
Colorize '/'


setUndoManager

public void setUndoManager(javax.swing.undo.UndoManager undo)
Reset the undo manager


getUndoManager

public javax.swing.undo.UndoManager getUndoManager()
Returns:
the current undo manager

undo

public void undo()
Undo last action


redo

public void redo()
Redo last action


setEntityResolver

public void setEntityResolver(XMLEntityResolver resolver)
Update the current entity resolver, it is useful for traducing char to entity while reading and the contrary when getting the current text


getEntityResolver

public XMLEntityResolver getEntityResolver()
Returns:
the current entity resolver

setText

public void setText(java.io.InputStream input)
             throws java.io.IOException
Note : You must use setText on the XMLContainer rather than on this class Load the text from the inputstream. The stream is closed after reading

Throws:
java.io.IOException

setText

public void setText(java.lang.String newText)
Note : You must use setText on the XMLContainer rather than on this class


getText

public java.lang.String getText(int from)
Returns:
a text starting from

getText

public java.lang.String getText()
Returns:
the current text

setLineNumber

public void setLineNumber(int num)
reset the cart to the current line number


insertText

public void insertText(java.lang.String text)
Insert a string at the current caret location


createDefaultEditorKit

public javax.swing.text.EditorKit createDefaultEditorKit()
Returns:
the current editor kit

unhighlightLine

public void unhighlightLine()
Remove the highlight of the current line


getLineStart

public int getLineStart(int caret)
Returns:
the start of the line for the caret position

getLineEnd

public int getLineEnd(int caret)
Returns:
the end of the line for the caret position

asynchronousHighlightLine

public void asynchronousHighlightLine(int line)
Highlight the line with an invokeLater


highlightLine

public void highlightLine(int line)
Highlight the line with the "selectionColor" property


removeHighlightedErrorLine

public void removeHighlightedErrorLine()
Remove error line


setHighlightedXPathLine

public void setHighlightedXPathLine(java.util.List list)

setHighlightedErrorLine

public void setHighlightedErrorLine(int lineStart)
Show the error line


setEnabledTreeLocationForCaret

public void setEnabledTreeLocationForCaret(boolean rt)
Enabled the current tree location for a caret change. This feature can reduce the velocity. So it should be disabled for heavy XML document


isEnabledTreeLocationForCaret

public boolean isEnabledTreeLocationForCaret()
Is Enabled the current tree location for a caret change ?. True by default


setEnabledXPathLocation

public void setEnabledXPathLocation(boolean enabled)
Enabled XPath location each time the cursor change. By default true


isEnabledXPathLocation

public boolean isEnabledXPathLocation()
Returns:
true if the xpath location is available on caret changes

notifyCurrentLocation

public void notifyCurrentLocation()
Notify to listener the current document location from the caret position. Note that this method shouldn't be called because this is done for caret changes and this is asynchronous. For instant action call rather reforceCurrentLocation


notifyCaretLocation

public void notifyCaretLocation()

synchronousCurrentLocation

public void synchronousCurrentLocation(boolean waitTreeSynchro)
Synchronous action for refreshing the current document location from the caret position

Parameters:
waitTreeSynchro - if true, the current thread will wait for a good text/tree synchro

caretUpdate

public void caretUpdate(javax.swing.event.CaretEvent e)
Structure computing

Specified by:
caretUpdate in interface javax.swing.event.CaretListener

setErrorLineRenderer

public void setErrorLineRenderer(LineRenderer renderer)
Reset the renderer for error line. This invokation should be done inside the Look step


setXPathLineRenderer

public void setXPathLineRenderer(LineRenderer renderer)

setSelectionLineRenderer

public void setSelectionLineRenderer(LineRenderer renderer)
Reset the renderer for error line. This invokation should be done inside the Look step


getSelectionHighlightColor

public java.awt.Color getSelectionHighlightColor()
Returns:
the highlight color

setSelectionHighlightColor

public void setSelectionHighlightColor(java.awt.Color selectionHighlightColor)
Parameters:
selectionHighlightColor - Reset the highlight line color