1 19 package org.netbeans.tax; 20 21 import org.netbeans.tax.spec.DTD; 22 import org.netbeans.tax.spec.ParameterEntityReference; 23 import org.netbeans.tax.spec.ConditionalSection; 24 25 30 public class TreeConditionalSection extends AbstractTreeDTD implements DTD.Child, ParameterEntityReference.Child, ConditionalSection.Child { 31 32 33 public static final String PROP_INCLUDE = "include"; 35 public static final String PROP_IGNORED_CONTENT = "ignoredContent"; 37 38 public static final boolean IGNORE = false; 39 40 41 public static final boolean INCLUDE = true; 42 43 44 45 private boolean include; 46 47 48 private String ignoredContent; 50 51 55 56 public TreeConditionalSection (boolean include) { 57 super (); 58 59 this.include = include; 60 this.ignoredContent = new String (); 61 } 62 63 64 protected TreeConditionalSection (TreeConditionalSection conditionalSection, boolean deep) { 65 super (conditionalSection, deep); 66 67 this.include = conditionalSection.include; 68 this.ignoredContent = conditionalSection.ignoredContent; 69 } 70 71 72 76 78 public Object clone (boolean deep) { 79 return new TreeConditionalSection (this, deep); 80 } 81 82 84 public boolean equals (Object object, boolean deep) { 85 if (!!! super.equals (object, deep)) 86 return false; 87 88 TreeConditionalSection peer = (TreeConditionalSection) object; 89 if (this.include != peer.include) 90 return false; 91 if (!!! Util.equals (this.getIgnoredContent (), peer.getIgnoredContent ())) 92 return false; 93 94 return true; 95 } 96 97 100 public void merge (TreeObject treeObject) throws CannotMergeException { 101 super.merge (treeObject); 102 103 TreeConditionalSection peer = (TreeConditionalSection) treeObject; 104 105 setIncludeImpl (peer.isInclude ()); 106 setIgnoredContentImpl (peer.getIgnoredContent ()); 107 } 108 109 110 114 116 public final boolean isInclude () { 117 return include; 118 } 119 120 122 private final void setIncludeImpl (boolean newInclude) { 123 if ( Util.THIS.isLoggable() ) Util.THIS.debug ("\nTreeConditionalSection::setIncludeImpl: oldInclude = " + this.include); if ( Util.THIS.isLoggable() ) Util.THIS.debug (" ::setIncludeImpl: newInclude = " + newInclude); 126 boolean oldInclude = this.include; 127 128 this.include = newInclude; 129 130 firePropertyChange (PROP_INCLUDE, oldInclude ? Boolean.TRUE : Boolean.FALSE, newInclude ? Boolean.TRUE : Boolean.FALSE); 131 } 132 133 137 public final void setInclude (boolean newInclude) throws ReadOnlyException, InvalidArgumentException { 138 if ( Util.THIS.isLoggable() ) Util.THIS.debug ("\nTreeConditionalSection::setInclude: oldInclude = " + this.include); if ( Util.THIS.isLoggable() ) Util.THIS.debug (" ::setInclude: newInclude = " + newInclude); 141 if ( this.include == newInclude ) 145 return; 146 checkReadOnly (); 147 149 setIncludeImpl (newInclude); 153 } 154 155 156 158 public final String getIgnoredContent () { 159 return ignoredContent; 160 } 161 162 164 private void setIgnoredContentImpl (String newContent) { 165 String oldContent = this.ignoredContent; 166 167 this.ignoredContent = newContent; 168 169 firePropertyChange (PROP_IGNORED_CONTENT, oldContent, newContent); 170 } 171 172 176 public final void setIgnoredContent (String newIgnoredContent) throws ReadOnlyException, InvalidArgumentException { 177 if ( Util.equals (this.ignoredContent, newIgnoredContent) ) 181 return; 182 checkReadOnly (); 183 185 setIgnoredContentImpl (newIgnoredContent); 189 } 190 191 192 196 198 protected TreeObjectList.ContentManager createChildListContentManager () { 199 return new ChildListContentManager (); 200 } 201 202 203 206 protected class ChildListContentManager extends AbstractTreeDTD.ChildListContentManager { 207 208 210 public TreeNode getOwnerNode () { 211 return TreeConditionalSection.this; 212 } 213 214 216 public void checkAssignableObject (Object obj) { 217 super.checkAssignableObject (obj); 218 checkAssignableClass (ConditionalSection.Child.class, obj); 219 } 220 221 } 223 } 224 | Popular Tags |