|
||||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |
java.lang.Objectjp.littlesoft.data.Table<E>
public class Table<E extends Serializable>
表データクラス。
表構造のデータを格納する為のオブジェクトです。
単純な2次元配列と異なる点は、データ項目の型や、その他の属性をColumnクラスによって定義できる点です。
また、データ項目値の設定、取得の他、行の追加、削除、並び替え、フィルタなど数多くのメソッドが用意されています。
Column
,
Params
,
直列化された形式入れ子のクラスの概要 | |
---|---|
static class |
Table.SortKey
SortKeyクラス。 |
フィールドの概要 | |
---|---|
protected Params<E> |
_params
表に付属するパラメータを格納する Params オブジェクトです。 |
E |
$$
エンティティのダミーオブジェクト. |
protected boolean |
active
Table オブジェクトの状態を表します。 |
protected IndexedMap<String,Column> |
columns
Column オブジェクトの集合です。 |
E |
entity
カーソル行のエンティティオブジェクトへのショートカット. |
E |
params
パラメータとして使用するエンティティオブジェクト. |
コンストラクタの概要 | |
---|---|
Table(E... e)
Table オブジェクトを生成します. |
メソッドの概要 | |
---|---|
void |
activate()
Table オブジェクトをアクティブ化します。 |
void |
addChangeListener(ChangeListener l)
Table オブジェクトへの変更を監視する ChangeListener オブジェクトを登録します。 |
void |
addColumn(Column column)
カラムの追加(作成したオブジェクトを登録)します。 |
Column |
addColumn(String fieldName)
カラムの追加(名前で作成)します。 |
Column |
addColumn(String fieldName,
Column.Type type)
カラムの追加(名前とタイプを指定して作成)します。 |
void |
addColumns(String[] names)
カラムの追加(名前配列で作成)します。 |
void |
addTableListener(TableListener l)
TableListenerの登録します。 |
Collection<E> |
allEntities()
内部にある全てのエンティティオブジェクトのコレクションを取得します。 |
Collection<Row<E>> |
allRows()
内部にある全ての行オブジェクトのコレクションを取得します。 |
Row<E> |
appendRow()
行を追加します。 |
Row<E> |
appendRow(E entity)
行を追加します。 |
void |
applyFilter()
Tableにフィルターを適用する指示を行います。 |
void |
applySortFilter(Table.SortKey[] sortKeys)
Tableにフィルターを適用する指示を行うと同時にその結果をソートします。 |
void |
cancelUpdates(boolean initial)
行に対する変更、行追加をキャンセルします。 |
protected void |
checkActive()
Table オブジェクトの状態チェックし、アクティブでなかったらアクティブ化します。 |
protected void |
checkDeactive()
アクティブ時にしてはいけない事をした場合の例外処理を実装します。 |
int[] |
checkDuplicate(String[] columnNameArray)
指定したColumnの重複値チェックを行います。 |
int[] |
checkDuplicate(String[] columnNameArray,
int rowIndex)
指定したColumnの重複値チェックを行います。 |
boolean |
checkMoreRow(boolean toLast)
追加行が存在するかどうかを調べます。 |
void |
clearColumns()
全カラムを削除します。 |
void |
deleteAllRows()
すべての行を削除します。 |
void |
deleteRow()
現在行を削除します。 |
protected void |
doLoadData()
データのロードを行います。 |
protected void |
doSetupColumn(IndexedMap<String,Column> fields)
DataFieldのセットアップを行います。 |
protected void |
fireAfterSetValue(ChangeEvent e)
項目値更新直後イベントを送出します。 |
protected void |
fireBeforeSetValue(ChangeEvent e)
項目値更新直前イベントを送出します。 |
void |
fireDataChanged(TableEvent<E> e,
TableEvent.Operation operation)
DataChangeイベントの送出をします。 |
protected void |
fireOnActivate(ChangeEvent e)
アクティブ化イベントを送出します。 |
protected void |
fireOnColumnSetup(ChangeEvent e)
フィールド構築イベントを送出します。 |
protected void |
fireOnPassivate(ChangeEvent e)
非アクティブ化イベントを送出します。 |
void |
fireRowDeleting(TableEvent<E> e)
rowDeletingイベントを送出します。 |
boolean |
fireRowFiltering(TableEvent<E> e)
rowFilteringイベントを送出します。 |
void |
fireRowValidating(TableEvent<E> e)
rowValidatingイベントを送出します。 |
boolean |
first()
行カーソルを先頭に移動します。 |
int |
getAllRowCount()
全体の行数を取得します。 |
Class[] |
getCaptionResource()
列の見出し(Columnクラスのcaptionプロパティ)に設定するリソースクラスの配列を取得します。 |
String |
getCharsetForCheckingLength()
文字列項目の長さチェックを行う際の文字コードセット名を取得します。 |
Column |
getColumn(int index)
引数 index で指定された列インデックスから Column オブジェクトを取得します。 |
Column |
getColumn(Object $dummyFiled)
|
Column |
getColumn(String columnName)
引数 columnName で指定されたカラム名から Column オブジェクトを取得します。 |
Column |
getColumn(String columnName,
boolean returnNull)
引数 columnName で指定されたカラム名から Column オブジェクトを取得します。 |
Column[] |
getColumnArray()
Column オブジェクトを配列で取得します。 |
int |
getColumnCount()
フィールド数を取得します。 |
IndexedMap<String,Column> |
getColumns()
Row オブジェクト構造を定義するカラム集合を取得します。 |
DataProvider |
getDataProvider()
表にデータを供給する DataProvider オブジェクトを取得します。 |
DataResolver |
getDataResolver()
表のデータをDBや外部ファイルに書き出す DataResolver オブジェクトを取得します。 |
E |
getEntity()
カーソル行のエンティティオブジェクトを取得します。 |
E |
getEntity(int rowIndex)
引数 rowIndex にカーソルを移動し、エンティティオブジェクトを取得します。 |
Class<E> |
getEntityType()
データ値を格納するクラスを指定します。 |
String |
getName()
Table オブジェクトの名称を取得します。 |
boolean[] |
getNullables()
Nullable属性の配列を取得します。 |
Params<E> |
getParams()
パラメータセットを取得します。 |
Row<E> |
getRow()
カーソル行の Row オブジェクトを取得します。 |
Row<E> |
getRow(int rowIndex)
引数 rowIndex で指定された Row オブジェクトを取得します。 |
int |
getRowCount()
行数を取得します。 |
Row.RowID |
getRowID(int rowIndex)
行インデックスを指定して、RowIDを取得します。 |
int |
getRowIndex()
現在の行カーソル位置を取得します。 |
Table.SortKey[] |
getSortKeys()
ソート用のフィールド名配列を取得します。 |
boolean |
inBounds()
行カーソルが有効範囲内にあるかどうか調べます。 |
int |
indexOf(E entity)
エンティティオブジェクトの行インデックスを取得します. |
int |
indexOf(Row<E> row)
Rowオブジェクトの行インデックスを取得します. |
int |
indexOfColumn(Column column)
指定した列オブジェクトのインデックスを取得します。 |
int |
indexOfColumn(String columnName)
引数 columnName で指定されたフィールド名から列インデックスを取得します。 |
int |
indexOfDBColumnName(String name)
指定した列のデータベース項目名(DBColumnName)でインデックスを取得します。 |
int |
indexOfRow(Row<E> row)
指定した行オブジェクトのインデックスを取得します。 |
Row<E> |
insertRow(int index)
行を挿入します。 |
Row<E> |
insertRow(int index,
E entity)
エンティティオブジェクトを行を挿入します。 |
protected void |
internalFree()
deActiveの時の後始末を行います。 |
boolean |
internalMoveTo(int index)
引数 index で指定されたインデックスへ行カーソルを移動します。 |
protected void |
internalOnActivate()
アクティブ時の内部設定を実装します。 |
Row.RowID |
internalPut(Row<E> row)
行オブジェクトを内部テーブルに登録します。 |
boolean |
internalPut(Row<E> row,
boolean visible,
boolean insert)
自分が使う行テーブルの登録します。 |
void |
internalRemove(Row.RowID rowID)
RowIDを指定して内部テーブルから行オブジェクトを削除します。 |
protected void |
internalSetup()
内部データのセットアップします。 |
boolean |
isActive()
Table オブジェクトがアクティブ化された状態かどうか調べます。 |
boolean |
isApplyFilter()
フィルターが適用中であるかどうかを取得します。 |
boolean |
isHasMoreRow()
setMaxRowsで設定した件数よりも実際に発行したSQLで取得できるレコードが存在するか否かを取得します。 |
boolean |
isTypedRow()
|
boolean |
last()
行カーソルを最終行へ移動します。 |
boolean |
moveTo(int index)
引数 index で指定されたインデックスへ行カーソルを移動します。 |
boolean |
next()
行カーソルを1行次へ移動します。 |
void |
passivate()
Table オブジェクトを非アクティブ化します。 |
boolean |
previous()
行カーソルを1行前へ移動します。 |
void |
releaseFilter()
Tableにフィルターを解除する指示を行います。 |
void |
releaseFilter(boolean doneFilter)
Tableにフィルターを解除する指示を行います。 |
void |
removeChangeListener(ChangeListener l)
Table オブジェクトへの変更を監視する ChangeListener オブジェクトを削除します。 |
void |
removeColumn(Column column)
引数 column で指定されたフィールドを削除します。 |
void |
removeTableListener(TableListener l)
TableListenerの削除します。 |
void |
resolveChanges()
Table オブジェクトの変更内容をDBや外部ファイルに書き出します。 |
protected void |
setActive(boolean activation)
Table オブジェクトの状態を設定します。 |
void |
setAllRowCount(int count)
全体の行数を設定します。 |
void |
setCaptionResource(Class captionResource)
列の見出し(Columnクラスのcaptionプロパティ)に設定するリソースクラスを設定します。 |
void |
setCaptionResource(Class[] captionResource)
列の見出し(Columnクラスのcaptionプロパティ)に設定するリソースクラスの配列を設定します。 |
void |
setCharsetForCheckingLength(String charsetForCheckingLength)
文字列項目の長さチェックを行う際の文字コードセット名を設定します。 |
void |
setDataProvider(DataProvider dataProvider)
表にデータを供給する DataProvider オブジェクトを設定します。 |
void |
setDataResolver(DataResolver dataResolver)
表のデータをDBや外部ファイルに書き出す DataResolver オブジェクトを設定します。 |
void |
setEntityType(Class<E> entityType)
|
void |
setHasMoreRow(boolean hasMoreRow)
setMaxRowsで設定した件数よりも実際に発行したSQLで取得できるレコードが存在するか否かを設定します。 |
void |
setName(String name)
Table オブジェクトの名前を設定します。 |
void |
setNullableAll(boolean nullable)
引数 nullable で指定されたNullable属性を全てのフィールドに設定します。 |
void |
setNullables(boolean[] nullables)
引数 nullables で指定されたNullable属性の配列を設定します。 |
void |
setSortKeys(Table.SortKey... sortKeys)
ソートキー配列を設定します。 |
void |
sortRows()
前回と同じソート順序で、ソートをやり直します。 |
void |
sortRows(String columnName)
引数 columnName で指定された列名の値により、行の並び替えを行います。 |
void |
sortRows(Table.SortKey... sortKey)
引数 sortKeyで指定された順序で行データを並び替えます。 |
E |
startEditing()
カーソル行のエンティティオブジェクトを編集・更新可能な状態にします。 |
void |
startEditing(E entity)
指定されたエンティティオブジェクトを編集・更新可能な状態にします。 |
void |
validate()
カーソルのエンティティオブジェクトをチェックし、問題がなければ値を受け入れます. |
void |
validate(E entity)
内容が編集・更新されたエンティティオブジェクトをチェックし、問題がなければ値を受け入れます. |
void |
validateAllRows()
テーブルオブジェクトに含まれる全ての行を検証し、編集内容を確定します。 |
EntityList<E> |
visibleEntities()
可視行のエンティティオブジェクトのコレクションを取得します。 |
Collection<Row<E>> |
visibleRows()
可視行オブジェクトのコレクションを取得します。 |
クラス java.lang.Object から継承されたメソッド |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
フィールドの詳細 |
---|
protected final IndexedMap<String,Column> columns
protected boolean active
protected Params<E extends Serializable> _params
public E extends Serializable params
public E extends Serializable $$
employee.select(). where(employee.$$.deptCode).is(new Long(25)).z. orderBy(employee.$$.name)....※エンティティの型を指定しない場合は、nullです。
public E extends Serializable entity
コンストラクタの詳細 |
---|
public Table(E... e)
メソッドの詳細 |
---|
public boolean isTypedRow()
public void activate() throws DataException
DataException
- 例外発生時public void addChangeListener(ChangeListener l)
l
- ChangeListener オブジェクトpublic void addColumn(Column column) throws DataException
column
- Column オブジェクト
DataException
- 例外発生時public Column addColumn(String fieldName) throws DataException
fieldName
- DataField名
DataException
- 例外発生時public Column addColumn(String fieldName, Column.Type type) throws DataException
fieldName
- DataField名type
- タイプ
DataException
- 例外発生時public void addColumns(String[] names) throws DataException
names
- カラム名の配列
DataException
- 例外発生時public void addTableListener(TableListener l)
l
- TableListenerインターフェースを実装したオブジェクトpublic Row<E> appendRow() throws DataException
DataException
- 例外発生時public Row<E> appendRow(E entity) throws DataException
entity
- エンティティオブジェクト
DataException
public void applyFilter() throws DataException
public boolean rowFiltering(TableEvent e, Row row) { try { if (e.getSource().equals(rsList)) { //部門コードが"1000"だったら表示対象とします。 return "1000".equals(row.getValueAsString("BUMON_CODE")); } else { return true; } } catch (Exception x) { x.printStackTrace(); } return true; }※注意: applyFilterを使用しフィルタリングされた行の並び順は、行が登録された順番になります。
DataException
- フィルター適用時に発生した例外public void applySortFilter(Table.SortKey[] sortKeys) throws DataException
sortKeys
- 並び替えを行うソートキー配列
DataException
- フィルター適用時に発生した例外public void cancelUpdates(boolean initial) throws DataException
initial
- true:
DataException
- 例外発生時protected void checkActive() throws DataException
DataException
- 例外発生時protected void checkDeactive() throws DataException
DataException
- アクティブ時にしてはいけない事をした場合public int[] checkDuplicate(String[] columnNameArray) throws DataException
columnNameArray
- チェックするColumn名配列
DataException
- 例外発生時public int[] checkDuplicate(String[] columnNameArray, int rowIndex) throws DataException
String[] columnNames = new String[]{"COL1"}; int rowIndex = 0; int[] results; while (true) { results = dataTable.checkDuplicate(columnNames, rowIndex); if (results == null) break; System.out.println(results[0] + " & " + results[1] + " rows are duplicated."); rowIndex = results[0] + 1; };
columnNameArray
- チェックするColumn名配列rowIndex
- 重複値チェックを開始する行インデックス
DataException
- 例外発生時public boolean checkMoreRow(boolean toLast) throws DataException
toLast
- True:最終行まで調べる、False:最終行まで調べない
DataException
- 例外発生時public void deleteAllRows() throws DataException
DataException
- 例外発生時public void deleteRow() throws DataException
DataException
- 例外発生時protected void doLoadData() throws DataException
DataException
- 例外発生時protected void doSetupColumn(IndexedMap<String,Column> fields) throws DataException
fields
- ColumnMap
DataException
- 例外発生時protected void fireAfterSetValue(ChangeEvent e)
e
- ChangeEvent オブジェクトprotected void fireBeforeSetValue(ChangeEvent e) throws Exception
e
- ChangeEvent オブジェクト
Exception
- 例外発生時public void fireDataChanged(TableEvent<E> e, TableEvent.Operation operation)
e
- TableEventoperation
- オペレーション(TableEventの定数)protected void fireOnActivate(ChangeEvent e) throws Exception
e
- ChangeEvent オブジェクト
Exception
- 例外発生時protected void fireOnColumnSetup(ChangeEvent e)
e
- ChangeEvent オブジェクトprotected void fireOnPassivate(ChangeEvent e)
e
- ChangeEvent オブジェクトpublic void fireRowDeleting(TableEvent<E> e) throws DataException
e
- TableEvent
Exception
- 例外発生時
DataException
public boolean fireRowFiltering(TableEvent<E> e)
e
- イベントオブジェクト
public void fireRowValidating(TableEvent<E> e) throws Exception
e
- TableEvent
Exception
- 例外発生時public boolean first() throws DataException
DataException
- 例外発生時public final Collection<Row<E>> allRows()
public final Collection<E> allEntities()
public final Collection<Row<E>> visibleRows()
public final EntityList<E> visibleEntities()
public Class[] getCaptionResource()
public Column getColumn(Object $dummyFiled)
public Column getColumn(int index)
index
- 列インデックス
public Column getColumn(String columnName) throws DataException
columnName
- カラム名
DataException
- 指定されたcolumnNameが存在しない場合public Column getColumn(String columnName, boolean returnNull)
columnName
- カラム名returnNull
- Dummy
public Column[] getColumnArray()
public int getColumnCount()
public final IndexedMap<String,Column> getColumns()
public DataProvider getDataProvider()
public DataResolver getDataResolver()
public String getName()
public boolean[] getNullables() throws DataException
DataException
- 例外発生時public Params<E> getParams()
public Row<E> getRow() throws DataException
DataException
public Row<E> getRow(int rowIndex) throws DataException
rowIndex
- 行インデックス
DataException
- 例外発生時public E getEntity() throws DataException
DataException
public E getEntity(int rowIndex) throws DataException
rowIndex
-
DataException
public E startEditing() throws DataException
entity
-
DataException
public void startEditing(E entity) throws DataException
entity
-
DataException
public void validate() throws DataException
DataException
public void validate(E entity) throws DataException
entity
-
DataException
public int indexOf(E entity)
entity
-
public int indexOf(Row<E> row)
entity
-
public int getRowCount()
public int getAllRowCount()
public void setAllRowCount(int count)
count
- 全体の行数public Row.RowID getRowID(int rowIndex) throws DataException
rowIndex
- 行インデックス
DataException
- 指定された行が存在しないpublic int getRowIndex()
public Table.SortKey[] getSortKeys()
public boolean inBounds()
public int indexOfColumn(Column column)
column
-
public int indexOfColumn(String columnName)
columnName
- フィールド名
public int indexOfDBColumnName(String name)
name
-
public int indexOfRow(Row<E> row)
row
- 対象の行
public Row<E> insertRow(int index) throws DataException
index
- 挿入場所を示すインデックス(先頭行は0)
DataException
- 例外発生時public Row<E> insertRow(int index, E entity) throws DataException
index
- 挿入場所を示すインデックス(先頭行は0)entity
- エンティティオブジェクト
DataException
protected void internalFree() throws DataException
DataException
- 例外発生時protected void internalOnActivate() throws DataException
DataException
public Row.RowID internalPut(Row<E> row)
row
- Row オブジェクト
public boolean internalPut(Row<E> row, boolean visible, boolean insert) throws DataException
row
- 行オブジェクトvisible
- 登録と同時に可視とするか?insert
- 先頭に挿入するか?
DataException
- 例外発生時public void internalRemove(Row.RowID rowID) throws DataException
rowID
- 行ID
DataException
- 例外発生時public boolean internalMoveTo(int index) throws DataException
index
- 行インデックス
DataException
- 例外発生時protected void internalSetup() throws DataException
DataException
- 例外発生時public boolean isActive()
public boolean isApplyFilter()
public boolean last() throws DataException
DataException
- 例外発生時public boolean next() throws DataException
DataException
- 例外発生時public void passivate() throws DataException
DataException
- 例外発生時public boolean previous() throws DataException
DataException
- 例外発生時public void releaseFilter() throws DataException
DataException
- フィルター解除時に発生した例外public void releaseFilter(boolean doneFilter) throws DataException
doneFilter
- True:フィルターを解除した後にTableEvent.DONE_FILTERイベントを発生させる、False:させない
DataException
- フィルター解除時に発生した例外public void clearColumns() throws DataException
DataException
- 例外発生時public void removeChangeListener(ChangeListener l)
l
- ChangeListener オブジェクトpublic void removeColumn(Column column)
column
- Column オブジェクトpublic void removeTableListener(TableListener l)
l
- TableListenerインターフェースを実装したオブジェクトpublic void resolveChanges() throws DataException
DataException
- 例外発生時protected void setActive(boolean activation) throws DataException
activation
- True:アクティブ状態、False:非アクティブ状態
DataException
- 例外発生時public void setCaptionResource(Class captionResource)
captionResource
- リソースクラスpublic void setCaptionResource(Class[] captionResource)
captionResource
- リソースクラスの配列public boolean moveTo(int index) throws DataException
index
- 行インデックス
DataException
- 例外発生時public void setDataProvider(DataProvider dataProvider)
dataProvider
- DataProvider オブジェクトpublic void setDataResolver(DataResolver dataResolver)
dataResolver
- DataResolver オブジェクトpublic void setName(String name)
name
- Table オブジェクトの名前
DataException
- 例外発生時public void setNullableAll(boolean nullable) throws DataException
nullable
- Nullable属性
DataException
- 例外発生時public void setNullables(boolean[] nullables) throws DataException
nullables
- 各フィールドのNullable属性を格納した配列
DataException
- 例外発生時public void setSortKeys(Table.SortKey... sortKeys)
sortKeys
- ソート用のフィールド名の配列public void sortRows() throws DataException
DataException
- フィルター解除時に発生した例外public void sortRows(String columnName)
columnName
- Column名public void sortRows(Table.SortKey... sortKey) throws DataException
sortKey
-
DataException
public void validateAllRows() throws DataException
DataException
- 例外発生時public String getCharsetForCheckingLength()
public void setCharsetForCheckingLength(String charsetForCheckingLength)
charsetForCheckingLength
- 文字列項目の長さチェックを行う際の文字コードセット名public boolean isHasMoreRow()
public void setHasMoreRow(boolean hasMoreRow)
hasMoreRow
- レコードが存在するか否かpublic Class<E> getEntityType()
public void setEntityType(Class<E> entityType) throws InstantiationException, IllegalAccessException, DataException
InstantiationException
IllegalAccessException
DataException
|
||||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |