當前位置: 首頁>>代碼示例>>Java>>正文


Java BeanDescriptor類代碼示例

本文整理匯總了Java中java.beans.BeanDescriptor的典型用法代碼示例。如果您正苦於以下問題:Java BeanDescriptor類的具體用法?Java BeanDescriptor怎麽用?Java BeanDescriptor使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


BeanDescriptor類屬於java.beans包,在下文中一共展示了BeanDescriptor類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: findHelp

import java.beans.BeanDescriptor; //導入依賴的package包/類
/** 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;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:35,代碼來源:HelpCtx.java

示例2: findDisplayNameFor

import java.beans.BeanDescriptor; //導入依賴的package包/類
private static String findDisplayNameFor(Object o) {
    try {
        if (o == null) {
            return null;
        }

        if (o instanceof Node.Property) {
            return ((Node.Property) o).getDisplayName();
        }

        BeanInfo bi = Introspector.getBeanInfo(o.getClass());

        if (bi != null) {
            BeanDescriptor bd = bi.getBeanDescriptor();

            if (bd != null) {
                return bd.getDisplayName();
            }
        }
    } catch (Exception e) {
        //okay, we did our best
    }

    return null;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:26,代碼來源:ModelProperty.java

示例3: getNameForBean

import java.beans.BeanDescriptor; //導入依賴的package包/類
/**
* Returns name of the bean.
*/
private String getNameForBean() {
    if (nameGetter != null) {
        try {
            String name = (String) nameGetter.invoke(bean);

            return (name != null) ? name : ""; // NOI18N
        } catch (Exception ex) {
            NodeOp.warning(ex);
        }
    }

    BeanDescriptor descriptor = beanInfo.getBeanDescriptor();

    return descriptor.getDisplayName();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:19,代碼來源:BeanNode.java

示例4: getBindingDescriptors

import java.beans.BeanDescriptor; //導入依賴的package包/類
@Override
public List<BindingDescriptor>[] getBindingDescriptors(RADComponent component) {
    BeanDescriptor beanDescriptor = component.getBeanInfo().getBeanDescriptor();
    List<BindingDescriptor>[] descs = getBindingDescriptors(null, beanDescriptor, false);
    Class<?> beanClass = component.getBeanClass();
    if (JTextComponent.class.isAssignableFrom(beanClass)) {
        // get rid of text_... descriptors
        descs[0] = filterDescriptors(descs[0], "text_"); // NOI18N
    } else if (JTable.class.isAssignableFrom(beanClass)
            || JList.class.isAssignableFrom(beanClass)
            || JComboBox.class.isAssignableFrom(beanClass)) {
        // get rid of selectedElement(s)_... descriptors
        descs[0] = filterDescriptors(descs[0], "selectedElement_"); // NOI18N
        descs[0] = filterDescriptors(descs[0], "selectedElements_"); // NOI18N
        // add elements descriptor
        BindingDescriptor desc = new BindingDescriptor("elements", List.class); // NOI18N
        descs[0].add(0, desc);
    } else if (JSlider.class.isAssignableFrom(beanClass)) {
        // get rid of value_... descriptor
        descs[0] = filterDescriptors(descs[0], "value_"); // NOI18N
    }
    return descs;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:24,代碼來源:BindingDesignSupportImpl.java

示例5: getShortDescription

import java.beans.BeanDescriptor; //導入依賴的package包/類
/** Gets the short description of this feature. */
public String getShortDescription() {
    if (noBeanInfo) return super.getShortDescription();
    
    try {
        InstanceCookie ic = ic();
        if (ic == null) {
            // it must be unrecognized instance
            return getDataObject().getPrimaryFile().toString();
        }
        
        Class clazz = ic.instanceClass();
        BeanDescriptor bd = Utilities.getBeanInfo(clazz).getBeanDescriptor();
        String desc = bd.getShortDescription();
        return (desc.equals(bd.getDisplayName()))? getDisplayName(): desc;
    } catch (Exception ex) {
        return super.getShortDescription();
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:20,代碼來源:SerialDataNode.java

示例6: __getTargetBeanDescriptor

import java.beans.BeanDescriptor; //導入依賴的package包/類
BeanDescriptor __getTargetBeanDescriptor()
  throws IntrospectionException
{
  // Use explicit info, if available,
  if (_informant != null)
  {
    BeanDescriptor bd = _informant.getBeanDescriptor();

    if (bd != null)
    {
      return bd;
    }
  }

  // OK, fabricate a default BeanDescriptor.
  return (new BeanDescriptor(_beanClass));
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:18,代碼來源:JavaIntrospector.java

示例7: getBeanDescriptor

import java.beans.BeanDescriptor; //導入依賴的package包/類
@Override
public BeanDescriptor getBeanDescriptor()
{
  if (_beanDescriptor == null)
  {
    if (_introspector != null)
    {
      try
      {
        _beanDescriptor = _introspector.__getTargetBeanDescriptor();
      }
      catch (IntrospectionException e)
      {
        // do nothing
        ;
      }
    }
    else
    {
      _beanDescriptor =
                     _cloneBeanDescriptor(_oldBeanInfo.getBeanDescriptor());
    }
  }

  return _beanDescriptor;
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:27,代碼來源:JavaIntrospector.java

示例8: _cloneBeanDescriptor

import java.beans.BeanDescriptor; //導入依賴的package包/類
private static BeanDescriptor _cloneBeanDescriptor(
  BeanDescriptor oldDescriptor
  )
{
  try
  {
    BeanDescriptor newDescriptor = new BeanDescriptor(
                                        oldDescriptor.getBeanClass(),
                                        oldDescriptor.getCustomizerClass());

    // copy the rest of the attributes
    _copyFeatureDescriptor(oldDescriptor, newDescriptor);

    return newDescriptor;
  }
  catch (Exception e)
  {
    _LOG.severe(e);
    return null;
  }
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:22,代碼來源:JavaIntrospector.java

示例9: getHtmlDescription

import java.beans.BeanDescriptor; //導入依賴的package包/類
public String getHtmlDescription() {
	if (htmlDescription == null) {
		BeanDescriptor beanDescriptor = beanInfo.getBeanDescriptor();
		String beanDescription = beanDescriptor.getShortDescription();

		String[] beanDescriptions = beanDescription.split("\\|");

		String beanShortDescription = beanDescriptions.length >= 1 ? beanDescriptions[0] : "n/a";
		String beanLongDescription = beanDescriptions.length >= 2 ? beanDescriptions[1] : "n/a";
		beanShortDescription = BeansUtils.cleanDescription(beanShortDescription, true);
		beanLongDescription = BeansUtils.cleanDescription(beanLongDescription, true);

		htmlDescription = "<p>" +
				"<font size=\"4.5\"><u><b>" + getDisplayName() + "</b></u></font>" + "<br><br>"	+
				"<i>" + beanShortDescription + "</i>" + "<br><br>" + beanLongDescription +
		   "</p>";
	}

	return htmlDescription;
}
 
開發者ID:convertigo,項目名稱:convertigo-engine,代碼行數:21,代碼來源:DboBeanData.java

示例10: DatabaseObject

import java.beans.BeanDescriptor; //導入依賴的package包/類
public DatabaseObject() {
	try {
		BeanInfo bi = CachedIntrospector.getBeanInfo(getClass());
		BeanDescriptor bd = bi.getBeanDescriptor();
		setBeanName(StringUtils.normalize(bd.getDisplayName())); // normalize
																	// bean
																	// name
																	// #283
		identity = getNewOrderValue();
		compilablePropertySourceValuesMap = new HashMap<String, Object>(5);
	} catch (Exception e) {
		name = getClass().getName();
		Engine.logBeans.error("Unable to set the default name; using the class name instead (\"" + name
				+ "\").", e);
	}
}
 
開發者ID:convertigo,項目名稱:convertigo-engine,代碼行數:17,代碼來源:DatabaseObject.java

示例11: getBeanDescriptor

import java.beans.BeanDescriptor; //導入依賴的package包/類
@Override
public BeanDescriptor getBeanDescriptor() {
	BeanDescriptor beanDescriptor = new BeanDescriptor(beanClass, null);
	beanDescriptor.setDisplayName(displayName);
	beanDescriptor.setShortDescription(shortDescription);
	if (iconNameC16 != null) {
		beanDescriptor.setValue("icon" + BeanInfo.ICON_COLOR_16x16, iconNameC16);
	}
	if (iconNameC32 != null) {
		beanDescriptor.setValue("icon" + BeanInfo.ICON_COLOR_32x32, iconNameC32);
	}
	if (iconNameM16 != null) {
		beanDescriptor.setValue("icon" + BeanInfo.ICON_MONO_16x16, iconNameM16);
	}
	if (iconNameM32 != null) {
		beanDescriptor.setValue("icon" + BeanInfo.ICON_MONO_32x32, iconNameM32);
	}
	return beanDescriptor;
}
 
開發者ID:convertigo,項目名稱:convertigo-engine,代碼行數:20,代碼來源:MySimpleBeanInfo.java

示例12: ExplicitBeanInfo

import java.beans.BeanDescriptor; //導入依賴的package包/類
public ExplicitBeanInfo(BeanDescriptor beanDescriptor,
                        BeanInfo[] additionalBeanInfo,
                        PropertyDescriptor[] propertyDescriptors,
                        int defaultPropertyIndex,
                        EventSetDescriptor[] eventSetDescriptors,
                        int defaultEventIndex,
                        MethodDescriptor[] methodDescriptors,
                        Image[] icons) {
        this.beanDescriptor = beanDescriptor;
        this.additionalBeanInfo = additionalBeanInfo;
        this.propertyDescriptors = propertyDescriptors;
        this.defaultPropertyIndex = defaultPropertyIndex;
        this.eventSetDescriptors = eventSetDescriptors;
        this.defaultEventIndex = defaultEventIndex;
        this.methodDescriptors = methodDescriptors;
        this.icons = icons;
}
 
開發者ID:vilie,項目名稱:javify,代碼行數:18,代碼來源:ExplicitBeanInfo.java

示例13: getBeanDescriptor

import java.beans.BeanDescriptor; //導入依賴的package包/類
@Override
public BeanDescriptor getBeanDescriptor() {
    try {
        return new BeanDescriptor(
                JPDABreakpoint.class,
                Class.forName("org.netbeans.modules.debugger.jpda.ui.breakpoints.JPDABreakpointCustomizer", true, Lookup.getDefault().lookup(ClassLoader.class))); // NOI18N
    } catch (ClassNotFoundException ex) {
        Exceptions.printStackTrace(ex);
        return null;
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:12,代碼來源:JPDABreakpointBeanInfo.java

示例14: getBeanDescriptor

import java.beans.BeanDescriptor; //導入依賴的package包/類
@Override
   public BeanDescriptor getBeanDescriptor() {
       BeanDescriptor descr = new BeanDescriptor(MicrosoftEdgeBrowser.class);
       descr.setDisplayName(NbBundle.getMessage(MicrosoftEdgeBrowserBeanInfo.class, "CTL_MicrosoftEdgeBrowserName")); // NOI18N
       descr.setShortDescription(NbBundle.getMessage(MicrosoftEdgeBrowserBeanInfo.class, "HINT_MicrosoftEdgeBrowserName")); // NOI18N
       descr.setValue ("helpID", "org.netbeans.modules.extbrowser.ExtWebBrowser");  // NOI18N
return descr;
   }
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:9,代碼來源:MicrosoftEdgeBrowserBeanInfo.java

示例15: createProperties

import java.beans.BeanDescriptor; //導入依賴的package包/類
/** 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);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:35,代碼來源:BeanNode.java


注:本文中的java.beans.BeanDescriptor類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。