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 / rtf / RTFReader$StylesheetDestination$StyleDefiningDestination.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  3.4 KB  |  133 lines

  1. package javax.swing.text.rtf;
  2.  
  3. import javax.swing.text.Style;
  4. import javax.swing.text.rtf.RTFReader.StylesheetDestination;
  5.  
  6. class RTFReader$StylesheetDestination$StyleDefiningDestination extends RTFReader.AttributeTrackingDestination implements RTFReader.Destination {
  7.    final int STYLENUMBER_NONE;
  8.    boolean additive;
  9.    boolean characterStyle;
  10.    boolean sectionStyle;
  11.    public String styleName;
  12.    public int number;
  13.    int basedOn;
  14.    int nextStyle;
  15.    boolean hidden;
  16.    Style realizedStyle;
  17.    // $FF: synthetic field
  18.    private final RTFReader.StylesheetDestination this$1;
  19.  
  20.    public RTFReader$StylesheetDestination$StyleDefiningDestination(RTFReader.StylesheetDestination var1) {
  21.       super(StylesheetDestination.access$000(var1));
  22.       this.this$1 = var1;
  23.       this.STYLENUMBER_NONE = 222;
  24.       this.additive = false;
  25.       this.characterStyle = false;
  26.       this.sectionStyle = false;
  27.       this.styleName = null;
  28.       this.number = 0;
  29.       this.basedOn = 222;
  30.       this.nextStyle = 222;
  31.       this.hidden = false;
  32.    }
  33.  
  34.    public void handleText(String var1) {
  35.       if (this.styleName != null) {
  36.          this.styleName = this.styleName + var1;
  37.       } else {
  38.          this.styleName = var1;
  39.       }
  40.  
  41.    }
  42.  
  43.    public void close() {
  44.       int var1 = this.styleName.indexOf(59);
  45.       if (var1 > 0) {
  46.          this.styleName = this.styleName.substring(0, var1);
  47.       }
  48.  
  49.       this.this$1.definedStyles.put(new Integer(this.number), this);
  50.       super.close();
  51.    }
  52.  
  53.    public boolean handleKeyword(String var1) {
  54.       if (var1.equals("additive")) {
  55.          this.additive = true;
  56.          return true;
  57.       } else if (var1.equals("shidden")) {
  58.          this.hidden = true;
  59.          return true;
  60.       } else {
  61.          return super.handleKeyword(var1);
  62.       }
  63.    }
  64.  
  65.    public boolean handleKeyword(String var1, int var2) {
  66.       if (var1.equals("s")) {
  67.          this.characterStyle = false;
  68.          this.sectionStyle = false;
  69.          this.number = var2;
  70.       } else if (var1.equals("cs")) {
  71.          this.characterStyle = true;
  72.          this.sectionStyle = false;
  73.          this.number = var2;
  74.       } else if (var1.equals("ds")) {
  75.          this.characterStyle = false;
  76.          this.sectionStyle = true;
  77.          this.number = var2;
  78.       } else if (var1.equals("sbasedon")) {
  79.          this.basedOn = var2;
  80.       } else {
  81.          if (!var1.equals("snext")) {
  82.             return super.handleKeyword(var1, var2);
  83.          }
  84.  
  85.          this.nextStyle = var2;
  86.       }
  87.  
  88.       return true;
  89.    }
  90.  
  91.    public Style realize() {
  92.       Style var1 = null;
  93.       Style var2 = null;
  94.       if (this.realizedStyle != null) {
  95.          return this.realizedStyle;
  96.       } else {
  97.          if (this.basedOn != 222) {
  98.             RTFReader$StylesheetDestination$StyleDefiningDestination var3 = (RTFReader$StylesheetDestination$StyleDefiningDestination)this.this$1.definedStyles.get(new Integer(this.basedOn));
  99.             if (var3 != null) {
  100.                var1 = var3.realize();
  101.             }
  102.          }
  103.  
  104.          this.realizedStyle = StylesheetDestination.access$000(this.this$1).target.addStyle(this.styleName, var1);
  105.          if (this.characterStyle) {
  106.             this.realizedStyle.addAttributes(((RTFReader.AttributeTrackingDestination)this).currentTextAttributes());
  107.             this.realizedStyle.addAttribute("style:type", "character");
  108.          } else if (this.sectionStyle) {
  109.             this.realizedStyle.addAttributes(((RTFReader.AttributeTrackingDestination)this).currentSectionAttributes());
  110.             this.realizedStyle.addAttribute("style:type", "section");
  111.          } else {
  112.             this.realizedStyle.addAttributes(((RTFReader.AttributeTrackingDestination)this).currentParagraphAttributes());
  113.             this.realizedStyle.addAttribute("style:type", "paragraph");
  114.          }
  115.  
  116.          if (this.nextStyle != 222) {
  117.             RTFReader$StylesheetDestination$StyleDefiningDestination var4 = (RTFReader$StylesheetDestination$StyleDefiningDestination)this.this$1.definedStyles.get(new Integer(this.nextStyle));
  118.             if (var4 != null) {
  119.                var2 = var4.realize();
  120.             }
  121.          }
  122.  
  123.          if (var2 != null) {
  124.             this.realizedStyle.addAttribute("style:nextStyle", var2);
  125.          }
  126.  
  127.          this.realizedStyle.addAttribute("style:additive", new Boolean(this.additive));
  128.          this.realizedStyle.addAttribute("style:hidden", new Boolean(this.hidden));
  129.          return this.realizedStyle;
  130.       }
  131.    }
  132. }
  133.