/** * Implements {@link * ValueManager#computeValue(CSSStylableElement,String,CSSEngine,int,StyleMap,Value)}. */ public Value computeValue(CSSStylableElement elt, String pseudo, CSSEngine engine, int idx, StyleMap sm, Value value) { switch (value.getCssValueType()) { case CSSValue.CSS_PRIMITIVE_VALUE: return value; } ListValue lv = (ListValue)value; ListValue result = new ListValue(' '); for (int i = 0; i < lv.getLength(); i++) { result.append(super.computeValue(elt, pseudo, engine, idx, sm, lv.item(i))); } return result; }
/** * Returns a printable representation of this value. */ public String toString() { return getCssText(); }
/** * Called when the list value text has changed. */ public void listTextChanged(int idx, String text) throws DOMException { ListValue lv = (ListValue)getValue(); int len = lv.getLength(); StringBuffer sb = new StringBuffer( len * 8 ); for (int i = 0; i < idx; i++) { sb.append(lv.item(i).getCssText()); sb.append(lv.getSeparatorChar()); } sb.append(text); for (int i = idx + 1; i < len; i++) { sb.append(lv.getSeparatorChar()); sb.append(lv.item(i).getCssText()); } text = sb.toString(); textChanged(text); }
/** * Returns the subregion of user space where access to the * background image is allowed to happen. * * @param e the container element */ public static Rectangle2D convertEnableBackground(Element e /*, UnitProcessor.Context uctx*/) { Value v = getComputedStyle(e, SVGCSSEngine.ENABLE_BACKGROUND_INDEX); if (v.getCssValueType() != CSSValue.CSS_VALUE_LIST) { return null; // accumulate } ListValue lv = (ListValue)v; int length = lv.getLength(); switch (length) { case 1: return CompositeGraphicsNode.VIEWPORT; // new case 5: // new <x>,<y>,<width>,<height> float x = lv.item(1).getFloatValue(); float y = lv.item(2).getFloatValue(); float w = lv.item(3).getFloatValue(); float h = lv.item(4).getFloatValue(); return new Rectangle2D.Float(x, y, w, h); default: throw new IllegalStateException("Unexpected length:" + length ); // Cannot happen } }
/** * Implements {@link * ValueManager#computeValue(CSSStylableElement,String,CSSEngine,int,StyleMap,Value)}. */ public Value computeValue(CSSStylableElement elt, String pseudo, CSSEngine engine, int idx, StyleMap sm, Value value) { if (value == SVGValueConstants.CURRENTCOLOR_VALUE) { sm.putColorRelative(idx, true); int ci = engine.getColorIndex(); return engine.getComputedStyle(elt, pseudo, ci); } if (value.getCssValueType() == CSSValue.CSS_VALUE_LIST) { ListValue lv = (ListValue)value; Value v = lv.item(0); Value t = super.computeValue(elt, pseudo, engine, idx, sm, v); if (t != v) { ListValue result = new ListValue(' '); result.append(t); result.append(lv.item(1)); return result; } return value; } return super.computeValue(elt, pseudo, engine, idx, sm, value); }
public int getLength() throws DOMException { return getListValue().getLength(); }
public CssValue item(int index) throws DOMException { Value value = getListValue().item(index); return CssValueFactory.createCssValue(value); } }
/** * Returns the subregion of user space where access to the * background image is allowed to happen. * * @param e the container element */ public static Rectangle2D convertEnableBackground(Element e /*, UnitProcessor.Context uctx*/) { Value v = getComputedStyle(e, SVGCSSEngine.ENABLE_BACKGROUND_INDEX); if (v.getCssValueType() != CSSValue.CSS_VALUE_LIST) { return null; // accumulate } ListValue lv = (ListValue)v; int length = lv.getLength(); switch (length) { case 1: return CompositeGraphicsNode.VIEWPORT; // new case 5: // new <x>,<y>,<width>,<height> float x = lv.item(1).getFloatValue(); float y = lv.item(2).getFloatValue(); float w = lv.item(3).getFloatValue(); float h = lv.item(4).getFloatValue(); return new Rectangle2D.Float(x, y, w, h); default: throw new IllegalStateException("Unexpected length:" + length ); // Cannot happen } }
/** * Implements {@link * ValueManager#computeValue(CSSStylableElement,String,CSSEngine,int,StyleMap,Value)}. */ public Value computeValue(CSSStylableElement elt, String pseudo, CSSEngine engine, int idx, StyleMap sm, Value value) { if (value == SVGValueConstants.CURRENTCOLOR_VALUE) { sm.putColorRelative(idx, true); int ci = engine.getColorIndex(); return engine.getComputedStyle(elt, pseudo, ci); } if (value.getCssValueType() == CSSValue.CSS_VALUE_LIST) { ListValue lv = (ListValue)value; Value v = lv.item(0); Value t = super.computeValue(elt, pseudo, engine, idx, sm, v); if (t != v) { ListValue result = new ListValue(' '); result.append(t); result.append(lv.item(1)); return result; } return value; } return super.computeValue(elt, pseudo, engine, idx, sm, value); }
/** * Implements {@link * ValueManager#computeValue(CSSStylableElement,String,CSSEngine,int,StyleMap,Value)}. */ public Value computeValue(CSSStylableElement elt, String pseudo, CSSEngine engine, int idx, StyleMap sm, Value value) { switch (value.getCssValueType()) { case CSSValue.CSS_PRIMITIVE_VALUE: return value; } ListValue lv = (ListValue)value; ListValue result = new ListValue(' '); for (int i = 0; i < lv.getLength(); i++) { result.append(super.computeValue(elt, pseudo, engine, idx, sm, lv.item(i))); } return result; }
/** * Called when the list value text has changed. */ public void listTextChanged(int idx, String text) throws DOMException { ListValue lv = (ListValue)getValue(); int len = lv.getLength(); StringBuffer sb = new StringBuffer( len * 8 ); for (int i = 0; i < idx; i++) { sb.append(lv.item(i).getCssText()); sb.append(lv.getSeparatorChar()); } sb.append(text); for (int i = idx + 1; i < len; i++) { sb.append(lv.getSeparatorChar()); sb.append(lv.item(i).getCssText()); } text = sb.toString(); textChanged(text); }
/** * Returns the subregion of user space where access to the * background image is allowed to happen. * * @param e the container element */ public static Rectangle2D convertEnableBackground(Element e /*, UnitProcessor.Context uctx*/) { Value v = getComputedStyle(e, SVGCSSEngine.ENABLE_BACKGROUND_INDEX); if (v.getCssValueType() != CSSValue.CSS_VALUE_LIST) { return null; // accumulate } ListValue lv = (ListValue)v; int length = lv.getLength(); switch (length) { case 1: return CompositeGraphicsNode.VIEWPORT; // new case 5: // new <x>,<y>,<width>,<height> float x = lv.item(1).getFloatValue(); float y = lv.item(2).getFloatValue(); float w = lv.item(3).getFloatValue(); float h = lv.item(4).getFloatValue(); return new Rectangle2D.Float(x, y, w, h); default: throw new IllegalStateException("Unexpected length:" + length ); // Cannot happen } }
/** * Implements {@link * ValueManager#computeValue(CSSStylableElement,String,CSSEngine,int,StyleMap,Value)}. */ public Value computeValue(CSSStylableElement elt, String pseudo, CSSEngine engine, int idx, StyleMap sm, Value value) { if (value == SVGValueConstants.CURRENTCOLOR_VALUE) { sm.putColorRelative(idx, true); int ci = engine.getColorIndex(); return engine.getComputedStyle(elt, pseudo, ci); } if (value.getCssValueType() == CSSValue.CSS_VALUE_LIST) { ListValue lv = (ListValue)value; Value v = lv.item(0); Value t = super.computeValue(elt, pseudo, engine, idx, sm, v); if (t != v) { ListValue result = new ListValue(' '); result.append(t); result.append(lv.item(1)); return result; } return value; } return super.computeValue(elt, pseudo, engine, idx, sm, value); }
/** * Returns a printable representation of this value. */ public String toString() { return getCssText(); }
/** * Implements {@link * ValueManager#computeValue(CSSStylableElement,String,CSSEngine,int,StyleMap,Value)}. */ public Value computeValue(CSSStylableElement elt, String pseudo, CSSEngine engine, int idx, StyleMap sm, Value value) { switch (value.getCssValueType()) { case CSSValue.CSS_PRIMITIVE_VALUE: return value; } ListValue lv = (ListValue)value; ListValue result = new ListValue(' '); for (int i = 0; i < lv.getLength(); i++) { result.append(super.computeValue(elt, pseudo, engine, idx, sm, lv.item(i))); } return result; }
throw createInvalidIdentifierDOMException(id); ListValue result = new ListValue(' '); result.append(SVGValueConstants.NEW_VALUE); lu = lu.getNextLexicalUnit(); if (lu == null) { return result; result.append(super.createValue(lu, engine)); for (int i = 1; i < 4; i++) { lu = lu.getNextLexicalUnit(); throw createMalformedLexicalUnitDOMException(); result.append(super.createValue(lu, engine));
/** * Called when the list value text has changed. */ public void listTextChanged(int idx, String text) throws DOMException { ListValue lv = (ListValue)getValue(); int len = lv.getLength(); StringBuffer sb = new StringBuffer( len * 8 ); for (int i = 0; i < idx; i++) { sb.append(lv.item(i).getCssText()); sb.append(lv.getSeparatorChar()); } sb.append(text); for (int i = idx + 1; i < len; i++) { sb.append(lv.getSeparatorChar()); sb.append(lv.item(i).getCssText()); } text = sb.toString(); textChanged(text); }