本文整理汇总了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;
}
示例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;
}
示例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();
}
示例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;
}
示例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();
}
}
示例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));
}
示例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;
}
示例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;
}
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
}
示例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;
}
示例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);
}
}