Java Code Examples for java.beans.BeanDescriptor#getValue()
The following examples show how to use
java.beans.BeanDescriptor#getValue() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HelpCtx.java From netbeans with Apache License 2.0 | 6 votes |
/** Finds help context for a generic object. Right now checks * for HelpCtx.Provider and handles java.awt.Component in a * special way compatible with JavaHelp. * Also {@link BeanDescriptor}'s are checked for a string-valued attribute * <code>helpID</code>, as per the JavaHelp specification (but no help sets * will be loaded). * * @param instance to search help for * @return the help for the object or <code>HelpCtx.DEFAULT_HELP</code> if HelpCtx cannot be found * * @since 4.3 */ public static HelpCtx findHelp(Object instance) { if (instance instanceof java.awt.Component) { return findHelp((java.awt.Component) instance); } if (instance instanceof HelpCtx.Provider) { return ((HelpCtx.Provider) instance).getHelpCtx(); } try { BeanDescriptor d = Introspector.getBeanInfo(instance.getClass()).getBeanDescriptor(); String v = (String) d.getValue("helpID"); // NOI18N if (v != null) { return new HelpCtx(v); } } catch (IntrospectionException e) { err.log(Level.FINE, "findHelp on {0}: {1}", new Object[]{instance, e}); } return HelpCtx.DEFAULT_HELP; }
Example 2
Source File: BeanNode.java From netbeans with Apache License 2.0 | 5 votes |
/** Prepare node properties based on the bean, storing them into the current property sheet. * Called when the bean info is ready. * This implementation always creates a set for standard properties * and may create a set for expert ones if there are any. * @see #computeProperties * @param bean bean to compute properties for * @param info information about the bean */ protected void createProperties(T bean, BeanInfo info) { Descriptor d = computeProperties(bean, info); Sheet sets = getSheet(); Sheet.Set pset = Sheet.createPropertiesSet(); pset.put(d.property); BeanDescriptor bd = info.getBeanDescriptor(); if ((bd != null) && (bd.getValue("propertiesHelpID") != null)) { // NOI18N pset.setValue("helpID", bd.getValue("propertiesHelpID")); // NOI18N } sets.put(pset); if (d.expert.length != 0) { Sheet.Set eset = Sheet.createExpertSet(); eset.put(d.expert); if ((bd != null) && (bd.getValue("expertHelpID") != null)) { // NOI18N eset.setValue("helpID", bd.getValue("expertHelpID")); // NOI18N } sets.put(eset); } }
Example 3
Source File: SerialDataNode.java From netbeans with Apache License 2.0 | 5 votes |
private Sheet.Set createExpertSet(BeanNode.Descriptor descr, BeanDescriptor bd) { Sheet.Set p = Sheet.createExpertSet(); convertProps (p, descr.expert, this); if (bd != null) { Object helpID = bd.getValue("expertHelpID"); // NOI18N if (helpID != null && helpID instanceof String) { p.setValue("helpID", helpID); // NOI18N } } return p; }
Example 4
Source File: SerialDataNode.java From netbeans with Apache License 2.0 | 5 votes |
private Sheet.Set createPropertiesSet(BeanNode.Descriptor descr, BeanDescriptor bd) { Sheet.Set props; props = Sheet.createPropertiesSet(); if (descr.property != null) { convertProps (props, descr.property, this); } if (bd != null) { // #29550: help from the beaninfo on property tabs Object helpID = bd.getValue("propertiesHelpID"); // NOI18N if (helpID != null && helpID instanceof String) { props.setValue("helpID", helpID); // NOI18N } } return props; }
Example 5
Source File: TestSwingContainer.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private static void test(BeanDescriptor bd, String name, Object expected) { Object value = bd.getValue(name); System.out.println("\t" + name + " = " + value); if (!Objects.equals(value, expected)) { throw new Error(name + ": expected = " + expected + "; actual = " + value); } }