|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectandroid.widget.BaseAdapter
com.sibvisions.android.widget.DataBookAdapter
public class DataBookAdapter
The DataBookAdapter is a BaseAdapter which gets data from an IDataBook
implementation. It supports ListView and Spinner.
The adapter uses the first primary key column to identify the item. Ensure that the primary key column
is set.
The display values will be read from the table columns of the databook. If you didn't specify special
column view resource ids, then the first column of the table columns will be set into the first found view
(Text, Image, Checkbox).
If you specified the column view resource ids, then the columns out of the table columns will be used in the
same order as the column view resource ids were set.
true, false, Y, N or J
| Nested Class Summary | |
|---|---|
static interface |
DataBookAdapter.ValueFormatter
The ValueFormatter allows changing the value before it will be set to a view. |
| Field Summary |
|---|
| Fields inherited from interface android.widget.Adapter |
|---|
IGNORE_ITEM_VIEW_TYPE, NO_SELECTION |
| Fields inherited from interface android.widget.Adapter |
|---|
IGNORE_ITEM_VIEW_TYPE, NO_SELECTION |
| Constructor Summary | |
|---|---|
DataBookAdapter(Context pContext,
IDataBook pDataBook,
int pLayout)
Creates a new instance of DataBookAdapter for a specific context and layout. |
|
| Method Summary | |
|---|---|
protected void |
bindView(View pView,
int pPosition)
Binds an existing view to the data pointed to by databook. |
void |
cancelEditing()
|
protected View |
createDropDownView(ViewGroup pParent)
Creates a new dropdown view to hold the data pointed to by databook. |
protected View |
createView(ViewGroup pParent)
Creates a new view to hold the data pointed to by databook. |
int[] |
getColumnViewResources()
Gets the resource ids of views which should be filled with values from the databook. |
protected Context |
getContext()
Gets the applications global information. |
int |
getCount()
|
IDataBook |
getDataBook()
Gets the databook. |
View |
getDropDownView(int pPosition,
View pConvertView,
ViewGroup pParent)
|
IChangeableDataRow |
getItem(int pPosition)
|
long |
getItemId(int pPosition)
|
TranslationMap |
getTranslation()
|
DataBookAdapter.ValueFormatter |
getValueFormatter()
Gets the current value formatter. |
View |
getView(int pPosition,
View pConvertView,
ViewGroup pParent)
|
void |
notifyRepaint()
|
void |
saveEditing()
|
void |
setColumnViewResources(int[] pViewResourceIds)
Sets the resource ids of views which should be filled with values from the databook. |
void |
setDataBook(IDataBook pDataBook)
Sets the databook and updates the dataset. |
void |
setDropDownViewResource(int pLayoutDropDown)
Sets the layout resource of the drop down views. |
void |
setTranslation(TranslationMap pTranslation)
|
void |
setValueFormatter(DataBookAdapter.ValueFormatter pFormatter)
Sets the formatter to change values before they will be set to a view. |
void |
setViewResource(int pLayout)
Sets the layout resource of the item views. |
| Methods inherited from class android.widget.BaseAdapter |
|---|
areAllItemsEnabled, getItemViewType, getViewTypeCount, hasStableIds, isEmpty, isEnabled, notifyDataSetChanged, notifyDataSetInvalidated, registerDataSetObserver, unregisterDataSetObserver |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DataBookAdapter(Context pContext,
IDataBook pDataBook,
int pLayout)
DataBookAdapter for a specific context and layout.
pContext - interface to application's global informationpDataBook - the databookpLayout - the item layout| Method Detail |
|---|
public void notifyRepaint()
notifyRepaint in interface IControlpublic void saveEditing()
saveEditing in interface IControlpublic void cancelEditing()
cancelEditing in interface IControlpublic void setTranslation(TranslationMap pTranslation)
setTranslation in interface IControlpublic TranslationMap getTranslation()
getTranslation in interface IControlpublic int getCount()
getCount in interface Adapterpublic IChangeableDataRow getItem(int pPosition)
getItem in interface Adapterpublic long getItemId(int pPosition)
getItemId in interface Adapter
public View getView(int pPosition,
View pConvertView,
ViewGroup pParent)
getView in interface Adapter
public View getDropDownView(int pPosition,
View pConvertView,
ViewGroup pParent)
getDropDownView in interface SpinnerAdaptergetDropDownView in class BaseAdapterpublic void setDataBook(IDataBook pDataBook)
pDataBook - the databook or null to unset the databookpublic IDataBook getDataBook()
null if no databook is setpublic void setViewResource(int pLayout)
pLayout - the layout resources used to create item viewspublic void setDropDownViewResource(int pLayoutDropDown)
pLayoutDropDown - the layout resources used to create drop down viewsprotected Context getContext()
protected View createView(ViewGroup pParent)
pParent - the parent to which the new view is attached to
protected View createDropDownView(ViewGroup pParent)
pParent - the parent to which the new view is attached to
public void setColumnViewResources(int[] pViewResourceIds)
pViewResourceIds - the resource ids within a layoutpublic int[] getColumnViewResources()
protected void bindView(View pView,
int pPosition)
pView - existing view, returned earlier by createViewpPosition - the row of the databookpublic void setValueFormatter(DataBookAdapter.ValueFormatter pFormatter)
pFormatter - the formatter or null to unsetpublic DataBookAdapter.ValueFormatter getValueFormatter()
null if no formatter will be used
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||