Package VASSAL.tools
Class FormattedString
java.lang.Object
VASSAL.tools.FormattedString
- All Implemented Interfaces:
RecursionLimiter.Loopable
- Direct Known Subclasses:
PlayerIdFormattedString
FormattedString.java
A String that can include options of the form $optionName$. Option values
are maintained in a property list and getText returns the string will all
options replaced by their value
-
Field Summary
-
Constructor Summary
ConstructorDescriptionFormattedString(String formatString, PropertySource defaultProperties)
FormattedString(PropertySource defaultProperties)
-
Method Summary
Modifier and TypeMethodDescriptionvoid
static String
debugInfo(FormattedString fs, String value, String description)
Format a standard debug message for use in Decorator bad data reports.boolean
getText()
getText(PropertySource ps)
Return the resulting string after substituting properties Also, if any property keys match a property in the given GamePiece, substitute the value of that propertyprotected String
getText(PropertySource ps, boolean localized)
getText(PropertySource ps, String def)
Return the resulting string after substituting properties Also, if any property keys match a property in the given GamePiece, substitute the value of that property.int
getTextAsInt(PropertySource ps, String description, AbstractConfigurable source)
int
getTextAsInt(PropertySource ps, String description, EditablePiece source)
Expand a FormattedString using the supplied propertySource and parse it as an integer.int
hashCode()
void
setDefaultProperties(PropertySource defaultProperties)
void
void
setProperty(String name, String value)
-
Field Details
-
props
-
-
Constructor Details
-
FormattedString
public FormattedString() -
FormattedString
-
FormattedString
-
FormattedString
-
-
Method Details
-
setFormat
-
getFormat
-
setProperty
-
clearProperties
public void clearProperties() -
setDefaultProperties
-
getDefaultProperties
-
getText
- Returns:
- the resulting string after substituting properties
-
getLocalizedText
-
getText
Return the resulting string after substituting properties Also, if any property keys match a property in the given GamePiece, substitute the value of that property- Parameters:
ps
- property source- Returns:
- Return the resulting string after substituting properties
- See Also:
GamePiece.getProperty(java.lang.Object)
-
getText
Return the resulting string after substituting properties Also, if any property keys match a property in the given GamePiece, substitute the value of that property. If the resulting string is empty, then the default is returned.- Parameters:
ps
- Property sourcedef
- the default if the result is otherwise empty- Returns:
- Return the resulting string after substituting properties
- See Also:
GamePiece.getProperty(java.lang.Object)
-
getLocalizedText
-
getText
-
getTextAsInt
Expand a FormattedString using the supplied propertySource and parse it as an integer. If the expanded string is not an integer, generate a Bad Data Report with debugging information and return a value of 0 -
getTextAsInt
-
debugInfo
Format a standard debug message for use in Decorator bad data reports. description=value description[format]=value Use format 1 if the generated value is the same as the format Use format 2 if the formatted contains an expression that has been expanded.- Parameters:
format
- Formatted Stringdescription
- Description of the Stringvalue
- Value generated by the formatted string- Returns:
- error message
-
debugInfo
-
hashCode
public int hashCode() -
equals
-
getComponentTypeName
- Specified by:
getComponentTypeName
in interfaceRecursionLimiter.Loopable
-
getComponentName
- Specified by:
getComponentName
in interfaceRecursionLimiter.Loopable
-