home *** CD-ROM | disk | FTP | other *** search
/ S283 Planetary Science &n…he Search for Life DVD 2 / DVD-ROM.iso / install / jre1_3 / lib / rt.jar / javax / swing / text / html / HTMLDocument$HTMLReader$HeadAction.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  2.8 KB  |  95 lines

  1. package javax.swing.text.html;
  2.  
  3. import javax.swing.text.AttributeSet;
  4. import javax.swing.text.MutableAttributeSet;
  5. import javax.swing.text.html.HTML.Attribute;
  6. import javax.swing.text.html.HTML.Tag;
  7. import javax.swing.text.html.HTMLDocument.HTMLReader;
  8. import javax.swing.text.html.HTMLEditorKit.ParserCallback;
  9.  
  10. class HTMLDocument$HTMLReader$HeadAction extends HTMLDocument.HTMLReader.BlockAction {
  11.    // $FF: synthetic field
  12.    private final HTMLDocument.HTMLReader this$1;
  13.  
  14.    HTMLDocument$HTMLReader$HeadAction(HTMLDocument.HTMLReader var1) {
  15.       super(var1);
  16.       this.this$1 = var1;
  17.    }
  18.  
  19.    public void start(HTML.Tag var1, MutableAttributeSet var2) {
  20.       this.this$1.inHead = true;
  21.       if (this.this$1.insertTag == null && !HTMLReader.access$200(this.this$1) || this.this$1.insertTag == Tag.HEAD || HTMLReader.access$200(this.this$1) && (this.this$1.foundInsertTag || !var2.isDefined(ParserCallback.IMPLIED))) {
  22.          super.start(var1, var2);
  23.       }
  24.  
  25.    }
  26.  
  27.    public void end(HTML.Tag var1) {
  28.       this.this$1.inHead = this.this$1.inStyle = false;
  29.       if (this.this$1.styles != null) {
  30.          boolean var2 = this.this$1.isStyleCSS;
  31.          int var3 = 0;
  32.          int var4 = this.this$1.styles.size();
  33.  
  34.          while(var3 < var4) {
  35.             Object var5 = this.this$1.styles.elementAt(var3);
  36.             if (var5 == Tag.LINK) {
  37.                ++var3;
  38.                this.handleLink((AttributeSet)this.this$1.styles.elementAt(var3));
  39.                ++var3;
  40.             } else {
  41.                ++var3;
  42.                String var6 = (String)this.this$1.styles.elementAt(var3);
  43.                boolean var7 = var6 == null ? var2 : var6.equals("text/css");
  44.  
  45.                while(true) {
  46.                   ++var3;
  47.                   if (var3 >= var4 || !(this.this$1.styles.elementAt(var3) instanceof String)) {
  48.                      break;
  49.                   }
  50.  
  51.                   if (var7) {
  52.                      this.this$1.addCSSRules((String)this.this$1.styles.elementAt(var3));
  53.                   }
  54.                }
  55.             }
  56.          }
  57.       }
  58.  
  59.       if (this.this$1.insertTag == null && !HTMLReader.access$200(this.this$1) || this.this$1.insertTag == Tag.HEAD || HTMLReader.access$200(this.this$1) && this.this$1.foundInsertTag) {
  60.          super.end(var1);
  61.       }
  62.  
  63.    }
  64.  
  65.    boolean isEmpty(HTML.Tag var1) {
  66.       return false;
  67.    }
  68.  
  69.    private void handleLink(AttributeSet var1) {
  70.       String var2 = (String)var1.getAttribute(Attribute.TYPE);
  71.       if (var2 == null) {
  72.          var2 = HTMLReader.access$100(this.this$1).getDefaultStyleSheetType();
  73.       }
  74.  
  75.       if (var2.equals("text/css")) {
  76.          String var3 = (String)var1.getAttribute(Attribute.REL);
  77.          String var4 = (String)var1.getAttribute(Attribute.TITLE);
  78.          String var5 = (String)var1.getAttribute(Attribute.MEDIA);
  79.          if (var5 == null) {
  80.             var5 = "all";
  81.          } else {
  82.             var5 = var5.toLowerCase();
  83.          }
  84.  
  85.          if (var3 != null) {
  86.             var3 = var3.toLowerCase();
  87.             if ((var5.indexOf("all") != -1 || var5.indexOf("screen") != -1) && (var3.equals("stylesheet") || var3.equals("alternate stylesheet") && var4.equals(this.this$1.defaultStyle))) {
  88.                this.this$1.linkCSSStyleSheet((String)var1.getAttribute(Attribute.HREF));
  89.             }
  90.          }
  91.       }
  92.  
  93.    }
  94. }
  95.