Java Code Examples for java.beans.PropertyDescriptor#setValue()

The following examples show how to use java.beans.PropertyDescriptor#setValue() . These examples are extracted from open source projects. 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
/**
 * See {@link java.beans.FeatureDescriptor}.
 */
public static void copyNonMethodProperties(PropertyDescriptor source, PropertyDescriptor target) {
	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());
}
 
Example 2
/**
 * See {@link java.beans.FeatureDescriptor}.
 */
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());
}
 
Example 3
/**
* Constructor which creates property group and creates UI for PlainTextConfigElement.
*/
public PlainTextConfigElementBeanInfo() {

    super(PlainTextConfigElement.class);

    //Create property group
    createPropertyGroup("plain_text_load_generator", new String[] {
            PLACE_HOLDER, JSON_SCHEMA
    });

    PropertyDescriptor placeHolderProps = property(PLACE_HOLDER);
    placeHolderProps.setValue(NOT_UNDEFINED, Boolean.TRUE);
    placeHolderProps.setValue(DEFAULT, PropsKeys.MSG_PLACEHOLDER);
    placeHolderProps.setValue(NOT_EXPRESSION, Boolean.TRUE);

    //Create inout Text Area
    PropertyDescriptor p = property(JSON_SCHEMA);
    p.setPropertyEditorClass(TextAreaEditor.class);
    p.setValue(NOT_UNDEFINED, Boolean.TRUE);
}
 
Example 4
Source Project: blog_demos   File: ExtendedBeanInfo.java    License: Apache License 2.0 6 votes vote down vote up
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());
}
 
Example 5
public AbstractBeanInfo() throws IntrospectionException {
    super(Abstract.class);
    for (PropertyDescriptor pd : getPropertyDescriptors()) {
        if (names.contains(pd.getName())) {
            pd.setValue("transient", Boolean.TRUE);
        }
    }
}
 
Example 6
public PropertyDescriptor[] getPropertyDescriptors() {
    try {
        PropertyDescriptor pdProperty = new PropertyDescriptor("property", SimpleBean.class, "getProperty", "setProperty");
        PropertyDescriptor pdNullable = new PropertyDescriptor("nullable", SimpleBean.class, null, null);
        PropertyDescriptor pdIndexed = new IndexedPropertyDescriptor("indexed", SimpleBean.class, null, null, null, null);
        pdNullable.setValue("name", "value");
        return new PropertyDescriptor[] {pdProperty, pdNullable, pdIndexed};
    }
    catch (IntrospectionException exception) {
        throw new Error(exception);
    }
}
 
Example 7
public AbstractBeanInfo() throws IntrospectionException {
    super(Abstract.class);
    for (PropertyDescriptor pd : getPropertyDescriptors()) {
        if (names.contains(pd.getName())) {
            pd.setValue("transient", Boolean.TRUE);
        }
    }
}
 
Example 8
public PropertyDescriptor[] getPropertyDescriptors() {
    try {
        PropertyDescriptor pdProperty = new PropertyDescriptor("property", SimpleBean.class, "getProperty", "setProperty");
        PropertyDescriptor pdNullable = new PropertyDescriptor("nullable", SimpleBean.class, null, null);
        PropertyDescriptor pdIndexed = new IndexedPropertyDescriptor("indexed", SimpleBean.class, null, null, null, null);
        pdNullable.setValue("name", "value");
        return new PropertyDescriptor[] {pdProperty, pdNullable, pdIndexed};
    }
    catch (IntrospectionException exception) {
        throw new Error(exception);
    }
}
 
Example 9
Source Project: hottub   File: Test7193977.java    License: GNU General Public License v2.0 5 votes vote down vote up
public AbstractBeanInfo() throws IntrospectionException {
    super(Abstract.class);
    for (PropertyDescriptor pd : getPropertyDescriptors()) {
        if (names.contains(pd.getName())) {
            pd.setValue("transient", Boolean.TRUE);
        }
    }
}
 
Example 10
public AbstractBeanInfo() throws IntrospectionException {
    super(Abstract.class);
    for (PropertyDescriptor pd : getPropertyDescriptors()) {
        if (names.contains(pd.getName())) {
            pd.setValue("transient", Boolean.TRUE);
        }
    }
}
 
Example 11
public PropertyDescriptor[] getPropertyDescriptors() {
    try {
        PropertyDescriptor pdProperty = new PropertyDescriptor("property", SimpleBean.class, "getProperty", "setProperty");
        PropertyDescriptor pdNullable = new PropertyDescriptor("nullable", SimpleBean.class, null, null);
        PropertyDescriptor pdIndexed = new IndexedPropertyDescriptor("indexed", SimpleBean.class, null, null, null, null);
        pdNullable.setValue("name", "value");
        return new PropertyDescriptor[] {pdProperty, pdNullable, pdIndexed};
    }
    catch (IntrospectionException exception) {
        throw new Error(exception);
    }
}
 
Example 12
public AbstractBeanInfo() throws IntrospectionException {
    super(Abstract.class);
    for (PropertyDescriptor pd : getPropertyDescriptors()) {
        if (names.contains(pd.getName())) {
            pd.setValue("transient", Boolean.TRUE);
        }
    }
}
 
Example 13
/**
 * Constructor which creates property group and creates UI for SerializedConfigElement.
 */
public SerializedConfigElementBeanInfo() {

    super(SerializedConfigElement.class);

    //Create Property group
    createPropertyGroup("serialized_load_generator", new String[] {
            PLACE_HOLDER, CLASS_NAME, OBJ_PROPERTIES
    });

    PropertyDescriptor placeHolderProps = property(PLACE_HOLDER);
    placeHolderProps.setValue(NOT_UNDEFINED, Boolean.TRUE);
    placeHolderProps.setValue(DEFAULT, PropsKeys.MSG_PLACEHOLDER);
    placeHolderProps.setValue(NOT_EXPRESSION, Boolean.TRUE);

    //Create table editor component of jmeter for class field and expression mapping
    TypeEditor tableEditor = TypeEditor.TableEditor;
    PropertyDescriptor tableProperties = property(OBJ_PROPERTIES, tableEditor);
    tableProperties.setValue(TableEditor.CLASSNAME, FieldExpressionMapping.class.getName());
    tableProperties.setValue(TableEditor.HEADERS, new String[]{ "Field Name", "Field Expression" } );
    tableProperties.setValue(TableEditor.OBJECT_PROPERTIES, new String[]{ FieldExpressionMapping.FIELD_NAME, FieldExpressionMapping.FIELD_EXPRESSION } );
    tableProperties.setValue(DEFAULT, new ArrayList<>());
    tableProperties.setValue(NOT_UNDEFINED, Boolean.TRUE);

    //Create class name input textfield
    PropertyDescriptor classNameProps = property(CLASS_NAME);
    classNameProps.setPropertyEditorClass(ClassPropertyEditor.class);
    classNameProps.setValue(NOT_UNDEFINED, Boolean.TRUE);
    classNameProps.setValue(DEFAULT, "<POJO class name>");

}
 
Example 14
public PropertyDescriptor[] getPropertyDescriptors() {
    try {
        PropertyDescriptor pdProperty = new PropertyDescriptor("property", SimpleBean.class, "getProperty", "setProperty");
        PropertyDescriptor pdNullable = new PropertyDescriptor("nullable", SimpleBean.class, null, null);
        PropertyDescriptor pdIndexed = new IndexedPropertyDescriptor("indexed", SimpleBean.class, null, null, null, null);
        pdNullable.setValue("name", "value");
        return new PropertyDescriptor[] {pdProperty, pdNullable, pdIndexed};
    }
    catch (IntrospectionException exception) {
        throw new Error(exception);
    }
}
 
Example 15
public PropertyDescriptor[] getPropertyDescriptors() {
    try {
        PropertyDescriptor pdProperty = new PropertyDescriptor("property", SimpleBean.class, "getProperty", "setProperty");
        PropertyDescriptor pdNullable = new PropertyDescriptor("nullable", SimpleBean.class, null, null);
        PropertyDescriptor pdIndexed = new IndexedPropertyDescriptor("indexed", SimpleBean.class, null, null, null, null);
        pdNullable.setValue("name", "value");
        return new PropertyDescriptor[] {pdProperty, pdNullable, pdIndexed};
    }
    catch (IntrospectionException exception) {
        throw new Error(exception);
    }
}
 
Example 16
public PropertyDescriptor[] getPropertyDescriptors() {
    try {
        PropertyDescriptor pdProperty = new PropertyDescriptor("property", SimpleBean.class, "getProperty", "setProperty");
        PropertyDescriptor pdNullable = new PropertyDescriptor("nullable", SimpleBean.class, null, null);
        PropertyDescriptor pdIndexed = new IndexedPropertyDescriptor("indexed", SimpleBean.class, null, null, null, null);
        pdNullable.setValue("name", "value");
        return new PropertyDescriptor[] {pdProperty, pdNullable, pdIndexed};
    }
    catch (IntrospectionException exception) {
        throw new Error(exception);
    }
}
 
Example 17
public PropertyDescriptor[] getPropertyDescriptors() {
    try {
        PropertyDescriptor pdProperty = new PropertyDescriptor("property", SimpleBean.class, "getProperty", "setProperty");
        PropertyDescriptor pdNullable = new PropertyDescriptor("nullable", SimpleBean.class, null, null);
        PropertyDescriptor pdIndexed = new IndexedPropertyDescriptor("indexed", SimpleBean.class, null, null, null, null);
        pdNullable.setValue("name", "value");
        return new PropertyDescriptor[] {pdProperty, pdNullable, pdIndexed};
    }
    catch (IntrospectionException exception) {
        throw new Error(exception);
    }
}
 
Example 18
public CassandraConnectionBeanInfo() {
    super(CassandraConnection.class);

    createPropertyGroup("varName", new String[] { "sessionName" });

    createPropertyGroup("cluster", new String[] { "contactPoints", "keyspace", "username", "password" });

    createPropertyGroup("loadbalancergroup", new String[] { "loadBalancer", "localDataCenter" });

    PropertyDescriptor p = property("contactPoints");
    p.setValue(NOT_UNDEFINED, Boolean.TRUE);
    p.setValue(DEFAULT, "");
    p = property("sessionName");
    p.setValue(NOT_UNDEFINED, Boolean.TRUE);
    p.setValue(DEFAULT, "");
    p = property("keyspace");
    p.setValue(NOT_UNDEFINED, Boolean.TRUE);
    p.setValue(DEFAULT, "");
    p = property("username");
    p.setValue(NOT_UNDEFINED, Boolean.TRUE);
    p.setValue(DEFAULT, "");
    p = property("password", TypeEditor.PasswordEditor);
    p.setValue(NOT_UNDEFINED, Boolean.TRUE);
    p.setValue(DEFAULT, "");

    p = property("loadBalancer"); // $NON-NLS-1$
    p.setValue(NOT_UNDEFINED, Boolean.TRUE);
    p.setValue(DEFAULT, CassandraConnection.DEFAULTLOADBALANCER);
    p.setValue(NOT_OTHER,Boolean.TRUE);
    p.setValue(TAGS,new String[]{
             CassandraConnection.ROUND_ROBIN,
             CassandraConnection.DC_AWARE_ROUND_ROBIN,
             CassandraConnection.DC_TOKEN_AWARE,
             CassandraConnection.WHITELIST,
             CassandraConnection.DEFAULTLOADBALANCER
    });

    p = property("localDataCenter");
    p.setValue(NOT_UNDEFINED, Boolean.TRUE);
    p.setValue(DEFAULT, "");
}
 
Example 19
/**
 *
 */
public CassandraTestElementBeanInfoSupport(Class<? extends TestBean> beanClass) {
    super(beanClass);

    createPropertyGroup("varName", // $NON-NLS-1$
            new String[]{"sessionName" }); // $NON-NLS-1$

    createPropertyGroup("cql", // $NON-NLS-1$
            new String[] {
            "queryType", // $NON-NLS-1$
            "query", // $NON-NLS-1$
            "queryArguments", // $NON-NLS-1$
            "variableNames", // $NON-NLS-1$
            "resultVariable", // $NON-NLS-1$
            "consistencyLevel", // $NON-NLS-1$
            "batchSize" // $NON-NLS-1$
            });

    PropertyDescriptor p = property("sessionName"); // $NON-NLS-1$
    p.setValue(NOT_UNDEFINED, Boolean.TRUE);
    p.setValue(DEFAULT, ""); // $NON-NLS-1$

    p = property("queryArguments"); // $NON-NLS-1$
    p.setValue(NOT_UNDEFINED, Boolean.TRUE);
    p.setValue(DEFAULT, ""); // $NON-NLS-1$

    p = property("variableNames"); // $NON-NLS-1$
    p.setValue(NOT_UNDEFINED, Boolean.TRUE);
    p.setValue(DEFAULT, ""); // $NON-NLS-1$

    p = property("resultVariable"); // $NON-NLS-1$
    p.setValue(NOT_UNDEFINED, Boolean.TRUE);
    p.setValue(DEFAULT, ""); // $NON-NLS-1$

    p = property("batchSize"); // $NON-NLS-1$
    p.setValue(NOT_UNDEFINED, Boolean.TRUE);
    p.setValue(DEFAULT, "");

    p = property("queryType"); // $NON-NLS-1$
    p.setValue(NOT_UNDEFINED, Boolean.TRUE);
    p.setValue(DEFAULT, AbstractCassandaTestElement.SIMPLE);
    p.setValue(NOT_OTHER,Boolean.TRUE);
    p.setValue(TAGS,new String[]{
            AbstractCassandaTestElement.SIMPLE,
            AbstractCassandaTestElement.PREPARED,
            AbstractCassandaTestElement.DYNAMIC_BATCH
            });

    p = property("consistencyLevel"); // $NON-NLS-1$
    p.setValue(NOT_UNDEFINED, Boolean.TRUE);
    p.setValue(DEFAULT, "ONE");
    p.setValue(NOT_OTHER,Boolean.TRUE);
    p.setValue(TAGS,new String[]{
            AbstractCassandaTestElement.ANY,
            AbstractCassandaTestElement.ONE,
            AbstractCassandaTestElement.QUORUM,
            AbstractCassandaTestElement.TWO,
            AbstractCassandaTestElement.THREE,
            AbstractCassandaTestElement.ALL,
            AbstractCassandaTestElement.LOCAL_ONE,
            AbstractCassandaTestElement.LOCAL_QUORUM,
            AbstractCassandaTestElement.EACH_QUORUM
    });

    p = property("query", TypeEditor.TextAreaEditor); // $NON-NLS-1$
    p.setValue(NOT_UNDEFINED, Boolean.TRUE);
    p.setValue(DEFAULT, ""); // $NON-NLS-1$
    p.setValue(TEXT_LANGUAGE, "sql");  // $NON-NLS-1$

}
 
Example 20
@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;
}