1 19 package org.openide.explorer.propertysheet; 20 21 import org.openide.explorer.*; 22 import org.openide.explorer.ExplorerManager.Provider; 23 import org.openide.nodes.Node; 24 import org.openide.nodes.Node.Property; 25 26 import java.beans.*; 27 28 import javax.swing.*; 29 30 31 67 public class PropertySheetView extends PropertySheet { 68 69 static final long serialVersionUID = -7568245745904766160L; 70 71 72 transient private boolean guiInitialized = false; 73 74 75 transient private PropertyIL managerListener; 76 77 78 transient private ExplorerManager explorerManager; 79 80 public PropertySheetView() { 81 } 83 84 85 private void initializeGUI() { 86 guiInitialized = true; 87 88 managerListener = new PropertyIL(); 91 } 92 93 95 public void addNotify() { 96 super.addNotify(); 97 98 explorerManager = ExplorerManager.find(this); 99 100 if (!guiInitialized) { 101 initializeGUI(); 102 } 103 104 explorerManager.addPropertyChangeListener(managerListener); 106 setNodes(explorerManager.getSelectedNodes()); 107 } 108 109 111 public void removeNotify() { 112 super.removeNotify(); 113 114 if (explorerManager != null) { explorerManager.removePropertyChangeListener(managerListener); 116 explorerManager = null; 117 setNodes(new Node[0]); 118 } 119 } 120 121 123 127 class PropertyIL implements PropertyChangeListener { 128 public void propertyChange(PropertyChangeEvent evt) { 129 if (ExplorerManager.PROP_SELECTED_NODES.equals(evt.getPropertyName())) { 130 setNodes((Node[]) evt.getNewValue()); 131 } 132 } 133 } 134 } 135 | Popular Tags |