1 19 20 package org.netbeans.modules.xml.schema.model.impl; 21 22 import java.util.Set ; 23 import org.netbeans.modules.xml.schema.model.GlobalComplexType; 24 import org.netbeans.modules.xml.schema.model.GlobalComplexType.Block; 25 import org.netbeans.modules.xml.schema.model.GlobalComplexType.Final; 26 import org.netbeans.modules.xml.schema.model.SchemaComponent; 27 import org.netbeans.modules.xml.schema.model.SchemaModel; 28 import org.netbeans.modules.xml.schema.model.visitor.SchemaVisitor; 29 import org.w3c.dom.Element ; 30 31 32 36 public class GlobalComplexTypeImpl extends CommonComplexTypeImpl implements GlobalComplexType{ 37 38 39 public GlobalComplexTypeImpl(SchemaModelImpl model) { 40 super(model,createNewComponent(SchemaElements.COMPLEX_TYPE, model)); 41 } 42 43 public GlobalComplexTypeImpl(SchemaModelImpl model, Element el){ 44 super(model,el); 45 } 46 47 51 public Class <? extends SchemaComponent> getComponentType() 52 { 53 return GlobalComplexType.class; 54 } 55 56 public void setName(String name) { 57 setAttribute(NAME_PROPERTY, SchemaAttributes.NAME, name); 58 } 59 60 public String getName() { 61 return getAttribute(SchemaAttributes.NAME); 62 } 63 64 public void setFinal(Set <Final> finalValue) { 65 setAttribute(FINAL_PROPERTY, SchemaAttributes.FINAL, 66 finalValue == null ? null : 67 Util.convertEnumSet(Final.class, finalValue)); 68 } 69 70 public Set <Final> getFinal() { 71 String s = getAttribute(SchemaAttributes.FINAL); 72 return s == null ? null : Util.valuesOf(Final.class, s); 73 } 74 75 public void setBlock(Set <Block> block) { 76 setAttribute(BLOCK_PROPERTY, SchemaAttributes.BLOCK, 77 block == null ? null : 78 Util.convertEnumSet(Block.class, block)); 79 } 80 81 public Set <Block> getBlock() { 82 String s = getAttribute(SchemaAttributes.BLOCK); 83 return s == null ? null : Util.valuesOf(Block.class, s); 84 } 85 86 public Set <Final> getFinalEffective() { 87 Set <Final> v = getFinal(); 88 return v == null ? getFinalDefault() : v; 89 } 90 91 public Set <Final> getFinalDefault() { 92 return Util.convertEnumSet(Final.class, getModel().getSchema().getFinalDefaultEffective()); 93 } 94 95 public Set <Block> getBlockEffective() { 96 Set <Block> v = getBlock(); 97 return v == null ? getBlockDefault() : v; 98 } 99 100 public Set <Block> getBlockDefault() { 101 return Util.convertEnumSet(Block.class, getModel().getSchema().getBlockDefaultEffective()); 102 } 103 104 public void setAbstract(Boolean isAbstract) { 105 setAttribute(ABSTRACT_PROPERTY, SchemaAttributes.ABSTRACT, isAbstract); 106 } 107 108 public Boolean isAbstract() { 109 String s = getAttribute(SchemaAttributes.ABSTRACT); 110 return s == null ? null : Boolean.valueOf(s); 111 } 112 113 public void accept(SchemaVisitor visitor) { 114 visitor.visit(this); 115 } 116 117 protected Class getAttributeMemberType(SchemaAttributes attr) { 118 switch(attr) { 119 case FINAL: 120 return Final.class; 121 case BLOCK: 122 return Block.class; 123 default: 124 return super.getAttributeMemberType(attr); 125 } 126 } 127 128 public boolean getEffectiveAbstract() { 129 Boolean v = isAbstract(); 130 return v == null ? getAbstractDefault() : v; 131 } 132 133 public boolean getAbstractDefault() { 134 return false; 135 } 136 137 public boolean getAbstractEffective() { 138 Boolean v = isAbstract(); 139 return v == null ? getAbstractDefault() : v; 140 } 141 } 142 | Popular Tags |