|
|||||||||||
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
javax.swing.text.JTextComponent
javax.swing.JEditorPane
com.japisoft.xmlpad.bean.XMLEditor
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
XMLContainer
,
XMLEditorKit
,
JEditorPane
,
Serialized FormNested 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 |
public XMLEditor()
Method Detail |
public void dispose()
public void addNotify()
init
method
public void select(int selectionStart, int selectionEnd)
public void removeNotify()
public boolean showSystemSyntaxHelperPopup(int offset)
offset
-
public boolean showAttributeSyntaxHelperPopup(int offset)
public boolean showTagSyntaxHelperPopup(int offset)
offset
-
false
if the popup can't be shownpublic com.japisoft.fastparser.node.SimpleNode getCurrentNodeLocation()
public boolean showEntitySyntaxHelperPopup(int offset)
offset
-
public void setXMLContainer(XMLContainer container)
public XMLContainer getXMLContainer()
public javax.swing.text.Document getDocument()
public void resetDocument(XMLDocument doc)
public void setAutoResetAction(boolean reset)
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.
public boolean isAutoResetAction()
true
if a focusGained
resets the
ActionModelpublic void focusGained(java.awt.event.FocusEvent e)
actionModel
wil
be used to active all action on the current editor. User can change this
behavior calling setAutoResetAction
focusGained
in interface java.awt.event.FocusListener
public static void setFocusBorder(javax.swing.border.Border border)
null
public void focusLost(java.awt.event.FocusEvent e)
focusLost
in interface java.awt.event.FocusListener
public void setEnabledRealTimeStructureChanged(boolean support)
public boolean isEnabledRealTimeStructureChanged()
public void setAutoCloseTag(boolean autoClose)
true
by default
public boolean isAutoCloseTag()
true
by
default
public void resetDocumentState(boolean modified)
public boolean isDocumentModified()
true
if the current document has been modified
oncepublic void notifyStructureChanged()
public void paint(java.awt.Graphics gc)
public void paintComponent(java.awt.Graphics gc)
public void setEditorContext(EditorContext context)
LocationListener
public void notifyError(int line, java.lang.String message)
public void notifyNoError()
public void resetDefaultLook()
public javax.swing.text.EditorKit getEditorKit()
public void initKeymap()
public void setAction(javax.swing.KeyStroke key, javax.swing.Action a)
public void setColorForDTDElement(java.awt.Color color)
public java.awt.Color getColorForDTDElement()
public void setColorForDTDAttribute(java.awt.Color color)
public java.awt.Color getColorForDTDAttribute()
public void setColorForDTDEntity(java.awt.Color color)
public java.awt.Color getColorForDTDEntity()
public void setColorForTagBorderLine(java.awt.Color color)
public java.awt.Color getColorForTagBorderLine()
public void setColorForCDATA(java.awt.Color color)
public void setColorForTagUnderline(java.awt.Color color)
public void setColorForEntity(java.awt.Color color)
public void setColorForComment(java.awt.Color color)
public void setColorForDeclaration(java.awt.Color color)
public void setColorForDocType(java.awt.Color color)
public void setColorForLiteral(java.awt.Color color)
public void setColorForTag(java.awt.Color color)
public void setColorForInvalid(java.awt.Color color)
public void setColorForText(java.awt.Color color)
public void setColorForAttribute(java.awt.Color color)
public void setColorForTagDelimiter(java.awt.Color color)
public void setColorForAttributeSeparator(java.awt.Color color)
public void setColorForTagEnd(java.awt.Color color)
public void setColorForNameSpace(java.awt.Color color)
public java.awt.Color getColorForCDATA()
public java.awt.Color getColorForTagUnderline()
public java.awt.Color getColorForNameSpace()
public java.awt.Color getColorForEntity()
public java.awt.Color getColorForComment()
public java.awt.Color getColorForDeclaration()
public java.awt.Color getColorForDocType()
public java.awt.Color getColorForLiteral()
public java.awt.Color getColorForTag()
public java.awt.Color getColorForInvalid()
public java.awt.Color getColorForText()
public java.awt.Color getColorForAttribute()
public java.awt.Color getColorForTagDelimiter()
public java.awt.Color getColorForAttributeSeparator()
public java.awt.Color getColorForTagEnd()
public void setUndoManager(javax.swing.undo.UndoManager undo)
public javax.swing.undo.UndoManager getUndoManager()
public void undo()
public void redo()
public void setEntityResolver(XMLEntityResolver resolver)
public XMLEntityResolver getEntityResolver()
public void setText(java.io.InputStream input) throws java.io.IOException
java.io.IOException
public void setText(java.lang.String newText)
public java.lang.String getText(int from)
public java.lang.String getText()
public void setLineNumber(int num)
public void insertText(java.lang.String text)
public javax.swing.text.EditorKit createDefaultEditorKit()
public void unhighlightLine()
public int getLineStart(int caret)
public int getLineEnd(int caret)
public void asynchronousHighlightLine(int line)
public void highlightLine(int line)
public void removeHighlightedErrorLine()
public void setHighlightedXPathLine(java.util.List list)
public void setHighlightedErrorLine(int lineStart)
public void setEnabledTreeLocationForCaret(boolean rt)
public boolean isEnabledTreeLocationForCaret()
public void setEnabledXPathLocation(boolean enabled)
true
public boolean isEnabledXPathLocation()
true
if the xpath location is available on caret changespublic void notifyCurrentLocation()
reforceCurrentLocation
public void notifyCaretLocation()
public void synchronousCurrentLocation(boolean waitTreeSynchro)
waitTreeSynchro
- if true
, the current thread will wait for a
good text/tree synchropublic void caretUpdate(javax.swing.event.CaretEvent e)
caretUpdate
in interface javax.swing.event.CaretListener
public void setErrorLineRenderer(LineRenderer renderer)
public void setXPathLineRenderer(LineRenderer renderer)
public void setSelectionLineRenderer(LineRenderer renderer)
public java.awt.Color getSelectionHighlightColor()
public void setSelectionHighlightColor(java.awt.Color selectionHighlightColor)
selectionHighlightColor
- Reset the highlight line color
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |