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


Java CSSPrimitiveValue类代码示例

本文整理汇总了Java中org.w3c.dom.css.CSSPrimitiveValue的典型用法代码示例。如果您正苦于以下问题:Java CSSPrimitiveValue类的具体用法?Java CSSPrimitiveValue怎么用?Java CSSPrimitiveValue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CSSPrimitiveValue类属于org.w3c.dom.css包,在下文中一共展示了CSSPrimitiveValue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setTextPadding

import org.w3c.dom.css.CSSPrimitiveValue; //导入依赖的package包/类
@Override
public BaseElement setTextPadding(float left, float right, float top, float bottom) {
	PropertyDeclaration declLeft = new PropertyDeclaration(CSSName.PADDING_LEFT,
			new PropertyValue(CSSPrimitiveValue.CSS_PX, left, String.format("%fpx", left)), false,
			StylesheetInfo.USER);
	PropertyDeclaration declRight = new PropertyDeclaration(CSSName.PADDING_RIGHT,
			new PropertyValue(CSSPrimitiveValue.CSS_PX, right, String.format("%fpx", right)), false,
			StylesheetInfo.USER);
	PropertyDeclaration declBottom = new PropertyDeclaration(CSSName.PADDING_BOTTOM,
			new PropertyValue(CSSPrimitiveValue.CSS_PX, bottom, String.format("%fpx", bottom)), false,
			StylesheetInfo.USER);
	PropertyDeclaration declTop = new PropertyDeclaration(CSSName.PADDING_TOP,
			new PropertyValue(CSSPrimitiveValue.CSS_PX, top, String.format("%fpx", top)), false,
			StylesheetInfo.USER);
	cssState.addAllCssDeclaration(declLeft);
	applyCssPadding(declLeft);
	cssState.addAllCssDeclaration(declRight);
	applyCssPadding(declRight);
	cssState.addAllCssDeclaration(declTop);
	applyCssPadding(declTop);
	cssState.addAllCssDeclaration(declBottom);
	applyCssPadding(declBottom);
	layoutChildren();
	return this;
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:26,代码来源:Element.java

示例2: setCssSize

import org.w3c.dom.css.CSSPrimitiveValue; //导入依赖的package包/类
protected void setCssSize(CSSName size, Size dim) {
	PropertyDeclaration decl = dim == null
			? CssExtensions.createValues(size, StylesheetInfo.USER, false, new PropertyValue(IdentValue.AUTO),
					new PropertyValue(IdentValue.AUTO))
			: CssExtensions.createValues(size, StylesheetInfo.USER, false,
					dim.xUnit == Unit.AUTO ? new PropertyValue(IdentValue.AUTO)
							: new PropertyValue(
									dim.xUnit == Unit.PX ? CSSPrimitiveValue.CSS_PX
											: CSSPrimitiveValue.CSS_PERCENTAGE,
									dim.x, String.format("%f%s", dim.x, dim.xUnit == Unit.PX ? "px" : "%")),
					dim.yUnit == Unit.AUTO ? new PropertyValue(IdentValue.AUTO)
							: new PropertyValue(
									dim.yUnit == Unit.PX ? CSSPrimitiveValue.CSS_PX
											: CSSPrimitiveValue.CSS_PERCENTAGE,
									dim.y, String.format("%f%s", dim.y, dim.yUnit == Unit.PX ? "px" : "%")));
	cssState.addAllCssDeclaration(decl);
	applyCss(decl);
	layoutChildren();
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:20,代码来源:Element.java

示例3: setHandlePosition

import org.w3c.dom.css.CSSPrimitiveValue; //导入依赖的package包/类
@Override
public BaseElement setHandlePosition(Vector4f borderHandles) {
	PropertyDeclaration declLeft = new PropertyDeclaration(CssExtensions.HANDLE_POSITION_LEFT,
			new PropertyValue(CSSPrimitiveValue.CSS_PX, borderHandles.w, String.format("%fpx", borderHandles.w)),
			false, StylesheetInfo.USER);
	PropertyDeclaration declRight = new PropertyDeclaration(CssExtensions.HANDLE_POSITION_RIGHT,
			new PropertyValue(CSSPrimitiveValue.CSS_PX, borderHandles.y, String.format("%fpx", borderHandles.y)),
			false, StylesheetInfo.USER);
	PropertyDeclaration declBottom = new PropertyDeclaration(CssExtensions.HANDLE_POSITION_BOTTOM,
			new PropertyValue(CSSPrimitiveValue.CSS_PX, borderHandles.z, String.format("%fpx", borderHandles.z)),
			false, StylesheetInfo.USER);
	PropertyDeclaration declTop = new PropertyDeclaration(CssExtensions.HANDLE_POSITION_TOP,
			new PropertyValue(CSSPrimitiveValue.CSS_PX, borderHandles.x, String.format("%fpx", borderHandles.x)),
			false, StylesheetInfo.USER);
	cssState.addAllCssDeclaration(declLeft);
	applyCss(declLeft);
	cssState.addAllCssDeclaration(declRight);
	applyCss(declRight);
	cssState.addAllCssDeclaration(declTop);
	applyCss(declTop);
	cssState.addAllCssDeclaration(declBottom);
	applyCss(declBottom);
	layoutChildren();
	return this;
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:26,代码来源:Element.java

示例4: createStringValue

import org.w3c.dom.css.CSSPrimitiveValue; //导入依赖的package包/类
/**
 * Implements {@link
 * ValueManager#createStringValue(short,String,CSSEngine)}.
 */
public Value createStringValue(short type, String value, CSSEngine engine)
    throws DOMException {
    switch (type) {
    case CSSPrimitiveValue.CSS_IDENT:
        if (value.equalsIgnoreCase(CSSConstants.CSS_NONE_VALUE)) {
            return ValueConstants.NONE_VALUE;
        }
        break;

    case CSSPrimitiveValue.CSS_URI:
        return new URIValue(value, 
                            resolveURI(engine.getCSSBaseURI(), value));
    }
    throw createInvalidStringTypeDOMException(type);
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:20,代码来源:ClipPathManager.java

示例5: createStringValue

import org.w3c.dom.css.CSSPrimitiveValue; //导入依赖的package包/类
/**
 * Implements {@link
 * ValueManager#createStringValue(short,String,CSSEngine)}.
 */
public Value createStringValue(short type, String value, CSSEngine engine)
    throws DOMException {
    switch (type) {
    case CSSPrimitiveValue.CSS_IDENT:
        if (value.equalsIgnoreCase(CSSConstants.CSS_NONE_VALUE)) {
            return ValueConstants.NONE_VALUE;
        }
        break;

    case CSSPrimitiveValue.CSS_URI:
        return new URIValue(value,
                            resolveURI(engine.getCSSBaseURI(), value));
    }
    throw createInvalidStringTypeDOMException(type);
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:20,代码来源:MaskManager.java

示例6: createValue

import org.w3c.dom.css.CSSPrimitiveValue; //导入依赖的package包/类
/**
 * Implements {@link ValueManager#createValue(LexicalUnit,CSSEngine)}.
 */
public Value createValue(LexicalUnit lu, CSSEngine engine)
    throws DOMException {
    switch (lu.getLexicalUnitType()) {
    case LexicalUnit.SAC_INHERIT:
        return SVGValueConstants.INHERIT_VALUE;

    case  LexicalUnit.SAC_INTEGER:
        return new FloatValue(CSSPrimitiveValue.CSS_NUMBER,
                              lu.getIntegerValue());

    case  LexicalUnit.SAC_REAL:
        return new FloatValue(CSSPrimitiveValue.CSS_NUMBER,
                              lu.getFloatValue());

    default:
        throw createInvalidLexicalUnitDOMException
            (lu.getLexicalUnitType());
    }
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:23,代码来源:StrokeMiterlimitManager.java

示例7: applyCssBgMap

import org.w3c.dom.css.CSSPrimitiveValue; //导入依赖的package包/类
protected void applyCssBgMap(PropertyDeclaration decl) {
	CSSPrimitiveValue v = decl.getValue();
	CSSName cssName = decl.getCSSName();
	if (cssName == CssExtensions.BGMAP_COLOR) {
		super.setBgMapColor(CssUtil.toColor(v.getCssText()));
	} else if (cssName == CssExtensions.BGMAP_IMAGE) {
		if (decl.getValue().getPrimitiveType() == CSSPrimitiveValue.CSS_IDENT) {
			IdentValue ident = decl.asIdentValue();
			if (ident == IdentValue.NONE || ident == IdentValue.AUTO) {
				super.setBgMap(null);
			} else
				throw new UnsupportedOperationException(String.format("Invalid animation image type %s.", ident));
		} else if (decl.getValue().getPrimitiveType() == CSSPrimitiveValue.CSS_URI) {
			super.setBgMap(v.getStringValue());
		} else
			throw new UnsupportedOperationException(
					String.format("Invalid animation image type %d", decl.getValue().getPrimitiveType()));
	}
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:20,代码来源:Element.java

示例8: createStringValue

import org.w3c.dom.css.CSSPrimitiveValue; //导入依赖的package包/类
/**
 * Implements {@link
 * ValueManager#createStringValue(short,String,CSSEngine)}.
 */
public Value createStringValue(short type, String value, CSSEngine engine)
    throws DOMException {
    switch (type) {
    case CSSPrimitiveValue.CSS_IDENT:
        String s = value.toLowerCase();
        if (s.equals(CSSConstants.CSS_AUTO_VALUE)) {
            return SVGValueConstants.AUTO_VALUE;
        }
        if (s.equals(CSSConstants.CSS_SRGB_VALUE)) {
            return SVGValueConstants.SRGB_VALUE;
        }
        return new StringValue(CSSPrimitiveValue.CSS_IDENT, s);

    case CSSPrimitiveValue.CSS_URI:
        return new URIValue(value,
                            resolveURI(engine.getCSSBaseURI(), value));
    }
    throw createInvalidStringTypeDOMException(type);
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:24,代码来源:ColorProfileManager.java

示例9: createValue

import org.w3c.dom.css.CSSPrimitiveValue; //导入依赖的package包/类
/**
 * Implements {@link ValueManager#createValue(LexicalUnit,CSSEngine)}.
 */
public Value createValue(LexicalUnit lu, CSSEngine engine)
    throws DOMException {
    switch (lu.getLexicalUnitType()) {
    case LexicalUnit.SAC_INHERIT:
        return SVGValueConstants.INHERIT_VALUE;

    case LexicalUnit.SAC_INTEGER:
        return new FloatValue(CSSPrimitiveValue.CSS_NUMBER,
                              lu.getIntegerValue());

    case LexicalUnit.SAC_REAL:
        return new FloatValue(CSSPrimitiveValue.CSS_NUMBER,
                              lu.getFloatValue());
    }
    throw createInvalidLexicalUnitDOMException(lu.getLexicalUnitType());
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:20,代码来源:OpacityManager.java

示例10: setAtlas

import org.w3c.dom.css.CSSPrimitiveValue; //导入依赖的package包/类
@Override
public BaseElement setAtlas(Vector4f atlas) {
	PropertyDeclaration declX = new PropertyDeclaration(CssExtensions.ATLAS_X,
			new PropertyValue(CSSPrimitiveValue.CSS_PX, atlas.x, String.format("%fpx", atlas.x)), false,
			StylesheetInfo.USER);
	PropertyDeclaration declY = new PropertyDeclaration(CssExtensions.ATLAS_Y,
			new PropertyValue(CSSPrimitiveValue.CSS_PX, atlas.y, String.format("%fpx", atlas.y)), false,
			StylesheetInfo.USER);
	PropertyDeclaration declW = new PropertyDeclaration(CssExtensions.ATLAS_WIDTH,
			new PropertyValue(CSSPrimitiveValue.CSS_PX, atlas.z, String.format("%fpx", atlas.z)), false,
			StylesheetInfo.USER);
	PropertyDeclaration declH = new PropertyDeclaration(CssExtensions.ATLAS_HEIGHT,
			new PropertyValue(CSSPrimitiveValue.CSS_PX, atlas.w, String.format("%fpx", atlas.w)), false,
			StylesheetInfo.USER);
	cssState.addAllCssDeclaration(declX);
	applyCss(declX);
	cssState.addAllCssDeclaration(declY);
	applyCss(declY);
	cssState.addAllCssDeclaration(declH);
	applyCss(declH);
	cssState.addAllCssDeclaration(declW);
	applyCss(declW);
	layoutChildren();
	return this;
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:26,代码来源:Element.java

示例11: setMargin

import org.w3c.dom.css.CSSPrimitiveValue; //导入依赖的package包/类
@Override
public BaseElement setMargin(float left, float right, float top, float bottom) {
	PropertyDeclaration declLeft = new PropertyDeclaration(CSSName.MARGIN_LEFT,
			new PropertyValue(CSSPrimitiveValue.CSS_PX, left, String.format("%fpx", left)), false,
			StylesheetInfo.USER);
	PropertyDeclaration declRight = new PropertyDeclaration(CSSName.MARGIN_RIGHT,
			new PropertyValue(CSSPrimitiveValue.CSS_PX, right, String.format("%fpx", right)), false,
			StylesheetInfo.USER);
	PropertyDeclaration declBottom = new PropertyDeclaration(CSSName.MARGIN_BOTTOM,
			new PropertyValue(CSSPrimitiveValue.CSS_PX, bottom, String.format("%fpx", bottom)), false,
			StylesheetInfo.USER);
	PropertyDeclaration declTop = new PropertyDeclaration(CSSName.MARGIN_TOP,
			new PropertyValue(CSSPrimitiveValue.CSS_PX, top, String.format("%fpx", top)), false,
			StylesheetInfo.USER);
	cssState.addAllCssDeclaration(declLeft);
	applyCssMargin(declLeft);
	cssState.addAllCssDeclaration(declRight);
	applyCssMargin(declRight);
	cssState.addAllCssDeclaration(declTop);
	applyCssMargin(declTop);
	cssState.addAllCssDeclaration(declBottom);
	applyCssMargin(declBottom);
	layoutChildren();
	return this;
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:26,代码来源:Element.java

示例12: createColorComponent

import org.w3c.dom.css.CSSPrimitiveValue; //导入依赖的package包/类
/**
 * Creates a color component from a lexical unit.
 */
protected Value createColorComponent(LexicalUnit lu) throws DOMException {
    switch (lu.getLexicalUnitType()) {
    case LexicalUnit.SAC_INTEGER:
        return new FloatValue(CSSPrimitiveValue.CSS_NUMBER,
                              lu.getIntegerValue());

    case LexicalUnit.SAC_REAL:
        return new FloatValue(CSSPrimitiveValue.CSS_NUMBER,
                              lu.getFloatValue());

    case LexicalUnit.SAC_PERCENTAGE:
        return new FloatValue(CSSPrimitiveValue.CSS_PERCENTAGE,
                              lu.getFloatValue());
    }
    throw createInvalidRGBComponentUnitDOMException
        (lu.getLexicalUnitType());
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:21,代码来源:AbstractColorManager.java

示例13: computeValue

import org.w3c.dom.css.CSSPrimitiveValue; //导入依赖的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;
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:20,代码来源:AbstractValueManager.java

示例14: computeValue

import org.w3c.dom.css.CSSPrimitiveValue; //导入依赖的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);
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:29,代码来源:CursorManager.java

示例15: createValue

import org.w3c.dom.css.CSSPrimitiveValue; //导入依赖的package包/类
/**
 * Implements {@link ValueManager#createValue(LexicalUnit,CSSEngine)}.
 */
public Value createValue(LexicalUnit lu, CSSEngine engine)
    throws DOMException {
    switch (lu.getLexicalUnitType()) {
    case LexicalUnit.SAC_INHERIT:
        return ValueConstants.INHERIT_VALUE;

    case LexicalUnit.SAC_INTEGER:
        return new FloatValue(CSSPrimitiveValue.CSS_NUMBER,
                              lu.getIntegerValue());

    case LexicalUnit.SAC_REAL:
        return new FloatValue(CSSPrimitiveValue.CSS_NUMBER,
                              lu.getFloatValue());

    case LexicalUnit.SAC_IDENT:
        if (lu.getStringValue().equalsIgnoreCase
            (CSSConstants.CSS_NONE_VALUE)) {
            return ValueConstants.NONE_VALUE;
        }
        throw createInvalidIdentifierDOMException(lu.getStringValue());
    }
    throw createInvalidLexicalUnitDOMException(lu.getLexicalUnitType());
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:27,代码来源:FontSizeAdjustManager.java


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