1 19 20 package org.netbeans.modules.xml.schema.model.impl; 21 22 import org.netbeans.modules.xml.schema.model.*; 23 import org.netbeans.modules.xml.schema.model.visitor.SchemaVisitor; 24 import org.netbeans.modules.xml.xam.dom.NamedComponentReference; 25 import org.w3c.dom.Element ; 26 27 30 public class GroupReferenceImpl extends SchemaComponentImpl 31 implements GroupReference { 32 35 public GroupReferenceImpl(SchemaModelImpl model) { 36 this(model,createNewComponent(SchemaElements.GROUP,model)); 37 } 38 39 42 public GroupReferenceImpl(SchemaModelImpl model, Element e) { 43 super(model,e); 44 } 45 46 50 public Class <? extends SchemaComponent> getComponentType() { 51 return GroupReference.class; 52 } 53 54 57 public void accept(SchemaVisitor v) { 58 v.visit(this); 59 } 60 61 64 public void setMinOccurs(Integer min) { 65 setAttribute(MIN_OCCURS_PROPERTY, SchemaAttributes.MIN_OCCURS, min); 66 } 67 68 71 public void setMaxOccurs(String max) { 72 setAttribute(MAX_OCCURS_PROPERTY, SchemaAttributes.MAX_OCCURS, max); 73 } 74 75 78 public void setRef(NamedComponentReference<GlobalGroup> def) { 79 setAttribute(REF_PROPERTY, SchemaAttributes.REF, def); 80 } 81 82 85 public NamedComponentReference<GlobalGroup> getRef() { 86 return resolveGlobalReference(GlobalGroup.class, 87 SchemaAttributes.REF); 88 } 89 90 93 public Integer getMinOccurs() { 94 String s = getAttribute(SchemaAttributes.MIN_OCCURS); 95 return s == null ? null : Integer.valueOf(s); 96 } 97 98 public int getMinOccursEffective() { 99 Integer v = getMinOccurs(); 100 return v == null ? getMinOccursDefault() : v; 101 } 102 103 public int getMinOccursDefault() { 104 return 1; 105 } 106 107 110 public String getMaxOccurs() { 111 return getAttribute(SchemaAttributes.MAX_OCCURS); 112 } 113 114 public String getMaxOccursEffective() { 115 String s = getMaxOccurs(); 116 return s == null ? getMaxOccursDefault() : s; 117 } 118 119 public String getMaxOccursDefault() { 120 return String.valueOf(1); 121 } 122 } 123 | Popular Tags |