final ElementStyleSheet style = e.getStyle();
final Iterator entries = styleExpressions.entrySet().iterator();
while (entries.hasNext())
{
final Map.Entry entry = (Map.Entry) entries.next();
final StyleKey key = (StyleKey) entry.getKey();
final Expression ex = (Expression) entry.getValue();
if (ex == null)
{
continue;
}
retval = true;
ex.setRuntime(getRuntime());
try
{
final Object value = evaluate(ex);
if (value == null)
{
style.setStyleProperty(key, null);
}
else if (key.getValueType().isInstance(value))
{
style.setStyleProperty(key, value);
}
else if (value instanceof ErrorValue)
{
style.setStyleProperty(key, null);
}
else
{
final ValueConverter valueConverter = ConverterRegistry.getInstance().getValueConverter(key.getValueType());
if (valueConverter != null)
{
// try to convert it ..
final Object o = ConverterRegistry.toPropertyValue(String.valueOf(value), key.getValueType());
style.setStyleProperty(key, o);
}
else
{
style.setStyleProperty(key, null);