Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.robrohan.editorkit
Class XMLEditorPane  view XMLEditorPane download XMLEditorPane.java

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byorg.syntax.jedit.JEditTextArea
                  extended bycom.robrohan.editorkit.XMLEditorPane
All Implemented Interfaces:
java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.swing.event.UndoableEditListener
Direct Known Subclasses:
XMLEditorPaneDnD

public class XMLEditorPane
extends org.syntax.jedit.JEditTextArea
implements javax.swing.event.UndoableEditListener

this is the main component for entering text (xml or xslt)


Nested Class Summary
(package private)  class XMLEditorPane.AnalyzeHandler
           
(package private)  class XMLEditorPane.AnalyzeParser
           
(package private)  class XMLEditorPane.commentSection
           
(package private)  class XMLEditorPane.errorHandler
           
(package private)  class XMLEditorPane.fileProperties
           
(package private)  class XMLEditorPane.goToLine
           
(package private)  class XMLEditorPane.loadFileAction
           
(package private)  class XMLEditorPane.redoAction
           
(package private)  class XMLEditorPane.saveAsFileAction
           
(package private)  class XMLEditorPane.saveFileAction
           
(package private)  class XMLEditorPane.undoAction
           
(package private)  class XMLEditorPane.validateAction
           
 
Nested classes inherited from class org.syntax.jedit.JEditTextArea
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
(package private)  java.util.Hashtable actionHash
          all the actions this pane can have
private  java.io.File currentFile
          the file this pane has loaded
 java.lang.String encodingtype
          encoding type for this pane
(package private)  javax.swing.JFileChooser fileChooser
           
(package private)  com.robrohan.treebeard.LoadFile fileLoader
          handle to the file loader (used to get files from the web or disk)
private  boolean fileReferenced
          flag to say if the xml file is in the pane or just referenced on disk
private  javax.swing.ImageIcon load_icon
          the icons
 XMLEditorPane panePtr
          pointer to this pane (used in inner classes)
private  javax.swing.ImageIcon redo_icon
          the icons
(package private)  javax.swing.JPopupMenu rmenu
          the right click menu (context menu)
private  javax.swing.ImageIcon save_icon
          the icons
 java.lang.String SAXFactory
          the SAXFactory to use (set by caller)
private  javax.swing.Timer timer
           
 javax.swing.undo.UndoManager undo
          for pane undos
private  javax.swing.ImageIcon undo_icon
          the icons
 java.lang.String valErrors
          any validation errors will be bubbled up to the container
 
Fields inherited from class org.syntax.jedit.JEditTextArea
biasLeft, blink, BOTTOM, bracketLine, bracketPosition, caretBlinks, caretEvent, caretTimer, caretVisible, CENTER, document, documentHandler, editable, electricScroll, firstLine, focusedComponent, horizontal, horizontalOffset, inputHandler, LEFT_OF_SCROLLBAR, lineSegment, listenerList, magicCaret, overwrite, painter, popup, rectSelect, RIGHT, scrollBarsInitialized, selectionEnd, selectionEndLine, selectionStart, selectionStartLine, vertical, visibleLines
 
Fields inherited from class javax.swing.JComponent
accessibleContext, 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
XMLEditorPane(java.lang.String type)
          Creates a new instance of XMLEditorPane
 
Method Summary
 void addKeyword(java.lang.String keyword, byte type)
          add a keyword to the keyword list (in tokenmarker) and set the type heavly tied to jedit
 void createNewDocument(java.lang.String contenttype)
          Creates a new document and sets a syntax highlighting type
 void createNewDocument(java.lang.String contenttype, java.lang.String defaultText)
          Creates a new document, sets a syntax highlighting type, and adds default text
 void doAnalyze()
          parse the textAreas contents and look for namespaces.
 void doValidate()
          Validates this panes contents.
 java.io.File getCurrentFile()
          gets the current file
 javax.swing.Action getLoadAction()
          Gets a handle to the load action to envoke loads from outside the class
 javax.swing.Action getRedoAction()
          Gets a handle to the redo action to envoke redos from outside the class
 javax.swing.Action getSaveAction()
          Gets a handle to the save action to envoke saves from outside the class
 javax.swing.Action getSaveAsAction()
          Gets a handle to the saveas action to envoke saveas' from outside the class
 javax.swing.Action getUndoAction()
          Gets a handle to the undo action to envoke undos from outside the class
private  java.lang.String guessFileType(java.lang.String filename)
           
 boolean isKeywordAdded(java.lang.String keyword)
          checks to see if a keyword is already listed in the TokenMarker this is crazy, but it works
 boolean isReferenced()
          to tell if the file is loaded into this pane, or just referenced.
 void killAnalyzer()
          kill the analyzer (looking for namespaces and such)
protected  void loadFile(java.io.File file)
           
 void openFile(java.lang.String title)
          Envokes the loadFile dialog and then trys to open the file from the fileLoader dialog box.
 void processMouseEvent(java.awt.event.MouseEvent e)
          envokes the right click menu (context menu)
private  void save()
           
 void saveAs()
          Envokes the saveas dialog to save this panes contents to disk
private  void saveFile(java.io.File file)
           
private  void setPage(java.lang.String URI)
           
 void setText(java.io.InputStream iso)
          Set this panes text from an input stream
 void stopAnalyzer()
          top the analyzer from parsing the textArea (looking for namespaces and such)
private  void tellMessage(java.lang.String message)
           
 void undoableEditHappened(javax.swing.event.UndoableEditEvent a)
          Adds an undo event to the undo tracker
 
Methods inherited from class org.syntax.jedit.JEditTextArea
_offsetToX, addCaretListener, blinkCaret, copy, cut, documentChanged, fireCaretEvent, getBracketLine, getBracketPosition, getCaretLine, getCaretPosition, getDocument, getDocumentLength, getElectricScroll, getFirstLine, getHorizontalOffset, getInputHandler, getLineCount, getLineEndOffset, getLineLength, getLineOfOffset, getLineStartOffset, getLineText, getLineText, getMagicCaretPosition, getMarkLine, getMarkPosition, getPainter, getRightClickPopup, getSelectedText, getSelectionEnd, getSelectionEnd, getSelectionEndLine, getSelectionStart, getSelectionStart, getSelectionStartLine, getText, getText, getText, getTokenMarker, getVisibleLines, isCaretBlinkEnabled, isCaretVisible, isEditable, isManagingFocus, isOverwriteEnabled, isSelectionRectangular, lineToY, offsetToX, overwriteSetSelectedText, paste, processKeyEvent, recalculateVisibleLines, removeCaretListener, removeNotify, scrollTo, scrollToCaret, select, selectAll, selectNone, setCaretBlinkEnabled, setCaretPosition, setCaretVisible, setDocument, setEditable, setElectricScroll, setFirstLine, setHorizontalOffset, setInputHandler, setMagicCaretPosition, setOrigin, setOverwriteEnabled, setRightClickPopup, setSelectedText, setSelectionEnd, setSelectionRectangular, setSelectionStart, setText, setTokenMarker, updateBracketHighlight, updateScrollBars, xToOffset, xyToOffset, yToLine
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, 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, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, 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, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, 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, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, 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, 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, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

actionHash

java.util.Hashtable actionHash
all the actions this pane can have


rmenu

javax.swing.JPopupMenu rmenu
the right click menu (context menu)


fileLoader

com.robrohan.treebeard.LoadFile fileLoader
handle to the file loader (used to get files from the web or disk)


fileChooser

javax.swing.JFileChooser fileChooser

SAXFactory

public java.lang.String SAXFactory
the SAXFactory to use (set by caller)


undo

public javax.swing.undo.UndoManager undo
for pane undos


currentFile

private java.io.File currentFile
the file this pane has loaded


valErrors

public java.lang.String valErrors
any validation errors will be bubbled up to the container


load_icon

private javax.swing.ImageIcon load_icon
the icons


save_icon

private javax.swing.ImageIcon save_icon
the icons


undo_icon

private javax.swing.ImageIcon undo_icon
the icons


redo_icon

private javax.swing.ImageIcon redo_icon
the icons


fileReferenced

private boolean fileReferenced
flag to say if the xml file is in the pane or just referenced on disk


encodingtype

public java.lang.String encodingtype
encoding type for this pane


panePtr

public final XMLEditorPane panePtr
pointer to this pane (used in inner classes)


timer

private javax.swing.Timer timer
Constructor Detail

XMLEditorPane

public XMLEditorPane(java.lang.String type)
Creates a new instance of XMLEditorPane

Method Detail

createNewDocument

public void createNewDocument(java.lang.String contenttype)
Creates a new document and sets a syntax highlighting type


createNewDocument

public void createNewDocument(java.lang.String contenttype,
                              java.lang.String defaultText)
Creates a new document, sets a syntax highlighting type, and adds default text


setText

public void setText(java.io.InputStream iso)
Set this panes text from an input stream


getCurrentFile

public java.io.File getCurrentFile()
gets the current file


undoableEditHappened

public void undoableEditHappened(javax.swing.event.UndoableEditEvent a)
Adds an undo event to the undo tracker

Specified by:
undoableEditHappened in interface javax.swing.event.UndoableEditListener

getUndoAction

public javax.swing.Action getUndoAction()
Gets a handle to the undo action to envoke undos from outside the class


getRedoAction

public javax.swing.Action getRedoAction()
Gets a handle to the redo action to envoke redos from outside the class


getSaveAction

public javax.swing.Action getSaveAction()
Gets a handle to the save action to envoke saves from outside the class


getSaveAsAction

public javax.swing.Action getSaveAsAction()
Gets a handle to the saveas action to envoke saveas' from outside the class


getLoadAction

public javax.swing.Action getLoadAction()
Gets a handle to the load action to envoke loads from outside the class


tellMessage

private void tellMessage(java.lang.String message)

processMouseEvent

public void processMouseEvent(java.awt.event.MouseEvent e)
envokes the right click menu (context menu)


stopAnalyzer

public void stopAnalyzer()
top the analyzer from parsing the textArea (looking for namespaces and such)


killAnalyzer

public void killAnalyzer()
kill the analyzer (looking for namespaces and such)


doValidate

public void doValidate()
Validates this panes contents. This function uses the currently select xml parser so if it does not do validation, this will not do anything. It will write any errors to the valErrors String


doAnalyze

public void doAnalyze()
parse the textAreas contents and look for namespaces. This will be used in codecompletion / insite stuff eventually


isKeywordAdded

public boolean isKeywordAdded(java.lang.String keyword)
checks to see if a keyword is already listed in the TokenMarker this is crazy, but it works


addKeyword

public void addKeyword(java.lang.String keyword,
                       byte type)
add a keyword to the keyword list (in tokenmarker) and set the type heavly tied to jedit


openFile

public void openFile(java.lang.String title)
Envokes the loadFile dialog and then trys to open the file from the fileLoader dialog box. Can load either a file off disk or from an http(s) address.


isReferenced

public boolean isReferenced()
to tell if the file is loaded into this pane, or just referenced.


setPage

private void setPage(java.lang.String URI)

loadFile

protected void loadFile(java.io.File file)

guessFileType

private java.lang.String guessFileType(java.lang.String filename)

save

private void save()

saveAs

public void saveAs()
Envokes the saveas dialog to save this panes contents to disk


saveFile

private void saveFile(java.io.File file)