本文整理汇总了Java中org.openide.nodes.PropertySupport.ReadWrite方法的典型用法代码示例。如果您正苦于以下问题:Java PropertySupport.ReadWrite方法的具体用法?Java PropertySupport.ReadWrite怎么用?Java PropertySupport.ReadWrite使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openide.nodes.PropertySupport
的用法示例。
在下文中一共展示了PropertySupport.ReadWrite方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createProperty
import org.openide.nodes.PropertySupport; //导入方法依赖的package包/类
/** Create PropertySupport for given property name and class */
private PropertySupport createProperty(final String name, final Class clazz) {
return new PropertySupport.ReadWrite(name, clazz,
getBundleString("PROP_" + name), //NOI18N
getBundleString("HINT_" + name)) { //NOI18N
public Object getValue() {
return getProperty(name);
}
public void setValue(Object value) {
setProperty(name, value);
}
public boolean supportsDefaultValue() {
return false;
}
};
}
示例2: getPropSet
import org.openide.nodes.PropertySupport; //导入方法依赖的package包/类
public Sheet.Set getPropSet() {
Sheet.Set props = super.getPropSet();
Node.Property p = new PropertySupport.ReadWrite("loglevel", Integer.class, "Log level", "") {
public void setValue(Object val) {
filter = replaceFilter(filter, new LogProxy.FilterLog(levels[(Integer) val]));
}
public Object getValue() {
Integer i = levelToIndex.get(((LogProxy.FilterLog) filter).getLevel());
return i;
}
};
p.setValue("intValues", levelVals);
p.setValue("stringKeys", levelNames);
props.put(p);
return props;
}
示例3: createButtonProperty
import org.openide.nodes.PropertySupport; //导入方法依赖的package包/类
private Property createButtonProperty() {
return new PropertySupport.ReadWrite<Object>("emit", Object.class, "Emit all particles", "Click here to emit all particles of this emitter ") {
JmeParticleEmitterButtonProperty pe;
@Override
public Object getValue() throws IllegalAccessException, InvocationTargetException {
return "";
}
@Override
public PropertyEditor getPropertyEditor() {
if (pe == null) {
pe = new JmeParticleEmitterButtonProperty(JmeParticleEmitter.this);
pe.attachEnv(pe.env);
}
return pe;
}
@Override
public void setValue(Object t) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
}
};
}
示例4: createButtonProperty
import org.openide.nodes.PropertySupport; //导入方法依赖的package包/类
private Property createButtonProperty() {
return new PropertySupport.ReadWrite<Object>("update", Object.class, "Refresh maps", "Click here to refresh environment maps ") {
JmeLightProbeButtonProperty pe;
@Override
public Object getValue() throws IllegalAccessException, InvocationTargetException {
return "";
}
@Override
public PropertyEditor getPropertyEditor() {
if (pe == null) {
pe = new JmeLightProbeButtonProperty(JmeLightProbe.this, getSpatial());
pe.attachEnv(pe.env);
}
return pe;
}
@Override
public void setValue(Object t) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
}
};
}
示例5: createButtonProperty
import org.openide.nodes.PropertySupport; //导入方法依赖的package包/类
private Property createButtonProperty() {
return new PropertySupport.ReadWrite<Object>("emit", Object.class, "Emit all particles", "Click here to emit all particles of this emitter ") {
JmeParticleEmitterButtonProperty pe;
@Override
public Object getValue() throws IllegalAccessException, InvocationTargetException {
return "";
}
@Override
public PropertyEditor getPropertyEditor() {
if (pe == null) {
pe = new JmeParticleEmitterButtonProperty(JmeParticleEmitter.this);
pe.attachEnv(pe.env);
}
return pe;
}
@Override
public void setValue(Object t) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
}
};
}
示例6: getPropertyEditorAction
import org.openide.nodes.PropertySupport; //导入方法依赖的package包/类
@NbBundle.Messages({"# {0} - the watched expression", "PropEditDisplayName=Value of {0}"})
private Action getPropertyEditorAction(final PropertyEditor pe,
final ObjectVariable var,
final ValueListeners vl,
final String expression) {
Property property = new PropertySupport.ReadWrite(expression, null,
Bundle.PropEditDisplayName(expression),
Bundle.PropEditDisplayName(expression)) {
@Override
public Object getValue() throws IllegalAccessException, InvocationTargetException {
return var;
}
@Override
public void setValue(final Object val) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
RP.post(new Runnable() {
@Override
public void run() {
try {
vl.watchEv.setFromMirrorObject(val);
vl.watchEv.setEvaluated(null);
updateValueFrom(vl.watchEv);
} catch (InvalidObjectException ex) {
NotifyDescriptor msg = new NotifyDescriptor.Message(ex.getLocalizedMessage(), NotifyDescriptor.ERROR_MESSAGE);
DialogDisplayer.getDefault().notifyLater(msg);
}
}
});
vl.value = getEvaluatingText();
vl.valueOnly = null;
}
@Override
public PropertyEditor getPropertyEditor() {
return pe;
}
};
PropertyPanel pp = new PropertyPanel(property);
return pp.getActionMap().get("invokeCustomEditor"); // NOI18N
}
示例7: createSheet
import org.openide.nodes.PropertySupport; //导入方法依赖的package包/类
protected Sheet createSheet() {
Sheet sheet = super.createSheet();
Sheet.Set props = sheet.get(Sheet.PROPERTIES);
if (props == null) {
props = Sheet.createPropertiesSet();
sheet.put(props);
}
props.put(new PropertySupport.Name(this));
class ValueProp extends PropertySupport.ReadWrite {
public ValueProp() {
super("value", String.class,
bundle.getString("PROP_value"), bundle.getString("HINT_value"));
}
public Object getValue() {
return System.getProperty(key);
}
public void setValue(Object nue) {
System.setProperty(key, (String) nue);
PropertiesNotifier.changed();
}
}
props.put(new ValueProp());
PropertiesNotifier.addChangeListener(listener = new
ChangeListener() {
public void stateChanged(ChangeEvent ev) {
firePropertyChange("value", null, null);
}
});
return sheet;
}
示例8: createNameProperty
import org.openide.nodes.PropertySupport; //导入方法依赖的package包/类
private Node.Property createNameProperty () {
Node.Property p = new PropertySupport.ReadWrite<String> (
DataObject.PROP_NAME,
String.class,
getMessage (DataObject.class, "PROP_name"),
getMessage (DataObject.class, "HINT_name")
) {
public String getValue () {
return JavaNode.this.getName();
}
@Override
public Object getValue(String key) {
if ("suppressCustomEditor".equals (key)) { //NOI18N
return Boolean.TRUE;
} else {
return super.getValue (key);
}
}
public void setValue(String val) throws IllegalAccessException,
IllegalArgumentException, InvocationTargetException {
if (!canWrite())
throw new IllegalAccessException();
JavaNode.this.setName(val);
}
@Override
public boolean canWrite() {
return JavaNode.this.canRename();
}
};
return p;
}
示例9: getPropSet
import org.openide.nodes.PropertySupport; //导入方法依赖的package包/类
/**
* Returns property sheet associated with node representing this source.
* TODO move it to the node?
* @return property sheet associated with node representing this source.
*/
public Sheet.Set getPropSet() {
Sheet.Set props = Sheet.createPropertiesSet();
final ResourceBundle bundle = NbBundle.getBundle(LogRecordsSource.class);
class RegexpFilterProp extends PropertySupport.ReadWrite {
//Pattern tempPat = Pattern.compile("");
public RegexpFilterProp() {
super("regexpFilterProp", Pattern.class,
bundle.getString("PROP_RegexpFilter"),
bundle.getString("HINT_RegexpFilter"));
}
public Object getValue() {
if (regexpFilter == null) {
return null;
} else {
return regexpFilter.pattern;
}
}
public void setValue(Object object) throws IllegalAccessException, IllegalArgumentException {
setRegexpFilterPatter((Pattern) object);
}
}
props.put(new RegexpFilterProp());
return props;
}
示例10: createNameProperty
import org.openide.nodes.PropertySupport; //导入方法依赖的package包/类
private Node.Property<String> createNameProperty () {
Node.Property<String> p = new PropertySupport.ReadWrite<String> (
DataObject.PROP_NAME,
String.class,
NbBundle.getMessage (DataObject.class, "PROP_name"),
NbBundle.getMessage (DataObject.class, "HINT_name")
)
{
@Override
public String getValue () {
return GoFileNode.this.getName();
}
@Override
public Object getValue(String key) {
if ("suppressCustomEditor".equals (key)) { //NOI18N
return Boolean.TRUE;
} else {
return super.getValue (key);
}
}
@Override
public void setValue(String val) throws IllegalAccessException,
IllegalArgumentException, InvocationTargetException {
if (!canWrite())
throw new IllegalAccessException();
GoFileNode.this.setName(val);
}
@Override
public boolean canWrite() {
return GoFileNode.this.canRename();
}
};
return p;
}
示例11: AntCustomizer
import org.openide.nodes.PropertySupport; //导入方法依赖的package包/类
public AntCustomizer() {
initComponents();
bAntHome.addActionListener (this);
((DefaultComboBoxModel) cbVerbosity.getModel()).removeAllElements(); // just have prototype for form editor
cbVerbosity.addItem(NbBundle.getMessage(AntCustomizer.class, "LBL_verbosity_warn"));
cbVerbosity.addItem(NbBundle.getMessage(AntCustomizer.class, "LBL_verbosity_info"));
cbVerbosity.addItem(NbBundle.getMessage(AntCustomizer.class, "LBL_verbosity_verbose"));
cbVerbosity.addItem(NbBundle.getMessage(AntCustomizer.class, "LBL_verbosity_debug"));
cbSaveFiles.addActionListener (this);
cbReuseOutput.addActionListener (this);
cbAlwaysShowOutput.addActionListener (this);
cbVerbosity.addActionListener (this);
classpathProperty = new PropertySupport.ReadWrite<NbClassPath>("classpath", NbClassPath.class, null, null) {
public NbClassPath getValue() throws IllegalAccessException, InvocationTargetException {
return new NbClassPath(classpath.toArray(new File[classpath.size()]));
}
public void setValue(NbClassPath val) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
String cp = val.getClassPath();
if (cp.startsWith("\"") && cp.endsWith("\"")) {
// *@%!* NbClassPath.getClassPath semantics.
cp = cp.substring(1, cp.length() - 1);
}
classpath = new ArrayList<File>();
for (String f : cp.split(Pattern.quote(File.pathSeparator))) {
if(!f.trim().isEmpty()) {
classpath.add(new File(f));
}
}
fireChanged();
}
};
propertiesProperty = new PropertySupport.ReadWrite<Properties>("properties", Properties.class, null, null) {
public Properties getValue() throws IllegalAccessException, InvocationTargetException {
Properties p = new Properties();
p.putAll(properties);
return p;
}
public void setValue(Properties val) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
properties = NbCollections.checkedMapByCopy(val, String.class, String.class, true);
fireChanged();
}
};
setUpPropertyPanels();
}
示例12: createSheet
import org.openide.nodes.PropertySupport; //导入方法依赖的package包/类
/** Initializes sheet of properties. Overrides superclass method.
* @return default sheet to use
*/
protected Sheet createSheet () {
Sheet sheet = Sheet.createDefault ();
Sheet.Set sheetSet = sheet.get (Sheet.PROPERTIES);
Node.Property property;
// Key property.
property = new PropertySupport.ReadWrite<String>(
PROP_NAME,
String.class,
NbBundle.getBundle(KeyNode.class).getString("PROP_item_key"),
NbBundle.getBundle(KeyNode.class).getString("HINT_item_key")
) {
public String getValue() {
return itemKey;
}
public void setValue(String val) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
KeyNode.this.setName(val);
}
};
property.setName(Element.ItemElem.PROP_ITEM_KEY);
sheetSet.put (property);
// Value property
property = new PropertySupport.ReadWrite<String>(
Element.ItemElem.PROP_ITEM_VALUE,
String.class,
NbBundle.getBundle(KeyNode.class).getString("PROP_item_value"),
NbBundle.getBundle(KeyNode.class).getString("HINT_item_value")
) {
public String getValue() {
return getItem().getValue();
}
public void setValue(String val) throws IllegalAccessException,
IllegalArgumentException, InvocationTargetException {
getItem().setValue(val);
}
};
property.setName(Element.ItemElem.PROP_ITEM_VALUE);
sheetSet.put (property);
// Comment property
property = new PropertySupport.ReadWrite<String>(
Element.ItemElem.PROP_ITEM_COMMENT,
String.class,
NbBundle.getBundle(KeyNode.class).getString("PROP_item_comment"),
NbBundle.getBundle(KeyNode.class).getString("HINT_item_comment")
) {
public String getValue() {
return getItem().getComment();
}
public void setValue(String val) throws IllegalAccessException,
IllegalArgumentException, InvocationTargetException {
getItem().setComment(val);
}
};
property.setName(Element.ItemElem.PROP_ITEM_COMMENT);
sheetSet.put (property);
return sheet;
}