net.sf.vex
Class VexComponent

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--net.sf.vex.VexComponent
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, javax.swing.Scrollable, SelectionProvider, java.io.Serializable

public class VexComponent
extends javax.swing.JComponent
implements javax.swing.Scrollable, SelectionProvider

A Swing component that allows the display and edit of an XML document with an associated CSS stylesheet.

See Also:
Serialized Form

Field Summary
 
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
VexComponent()
          Class constructor.
 
Method Summary
 void addSelectionListener(SelectionListener listener)
          Add the given SelectionChangeListener to be notified when the current selection changes.
 void beginWork()
          Signals the start of a set of operations that should be considered a single unit for undo/redo purposes.
 boolean canPaste()
          Returns true if the clipboard has content that can be pasted.
 boolean canPasteText()
          Returns true if the clipboard has plain text content that can be pasted.
 boolean canRedo()
           
 boolean canUndo()
           
 boolean canUnwrap()
          Returns true if the current element can be unwrapped, i.e.
 void copySelection()
          Copy the current selection to the clipboard.
static javax.swing.InputMap createInputMap()
          Create the input map for the control.
 void cutSelection()
          Cuts the current selection to the clipboard.
 void deleteNextChar()
          Deletes the character to the right of the caret.
 void deletePreviousChar()
          Deletes the character to the left of the caret.
 void deleteSelection()
          Delete the current selection.
 void endWork(boolean success)
          Signals the end of a set of operations that should be treated as a single unit for undo/redo purposes.
 BoxFactory getBoxFactory()
          Returns the BoxFactory used for generating boxes in the layout.
 java.awt.Rectangle getCaretBounds()
          Returns the rectangle occupied by the caret.
 int getCaretOffset()
          Return the offset into the document represented by the caret.
 Element getCurrentElement()
          Returns the element at the current caret offset.
 Document getDocument()
          Returns the document associated with this component.
 javax.swing.Action[] getInsertElementActions()
          Returns an array of InsertElementAction objects that are valid for the given caret offset and selection
static VexComponent getLastFocusedComponent()
          Returns the VexComponent that last had focus.
 int getMagicX()
          Returns the "magic x" coordinate.
 javax.swing.Action[] getMorphActions()
          Returns an array of MorphAction objects representing valid morphs at the given caret offset.
 java.awt.Dimension getPreferredScrollableViewportSize()
           
 int getScrollableBlockIncrement(java.awt.Rectangle visibleRect, int orientation, int direction)
           
 boolean getScrollableTracksViewportHeight()
           
 boolean getScrollableTracksViewportWidth()
           
 int getScrollableUnitIncrement(java.awt.Rectangle visibleRect, int orientation, int direction)
           
 DocumentFragment getSelectedFragment()
          Returns the currently selected document fragment, or null if there is no current selection.
 java.lang.String getSelectedText()
          Returns the currently selected string, or an empty string if there is no current selection.
 int getSelectionEnd()
          Returns the offset at which the selection ends.
 int getSelectionStart()
          Returns the offset at which the selection starts.
 StyleSheet getStyleSheet()
          Returns the style sheet used to format the document while editing.
static java.lang.String getUIString(java.lang.String name)
          Returns a string from the resource bundle for the current locale.
 int getUndoDepth()
          Returns the number of undoable edits that have occurred on this document since editing has started, not including limitations due to maximum undo depth.
 boolean hasSelection()
          Returns true if the user currently has some text selected.
 void insertElement(Element element)
          Inserts the given element at the current caret position.
 void insertFragment(DocumentFragment frag)
          Inserts the given document fragment at the current caret position.
 void insertText(java.lang.String text)
          Inserts the given text at the current caret position.
 boolean isAntiAliased()
          Returns the value of the antiAliased flag.
 void morph(Element element)
          Replaces the current element with the given element.
 void moveRelative(int distance)
          Moves the caret a given distance relative to the current caret offset.
 void moveRelative(int distance, boolean select)
          Moves the caret a given distance relative to the current caret offset.
 void moveTo(int offset)
          Moves the caret to a new offset.
 void moveTo(int offset, boolean select)
          Moves the caret to the new offset, possibly changing the selection.
 void moveToLineEnd(boolean select)
          Move the caret to the end of the current line.
 void moveToLineStart(boolean select)
          Move the caret to the start of the current line.
 void moveToNextLine(boolean select)
          Move the caret down to the next line.
 void moveToNextWord(boolean select)
          Moves the caret to the end of the current or next word.
 void moveToPreviousLine(boolean select)
          Moves the caret up to the previous line.
 void moveToPreviousWord(boolean select)
          Moves the caret to the start of the current or previous word.
protected  void paintComponent(java.awt.Graphics g)
           
 void paste()
          Paste the current clipboard contents into the document at the current caret position.
 void pasteText()
          Paste the current clipboard contents as plain text into the document at the current caret position.
 void redo()
          Redoes the last action on the redo stack.
 void relayout(boolean force)
          Causes this control to be laid out at a convenient time.
 void relayoutLater(boolean force)
          Calls relayout from the Swing event loop rather than immediately.
 void removeAttribute(java.lang.String attributeName)
          Removes an attribute from the current element.
 void removeSelectionListener(SelectionListener listener)
          Remove the given SelectionChangeListener from the notification list.
 void selectWord()
          Selects the word at the current caret offset.
 void setAntiAliased(boolean antiAliased)
          Sets the value of the antiAliased flag.
 void setAttribute(java.lang.String attributeName, java.lang.String value)
          Sets the value of an attribute in the current element.
 void setBoxFactory(BoxFactory boxFactory)
          Sets the box factory to be applied to the current document during editing.
 void setDocument(Document document, StyleSheet styleSheet)
          Sets a new document for this control.
 void setDocument(Document document, StyleSheet styleSheet, BoxFactory boxFactory)
          Sets a new document for this control, providing a custom BoxFactory.
 void setDocument(java.net.URL docUrl, java.net.URL ssUrl)
          Sets the document to be displayed in the component.
 void setMagicX(int magicX)
          Sets the magic X value.
 void setStyleSheet(StyleSheet styleSheet)
          Sets the style sheet to be applied to the current document during editing.
 void showInsertElementPopup()
          Display a popup menu of valid elements to insert at the current caret position.
 void showMorphElementPopup()
          Display a popup menu of valid elements to which the current element can be morphed.
 void split()
          Split the element at the current caret offset.
 void undo()
          Undoes the last action on the undo stack.
 void unwrap()
          Unwraps the current element.
 int viewToModel(int x, int y)
          Return the offset into the document for the given coordinates.
 
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, 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, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, 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, 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, addInputMethodListener, 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, getInputMethodRequests, 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, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, 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
 

Constructor Detail

VexComponent

public VexComponent()
Class constructor.

Method Detail

getPreferredScrollableViewportSize

public java.awt.Dimension getPreferredScrollableViewportSize()
Specified by:
getPreferredScrollableViewportSize in interface javax.swing.Scrollable

getScrollableBlockIncrement

public int getScrollableBlockIncrement(java.awt.Rectangle visibleRect,
                                       int orientation,
                                       int direction)
Specified by:
getScrollableBlockIncrement in interface javax.swing.Scrollable

getScrollableTracksViewportHeight

public boolean getScrollableTracksViewportHeight()
Specified by:
getScrollableTracksViewportHeight in interface javax.swing.Scrollable

getScrollableTracksViewportWidth

public boolean getScrollableTracksViewportWidth()
Specified by:
getScrollableTracksViewportWidth in interface javax.swing.Scrollable

getScrollableUnitIncrement

public int getScrollableUnitIncrement(java.awt.Rectangle visibleRect,
                                      int orientation,
                                      int direction)
Specified by:
getScrollableUnitIncrement in interface javax.swing.Scrollable

addSelectionListener

public void addSelectionListener(SelectionListener listener)
Description copied from interface: SelectionProvider
Add the given SelectionChangeListener to be notified when the current selection changes.

Specified by:
addSelectionListener in interface SelectionProvider
Parameters:
listener - SelectionChangeListener to add.
See Also:
SelectionProvider.addSelectionListener(net.sf.vex.SelectionListener)

beginWork

public void beginWork()
Signals the start of a set of operations that should be considered a single unit for undo/redo purposes. Each call to beginWork should be matched with a call to endWork. The following pattern can be used to enforce this rules even in the face of exceptions.
 VexComponent c = ...;
 boolean success = false;
 try {
     c.beginWork();
     // do multiple inserts/deletes
     success = true;
 } finally {
     c.endWork(success);
 }
 

In the case of nested beginWork/endWork calls, only the outermost results in an undoable event.

See Also:
endWork(boolean)

canPaste

public boolean canPaste()
Returns true if the clipboard has content that can be pasted. Used to enable/disable the paste action of a containing application.


canPasteText

public boolean canPasteText()
Returns true if the clipboard has plain text content that can be pasted. Used to enable/disable the "paste text" action of a containing application.


canRedo

public boolean canRedo()
Returns:
true if a redo can be performed.

canUndo

public boolean canUndo()
Returns:
true if an undo can be performed.

canUnwrap

public boolean canUnwrap()
Returns true if the current element can be unwrapped, i.e. replaced with its content.


copySelection

public void copySelection()
Copy the current selection to the clipboard.


cutSelection

public void cutSelection()
Cuts the current selection to the clipboard.


deleteNextChar

public void deleteNextChar()
                    throws DocumentValidationException
Deletes the character to the right of the caret.

DocumentValidationException

deletePreviousChar

public void deletePreviousChar()
                        throws DocumentValidationException
Deletes the character to the left of the caret.

DocumentValidationException

deleteSelection

public void deleteSelection()
Delete the current selection. Does nothing if there is no current selection.


endWork

public void endWork(boolean success)
Signals the end of a set of operations that should be treated as a single unit for undo/redo purposes.

Parameters:
success - If true, an edit is added to the undo stack. If false, all the changes since the matching beginWork call are undone.
See Also:
beginWork()

getBoxFactory

public BoxFactory getBoxFactory()
Returns the BoxFactory used for generating boxes in the layout.


getCaretOffset

public int getCaretOffset()
Return the offset into the document represented by the caret.


getCurrentElement

public Element getCurrentElement()
Returns the element at the current caret offset.


getCaretBounds

public java.awt.Rectangle getCaretBounds()
Returns the rectangle occupied by the caret.


getDocument

public Document getDocument()
Returns the document associated with this component.


getInsertElementActions

public javax.swing.Action[] getInsertElementActions()
Returns an array of InsertElementAction objects that are valid for the given caret offset and selection


isAntiAliased

public boolean isAntiAliased()
Returns the value of the antiAliased flag.


getLastFocusedComponent

public static VexComponent getLastFocusedComponent()
Returns the VexComponent that last had focus.


getMagicX

public int getMagicX()
Returns the "magic x" coordinate. The magic x when moving vertically between uneven lines. Magic x is reset to -1 by setCaretOffset.


getMorphActions

public javax.swing.Action[] getMorphActions()
Returns an array of MorphAction objects representing valid morphs at the given caret offset.


getSelectionEnd

public int getSelectionEnd()
Returns the offset at which the selection ends.


getSelectionStart

public int getSelectionStart()
Returns the offset at which the selection starts.


getSelectedFragment

public DocumentFragment getSelectedFragment()
Returns the currently selected document fragment, or null if there is no current selection.


getSelectedText

public java.lang.String getSelectedText()
Returns the currently selected string, or an empty string if there is no current selection.


getStyleSheet

public StyleSheet getStyleSheet()
Returns the style sheet used to format the document while editing.


getUIString

public static java.lang.String getUIString(java.lang.String name)
Returns a string from the resource bundle for the current locale. If the string is not found in the resource bundle, returns null.

Parameters:
name - property for which to return the string.

getUndoDepth

public int getUndoDepth()
Returns the number of undoable edits that have occurred on this document since editing has started, not including limitations due to maximum undo depth.


hasSelection

public boolean hasSelection()
Returns true if the user currently has some text selected.


insertFragment

public void insertFragment(DocumentFragment frag)
                    throws DocumentValidationException
Inserts the given document fragment at the current caret position. Any selected content is deleted.

Parameters:
frag - DocumentFragment to insert.
DocumentValidationException

insertElement

public void insertElement(Element element)
                   throws DocumentValidationException
Inserts the given element at the current caret position. Any selected content becomes the new contents of the element.

Parameters:
element - Element to insert.
DocumentValidationException

insertText

public void insertText(java.lang.String text)
                throws DocumentValidationException
Inserts the given text at the current caret position. Any selected content is first deleted.

Parameters:
text - String to insert.
DocumentValidationException

morph

public void morph(Element element)
           throws DocumentValidationException
Replaces the current element with the given element. The content of the element is preserved.

Parameters:
element - Element to replace the current element with.
Throws:
DocumentValidationException - if the given element is not valid at this place in the document, or if the current element's content is not compatible with the given element.

moveRelative

public void moveRelative(int distance)
Moves the caret a given distance relative to the current caret offset.

Parameters:
distance - Amount by which to alter the caret offset. Positive values increase the caret offset.

moveRelative

public void moveRelative(int distance,
                         boolean select)
Moves the caret a given distance relative to the current caret offset.

Parameters:
distance - Amount by which to alter the caret offset. Positive values increase the caret offset.
select - if true, the current selection is extended to match the new caret offset

moveTo

public void moveTo(int offset)
Moves the caret to a new offset. The selection is not extended. This is equivalent to moveTo(offset, false).


moveTo

public void moveTo(int offset,
                   boolean select)
Moves the caret to the new offset, possibly changing the selection.

Parameters:
select - if true, the current selection is extended to match the new caret offset.

moveToLineEnd

public void moveToLineEnd(boolean select)
Move the caret to the end of the current line.

Parameters:
select - If true, the selection is extended.

moveToLineStart

public void moveToLineStart(boolean select)
Move the caret to the start of the current line.

Parameters:
select - If true, the selection is extended.

moveToNextLine

public void moveToNextLine(boolean select)
Move the caret down to the next line. Attempts to preserve the same distance from the left edge of the control.

Parameters:
select - If true, the selection is extended.

moveToNextWord

public void moveToNextWord(boolean select)
Moves the caret to the end of the current or next word.

Parameters:
select - If true, the selection is extended.

moveToPreviousLine

public void moveToPreviousLine(boolean select)
Moves the caret up to the previous line.

Parameters:
select - If true, the selection is extended

moveToPreviousWord

public void moveToPreviousWord(boolean select)
Moves the caret to the start of the current or previous word.

Parameters:
select - If true, the selection is extended.

paintComponent

protected void paintComponent(java.awt.Graphics g)
Overrides:
paintComponent in class javax.swing.JComponent

paste

public void paste()
           throws DocumentValidationException
Paste the current clipboard contents into the document at the current caret position.

DocumentValidationException

pasteText

public void pasteText()
               throws DocumentValidationException
Paste the current clipboard contents as plain text into the document at the current caret position.

DocumentValidationException

redo

public void redo()
          throws javax.swing.undo.CannotRedoException
Redoes the last action on the redo stack.

javax.swing.undo.CannotRedoException

relayout

public void relayout(boolean force)
Causes this control to be laid out at a convenient time. This should be called whenever the content changes, rather than calling layout directly.

Parameters:
force - Layout should be forced, e.g. when the width of the component changed.

relayoutLater

public void relayoutLater(boolean force)
Calls relayout from the Swing event loop rather than immediately.

Parameters:
force - Layout should be forced, e.g. when the width of the component changed.

removeAttribute

public void removeAttribute(java.lang.String attributeName)
Removes an attribute from the current element. Attributes removed in this manner (as opposed to calling Element.setAttribute directly) will be subject to undo/redo.

Parameters:
attributeName - Name of the attribute to remove.

removeSelectionListener

public void removeSelectionListener(SelectionListener listener)
Description copied from interface: SelectionProvider
Remove the given SelectionChangeListener from the notification list.

Specified by:
removeSelectionListener in interface SelectionProvider
Parameters:
listener - SelectionChangeListener to remove.
See Also:
SelectionProvider.removeSelectionListener(net.sf.vex.SelectionListener)

selectWord

public void selectWord()
Selects the word at the current caret offset.


setAntiAliased

public void setAntiAliased(boolean antiAliased)
Sets the value of the antiAliased flag.

Parameters:
antiAliased - if true, text is rendered using antialiasing.

setAttribute

public void setAttribute(java.lang.String attributeName,
                         java.lang.String value)
Sets the value of an attribute in the current element. Attributes set in this manner (as opposed to calling Element.setAttribute directly) will be subject to undo/redo.

Parameters:
attributeName - Name of the attribute being changed.
value - New value for the attribute. If null, the attribute is removed from the element.

setBoxFactory

public void setBoxFactory(BoxFactory boxFactory)
Sets the box factory to be applied to the current document during editing.

Parameters:
boxFactory - the new BoxFactory to use

setDocument

public void setDocument(Document document,
                        StyleSheet styleSheet)
Sets a new document for this control.

Parameters:
document - new Document to display
styleSheet - StyleSheet to use for formatting

setDocument

public void setDocument(Document document,
                        StyleSheet styleSheet,
                        BoxFactory boxFactory)
Sets a new document for this control, providing a custom BoxFactory.

Parameters:
document - new Document to display
styleSheet - StyleSheet to use for formatting
boxFactory - BoxFactory to use during layout

setDocument

public void setDocument(java.net.URL docUrl,
                        java.net.URL ssUrl)
                 throws java.io.IOException,
                        javax.xml.parsers.ParserConfigurationException,
                        org.xml.sax.SAXException
Sets the document to be displayed in the component. Uses the CssBoxFactory for the normal, CSS-styled layout.

Parameters:
docUrl - URL of the document to be displayed.
ssUrl - URL of the CSS style sheet to use.
java.io.IOException
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException

setMagicX

public void setMagicX(int magicX)
Sets the magic X value.

Parameters:
magicX - the new value for magic X.

setStyleSheet

public void setStyleSheet(StyleSheet styleSheet)
Sets the style sheet to be applied to the current document during editing. If no resolver has been set, the style sheet will also be used for any subsequently loaded documents. If a resolver has been set, the style sheet returned by the resolver will be used for subsequently loaded documents.

Parameters:
styleSheet - the new StyleSheet to use

showInsertElementPopup

public void showInsertElementPopup()
Display a popup menu of valid elements to insert at the current caret position.


showMorphElementPopup

public void showMorphElementPopup()
Display a popup menu of valid elements to which the current element can be morphed.


split

public void split()
           throws DocumentValidationException
Split the element at the current caret offset. This is the normal behaviour when the user presses Enter.

DocumentValidationException

undo

public void undo()
          throws javax.swing.undo.CannotUndoException
Undoes the last action on the undo stack.

javax.swing.undo.CannotUndoException

unwrap

public void unwrap()
            throws DocumentValidationException
Unwraps the current element. Unwrapping is the process of moving the element's content into the parent element and deleting the element.

DocumentValidationException

viewToModel

public int viewToModel(int x,
                       int y)
Return the offset into the document for the given coordinates.

Parameters:
x - the x-coordinate
y - the y-coordinate

createInputMap

public static javax.swing.InputMap createInputMap()
Create the input map for the control. This input map can reference both static and non-static actions.