本文整理汇总了Java中org.w3c.dom.css.CSSStyleSheet类的典型用法代码示例。如果您正苦于以下问题:Java CSSStyleSheet类的具体用法?Java CSSStyleSheet怎么用?Java CSSStyleSheet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CSSStyleSheet类属于org.w3c.dom.css包,在下文中一共展示了CSSStyleSheet类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: equals
import org.w3c.dom.css.CSSStyleSheet; //导入依赖的package包/类
@Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof CSSStyleSheet)) {
return false;
}
final CSSStyleSheet css = (CSSStyleSheet) obj;
boolean eq = LangUtils.equals(getCssRules(), css.getCssRules());
eq = eq && (getDisabled() == css.getDisabled());
eq = eq && LangUtils.equals(getHref(), css.getHref());
eq = eq && LangUtils.equals(getMedia(), css.getMedia());
// TODO implement some reasonful equals method for ownerNode
// eq = eq && Utils.equals(getOwnerNode(), css.getOwnerNode());
// don't use ownerNode and parentStyleSheet in equals()
// recursive loop -> stack overflow!
eq = eq && LangUtils.equals(getTitle(), css.getTitle());
return eq;
}
开发者ID:oswetto,项目名称:LoboEvolution,代码行数:21,代码来源:CSSStyleSheetImpl.java
示例2: isAffectedByPseudoNameInAncestor
import org.w3c.dom.css.CSSStyleSheet; //导入依赖的package包/类
/**
* is affected by pseudo name in ancestor
*
* @param elementRules
* @param ancestor
* @param element
* @param pseudoName
* @return
*/
private boolean isAffectedByPseudoNameInAncestor(Collection<StyleRuleInfo> elementRules, HTMLElementImpl ancestor,
HTMLElementImpl element, String pseudoName) {
if (elementRules != null) {
Iterator<StyleRuleInfo> i = elementRules.iterator();
while (i.hasNext()) {
StyleRuleInfo styleRuleInfo = i.next();
CSSStyleSheet styleSheet = styleRuleInfo.getStyleRule().getParentStyleSheet();
if (styleSheet != null && styleSheet.getDisabled()) {
continue;
}
if (styleRuleInfo.affectedByPseudoNameInAncestor(element, ancestor, pseudoName)) {
return true;
}
}
}
return false;
}
开发者ID:oswetto,项目名称:LoboEvolution,代码行数:27,代码来源:StyleSheetAggregator.java
示例3: putStyleDeclarations
import org.w3c.dom.css.CSSStyleSheet; //导入依赖的package包/类
/**
* put style declarations
*
* @param elementRules
* @param styleDeclarations
* @param element
* @param pseudoNames
* @return
*/
private Collection<CSSStyleDeclaration> putStyleDeclarations(Collection<StyleRuleInfo> elementRules,
Collection<CSSStyleDeclaration> styleDeclarations, HTMLElementImpl element, Set pseudoNames) {
Iterator<StyleRuleInfo> i = elementRules.iterator();
while (i.hasNext()) {
StyleRuleInfo styleRuleInfo = i.next();
if (styleRuleInfo.isSelectorMatch(element, pseudoNames)) {
CSSStyleRule styleRule = styleRuleInfo.getStyleRule();
CSSStyleSheet styleSheet = styleRule.getParentStyleSheet();
if (styleSheet != null && styleSheet.getDisabled()) {
continue;
}
if (styleDeclarations == null) {
styleDeclarations = new LinkedList<CSSStyleDeclaration>();
}
styleDeclarations.add(styleRule.getStyle());
}
}
return styleDeclarations;
}
开发者ID:oswetto,项目名称:LoboEvolution,代码行数:29,代码来源:StyleSheetAggregator.java
示例4: addStyleSheet
import org.w3c.dom.css.CSSStyleSheet; //导入依赖的package包/类
/**
* Adds the style sheet.
*
* @param ss
* the ss
*/
public final void addStyleSheet(CSSStyleSheet ss) {
synchronized (this.getTreeLock()) {
this.styleSheets.add(ss);
this.styleSheetAggregator = null;
this.forgetRenderState();
ArrayList<?> nl = this.nodeList;
if (nl != null) {
Iterator<?> i = nl.iterator();
while (i.hasNext()) {
Object node = i.next();
if (node instanceof HTMLElementImpl) {
((HTMLElementImpl) node).forgetStyle(true);
}
}
}
}
this.allInvalidated();
}
开发者ID:oswetto,项目名称:LoboEvolution,代码行数:25,代码来源:HTMLDocumentImpl.java
示例5: showStyleSheet
import org.w3c.dom.css.CSSStyleSheet; //导入依赖的package包/类
/**
* Show style sheet.
*
* @param styleSheet
* the style sheet
*/
private void showStyleSheet(CSSStyleSheet styleSheet) {
StringWriter stringWriter = new StringWriter();
PrintWriter writer = new PrintWriter(stringWriter);
writer.println("<DL>");
CSSRuleList ruleList = styleSheet.getCssRules();
int length = ruleList.getLength();
for (int i = 0; i < length; i++) {
CSSRule rule = ruleList.item(i);
writer.println("<DT><strong>Rule: type=" + rule.getType() + ",class=" + rule.getClass().getName()
+ "</strong></DT>");
writer.println("<DD>");
this.writeRuleInfo(writer, rule);
writer.println("</DD>");
}
writer.println("</DL>");
writer.flush();
String html = stringWriter.toString();
HtmlRendererContext rcontext = new SimpleHtmlRendererContext(this.cssOutput, (UserAgentContext) null);
this.cssOutput.setHtml(html, "about:css", rcontext);
}
开发者ID:oswetto,项目名称:LoboEvolution,代码行数:27,代码来源:CssParserTest.java
示例6: parseStyleSheet
import org.w3c.dom.css.CSSStyleSheet; //导入依赖的package包/类
/**
* Parses a CSS resource and get the CSSStyleSheet as the output.
*
* @param source
* the source of the CSS resource
* @return the CSSStyleSheet if succeed
* @throws IOException
* if the resource is not well-located
*/
public CSSStyleSheet parseStyleSheet( InputSource source )
throws IOException
{
CssHandler handler = new CssHandler( );
parser.setDocumentHandler( handler );
parser.setErrorHandler( errorHandler );
try
{
parser.parseStyleSheet( source );
}
catch ( StringIndexOutOfBoundsException e )
{
throw new CSSException( CSSException.SAC_SYNTAX_ERR );
}
return (StyleSheet) handler.getRoot( );
}
开发者ID:eclipse,项目名称:birt,代码行数:27,代码来源:CssParser.java
示例7: merge
import org.w3c.dom.css.CSSStyleSheet; //导入依赖的package包/类
/**
* Merges all StyleSheets in this list into one.
*
* @return the new (merged) StyleSheet
*/
public StyleSheet merge() {
final CSSStyleSheetImpl merged = new CSSStyleSheetImpl();
final CSSRuleListImpl cssRuleList = new CSSRuleListImpl();
final Iterator<CSSStyleSheet> it = getCSSStyleSheets().iterator();
while (it.hasNext()) {
final CSSStyleSheetImpl cssStyleSheet = (CSSStyleSheetImpl) it.next();
final CSSMediaRuleImpl cssMediaRule = new CSSMediaRuleImpl(merged, null, cssStyleSheet.getMedia());
cssMediaRule.setRuleList((CSSRuleListImpl) cssStyleSheet.getCssRules());
cssRuleList.add(cssMediaRule);
}
merged.setCssRules(cssRuleList);
merged.setMediaText("all");
return merged;
}
开发者ID:oswetto,项目名称:LoboEvolution,代码行数:20,代码来源:CSSStyleSheetListImpl.java
示例8: addStyleSheet
import org.w3c.dom.css.CSSStyleSheet; //导入依赖的package包/类
/**
* Adds the style sheet.
*
* @param styleSheet
* the style sheet
* @throws MalformedURLException
* the malformed url exception
* @throws UnsupportedEncodingException
*/
private final void addStyleSheet(CSSStyleSheet styleSheet)
throws MalformedURLException, UnsupportedEncodingException {
CSSRuleList ruleList = styleSheet.getCssRules();
int length = ruleList.getLength();
for (int i = 0; i < length; i++) {
CSSRule rule = ruleList.item(i);
this.addRule(styleSheet, rule);
}
}
开发者ID:oswetto,项目名称:LoboEvolution,代码行数:19,代码来源:StyleSheetAggregator.java
示例9: setDisabled
import org.w3c.dom.css.CSSStyleSheet; //导入依赖的package包/类
@Override
public void setDisabled(boolean disabled) {
this.disabled = disabled;
CSSStyleSheet sheet = this.styleSheet;
if (sheet != null) {
sheet.setDisabled(disabled);
}
}
开发者ID:oswetto,项目名称:LoboEvolution,代码行数:9,代码来源:HTMLLinkElementImpl.java
示例10: processStyle
import org.w3c.dom.css.CSSStyleSheet; //导入依赖的package包/类
/**
* Process style.
*/
protected void processStyle() {
this.styleSheet = null;
UserAgentContext uacontext = this.getUserAgentContext();
if (uacontext.isInternalCSSEnabled() && CSSUtilities.matchesMedia(this.getMedia(), this.getUserAgentContext())) {
String text = this.getRawInnerText(true);
if (text != null && !"".equals(text)) {
HTMLDocumentImpl doc = (HTMLDocumentImpl) this.getOwnerDocument();
try {
CSSOMParser parser = new CSSOMParser(new SACParserCSS3());
InputSource is = CSSUtilities.getCssInputSourceForStyleSheet(text, doc.getBaseURI());
CSSStyleSheet sheet = parser.parseStyleSheet(is, null, null);
if (sheet != null) {
doc.addStyleSheet(sheet);
this.styleSheet = sheet;
if (sheet instanceof CSSStyleSheetImpl) {
CSSStyleSheetImpl sheetImpl = (CSSStyleSheetImpl) sheet;
sheetImpl.setDisabled(disabled);
} else {
sheet.setDisabled(this.disabled);
}
}
} catch (Throwable err) {
logger.error("Unable to parse style sheet", err);
}
}
}
}
开发者ID:oswetto,项目名称:LoboEvolution,代码行数:31,代码来源:HTMLStyleElementImpl.java
示例11: JStyleSheetWrapper
import org.w3c.dom.css.CSSStyleSheet; //导入依赖的package包/类
JStyleSheetWrapper(final cz.vutbr.web.css.StyleSheet jStyleSheet, final String mediaStr, final String href, final Node ownerNode,
final CSSStyleSheet parentStyleSheet, final String type, final String title, final StyleSheetBridge bridge) {
this.jStyleSheet = jStyleSheet;
this.mediaStr = mediaStr;
this.href = href;
this.bridge = bridge;
this.ownerNode = ownerNode;
this.type = type;
this.title = title;
this.parentStyleSheet = parentStyleSheet;
}
开发者ID:UprootLabs,项目名称:jStyleDomBridge,代码行数:12,代码来源:JStyleSheetWrapper.java
示例12: extractCssStyleRules
import org.w3c.dom.css.CSSStyleSheet; //导入依赖的package包/类
public HashMap<String, CSSStyleRule> extractCssStyleRules(String cssFile) throws IOException {
TEST_FILE_SYSTEM.filesExists(cssFile);
CSSOMParser cssParser = new CSSOMParser();
CSSStyleSheet css = cssParser.parseStyleSheet(new InputSource(new FileReader(TEST_FILE_SYSTEM.file(cssFile))), null, null);
CSSRuleList cssRules = css.getCssRules();
HashMap<String, CSSStyleRule> rules = new HashMap<String, CSSStyleRule>();
for (int i = 0; i < cssRules.getLength(); i++) {
CSSRule rule = cssRules.item(i);
if (rule instanceof CSSStyleRule) {
rules.put(((CSSStyleRule) rule).getSelectorText(), (CSSStyleRule) rule);
}
}
return rules;
}
开发者ID:slezier,项目名称:SimpleFunctionalTest,代码行数:15,代码来源:CssParser.java
示例13: getRuleList
import org.w3c.dom.css.CSSStyleSheet; //导入依赖的package包/类
AttributeRuleList getRuleList(InputStream stream) throws IOException {
InputSource source = new InputSource(new InputStreamReader(stream));
CSSOMParser parser = new CSSOMParser(new SACParserCSS3());
parser.setErrorHandler(ThrowCssExceptionErrorHandler.INSTANCE);
CSSStyleSheet stylesheet = parser.parseStyleSheet(source, null, null);
CSSRuleList ruleList = stylesheet.getCssRules();
return new AttributeRuleList(ruleList);
}
开发者ID:connect-group,项目名称:thymesheet,代码行数:10,代码来源:ThymesheetPreprocessor.java
示例14: createCSSStyleSheet
import org.w3c.dom.css.CSSStyleSheet; //导入依赖的package包/类
/**
* <b>DOM</b>: Implements {@link
* org.w3c.dom.css.DOMImplementationCSS#createCSSStyleSheet(String,String)}.
*/
public CSSStyleSheet createCSSStyleSheet(String title, String media) {
throw new UnsupportedOperationException
("DOMImplementationCSS.createCSSStyleSheet is not implemented"); // XXX
}
开发者ID:git-moss,项目名称:Push2Display,代码行数:9,代码来源:SVGDOMImplementation.java
示例15: getUserAgentStyleSheet
import org.w3c.dom.css.CSSStyleSheet; //导入依赖的package包/类
/**
* Returns the user-agent stylesheet.
*/
public CSSStyleSheet getUserAgentStyleSheet() {
throw new UnsupportedOperationException
("StyleSheetFactory.getUserAgentStyleSheet is not implemented"); // XXX
}
开发者ID:git-moss,项目名称:Push2Display,代码行数:8,代码来源:SVGDOMImplementation.java
示例16: CSSStyleSheetAssert
import org.w3c.dom.css.CSSStyleSheet; //导入依赖的package包/类
protected CSSStyleSheetAssert(CSSStyleSheet actual) {
super(actual, CSSStyleSheetAssert.class);
}
开发者ID:NineWorlds,项目名称:xstreamer,代码行数:4,代码来源:CSSStyleSheetAssert.java
示例17: assertThat
import org.w3c.dom.css.CSSStyleSheet; //导入依赖的package包/类
public static CSSStyleSheetAssert assertThat(CSSStyleSheet actual) {
return new CSSStyleSheetAssert(actual);
}
开发者ID:NineWorlds,项目名称:xstreamer,代码行数:4,代码来源:CSSStyleSheetAssert.java
示例18: getParentStyleSheet
import org.w3c.dom.css.CSSStyleSheet; //导入依赖的package包/类
public CSSStyleSheet getParentStyleSheet() {
return parentStyleSheet_;
}
开发者ID:oswetto,项目名称:LoboEvolution,代码行数:4,代码来源:AbstractCSSRuleImpl.java
示例19: getCSSStyleSheets
import org.w3c.dom.css.CSSStyleSheet; //导入依赖的package包/类
public List<CSSStyleSheet> getCSSStyleSheets() {
if (cssStyleSheets_ == null) {
cssStyleSheets_ = new ArrayList<CSSStyleSheet>();
}
return cssStyleSheets_;
}
开发者ID:oswetto,项目名称:LoboEvolution,代码行数:7,代码来源:CSSStyleSheetListImpl.java
示例20: setCSSStyleSheets
import org.w3c.dom.css.CSSStyleSheet; //导入依赖的package包/类
public void setCSSStyleSheets(final List<CSSStyleSheet> cssStyleSheets) {
cssStyleSheets_ = cssStyleSheets;
}
开发者ID:oswetto,项目名称:LoboEvolution,代码行数:4,代码来源:CSSStyleSheetListImpl.java
注:本文中的org.w3c.dom.css.CSSStyleSheet类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论