/** * This function returns value of 'prop'. Querying value mechanism does * not care shorthand properties. */ protected String get(String propName) { String str = null; Object obj = fProperties.get(propName); if (obj != null) { if (obj instanceof ICSSValue) str = ((ICSSValue) obj).getCSSValueText(); else str = obj.toString(); } return (str != null) ? str : "";//$NON-NLS-1$ }
ICSSValueList list = (ICSSValueList) obj; ICSSValue value = (ICSSValue) list.item(0); if (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) { ICSSPrimitiveValue prim = (ICSSPrimitiveValue) value; if (prim.getPrimitiveType() == CSSPrimitiveValue.CSS_IDENT) { str = value.getCSSValueText(); str = ((ICSSValue) obj).getCSSValueText(); if (str.equalsIgnoreCase(IValID.V_BOTTOM) || str.equalsIgnoreCase(IValID.V_TOP)) str = "";//$NON-NLS-1$
int index = 1; ICSSValue value = (ICSSValue) list.item(0); if (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) { ICSSPrimitiveValue prim = (ICSSPrimitiveValue) value; if (prim.getPrimitiveType() == CSSPrimitiveValue.CSS_IDENT) { str = ((ICSSValue) list.item(index)).getCSSValueText(); str = ((ICSSValue) obj).getCSSValueText(); if (!str.equalsIgnoreCase(IValID.V_BOTTOM) && !str.equalsIgnoreCase(IValID.V_TOP)) str = "";//$NON-NLS-1$
/** * Used to retrieve the value of a CSS property if it has been explicitly * set within this declaration block. * * @param propertyName * The name of the CSS property. See the CSS property index. * @return Returns the value of the property if it has been explicitly set * for this declaration block. Returns the empty string if the * property has not been set. */ public String getPropertyValue(String propertyName) { CSSValue value = getPropertyCSSValue(propertyName); if (value != null) return ((ICSSValue) value).getCSSValueText(); return null; }
/** * This function exports all property/value pairs to 'decl' declaration */ public void applyFull(ICSSStyleDeclaration decl) { if (decl == null) return; Enumeration keys = fProperties.keys(); while (keys.hasMoreElements()) { Object key = keys.nextElement(); Object val = fProperties.get(key); String value = (val instanceof ICSSValue) ? ((ICSSValue) val).getCSSValueText() : val.toString(); if (value == null || value.length() <= 0) decl.removeProperty(key.toString()); else decl.setProperty(key.toString(), value.trim(), (val instanceof ValueData && ((ValueData) val).important) ? "!important" : "");//$NON-NLS-2$//$NON-NLS-1$ } }
/** * This function exports modified property/value pairs to 'decl' * declaration */ public void applyModified(ICSSStyleDeclaration decl) { if (decl == null || fModified == null) return; Iterator it = fModified.iterator(); while (it.hasNext()) { Object key = it.next(); Object val = fProperties.get(key); String value = (val instanceof ICSSValue) ? ((ICSSValue) val).getCSSValueText() : ((val != null) ? val.toString() : null); if (value == null || value.length() <= 0) decl.removeProperty(key.toString()); else decl.setProperty(key.toString(), value.trim(), (val instanceof ValueData && ((ValueData) val).important) ? "!important" : "");//$NON-NLS-2$//$NON-NLS-1$ } }
str = ((ICSSValue) obj).getCSSValueText();
String value = (val instanceof ICSSValue) ? ((ICSSValue) val).getCSSValueText() : val.toString();