Example usage for java.beans BeanDescriptor setValue

List of usage examples for java.beans BeanDescriptor setValue

Introduction

In this page you can find the example usage for java.beans BeanDescriptor setValue.

Prototype

public void setValue(String attributeName, Object value) 

Source Link

Document

Associate a named attribute with this feature.

Usage

From source file:com.twinsoft.convertigo.beans.core.MySimpleBeanInfo.java

@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);
    }/*from   ww w . j  a va 2  s .c o  m*/
    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;
}

From source file:org.apache.jmeter.testbeans.gui.TestBeanGUI.java

/**
 * Setup GUI class/*from  w  ww.ja  v a 2 s.com*/
 * @param menuCategories List<String> menu categories
 * @return number of matches
 */
private int setupGuiClasses(List<String> menuCategories) {
    int matches = 0;// How many classes can we assign from?
    // TODO: there must be a nicer way...
    BeanDescriptor bd = beanInfo.getBeanDescriptor();
    if (Assertion.class.isAssignableFrom(testBeanClass)) {
        menuCategories.add(MenuFactory.ASSERTIONS);
        bd.setValue(TestElement.GUI_CLASS, AbstractAssertionGui.class.getName());
        matches++;
    }
    if (ConfigElement.class.isAssignableFrom(testBeanClass)) {
        menuCategories.add(MenuFactory.CONFIG_ELEMENTS);
        bd.setValue(TestElement.GUI_CLASS, AbstractConfigGui.class.getName());
        matches++;
    }
    if (Controller.class.isAssignableFrom(testBeanClass)) {
        menuCategories.add(MenuFactory.CONTROLLERS);
        bd.setValue(TestElement.GUI_CLASS, AbstractControllerGui.class.getName());
        matches++;
    }
    if (Visualizer.class.isAssignableFrom(testBeanClass)) {
        menuCategories.add(MenuFactory.LISTENERS);
        bd.setValue(TestElement.GUI_CLASS, AbstractVisualizer.class.getName());
        matches++;
    }
    if (PostProcessor.class.isAssignableFrom(testBeanClass)) {
        menuCategories.add(MenuFactory.POST_PROCESSORS);
        bd.setValue(TestElement.GUI_CLASS, AbstractPostProcessorGui.class.getName());
        matches++;
    }
    if (PreProcessor.class.isAssignableFrom(testBeanClass)) {
        menuCategories.add(MenuFactory.PRE_PROCESSORS);
        bd.setValue(TestElement.GUI_CLASS, AbstractPreProcessorGui.class.getName());
        matches++;
    }
    if (Sampler.class.isAssignableFrom(testBeanClass)) {
        menuCategories.add(MenuFactory.SAMPLERS);
        bd.setValue(TestElement.GUI_CLASS, AbstractSamplerGui.class.getName());
        matches++;
    }
    if (Timer.class.isAssignableFrom(testBeanClass)) {
        menuCategories.add(MenuFactory.TIMERS);
        bd.setValue(TestElement.GUI_CLASS, AbstractTimerGui.class.getName());
        matches++;
    }
    return matches;
}