本文整理汇总了Java中org.w3c.dom.css.CSSValue.CSS_PRIMITIVE_VALUE属性的典型用法代码示例。如果您正苦于以下问题:Java CSSValue.CSS_PRIMITIVE_VALUE属性的具体用法?Java CSSValue.CSS_PRIMITIVE_VALUE怎么用?Java CSSValue.CSS_PRIMITIVE_VALUE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.w3c.dom.css.CSSValue
的用法示例。
在下文中一共展示了CSSValue.CSS_PRIMITIVE_VALUE属性的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) {
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
/**
* 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: 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 );
}
示例4: computeValue
/**
* Implements {@link
* ValueManager#computeValue(CSSStylableElement,String,CSSEngine,int,StyleMap,Value)}.
*/
public Value computeValue(CSSStylableElement elt, CSSEngine engine,
int idx, Value value) {
if (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
if (value.getPrimitiveType() == CSSPrimitiveValue.CSS_IDENT) {
Value percentage = (Value) percentValues.get(value
.getStringValue());
if (percentage != null) {
return percentage;
}
throw createInvalidIdentifierDOMException(value
.getStringValue());
}
}
return super.computeValue(elt, engine, idx, value);
}
示例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.getCssValueType() != CSSValue.CSS_PRIMITIVE_VALUE) {
return value;
}
if (value.getPrimitiveType() != CSSPrimitiveValue.CSS_RECT) {
return value;
}
RectValue rect = (RectValue)value;
orientation = VERTICAL_ORIENTATION;
Value top = super.computeValue(elt, pseudo, engine, idx, sm,
rect.getTop());
Value bottom = super.computeValue(elt, pseudo, engine, idx, sm,
rect.getBottom());
orientation = HORIZONTAL_ORIENTATION;
Value left = super.computeValue(elt, pseudo, engine, idx, sm,
rect.getLeft());
Value right = super.computeValue(elt, pseudo, engine, idx, sm,
rect.getRight());
if (top != rect.getTop() ||
right != rect.getRight() ||
bottom != rect.getBottom() ||
left != rect.getLeft()) {
return new RectValue(top, right, bottom, left);
} else {
return 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.getCssValueType() != CSSValue.CSS_PRIMITIVE_VALUE)
return value;
switch (value.getPrimitiveType()) {
case CSSPrimitiveValue.CSS_NUMBER:
return new LineHeightValue(CSSPrimitiveValue.CSS_NUMBER,
value.getFloatValue(), true);
case CSSPrimitiveValue.CSS_PERCENTAGE: {
float v = value.getFloatValue();
int fsidx = engine.getFontSizeIndex();
float fs = engine.getComputedStyle
(elt, pseudo, fsidx).getFloatValue();
return new FloatValue(CSSPrimitiveValue.CSS_NUMBER, v * fs * 0.01f);
}
default:
return super.computeValue(elt, pseudo, engine, idx, sm, value);
}
}
示例7: getSrcValue
public static Object getSrcValue(Value v, ParsedURL base) {
if (v.getCssValueType() != CSSValue.CSS_PRIMITIVE_VALUE)
return null;
if (v.getPrimitiveType() == CSSPrimitiveValue.CSS_URI) {
if (base != null)
return new ParsedURL(base, v.getStringValue());
return new ParsedURL(v.getStringValue());
}
if (v.getPrimitiveType() == CSSPrimitiveValue.CSS_STRING)
return v.getStringValue();
return null;
}
示例8: 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;
}
示例9: convertLightingColor
/**
* Converts the color defined on the specified lighting filter element
* to a <code>Color</code>.
*
* @param e the lighting filter element
* @param ctx the bridge context
*/
public static Color convertLightingColor(Element e, BridgeContext ctx) {
Value v = getComputedStyle(e, SVGCSSEngine.LIGHTING_COLOR_INDEX);
if (v.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
return PaintServer.convertColor(v, 1);
} else {
return PaintServer.convertRGBICCColor
(e, v.item(0), v.item(1), 1, ctx);
}
}
示例10: convertFloodColor
/**
* Converts the color defined on the specified <feFlood>
* element to a <code>Color</code>.
*
* @param e the feFlood element
* @param ctx the bridge context
*/
public static Color convertFloodColor(Element e, BridgeContext ctx) {
Value v = getComputedStyle(e, SVGCSSEngine.FLOOD_COLOR_INDEX);
Value o = getComputedStyle(e, SVGCSSEngine.FLOOD_OPACITY_INDEX);
float f = PaintServer.convertOpacity(o);
if (v.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
return PaintServer.convertColor(v, f);
} else {
return PaintServer.convertRGBICCColor
(e, v.item(0), v.item(1), f, ctx);
}
}
示例11: convertStopColor
/**
* Converts the color defined on the specified <stop> element
* to a <code>Color</code>.
*
* @param e the stop element
* @param opacity the paint opacity
* @param ctx the bridge context to use
*/
public static Color convertStopColor(Element e,
float opacity,
BridgeContext ctx) {
Value v = getComputedStyle(e, SVGCSSEngine.STOP_COLOR_INDEX);
Value o = getComputedStyle(e, SVGCSSEngine.STOP_OPACITY_INDEX);
opacity *= PaintServer.convertOpacity(o);
if (v.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
return PaintServer.convertColor(v, opacity);
} else {
return PaintServer.convertRGBICCColor
(e, v.item(0), v.item(1), opacity, ctx);
}
}
示例12: 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);
}
示例13: convertStopColor
/**
* Converts the color defined on the specified <stop> element
* to a <tt>Color</tt>.
*
* @param e the stop element
* @param opacity the paint opacity
* @param ctx the bridge context to use
*/
public static Color convertStopColor(Element e,
float opacity,
BridgeContext ctx) {
Value v = getComputedStyle(e, SVGCSSEngine.STOP_COLOR_INDEX);
Value o = getComputedStyle(e, SVGCSSEngine.STOP_OPACITY_INDEX);
opacity *= PaintServer.convertOpacity(o);
if (v.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
return PaintServer.convertColor(v, opacity);
} else {
return PaintServer.convertRGBICCColor
(e, v.item(0), (ICCColor)v.item(1), opacity, ctx);
}
}
示例14: convertLightingColor
/**
* Converts the color defined on the specified lighting filter element
* to a <tt>Color</tt>.
*
* @param e the lighting filter element
* @param ctx the bridge context
*/
public static Color convertLightingColor(Element e, BridgeContext ctx) {
Value v = getComputedStyle(e, SVGCSSEngine.LIGHTING_COLOR_INDEX);
if (v.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
return PaintServer.convertColor(v, 1);
} else {
return PaintServer.convertRGBICCColor
(e, v.item(0), (ICCColor)v.item(1), 1, ctx);
}
}
示例15: convertFloodColor
/**
* Converts the color defined on the specified <feFlood>
* element to a <tt>Color</tt>.
*
* @param e the feFlood element
* @param ctx the bridge context
*/
public static Color convertFloodColor(Element e, BridgeContext ctx) {
Value v = getComputedStyle(e, SVGCSSEngine.FLOOD_COLOR_INDEX);
Value o = getComputedStyle(e, SVGCSSEngine.FLOOD_OPACITY_INDEX);
float f = PaintServer.convertOpacity(o);
if (v.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
return PaintServer.convertColor(v, f);
} else {
return PaintServer.convertRGBICCColor
(e, v.item(0), (ICCColor)v.item(1), f, ctx);
}
}