* @return The parsed, storable property value.
* @throws PropertyException For an invalid property value.
*/
private PropertyValue createShorthandValue(final FObj fobj,
final String value) throws PropertyException {
final PropertyCollection collection = new PropertyCollection();
PropertyValue pv = checkKeywords(this.getValidKeywords(), value);
if (pv != null) {
final PdBackgroundPosition property =
new PdBackgroundPosition(pv);
collection.addItem(property);
return collection;
}
final StringTokenizer st = new StringTokenizer(value);
if (st.countTokens() < 1 || st.countTokens() > 2) {
throw unexpectedValue(value, fobj);
}
while (st.hasMoreTokens()) {
final String token = st.nextToken();
pv = DtPercentage.makePercentageDT(token);
if (pv == null) {
pv = DtLength.makeLengthDT(token);
}
if (pv == null) {
final FoValue keyword = FoValue.xslValueOf(token);
if (Property.keywordInSet(keyword,
PdBackgroundPositionHorizontal.VALID_KEYWORDS)
&& keyword != FoValue.INHERIT) {
pv = FoPropertyKeyword.getPropertyKeyword(keyword);
}
}
if (pv == null) {
final FoValue keyword = FoValue.xslValueOf(token);
if (Property.keywordInSet(keyword,
PdBackgroundPositionVertical.VALID_KEYWORDS)
&& keyword != FoValue.INHERIT) {
pv = FoPropertyKeyword.getPropertyKeyword(keyword);
}
}
if (pv != null) {
final PdBackgroundPosition property =
new PdBackgroundPosition(pv);
collection.addItem(property);
} else {
throw unexpectedValue(value, fobj);
}
}
if (collection.getCount() == 1) {
return collection;
}
pv = collection.getItem(0).value();
final PropertyValue pv2 = collection.getItem(1).value();
/* If the first item is a length or percentage, the other needs to be
* also. */
if (pv.canEvalPercentage()
|| pv.canEvalLength()) {
if (pv2.canEvalPercentage()