/** * Makes a local, "computed", modification to this CSS style. * * @param declaration the style declaration * @param selector the selector determining that the style applies to this element */ public void applyStyleFromSelector(final org.w3c.dom.css.CSSStyleDeclaration declaration, final Selector selector) { final BrowserVersion browserVersion = getBrowserVersion(); final SelectorSpecificity specificity = selector.getSelectorSpecificity(); for (int i = 0; i < declaration.getLength(); i++) { final String name = declaration.item(i); if (!browserVersion.hasFeature(CSS_COMPUTED_NO_Z_INDEX) || !"z-index".equals(name)) { final String value = declaration.getPropertyValue(name); final String priority = declaration.getPropertyPriority(name); applyLocalStyleAttribute(name, value, priority, specificity); } } }
for (int j = 0; j < styleDeclaration.getLength(); j++) String property = styleDeclaration.item(j); ps.println("property: " + property); ps.println("value: " + styleDeclaration.getPropertyCSSValue(property).getCssText()); ps.println("priority: " + styleDeclaration.getPropertyPriority(property));
/** * Updates a property value in this target. */ public void updatePropertyValue(String pn, AnimatableValue val) { CSSStyleDeclaration over = getOverrideStyle(); if (val == null) { over.removeProperty(pn); } else { over.setProperty(pn, val.getCssText(), ""); } }
/** * Creates a new NodeAttributesModel object. */ public NodeCSSValuesModel(Node n) { node = n; if (viewCSS != null) { style = viewCSS.getComputedStyle((Element)n, null); propertyNames = new ArrayList(); if (style != null) { for (int i = 0; i < style.getLength(); i++) { propertyNames.add(style.item(i)); } Collections.sort(propertyNames); } } }
.getValue(); if (styleDeclaration != null) { int length = styleDeclaration.getLength(); String propertyName = styleDeclaration.item(i); String propertyValue = styleDeclaration .getPropertyValue(propertyName); property(writer, propertyName, propertyValue);
/** * Return the margin top as specified in the stylesheet for this control, or * the defaultValue if none is specified. * * @param defaultValue * @return the margin in pixels */ public int getMarginTop(int defaultValue) { if (style == null) return defaultValue; return getPxValue(style.getPropertyCSSValue("margin-top"), defaultValue); //$NON-NLS-1$ }
for (int i = 0; i < style.getLength(); i++) { String property = style.item(i); CSSValue value = style.getPropertyCSSValue(property); try { ICSSPropertyHandler handler = this.applyCSSProperty(element,
/** * Returns the value of the given cell. */ public Object getValueAt(int row, int col) { String prop = (String)propertyNames.get(row); if (col == 0) { return prop; } else { return style.getPropertyValue(prop); } } }
String oldValue = over.getPropertyValue(pn); if (oldValue != null) { over.removeProperty(pn); over.setProperty(pn, oldValue, null);
private boolean equalsProperties(final CSSStyleDeclaration csd) { if ((csd == null) || (getLength() != csd.getLength())) { return false; } for (int i = 0; i < getLength(); i++) { final String propertyName = item(i); // CSSValue propertyCSSValue1 = getPropertyCSSValue(propertyName); // CSSValue propertyCSSValue2 = csd.getPropertyCSSValue(propertyName); final String propertyValue1 = getPropertyValue(propertyName); final String propertyValue2 = csd.getPropertyValue(propertyName); if (!LangUtils.equals(propertyValue1, propertyValue2)) { return false; } final String propertyPriority1 = getPropertyPriority(propertyName); final String propertyPriority2 = csd.getPropertyPriority(propertyName); if (!LangUtils.equals(propertyPriority1, propertyPriority2)) { return false; } } return true; }
/** * Returns the actual text of the style. * @return the actual text of the style */ @JsxGetter public String getCssText() { if (styleDeclaration_ != null) { final String text = styleDeclaration_.getCssText(); if (styleDeclaration_.getLength() > 0) { return text + ";"; } return text; } return jsElement_.getDomNodeOrDie().getAttributeDirect("style"); }
/** * Returns the number of rows in the table. */ public int getRowCount() { if (style == null) { return 0; } return style.getLength(); }
/** * Sets the specified style attribute. * @param name the attribute name (camel-cased) * @param newValue the attribute value * @param important important value */ protected void setStyleAttribute(final String name, String newValue, final String important) { if (null == newValue || "null".equals(newValue)) { newValue = ""; } if (styleDeclaration_ != null) { styleDeclaration_.setProperty(name, newValue, important); return; } jsElement_.getDomNodeOrDie().replaceStyleAttribute(name, newValue, important); }
/** * @param buffer */ public void dumpDebugInfo(StringBuffer buffer) { if (_cache != null) { buffer.append("cache:\n"); buffer.append(_cache.getCssText()).append("\n"); } if (_defaultCache != null) { buffer.append("default cache:\n"); buffer.append(_defaultCache.getCssText()).append("\n"); } }
/** * Removes the specified style attribute, returning the value of the removed attribute. * @param name the attribute name (delimiter-separated, not camel-cased) */ private String removeStyleAttribute(final String name) { if (null != styleDeclaration_) { return styleDeclaration_.removeProperty(name); } return jsElement_.getDomNodeOrDie().removeStyleAttribute(name); }
/** * Returns the priority of the named style attribute, or an empty string if it is not found. * * @param name the name of the style attribute whose value is to be retrieved * @return the named style attribute value, or an empty string if it is not found */ protected String getStylePriority(final String name) { if (styleDeclaration_ != null) { return styleDeclaration_.getPropertyPriority(name); } final StyleElement element = getStyleElement(name); if (element != null && element.getValue() != null) { return element.getPriority(); } return ""; }
boolean isFillNone = false; boolean isStrokeNone = false; for (int j = 0; j < declaration.getLength(); j++) { final String property = declaration.item(j).trim(); final String value = declaration.getPropertyValue(property).trim(); switch (property) { case OPACITY:
/** * Return the margin top as specified in the stylesheet for this control, or * the defaultValue if none is specified. * * @param defaultValue * @return the margin in pixels */ public int getMarginTop(int defaultValue) { if (style == null) return defaultValue; return getPxValue(style.getPropertyCSSValue("margin-top"), defaultValue); //$NON-NLS-1$ }
String fontName = ""; String fontSrc = ""; for (int j = 0; j < declaration.getLength(); j++) { String property = declaration.item(j); CSSValue cssval = declaration.getPropertyCSSValue(property); String value = cssval.getCssText(); if (property.equals("font-family")) fontName = value; for (int j = 0; j < declaration.getLength(); j++) { String property = declaration.item(j); CSSValue cssval = declaration.getPropertyCSSValue(property); short valtyp = cssval.getCssValueType(); if (valtyp == CSSValue.CSS_PRIMITIVE_VALUE) {
/** * Returns the value of the given cell. */ public Object getValueAt(int row, int col) { String prop = (String)propertyNames.get(row); if (col == 0) { return prop; } else { return style.getPropertyValue(prop); } } }