1 19 20 package org.netbeans.modules.xml.wsdl.ui.netbeans.module; 21 22 import java.awt.Image ; 23 import javax.swing.Icon ; 24 import javax.swing.ImageIcon ; 25 import org.netbeans.modules.xml.schema.model.SchemaComponent; 26 import org.netbeans.modules.xml.wsdl.model.WSDLComponent; 27 import org.netbeans.modules.xml.wsdl.model.WSDLModel; 28 import org.netbeans.modules.xml.wsdl.ui.netbeans.module.WSDLSettings.ViewMode; 29 import org.netbeans.modules.xml.wsdl.ui.search.AttributeNameSearchProvider; 30 import org.netbeans.modules.xml.wsdl.ui.search.AttributeValueSearchProvider; 31 import org.netbeans.modules.xml.wsdl.ui.search.ComponentNameSearchProvider; 32 import org.netbeans.modules.xml.wsdl.ui.search.ComponentTypeSearchProvider; 33 import org.netbeans.modules.xml.xam.Component; 34 import org.netbeans.modules.xml.xam.ui.category.AbstractCategory; 35 import org.openide.util.Lookup; 36 import org.openide.util.NbBundle; 37 import org.openide.util.Utilities; 38 import org.openide.util.lookup.Lookups; 39 import org.openide.util.lookup.ProxyLookup; 40 41 46 public class WSDLColumnsCategory extends AbstractCategory { 47 48 private WSDLModel wsdlModel; 49 50 private WSDLColumnsView component; 51 52 private Lookup lookup; 53 54 60 public WSDLColumnsCategory(WSDLModel model, Lookup lookup) { 61 wsdlModel = model; 62 Object [] searchers = new Object [] { 63 new ComponentNameSearchProvider(model, this), 64 new ComponentTypeSearchProvider(model, this), 65 new AttributeNameSearchProvider(model, this), 66 new AttributeValueSearchProvider(model, this), 67 }; 68 this.lookup = new ProxyLookup(new Lookup[] { 69 lookup, 70 Lookups.fixed(searchers) 71 }); 72 } 73 74 public void componentHidden() { 75 } 76 77 public void componentShown() { 78 initComponents(); 79 WSDLSettings.getDefault().setViewMode(ViewMode.COLUMN); 80 } 81 82 public java.awt.Component getComponent() { 83 initComponents(); 84 return component; 85 } 86 87 public String getDescription() { 88 return NbBundle.getMessage(WSDLColumnsCategory.class, 89 "HINT_WsdlCategory_Column"); 90 } 91 92 public Icon getIcon() { 93 String url = NbBundle.getMessage(WSDLColumnsCategory.class, 94 "IMG_WsdlCategory_Column"); 95 Image img = Utilities.loadImage(url); 96 return new ImageIcon (img); 97 } 98 99 public Lookup getLookup() { 100 return lookup; 101 } 102 103 public String getTitle() { 104 return NbBundle.getMessage(WSDLColumnsCategory.class, 105 "LBL_WsdlCategory_Column"); 106 } 107 108 111 private void initComponents() { 112 if (component == null) { 113 component = new WSDLColumnsView(wsdlModel, getLookup()); 114 } 115 } 116 117 public void showComponent(Component comp) { 118 if (comp instanceof WSDLComponent) { 119 component.showComponent((WSDLComponent) comp); 120 } else if (comp instanceof SchemaComponent) { 121 component.showComponent((SchemaComponent) comp); 122 } 123 } 124 } 125 | Popular Tags |