Package org.w3c.dom.stylesheets

Examples of org.w3c.dom.stylesheets.StyleSheetList


  public static String[] getCSSClasses(Document doc) {
    Collection c = Collections.EMPTY_SET;
    if (doc instanceof INodeNotifier) {
      IStyleSheetListAdapter adapter = (IStyleSheetListAdapter) ((INodeNotifier) doc)
          .getAdapterFor(IStyleSheetListAdapter.class);
      StyleSheetList ssl = (adapter == null ? null : adapter
          .getStyleSheets());

      CSSClassTraverser traverser = new CSSClassTraverser();
      if (ssl != null) {
        for (int i = 0, numStyles = ssl.getLength(); i < numStyles; i++) {
          // loop for styles (<style> and <link>)
          org.w3c.dom.stylesheets.StyleSheet ss = ssl.item(i);

          try {
            traverser.apply((ICSSNode) ss);
          } catch (ClassCastException ex) {
            Logger log = PDPlugin
View Full Code Here


  }

  /**
   */
  public Enumeration getClasses() {
    StyleSheetList sheetList = getStyleSheets();
    int nSheets = sheetList.getLength();

    final ArrayList classes = new ArrayList();

    CSSClassTraverser traverser = new CSSClassTraverser();
    traverser.setTraverseImported(true);

    for (int i = 0; i < nSheets; i++) {
      org.w3c.dom.stylesheets.StyleSheet sheet = sheetList.item(i);
      if (sheet instanceof ICSSNode) {
        traverser.apply((ICSSNode) sheet);
      }
    }
    classes.addAll(traverser.getClassNames());
View Full Code Here

  }

  /**
   */
  public CSSStyleDeclaration getOverrideStyle(Element element, String pseudoName) {
    StyleSheetList ssl = getStyleSheets();
    int numStyles = ssl.getLength();

    CSSQueryTraverser query = new CSSQueryTraverser();
    query.setTraverseImported(true);
    query.setTraverseImportFirst(true);
    query.setElement(element, pseudoName);

    for (int i = 0; i < numStyles; i++) {
      // loop for styles (<style> and <link>)
      org.w3c.dom.stylesheets.StyleSheet ss = ssl.item(i);

      try {
        query.apply((ICSSNode) ss);
      }
      catch (ClassCastException ex) {
View Full Code Here

    if (notifier == null)
      return;

    // before updating, all sub-models should be loaded!
    DocumentStyle document = (DocumentStyle) model.getDocument();
    StyleSheetList styles = document.getStyleSheets();
    if (styles != null) {
      int n = styles.getLength();
      ImportedCollector trav = new ImportedCollector();
      for (int i = 0; i < n; i++) {
        org.w3c.dom.stylesheets.StyleSheet sheet = styles.item(i);
        if (sheet instanceof ICSSNode)
          trav.apply((ICSSNode) sheet);
      }
    }
View Full Code Here

  private static String[] internalGetCSSClasses(Document doc) {
    Collection c = Collections.EMPTY_SET;
    if (doc instanceof INodeNotifier) {
      IStyleSheetListAdapter adapter = (IStyleSheetListAdapter) ((INodeNotifier) doc)
          .getAdapterFor(IStyleSheetListAdapter.class);
      StyleSheetList ssl = (adapter == null ? null : adapter
          .getStyleSheets());

      CSSClassTraverser traverser = new CSSClassTraverser();
      if (ssl != null) {
        for (int i = 0, numStyles = ssl.getLength(); i < numStyles; i++) {
          // loop for styles (<style> and <link>)
          org.w3c.dom.stylesheets.StyleSheet ss = ssl.item(i);

          try {
            traverser.apply((ICSSNode) ss);
          } catch (ClassCastException ex) {
            JSFCorePlugin.log(ex, "Unable to cast to CSS style"); //$NON-NLS-1$
View Full Code Here

    List styleSheets = new ArrayList();
    INodeNotifier docnotifier = (INodeNotifier) element.getOwnerDocument();
    IStyleSheetListAdapter adapter = (IStyleSheetListAdapter) docnotifier
        .getAdapterFor(IStyleSheetListAdapter.class);

    StyleSheetList ssl = (adapter == null ? null : adapter.getStyleSheets());

    if (ssl != null) {
      for (int i = 0, numStyles = ssl.getLength(); i < numStyles; i++) {
        // loop for styles (<style> and <link>)
        org.w3c.dom.stylesheets.StyleSheet ss = ssl.item(i);
        styleSheets.add(ss);
      }
    }

    // now is our work-around part for support datawindow.
View Full Code Here

     */
    protected void addAuthorStyleSheetProperties
        (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 {
View Full Code Here

     */
    protected void addAuthorStyleSheetProperties
        (Element e, String pe, CSSOMReadOnlyStyleDeclaration rd) {
        try {
            CSSOMRuleList authorRules = new CSSOMRuleList();
            StyleSheetList l = ((DocumentStyle)document).getStyleSheets();
            for (int i = 0; i < l.getLength(); i++) {
                addMatchingRules(((CSSStyleSheet)l.item(i)).getCssRules(),
                                 e,
                                 pe,
                                 authorRules);
            }
            authorRules = sortRules(authorRules, e, pe);
View Full Code Here

     */
    protected void addAuthorStyleSheetProperties
        (Element e, String pe, CSSOMReadOnlyStyleDeclaration rd) {
        try {
            CSSOMRuleList authorRules = new CSSOMRuleList();
            StyleSheetList l = ((DocumentStyle)document).getStyleSheets();
            for (int i = 0; i < l.getLength(); i++) {
                addMatchingRules(((CSSStyleSheet)l.item(i)).getCssRules(),
                                 e,
                                 pe,
                                 authorRules);
            }
            authorRules = sortRules(authorRules, e, pe);
View Full Code Here

     * @param rd The result style declaration.
     */
    protected void addAuthorStyleSheetProperties
        (Element e, String pe, CSSOMReadOnlyStyleDeclaration rd) {
  CSSOMRuleList authorRules = new CSSOMRuleList();
  StyleSheetList l = ((DocumentStyle)document).getStyleSheets();
  for (int i = 0; i < l.getLength(); i++) {
      addMatchingRules(((CSSStyleSheet)l.item(i)).getCssRules(),
           e,
           pe,
           authorRules);
  }
  authorRules = sortRules(authorRules, e, pe);
View Full Code Here

TOP

Related Classes of org.w3c.dom.stylesheets.StyleSheetList

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.