Declare that widgets of type TWidget can be used to directly
render or update objects of type TData.
Declare that widgets of type TWidget can be used to directly
render or update objects of type TData. The caller must supply two
functions to manage the mechanics of the shuffling:
a showFunc to update a TWidget from the state of a TData,
and an updateFunc to update a TData into a TWidget.
TWidget must be a subclass of android.preference.Preference;
Views will be supported too, which is why the typechecker doesn't
enforce this.
Declare that widgets of type TWidget can be used to render
or set properties of type TProp.
Declare that widgets of type TWidget can be used to render
or set properties of type TProp. The caller must supply two
functions to manage the mechanics of the shuffling:
a readFunc to get a TProp out of a TWidget,
and a writeFunc to put a TProp into a TWidget.
TWidget must be a subclass of android.preference.Preference;
or android.view.View.
The default behavior is specified as follows; declarations for other types may be specified similarly, often in a subclass constructor:
bindProperties[ EditTextPreference, String ](
(_.getText), (_.setText( _ )))
bindProperties[ CheckBoxPreference, Boolean ](
(_.isChecked), (_.setChecked( _ )))
bindProperties[ TextView, String ](
(_.getText.toString), (_.setText( _ )))
bindProperties[ CheckBox, Boolean ](
(_.isChecked), (_.setChecked( _ )))
Get Some of a UiBinder that can be used to mediate between 'widget' and 'object' (or some appropriately chosen property), or none.
Get Some of a UiBinder that can be used to mediate between 'widget' and 'object' (or some appropriately chosen property), or none.
Update an Android View (or ViewGroup) based on
the properties of the object toShow.
Update an Android View (or ViewGroup) based on
the properties of the object toShow.
A ViewGroup is handled by iterating over its members. (If
those contain nested ViewGroups, we iterate over their members
too.) Otherwise, we proceed as follows:
If a binder has been declared for the particular View type
and the class of toShow (q.v. bind), then it is used to handle
the data transfer. Otherwise, if the View has been bound
to a particular property type with bindProperties, and if toShow
is a org.postronicnet.util.ReflectiveProperties object, we
attempt to get the name corresponding to the view's ID
(viz. org.positronicnet.ui.ResourceId), and look for an
appropriate property of that name.
XXX not working:
If we can't find any relevant declared UI Binding, and the supplied
view is a TextView, we effectively do view.setText(toShow.toString).
A TextView that is the child of a supplied ViewGroup does not get
this treatment, to leave labels and the like in a complex layout of
some kind undisturbed. Note that unlike for preferences, a child
View with no binder declared will just be ignored.
Update an Android Preference (or PreferenceGroup) based on
the properties of the object toShow.
Update an Android Preference (or PreferenceGroup) based on
the properties of the object toShow.
A PreferenceGroup is handled by iterating over its members. (If
those contain nested PreferenceGroups, we iterate over their members
too.) Otherwise, we proceed as follows:
If a binder has been declared for the particular Preference type
and the class of toShow (q.v. bind), then it is used to handle
the data transfer. Otherwise, if the Preference has been bound
to a particular property type with bindProperties, and if toShow
is a org.postronicnet.util.ReflectiveProperties object, we look
for a property of that type named by the Preference's key
(viz. getKey).
Otherwise, if we can't find a relevant declared UI Binding, a NoBinderFor exception is thrown at runtime.
Use an Android View (or ViewGroup) to produce
an updated version of the ReflectiveProperties
object toUpdate.
Use an Android View (or ViewGroup) to produce
an updated version of the ReflectiveProperties
object toUpdate.
A ViewGroup is handled by iterating over its members. (If
those contain nested ViewGroups, we iterate over their members
too.) Otherwise, we proceed as follows:
If a binder has been declared for the particular View type
and the class of toShow (q.v. bind), then it is used to handle
the data transfer. Otherwise, if the View has been bound
to a particular property type with bindProperties, and if toShow
is a org.postronicnet.util.ReflectiveProperties object, we look
for a property of that type named by the View's key
(viz. getKey).
Properties not named by any View are left unaltered.
Use an Android Preference (or PreferenceGroup) to produce
an updated version of the ReflectiveProperties
object toUpdate.
Use an Android Preference (or PreferenceGroup) to produce
an updated version of the ReflectiveProperties
object toUpdate.
A PreferenceGroup is handled by iterating over its members. (If
those contain nested PreferenceGroups, we iterate over their members
too.) Otherwise, we proceed as follows:
If a binder has been declared for the particular Preference type
and the class of toShow (q.v. bind), then it is used to handle
the data transfer. Otherwise, if the Preference has been bound
to a particular property type with bindProperties, and if toShow
is a org.postronicnet.util.ReflectiveProperties object, we look
for a property of that type named by the Preference's key
(viz. getKey).
Properties not named by any Preference are left unaltered.
Class that helps shuffle data between properties of ReflectiveProperties objects and Android user interface widgets. Each widget has a particular type of property that it can handle; a
CheckBoxPreferencecan handleBooleanproperties, anEditTextPreferencecan handleStringproperties, and so forth.Actual shuffling is done by calling the
showandupdatemethods of a UiBinder, which was builg with this org.positronicnet.ui.PropertyBinder as the argument to its constructor.