当前位置: 首页>>代码示例>>Java>>正文


Java CSSValue.CSS_PRIMITIVE_VALUE属性代码示例

本文整理汇总了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;
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:23,代码来源:StrokeDasharrayManager.java

示例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;
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:19,代码来源:AbstractValueManager.java

示例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 );
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:29,代码来源:CSSOMSVGColor.java

示例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);
}
 
开发者ID:eclipse,项目名称:birt,代码行数:19,代码来源:BackgroundPositionXManager.java

示例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;
    }
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:37,代码来源:RectManager.java

示例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);
    }
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:30,代码来源:LineHeightManager.java

示例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;
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:12,代码来源:CSSFontFace.java

示例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;
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:37,代码来源:CSSUtilities.java

示例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);
    }
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:16,代码来源:CSSUtilities.java

示例10: convertFloodColor

/**
 * Converts the color defined on the specified &lt;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);
    }
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:18,代码来源:CSSUtilities.java

示例11: convertStopColor

/**
 * Converts the color defined on the specified &lt;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);
    }
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:21,代码来源:CSSUtilities.java

示例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);
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:41,代码来源:CursorManager.java

示例13: convertStopColor

/**
 * Converts the color defined on the specified &lt;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);
    }
}
 
开发者ID:BowlerHatLLC,项目名称:feathers-sdk,代码行数:21,代码来源:CSSUtilities.java

示例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);
    }
}
 
开发者ID:BowlerHatLLC,项目名称:feathers-sdk,代码行数:16,代码来源:CSSUtilities.java

示例15: convertFloodColor

/**
 * Converts the color defined on the specified &lt;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);
    }
}
 
开发者ID:BowlerHatLLC,项目名称:feathers-sdk,代码行数:18,代码来源:CSSUtilities.java


注:本文中的org.w3c.dom.css.CSSValue.CSS_PRIMITIVE_VALUE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。