本文整理汇总了Java中org.w3c.css.sac.CSSException类的典型用法代码示例。如果您正苦于以下问题:Java CSSException类的具体用法?Java CSSException怎么用?Java CSSException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CSSException类属于org.w3c.css.sac包,在下文中一共展示了CSSException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: property
import org.w3c.css.sac.CSSException; //导入依赖的package包/类
/**
* <b>SAC</b>: Implements {@link
* DocumentHandler#property(String,LexicalUnit,boolean)}.
*/
public void property(String name, LexicalUnit value, boolean important)
throws CSSException {
int i = getPropertyIndex(name);
if (i == -1) {
i = getShorthandIndex(name);
if (i == -1) {
// Unknown property
return;
}
shorthandManagers[i].setValues(CSSEngine.this,
this,
value,
important);
} else {
Value v = valueManagers[i].createValue(value, CSSEngine.this);
styleDeclaration.append(v, i, important);
}
}
示例2: property
import org.w3c.css.sac.CSSException; //导入依赖的package包/类
@Override
public void property(String name, LexicalUnit value, boolean arg2) throws CSSException {
if (currentStyle != null) {
if ("color".equals(name)) {
currentStyle.setColor(createRGB(value));
} else if ("background-color".equals(name)) {
currentStyle.setBackgroundColor(createRGB(value));
} else if ("font-weight".equals(name)) {
currentStyle.setBold(value.getStringValue().toUpperCase().contains("BOLD"));
} else if ("font-style".equals(name)) {
currentStyle.setItalic(value.getStringValue().toUpperCase().contains("ITALIC"));
}
if ("text-decoration".equals(name)) {
String decoration = value.getStringValue().toUpperCase();
if (decoration.contains("UNDERLINE")) {
currentStyle.setUnderline(true);
}
if (decoration.contains("LINE-THROUGH")) {
currentStyle.setStrikeThrough(true);
}
}
}
}
示例3: endFontFace
import org.w3c.css.sac.CSSException; //导入依赖的package包/类
/**
* <b>SAC</b>: Implements {@link
* org.w3c.css.sac.DocumentHandler#endFontFace()}.
*/
public void endFontFace() throws CSSException {
StyleMap sm = new StyleMap(getNumberOfProperties());
int len = styleDeclaration.size();
for (int i=0; i<len; i++) {
int idx = styleDeclaration.getIndex(i);
sm.putValue(idx, styleDeclaration.getValue(i));
sm.putImportant(idx, styleDeclaration.getPriority(i));
// Not sure on this..
sm.putOrigin(idx, StyleMap.AUTHOR_ORIGIN);
}
styleDeclaration = null;
int pidx = getPropertyIndex(CSSConstants.CSS_FONT_FAMILY_PROPERTY);
Value fontFamily = sm.getValue(pidx);
if (fontFamily == null) return;
ParsedURL base = getCSSBaseURI();
fontFaces.add(new FontFaceRule(sm, base));
}
示例4: createAttributeCondition
import org.w3c.css.sac.CSSException; //导入依赖的package包/类
/**
* <b>SAC</b>: Implements {@link
*ConditionFactory#createAttributeCondition(String,String,boolean,String)}.
*/
public AttributeCondition createAttributeCondition(String localName,
String namespaceURI,
boolean specified,
String value)
throws CSSException {
return new CSSAttributeCondition(localName, namespaceURI, specified,
value);
}
示例5: startSelector
import org.w3c.css.sac.CSSException; //导入依赖的package包/类
/**
* <b>SAC</b>: Implements {@link
* org.w3c.css.sac.DocumentHandler#startSelector(SelectorList)}.
*/
public void startSelector(SelectorList selectors) throws CSSException {
styleRule = new StyleRule();
styleRule.setSelectorList(selectors);
styleDeclaration = new StyleDeclaration();
styleRule.setStyleDeclaration(styleDeclaration);
styleSheet.append(styleRule);
}
示例6: DefaultDirectAdjacentSelector
import org.w3c.css.sac.CSSException; //导入依赖的package包/类
/**
* <b>SAC</b>: Implements {@link
* SelectorFactory#createDirectAdjacentSelector(short,Selector,SimpleSelector)}.
*/
public SiblingSelector createDirectAdjacentSelector
(short nodeType,
Selector child,
SimpleSelector directAdjacent)
throws CSSException {
return new DefaultDirectAdjacentSelector(nodeType, child,
directAdjacent);
}
示例7:
import org.w3c.css.sac.CSSException; //导入依赖的package包/类
/**
* <b>SAC</b>: Implements {@link
* ConditionFactory#createBeginHyphenAttributeCondition(String,String,boolean,String)}.
*/
public AttributeCondition createBeginHyphenAttributeCondition
(String localName,
String namespaceURI,
boolean specified,
String value)
throws CSSException {
return new CSSBeginHyphenAttributeCondition
(localName, namespaceURI, specified, value);
}
示例8: CSSParser
import org.w3c.css.sac.CSSException; //导入依赖的package包/类
public CSSParser(InputSource source, Parser parser) throws CSSException, IOException {
this.handler = new CSSDocumentHandler();
parser.setDocumentHandler(handler);
parser.setConditionFactory(CSSConditionFactory.INSTANCE);
parser.setSelectorFactory(CSSSelectorFactory.INSTANCE);
parser.parseStyleSheet(source);
}
示例9: DefaultDescendantSelector
import org.w3c.css.sac.CSSException; //导入依赖的package包/类
/**
* <b>SAC</b>: Implements {@link
* SelectorFactory#createDescendantSelector(Selector,SimpleSelector)}.
*/
public DescendantSelector createDescendantSelector
(Selector parent,
SimpleSelector descendant)
throws CSSException {
return new DefaultDescendantSelector(parent, descendant);
}
示例10: testParser
import org.w3c.css.sac.CSSException; //导入依赖的package包/类
@Test
public void testParser() throws CSSException, URISyntaxException,
IOException {
Parser parser = new Parser();
SCSSDocumentHandler handler = new SCSSDocumentHandlerImpl();
parser.setDocumentHandler(handler);
parser.parseStyleSheet(getClass().getResource(scss).getPath());
ScssStylesheet root = handler.getStyleSheet();
Assert.assertTrue(root.getChildren().get(2).getChildren().get(0) instanceof ExtendNode);
}
示例11: DefaultConditionalSelector
import org.w3c.css.sac.CSSException; //导入依赖的package包/类
/**
* <b>SAC</b>: Implements {@link
* SelectorFactory#createConditionalSelector(SimpleSelector,Condition)}.
*/
public ConditionalSelector createConditionalSelector
(SimpleSelector selector,
Condition condition)
throws CSSException {
return new DefaultConditionalSelector(selector, condition);
}
示例12: fatalError
import org.w3c.css.sac.CSSException; //导入依赖的package包/类
@Override
public void fatalError(CSSParseException e) throws CSSException {
log("FATAL Error when parsing file \n" + e.getURI() + " on line "
+ e.getLineNumber() + ", column " + e.getColumnNumber());
log(e);
errorsDetected = true;
}
示例13: testParser
import org.w3c.css.sac.CSSException; //导入依赖的package包/类
public ScssStylesheet testParser(String file) throws CSSException,
IOException, URISyntaxException {
originalScss = getFileContent(file);
originalScss = originalScss.replaceAll(CR, "");
ScssStylesheet sheet = getStyleSheet(file);
parsedScss = sheet.printState();
parsedScss = parsedScss.replace(CR, "");
Assert.assertEquals("Original CSS and parsed CSS do not match",
originalScss, parsedScss);
return sheet;
}
示例14: parseMedia
import org.w3c.css.sac.CSSException; //导入依赖的package包/类
/**
* Implements {@link ExtendedParser#parseMedia(String)}.
*/
public SACMediaList parseMedia(String mediaText)
throws CSSException, IOException {
CSSSACMediaList result = new CSSSACMediaList();
if (!"all".equalsIgnoreCase(mediaText)) {
StringTokenizer st = new StringTokenizer(mediaText, " ,");
while (st.hasMoreTokens()) {
result.append(st.nextToken());
}
}
return result;
}
示例15: error
import org.w3c.css.sac.CSSException; //导入依赖的package包/类
@Override
public void error(CSSParseException e) throws CSSException {
log("Error when parsing file \n" + e.getURI() + " on line "
+ e.getLineNumber() + ", column " + e.getColumnNumber());
log(e);
errorsDetected = true;
}