Package editor

Class GosuStyleContext

  • All Implemented Interfaces:
    java.io.Serializable, javax.swing.text.AbstractDocument.AttributeContext, javax.swing.text.ViewFactory

    public class GosuStyleContext
    extends javax.swing.text.StyleContext
    implements javax.swing.text.ViewFactory
    A collection of styles used to render gosu source.
    See Also:
    Serialized Form
    • Field Detail

      • ENHANCEMENT_METHOD_CALL

        public static final int ENHANCEMENT_METHOD_CALL
        See Also:
        Constant Field Values
      • KEY_WORD_KEY

        public static final java.lang.Integer KEY_WORD_KEY
      • PARSE_ERROR_KEY

        public static final java.lang.Integer PARSE_ERROR_KEY
      • DEPRECATED_KEY

        public static final java.lang.Integer DEPRECATED_KEY
      • TYPE_LITERAL_KEY

        public static final java.lang.Integer TYPE_LITERAL_KEY
      • NESTED_TYPE_LITERAL_KEY

        public static final java.lang.Integer NESTED_TYPE_LITERAL_KEY
      • PARSE_WARNING_KEY

        public static final java.lang.Integer PARSE_WARNING_KEY
      • METHOD_CALL_KEY

        public static final java.lang.Integer METHOD_CALL_KEY
      • PROPERTY_KEY

        public static final java.lang.Integer PROPERTY_KEY
      • ENHANCEMENT_METHOD_CALL_KEY

        public static final java.lang.Integer ENHANCEMENT_METHOD_CALL_KEY
      • ENHANCEMENT_PROPERTY_KEY

        public static final java.lang.Integer ENHANCEMENT_PROPERTY_KEY
      • USES_KEY

        public static final java.lang.Integer USES_KEY
      • PACKAGE_KEY

        public static final java.lang.Integer PACKAGE_KEY
      • FIELD_ERROR_KEY

        public static final java.lang.Integer FIELD_ERROR_KEY
      • FIELD_WARNING_KEY

        public static final java.lang.Integer FIELD_WARNING_KEY
      • THISISSTUPID

        private static final java.awt.Component THISISSTUPID
      • g_defFontFamily

        private static java.lang.String g_defFontFamily
      • g_defFontSize

        private static int g_defFontSize
      • STYLE_Whitespace

        public static final java.lang.String STYLE_Whitespace
        See Also:
        Constant Field Values
      • STYLE_StringLiteral

        public static final java.lang.String STYLE_StringLiteral
        See Also:
        Constant Field Values
      • STYLE_ParseError

        public static final java.lang.String STYLE_ParseError
        See Also:
        Constant Field Values
      • STYLE_ParseWarning

        public static final java.lang.String STYLE_ParseWarning
        See Also:
        Constant Field Values
      • STYLE_DeprecatedMember

        public static final java.lang.String STYLE_DeprecatedMember
        See Also:
        Constant Field Values
      • STYLE_TypeLiteral

        public static final java.lang.String STYLE_TypeLiteral
        See Also:
        Constant Field Values
      • STYLE_NestedTypeLiteral

        public static final java.lang.String STYLE_NestedTypeLiteral
        See Also:
        Constant Field Values
      • STYLE_MethodCall

        public static final java.lang.String STYLE_MethodCall
        See Also:
        Constant Field Values
      • STYLE_EnhancementMethodCall

        public static final java.lang.String STYLE_EnhancementMethodCall
        See Also:
        Constant Field Values
      • STYLE_EnhancementProperty

        public static final java.lang.String STYLE_EnhancementProperty
        See Also:
        Constant Field Values
      • STYLE_FieldError

        public static final java.lang.String STYLE_FieldError
        See Also:
        Constant Field Values
      • STYLE_FieldWarning

        public static final java.lang.String STYLE_FieldWarning
        See Also:
        Constant Field Values
      • _strFontFamily

        private java.lang.String _strFontFamily
      • _iFontSize

        private int _iFontSize
      • _fontCache

        private java.util.HashMap<javax.swing.text.AttributeSet,​java.awt.Font> _fontCache
      • _tokenStyles

        private java.util.HashMap<java.lang.Integer,​javax.swing.text.Style> _tokenStyles
    • Constructor Detail

      • GosuStyleContext

        public GosuStyleContext()
        Constructs a set of styles to represent gosu lexical tokens.
    • Method Detail

      • setForeground

        public void setForeground​(javax.swing.text.Style style,
                                  java.awt.Color colorFore)
      • setBackground

        public void setBackground​(javax.swing.text.Style style,
                                  java.awt.Color colorBack)
      • setBold

        public void setBold​(javax.swing.text.Style style,
                            boolean bBold)
      • setItalic

        public void setItalic​(javax.swing.text.Style style,
                              boolean bItalic)
      • setUnderline

        public void setUnderline​(javax.swing.text.Style style,
                                 boolean bUnderline)
      • setStrikeThrough

        public void setStrikeThrough​(javax.swing.text.Style style,
                                     boolean bStrikeThrough)
      • setAttribute

        public void setAttribute​(javax.swing.text.Style style,
                                 java.lang.Object attr,
                                 java.lang.Object value)
      • setDefaultStyles

        public void setDefaultStyles()
      • setDefaultFontFamily

        public static void setDefaultFontFamily​(java.lang.String defFontFamily)
      • getDefaultFontFamily

        public static java.lang.String getDefaultFontFamily()
      • setDefaultFontSize

        public static void setDefaultFontSize​(int defFontSize)
      • getDefaultFontSize

        public static int getDefaultFontSize()
      • getForeground

        public java.awt.Color getForeground​(int code)
        Fetch the foreground color to use for a lexical token with the given value.
      • getBackground

        public java.awt.Color getBackground​(int code)
      • getFont

        public java.awt.Font getFont​(int code)
        Fetch the font to use for a lexical token with the given scan value.
      • getStyleForScanValue

        public javax.swing.text.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 java.awt.Font getFont​(javax.swing.text.AttributeSet attr)
        Fetch the font to use for a given attribute set.
        Overrides:
        getFont in class javax.swing.text.StyleContext
      • getFont

        private java.awt.Font getFont​(javax.swing.text.AttributeSet attr,
                                      java.lang.String strFamily)
      • getFontFamily

        public java.lang.String getFontFamily​(javax.swing.text.AttributeSet a)
      • getFontFamily

        public java.lang.String getFontFamily()
      • setFontFamily

        public void setFontFamily​(java.lang.String strFamily)
      • getFontSize

        public int getFontSize()
      • setFontSize

        public void setFontSize​(int iSize)
      • create

        public javax.swing.text.View create​(javax.swing.text.Element elem)
        Specified by:
        create in interface javax.swing.text.ViewFactory
      • getStyles

        public java.util.List<javax.swing.text.Style> getStyles()
      • areStylesEquivalent

        public boolean areStylesEquivalent​(java.lang.String styleName1,
                                           java.lang.String styleName2)