java.lang.Object
org.jhotdraw8.css.converter.SizeCssConverter
- All Implemented Interfaces:
Converter<CssSize>,CssConverter<CssSize>
CssSizeConverter.
Parses the following EBNF from the JavaFX CSS Reference Guide.
Size := Double, [Unit] ;
Unit := ("px"|"mm"|"cm"|in"|"pt"|"pc"]"em"|"ex") ;
- Author:
- Werner Randelshofer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean@Nullable CssSize@Nullable StringGets a help text.inthashCode()booleanbooleannullable()@Nullable CssSizeparse(CssTokenizer tt, @Nullable IdResolver idResolver) Parses from the given tokenizer and moves the tokenizer to the next token past the value.static CssSizeparseSize(CssTokenizer tt, String variable) static CssSizeparseSizeOrPercentage(CssTokenizer tt, String variable) <TT extends CssSize>
voidproduceTokens(@Nullable TT value, @Nullable IdSupplier idSupplier, Consumer<CssToken> out) Produces tokens for the specified value.toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.jhotdraw8.base.converter.Converter
fromString, fromString, fromStringNonNull, fromStringNonNull, fromStringNonNull, fromStringNonNull, needsIdResolver, toString, toStringMethods inherited from interface org.jhotdraw8.css.converter.CssConverter
fromString, fromString, getExamples, parseNonNull, toString, toString, toString, toTokens
-
Constructor Details
-
SizeCssConverter
public SizeCssConverter(boolean nullable)
-
-
Method Details
-
parse
public @Nullable CssSize parse(CssTokenizer tt, @Nullable IdResolver idResolver) throws ParseException, IOException Description copied from interface:CssConverterParses from the given tokenizer and moves the tokenizer to the next token past the value.- Specified by:
parsein interfaceCssConverter<CssSize>- Parameters:
tt- tokenizer positioned on the tokenidResolver- the id factory- Returns:
- the parsed value
- Throws:
ParseException- on parse exceptionIOException- on io exception
-
parseSize
public static CssSize parseSize(CssTokenizer tt, String variable) throws ParseException, IOException - Throws:
ParseExceptionIOException
-
parseSizeOrPercentage
public static CssSize parseSizeOrPercentage(CssTokenizer tt, String variable) throws ParseException, IOException - Throws:
ParseExceptionIOException
-
produceTokens
public <TT extends CssSize> void produceTokens(@Nullable TT value, @Nullable IdSupplier idSupplier, Consumer<CssToken> out) Description copied from interface:CssConverterProduces tokens for the specified value.- Specified by:
produceTokensin interfaceCssConverter<CssSize>- Type Parameters:
TT- the value type- Parameters:
value- the valueidSupplier- the id factoryout- the consumer for the tokens
-
getDefaultValue
- Specified by:
getDefaultValuein interfaceConverter<CssSize>
-
getHelpText
Description copied from interface:CssConverterGets a help text.- Specified by:
getHelpTextin interfaceConverter<CssSize>- Specified by:
getHelpTextin interfaceCssConverter<CssSize>- Returns:
- a help text.
-
isNullable
public boolean isNullable()- Specified by:
isNullablein interfaceCssConverter<CssSize>
-
nullable
public boolean nullable() -
equals
-
hashCode
public int hashCode() -
toString
-