|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.kalmeo.kuix.core.model.DataProvider
public class DataProvider
This class represent the base object of the Kuix data model.
A DataProvider
help you to organize data model to interact with
widgets.
You can customize returns value by overriding the
getUserDefinedValue
function.
Since 1.0.1, you can create a tree of dataproviders by adding
dataproviders as slave of an other. in this case, the getValue
function could returns a value from the dataprovider itself if it exists of
from its slaves.
dispatchUpdateEvent
and dispatchItemsUpdateEvent
methods invoke rescursivly each dataprovider's masters.
Field Summary | |
---|---|
static byte |
ADD_AFTER_MODEL_UPDATE_EVENT_TYPE
|
static byte |
ADD_BEFORE_MODEL_UPDATE_EVENT_TYPE
|
static byte |
ADD_MODEL_UPDATE_EVENT_TYPE
|
static byte |
CLEAR_MODEL_UPDATE_EVENT_TYPE
|
static byte |
FILTER_MODEL_UPDATE_EVENT_TYPE
|
static byte |
REMOVE_MODEL_UPDATE_EVENT_TYPE
|
static byte |
SORT_MODEL_UPDATE_EVENT_TYPE
|
Constructor Summary | |
---|---|
DataProvider()
|
Method Summary | |
---|---|
int |
addItem(java.lang.String property,
DataProvider item)
Add the item to the property items list. |
int |
addItem(java.lang.String property,
DataProvider item,
DataProvider referenceItem,
boolean after)
Add the item to the property items list by
placing it after or before the referenceItem according to
the after parameter. |
void |
addSlave(DataProvider slaveDataProvider)
Add a slave DataProvider to this DataProvider . |
void |
bind(Widget widget)
Bind the widget to this DataProvider . |
int |
compareTo(LinkedListItem item,
int flag)
|
boolean |
contains(java.lang.String property,
DataProvider item)
Search a LinkedListItem in LinkedList and return
true if it's in. |
int |
countItemValues(java.lang.String property)
Returns the count of items assocayed with the specified property . |
protected void |
dispatchItemsUpdateEvent(byte type,
java.lang.String property,
DataProvider item,
LinkedListEnumeration itemsEnumeration)
Dispatch an items update event for a specific property to all
binded widgets. |
protected void |
dispatchUpdateEvent(java.lang.String property)
Dispatch an update event for a specific property to all
binded widgets. |
LinkedListEnumeration |
enumerateItems(java.lang.String property,
boolean useFilter)
Returns the LinkedListEnumeration instance or null
if no value is associated with this property . |
DataProvider |
getFirstItem(java.lang.String property)
Returns the first DataProvider item of the property
items list or null if the list is empty or doesn't exists. |
LinkedList |
getItemsValue(java.lang.String property)
Returns the property associated items value, or null if
the property has no value or value is not a LinkedList . |
DataProvider |
getLastItem(java.lang.String property)
Returns the last DataProvider item of the property
items list or null if the list is empty or doesn't exists. |
LinkedListItem |
getNext()
|
LinkedListItem |
getPrevious()
|
java.lang.String |
getStringValue(java.lang.String property)
Returns the property associated string value, or null if
the property has no value or value is not a string. |
protected java.lang.Object |
getUserDefinedValue(java.lang.String property)
Returns the user defined value corresponding the given property . |
java.lang.Object |
getValue(java.lang.String property)
Returns the value (user defined values and items values) corresponding the given property . |
void |
removeAllItems(java.lang.String property)
Remove all items from the property items list. |
void |
removeAllSlaves()
Remove all DataProvider slaves of this instance. |
void |
removeFromMaster(DataProvider masterDataProvider)
Remove this DataProvider from a specific master. |
void |
removeFromMasters()
Remove this DataProvider from its masters. |
int |
removeItem(java.lang.String property,
DataProvider item)
Remove the item from the property items
list. |
void |
removeSlave(DataProvider slaveDataProvider)
Remove the slaveDataProvider instance from this
DataProvider slaves. |
void |
setItemsFilter(java.lang.String property,
Filter filter)
Filter property items list. |
void |
setNext(LinkedListItem next)
|
void |
setPrevious(LinkedListItem previous)
|
void |
sortItems(java.lang.String property,
int flag)
Sort property items list. |
void |
unbind(Widget widget)
Unbind the widget from this DataProvider . |
void |
unbindAll()
Unbind all widgets from this DataProvider . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final byte ADD_MODEL_UPDATE_EVENT_TYPE
public static final byte ADD_BEFORE_MODEL_UPDATE_EVENT_TYPE
public static final byte ADD_AFTER_MODEL_UPDATE_EVENT_TYPE
public static final byte REMOVE_MODEL_UPDATE_EVENT_TYPE
public static final byte SORT_MODEL_UPDATE_EVENT_TYPE
public static final byte FILTER_MODEL_UPDATE_EVENT_TYPE
public static final byte CLEAR_MODEL_UPDATE_EVENT_TYPE
Constructor Detail |
---|
public DataProvider()
Method Detail |
---|
public LinkedListItem getNext()
public LinkedListItem getPrevious()
public void setNext(LinkedListItem next)
public void setPrevious(LinkedListItem previous)
public void addSlave(DataProvider slaveDataProvider)
DataProvider
to this DataProvider
.
slaveDataProvider
- public void removeSlave(DataProvider slaveDataProvider)
slaveDataProvider
instance from this
DataProvider
slaves.
slaveDataProvider
- public void removeAllSlaves()
DataProvider
slaves of this instance.
public void removeFromMaster(DataProvider masterDataProvider)
DataProvider
from a specific master.
masterDataProvider
- public void removeFromMasters()
DataProvider
from its masters.
public final java.lang.Object getValue(java.lang.String property)
property
.
property
-
property
.protected java.lang.Object getUserDefinedValue(java.lang.String property)
property
.
property
.public java.lang.String getStringValue(java.lang.String property)
property
associated string value, or null if
the property has no value or value is not a string.
property
-
public LinkedList getItemsValue(java.lang.String property)
property
associated items value, or null if
the property has no value or value is not a LinkedList
.getValue
because it returns a unique
LinkedList
instance by property instead of a new
LinkedListEnumeration
each time the method is called.
property
-
LinkedList
value, or null if the property has no
value or value is not a LinkedList
.public int countItemValues(java.lang.String property)
property
.
property
-
property
public DataProvider getFirstItem(java.lang.String property)
DataProvider
item of the property
items list or null
if the list is empty or doesn't exists.
property
-
DataProvider
itempublic DataProvider getLastItem(java.lang.String property)
DataProvider
item of the property
items list or null
if the list is empty or doesn't exists.
property
-
DataProvider
itempublic LinkedListEnumeration enumerateItems(java.lang.String property, boolean useFilter)
LinkedListEnumeration
instance or null
if no value is associated with this property
. If a filter
is associated with this property
and
useFilter
is set to true
, the enumeration
use it.
property
- useFilter
-
LinkedListEnumeration
instance or null
if no value is associated with this property
.public int addItem(java.lang.String property, DataProvider item)
item
to the property
items list.
property
- item
-
-1
if adding is
faild.public int addItem(java.lang.String property, DataProvider item, DataProvider referenceItem, boolean after)
item
to the property
items list by
placing it after or before the referenceItem
according to
the after
parameter. If item
is
null
nothing append and -1
is returned.
property
- item
- referenceItem
- after
-
-1
if adding is
faild.public int removeItem(java.lang.String property, DataProvider item)
item
from the property
items
list.
property
- item
-
-1
if removing is
faild.public void removeAllItems(java.lang.String property)
property
items list.
property
- public boolean contains(java.lang.String property, DataProvider item)
LinkedListItem
in LinkedList
and return
true
if it's in. The value linked to property
must be a LinkedList
.
property
- the property where item
may be founditem
- the LinkedListItem
to search
true
if item
exist in
LinkedList
property
, false
else.public void sortItems(java.lang.String property, int flag)
property
items list.
property
- flag
- public void setItemsFilter(java.lang.String property, Filter filter)
property
items list.
property
- filter
- the Filter
to apply to the enumeration. Set it null to retrieve all items of the enumerationpublic void bind(Widget widget)
widget
to this DataProvider
.
widget
- public void unbind(Widget widget)
widget
from this DataProvider
.
widget
- public void unbindAll()
DataProvider
.
protected void dispatchUpdateEvent(java.lang.String property)
property
to all
binded widgets.
property
- protected void dispatchItemsUpdateEvent(byte type, java.lang.String property, DataProvider item, LinkedListEnumeration itemsEnumeration)
property
to all
binded widgets.
type
- property
- item
- itemsEnumeration
- public int compareTo(LinkedListItem item, int flag)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |