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 / StyleContext$NamedStyle.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  5.0 KB  |  192 lines

  1. package javax.swing.text;
  2.  
  3. import java.io.IOException;
  4. import java.io.ObjectInputStream;
  5. import java.io.ObjectOutputStream;
  6. import java.io.Serializable;
  7. import java.util.Enumeration;
  8. import java.util.EventListener;
  9. import javax.swing.event.ChangeEvent;
  10. import javax.swing.event.ChangeListener;
  11. import javax.swing.event.EventListenerList;
  12.  
  13. public class StyleContext$NamedStyle implements Style, Serializable {
  14.    protected EventListenerList listenerList;
  15.    protected transient ChangeEvent changeEvent;
  16.    private transient AttributeSet attributes;
  17.    // $FF: synthetic field
  18.    static Class class$javax$swing$event$ChangeListener;
  19.    // $FF: synthetic field
  20.    private final StyleContext this$0;
  21.  
  22.    public StyleContext$NamedStyle(StyleContext var1, String var2, Style var3) {
  23.       this.this$0 = var1;
  24.       this.listenerList = new EventListenerList();
  25.       this.changeEvent = null;
  26.       this.attributes = var1.getEmptySet();
  27.       if (var2 != null) {
  28.          this.setName(var2);
  29.       }
  30.  
  31.       if (var3 != null) {
  32.          this.setResolveParent(var3);
  33.       }
  34.  
  35.    }
  36.  
  37.    public StyleContext$NamedStyle(StyleContext var1, Style var2) {
  38.       this(var1, (String)null, var2);
  39.    }
  40.  
  41.    public StyleContext$NamedStyle(StyleContext var1) {
  42.       this.this$0 = var1;
  43.       this.listenerList = new EventListenerList();
  44.       this.changeEvent = null;
  45.       this.attributes = var1.getEmptySet();
  46.    }
  47.  
  48.    public String toString() {
  49.       return "NamedStyle:" + this.getName() + " " + this.attributes;
  50.    }
  51.  
  52.    public String getName() {
  53.       return this.isDefined(StyleConstants.NameAttribute) ? (String)this.getAttribute(StyleConstants.NameAttribute) : null;
  54.    }
  55.  
  56.    public void setName(String var1) {
  57.       if (var1 != null) {
  58.          this.addAttribute(StyleConstants.NameAttribute, var1);
  59.       }
  60.  
  61.    }
  62.  
  63.    public void addChangeListener(ChangeListener var1) {
  64.       this.listenerList.add(class$javax$swing$event$ChangeListener == null ? (class$javax$swing$event$ChangeListener = class$("javax.swing.event.ChangeListener")) : class$javax$swing$event$ChangeListener, var1);
  65.    }
  66.  
  67.    public void removeChangeListener(ChangeListener var1) {
  68.       this.listenerList.remove(class$javax$swing$event$ChangeListener == null ? (class$javax$swing$event$ChangeListener = class$("javax.swing.event.ChangeListener")) : class$javax$swing$event$ChangeListener, var1);
  69.    }
  70.  
  71.    protected void fireStateChanged() {
  72.       Object[] var1 = this.listenerList.getListenerList();
  73.  
  74.       for(int var2 = var1.length - 2; var2 >= 0; var2 -= 2) {
  75.          if (var1[var2] == (class$javax$swing$event$ChangeListener == null ? (class$javax$swing$event$ChangeListener = class$("javax.swing.event.ChangeListener")) : class$javax$swing$event$ChangeListener)) {
  76.             if (this.changeEvent == null) {
  77.                this.changeEvent = new ChangeEvent(this);
  78.             }
  79.  
  80.             ((ChangeListener)var1[var2 + 1]).stateChanged(this.changeEvent);
  81.          }
  82.       }
  83.  
  84.    }
  85.  
  86.    public EventListener[] getListeners(Class var1) {
  87.       return this.listenerList.getListeners(var1);
  88.    }
  89.  
  90.    public int getAttributeCount() {
  91.       return this.attributes.getAttributeCount();
  92.    }
  93.  
  94.    public boolean isDefined(Object var1) {
  95.       return this.attributes.isDefined(var1);
  96.    }
  97.  
  98.    public boolean isEqual(AttributeSet var1) {
  99.       return this.attributes.isEqual(var1);
  100.    }
  101.  
  102.    public AttributeSet copyAttributes() {
  103.       StyleContext$NamedStyle var1 = new StyleContext$NamedStyle(this.this$0);
  104.       var1.attributes = this.attributes.copyAttributes();
  105.       return var1;
  106.    }
  107.  
  108.    public Object getAttribute(Object var1) {
  109.       return this.attributes.getAttribute(var1);
  110.    }
  111.  
  112.    public Enumeration getAttributeNames() {
  113.       return this.attributes.getAttributeNames();
  114.    }
  115.  
  116.    public boolean containsAttribute(Object var1, Object var2) {
  117.       return this.attributes.containsAttribute(var1, var2);
  118.    }
  119.  
  120.    public boolean containsAttributes(AttributeSet var1) {
  121.       return this.attributes.containsAttributes(var1);
  122.    }
  123.  
  124.    public AttributeSet getResolveParent() {
  125.       return this.attributes.getResolveParent();
  126.    }
  127.  
  128.    public void addAttribute(Object var1, Object var2) {
  129.       StyleContext var3 = this.this$0;
  130.       this.attributes = var3.addAttribute(this.attributes, var1, var2);
  131.       this.fireStateChanged();
  132.    }
  133.  
  134.    public void addAttributes(AttributeSet var1) {
  135.       StyleContext var2 = this.this$0;
  136.       this.attributes = var2.addAttributes(this.attributes, var1);
  137.       this.fireStateChanged();
  138.    }
  139.  
  140.    public void removeAttribute(Object var1) {
  141.       StyleContext var2 = this.this$0;
  142.       this.attributes = var2.removeAttribute(this.attributes, var1);
  143.       this.fireStateChanged();
  144.    }
  145.  
  146.    public void removeAttributes(Enumeration var1) {
  147.       StyleContext var2 = this.this$0;
  148.       this.attributes = var2.removeAttributes(this.attributes, var1);
  149.       this.fireStateChanged();
  150.    }
  151.  
  152.    public void removeAttributes(AttributeSet var1) {
  153.       StyleContext var2 = this.this$0;
  154.       if (var1 == this) {
  155.          this.attributes = var2.getEmptySet();
  156.       } else {
  157.          this.attributes = var2.removeAttributes(this.attributes, var1);
  158.       }
  159.  
  160.       this.fireStateChanged();
  161.    }
  162.  
  163.    public void setResolveParent(AttributeSet var1) {
  164.       if (var1 != null) {
  165.          this.addAttribute(StyleConstants.ResolveAttribute, var1);
  166.       } else {
  167.          this.removeAttribute(StyleConstants.ResolveAttribute);
  168.       }
  169.  
  170.    }
  171.  
  172.    private void writeObject(ObjectOutputStream var1) throws IOException {
  173.       var1.defaultWriteObject();
  174.       StyleContext.writeAttributeSet(var1, this.attributes);
  175.    }
  176.  
  177.    private void readObject(ObjectInputStream var1) throws ClassNotFoundException, IOException {
  178.       var1.defaultReadObject();
  179.       this.attributes = SimpleAttributeSet.EMPTY;
  180.       StyleContext.readAttributeSet(var1, this);
  181.    }
  182.  
  183.    // $FF: synthetic method
  184.    static Class class$(String var0) {
  185.       try {
  186.          return Class.forName(var0);
  187.       } catch (ClassNotFoundException var2) {
  188.          throw new NoClassDefFoundError(((Throwable)var2).getMessage());
  189.       }
  190.    }
  191. }
  192.