本文整理汇总了Java中org.w3c.dom.css.CSSValue类的典型用法代码示例。如果您正苦于以下问题:Java CSSValue类的具体用法?Java CSSValue怎么用?Java CSSValue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CSSValue类属于org.w3c.dom.css包,在下文中一共展示了CSSValue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: computeValue
import org.w3c.dom.css.CSSValue; //导入依赖的package包/类
/**
* 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;
}
示例2: computeValue
import org.w3c.dom.css.CSSValue; //导入依赖的package包/类
/**
* 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.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) &&
(value.getPrimitiveType() == CSSPrimitiveValue.CSS_URI)) {
// Reveal the absolute value as the cssText now.
return new URIValue(value.getStringValue(),
value.getStringValue());
}
return value;
}
示例3: computeValue
import org.w3c.dom.css.CSSValue; //导入依赖的package包/类
/**
* 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.getCssValueType() == CSSValue.CSS_VALUE_LIST) {
ListValue lv = (ListValue)value;
int len = lv.getLength();
ListValue result = new ListValue(' ');
for (int i=0; i<len; i++) {
Value v = lv.item(0);
if (v.getPrimitiveType() == CSSPrimitiveValue.CSS_URI) {
// Reveal the absolute value as the cssText now.
result.append(new URIValue(v.getStringValue(),
v.getStringValue()));
} else {
result.append(v);
}
}
return result;
}
return super.computeValue(elt, pseudo, engine, idx, sm, value);
}
示例4: createCSSValue
import org.w3c.dom.css.CSSValue; //导入依赖的package包/类
/**
* Creates a CSSValue to manage the value at the given index.
*/
protected CSSValue createCSSValue(int idx) {
if (idx > SVGCSSEngine.FINAL_INDEX) {
if (cssEngine.getValueManagers()[idx] instanceof SVGPaintManager) {
return new ComputedCSSPaintValue(idx);
}
if (cssEngine.getValueManagers()[idx] instanceof SVGColorManager) {
return new ComputedCSSColorValue(idx);
}
} else {
switch (idx) {
case SVGCSSEngine.FILL_INDEX:
case SVGCSSEngine.STROKE_INDEX:
return new ComputedCSSPaintValue(idx);
case SVGCSSEngine.FLOOD_COLOR_INDEX:
case SVGCSSEngine.LIGHTING_COLOR_INDEX:
case SVGCSSEngine.STOP_COLOR_INDEX:
return new ComputedCSSColorValue(idx);
}
}
return super.createCSSValue(idx);
}
示例5: item
import org.w3c.dom.css.CSSValue; //导入依赖的package包/类
/**
* <b>DOM</b>: Implements {@link org.w3c.dom.css.CSSValueList#item(int)}.
*/
public CSSValue item(int index) {
int len = valueProvider.getValue().getLength();
if (index < 0 || index >= len) {
return null;
}
if (items == null) {
items = new CSSValue[valueProvider.getValue().getLength()];
} else if (items.length < len) {
CSSValue[] nitems = new CSSValue[len];
System.arraycopy( items, 0, nitems, 0, items.length );
items = nitems;
}
CSSValue result = items[index];
if (result == null) {
items[index] = result = new ListComponent(index);
}
return result;
}
示例6: createCSSValue
import org.w3c.dom.css.CSSValue; //导入依赖的package包/类
/**
* Creates the CSS value associated with the given property.
*/
protected CSSValue createCSSValue(String name) {
int idx = cssEngine.getPropertyIndex(name);
if (idx > SVGCSSEngine.FINAL_INDEX) {
if (cssEngine.getValueManagers()[idx] instanceof SVGPaintManager) {
return new StyleDeclarationPaintValue(name);
}
if (cssEngine.getValueManagers()[idx] instanceof SVGColorManager) {
return new StyleDeclarationColorValue(name);
}
} else {
switch (idx) {
case SVGCSSEngine.FILL_INDEX:
case SVGCSSEngine.STROKE_INDEX:
return new StyleDeclarationPaintValue(name);
case SVGCSSEngine.FLOOD_COLOR_INDEX:
case SVGCSSEngine.LIGHTING_COLOR_INDEX:
case SVGCSSEngine.STOP_COLOR_INDEX:
return new StyleDeclarationColorValue(name);
}
}
return super.createCSSValue(name);
}
示例7: getColorType
import org.w3c.dom.css.CSSValue; //导入依赖的package包/类
/**
* <b>DOM</b>: Implements {@link
* org.w3c.dom.svg.SVGColor#getColorType()}.
*/
public short getColorType() {
Value value = valueProvider.getValue();
int cssValueType = value.getCssValueType();
switch ( cssValueType ) {
case CSSValue.CSS_PRIMITIVE_VALUE:
int primitiveType = value.getPrimitiveType();
switch ( primitiveType ) {
case CSSPrimitiveValue.CSS_IDENT: {
if (value.getStringValue().equalsIgnoreCase
(CSSConstants.CSS_CURRENTCOLOR_VALUE))
return SVG_COLORTYPE_CURRENTCOLOR;
return SVG_COLORTYPE_RGBCOLOR;
}
case CSSPrimitiveValue.CSS_RGBCOLOR:
return SVG_COLORTYPE_RGBCOLOR;
}
// there was no case for this primitiveType, prevent throwing the other exception
throw new IllegalStateException("Found unexpected PrimitiveType:" + primitiveType );
case CSSValue.CSS_VALUE_LIST:
return SVG_COLORTYPE_RGBCOLOR_ICCCOLOR;
}
// should not happen
throw new IllegalStateException("Found unexpected CssValueType:" + cssValueType );
}
示例8: computeValue
import org.w3c.dom.css.CSSValue; //导入依赖的package包/类
/**
* Computes a CSS {@link Value} and performance inheritance if the
* specified value is 'inherit'.
*/
protected Value computeValue(CSSStylableElement elt, String pn,
Value v) {
ValueManager[] vms = cssEngine.getValueManagers();
int idx = cssEngine.getPropertyIndex(pn);
if (idx != -1) {
if (v.getCssValueType() == CSSValue.CSS_INHERIT) {
elt = CSSEngine.getParentCSSStylableElement(elt);
if (elt != null) {
return cssEngine.getComputedStyle(elt, null, idx);
}
return vms[idx].getDefaultValue();
}
v = vms[idx].computeValue(elt, null, cssEngine, idx,
dummyStyleMap, v);
}
return v;
}
示例9: convertEnableBackground
import org.w3c.dom.css.CSSValue; //导入依赖的package包/类
/**
* 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
}
}
示例10: convertStrokeDasharray
import org.w3c.dom.css.CSSValue; //导入依赖的package包/类
/**
* Converts the 'stroke-dasharray' property to a list of float
* number in user units.
*
* @param v the CSS value describing the dasharray property
*/
public static float [] convertStrokeDasharray(Value v) {
float [] dasharray = null;
if (v.getCssValueType() == CSSValue.CSS_VALUE_LIST) {
int length = v.getLength();
dasharray = new float[length];
float sum = 0;
for (int i = 0; i < dasharray.length; ++i) {
dasharray[i] = v.item(i).getFloatValue();
sum += dasharray[i];
}
if (sum == 0) {
/* 11.4 - If the sum of the <length>'s is zero, then
* the stroke is rendered as if a value of none were specified.
*/
dasharray = null;
}
}
return dasharray;
}
示例11: buildDeclarations
import org.w3c.dom.css.CSSValue; //导入依赖的package包/类
@Override
public List buildDeclarations(CSSName cssName, List values, int origin, boolean important,
boolean inheritAllowed) {
checkValueCount(cssName, 1, values.size());
CSSPrimitiveValue value = (CSSPrimitiveValue) values.get(0);
checkInheritAllowed(value, inheritAllowed);
if (value.getCssValueType() != CSSValue.CSS_INHERIT) {
checkIdentOrURIType(cssName, value);
if (value.getPrimitiveType() == CSSPrimitiveValue.CSS_IDENT) {
IdentValue ident = checkIdent(cssName, value);
checkValidity(cssName, ALLOWED, ident);
}
}
return Collections.singletonList(new PropertyDeclaration(cssName, value, important, origin));
}
示例12: buildDeclarations
import org.w3c.dom.css.CSSValue; //导入依赖的package包/类
@Override
public List buildDeclarations(
CSSName cssName, List values, int origin, boolean important, boolean inheritAllowed) {
checkValueCount(cssName, 1, values.size());
PropertyValue value = (PropertyValue)values.get(0);
checkInheritAllowed(value, inheritAllowed);
if (value.getCssValueType() != CSSValue.CSS_INHERIT) {
checkIdentLengthOrPercentType(cssName, value);
if (value.getPrimitiveType() == CSSPrimitiveValue.CSS_IDENT) {
IdentValue ident = checkIdent(cssName, value);
checkValidity(cssName, getAllowed(), ident);
} else if (! isNegativeValuesAllowed() && value.getFloatValue() < 0.0f) {
throw new CSSParseException(cssName + " may not be negative", -1);
}
}
return Collections.singletonList(
new PropertyDeclaration(cssName, value, important, origin));
}
示例13: buildDeclarations
import org.w3c.dom.css.CSSValue; //导入依赖的package包/类
@Override
public List buildDeclarations(CSSName cssName, List values, int origin, boolean important,
boolean inheritAllowed) {
checkValueCount(cssName, 1, values.size());
CSSPrimitiveValue value = (CSSPrimitiveValue) values.get(0);
checkInheritAllowed(value, inheritAllowed);
if (value.getCssValueType() != CSSValue.CSS_INHERIT) {
checkIdentType(cssName, value);
IdentValue ident = checkIdent(cssName, value);
checkValidity(cssName, getAllowed(), ident);
}
return Collections.singletonList(new PropertyDeclaration(cssName, value, important, origin));
}
示例14: buildDeclarations
import org.w3c.dom.css.CSSValue; //导入依赖的package包/类
@Override
public List buildDeclarations(CSSName cssName, List values, int origin, boolean important,
boolean inheritAllowed) {
checkValueCount(cssName, 1, values.size());
PropertyValue value = (PropertyValue) values.get(0);
checkInheritAllowed(value, inheritAllowed);
if (value.getCssValueType() != CSSValue.CSS_INHERIT) {
checkIdentNumberOrPercentType(cssName, value);
if (value.getPrimitiveType() == CSSPrimitiveValue.CSS_IDENT) {
IdentValue ident = checkIdent(cssName, value);
checkValidity(cssName, allowed, ident);
} else if (value.getFloatValue() < 0.0f) {
throw new CSSParseException(cssName + " may not be negative", -1);
}
}
return Collections.singletonList(new PropertyDeclaration(cssName, value, important, origin));
}
示例15: buildDeclarations
import org.w3c.dom.css.CSSValue; //导入依赖的package包/类
@Override
public List buildDeclarations(CSSName cssName, List values, int origin, boolean important,
boolean inheritAllowed) {
checkValueCount(cssName, 1, values.size());
PropertyValue value = (PropertyValue) values.get(0);
checkInheritAllowed(value, inheritAllowed);
if (value.getCssValueType() != CSSValue.CSS_INHERIT) {
checkLengthOrPercentType(cssName, value);
if (!isNegativeValuesAllowed() && value.getFloatValue() < 0.0f) {
throw new CSSParseException(cssName + " may not be negative", -1);
}
}
return Collections.singletonList(new PropertyDeclaration(cssName, value, important, origin));
}