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 / java / beans / PropertyEditorSupport.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  2.1 KB  |  102 lines

  1. package java.beans;
  2.  
  3. import java.awt.Component;
  4. import java.awt.Graphics;
  5. import java.awt.Rectangle;
  6. import java.util.Vector;
  7.  
  8. public class PropertyEditorSupport implements PropertyEditor {
  9.    private Object value;
  10.    private Object source;
  11.    private Vector listeners;
  12.  
  13.    protected PropertyEditorSupport() {
  14.       this.source = this;
  15.    }
  16.  
  17.    protected PropertyEditorSupport(Object var1) {
  18.       if (var1 == null) {
  19.          throw new NullPointerException();
  20.       } else {
  21.          this.source = var1;
  22.       }
  23.    }
  24.  
  25.    public void setValue(Object var1) {
  26.       this.value = var1;
  27.       this.firePropertyChange();
  28.    }
  29.  
  30.    public Object getValue() {
  31.       return this.value;
  32.    }
  33.  
  34.    public boolean isPaintable() {
  35.       return false;
  36.    }
  37.  
  38.    public void paintValue(Graphics var1, Rectangle var2) {
  39.    }
  40.  
  41.    public String getJavaInitializationString() {
  42.       return "???";
  43.    }
  44.  
  45.    public String getAsText() {
  46.       return this.value instanceof String ? (String)this.value : "" + this.value;
  47.    }
  48.  
  49.    public void setAsText(String var1) throws IllegalArgumentException {
  50.       if (this.value instanceof String) {
  51.          this.setValue(var1);
  52.       } else {
  53.          throw new IllegalArgumentException(var1);
  54.       }
  55.    }
  56.  
  57.    public String[] getTags() {
  58.       return null;
  59.    }
  60.  
  61.    public Component getCustomEditor() {
  62.       return null;
  63.    }
  64.  
  65.    public boolean supportsCustomEditor() {
  66.       return false;
  67.    }
  68.  
  69.    public synchronized void addPropertyChangeListener(PropertyChangeListener var1) {
  70.       if (this.listeners == null) {
  71.          this.listeners = new Vector();
  72.       }
  73.  
  74.       this.listeners.addElement(var1);
  75.    }
  76.  
  77.    public synchronized void removePropertyChangeListener(PropertyChangeListener var1) {
  78.       if (this.listeners != null) {
  79.          this.listeners.removeElement(var1);
  80.       }
  81.    }
  82.  
  83.    public void firePropertyChange() {
  84.       Vector var1;
  85.       synchronized(this) {
  86.          if (this.listeners == null) {
  87.             return;
  88.          }
  89.  
  90.          var1 = (Vector)this.listeners.clone();
  91.       }
  92.  
  93.       PropertyChangeEvent var3 = new PropertyChangeEvent(this.source, (String)null, (Object)null, (Object)null);
  94.  
  95.       for(int var4 = 0; var4 < var1.size(); ++var4) {
  96.          PropertyChangeListener var5 = (PropertyChangeListener)var1.elementAt(var4);
  97.          var5.propertyChange(var3);
  98.       }
  99.  
  100.    }
  101. }
  102.