FileDocCategorySizeDatePackage
GTKEngineParser.javaAPI DocJava SE 5 API3707Fri Aug 26 14:54:44 BST 2005com.sun.java.swing.plaf.gtk

GTKEngineParser

public abstract class GTKEngineParser extends Object
The abstract base class for all theme engine parsers.
author
Shannon Hickey
version
1.7 12/19/03

Fields Summary
protected final int
uniqueScopeID
Constructors Summary
Methods Summary
abstract intparse(GTKScanner scanner, GTKParser parser, GTKParser.EngineInfo[] retVal)
Parse the body of an 'engine' section of an rc file and store the results in a GTKParser.EngineInfo object.

This method takes three parameters. The first is a scanner to retrieve tokens from. Configuration options on the scanner may be changed by this method, but it must be sure to restore the previous values when it has completed. A typical implementation will also want to register its own symbols with the scanner. To do so, it should save the current scope of the scanner, and then set the scanner's scope to the value of 'uniqueScopeID'. Then, it should register its own symbols with the scanner if they don't already exist. The int value of every symbol registered must be > GTKScanner.TOKEN_LAST. At the successful completion of this method, the old scope should be restored, but the registered symbols can be left for the next use.

When this method is called, the scanner will be ready to return the first token inside the opening '{' of an engine section. Therefore, with the exception of returning early in error, this method must continue parsing until it sees a matching outer '}', even if it no longer has interest in the tokens returned.

The second parameter is the parser that called this method. It should not be modified in any way, and has been included only to make available its resolvePixmapPath method for resolving paths to images.

The last parameter will always be a single element array, for returning a GTKParser.EngineInfo object representing the information that was parsed. Upon invocation of this method, the array may already contain an info object. If so, it is guaranteed that it was created by this GTKEngineParser on a previous call to parse. As such, its type can be assumed. Typically, an implementation will want to append to, or merge with the information contained in any passed in info object.

Upon successful completion, the information parsed should be stored in a GTKParser.EngineInfo object as element 0 in the array parameter. This can be null if we wish to signify, for any reason, that that this entire engine section be thrown out and to use the default engine instead.

This method should return GTKScanner.TOKEN_NONE, if successful, otherwise the token that it expected but didn't get.

param
scanner The scanner to retrieve tokens from.
param
parser The parser that called us.
param
retVal A single element array to store an object containing the information parsed.
return
GTKScanner.TOKEN_NONE if the parse was successful, otherwise the token that was expected but not received.