public abstract class BeanConfigurable<T> extends java.lang.Object implements UnnamedConfigurable, ConfigurableWithOptionDescriptors
ConfigurableBuilder for UiDslConfigurable alternative.| Modifier | Constructor and Description |
|---|---|
protected |
BeanConfigurable(T beanInstance) |
protected |
BeanConfigurable(T beanInstance,
java.lang.String title) |
| Modifier and Type | Method and Description |
|---|---|
void |
apply()
Stores the settings from the Swing form to the configurable component.
|
protected void |
checkBox(java.lang.String title,
<any> prop) |
protected void |
checkBox(java.lang.String title,
Getter<java.lang.Boolean> getter,
Setter<java.lang.Boolean> setter)
Adds check box with given
title. |
protected void |
checkBox(java.lang.String fieldName,
java.lang.String title)
Deprecated.
use
checkBox(String, Getter, Setter) instead |
protected <V> void |
component(javax.swing.JComponent component,
Getter<? extends V> beanGetter,
Setter<? super V> beanSetter,
Getter<? extends V> componentGetter,
Setter<? super V> componentSetter)
Adds custom component (e.g.
|
javax.swing.JComponent |
createComponent()
Creates new Swing form that enables user to configure the settings.
|
protected T |
getInstance() |
java.util.List<OptionDescription> |
getOptionDescriptors(java.lang.String configurableId,
java.util.function.Function<? super java.lang.String,java.lang.String> nameConverter) |
java.lang.String |
getTitle() |
boolean |
isModified()
Indicates whether the Swing form was modified or not.
|
void |
reset()
Loads the settings from the configurable component to the Swing form.
|
protected void |
setTitle(java.lang.String title) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcancel, disposeUIResourcesprotected BeanConfigurable(T beanInstance)
protected BeanConfigurable(T beanInstance, java.lang.String title)
public java.lang.String getTitle()
protected void setTitle(java.lang.String title)
protected T getInstance()
@Deprecated
protected void checkBox(java.lang.String fieldName,
java.lang.String title)
checkBox(String, Getter, Setter) insteadprotected void checkBox(java.lang.String title,
Getter<java.lang.Boolean> getter,
Setter<java.lang.Boolean> setter)
title.
Initial checkbox value is obtained from getter.
After the apply, the value from the check box is written back to model via setter.protected void checkBox(java.lang.String title,
<any> prop)
protected <V> void component(javax.swing.JComponent component,
Getter<? extends V> beanGetter,
Setter<? super V> beanSetter,
Getter<? extends V> componentGetter,
Setter<? super V> componentSetter)
beanGetter and applied to the component via componentSetter.
E.g. text is read from the model and set to the edit box.
After the apply, the value from the component is queried via componentGetter and written back to model via beanSetter.
E.g. text from the edit box is queried and saved back to model bean.public java.util.List<OptionDescription> getOptionDescriptors(java.lang.String configurableId, java.util.function.Function<? super java.lang.String,java.lang.String> nameConverter)
getOptionDescriptors in interface ConfigurableWithOptionDescriptorspublic javax.swing.JComponent createComponent()
UnnamedConfigurableAlso this place is designed to allocate resources (subscriptions/listeners etc.)
createComponent in interface UnnamedConfigurablenull if it cannot be createdUnnamedConfigurable.disposeUIResources()public boolean isModified()
UnnamedConfigurableisModified in interface UnnamedConfigurabletrue if the settings were modified, false otherwisepublic void apply()
throws ConfigurationException
UnnamedConfigurableapply in interface UnnamedConfigurableConfigurationException - if values cannot be appliedpublic void reset()
UnnamedConfigurablereset in interface UnnamedConfigurable