home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1998 January / PCO0198.ISO / browser / net_linx / jae40.jar / java / beans / PropertyEditorSupport.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-11-03  |  2.0 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.       this.source = var1;
  19.    }
  20.  
  21.    public void setValue(Object var1) {
  22.       this.value = var1;
  23.       this.firePropertyChange();
  24.    }
  25.  
  26.    public Object getValue() {
  27.       return this.value;
  28.    }
  29.  
  30.    public boolean isPaintable() {
  31.       return false;
  32.    }
  33.  
  34.    public void paintValue(Graphics var1, Rectangle var2) {
  35.    }
  36.  
  37.    public String getJavaInitializationString() {
  38.       return "???";
  39.    }
  40.  
  41.    public String getAsText() {
  42.       return this.value instanceof String ? (String)this.value : String.valueOf(this.value);
  43.    }
  44.  
  45.    public void setAsText(String var1) throws IllegalArgumentException {
  46.       if (this.value instanceof String) {
  47.          this.setValue(var1);
  48.       } else {
  49.          throw new IllegalArgumentException(var1);
  50.       }
  51.    }
  52.  
  53.    public String[] getTags() {
  54.       return null;
  55.    }
  56.  
  57.    public Component getCustomEditor() {
  58.       return null;
  59.    }
  60.  
  61.    public boolean supportsCustomEditor() {
  62.       return false;
  63.    }
  64.  
  65.    public synchronized void addPropertyChangeListener(PropertyChangeListener var1) {
  66.       if (this.listeners == null) {
  67.          this.listeners = new Vector();
  68.       }
  69.  
  70.       this.listeners.addElement(var1);
  71.    }
  72.  
  73.    public synchronized void removePropertyChangeListener(PropertyChangeListener var1) {
  74.       if (this.listeners != null) {
  75.          this.listeners.removeElement(var1);
  76.       }
  77.    }
  78.  
  79.    public void firePropertyChange() {
  80.       synchronized(this){}
  81.  
  82.       Vector var1;
  83.       try {
  84.          if (this.listeners == null) {
  85.             return;
  86.          }
  87.  
  88.          var1 = (Vector)this.listeners.clone();
  89.       } catch (Throwable var6) {
  90.          throw var6;
  91.       }
  92.  
  93.       PropertyChangeEvent var2 = new PropertyChangeEvent(this.source, (String)null, (Object)null, (Object)null);
  94.  
  95.       for(int var3 = 0; var3 < var1.size(); ++var3) {
  96.          PropertyChangeListener var4 = (PropertyChangeListener)var1.elementAt(var3);
  97.          var4.propertyChange(var2);
  98.       }
  99.  
  100.    }
  101. }
  102.