1 19 20 package org.netbeans.modules.autoupdate; 21 22 import java.util.ArrayList ; 23 import java.util.Collection ; 24 25 import org.w3c.dom.*; 26 27 31 class ModuleGroup extends Object 32 implements org.openide.nodes.Node.Cookie { 33 34 private static final String ATTR_NAME = "name"; 36 37 private Node node; 38 39 40 private String name; 41 42 43 private Collection items; 44 45 46 public ModuleGroup( ) { 47 this( null ); 48 } 49 50 51 public ModuleGroup( Node node ) { 52 items = new ArrayList ( 11 ); 53 if ( node != null ) { 54 this.node = node; 55 setName( getAttribute( ATTR_NAME ) ); 56 } 57 } 58 59 61 void addItem( ModuleGroup group ) { 62 items.add( group ); 63 } 64 65 67 void addItem( ModuleUpdate update ) { 68 items.add( update ); 69 } 70 71 73 76 public String getName() { 77 return name; 78 } 79 80 83 public void setName(String name) { 84 this.name = name; 85 } 86 87 90 public Collection getItems() { 91 return items; 92 } 93 94 96 99 private String getAttribute( String attribute ) { 100 Node attr = node.getAttributes().getNamedItem( attribute ); 101 return attr == null ? null : attr.getNodeValue(); 102 } 103 104 } 105 | Popular Tags |