Package VASSAL.tools
Class FormattedString
java.lang.Object
VASSAL.tools.FormattedString
- All Implemented Interfaces:
RecursionLimiter.Loopable
- Direct Known Subclasses:
PlayerIdFormattedString
public class FormattedString extends Object implements RecursionLimiter.Loopable
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
Fields Modifier and Type Field Description protected PropertySourcedefaultPropertiesprotected Expressionformatprotected StringformatStringprotected Map<String,String>props -
Constructor Summary
Constructors Constructor Description FormattedString()FormattedString(String s)FormattedString(String formatString, PropertySource defaultProperties)FormattedString(PropertySource defaultProperties) -
Method Summary
Modifier and Type Method Description voidclearProperties()StringdebugInfo(String value, String description)static StringdebugInfo(FormattedString format, String value, String description)Format a standard debug message for use in Decorator bad data reports.booleanequals(Object obj)StringgetComponentName()StringgetComponentTypeName()PropertySourcegetDefaultProperties()StringgetFormat()StringgetLocalizedText()StringgetLocalizedText(PropertySource ps)StringgetText()Return the resulting string after substituting propertiesStringgetText(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 StringgetText(PropertySource ps, boolean localized)StringgetText(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.intgetTextAsInt(PropertySource ps, String description, AbstractConfigurable source)intgetTextAsInt(PropertySource ps, String description, EditablePiece source)Expand a FormattedString using the supplied propertySource and parse it as an integer.inthashCode()voidsetDefaultProperties(PropertySource defaultProperties)voidsetFormat(String s)voidsetProperty(String name, String value)
-
Field Details
-
formatString
-
format
-
props
-
defaultProperties
-
-
Constructor Details
-
FormattedString
public FormattedString() -
FormattedString
-
FormattedString
-
FormattedString
-
-
Method Details
-
getComponentTypeName
- Specified by:
getComponentTypeNamein interfaceRecursionLimiter.Loopable
-
getComponentName
- Specified by:
getComponentNamein interfaceRecursionLimiter.Loopable
-
setFormat
-
getFormat
-
setProperty
-
clearProperties
public void clearProperties() -
getText
Return the resulting string after substituting properties- Returns:
-
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-- Returns:
- 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-def- the default if the result is otherwise empty- Returns:
- 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 formated 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
-
getDefaultProperties
-
setDefaultProperties
-
hashCode
public int hashCode() -
equals
-