Package org.w3c.dom.css

Examples of org.w3c.dom.css.CSSStyleSheet


    @Override
    public InputStream getInputStream() throws IOException {
        FacesContext ctx = FacesContext.getCurrentInstance();
        InputStream stream = null;
        CSSStyleSheet styleSheet = null;
        try {
            stream = getResourceInputStream();
            if (null == stream) {
                return null;
            }
View Full Code Here


   */
  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

        (Element e, String pe, CSSOMReadOnlyStyleDeclaration rd) {
        try {
            CSSOMRuleList authorRules = new CSSOMRuleList();
            StyleSheetList l = ((DocumentStyle)document).getStyleSheets();
            for (int i = 0; i < l.getLength(); i++) {
                CSSStyleSheet ss = (CSSStyleSheet)l.item(i);
                if (!ss.getDisabled() && mediaMatch(ss.getMedia())) {
                    Node on = ss.getOwnerNode();
                    URL baseURI = null;
                    if (on instanceof ExtendedLinkStyle) {
                        try {
                            baseURI =
                                new URL(((ExtendedLinkStyle)on).getStyleSheetURI());
                        } catch (MalformedURLException ex) {
                        }
                    }
                    addMatchingRules(ss.getCssRules(),
                                     e,
                                     pe,
                                     baseURI,
                                     authorRules);
                }
View Full Code Here

                            buri = new URL(buri, ir.getHref());
                        }
                    } catch (MalformedURLException ex) {
                        break;
                    }
                    CSSStyleSheet is = ir.getStyleSheet();
                    if (is != null) {
                        addMatchingRules(is.getCssRules(), e, pe, buri, rl);
                    }
                }
    break;

      case CSSRule.MEDIA_RULE:
View Full Code Here

    /**
     * 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

        }
    }
    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

    /**
     * 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

   */
  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

  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

     * @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

TOP

Related Classes of org.w3c.dom.css.CSSStyleSheet

Copyright © 2018 www.massapicom. 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.