Package editor
Class GosuStyleContext
- java.lang.Object
-
- javax.swing.text.StyleContext
-
- editor.GosuStyleContext
-
- All Implemented Interfaces:
Serializable
,AbstractDocument.AttributeContext
,ViewFactory
public class GosuStyleContext extends StyleContext implements ViewFactory
A collection of styles used to render gosu source.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javax.swing.text.StyleContext
StyleContext.NamedStyle, StyleContext.SmallAttributeSet
-
-
Field Summary
-
Fields inherited from class javax.swing.text.StyleContext
DEFAULT_STYLE
-
-
Constructor Summary
Constructors Constructor Description GosuStyleContext()
Constructs a set of styles to represent gosu lexical tokens.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
areStylesEquivalent(String styleName1, String styleName2)
View
create(Element elem)
Color
getBackground(int code)
static String
getDefaultFontFamily()
static int
getDefaultFontSize()
Font
getFont(int code)
Fetch the font to use for a lexical token with the given scan value.Font
getFont(AttributeSet attr)
Fetch the font to use for a given attribute set.String
getFontFamily()
String
getFontFamily(AttributeSet a)
int
getFontSize()
Color
getForeground(int code)
Fetch the foreground color to use for a lexical token with the given value.Style
getStyleForScanValue(int code)
Fetches the attribute set to use for the given scan code.List<Style>
getStyles()
void
setAttribute(Style style, Object attr, Object value)
void
setBackground(Style style, Color colorBack)
void
setBold(Style style, boolean bBold)
static void
setDefaultFontFamily(String defFontFamily)
static void
setDefaultFontSize(int defFontSize)
void
setDefaultStyles()
void
setFontFamily(String strFamily)
void
setFontSize(int iSize)
void
setForeground(Style style, Color colorFore)
void
setItalic(Style style, boolean bItalic)
void
setStrikeThrough(Style style, boolean bStrikeThrough)
void
setUnderline(Style style, boolean bUnderline)
-
Methods inherited from class javax.swing.text.StyleContext
addAttribute, addAttributes, addChangeListener, addStyle, createLargeAttributeSet, createSmallAttributeSet, getBackground, getChangeListeners, getCompressionThreshold, getDefaultStyleContext, getEmptySet, getFont, getFontMetrics, getForeground, getStaticAttribute, getStaticAttributeKey, getStyle, getStyleNames, readAttributes, readAttributeSet, reclaim, registerStaticAttributeKey, removeAttribute, removeAttributes, removeAttributes, removeChangeListener, removeStyle, toString, writeAttributes, writeAttributeSet
-
-
-
-
Field Detail
-
KEY_WORD
public static final int KEY_WORD
- See Also:
- Constant Field Values
-
PARSE_ERROR
public static final int PARSE_ERROR
- See Also:
- Constant Field Values
-
DEPRECATED
public static final int DEPRECATED
- See Also:
- Constant Field Values
-
PARSE_WARNING
public static final int PARSE_WARNING
- See Also:
- Constant Field Values
-
TYPE_LITERAL
public static final int TYPE_LITERAL
- See Also:
- Constant Field Values
-
NESTED_TYPE_LITERAL
public static final int NESTED_TYPE_LITERAL
- See Also:
- Constant Field Values
-
METHOD_CALL
public static final int METHOD_CALL
- See Also:
- Constant Field Values
-
USES
public static final int USES
- See Also:
- Constant Field Values
-
DEFAULT
public static final int DEFAULT
- See Also:
- Constant Field Values
-
FIELD_ERROR
public static final int FIELD_ERROR
- See Also:
- Constant Field Values
-
FIELD_WARNING
public static final int FIELD_WARNING
- See Also:
- Constant Field Values
-
PACKAGE
public static final int PACKAGE
- See Also:
- Constant Field Values
-
PROPERTY
public static final int PROPERTY
- See Also:
- Constant Field Values
-
ENHANCEMENT_METHOD_CALL
public static final int ENHANCEMENT_METHOD_CALL
- See Also:
- Constant Field Values
-
ENHANCEMENT_PROPERTY
public static final int ENHANCEMENT_PROPERTY
- See Also:
- Constant Field Values
-
KEY_WORD_KEY
public static final Integer KEY_WORD_KEY
-
PARSE_ERROR_KEY
public static final Integer PARSE_ERROR_KEY
-
DEPRECATED_KEY
public static final Integer DEPRECATED_KEY
-
TYPE_LITERAL_KEY
public static final Integer TYPE_LITERAL_KEY
-
NESTED_TYPE_LITERAL_KEY
public static final Integer NESTED_TYPE_LITERAL_KEY
-
PARSE_WARNING_KEY
public static final Integer PARSE_WARNING_KEY
-
METHOD_CALL_KEY
public static final Integer METHOD_CALL_KEY
-
PROPERTY_KEY
public static final Integer PROPERTY_KEY
-
ENHANCEMENT_METHOD_CALL_KEY
public static final Integer ENHANCEMENT_METHOD_CALL_KEY
-
ENHANCEMENT_PROPERTY_KEY
public static final Integer ENHANCEMENT_PROPERTY_KEY
-
USES_KEY
public static final Integer USES_KEY
-
PACKAGE_KEY
public static final Integer PACKAGE_KEY
-
FIELD_ERROR_KEY
public static final Integer FIELD_ERROR_KEY
-
FIELD_WARNING_KEY
public static final Integer FIELD_WARNING_KEY
-
DASHED
public static final String DASHED
- See Also:
- Constant Field Values
-
STYLE_EOL
public static final String STYLE_EOL
- See Also:
- Constant Field Values
-
STYLE_EOF
public static final String STYLE_EOF
- See Also:
- Constant Field Values
-
STYLE_Whitespace
public static final String STYLE_Whitespace
- See Also:
- Constant Field Values
-
STYLE_Comment
public static final String STYLE_Comment
- See Also:
- Constant Field Values
-
STYLE_Caret
public static final String STYLE_Caret
- See Also:
- Constant Field Values
-
STYLE_Number
public static final String STYLE_Number
- See Also:
- Constant Field Values
-
STYLE_Integer
public static final String STYLE_Integer
- See Also:
- Constant Field Values
-
STYLE_Word
public static final String STYLE_Word
- See Also:
- Constant Field Values
-
STYLE_Operator
public static final String STYLE_Operator
- See Also:
- Constant Field Values
-
STYLE_StringLiteral
public static final String STYLE_StringLiteral
- See Also:
- Constant Field Values
-
STYLE_KeyWord
public static final String STYLE_KeyWord
- See Also:
- Constant Field Values
-
STYLE_ParseError
public static final String STYLE_ParseError
- See Also:
- Constant Field Values
-
STYLE_ParseWarning
public static final String STYLE_ParseWarning
- See Also:
- Constant Field Values
-
STYLE_DeprecatedMember
public static final String STYLE_DeprecatedMember
- See Also:
- Constant Field Values
-
STYLE_TypeLiteral
public static final String STYLE_TypeLiteral
- See Also:
- Constant Field Values
-
STYLE_NestedTypeLiteral
public static final String STYLE_NestedTypeLiteral
- See Also:
- Constant Field Values
-
STYLE_MethodCall
public static final String STYLE_MethodCall
- See Also:
- Constant Field Values
-
STYLE_Property
public static final String STYLE_Property
- See Also:
- Constant Field Values
-
STYLE_EnhancementMethodCall
public static final String STYLE_EnhancementMethodCall
- See Also:
- Constant Field Values
-
STYLE_EnhancementProperty
public static final String STYLE_EnhancementProperty
- See Also:
- Constant Field Values
-
STYLE_FieldError
public static final String STYLE_FieldError
- See Also:
- Constant Field Values
-
STYLE_FieldWarning
public static final String STYLE_FieldWarning
- See Also:
- Constant Field Values
-
-
Method Detail
-
setBold
public void setBold(Style style, boolean bBold)
-
setItalic
public void setItalic(Style style, boolean bItalic)
-
setUnderline
public void setUnderline(Style style, boolean bUnderline)
-
setStrikeThrough
public void setStrikeThrough(Style style, boolean bStrikeThrough)
-
setDefaultStyles
public void setDefaultStyles()
-
setDefaultFontFamily
public static void setDefaultFontFamily(String defFontFamily)
-
getDefaultFontFamily
public static String getDefaultFontFamily()
-
setDefaultFontSize
public static void setDefaultFontSize(int defFontSize)
-
getDefaultFontSize
public static int getDefaultFontSize()
-
getForeground
public Color getForeground(int code)
Fetch the foreground color to use for a lexical token with the given value.
-
getBackground
public Color getBackground(int code)
-
getFont
public Font getFont(int code)
Fetch the font to use for a lexical token with the given scan value.
-
getStyleForScanValue
public Style getStyleForScanValue(int code)
Fetches the attribute set to use for the given scan code. The set is stored in a table to facilitate relatively fast access to use in conjunction with the scanner.
-
getFont
public Font getFont(AttributeSet attr)
Fetch the font to use for a given attribute set.- Overrides:
getFont
in classStyleContext
-
getFontFamily
public String getFontFamily(AttributeSet a)
-
getFontFamily
public String getFontFamily()
-
setFontFamily
public void setFontFamily(String strFamily)
-
getFontSize
public int getFontSize()
-
setFontSize
public void setFontSize(int iSize)
-
create
public View create(Element elem)
- Specified by:
create
in interfaceViewFactory
-
-