else if ("url".equals(type))
{
final CSSResourceValue cssResourceValue =
FunctionUtilities.loadResource(layoutProcess, strVal);
final Resource resource = cssResourceValue.getValue();
return new ResourceContentToken(resource);
}
else if ("color".equals(type))
{
final CSSValue colorValue = ColorUtil.parseColor(strVal);
if (colorValue == null)
{
throw new FunctionEvaluationException();
}
return new StaticTextToken (colorValue.getCSSText());
}
else
{
// auto-mode. We check for URLs, as this is required for images
final CSSValue cssValue =
FunctionUtilities.parseValue(layoutProcess, strVal);
if (cssValue instanceof CSSResourceValue)
{
final CSSResourceValue cssResourceValue =
(CSSResourceValue) cssValue;
final Resource resource = cssResourceValue.getValue();
return new ResourceContentToken(resource);
}
else if (cssValue instanceof CSSStringValue)
{
final CSSStringValue sval = (CSSStringValue) cssValue;
return new StaticTextToken (sval.getValue());
}
else
{
return new StaticTextToken (cssValue.getCSSText());
}
}
}
else if (value instanceof URL)
{
final CSSResourceValue cssResourceValue =
FunctionUtilities.loadResource(layoutProcess, value);
final Resource resource = cssResourceValue.getValue();
return new ResourceContentToken(resource);
}
else if (value instanceof Resource)
{
return new ResourceContentToken((Resource) value);
}
else if (value instanceof ResourceKey)
{
final CSSResourceValue cssResourceValue =
FunctionUtilities.loadResource(layoutProcess, value);
final Resource resource = cssResourceValue.getValue();
return new ResourceContentToken(resource);
}
else if (value instanceof Date)
{
return new StaticTextToken (String.valueOf(value));
}