public class DefaultSyntaxKit
extends javax.swing.text.DefaultEditorKit
implements javax.swing.text.ViewFactory
javax.swing.text.DefaultEditorKit.BeepAction, javax.swing.text.DefaultEditorKit.CopyAction, javax.swing.text.DefaultEditorKit.CutAction, javax.swing.text.DefaultEditorKit.DefaultKeyTypedAction, javax.swing.text.DefaultEditorKit.InsertBreakAction, javax.swing.text.DefaultEditorKit.InsertContentAction, javax.swing.text.DefaultEditorKit.InsertTabAction, javax.swing.text.DefaultEditorKit.PasteAction| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
CONFIG_CARETCOLOR |
static java.lang.String |
CONFIG_COMPONENTS |
static java.lang.String |
CONFIG_MENU |
static java.lang.String |
CONFIG_SELECTION |
static java.lang.String |
CONFIG_TOOLBAR |
static java.lang.String |
CONFIG_TOOLBAR_BORDER |
static java.lang.String |
CONFIG_TOOLBAR_BORDER_SIZE |
static java.lang.String |
CONFIG_TOOLBAR_OPAQUE |
static java.lang.String |
CONFIG_TOOLBAR_ROLLOVER |
backwardAction, beepAction, beginAction, beginLineAction, beginParagraphAction, beginWordAction, copyAction, cutAction, defaultKeyTypedAction, deleteNextCharAction, deleteNextWordAction, deletePrevCharAction, deletePrevWordAction, downAction, endAction, endLineAction, EndOfLineStringProperty, endParagraphAction, endWordAction, forwardAction, insertBreakAction, insertContentAction, insertTabAction, nextWordAction, pageDownAction, pageUpAction, pasteAction, previousWordAction, readOnlyAction, selectAllAction, selectionBackwardAction, selectionBeginAction, selectionBeginLineAction, selectionBeginParagraphAction, selectionBeginWordAction, selectionDownAction, selectionEndAction, selectionEndLineAction, selectionEndParagraphAction, selectionEndWordAction, selectionForwardAction, selectionNextWordAction, selectionPreviousWordAction, selectionUpAction, selectLineAction, selectParagraphAction, selectWordAction, upAction, writableAction| Constructor and Description |
|---|
DefaultSyntaxKit(Lexer lexer)
Creates a new Kit for the given language
|
| Modifier and Type | Method and Description |
|---|---|
static void |
addAbbreviation(java.lang.String abbr,
java.lang.String template)
Adds an abbreviation to this kit's abbreviations.
|
void |
addActions(javax.swing.JEditorPane editorPane)
Adds keyboard actions to this control using the Configuration we have
This is revised to properly use InputMap and ActionMap of the component
instead of using the KeyMaps directly.
|
void |
addComponents(javax.swing.JEditorPane editorPane)
Adds UI components to the pane
|
void |
addPopupMenu(javax.swing.JEditorPane editorPane)
Adds a popup menu to the editorPane if needed.
|
void |
addToolBarActions(javax.swing.JEditorPane editorPane,
javax.swing.JToolBar toolbar)
Adds all pop-up menu items to a Toolbar.
|
javax.swing.text.View |
create(javax.swing.text.Element element) |
javax.swing.text.Document |
createDefaultDocument()
This is called by Swing to create a Document for the JEditorPane document
This may be called before you actually get a reference to the control.
|
void |
deinstall(javax.swing.JEditorPane editorPane) |
void |
deinstallComponent(javax.swing.JEditorPane pane,
java.lang.String className)
Finds the SyntaxComponent with given class name that is installed
on the given pane, then de-installs and removes it fom the
editorComponents list
|
static java.lang.String |
getAbbreviation(java.lang.String abbr)
Gets the template for the given abbreviation
|
java.util.Map<java.lang.String,java.lang.String> |
getAbbreviations() |
Configuration |
getConfig()
Gets the configuration for this Object
|
static Configuration |
getConfig(java.lang.Class<? extends DefaultSyntaxKit> kit)
Returns the Configurations object for a Kit.
|
java.lang.String |
getContentType() |
static java.lang.String[] |
getContentTypes()
Return all the content types supported by this library.
|
java.lang.String |
getProperty(java.lang.String key)
Return the property with the given key.
|
javax.swing.text.ViewFactory |
getViewFactory() |
static void |
initKit()
This is called to initialize the list of
Lexers we have. |
void |
install(javax.swing.JEditorPane editorPane)
Installs the View on the given EditorPane.
|
void |
installComponent(javax.swing.JEditorPane pane,
java.lang.String className)
Creates a SyntaxComponent of the the given class name and installs it on the pane
|
boolean |
isComponentInstalled(javax.swing.JEditorPane pane,
java.lang.String className)
Checks if the component with given class-name is installed on the pane.
|
void |
read(java.io.Reader in,
javax.swing.text.Document doc,
int pos) |
static void |
registerContentType(java.lang.String type,
java.lang.String className)
Registers the given content type to use the given class name as its kit
When this is called, an entry is added into the private HashMap of the
registered editors kits.
|
void |
setConfig(java.util.Properties config)
Merges the given properties with the configurations for this Object
|
void |
setProperty(java.lang.String key,
java.lang.String value)
Sets the given property to the given value.
|
boolean |
toggleComponent(javax.swing.JEditorPane pane,
java.lang.String className)
Toggles the component with given class-name.
|
public static final java.lang.String CONFIG_CARETCOLOR
public static final java.lang.String CONFIG_SELECTION
public static final java.lang.String CONFIG_COMPONENTS
public static final java.lang.String CONFIG_MENU
public static final java.lang.String CONFIG_TOOLBAR
public static final java.lang.String CONFIG_TOOLBAR_ROLLOVER
public static final java.lang.String CONFIG_TOOLBAR_BORDER
public static final java.lang.String CONFIG_TOOLBAR_OPAQUE
public static final java.lang.String CONFIG_TOOLBAR_BORDER_SIZE
public DefaultSyntaxKit(Lexer lexer)
public void addComponents(javax.swing.JEditorPane editorPane)
editorPane - a component to install this kit forpublic void installComponent(javax.swing.JEditorPane pane,
java.lang.String className)
public void deinstallComponent(javax.swing.JEditorPane pane,
java.lang.String className)
public boolean isComponentInstalled(javax.swing.JEditorPane pane,
java.lang.String className)
public boolean toggleComponent(javax.swing.JEditorPane pane,
java.lang.String className)
public void read(java.io.Reader in,
javax.swing.text.Document doc,
int pos)
throws java.io.IOException,
javax.swing.text.BadLocationException
read in class javax.swing.text.DefaultEditorKitjava.io.IOExceptionjavax.swing.text.BadLocationExceptionpublic void addPopupMenu(javax.swing.JEditorPane editorPane)
public void addToolBarActions(javax.swing.JEditorPane editorPane,
javax.swing.JToolBar toolbar)
public javax.swing.text.ViewFactory getViewFactory()
getViewFactory in class javax.swing.text.DefaultEditorKitpublic javax.swing.text.View create(javax.swing.text.Element element)
create in interface javax.swing.text.ViewFactorypublic void install(javax.swing.JEditorPane editorPane)
install in class javax.swing.text.EditorKitpublic void deinstall(javax.swing.JEditorPane editorPane)
deinstall in class javax.swing.text.EditorKitpublic void addActions(javax.swing.JEditorPane editorPane)
editorPane - the component to attach the actions topublic javax.swing.text.Document createDefaultDocument()
createDefaultDocument in class javax.swing.text.DefaultEditorKitpublic static void initKit()
Lexers we have.
You can call this at initialization, or it will be called when needed.
The method will also add the appropriate EditorKit classes to the
corresponding ContentType of the JEditorPane. After this is called,
you can simply call the editor.setContentType("text/java") on the
control and you will be done.public static void registerContentType(java.lang.String type,
java.lang.String className)
public static java.lang.String[] getContentTypes()
public void setConfig(java.util.Properties config)
public void setProperty(java.lang.String key,
java.lang.String value)
public java.lang.String getProperty(java.lang.String key)
public Configuration getConfig()
public static Configuration getConfig(java.lang.Class<? extends DefaultSyntaxKit> kit)
public java.util.Map<java.lang.String,java.lang.String> getAbbreviations()
public static void addAbbreviation(java.lang.String abbr,
java.lang.String template)
public static java.lang.String getAbbreviation(java.lang.String abbr)
public java.lang.String getContentType()
getContentType in class javax.swing.text.DefaultEditorKit