Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: javax/ide/extension/I18NCharVisitor.java


1   package javax.ide.extension;
2   
3   /**
4    * An element visitor that processes xml elements of type i18n_char. If 
5    * the element has an rskey attribute and an ancestor extension element defined
6    * a bundle using the rsbundle attribute, this implementation will use 
7    * ResourceBundle.getBundle() to load a string resource from the bundle class.
8    * If no rskey attribute is present, the text of the element will be used 
9    * instead. In either case, {@link #characterValue( ElementContext, char )} 
10   * is called with the first non-whitespace character of the resulting string.<p>
11   * 
12   * An error is logged if the rskey attribute is present on the element but no
13   * rsbundle was defined in an ancestor extension element.
14   */
15  public abstract class I18NCharVisitor extends ElementVisitor
16  {
17    private final I18NStringVisitor _delegate = new I18NStringVisitor() 
18    {
19      protected void string( ElementContext context, String value )
20      {
21        characterValue( context, value.trim().charAt( 0 ) );
22      }
23    };
24    
25    public final void start( ElementStartContext context )
26    {
27      _delegate.start( context );
28    }
29    
30    public final void end( ElementEndContext context )
31    {
32      _delegate.end( context );
33    }
34    
35    protected abstract void characterValue( ElementContext context, char value );
36  }