use of java.beans.Customizer in project ACS by ACS-Community.
the class BeanNode method getCustomizer.
/**
* Returns the customizer component.
* @return the component or <code>null</code> if there is no customizer
*/
public java.awt.Component getCustomizer() {
Class clazz = _beanInfo.getBeanDescriptor().getCustomizerClass();
if (clazz == null)
return null;
Object o;
try {
o = clazz.newInstance();
} catch (InstantiationException e) {
exception(e);
return null;
} catch (IllegalAccessException e) {
exception(e);
return null;
}
if (!(o instanceof Customizer))
return null;
Customizer cust = ((java.beans.Customizer) o);
attachCustomizer(this, cust);
// looking for the component
java.awt.Component comp = null;
if (o instanceof java.awt.Component) {
comp = (java.awt.Component) o;
} else {
// create the dialog from descriptor
comp = createDialog(o);
}
if (comp == null) {
// no component provided
return null;
}
cust.setObject(_bean);
if (!_guiUpdater.hasRegisteredListenerInternal()) {
cust.addPropertyChangeListener(new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent e) {
firePropertyChange(e.getPropertyName(), e.getOldValue(), e.getNewValue());
}
});
}
return comp;
}
use of java.beans.Customizer in project jmeter by apache.
the class TestBeanGUI method setValues.
/**
* Get values from element to fill propertyMap and setup customizer
* @param element TestElement
*/
private void setValues(TestElement element) {
// Copy all property values into the map:
for (PropertyIterator jprops = element.propertyIterator(); jprops.hasNext(); ) {
JMeterProperty jprop = jprops.next();
propertyMap.put(jprop.getName(), jprop.getObjectValue());
}
if (customizer != null) {
customizer.setObject(propertyMap);
} else {
if (initialized) {
remove(customizerIndexInPanel);
}
Customizer c = customizers.get(element);
if (c == null) {
c = createCustomizer();
c.setObject(propertyMap);
customizers.put(element, c);
}
add((Component) c, BorderLayout.CENTER);
}
}
Aggregations