public class FontPropertyType extends PropertyType<Font>
Font.decode(str) method.Font.decode(....)]:
| Constructor Example | Comments | ||
|---|---|---|---|
Property<Font> A_PROPERTY = |
Default value is null. |
||
Property<Font> A_PROPERTY = |
Default value is new Font("Verdana",Font.BOLD,16). |
||
| Type of value(s) | Examples | Result | Comments |
| Valid | Verdana-BOLD-16 | A string validated as a Font("Verdana",Font.BOLD,16). | Validate successfully. |
| Valid | Verdana italic 18 | A string validated as a Font("Verdana",Font.ITALIC,18). | Validate successfully. |
| Valid | Times New Roman | A string validated as a Font("Times New Roman",Font.PLAIN,12). | Validate successfully. |
| Invalid | -plain-16 | null |
Validate will throw an exception. Return default value if set, otherwise null. |
| Invalid | «empty string» | null |
|
| Invalid | «empty string after trim» | null |
|
| Invalid | IDontKnowThisFont-italicbold-15 | null |
|
| InvValid | IDontKnowThisFont | null |
|
| Invalid | null |
defaultValue OR null |
Validate will throw an exception. Return default value if set, otherwise null. |
Font,
Font.decode(String),
Serialized Form| Modifier and Type | Field and Description |
|---|---|
static String |
TYPE
The type name string constant of FontPropertyType
|
| Constructor and Description |
|---|
FontPropertyType()
Constructor, sets the default value to
null. |
FontPropertyType(Font defaultValue)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
String[] |
getAvailableFontFamilyNames()
Gets all the available font names from local graphics environment.
|
List<String> |
getRestrictions()
Gets a detailed description of the PropertyType with any constraints that might influence the validation.
|
String |
toString(String propertyName,
Font t)
Converts a typed to the string representation.
|
Font |
validateValue(String propertyName,
String value)
Converts the string representation of to a typed value.
|
equals, getDefaultValue, getDefaultValueAsString, getDefaultValueDescription, getDescription, getDescription, getInitializationPriority, getIo, getLogger, getTypeName, hasDefaultValue, isDefaultValueValid, postGetValueProcessing, setDefaultValue, setInitializationPriority, setIo, setTypedValue, setTypeName, toType, validate, validateConstraints, validateNullTypepublic static final String TYPE
public FontPropertyType()
null.public FontPropertyType(Font defaultValue)
defaultValue - default value returned if property value is undefined.public List<String> getRestrictions()
PropertyTypegetRestrictions in class PropertyType<Font>public Font validateValue(String propertyName, String value) throws PropertyException
PropertyTypevalidateValue in class PropertyType<Font>propertyName - the name of the property used for logging purposes. To uniquely identify the Property with validation issues.value - the string representation of the propertyPropertyException - if the conversion failed.public String toString(String propertyName, Font t) throws PropertyException
PropertyTypetoString in class PropertyType<Font>propertyName - the name of the property used for logging purposes.t - the type T.PropertyException - if conversion failed in validation.PropertyType.validate(String, String)public String[] getAvailableFontFamilyNames()
GraphicsEnvironment.getLocalGraphicsEnvironment(),
GraphicsEnvironment.getAvailableFontFamilyNames()