Observable
ObservableBoolean
Events:
- Updated (OldValue As Boolean, NewValue As Boolean)
Functions:
- AddObserver (EventPrefix As String)
Adds an Updated event trigger. The event is triggered whenever the value of this Observable changes.
The created observer is local to the current Activity.
- Bind (View As android.view.View)
Associates a view with this Observable so that any change of value updates the following view property:
- Checked for CheckBoxes, RadioButtons and ToggleButtons;
- Text for Buttons, EditTexts and Labels.
Raises a Runtime exception if the view type is not supported or a ClassCast exception if the view property does not accept a boolean value.
- DeleteObserver (EventPrefix As String)
Removes the Updated event trigger that uses the specified prefix in the current Activity.
- Initialize (EventPrefix As String)
Creates an Observable with a Boolean type value. Any change to this value will trigger an Updated event with the specified prefix.
- IsInitialized As Boolean
- NotifyObservers (OldValue As Object, NewValue As Object)
Triggers the Updated events and updates the views associated with this Observable.
- Unbind (View As android.view.View)
Stops updating the specified view with the value of this Observable.
Properties:
- Value As Boolean
Gets or sets the boolean value of this Observable.
ObservableByte
Events:
- Updated (OldValue As Byte, NewValue As Byte)
Functions:
- AddObserver (EventPrefix As String)
Adds an Updated event trigger. The event is triggered whenever the value of this Observable changes.
The created observer is local to the current Activity.
- Bind (View As android.view.View)
Associates a view with this Observable so that any change of value updates the following view property:
- Position for ListViews;
- Progress for ProgressBars;
- SelectedIndex for Spinners;
- Text for Buttons, CheckBoxes, EditTexts, Labels, RadioButtons and ToggleButtons;
- Value for SeekBars.
Raises a Runtime exception if the view type is not supported.
- DeleteObserver (EventPrefix As String)
Removes the Updated event trigger that uses the specified prefix in the current Activity.
- Initialize (EventPrefix As String)
Creates an Observable with a Byte type value. Any change to this value will trigger an Updated event with the specified prefix.
- IsInitialized As Boolean
- NotifyObservers (OldValue As Object, NewValue As Object)
Triggers the Updated events and updates the views associated with this Observable.
- Unbind (View As android.view.View)
Stops updating the specified view with the value of this Observable.
Properties:
- Value As Byte
Gets or sets the byte value of this Observable.
ObservableDouble
Events:
- Updated (OldValue As Double, NewValue As Double)
Functions:
- AddObserver (EventPrefix As String)
Adds an Updated event trigger. The event is triggered whenever the value of this Observable changes.
The created observer is local to the current Activity.
- Bind (View As android.view.View)
Associates a view with this Observable so that any change of value updates the following view property:
- Position for ListViews;
- Progress for ProgressBars;
- SelectedIndex for Spinners;
- Text for Buttons, CheckBoxes, EditTexts, Labels, RadioButtons and ToggleButtons;
- Value for SeekBars.
Raises a Runtime exception if the view type is not supported.
- DeleteObserver (EventPrefix As String)
Removes the Updated event trigger that uses the specified prefix in the current Activity.
- Initialize (EventPrefix As String)
Creates an Observable with a Double type value. Any change to this value will trigger an Updated event with the specified prefix.
- IsInitialized As Boolean
- NotifyObservers (OldValue As Object, NewValue As Object)
Triggers the Updated events and updates the views associated with this Observable.
- Unbind (View As android.view.View)
Stops updating the specified view with the value of this Observable.
Properties:
- Value As Double
Gets or sets the value of this Observable.
ObservableField
Events:
- ReadFromDB (ID As Object) As Object
- Updated (OldValue As Object, NewValue As Object)
- WriteToDB (Value As Object) As Boolean
Functions:
- AddObserver (EventPrefix As String)
Adds an Updated event trigger. The event is triggered whenever the value of this Observable changes.
The created observer is local to the current Activity.
- Bind (View As android.view.View)
Associates a view with this Observable so that any change of value updates a view property depending on the value type (e.g. a boolean value updates the Checked property of a CheckBox while a String value updates the Text property).
Raises a Runtime exception if the view type is not supported.
- DeleteObserver (EventPrefix As String)
Removes the Updated event trigger that uses the specified prefix in the current Activity.
- GetValueForID (ID As Object) As Object
Sets the ID of this Observable and returns the corresponding value.
For a list, ID is the position in the list.
For a map, ID is either the position in the list if ID is numeric, or the key if ID is not numeric.
For a database field, ID is the unique identifier of the record in the table.
- InitializeWithDBTable (SQL As SQL, Table As String, Field As String, Where As String, EventPrefix As String)
Creates an Observable for the specified field in a DB table. Any change to the value of this field or to the Observable ID will trigger an Updated event with the specified prefix.
Please note that any change made by means other than those provided by this class will not be detected and notified by an event.
SQL: The SQL object to access the database. It must be initialized (i.e. the database must be opened) before calling other functions of this class.
Table: The table name in the database.
Field: The field name in the DB table.
Where: The condition of the SQL Where clause. Put a question mark instead of the value to be replaced by the ID (e.g. "RowID=?").
- InitializeWithDBTable2 (ReaderSub As String, WriterSub As String, EventPrefix As String)
Creates an Observable for a field in a DB table. Any change to the value of this field or to the Observable ID will trigger an Updated event with the specified prefix.
Please note that any change made by means other than those provided by this class will not be detected and notified by an event.
ReaderSub: The name of the function to call to read the field value in the appropriate DB table. This function has to be declared like this: Function_Name(ID As Object) As Object. The field value is expected in return.
WriterSub: The name of the function to call to update the field value in the appropriate DB table. This function has to be declared like this: Function_Name(Value As Object) As Boolean. It has to return True if the operation is successful.
- InitializeWithList (List As ObservableList, EventPrefix As String)
Creates an Observable for an item in a list. Any change to this item or to the Observable ID (i.e. the position in the list) will trigger an Updated event with the specified prefix.
- InitializeWithMap (Map As ObservableMap, EventPrefix As String)
Creates an Observable for a Key/Value pair in a Map. Any change to the value of this pair or to the Observable ID will trigger an Updated event with the specified prefix.
- IsInitialized As Boolean
- NotifyObservers (OldValue As Object, NewValue As Object)
Triggers the Updated events and updates the views associated with this Observable.
- Unbind (View As android.view.View)
Stops updating the specified view with the value of this Observable.
Properties:
- ID As Object
Gets or sets the ID used to select the value of this Observable.
For a list, ID is the position in the list.
For a map, ID is either the position in the list if ID is numeric, or the key if ID is not numeric.
For a database field, ID is the unique identifier of the record in the table.
- Tag As Object
Gets or sets the Tag value. It can be used to store additional data.
- Value As Object
ObservableFloat
Events:
- Updated (OldValue As Float, NewValue As Float)
Functions:
- AddObserver (EventPrefix As String)
Adds an Updated event trigger. The event is triggered whenever the value of this Observable changes.
The created observer is local to the current Activity.
- Bind (View As android.view.View)
Associates a view with this Observable so that any change of value updates the following view property:
- Position for ListViews;
- Progress for ProgressBars;
- SelectedIndex for Spinners;
- Text for Buttons, CheckBoxes, EditTexts, Labels, RadioButtons and ToggleButtons;
- Value for SeekBars.
Raises a Runtime exception if the view type is not supported.
- DeleteObserver (EventPrefix As String)
Removes the Updated event trigger that uses the specified prefix in the current Activity.
- Initialize (EventPrefix As String)
Creates an Observable with a Float type value. Any change to this value will trigger an Updated event with the specified prefix.
- IsInitialized As Boolean
- NotifyObservers (OldValue As Object, NewValue As Object)
Triggers the Updated events and updates the views associated with this Observable.
- Unbind (View As android.view.View)
Stops updating the specified view with the value of this Observable.
Properties:
- Value As Float
Gets or sets the value of this Observable.
ObservableInteger
Events:
- Updated (OldValue As Int, NewValue As Int)
Functions:
- AddObserver (EventPrefix As String)
Adds an Updated event trigger. The event is triggered whenever the value of this Observable changes.
The created observer is local to the current Activity.
- Bind (View As android.view.View)
Associates a view with this Observable so that any change of value updates the following view property:
- Position for ListViews;
- Progress for ProgressBars;
- SelectedIndex for Spinners;
- Text for Buttons, CheckBoxes, EditTexts, Labels, RadioButtons and ToggleButtons;
- Value for SeekBars.
Raises a Runtime exception if the view type is not supported.
- DeleteObserver (EventPrefix As String)
Removes the Updated event trigger that uses the specified prefix in the current Activity.
- Initialize (EventPrefix As String)
Creates an Observable with an Int type value. Any change to this value will trigger an Updated event with the specified prefix.
- IsInitialized As Boolean
- NotifyObservers (OldValue As Object, NewValue As Object)
Triggers the Updated events and updates the views associated with this Observable.
- Unbind (View As android.view.View)
Stops updating the specified view with the value of this Observable.
Properties:
- Value As Int
Gets or sets the integer value of this Observable.
ObservableList
Events:
- Added (Item As Object, Index As Int)
- Cleared
- Removed (Item As Object, Index As Int)
- Sorted
- Updated (Item As Object, Index As Int)
Functions:
- Add (Item As Object)
- AddAll (List As List)
- AddAllAt (Index As Int, List As List)
- AddObserver (EventPrefix As String)
Adds event triggers using the specified prefix. The events (Added, Cleared, Removed, Sorted and Updated) are triggered when the list content is modified.
The created observer is local to the current Activity.
- Clear
- DeleteObserver (EventPrefix As String)
Removes the event triggers that use the specified prefix in the current Activity.
- Get (arg0 As Int) As Object
- IndexOf (arg0 As Object) As Int
- Initialize (EventPrefix As String)
Initializes a List whose modification will trigger an event (Added, Cleared, Removed, Sorted or Updated) with the specified prefix.
- Initialize2 (Array As List, EventPrefix As String)
Initializes a List whose modification will trigger an event (Cleared, Sorted or Updated) with the specified prefix.
The list is filled with the given values. Its size is fixed so you cannot add or remove items later.
- InsertAt (Index As Int, Item As Object)
- IsInitialized As Boolean
- RemoveAt (Index As Int)
- Set (Index As Int, Item As Object)
- Sort (Ascending As Boolean)
- SortCaseInsensitive (Ascending As Boolean)
- SortType (FieldName As String, Ascending As Boolean)
- SortTypeCaseInsensitive (FieldName As String, Ascending As Boolean)
Properties:
ObservableLong
Events:
- Updated (OldValue As Long, NewValue As Long)
Functions:
- AddObserver (EventPrefix As String)
Adds an Updated event trigger. The event is triggered whenever the value of this Observable changes.
The created observer is local to the current Activity.
- Bind (View As android.view.View)
Associates a view with this Observable so that any change of value updates the following view property:
- Position for ListViews;
- Progress for ProgressBars;
- SelectedIndex for Spinners;
- Text for Buttons, CheckBoxes, EditTexts, Labels, RadioButtons and ToggleButtons;
- Value for SeekBars.
Raises a Runtime exception if the view type is not supported.
- DeleteObserver (EventPrefix As String)
Removes the Updated event trigger that uses the specified prefix in the current Activity.
- Initialize (EventPrefix As String)
Creates an Observable with a Long type value. Any change to this value will trigger an Updated event with the specified prefix.
- IsInitialized As Boolean
- NotifyObservers (OldValue As Object, NewValue As Object)
Triggers the Updated events and updates the views associated with this Observable.
- Unbind (View As android.view.View)
Stops updating the specified view with the value of this Observable.
Properties:
- Value As Long
Gets or sets the value of this Observable.
ObservableMap
Events:
- Added (Key As Object, Value As Object)
- Cleared
- Removed (Key As Object, Value As Object)
- Updated (Key As Object, Value As Object)
Functions:
- AddObserver (EventPrefix As String)
Adds event triggers using the specified prefix. The events (Added, Cleared, Removed and Updated) are triggered when the Map content is modified.
The created observer is local to the current Activity.
- Clear
- ContainsKey (arg0 As Object) As Boolean
- DeleteObserver (EventPrefix As String)
Removes the event triggers that use the specified prefix in the current Activity.
- Get (arg0 As Object) As Object
- GetDefault (arg0 As Object, arg1 As Object) As Object
- GetKeyAt (arg0 As Int) As Object
- GetValueAt (arg0 As Int) As Object
- Initialize (EventPrefix As String)
Initializes a Map whose modification will trigger an event (Added, Cleared, Removed or Updated) with the specified prefix.
- IsInitialized As Boolean
- Keys As IterableList
- Put (Key As Object, Value As Object) As Object
- Remove (Key As Object) As Object
- Values As IterableList
Properties:
ObservableObject
Events:
- Updated (OldValue As Object, NewValue As Object)
Functions:
- AddObserver (EventPrefix As String)
Adds an Updated event trigger. The event is triggered whenever the value of this Observable changes.
The created observer is local to the current Activity.
- Bind (View As android.view.View)
Associates a view with this Observable so that any change of value updates a view property depending on the value type (e.g. a boolean value updates the Checked property of a CheckBox while a String value updates the Text property).
Raises a Runtime exception if the view type is not supported.
- DeleteObserver (EventPrefix As String)
Removes the Updated event trigger that uses the specified prefix in the current Activity.
- Initialize (EventPrefix As String)
Creates an Observable with an Object type value. Any change to this value will trigger an Updated event with the specified prefix.
- IsInitialized As Boolean
- NotifyObservers (OldValue As Object, NewValue As Object)
Triggers the Updated events and updates the views associated with this Observable.
- Unbind (View As android.view.View)
Stops updating the specified view with the value of this Observable.
Properties:
- Value As Object
Gets or sets the value of this Observable.
ObservableRecord
Events:
- Updated (OldRecord As Map, NewRecord As ObservableMap)
Functions:
- AddObserver (EventPrefix As String)
Adds an Updated event trigger. The event is triggered whenever the content of the record of this Observable is changed.
The created observer is local to the current Activity.
- Bind (ViewMap As Map)
Associates views with this Observable so that any change of a field value updates a view property depending on the value type (e.g. a boolean value updates the Checked property of a CheckBox while a String value updates the Text property).
ViewMap: A Map that contains the views to update when the record data of this Observable changes (keys: field names, values: views).
Raises a Runtime exception if the view type is not supported.
- Delete
Deletes the record of this Observable, then resets the current Selection.
- DeleteObserver (EventPrefix As String)
Removes the Updated event trigger that uses the specified prefix in the current Activity.
- Initialize (SQL As SQL, Table As String, EventPrefix As String)
Creates an Observable for an existing record in the given DB table. Modifying the content of this record will trigger an Updated event with the specified prefix.
Please note that any change made by means other than those provided by this class will not be detected and notified by an event.
SQL: The SQL object to access the database. It must be initialized (i.e. the database must be opened) before calling other functions of this class.
Table: The table name in the database.
- InitializeWithNewRecord (SQL As SQL, Table As String, RecordMap As Map, EventPrefix As String) As Long
Creates an Observable for a record to insert into the given DB table. Modifying later the content of this record will trigger an Updated event with the specified prefix.
Returns the rowid value of the inserted record.
Please note that any change made by means other than those provided by this class will not be detected and notified by an event.
SQL: The SQL object to access the database. It must be initialized (i.e. the database must be opened).
Table: The table name in the database.
RecordMap: A Map that contains the fields of the new record (keys: field names, values: field values).
- IsInitialized As Boolean
- NotifyObservers (OldValue As Object, NewValue As Object)
Triggers the Updated events and updates the views associated with this Observable.
- Query As ObservableMap
Retrieves the record of this Observable from the database using the current Selection.
Returns an ObservableMap whose the keys are the field names and the values the field values. Any change to this Map will update immediately the record in the database according to the Selection settings.
- Unbind
Stops updating the views associated with this Observable.
- Update (UpdateMap As Map)
Updates the record of this Observable in the database using the current Selection.
UpdateMap: A Map that contains the fields to update (keys: field names, values: field values).
Properties:
- Selection As ObservableRecordSelection
Gets or sets the fields to be retrieved with Query, the condition of the SQL Where clause (with a question mark instead of the values to be replaced) and the condition values.
When a new Selection is set, Query is automatically called.
- Tag As Object
Gets or sets the Tag value. It can be used to store additional data.
- Value As ObservableMap [read only]
The record returned by this function is the last known state of the record of this Observable after calling functions such as Query or Update. It may be different from the record in the database if it has since been modified by some other means.
Any change to the returned ObservableMap will update immediately the record in the database according to the Selection settings.
ObservableRecordSelection
Fields:
- QueryFields As String
- WhereCondition As String
- WhereValues As String()
ObservableShort
Events:
- Updated (OldValue As Short, NewValue As Short)
Functions:
- AddObserver (EventPrefix As String)
Adds an Updated event trigger. The event is triggered whenever the value of this Observable changes.
The created observer is local to the current Activity.
- Bind (View As android.view.View)
Associates a view with this Observable so that any change of value updates the following view property:
- Position for ListViews;
- Progress for ProgressBars;
- SelectedIndex for Spinners;
- Text for Buttons, CheckBoxes, EditTexts, Labels, RadioButtons and ToggleButtons;
- Value for SeekBars.
Raises a Runtime exception if the view type is not supported.
- DeleteObserver (EventPrefix As String)
Removes the Updated event trigger that uses the specified prefix in the current Activity.
- Initialize (EventPrefix As String)
Creates an Observable with a Short type value. Any change to this value will trigger an Updated event with the specified prefix.
- IsInitialized As Boolean
- NotifyObservers (OldValue As Object, NewValue As Object)
Triggers the Updated events and updates the views associated with this Observable.
- Unbind (View As android.view.View)
Stops updating the specified view with the value of this Observable.
Properties:
- Value As Short
Gets or sets the value of this Observable.
ObservableString
Events:
- Updated (OldValue As String, NewValue As String)
Functions:
- AddObserver (EventPrefix As String)
Adds an Updated event trigger. The event is triggered whenever the value of this Observable changes.
The created observer is local to the current Activity.
- Bind (View As android.view.View)
Associates a view with this Observable so that any change of value updates the following view property:
- Position for ListViews;
- Progress for ProgressBars;
- SelectedIndex for Spinners;
- Text for Buttons, CheckBoxes, EditTexts, Labels, RadioButtons and ToggleButtons;
- Value for SeekBars.
Raises a Runtime exception if the view type is not supported.
- DeleteObserver (EventPrefix As String)
Removes the Updated event trigger that uses the specified prefix in the current Activity.
- Initialize (EventPrefix As String)
Creates an Observable with a String type value. Any change to this value will trigger an Updated event with the specified prefix.
- IsInitialized As Boolean
- NotifyObservers (OldValue As Object, NewValue As Object)
Triggers the Updated events and updates the views associated with this Observable.
- Unbind (View As android.view.View)
Stops updating the specified view with the value of this Observable.
Properties:
- Value As String
Gets or sets the value of this Observable.
Author: F. Leneuf-Magaud/Informatix