本文整理汇总了Java中java.beans.PropertyDescriptor.setConstrained方法的典型用法代码示例。如果您正苦于以下问题:Java PropertyDescriptor.setConstrained方法的具体用法?Java PropertyDescriptor.setConstrained怎么用?Java PropertyDescriptor.setConstrained使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.beans.PropertyDescriptor
的用法示例。
在下文中一共展示了PropertyDescriptor.setConstrained方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPropertyDescriptor
import java.beans.PropertyDescriptor; //导入方法依赖的package包/类
protected PropertyDescriptor getPropertyDescriptor(String name) throws IntrospectionException {
checkAdditionalProperties();
for (int i = 0 ; i < properties.length ; i++) {
PropertyDescriptor property = properties[i];
if (name.equals(property.getName())) {
PropertyDescriptor clone = new PropertyDescriptor(name, property.getReadMethod(), property.getWriteMethod());
clone.setDisplayName(property.getDisplayName());
clone.setShortDescription(property.getShortDescription());
clone.setPropertyEditorClass(property.getPropertyEditorClass());
clone.setBound(property.isBound());
clone.setConstrained(property.isConstrained());
clone.setExpert(property.isExpert());
clone.setHidden(property.isHidden());
clone.setPreferred(property.isPreferred());
for (String attributeName : Collections.list(property.attributeNames())) {
clone.setValue(attributeName, property.getValue(attributeName));
}
return properties[i] = clone;
}
}
return null;
}
示例2: copyNonMethodProperties
import java.beans.PropertyDescriptor; //导入方法依赖的package包/类
public static void copyNonMethodProperties(PropertyDescriptor source, PropertyDescriptor target)
throws IntrospectionException {
target.setExpert(source.isExpert());
target.setHidden(source.isHidden());
target.setPreferred(source.isPreferred());
target.setName(source.getName());
target.setShortDescription(source.getShortDescription());
target.setDisplayName(source.getDisplayName());
// Copy all attributes (emulating behavior of private FeatureDescriptor#addTable)
Enumeration<String> keys = source.attributeNames();
while (keys.hasMoreElements()) {
String key = keys.nextElement();
target.setValue(key, source.getValue(key));
}
// See java.beans.PropertyDescriptor#PropertyDescriptor(PropertyDescriptor)
target.setPropertyEditorClass(source.getPropertyEditorClass());
target.setBound(source.isBound());
target.setConstrained(source.isConstrained());
}
示例3: setDocInfoProps
import java.beans.PropertyDescriptor; //导入方法依赖的package包/类
/**
* Sets properties from the BeanInfo supplement on the
* introspected PropertyDescriptor
*/
private void setDocInfoProps(DocBeanInfo dbi, PropertyDescriptor pds) {
int beanflags = dbi.beanflags;
if ((beanflags & DocBeanInfo.BOUND) != 0)
pds.setBound(true);
if ((beanflags & DocBeanInfo.EXPERT) != 0)
pds.setExpert(true);
if ((beanflags & DocBeanInfo.CONSTRAINED) != 0)
pds.setConstrained(true);
if ((beanflags & DocBeanInfo.HIDDEN) !=0)
pds.setHidden(true);
if ((beanflags & DocBeanInfo.PREFERRED) !=0)
pds.setPreferred(true);
if (!(dbi.desc.equals("null"))){
pds.setShortDescription(dbi.desc);
}
if (!(dbi.displayname.equals("null"))){
pds.setDisplayName(dbi.displayname);
}
}
示例4: _mergePropertyDescriptors
import java.beans.PropertyDescriptor; //导入方法依赖的package包/类
/**
* Merge information from two PropertyDescriptors into a third
* PropertyDescriptor.
* In the event of other conflicts, the second argument
* <code>primaryDescriptor</code> is given priority over the first argument
* <code>secondaryDescriptor</code>.
* <p>
* @param secondaryDescriptor The lower priority PropertyDescriptor
* @param primaryDescriptor The higher priority PropertyDescriptor
* @param mergedDescriptor The PropertyDescriptor to merge the information
* into.
*/
private static void _mergePropertyDescriptors(
PropertyDescriptor secondaryDescriptor,
PropertyDescriptor primaryDescriptor,
PropertyDescriptor mergedDescriptor
)
{
// merge the superclasses
_mergeFeatureDescriptors(secondaryDescriptor,
primaryDescriptor,
mergedDescriptor);
//
// merge the property editor class
//
Class<?> editorClass = primaryDescriptor.getPropertyEditorClass();
// Give priority to the primary propertyEditor.
if (editorClass == null)
{
editorClass = secondaryDescriptor.getPropertyEditorClass();
}
mergedDescriptor.setPropertyEditorClass(editorClass);
// merge the bound property
mergedDescriptor.setBound(secondaryDescriptor.isBound() |
primaryDescriptor.isBound());
// merge the constrained property
mergedDescriptor.setConstrained(secondaryDescriptor.isConstrained() |
primaryDescriptor.isConstrained());
}
示例5: _copyPropertyDescriptor
import java.beans.PropertyDescriptor; //导入方法依赖的package包/类
private static void _copyPropertyDescriptor(
PropertyDescriptor oldDescriptor,
PropertyDescriptor newDescriptor
)
{
newDescriptor.setBound(oldDescriptor.isBound());
newDescriptor.setConstrained(oldDescriptor.isConstrained());
newDescriptor.setPropertyEditorClass(
oldDescriptor.getPropertyEditorClass());
// copy in superclass
_copyFeatureDescriptor(oldDescriptor, newDescriptor);
}
示例6: getPropertyDescriptors
import java.beans.PropertyDescriptor; //导入方法依赖的package包/类
@Override
public PropertyDescriptor[] getPropertyDescriptors() {
PropertyDescriptor[] p = new PropertyDescriptor[2];
try {
// value
PropertyDescriptor pdValue = new PropertyDescriptor(
"value", TestClass.class, "getValue", "setValue");
pdValue.setBound(true);
pdValue.setConstrained(true);
pdValue.setExpert(true);
pdValue.setHidden(true);
pdValue.setPreferred(true);
pdValue.setValue("required", true);
pdValue.setValue("visualUpdate", true);
pdValue.setShortDescription("user-defined-value");
pdValue.setValue("enumerationValues", new Object[]{
"EAST", 3, "javax.swing.SwingConstants.EAST",
"WEST", 7, "javax.swing.SwingConstants.WEST"});
p[iValue] = pdValue;
// other
PropertyDescriptor pdOther = new PropertyDescriptor(
"other", TestClass.class, "getOther", "setOther");
pdOther.setBound(false);
pdOther.setConstrained(false);
pdOther.setExpert(false);
pdOther.setHidden(false);
pdOther.setPreferred(false);
pdOther.setValue("required", false);
pdOther.setValue("visualUpdate", false);
pdOther.setShortDescription("user-defined-other");
pdOther.setValue("enumerationValues", new Object[]{
"TOP", 1, "javax.swing.SwingConstants.TOP"});
p[iOther] = pdOther;
} catch(IntrospectionException e) {
e.printStackTrace();
}
return p;
}