|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.dynamide.db.DatasourceHelper
public class DatasourceHelper
| Field Summary |
|---|
| Fields inherited from interface com.dynamide.db.IDatasource |
|---|
AFTER, BEFORE, BEFORE_FIRST, BEGIN, END, ROW_COUNT_NOT_ALLOWED, ROW_INDEX_UNKNOWN |
| Constructor Summary | |
|---|---|
DatasourceHelper(IDatasourceBasic datasource)
|
|
| Method Summary | |
|---|---|
void |
cancel()
|
void |
clear()
|
java.lang.String |
dumpErrorsHTML()
|
java.lang.Object |
get(java.lang.String what)
Method to work with things like WebMacro, that automatically call Foo.get("bar") when you invoke $foo.bar if foo is of class Foo. |
int |
getCurrentRowIndex()
The zero-based index of the current row: single-row implementations can always return 0, implementations that don't support row indices should return IDatasource.ROW_INDEX_UNKNOWN; |
IDatasourceBasic |
getDatasource()
|
IDatasource |
getDatasourceHelper()
By default, simply return a reference to "this", since the implementing class is an instance of IDatasource. |
Field |
getField(java.lang.String fieldName)
If you want a String value, try get(String). |
Field |
getField(java.lang.String fieldName,
java.lang.String fieldIndex)
This class can support indexed Fields, by any arbitrary String index, which will for tabular datasets, be the zero-based row index; however the index can be any valid string which could itself be a search specifier that is used by this method. |
java.util.Map |
getFields()
|
java.lang.String |
getID()
A unique name within the Application for this datasource, it becomes the ID by which Widgets can discover the datasource. |
Property |
getProperty(java.lang.String propertyName)
Rather than having a complicated interface to IDatasource, specialized behaviors can be set/retrieved using setProperty/getProperty, for example, "isMultiRowEditable". |
int |
getRowCount()
The row count of the current dataset, or IDatasource.ROW_COUNT_NOT_ALLOWED if the operation is not supported. |
boolean |
go(int distance)
go(0) should go to the first row in the set, if supported, go(-1) should go back a row, if supported, go(1) should go forward a row if supported, go(IDatasource.END) should go to the last row in the set, leaving the last row active, that is, not after the last row, and all unsupported actions should simply be no-ops. |
boolean |
insertRow(int index)
|
boolean |
isReadOnly()
Updateable datasets should return false. |
boolean |
isRowCountAllowed()
Report if calling getRowCount() will be allowed. |
java.util.Iterator |
iterator()
Return an Iterator which knows how to properly iterate over your implementation. |
void |
onRowChanged()
Provides notification that a seek or go operation has occured. |
boolean |
post()
If isReadOnly() returns false, and the underlying data can be updated, return true. |
void |
reload()
|
boolean |
seek(int zeroBasedIndex)
Jump to the absolute zero based index. |
boolean |
seekBegin()
|
boolean |
seekEnd()
|
void |
setFieldValue(java.lang.String fieldName,
java.lang.Object value)
The editable Dynamide Widgets can use this to modify the underlying Fields. |
boolean |
setFieldValue(java.lang.String fieldName,
java.lang.Object value,
java.lang.String fieldIndex)
Optional operation: Dynamide Widgets can use this to modify the underlying datasource if the datasource supports indexed Fields. |
void |
setProperty(java.lang.String name,
java.lang.String value)
Rather than having a complicated interface to IDatasource, specialized behaviors can be set/retrieved using setProperty/getProperty, for example, "isMultiRowEditable". |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DatasourceHelper(IDatasourceBasic datasource)
| Method Detail |
|---|
public IDatasourceBasic getDatasource()
public IDatasource getDatasourceHelper()
IDatasource
getDatasourceHelper in interface IDatasourcegetDatasourceHelper in interface IDatasourceBasicIDatasourceBasicpublic java.util.Iterator iterator()
IDatasourceBasic
public class MyClass implements IDatasourceBasic{
public class MyDatasourceIterator implements Iterator {
private MyClass m_target;
private int m_iterCount = 0;
public SessionDatasourceIterator(MyClass target){
m_target = target;
}
public Object next(){
m_iterCount++;
return m_target;
}
public boolean hasNext(){
return (m_iterCount < 1);
}
public void remove(){
throw new UnsupportedOperationException();
}
}
}
iterator in interface IDatasourceiterator in interface IDatasourceBasicIDatasourceBasic.iterator()public java.lang.String getID()
IDatasource
getID in interface IDatasourcegetID in interface IDatasourceBasicpublic Field getField(java.lang.String fieldName)
getField in interface IDatasourcegetField in interface IDatasourceBasic
public Field getField(java.lang.String fieldName,
java.lang.String fieldIndex)
IDatasource
getField in interface IDatasource
public java.lang.Object get(java.lang.String what)
throws java.lang.Exception
IDatasource
get in interface IDatasourceget in interface IDatasourceBasicjava.lang.Exception
public Property getProperty(java.lang.String propertyName)
throws java.lang.Exception
IDatasource
getProperty in interface IDatasourcejava.lang.ExceptionIDatasource.get(String)
public void setProperty(java.lang.String name,
java.lang.String value)
throws DatatypeException
IDatasource
setProperty in interface IDatasourceDatatypeExceptionpublic java.util.Map getFields()
getFields in interface IDatasourcegetFields in interface IDatasourceBasicpublic java.lang.String dumpErrorsHTML()
dumpErrorsHTML in interface IDatasource
public void setFieldValue(java.lang.String fieldName,
java.lang.Object value)
throws DatatypeException
IDatasource
setFieldValue in interface IDatasourceDatatypeException
public boolean setFieldValue(java.lang.String fieldName,
java.lang.Object value,
java.lang.String fieldIndex)
IDatasource
setFieldValue in interface IDatasourcepublic boolean isReadOnly()
IDatasource
isReadOnly in interface IDatasourcepublic boolean post()
IDatasource
post in interface IDatasourcepublic void cancel()
cancel in interface IDatasource
public void reload()
throws java.lang.Exception
reload in interface IDatasourcejava.lang.Exceptionpublic void clear()
clear in interface IDatasourcepublic boolean go(int distance)
IDatasource
go in interface IDatasourcepublic boolean seekBegin()
seekBegin in interface IDatasourcepublic boolean seekEnd()
seekEnd in interface IDatasourcepublic boolean seek(int zeroBasedIndex)
IDatasource
seek in interface IDatasourcepublic boolean insertRow(int index)
insertRow in interface IDatasourceindex - Is one of IDatasource.BEGIN, IDatasource.END, IDatasource.AFTER, IDatasource.BEFORE
or is an absolute index the new row will occupy. For examle, if there is one row in the dataset,
then insertRow(0) would insert the new row at index 0, before the current row, while insertRow(1)
would place the new row at index 1, after the current row. IDatasource.AFTER would place the
new row after the current row, regardless of absolute index, and IDatasource.BEFORE would place the row
before the current row.
public boolean isRowCountAllowed()
IDatasource
isRowCountAllowed in interface IDatasourcepublic int getRowCount()
IDatasource
getRowCount in interface IDatasourcepublic int getCurrentRowIndex()
IDatasource
getCurrentRowIndex in interface IDatasourcepublic void onRowChanged()
IDatasource
onRowChanged in interface IDatasource
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||