Class MetawidgetBinder
java.lang.Object
microsim.gui.shell.parameter.MetawidgetBinder
- All Implemented Interfaces:
org.metawidget.iface.Immutable, org.metawidget.swing.widgetprocessor.binding.BindingConverter, org.metawidget.widgetprocessor.iface.AdvancedWidgetProcessor<JComponent, org.metawidget.swing.SwingMetawidget>, org.metawidget.widgetprocessor.iface.WidgetProcessor<JComponent, org.metawidget.swing.SwingMetawidget>
public class MetawidgetBinder
extends Object
implements org.metawidget.widgetprocessor.iface.AdvancedWidgetProcessor<JComponent, org.metawidget.swing.SwingMetawidget>, org.metawidget.swing.widgetprocessor.binding.BindingConverter
Property binding implementation based on BeanUtils.
This implementation recognizes the following
SwingMetawidget.setParameter
parameters:
propertyStyle- eitherPROPERTYSTYLE_JAVABEAN(default) orPROPERTYSTYLE_SCALA(for Scala-style getters and setters).
Note: BeanUtils does not bind actions, such as invoking
a method when a
JButton is pressed. For that, see
ReflectionBindingProcessor and
MetawidgetActionStyle or
SwingAppFrameworkActionStyle.
- Author:
- Richard Kennard, Stefan Ackermann
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconvertFromString(String value, Class<?> expectedType) voidonEndBuild(org.metawidget.swing.SwingMetawidget metawidget) voidonStartBuild(org.metawidget.swing.SwingMetawidget metawidget) processWidget(JComponent component, String elementName, Map<String, String> attributes, org.metawidget.swing.SwingMetawidget metawidget) voidRebinds the Metawidget to the given Object.protected ObjectretrieveValueFromObject(org.metawidget.swing.SwingMetawidget metawidget, Object source, String names) Retrieve value identified by the given names from the given source.protected ObjectretrieveValueFromWidget(microsim.gui.shell.parameter.MetawidgetBinder.SavedBinding binding) voidsave(org.metawidget.swing.SwingMetawidget metawidget) protected voidsaveValueToObject(org.metawidget.swing.SwingMetawidget metawidget, String names, Object componentValue) Save the given value into the given source at the location specified by the given names.protected voidsaveValueToWidget(microsim.gui.shell.parameter.MetawidgetBinder.SavedBinding binding, Object sourceValue)
-
Constructor Details
-
MetawidgetBinder
public MetawidgetBinder()
-
-
Method Details
-
onStartBuild
public void onStartBuild(org.metawidget.swing.SwingMetawidget metawidget) - Specified by:
onStartBuildin interfaceorg.metawidget.widgetprocessor.iface.AdvancedWidgetProcessor<JComponent, org.metawidget.swing.SwingMetawidget>
-
processWidget
public JComponent processWidget(JComponent component, String elementName, Map<String, String> attributes, org.metawidget.swing.SwingMetawidget metawidget) - Specified by:
processWidgetin interfaceorg.metawidget.widgetprocessor.iface.WidgetProcessor<JComponent, org.metawidget.swing.SwingMetawidget>
-
rebind
Rebinds the Metawidget to the given Object.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.
-
save
public void save(org.metawidget.swing.SwingMetawidget metawidget) -
convertFromString
-
onEndBuild
public void onEndBuild(org.metawidget.swing.SwingMetawidget metawidget) - Specified by:
onEndBuildin interfaceorg.metawidget.widgetprocessor.iface.AdvancedWidgetProcessor<JComponent, org.metawidget.swing.SwingMetawidget>
-
retrieveValueFromObject
protected Object retrieveValueFromObject(org.metawidget.swing.SwingMetawidget metawidget, Object source, String names) throws Exception Retrieve value identified by the given names from the given source.Clients may override this method to incorporate their own getter convention.
- Parameters:
metawidget- Metawidget to retrieve value from- Throws:
Exception
-
saveValueToObject
protected void saveValueToObject(org.metawidget.swing.SwingMetawidget metawidget, String names, Object componentValue) throws Exception Save the given value into the given source at the location specified by the given names.Clients may override this method to incorporate their own setter convention.
- Parameters:
componentValue- the raw value from theJComponent- Throws:
Exception
-
retrieveValueFromWidget
-
saveValueToWidget
-