public class ReflectionBindingProcessor extends Object implements AdvancedWidgetProcessor<JComponent,SwingMetawidget>
This is the typical Swing approach to binding UI buttons to Java objects using
AbstractActions
and reflection.
Constructor and Description |
---|
ReflectionBindingProcessor() |
Modifier and Type | Method and Description |
---|---|
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.
|
public void onStartBuild(SwingMetawidget metawidget)
AdvancedWidgetProcessor
WidgetBuilder
is called. WidgetProcessor
s 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)
WidgetProcessor
WidgetBuilder
, 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 onEndBuild(SwingMetawidget metawidget)
AdvancedWidgetProcessor
Layout
. WidgetProcessor
s 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 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.
Copyright © 2015. All Rights Reserved.