本文整理汇总了Java中org.w3c.dom.css.CSSValue.CSS_VALUE_LIST属性的典型用法代码示例。如果您正苦于以下问题:Java CSSValue.CSS_VALUE_LIST属性的具体用法?Java CSSValue.CSS_VALUE_LIST怎么用?Java CSSValue.CSS_VALUE_LIST使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.w3c.dom.css.CSSValue
的用法示例。
在下文中一共展示了CSSValue.CSS_VALUE_LIST属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: computeValue
/**
* 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);
}
示例2: getColorType
/**
* <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 );
}
示例3: convertEnableBackground
/**
* 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
}
}
示例4: convertStrokeDasharray
/**
* 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;
}
示例5: computeValue
/**
* 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);
}
示例6: computeValue
/**
* 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.NONE_VALUE) {
return value;
}
if (value.getCssValueType() == CSSValue.CSS_VALUE_LIST) {
ListValue lv = (ListValue)value;
Value v = lv.item(0);
if (v.getPrimitiveType() == CSSPrimitiveValue.CSS_URI) {
v = lv.item(1);
if (v == SVGValueConstants.NONE_VALUE) {
return value;
}
Value t = super.computeValue(elt, pseudo, engine, idx, sm, v);
if (t != v) {
ListValue result = new ListValue(' ');
result.append(lv.item(0));
result.append(t);
if (lv.getLength() == 3) {
result.append(lv.item(1));
}
return result;
}
return value;
}
}
return super.computeValue(elt, pseudo, engine, idx, sm, value);
}
示例7: getStringProp
public static String getStringProp(StyleMap sm, CSSEngine eng, int pidx) {
Value v = sm.getValue(pidx);
ValueManager [] vms = eng.getValueManagers();
if (v == null) {
ValueManager vm = vms[pidx];
v = vm.getDefaultValue();
}
while (v.getCssValueType() == CSSValue.CSS_VALUE_LIST) {
v = v.item(0);
}
return v.getStringValue();
}
示例8: getFloatProp
public static float getFloatProp(StyleMap sm, CSSEngine eng, int pidx) {
Value v = sm.getValue(pidx);
ValueManager [] vms = eng.getValueManagers();
if (v == null) {
ValueManager vm = vms[pidx];
v = vm.getDefaultValue();
}
while (v.getCssValueType() == CSSValue.CSS_VALUE_LIST) {
v = v.item(0);
}
return v.getFloatValue();
}
示例9: isAutoCursor
/**
* Checks if the cursor property on the input element is set to auto
*/
public static boolean isAutoCursor(Element e) {
Value cursorValue =
CSSUtilities.getComputedStyle(e,
SVGCSSEngine.CURSOR_INDEX);
boolean isAuto = false;
if (cursorValue != null){
if(
cursorValue.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE
&&
cursorValue.getPrimitiveType() == CSSPrimitiveValue.CSS_IDENT
&&
cursorValue.getStringValue().charAt(0) == 'a'
) {
isAuto = true;
} else if (
cursorValue.getCssValueType() == CSSValue.CSS_VALUE_LIST
&&
cursorValue.getLength() == 1) {
Value lValue = cursorValue.item(0);
if (lValue != null
&&
lValue.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE
&&
lValue.getPrimitiveType() == CSSPrimitiveValue.CSS_IDENT
&&
lValue.getStringValue().charAt(0) == 'a') {
isAuto = true;
}
}
}
return isAuto;
}
示例10: convertCursor
/**
* Returns the Cursor corresponding to the input element's cursor property
*
* @param e the element on which the cursor property is set
*/
public Cursor convertCursor(Element e) {
Value cursorValue = CSSUtilities.getComputedStyle
(e, SVGCSSEngine.CURSOR_INDEX);
String cursorStr = SVGConstants.SVG_AUTO_VALUE;
if (cursorValue != null) {
if (cursorValue.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE
&&
cursorValue.getPrimitiveType() == CSSPrimitiveValue.CSS_IDENT) {
// Single Value : should be one of the predefined cursors or
// 'inherit'
cursorStr = cursorValue.getStringValue();
return convertBuiltInCursor(e, cursorStr);
} else if (cursorValue.getCssValueType() ==
CSSValue.CSS_VALUE_LIST) {
int nValues = cursorValue.getLength();
if (nValues == 1) {
cursorValue = cursorValue.item(0);
if (cursorValue.getPrimitiveType() ==
CSSPrimitiveValue.CSS_IDENT) {
cursorStr = cursorValue.getStringValue();
return convertBuiltInCursor(e, cursorStr);
}
} else if (nValues > 1) {
//
// Look for the first cursor url we can handle.
// That would be a reference to a <cursor> element.
//
return convertSVGCursor(e, cursorValue);
}
}
}
return convertBuiltInCursor(e, cursorStr);
}
示例11: getCssValueType
/**
* Implements {@link Value#getCssValueType()}.
*/
public short getCssValueType() {
return CSSValue.CSS_VALUE_LIST;
}
示例12: computeValue
/**
* 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;
if (lv.getLength() == 5) {
Value lv1 = lv.item(1);
orientation = HORIZONTAL_ORIENTATION;
Value v1 = super.computeValue(elt, pseudo, engine,
idx, sm, lv1);
Value lv2 = lv.item(2);
orientation = VERTICAL_ORIENTATION;
Value v2 = super.computeValue(elt, pseudo, engine,
idx, sm, lv2);
Value lv3 = lv.item(3);
orientation = HORIZONTAL_ORIENTATION;
Value v3 = super.computeValue(elt, pseudo, engine,
idx, sm, lv3);
Value lv4 = lv.item(4);
orientation = VERTICAL_ORIENTATION;
Value v4 = super.computeValue(elt, pseudo, engine,
idx, sm, lv4);
if (lv1 != v1 || lv2 != v2 ||
lv3 != v3 || lv4 != v4) {
ListValue result = new ListValue(' ');
result.append(lv.item(0));
result.append(v1);
result.append(v2);
result.append(v3);
result.append(v4);
return result;
}
}
}
return value;
}
示例13: createCSSFontFace
public static CSSFontFace createCSSFontFace(CSSEngine eng,
FontFaceRule ffr) {
StyleMap sm = ffr.getStyleMap();
String familyName = getStringProp
(sm, eng, SVGCSSEngine.FONT_FAMILY_INDEX);
CSSFontFace ret = new CSSFontFace(familyName);
Value v;
v = sm.getValue(SVGCSSEngine.FONT_WEIGHT_INDEX);
if (v != null)
ret.fontWeight = v.getCssText();
v = sm.getValue(SVGCSSEngine.FONT_STYLE_INDEX);
if (v != null)
ret.fontStyle = v.getCssText();
v = sm.getValue(SVGCSSEngine.FONT_VARIANT_INDEX);
if (v != null)
ret.fontVariant = v.getCssText();
v = sm.getValue(SVGCSSEngine.FONT_STRETCH_INDEX);
if (v != null)
ret.fontStretch = v.getCssText();
v = sm.getValue(SVGCSSEngine.SRC_INDEX);
ParsedURL base = ffr.getURL();
if ((v != null) && (v != ValueConstants.NONE_VALUE)) {
if (v.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
ret.srcs = new LinkedList();
ret.srcs.add(getSrcValue(v, base));
} else if (v.getCssValueType() == CSSValue.CSS_VALUE_LIST) {
ret.srcs = new LinkedList();
for (int i=0; i<v.getLength(); i++) {
ret.srcs.add(getSrcValue(v.item(i), base));
}
}
}
/*
float unitsPerEm = getFloatProp
(sm, eng, SVGCSSEngine.UNITS_PER_EM_INDEX);
String slope = getFloatProp
(sm, eng, SVGCSSEngine.SLOPE_INDEX);
String panose1 = getStringProp
(sm, eng, SVGCSSEngine.PANOSE1_INDEX);
String ascent = getFloatProp
(sm, eng, SVGCSSEngine.ASCENT_INDEX);
String descent = getFloatProp
(sm, eng, SVGCSSEngine.DESCENT_INDEX);
String strikethroughPosition = getFloatProp
(sm, eng, SVGCSSEngine.STRIKETHROUGH_POSITION_INDEX);
String strikethroughThickness = getFloatProp
(sm, eng, SVGCSSEngine.STRIKETHROUGH_THICKNESS_INDEX);
String underlinePosition = getFloatProp
(sm, eng, SVGCSSEngine.UNDERLINE_POSITION_INDEX);
String underlineThickness = getFloatProp
(sm, eng, SVGCSSEngine.UNDERLINE_THICKNESS_INDEX);
String overlinePosition = getFloatProp
(sm, eng, SVGCSSEngine.OVERLINE_POSITION_INDEX);
String overlineThickness = getFloatProp
(sm, eng, SVGCSSEngine.OVERLINE_THICKNESS_INDEX);
*/
return ret;
}
示例14: setDecorationTextPaintInfo
public void setDecorationTextPaintInfo(TextPaintInfo pi, Element element) {
Value val = CSSUtilities.getComputedStyle
(element, SVGCSSEngine.TEXT_DECORATION_INDEX);
switch (val.getCssValueType()) {
case CSSValue.CSS_VALUE_LIST:
ListValue lst = (ListValue)val;
int len = lst.getLength();
for (int i = 0; i < len; i++) {
Value v = lst.item(i);
String s = v.getStringValue();
switch (s.charAt(0)) {
case 'u':
if (pi.fillPaint != null) {
pi.underlinePaint = pi.fillPaint;
}
if (pi.strokePaint != null) {
pi.underlineStrokePaint = pi.strokePaint;
}
if (pi.strokeStroke != null) {
pi.underlineStroke = pi.strokeStroke;
}
break;
case 'o':
if (pi.fillPaint != null) {
pi.overlinePaint = pi.fillPaint;
}
if (pi.strokePaint != null) {
pi.overlineStrokePaint = pi.strokePaint;
}
if (pi.strokeStroke != null) {
pi.overlineStroke = pi.strokeStroke;
}
break;
case 'l':
if (pi.fillPaint != null) {
pi.strikethroughPaint = pi.fillPaint;
}
if (pi.strokePaint != null) {
pi.strikethroughStrokePaint = pi.strokePaint;
}
if (pi.strokeStroke != null) {
pi.strikethroughStroke = pi.strokeStroke;
}
break;
}
}
break;
default: // None
pi.underlinePaint = null;
pi.underlineStrokePaint = null;
pi.underlineStroke = null;
pi.overlinePaint = null;
pi.overlineStrokePaint = null;
pi.overlineStroke = null;
pi.strikethroughPaint = null;
pi.strikethroughStrokePaint = null;
pi.strikethroughStroke = null;
break;
}
}
示例15: getCssValueType
/**
* Implements {@link Value#getCssValueType()}.
*/
public short getCssValueType( )
{
return CSSValue.CSS_VALUE_LIST;
}