1 19 20 package org.netbeans.modules.xml.schema.ui.nodes.schema; 21 22 import org.netbeans.modules.xml.schema.model.Cardinality; 23 import org.netbeans.modules.xml.schema.ui.basic.editors.MaxOccursEditor; 24 import org.netbeans.modules.xml.schema.ui.nodes.schema.properties.BaseSchemaProperty; 25 import org.openide.nodes.Children; 26 import org.openide.nodes.Node.Property; 27 import org.openide.nodes.Sheet; 28 import org.openide.util.NbBundle; 29 30 import org.netbeans.modules.xml.schema.model.Sequence; 31 import org.netbeans.modules.xml.schema.model.SchemaComponentReference; 32 import org.netbeans.modules.xml.schema.ui.nodes.SchemaComponentNode; 33 import org.netbeans.modules.xml.schema.ui.nodes.SchemaModelFlushWrapper; 34 import org.netbeans.modules.xml.schema.ui.nodes.SchemaUIContext; 35 import org.netbeans.modules.xml.schema.ui.nodes.schema.properties.NonNegativeIntegerProperty; 36 37 42 public class SequenceNode extends SchemaComponentNode<Sequence> 43 { 44 48 public SequenceNode(SchemaUIContext context, 49 SchemaComponentReference<Sequence> reference, 50 Children children) { 51 super(context,reference,children); 52 setIconBaseWithExtension( 53 "org/netbeans/modules/xml/schema/ui/nodes/resources/sequence.png"); 54 55 setDefaultExpanded(true); 56 } 57 58 59 63 @Override 64 public String getTypeDisplayName() { 65 return NbBundle.getMessage(SequenceNode.class, 66 "LBL_SequenceNode_TypeDisplayName"); } 68 69 70 71 @Override 72 protected Sheet createSheet() { 73 Sheet sheet = null; 74 try { 75 sheet = super.createSheet(); 76 Sheet.Set props = sheet.get(Sheet.PROPERTIES); 77 if (props == null) { 78 props = Sheet.createPropertiesSet(); 79 sheet.put(props); 80 } 81 82 Cardinality choiceCardinality = getReference().get().getCardinality(); 83 84 if (choiceCardinality != null) { 85 Property minOccursProp = new NonNegativeIntegerProperty( 87 getReference().get(), Sequence.MIN_OCCURS_PROPERTY, 89 NbBundle.getMessage(SequenceNode.class,"PROP_MinOccurs_DisplayName"), NbBundle.getMessage(SequenceNode.class,"PROP_MinOccurs_ShortDescription") ); 92 props.put(new SchemaModelFlushWrapper(getReference().get(), minOccursProp)); 93 94 Property maxOccursProp = new BaseSchemaProperty( 96 getReference().get(), String .class, 98 Sequence.MAX_OCCURS_PROPERTY, 99 NbBundle.getMessage(SequenceNode.class,"PROP_MaxOccurs_DisplayName"), NbBundle.getMessage(SequenceNode.class,"PROP_MaxOccurs_ShortDescription"), MaxOccursEditor.class 102 ); 103 props.put(new SchemaModelFlushWrapper(getReference().get(), maxOccursProp)); 104 } 105 } catch (NoSuchMethodException ex) { 106 assert false : "properties should be defined"; 107 } 108 return sheet; 109 } 110 } 111 | Popular Tags |