/** * Returns the length of this list. * @return the length of this list. */ public int jsxGet_length() { if (rules_ != null) { return rules_.getLength(); } return 0; }
/** * {@inheritDoc} */ @Override public Object get(final int index, final Scriptable start) { return CSSRule.create(stylesheet_, rules_.item(index)); }
/** * Returns the length of this list. * @return the length of this list. */ public int jsxGet_length() { if (rules_ != null) { return rules_.getLength(); } return 0; }
/** * {@inheritDoc} */ @Override public Object get(final int index, final Scriptable start) { return CSSRule.create(stylesheet_, rules_.item(index)); }
private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException { cssRules_ = (CSSRuleList) in.readObject(); if (cssRules_ != null) { for (int i = 0; i < cssRules_.getLength(); i++) { final CSSRule cssRule = cssRules_.item(i); if (cssRule instanceof AbstractCSSRuleImpl) { ((AbstractCSSRuleImpl) cssRule).setParentStyleSheet(this); } } } disabled_ = in.readBoolean(); href_ = (String) in.readObject(); media_ = (MediaList) in.readObject(); readOnly_ = in.readBoolean(); title_ = (String) in.readObject(); }
/** * Returns the length of this list. * @return the length of this list. */ public int jsxGet_length() { if (rules_ != null) { return rules_.getLength(); } return 0; }
/** * {@inheritDoc} */ @Override public Object get(final int index, final Scriptable start) { return CSSRule.create(stylesheet_, rules_.item(index)); }
private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException { baseUri_ = (String) in.readObject(); cssRules_ = (CSSRuleList) in.readObject(); if (cssRules_ != null) { for (int i = 0; i < cssRules_.getLength(); i++) { final CSSRule cssRule = cssRules_.item(i); if (cssRule instanceof AbstractCSSRuleImpl) { ((AbstractCSSRuleImpl) cssRule).setParentStyleSheet(this); } } } disabled_ = in.readBoolean(); href_ = (String) in.readObject(); media_ = (MediaList) in.readObject(); // TODO ownerNode may not be serializable! // ownerNode = (Node) in.readObject(); readOnly_ = in.readBoolean(); title_ = (String) in.readObject(); }
/** * Adds a new rule. * @see <a href="http://msdn.microsoft.com/en-us/library/aa358796.aspx">MSDN</a> * @param selector the selector name * @param rule the rule * @return always return -1 as of MSDN documentation */ public int jsxFunction_addRule(final String selector, final String rule) { final String completeRule = selector.trim() + " {" + rule + "}"; wrapped_.insertRule(completeRule, wrapped_.getCssRules().getLength()); return -1; }
InputSource source = new InputSource( new StringReader( "h1 { background: #ffcc44; } div { color: red; }")); CSSOMParser parser = new CSSOMParser(new SACParserCSS3()); CSSStyleSheet sheet = parser.parseStyleSheet(source, null, null); CSSRuleList rules = sheet.getCssRules(); for (int i = 0; i < rules.getLength(); i++) { final CSSRule rule = rules.item(i); System.out.println(rule.getCssText()); }
/** * Adds a new rule. * @see <a href="http://msdn.microsoft.com/en-us/library/aa358796.aspx">MSDN</a> * @param selector the selector name * @param rule the rule * @return always return -1 as of MSDN documentation */ public int jsxFunction_addRule(final String selector, final String rule) { final String completeRule = selector.trim() + " {" + rule + "}"; wrapped_.insertRule(completeRule, wrapped_.getCssRules().getLength()); return -1; }
private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException { cssRules_ = (CSSRuleList) in.readObject(); if (cssRules_ != null) { for (int i = 0; i < cssRules_.getLength(); i++) { final CSSRule cssRule = cssRules_.item(i); if (cssRule instanceof AbstractCSSRuleImpl) { ((AbstractCSSRuleImpl) cssRule).setParentRule(this); ((AbstractCSSRuleImpl) cssRule).setParentStyleSheet(getParentStyleSheetImpl()); } } } media_ = (MediaList) in.readObject(); } }
/** * Adds a new rule. * @see <a href="http://msdn.microsoft.com/en-us/library/aa358796.aspx">MSDN</a> * @param selector the selector name * @param rule the rule * @return always return -1 as of MSDN documentation */ public int jsxFunction_addRule(final String selector, final String rule) { final String completeRule = selector.trim() + " {" + rule + "}"; wrapped_.insertRule(completeRule, wrapped_.getCssRules().getLength()); return -1; }
private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException { cssRules_ = (CSSRuleList) in.readObject(); if (cssRules_ != null) { for (int i = 0; i < cssRules_.getLength(); i++) { final CSSRule cssRule = cssRules_.item(i); if (cssRule instanceof AbstractCSSRuleImpl) { ((AbstractCSSRuleImpl) cssRule).setParentRule(this); ((AbstractCSSRuleImpl) cssRule).setParentStyleSheet(getParentStyleSheetImpl()); } } } media_ = (MediaList) in.readObject(); } }
public Map<String, CSSStyleRule> parseCSS() throws IOException { Map<String, CSSStyleRule> rules = new HashMap<String, CSSStyleRule>(); InputSource inputSource = new InputSource(new FileReader("bootstrap.css")); CSSStyleSheet styleSheet = new CSSOMParser().parseStyleSheet(inputSource, null, null); CSSRuleList ruleList = styleSheet.getCssRules(); for (int i = 0; i < ruleList.getLength(); i++) { CSSRule rule = ruleList.item(i); if (rule.getType() == CSSRule.STYLE_RULE) { CSSStyleRule styleRule = (CSSStyleRule) rule; rules.put(styleRule.getSelectorText(), styleRule); } } return rules; }
int length = getCssRules().getLength(); if (index < 0 || length < index) throw new DOMException(DOMException.INDEX_SIZE_ERR, "");//$NON-NLS-1$
/** * {@inheritDoc} */ @Override public String getCssText() { final StringBuilder sb = new StringBuilder("@media "); sb.append(((MediaListImpl) getMedia()).getMediaText()); sb.append(" {"); for (int i = 0; i < getCssRules().getLength(); i++) { final CSSRule rule = getCssRules().item(i); sb.append(rule.getCssText()).append(" "); } sb.append("}"); return sb.toString(); }
int length = getCssRules().getLength(); if (index < 0 || length < index) throw new DOMException(DOMException.INDEX_SIZE_ERR, "");//$NON-NLS-1$