Home » openjdk-7 » javax » swing » text » [javadoc | source]
javax.swing.text
public class: DefaultEditorKit [javadoc | source]
java.lang.Object
   javax.swing.text.EditorKit
      javax.swing.text.DefaultEditorKit

All Implemented Interfaces:
    Cloneable, Serializable

Direct Known Subclasses:
    MyHTMLEditorKit, StyledEditorKit, PlainEditorKit, RTFEditorKit, BasicEditorKit, HTMLEditorKit

This is the set of things needed by a text component to be a reasonably functioning editor for some type of text document. This implementation provides a default implementation which treats text as plain text and provides a minimal set of actions for a simple editor.

Newlines
There are two properties which deal with newlines. The system property, line.separator, is defined to be platform-dependent, either "\n", "\r", or "\r\n". There is also a property defined in DefaultEditorKit, called EndOfLineStringProperty, which is defined automatically when a document is loaded, to be the first occurrence of any of the newline characters. When a document is loaded, EndOfLineStringProperty is set appropriately, and when the document is written back out, the EndOfLineStringProperty is used. But while the document is in memory, the "\n" character is used to define a newline, regardless of how the newline is defined when the document is on disk. Therefore, for searching purposes, "\n" should always be used. When a new document is created, and the EndOfLineStringProperty has not been defined, it will use the System property when writing out the document.

Note that EndOfLineStringProperty is set on the Document using the get/putProperty methods. Subclasses may override this behavior.

Nested Class Summary:
public static class  DefaultEditorKit.DefaultKeyTypedAction  The action that is executed by default if a key typed event is received and there is no keymap entry. There is a variation across different VM's in what gets sent as a key typed event, and this action tries to filter out the undesired events. This filters the control characters and those with the ALT modifier. It allows Control-Alt sequences through as these form legitimate unicode characters on some PC keyboards.

If the event doesn't get filtered, it will try to insert content into the text editor. The content is fetched from the command string of the ActionEvent. The text entry is done through the replaceSelection method on the target text component. This is the action that will be fired for most text entry tasks.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeansTM has been added to the java.beans package. Please see {@link java.beans.XMLEncoder}. 

public static class  DefaultEditorKit.InsertContentAction  Places content into the associated document. If there is a selection, it is removed before the new content is added.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeansTM has been added to the java.beans package. Please see {@link java.beans.XMLEncoder}. 

public static class  DefaultEditorKit.InsertBreakAction  Places a line/paragraph break into the document. If there is a selection, it is removed before the break is added.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeansTM has been added to the java.beans package. Please see {@link java.beans.XMLEncoder}. 

public static class  DefaultEditorKit.InsertTabAction  Places a tab character into the document. If there is a selection, it is removed before the tab is added.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeansTM has been added to the java.beans package. Please see {@link java.beans.XMLEncoder}. 

static class  DefaultEditorKit.DeletePrevCharAction   
static class  DefaultEditorKit.DeleteNextCharAction   
static class  DefaultEditorKit.DeleteWordAction   
static class  DefaultEditorKit.ReadOnlyAction   
static class  DefaultEditorKit.WritableAction   
public static class  DefaultEditorKit.CutAction  Cuts the selected region and place its contents into the system clipboard.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeansTM has been added to the java.beans package. Please see {@link java.beans.XMLEncoder}. 

public static class  DefaultEditorKit.CopyAction  Copies the selected region and place its contents into the system clipboard.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeansTM has been added to the java.beans package. Please see {@link java.beans.XMLEncoder}. 

public static class  DefaultEditorKit.PasteAction  Pastes the contents of the system clipboard into the selected region, or before the caret if nothing is selected.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeansTM has been added to the java.beans package. Please see {@link java.beans.XMLEncoder}. 

public static class  DefaultEditorKit.BeepAction  Creates a beep.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeansTM has been added to the java.beans package. Please see {@link java.beans.XMLEncoder}. 

static class  DefaultEditorKit.VerticalPageAction  Scrolls up/down vertically. The select version of this action extends the selection, instead of simply moving the caret. 
static class  DefaultEditorKit.PageAction  Pages one view to the left or right. 
static class  DefaultEditorKit.DumpModelAction   
static class  DefaultEditorKit.NextVisualPositionAction   
static class  DefaultEditorKit.BeginWordAction   
static class  DefaultEditorKit.EndWordAction   
static class  DefaultEditorKit.PreviousWordAction   
static class  DefaultEditorKit.NextWordAction   
static class  DefaultEditorKit.BeginLineAction   
static class  DefaultEditorKit.EndLineAction   
static class  DefaultEditorKit.BeginParagraphAction   
static class  DefaultEditorKit.EndParagraphAction   
static class  DefaultEditorKit.BeginAction   
static class  DefaultEditorKit.EndAction   
static class  DefaultEditorKit.SelectWordAction   
static class  DefaultEditorKit.SelectLineAction   
static class  DefaultEditorKit.SelectParagraphAction   
static class  DefaultEditorKit.SelectAllAction   
static class  DefaultEditorKit.UnselectAction   
static class  DefaultEditorKit.ToggleComponentOrientationAction   
Field Summary
public static final  String EndOfLineStringProperty    When reading a document if a CRLF is encountered a property with this name is added and the value will be "\r\n". 
public static final  String insertContentAction    Name of the action to place content into the associated document. If there is a selection, it is removed before the new content is added. 
public static final  String insertBreakAction    Name of the action to place a line/paragraph break into the document. If there is a selection, it is removed before the break is added. 
public static final  String insertTabAction    Name of the action to place a tab character into the document. If there is a selection, it is removed before the tab is added. 
public static final  String deletePrevCharAction    Name of the action to delete the character of content that precedes the current caret position. 
public static final  String deleteNextCharAction    Name of the action to delete the character of content that follows the current caret position. 
public static final  String deleteNextWordAction    Name of the action to delete the word that follows the beginning of the selection.
    Also see:
    getActions
    JTextComponent#getSelectionStart
    since: 1.6 -
 
public static final  String deletePrevWordAction    Name of the action to delete the word that precedes the beginning of the selection.
    Also see:
    getActions
    JTextComponent#getSelectionStart
    since: 1.6 -
 
public static final  String readOnlyAction    Name of the action to set the editor into read-only mode. 
public static final  String writableAction    Name of the action to set the editor into writeable mode. 
public static final  String cutAction    Name of the action to cut the selected region and place the contents into the system clipboard. 
public static final  String copyAction    Name of the action to copy the selected region and place the contents into the system clipboard. 
public static final  String pasteAction    Name of the action to paste the contents of the system clipboard into the selected region, or before the caret if nothing is selected. 
public static final  String beepAction    Name of the action to create a beep. 
public static final  String pageUpAction    Name of the action to page up vertically. 
public static final  String pageDownAction    Name of the action to page down vertically. 
static final  String selectionPageUpAction    Name of the action to page up vertically, and move the selection. 
static final  String selectionPageDownAction    Name of the action to page down vertically, and move the selection. 
static final  String selectionPageLeftAction    Name of the action to page left horizontally, and move the selection. 
static final  String selectionPageRightAction    Name of the action to page right horizontally, and move the selection. 
public static final  String forwardAction    Name of the Action for moving the caret logically forward one position. 
public static final  String backwardAction    Name of the Action for moving the caret logically backward one position. 
public static final  String selectionForwardAction    Name of the Action for extending the selection by moving the caret logically forward one position. 
public static final  String selectionBackwardAction    Name of the Action for extending the selection by moving the caret logically backward one position. 
public static final  String upAction    Name of the Action for moving the caret logically upward one position. 
public static final  String downAction    Name of the Action for moving the caret logically downward one position. 
public static final  String selectionUpAction    Name of the Action for moving the caret logically upward one position, extending the selection. 
public static final  String selectionDownAction    Name of the Action for moving the caret logically downward one position, extending the selection. 
public static final  String beginWordAction    Name of the Action for moving the caret to the beginning of a word. 
public static final  String endWordAction    Name of the Action for moving the caret to the end of a word. 
public static final  String selectionBeginWordAction    Name of the Action for moving the caret to the beginning of a word, extending the selection. 
public static final  String selectionEndWordAction    Name of the Action for moving the caret to the end of a word, extending the selection. 
public static final  String previousWordAction    Name of the Action for moving the caret to the beginning of the previous word. 
public static final  String nextWordAction    Name of the Action for moving the caret to the beginning of the next word. 
public static final  String selectionPreviousWordAction    Name of the Action for moving the selection to the beginning of the previous word, extending the selection. 
public static final  String selectionNextWordAction    Name of the Action for moving the selection to the beginning of the next word, extending the selection. 
public static final  String beginLineAction    Name of the Action for moving the caret to the beginning of a line. 
public static final  String endLineAction    Name of the Action for moving the caret to the end of a line. 
public static final  String selectionBeginLineAction    Name of the Action for moving the caret to the beginning of a line, extending the selection. 
public static final  String selectionEndLineAction    Name of the Action for moving the caret to the end of a line, extending the selection. 
public static final  String beginParagraphAction    Name of the Action for moving the caret to the beginning of a paragraph. 
public static final  String endParagraphAction    Name of the Action for moving the caret to the end of a paragraph. 
public static final  String selectionBeginParagraphAction    Name of the Action for moving the caret to the beginning of a paragraph, extending the selection. 
public static final  String selectionEndParagraphAction    Name of the Action for moving the caret to the end of a paragraph, extending the selection. 
public static final  String beginAction    Name of the Action for moving the caret to the beginning of the document. 
public static final  String endAction    Name of the Action for moving the caret to the end of the document. 
public static final  String selectionBeginAction    Name of the Action for moving the caret to the beginning of the document. 
public static final  String selectionEndAction    Name of the Action for moving the caret to the end of the document. 
public static final  String selectWordAction    Name of the Action for selecting a word around the caret. 
public static final  String selectLineAction    Name of the Action for selecting a line around the caret. 
public static final  String selectParagraphAction    Name of the Action for selecting a paragraph around the caret. 
public static final  String selectAllAction    Name of the Action for selecting the entire document 
static final  String unselectAction    Name of the Action for removing selection 
static final  String toggleComponentOrientationAction    Name of the Action for toggling the component's orientation. 
public static final  String defaultKeyTypedAction    Name of the action that is executed by default if a key typed event is received and there is no keymap entry. 
Constructor:
 public DefaultEditorKit() 
Method from javax.swing.text.DefaultEditorKit Summary:
createCaret,   createDefaultDocument,   getActions,   getContentType,   getInputAttributes,   getViewFactory,   read,   read,   write,   write
Methods from javax.swing.text.EditorKit:
clone,   createCaret,   createDefaultDocument,   deinstall,   getActions,   getContentType,   getViewFactory,   install,   read,   read,   write,   write
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from javax.swing.text.DefaultEditorKit Detail:
 public Caret createCaret() 
    Fetches a caret that can navigate through views produced by the associated ViewFactory.
 public Document createDefaultDocument() 
    Creates an uninitialized text storage model (PlainDocument) that is appropriate for this type of editor.
 public Action[] getActions() 
    Fetches the set of commands that can be used on a text component that is using a model and view produced by this kit.
 public String getContentType() 
    Gets the MIME type of the data that this kit represents support for. The default is text/plain.
 MutableAttributeSet getInputAttributes() 
    Gets the input attributes for the pane. This method exists for the benefit of StyledEditorKit so that the read method will pick up the correct attributes to apply to inserted text. This class's implementation simply returns null.
 public ViewFactory getViewFactory() 
    Fetches a factory that is suitable for producing views of any models that are produced by this kit. The default is to have the UI produce the factory, so this method has no implementation.
 public  void read(InputStream in,
    Document doc,
    int pos) throws IOException, BadLocationException 
    Inserts content from the given stream which is expected to be in a format appropriate for this kind of content handler.
 public  void read(Reader in,
    Document doc,
    int pos) throws IOException, BadLocationException 
    Inserts content from the given stream, which will be treated as plain text.
 public  void write(OutputStream out,
    Document doc,
    int pos,
    int len) throws IOException, BadLocationException 
    Writes content from a document to the given stream in a format appropriate for this kind of content handler.
 public  void write(Writer out,
    Document doc,
    int pos,
    int len) throws IOException, BadLocationException 
    Writes content from a document to the given stream as plain text.