1 19 package org.netbeans.lib.jmi.mapping; 20 21 import java.beans.PropertyChangeListener ; 22 import java.beans.PropertyChangeSupport ; 23 import org.netbeans.api.mdr.*; 24 import javax.jmi.reflect.RefBaseObject; 25 import java.io.*; 26 27 31 public class JMIMapperImpl extends JMIMapper implements Serializable { 32 33 34 public static final String PROP_HEADER = "header"; 36 37 private transient PropertyChangeSupport supp; 38 39 private String header = ""; 40 41 43 44 public JMIMapperImpl() { 45 } 46 47 49 public String getHeader () { 50 return header; 51 } 52 53 public void setHeader (String header) { 54 String oldHeader = this.header; 55 if (!oldHeader.equals(header)) { 56 this.header = header; 57 init(); 58 supp.firePropertyChange(PROP_HEADER, oldHeader, header); 59 } 60 } 61 62 public void generate(JMIStreamFactory sf, RefBaseObject object) throws IOException { 63 new JavaMapper(sf, header).visitRefBaseObject(object); 64 } 65 66 69 public final void addPropertyChangeListener(PropertyChangeListener l) { 70 init(); 71 supp.addPropertyChangeListener(l); 72 } 73 74 77 public final void removePropertyChangeListener(PropertyChangeListener l) { 78 if (supp != null) supp.removePropertyChangeListener(l); 79 } 80 81 private synchronized void init() { 82 if (supp == null) { 83 supp = new PropertyChangeSupport (this); 84 } 85 } 86 } 87 | Popular Tags |