本文整理汇总了Java中org.w3c.dom.css.CSSPrimitiveValue类的典型用法代码示例。如果您正苦于以下问题:Java CSSPrimitiveValue类的具体用法?Java CSSPrimitiveValue怎么用?Java CSSPrimitiveValue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CSSPrimitiveValue类属于org.w3c.dom.css包,在下文中一共展示了CSSPrimitiveValue类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: toInches
import org.w3c.dom.css.CSSPrimitiveValue; //导入依赖的package包/类
/**
* Converts the current value into inches.
*/
protected static float toInches(Value value) {
switch (value.getPrimitiveType()) {
case CSSPrimitiveValue.CSS_CM:
return (value.getFloatValue() / 2.54f);
case CSSPrimitiveValue.CSS_MM:
return (value.getFloatValue() / 25.4f);
case CSSPrimitiveValue.CSS_IN:
return value.getFloatValue();
case CSSPrimitiveValue.CSS_PT:
return (value.getFloatValue() / 72);
case CSSPrimitiveValue.CSS_PC:
return (value.getFloatValue() / 6);
default:
throw new DOMException(DOMException.INVALID_ACCESS_ERR, "");
}
}
开发者ID:git-moss,项目名称:Push2Display,代码行数:20,代码来源:CSSOMValue.java
示例17: toMillimeters
import org.w3c.dom.css.CSSPrimitiveValue; //导入依赖的package包/类
/**
* Converts the current value into millimeters.
*/
protected static float toMillimeters(Value value) {
switch (value.getPrimitiveType()) {
case CSSPrimitiveValue.CSS_CM:
return (value.getFloatValue() * 10);
case CSSPrimitiveValue.CSS_MM:
return value.getFloatValue();
case CSSPrimitiveValue.CSS_IN:
return (value.getFloatValue() * 25.4f);
case CSSPrimitiveValue.CSS_PT:
return (value.getFloatValue() * 25.4f / 72);
case CSSPrimitiveValue.CSS_PC:
return (value.getFloatValue() * 25.4f / 6);
default:
throw new DOMException(DOMException.INVALID_ACCESS_ERR, "");
}
}
开发者ID:git-moss,项目名称:Push2Display,代码行数:20,代码来源:CSSOMValue.java
示例18: toPoints
import org.w3c.dom.css.CSSPrimitiveValue; //导入依赖的package包/类
/**
* Converts the current value into points.
*/
protected static float toPoints(Value value) {
switch (value.getPrimitiveType()) {
case CSSPrimitiveValue.CSS_CM:
return (value.getFloatValue() * 72 / 2.54f);
case CSSPrimitiveValue.CSS_MM:
return (value.getFloatValue() * 72 / 25.4f);
case CSSPrimitiveValue.CSS_IN:
return (value.getFloatValue() * 72);
case CSSPrimitiveValue.CSS_PT:
return value.getFloatValue();
case CSSPrimitiveValue.CSS_PC:
return (value.getFloatValue() * 12);
default:
throw new DOMException(DOMException.INVALID_ACCESS_ERR, "");
}
}
开发者ID:git-moss,项目名称:Push2Display,代码行数:20,代码来源:CSSOMValue.java
示例19: toPicas
import org.w3c.dom.css.CSSPrimitiveValue; //导入依赖的package包/类
/**
* Converts the current value into picas.
*/
protected static float toPicas(Value value) {
switch (value.getPrimitiveType()) {
case CSSPrimitiveValue.CSS_CM:
return (value.getFloatValue() * 6 / 2.54f);
case CSSPrimitiveValue.CSS_MM:
return (value.getFloatValue() * 6 / 25.4f);
case CSSPrimitiveValue.CSS_IN:
return (value.getFloatValue() * 6);
case CSSPrimitiveValue.CSS_PT:
return (value.getFloatValue() / 12);
case CSSPrimitiveValue.CSS_PC:
return value.getFloatValue();
default:
throw new DOMException(DOMException.INVALID_ACCESS_ERR, "");
}
}
开发者ID:git-moss,项目名称:Push2Display,代码行数:20,代码来源:CSSOMValue.java
示例20: setCssPosition
import org.w3c.dom.css.CSSPrimitiveValue; //导入依赖的package包/类
protected void setCssPosition(CSSName size, Measurement 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.yUnit == Unit.PX ? CSSPrimitiveValue.CSS_PX
: CSSPrimitiveValue.CSS_PERCENTAGE,
dim.x, String.format("%fpx", dim.x)),
dim.yUnit == Unit.AUTO ? new PropertyValue(IdentValue.AUTO)
: new PropertyValue(
dim.yUnit == Unit.PX ? CSSPrimitiveValue.CSS_PX
: CSSPrimitiveValue.CSS_PERCENTAGE,
dim.y, String.format("%fpx", dim.y)));
cssState.addAllCssDeclaration(decl);
applyCss(decl);
layoutChildren();
}
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:20,代码来源:Element.java
注:本文中的org.w3c.dom.css.CSSPrimitiveValue类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论