1 19 20 package org.netbeans.spi.looks; 21 22 import java.util.ArrayList ; 23 import java.util.Collections ; 24 import java.util.Enumeration ; 25 import java.util.List ; 26 import org.netbeans.api.nodes2looks.Nodes; 27 import org.openide.nodes.Node; 28 29 34 public class SampleProvider implements LookProvider { 35 36 private Look lookForSampleRepObject; 37 38 private List sampleRepObjectLooks = new ArrayList (); 39 private List nodeLooks = new ArrayList (); 40 private List otherObjectsLooks = new ArrayList (); 41 42 43 public SampleProvider(Look lookForSampleRepObject) { 44 45 if ( lookForSampleRepObject != null ) { 46 sampleRepObjectLooks.add( lookForSampleRepObject ); 47 } 48 sampleRepObjectLooks.add( Looks.bean() ); 49 50 nodeLooks.add( Looks.bean() ); 51 nodeLooks.add( Nodes.nodeLook() ); 52 53 otherObjectsLooks.add( Looks.bean() ); 54 55 } 56 57 public Enumeration getLooksForObject(Object representedObject) { 58 if ( representedObject instanceof SampleRepObject ) { 59 return Collections.enumeration( sampleRepObjectLooks ); 60 } 61 else if ( representedObject instanceof Node ) { 62 return Collections.enumeration( nodeLooks ); 63 } 64 else { 65 return Collections.enumeration( otherObjectsLooks ); 66 } 67 } 68 69 public String getName() { 70 return "Sample Look"; 71 } 72 73 public String getDisplayName() { 74 return getName(); 75 } 76 77 } 78 | Popular Tags |