1 19 20 package org.netbeans.modules.dbschema.jdbcimpl; 21 22 import java.beans.*; 23 24 import org.netbeans.modules.dbschema.*; 25 26 abstract class DBElementImpl implements DBElement.Impl, DBElementProperties { 27 28 29 DBElement element; 30 31 protected DBIdentifier _name; 32 33 34 transient private PropertyChangeSupport support; 35 36 37 public DBElementImpl () { 38 } 39 40 41 public DBElementImpl (String name) { 42 if (name != null) 43 _name = DBIdentifier.create(name); 44 } 45 46 53 public void attachToElement(DBElement el) { 54 element = el; 55 } 56 57 60 public DBIdentifier getName() { 61 return _name; 62 } 63 64 68 public void setName(DBIdentifier name) throws DBException { 69 _name = name; 70 } 71 72 protected boolean comp(Object obj1, Object obj2) { 73 if (obj1 == null || obj2 == null) { 74 if (obj1 == obj2) 75 return true; 76 } else 77 if (obj1.equals(obj2)) 78 return true; 79 80 return false; 81 } 82 83 88 protected final void firePropertyChange (String name, Object o, Object n) { 89 if (support != null) 90 support.firePropertyChange(name, o, n); 91 } 92 93 96 public synchronized void addPropertyChangeListener(PropertyChangeListener l) { 97 if (support == null) 98 synchronized (this) { 99 if (support == null) 101 support = new PropertyChangeSupport(element); 102 } 103 104 support.addPropertyChangeListener(l); 105 } 106 107 110 public void removePropertyChangeListener(PropertyChangeListener l) { 111 if (support != null) 112 support.removePropertyChangeListener(l); 113 } 114 } 115 | Popular Tags |