Data Request Broker
2-3-release

fr.gael.drb.query
Class GrammarContext

java.lang.Object
  extended by javax.swing.text.StyleContext
      extended by fr.gael.drb.query.GrammarContext
All Implemented Interfaces:
Serializable, AbstractDocument.AttributeContext

public class GrammarContext
extends StyleContext

A collection of styles used to render xquery script. This class also acts as a factory for the views used to represent the grammarized documents. Since the rendering styles are based upon view preferences, the views need a way to gain access to the style settings which is facilitated by implementing the factory in the style storage. Both functionalities can be widely shared across grammarized document views.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.text.StyleContext
StyleContext.NamedStyle, StyleContext.SmallAttributeSet
 
Field Summary
 Color commentColor
          Comment color.
 Font defaultFont
          Default font.
 
Fields inherited from class javax.swing.text.StyleContext
DEFAULT_STYLE
 
Constructor Summary
GrammarContext()
          Constructs a set of styles to represent java lexical tokens.
 
Method Summary
 Font getDefaultFont()
          Returns the default font.
 Font getFont(int code)
          Fetch the font to use for a lexical token with the given scan value.
 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.
 void setDefaultFontSize(float font_size)
          Sets the default font size.
 
Methods inherited from class javax.swing.text.StyleContext
addAttribute, addAttributes, addChangeListener, addStyle, createLargeAttributeSet, createSmallAttributeSet, getBackground, getChangeListeners, getCompressionThreshold, getDefaultStyleContext, getEmptySet, getFont, getFont, getFontMetrics, getForeground, getStaticAttribute, getStaticAttributeKey, getStyle, getStyleNames, readAttributes, readAttributeSet, reclaim, registerStaticAttributeKey, removeAttribute, removeAttributes, removeAttributes, removeChangeListener, removeStyle, toString, writeAttributes, writeAttributeSet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

commentColor

public Color commentColor
Comment color.


defaultFont

public Font defaultFont
Default font.

Constructor Detail

GrammarContext

public GrammarContext()
Constructs a set of styles to represent java lexical tokens. By default there are no colors or fonts specified.

Method Detail

setDefaultFontSize

public void setDefaultFontSize(float font_size)
Sets the default font size.

Parameters:
font_size - the default font size to be used.

getForeground

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

Parameters:
code - the token code.
Returns:
the associated foreground color.

getDefaultFont

public Font getDefaultFont()
Returns the default font.

Returns:
the associated font.

getFont

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

Parameters:
code - the token code.
Returns:
the associated font.

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.

Parameters:
code - the token code.
Returns:
the associated style.

Data Request Broker - DRB API®
2-3-release

Copyright© 2001-2009 GAEL Consultant. All rights reserved. Use is subject to license terms .