com.borland.primetime.editor
Class BasicStyleMap
java.lang.Object
|
+--com.borland.primetime.editor.BasicStyleMap
- public class BasicStyleMap
- extends java.lang.Object
A BasicStyleMap keeps track of style names used by a particular scanner
implementation.
Each EditorDocument has an associated BasicStyleMap and matching Scanner.
The Scanner fills in the EditorDocument.RunInfo structure, using constants
from the BasicStyleMap (or subclass) to refer to particular Styles. When
rendering the document, the EditorView uses the BasicStyleMap associated
with the document to resolve the Style references into actual styles.
This class does not actually store the information for the styles it
references; instead, they should be stored in the StyleContext retrieved
from the EditorManager.
- See Also:
AbstractScanner
,
EditorDocument
,
EditorView
,
Scanner
Constructor Summary |
BasicStyleMap()
|
BasicStyleMap(javax.swing.text.StyleContext context)
Create a new instance, using the specified context to resolve Styles. |
Method Summary |
java.awt.Font |
getFont(javax.swing.text.AttributeSet attr)
Get the Font for a particular AttributeSet (Style). |
javax.swing.text.Style |
getStyle(int styleType)
Get a particular style by integer reference. |
static void |
initOpenTool(byte majorVersion,
byte minorVersion)
Initialize the BasicStyleMap by registering all of the styles we know
about. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
context
protected javax.swing.text.StyleContext context
- The context this class will use to resolve styles.
CARET
public static final int CARET
SELECTION
public static final int SELECTION
INPUT_METHOD
public static final int INPUT_METHOD
PLAIN
public static final int PLAIN
WHITESPACE
public static final int WHITESPACE
COMMENT
public static final int COMMENT
RESERVED_WORD
public static final int RESERVED_WORD
IDENTIFIER
public static final int IDENTIFIER
SYMBOL
public static final int SYMBOL
STRING
public static final int STRING
NUMBER
public static final int NUMBER
EXTRA_KEYWORD
public static final int EXTRA_KEYWORD
ILLEGAL
public static final int ILLEGAL
PREPROCESSOR
public static final int PREPROCESSOR
CARET_KEY
public static final java.lang.String CARET_KEY
SELECTION_KEY
public static final java.lang.String SELECTION_KEY
INPUT_METHOD_KEY
public static final java.lang.String INPUT_METHOD_KEY
WHITESPACE_KEY
public static final java.lang.String WHITESPACE_KEY
BasicStyleMap
public BasicStyleMap()
BasicStyleMap
public BasicStyleMap(javax.swing.text.StyleContext context)
- Create a new instance, using the specified context to resolve Styles.
initOpenTool
public static void initOpenTool(byte majorVersion,
byte minorVersion)
- Initialize the BasicStyleMap by registering all of the styles we know
about. Subclasses should not reregister styles inherited from
BasicStyleMap.
getStyle
public javax.swing.text.Style getStyle(int styleType)
- Get a particular style by integer reference. The View uses this when
painting text using data stored in a EditorDocument.RunInfo structure.
- Returns:
- the Style corresponding to the int type.
getFont
public java.awt.Font getFont(javax.swing.text.AttributeSet attr)
- Get the Font for a particular AttributeSet (Style).
- Parameters:
attr
- The AttributeSet (Style) to get the font for.- Returns:
- the font to use for the specified AttributeSet (Style).