Package org.fife.ui.rsyntaxtextarea
Class RSyntaxTextAreaUI
java.lang.Object
javax.swing.plaf.ComponentUI
javax.swing.plaf.TextUI
javax.swing.plaf.basic.BasicTextUI
javax.swing.plaf.basic.BasicTextAreaUI
org.fife.ui.rtextarea.RTextAreaUI
org.fife.ui.rsyntaxtextarea.RSyntaxTextAreaUI
- All Implemented Interfaces:
ViewFactory
UI used by
RSyntaxTextArea. This allows us to implement
syntax highlighting.- Version:
- 0.1
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.plaf.basic.BasicTextUI
BasicTextUI.BasicCaret, BasicTextUI.BasicHighlighter -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final EditorKitprivate static final Stringprivate static final StringFields inherited from class org.fife.ui.rtextarea.RTextAreaUI
textArea -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreates the view for an element.protected HighlighterCreates the highlighter to use for syntax text areas.static ComponentUIcreateUI(JComponent ta) Creates and returns an instance of this UI.protected StringReturns the name to use to cache/fetch the shared action map.Fetches the EditorKit for the UI.protected InputMapGet the InputMap to use for the UI.protected voidPaints editor augmentations added by RTextArea: highlighted lines, current line highlight, and margin line.protected voidPaints the "matched bracket", if any.protected voidpaintMatchedBracketImpl(Graphics g, RSyntaxTextArea rsta, Rectangle r) protected voidGets called whenever a bound property is changed on this UI'sRSyntaxTextArea.voidUpdates the view.intyForLine(int line) Returns the y-coordinate of the specified line.intyForLineContaining(int offs) Returns the y-coordinate of the line containing a specified offset.Methods inherited from class org.fife.ui.rtextarea.RTextAreaUI
createCaret, createKeymap, createRTextAreaActionMap, getRTextArea, getVisibleEditorRect, installDefaults, installKeyboardActions, installUI, paintBackground, paintCurrentLineHighlight, paintLineHighlights, paintMarginLine, paintSafelyMethods inherited from class javax.swing.plaf.basic.BasicTextAreaUI
getBaseline, getBaselineResizeBehavior, getMinimumSize, getPreferredSize, getPropertyPrefixMethods inherited from class javax.swing.plaf.basic.BasicTextUI
create, damageRange, damageRange, getComponent, getKeymapName, getMaximumSize, getNextVisualPositionFrom, getRootView, getToolTipText, installListeners, modelChanged, modelToView, modelToView, modelToView2D, paint, setView, uninstallDefaults, uninstallKeyboardActions, uninstallListeners, uninstallUI, update, viewToModel, viewToModel, viewToModel2DMethods inherited from class javax.swing.plaf.TextUI
getToolTipText2DMethods inherited from class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount
-
Field Details
-
SHARED_ACTION_MAP_NAME
- See Also:
-
SHARED_INPUT_MAP_NAME
- See Also:
-
DEFAULT_KIT
-
-
Constructor Details
-
RSyntaxTextAreaUI
Constructor.- Parameters:
rSyntaxTextArea- The text area.
-
-
Method Details
-
createUI
Creates and returns an instance of this UI.- Parameters:
ta- The text area that will use the UI.- Returns:
- The UI.
-
create
Creates the view for an element.- Specified by:
createin interfaceViewFactory- Overrides:
createin classRTextAreaUI- Parameters:
elem- The element.- Returns:
- The view.
-
createHighlighter
Creates the highlighter to use for syntax text areas.- Overrides:
createHighlighterin classRTextAreaUI- Returns:
- The highlighter.
-
getActionMapName
Returns the name to use to cache/fetch the shared action map. This should be overridden by subclasses if the subclass has its own custom editor kit to install, so its actions get picked up.- Overrides:
getActionMapNamein classRTextAreaUI- Returns:
- The name of the cached action map.
-
getEditorKit
Fetches the EditorKit for the UI.- Overrides:
getEditorKitin classRTextAreaUI- Parameters:
tc- The text component for which this UI is installed.- Returns:
- The editor capabilities.
- See Also:
-
getRTextAreaInputMap
Get the InputMap to use for the UI.This method is not named
getInputMap()because there is a package-private method inBasicTextAreaUIwith that name. Thus, creating a new method with that name causes certain compilers to issue warnings that you are not actually overriding the original method (since it is package-private).- Overrides:
getRTextAreaInputMapin classRTextAreaUI
-
paintEditorAugmentations
Description copied from class:RTextAreaUIPaints editor augmentations added by RTextArea: highlighted lines, current line highlight, and margin line.- Overrides:
paintEditorAugmentationsin classRTextAreaUI- Parameters:
g- The graphics context with which to paint.
-
paintMatchedBracket
Paints the "matched bracket", if any.- Parameters:
g- The graphics context.
-
paintMatchedBracketImpl
-
propertyChange
Gets called whenever a bound property is changed on this UI'sRSyntaxTextArea.- Overrides:
propertyChangein classBasicTextAreaUI- Parameters:
e- The property change event.
-
refreshSyntaxHighlighting
public void refreshSyntaxHighlighting()Updates the view. This should be called when the underlyingRSyntaxTextAreachanges its syntax editing style. -
yForLine
Returns the y-coordinate of the specified line.This method is quicker than using traditional
modelToView(int)calls, as the entire bounding box isn't computed.- Overrides:
yForLinein classRTextAreaUI- Parameters:
line- The line number.- Returns:
- The y-coordinate of the top of the line, or
-1if this text area doesn't yet have a positive size or the line is hidden (i.e. from folding). - Throws:
BadLocationException- Iflineisn't a valid line number for this document.
-
yForLineContaining
Returns the y-coordinate of the line containing a specified offset.This is faster than calling
modelToView(offs).y, so it is preferred if you do not need the actual bounding box.- Overrides:
yForLineContainingin classRTextAreaUI- Parameters:
offs- The offset info the document.- Returns:
- The y-coordinate of the top of the offset, or
-1if this text area doesn't yet have a positive size or the line is hidden (i.e. from folding). - Throws:
BadLocationException- Ifoffsisn't a valid offset into the document.
-