com.pietschy.command.configuration.impl
Class FaceTextAttributeParser

java.lang.Object
  extended by com.pietschy.command.configuration.impl.FaceAttributeParser
      extended by com.pietschy.command.configuration.impl.FaceTextAttributeParser

public class FaceTextAttributeParser
extends FaceAttributeParser

Parses the text attribute of faces.


Field Summary
(package private)  java.util.regex.Pattern pattern
           
 
Constructor Summary
FaceTextAttributeParser()
          Creates a new instance.
 
Method Summary
protected  boolean endsInEscapeCharacter(java.lang.String s)
          Checks if the string ends in an odd number of '\'.
(package private) static java.lang.String getDefaultShortcutString(int shortCutMask)
          Gets the string representation of specified shortcut mask.
static javax.swing.KeyStroke parseAccelerator(java.lang.CharSequence accelerator)
          Parses accelerator values.
 void parseEmptyImpl(java.lang.String property, Face face, ExceptionFactory factory)
          Updates the face attribute to be null and not inherited.
protected  void parseImpl(java.lang.String propertyName, java.lang.String value, Face face, ExceptionFactory factory)
          Parses the text value and updates the face appropriately.
(package private) static java.lang.String replaceDefaultAccelerator(java.lang.CharSequence accelerator)
          Replaces the string "default" with the current platforms default accelerator.
 
Methods inherited from class com.pietschy.command.configuration.impl.FaceAttributeParser
getProperties, parse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pattern

java.util.regex.Pattern pattern
Constructor Detail

FaceTextAttributeParser

public FaceTextAttributeParser()
Creates a new instance.

Method Detail

parseImpl

protected void parseImpl(java.lang.String propertyName,
                         java.lang.String value,
                         Face face,
                         ExceptionFactory factory)
                  throws ParseException
Parses the text value and updates the face appropriately. This parser may update the text, mnemonic and accelerator properties of the face.

Specified by:
parseImpl in class FaceAttributeParser
Parameters:
propertyName - ignored.
value - the value of the text property.
face - the face to configure.
factory - the exception factory.
Throws:
ParseException - if there was an error parsing the property.

parseAccelerator

public static javax.swing.KeyStroke parseAccelerator(java.lang.CharSequence accelerator)
                                              throws ParseException
Parses accelerator values. This method delegates to KeyStroke.getKeyStroke(String) after replacing the string "default" with the currently platforms default accelerator.

Parameters:
accelerator - the accelerator definition
Returns:
the KeyStroke representing the specified accelerator.
Throws:
ParseException - if there was an error parsing the accelerator.

endsInEscapeCharacter

protected boolean endsInEscapeCharacter(java.lang.String s)
Checks if the string ends in an odd number of '\'. This is then used to determine if the ',' we split on was actually escaped.

Parameters:
s - the string to check.
Returns:
true if the string ends in '\', false otherwise.

parseEmptyImpl

public void parseEmptyImpl(java.lang.String property,
                           Face face,
                           ExceptionFactory factory)
Updates the face attribute to be null and not inherited.

Specified by:
parseEmptyImpl in class FaceAttributeParser
Parameters:
property - the property to configure.
face - the face to update.
factory - the exception factory.

replaceDefaultAccelerator

static java.lang.String replaceDefaultAccelerator(java.lang.CharSequence accelerator)
Replaces the string "default" with the current platforms default accelerator.

Parameters:
accelerator - the accelerator string.
Returns:
the accelerator string with the "default" accelerator replaced with the correct value for the platform.

getDefaultShortcutString

static java.lang.String getDefaultShortcutString(int shortCutMask)
Gets the string representation of specified shortcut mask.

Parameters:
shortCutMask - the short cut mask.
Returns:
the string representing the specified mask.


Copyright © 2006 - 2007 Andrew Pietsch