public class BeanUtilsBindingProcessor extends Object implements AdvancedWidgetProcessor<JComponent,SwingMetawidget>, BindingConverter
Note: BeanUtils does not bind actions, such as invoking a method when a
JButton is pressed. For that, see ReflectionBindingProcessor and
MetawidgetActionStyle or SwingAppFrameworkActionStyle.
| Constructor and Description |
|---|
BeanUtilsBindingProcessor() |
BeanUtilsBindingProcessor(BeanUtilsBindingProcessorConfig config) |
| Modifier and Type | Method and Description |
|---|---|
Object |
convertFromString(String value,
Class<?> expectedType)
Convert the given String to the given expected type, if possible.
|
void |
onEndBuild(SwingMetawidget metawidget)
Event called at the end of widget building, after all widgets have been built and added to
the
Layout. |
void |
onStartBuild(SwingMetawidget metawidget)
Event called at the start of the widget building process, before the
WidgetBuilder is called. |
JComponent |
processWidget(JComponent component,
String elementName,
Map<String,String> attributes,
SwingMetawidget metawidget)
Process the given widget.
|
void |
rebind(Object toRebind,
SwingMetawidget metawidget)
Rebinds the Metawidget to the given Object.
|
protected Object |
retrieveValueFromWidget(org.metawidget.swing.widgetprocessor.binding.beanutils.BeanUtilsBindingProcessor.SavedBinding binding) |
void |
save(SwingMetawidget metawidget) |
protected void |
saveValueToObject(SwingMetawidget metawidget,
String names,
Object componentValue)
Save the given value into the given source at the location specified by the given names.
|
protected void |
saveValueToWidget(org.metawidget.swing.widgetprocessor.binding.beanutils.BeanUtilsBindingProcessor.SavedBinding binding,
Object sourceValue) |
public BeanUtilsBindingProcessor()
public BeanUtilsBindingProcessor(BeanUtilsBindingProcessorConfig config)
public void onStartBuild(SwingMetawidget metawidget)
AdvancedWidgetProcessorWidgetBuilder is called. WidgetProcessors may wish to act on this
event to initialize themselves ready for processing. This event is only called once per
inspection, not once per widget built.onStartBuild in interface AdvancedWidgetProcessor<JComponent,SwingMetawidget>metawidget - the parent Metawidget. Never nullpublic JComponent processWidget(JComponent component, String elementName, Map<String,String> attributes, SwingMetawidget metawidget)
WidgetProcessorWidgetBuilder, and before it is added to the Layout.processWidget in interface WidgetProcessor<JComponent,SwingMetawidget>component - the widget to process. Never nullelementName - XML node name of the business field. Typically 'entity', 'property' or 'action'.
Never nullattributes - attributes of the widget to process. Never null. This Map is modifiable - changes
will be passed to subsequent WidgetProcessors and Layoutsmetawidget - the parent Metawidget. Never nullpublic void rebind(Object toRebind, SwingMetawidget metawidget)
This method is an optimization that allows clients to load a new object into the binding without calling setToInspect, and therefore without reinspecting the object or recreating the components. It is the client's responsbility to ensure the rebound object is compatible with the original setToInspect.
public void save(SwingMetawidget metawidget)
public Object convertFromString(String value, Class<?> expectedType)
BindingConverterconvertFromString in interface BindingConverterpublic void onEndBuild(SwingMetawidget metawidget)
AdvancedWidgetProcessorLayout. WidgetProcessors may wish to act on this event to clean
themselves up after processing. This event is only called once per inspection, not once per
widget built.onEndBuild in interface AdvancedWidgetProcessor<JComponent,SwingMetawidget>metawidget - the parent Metawidget. Never nullprotected void saveValueToObject(SwingMetawidget metawidget, String names, Object componentValue) throws Exception
Clients may override this method to incorporate their own setter convention.
componentValue - the raw value from the JComponentExceptionprotected Object retrieveValueFromWidget(org.metawidget.swing.widgetprocessor.binding.beanutils.BeanUtilsBindingProcessor.SavedBinding binding) throws Exception
ExceptionCopyright © 2015. All Rights Reserved.