本文整理汇总了Java中java.beans.BeanDescriptor.getDisplayName方法的典型用法代码示例。如果您正苦于以下问题:Java BeanDescriptor.getDisplayName方法的具体用法?Java BeanDescriptor.getDisplayName怎么用?Java BeanDescriptor.getDisplayName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.beans.BeanDescriptor
的用法示例。
在下文中一共展示了BeanDescriptor.getDisplayName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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();
}
示例3: updateHelpText
import java.beans.BeanDescriptor; //导入方法依赖的package包/类
private void updateHelpText(BeanInfo bi) {
BeanDescriptor beanDescriptor = bi.getBeanDescriptor();
boolean isDocumented = documentedDboList.contains(beanDescriptor.getBeanClass().getName());
String beanDescription = isDocumented ? beanDescriptor.getShortDescription():"Not yet documented. |";
String[] beanDescriptions = beanDescription.split("\\|");
String beanDisplayName = beanDescriptor.getDisplayName();
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);
helpBrowser.setText("<html>" +
"<head>" +
"<script type=\"text/javascript\">"+
"document.oncontextmenu = new Function(\"return false\");"+
"</script>"+
"<style type=\"text/css\">"+
"body {"+
"font-family: Courrier new, sans-serif;"+
"font-size: 14px;"+
"padding-left: 0.3em;"+
"background-color: #ECEBEB }"+
"</style>"+
"</head><p>"
+ "<font size=\"4.5\"><u><b>"+beanDisplayName+"</b></u></font>" + "<br><br>"
+ "<i>"+beanShortDescription+"</i>" + "<br><br>"
+ beanLongDescription + "</p></html>");
}