本文整理汇总了Java中org.w3c.dom.css.CSSRule.STYLE_RULE属性的典型用法代码示例。如果您正苦于以下问题:Java CSSRule.STYLE_RULE属性的具体用法?Java CSSRule.STYLE_RULE怎么用?Java CSSRule.STYLE_RULE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.w3c.dom.css.CSSRule
的用法示例。
在下文中一共展示了CSSRule.STYLE_RULE属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseStyleSheetDefinition
public static StyleSheetDefinition parseStyleSheetDefinition(final String cssPath,
final InputStream cssStream) throws TranslatorException {
final CSSStyleSheetImpl sheet = parseStyleSheet(new InputSource(new InputStreamReader(cssStream)));
final CSSRuleList cssRules = sheet.getCssRules();
final StyleSheetDefinition result = new StyleSheetDefinition(cssPath);
for (int i = 0; i < cssRules.getLength(); i++) {
final CSSRule item = cssRules.item(i);
if (CSSRule.STYLE_RULE == item.getType()) {
final CSSStyleRuleImpl rule = (CSSStyleRuleImpl) item;
final String selectorText = rule.getSelectorText();
final CSSStyleDeclaration declaration = rule.getStyle();
final StyleDefinition styleDefinition = parseStyleDefinition(declaration);
result.addStyle(selectorText, styleDefinition);
}
}
return result;
}
示例2: parseElementStyleDefinition
private static StyleDefinition parseElementStyleDefinition(final String styleRaw) throws TranslatorException {
final CSSStyleSheetImpl sheet = parseElementStyleSheet(styleRaw);
final CSSRuleList cssRules = sheet.getCssRules();
for (int i = 0; i < cssRules.getLength(); i++) {
final CSSRule item = cssRules.item(i);
if (CSSRule.STYLE_RULE == item.getType()) {
final CSSStyleRuleImpl rule = (CSSStyleRuleImpl) item;
String selectorText = rule.getSelectorText();
final CSSStyleDeclaration declaration = rule.getStyle();
return parseStyleDefinition(declaration);
}
}
return null;
}
示例3: getType
public short getType() {
return CSSRule.STYLE_RULE;
}