public void debug(String propertyName, CSSValue value) { short valueType = value.getCssValueType(); switch (valueType) { case CSSValue.CSS_CUSTOM: log.warn("valueType CUSTOM for " + propertyName + " - NOT IMPLEMENTED "); break; case CSSValue.CSS_INHERIT: log.warn("valueType INHERIT for " + propertyName + " - NOT IMPLEMENTED "); break; case CSSValue.CSS_PRIMITIVE_VALUE: log.debug("valueType PRIMITIVE for " + propertyName ); CSSPrimitiveValue cssPrimitiveValue = (CSSPrimitiveValue)value; log.debug("PrimitiveType: " + cssPrimitiveValue.getPrimitiveType() ); break; case CSSValue.CSS_VALUE_LIST: log.debug("valueType LIST for " + propertyName ); CSSValueList cssValueList = (CSSValueList)value; break; default: log.error("Unexpected valueType " + valueType + " for " + propertyName ); return; } }
public void applyCSSPropertyColor(Object node, CSSValue value, String pseudo, CSSEngine engine) throws Exception { if (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) { // Add color attribute Element element = (Element) node; CSSPrimitiveValue primitiveValue = (CSSPrimitiveValue) value; element.setAttribute("color", primitiveValue.getStringValue()); } }
public static RGB getRGB(CSSValue value) { if (value.getCssValueType() != CSSValue.CSS_PRIMITIVE_VALUE) { return null; } return getRGB((CSSPrimitiveValue) value); }
public void applyCSSPropertyBorderColor(CSSBorderProperties border, CSSValue value, String pseudo, CSSEngine engine) throws Exception { if (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) { border.setColor((CSSPrimitiveValue) value); } }
public Object convert(CSSValue value, CSSEngine engine, Object context) throws Exception { if (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) { CSSPrimitiveValue primitiveValue = (CSSPrimitiveValue) value; if ("true".equals(primitiveValue.getStringValue())) return Boolean.TRUE; } return Boolean.FALSE; }
protected void applyCSSProperty(Control control, String property, CSSValue value, String pseudo, CSSEngine engine) throws Exception { if (!(control instanceof CTabFolder)) return; if (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) { int radiusValue = (int) ((CSSPrimitiveValue) value).getFloatValue(CSSPrimitiveValue.CSS_NUMBER); CTabFolderRenderer renderer = ((CTabFolder) control).getRenderer(); try { Method m = renderer.getClass().getMethod("setCornerRadius", new Class[]{int.class}); m.invoke(renderer, radiusValue); } catch(NoSuchMethodException e) {/*IGNORED*/} } }
public void applyCSSPropertyFontStyle(Object node, CSSValue value, String pseudo, CSSEngine engine) throws Exception { if (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) { Element element = (Element) node; String style = ((CSSPrimitiveValue) value).getStringValue(); if ("italic".equals(style)) { insertElement(element, "i"); } } }
public static String getCSSValueKey(CSSValue value) { if (value instanceof CSS2FontProperties) return getCSSFontPropertiesKey((CSS2FontProperties) value); if (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) return getCSSPrimitiveValueKey((CSSPrimitiveValue) value); return null; }
public void applyCSSPropertyBorderStyle(CSSBorderProperties border, CSSValue value, String pseudo, CSSEngine engine) throws Exception { if (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) { border.setStyle(((CSSPrimitiveValue) value).getStringValue()); } }
@Override public void applyCSSPropertyPaddingBottom(Object element, CSSValue value, String pseudo, CSSEngine engine) throws Exception { CSS2PaddingPropertiesImpl padding = new CSS2PaddingPropertiesImpl(); if(value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) { padding.bottom = value; setPadding(element, padding, pseudo); } }
/** * @see http://www.w3schools.com/css/pr_class_cursor.asp */ public static Cursor getSWTCursor(CSSValue value, Display display) { if (!(value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)) return null; int i = getSWTCursorId((CSSPrimitiveValue) value); if (i == SWT.NONE) return null; Cursor cursor = new Cursor(display, i); return cursor; }
private int getPxValue(CSSValue value, int defaultValue) { if (value != null && (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) && (((CSSPrimitiveValue) value).getPrimitiveType() == CSSPrimitiveValue.CSS_PX)) { return (int) ((CSSPrimitiveValue) value) .getFloatValue(CSSPrimitiveValue.CSS_PX); } return defaultValue; } }
@Override public void applyCSSPropertyPaddingTop(Object element, CSSValue value, String pseudo, CSSEngine engine) throws Exception { CSS2PaddingPropertiesImpl padding = new CSS2PaddingPropertiesImpl(); if(value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) { padding.top = value; setPadding(element, padding, pseudo); } }
public void applyCSSPropertyPaddingTop(Object element, CSSValue value, String pseudo, CSSEngine engine) throws Exception { CSS2PaddingPropertiesImpl padding = new CSS2PaddingPropertiesImpl(); if(value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) { padding.top = value; setPadding(element, padding, pseudo); } }
public void applyCSSPropertyPaddingBottom(Object element, CSSValue value, String pseudo, CSSEngine engine) throws Exception { CSS2PaddingPropertiesImpl padding = new CSS2PaddingPropertiesImpl(); if(value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) { padding.bottom = value; setPadding(element, padding, pseudo); } }
private int getPxValue(CSSValue value, int defaultValue) { if (value != null && (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) && (((CSSPrimitiveValue) value).getPrimitiveType() == CSSPrimitiveValue.CSS_PX)) { return (int) ((CSSPrimitiveValue) value) .getFloatValue(CSSPrimitiveValue.CSS_PX); } return defaultValue; } }
@Override protected void applyCSSProperty(Control control, String property, CSSValue value, String pseudo, CSSEngine engine) throws Exception { if (! (control instanceof CTabFolder)) return; if ((value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) && ( ((CSSPrimitiveValue) value).getPrimitiveType() == CSSPrimitiveValue.CSS_PX) ) { int height = (int) ((CSSPrimitiveValue) value).getFloatValue(CSSPrimitiveValue.CSS_PX); ((CTabFolder) control).setTabHeight(height); } }
public void applyCSSPropertyCursor(Object element, CSSValue value, String pseudo, CSSEngine engine) throws Exception { if (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) { final Control control = (Control) element; Cursor cursor = (Cursor) engine.convert(value, Cursor.class, control.getDisplay()); control.setCursor(cursor); } }
@Override protected void applyCSSProperty(Control control, String property, CSSValue value, String pseudo, CSSEngine engine) throws Exception { if (! (control instanceof CTabFolder)) { return; } if ((value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) && ( ((CSSPrimitiveValue) value).getPrimitiveType() == CSSPrimitiveValue.CSS_PX) ) { int height = (int) ((CSSPrimitiveValue) value).getFloatValue(CSSPrimitiveValue.CSS_PX); ((CTabFolder) control).setTabHeight(height); } }
@Override public void applyCSSPropertyCursor(Object element, CSSValue value, String pseudo, CSSEngine engine) throws Exception { if (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) { final Control control = (Control) element; Cursor cursor = (Cursor) engine.convert(value, Cursor.class, control.getDisplay()); CSSSWTCursorHelper.storeDefaultCursor(control); control.setCursor(cursor); } }