1 19 package org.netbeans.modules.xml.core.wizard; 20 21 import java.beans.PropertyChangeSupport ; 22 import java.beans.PropertyChangeListener ; 23 import java.net.URL ; 24 import java.util.ArrayList ; 25 import java.util.Iterator ; 26 import java.util.Set ; 27 import java.util.TreeSet ; 28 29 34 public final class DocumentModel { 35 36 public static final int NONE = 0; 37 38 public static final int DTD = 1; 39 40 public static final int SCHEMA = 2; 41 42 public static final int OTHER = 3; 43 44 private String name; 45 46 private String namespace; 47 48 private String publicID; 49 50 private String systemID; 51 52 private String root; 53 54 private URL targetFolderURL; 56 57 public static final String PROP_TYPE = "type"; 58 59 private int type; 60 61 private PropertyChangeSupport support; 62 63 64 public DocumentModel(URL targetFolderURL) { 65 type = NONE; 66 this.targetFolderURL = targetFolderURL; 67 } 68 69 public String getName() { 70 return name; 71 } 72 73 public void setName(String value) { 74 name = value; 75 } 76 77 public String getNamespace() { 78 return this.namespace; 79 } 80 81 public void setNamespace(String namespace) { 82 this.namespace = namespace; 83 } 84 85 public String getPublicID() { 86 if (publicID != null && publicID.trim().equals("")) return null; 87 return this.publicID; 88 } 89 90 public void setPublicID(String publicID) { 91 this.publicID = publicID; 92 } 93 94 public String getSystemID() { 95 return this.systemID; 96 } 97 98 public void setSystemID(String systemID) { 99 this.systemID = systemID; 100 } 101 102 public String getRoot() { 103 if (root != null && root.trim().equals("")) return null; 104 return this.root; 105 } 106 107 public void setRoot(String root) { 108 this.root = root; 109 } 110 111 public int getType() { 112 return this.type; 113 } 114 115 public void setType(int type) { 116 int old = this.type; 117 this.type = type; 118 getSupport().firePropertyChange(PROP_TYPE, old, type); 119 } 120 121 public URL getTargetFolderURL() { 122 return targetFolderURL; 123 } 124 125 public void addPropertyChangeListener(PropertyChangeListener l) { 126 getSupport().addPropertyChangeListener(l); 127 } 128 129 public void removePropertyChangeListener(PropertyChangeListener l) { 130 getSupport().removePropertyChangeListener(l); 131 } 132 133 private synchronized PropertyChangeSupport getSupport() { 134 if (support == null) { 135 support = new PropertyChangeSupport (this); 136 } 137 return support; 138 } 139 140 } 141 | Popular Tags |