1 19 24 package org.openide.explorer.propertysheet; 25 26 import org.openide.nodes.Node; 27 28 import java.beans.*; 29 30 31 50 final class ReusablePropertyEnv extends PropertyEnv { 51 private Object NODE = null; 52 private ReusablePropertyModel mdl; 53 54 55 public ReusablePropertyEnv() { 56 } 57 58 public ReusablePropertyModel getReusablePropertyModel() { 59 return mdl; 60 } 61 62 void clear() { 63 NODE = null; 64 65 if (mdl != null) { 66 mdl.clear(); 67 } 68 } 69 70 void setReusablePropertyModel(ReusablePropertyModel mdl) { 71 this.mdl = mdl; 72 } 73 74 76 public Object [] getBeans() { 77 if (ReusablePropertyModel.DEBUG) { 78 ReusablePropertyModel.checkThread(); 79 } 80 81 if (getNode() instanceof ProxyNode) { 82 return ((ProxyNode) getNode()).getOriginalNodes(); 83 } else if (getNode() instanceof Object []) { 84 return (Object []) getNode(); 85 } else { 86 return new Object [] { getNode() }; 87 } 88 } 89 90 public FeatureDescriptor getFeatureDescriptor() { 91 return mdl.getProperty(); 92 } 93 94 public void addVetoableChangeListener(VetoableChangeListener l) { 95 } 96 97 public void addPropertyChangeListener(PropertyChangeListener l) { 98 } 99 100 public void removeVetoableChangeListener(VetoableChangeListener l) { 101 } 102 103 public void removePropertyChangeListener(PropertyChangeListener l) { 104 } 105 106 public boolean isEditable() { 107 boolean result; 108 109 if (mdl.getProperty() != null) { 110 result = mdl.getProperty().canWrite(); 111 } else { 112 result = true; 113 } 114 115 return result; 116 } 117 118 public void reset() { 119 setEditable(true); 120 setState(STATE_NEEDS_VALIDATION); 121 } 122 123 public Object getNode() { 124 return NODE; 125 } 126 127 public void setNode(Object NODE) { 128 this.NODE = NODE; 129 } 130 } 131 | Popular Tags |