Examples of CSSStyleSheet


Examples of org.w3c.dom.css.CSSStyleSheet

        }
    }
    break;
      case CSSRule.IMPORT_RULE:
    CSSImportRule ir = (CSSImportRule)rule;
    CSSStyleSheet   is = ir.getStyleSheet();
    if (is != null) {
        addMatchingRules(is.getCssRules(), e, pe, rl);
    }
    break;
      case CSSRule.MEDIA_RULE:
    CSSMediaRule mr = (CSSMediaRule)rule;
    if (mediaMatch(mr.getMedia())) {
View Full Code Here

Examples of org.w3c.dom.css.CSSStyleSheet

    /**
     * Returns the user-agent stylesheet.
     */
    public CSSStyleSheet getUserAgentStyleSheet() {
        CSSStyleSheet result = null;

        URL url = getClass().getResource("resources/UserAgentStyleSheet.css");
        if (url != null) {
            String uri = url.toString();
            result = createCSSStyleSheet("User Agent Style Sheet", "all");
View Full Code Here

Examples of org.w3c.dom.css.CSSStyleSheet

   */
  private void processStylesheet(String css) {
    try {
      CSSOMParser parser = new CSSOMParser();
      InputSource is = new InputSource(new StringReader(css));
      CSSStyleSheet stylesheet = parser.parseStyleSheet(is);
      CSSRuleList list = stylesheet.getCssRules();
      //      ArrayList assists = new ArrayList();
      for (int i = 0; i < list.getLength(); i++) {
        CSSRule rule = list.item(i);
        if (rule instanceof CSSStyleRule) {
          CSSStyleRule styleRule = (CSSStyleRule) rule;
View Full Code Here

Examples of org.w3c.dom.css.CSSStyleSheet

  public void update() {
    try {
      CSSOMParser parser = new CSSOMParser();
      InputSource is = new InputSource(new StringReader(editor.getDocumentProvider().getDocument(editor.getEditorInput()).get()));
      CSSStyleSheet stylesheet = parser.parseStyleSheet(is);
      this.selectors.clear();
      CSSRuleList list = stylesheet.getCssRules();
      for (int i = 0; i < list.getLength(); i++) {
        CSSRule rule = list.item(i);
        if (rule instanceof CSSStyleRule) {
          CSSStyleRule styleRule = (CSSStyleRule) rule;
          String selector = styleRule.getSelectorText();
View Full Code Here

Examples of org.w3c.dom.css.CSSStyleSheet

     * @return Whether the setting of the value was successful.
     */
    public static boolean setValue(final File cssFile, final String selector,
            final String property, final String newValue, final String priority) {
        boolean success = false;
        final CSSStyleSheet styleSheet = getStyleSheet(cssFile);
        final List<CSSStyleRule> rules = getRules(styleSheet);
        final Optional<CSSStyleDeclaration> styleMaybe = getStyle(rules,
                selector);
        if (styleMaybe.isPresent()) {
            final CSSStyleDeclaration style = styleMaybe.get();
            style.setProperty(property, newValue, priority);
            success = IOUtil.write(styleSheet.toString(), cssFile);
        }
        return success;
    }
View Full Code Here

Examples of org.w3c.dom.css.CSSStyleSheet

     * @return The parsed {@code CSSStyleSheet} or an initialized but empty
     *         {@code CSSStyleSheetImpl} if the parsing was unsuccessful.
     */
    private static CSSStyleSheet getStyleSheet(final File cssFile) {

        CSSStyleSheet sheet = null;
        final InputSource source = new InputSource(cssFile.toURI().toString());
        try {
            sheet = new CSSOMParser().parseStyleSheet(source, null, null);
        } catch (final IOException e) {
            LOG.error("IOException while reading {}", cssFile, e);
View Full Code Here

Examples of org.w3c.dom.css.CSSStyleSheet

  }
 
  AttributeRuleList getRuleList(InputStream stream) throws IOException {
    InputSource source = new InputSource(new InputStreamReader(stream));
        CSSOMParser parser = new CSSOMParser(new SACParserCSS3());
        CSSStyleSheet stylesheet = parser.parseStyleSheet(source, null, null);
        CSSRuleList ruleList = stylesheet.getCssRules();
       
        return new AttributeRuleList(ruleList);
  }
View Full Code Here

Examples of org.w3c.dom.css.CSSStyleSheet

    /**
     * Returns the user-agent stylesheet.
     */
    public CSSStyleSheet getUserAgentStyleSheet() {
        CSSStyleSheet result = null;

        URL url = getClass().getResource("resources/UserAgentStyleSheet.css");
        if (url != null) {
            String uri = url.toString();
            result = createCSSStyleSheet("User Agent Style Sheet", "all");
View Full Code Here

Examples of org.w3c.dom.css.CSSStyleSheet

        }
    }
    break;
      case CSSRule.IMPORT_RULE:
    CSSImportRule ir = (CSSImportRule)rule;
    CSSStyleSheet   is = ir.getStyleSheet();
    if (is != null) {
        addMatchingRules(is.getCssRules(), e, pe, rl);
    }
    break;
      case CSSRule.MEDIA_RULE:
    CSSMediaRule mr = (CSSMediaRule)rule;
    if (mediaMatch(mr.getMedia())) {
View Full Code Here

Examples of org.w3c.dom.css.CSSStyleSheet

     *
     * @param source the source from which to retrieve the CSS to be parsed
     * @return the stylesheet parsed from the specified input source
     */
    private CSSStyleSheet parseCSS(final InputSource source) {
        CSSStyleSheet ss;
        try {
            final ErrorHandler errorHandler = getWindow().getWebWindow().getWebClient().getCssErrorHandler();
            final CSSOMParser parser = new CSSOMParser(new SACParserCSS21());
            parser.setErrorHandler(errorHandler);
            ss = parser.parseStyleSheet(source, null, null);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.