私はVaadinでcommit()
メソッドが実際に何をするのか理解することにいくつか問題があります。私はドキュメントを読んで、いくつかの例を示しましたが、私はまだそれが実際に何かを誤解しています。Vaadinフォームcommit()メソッド?
これは、コードのスニペットです:
if (source == save) {
/* If the given input is not valid there is no point in continuing */
if (!isValid()) {
return;
}
if (newContactMode) {
/* We need to add the new person to the container */
Item addedItem = app.getDataSource().addItem(newPerson);
/*
* We must update the form to use the Item from our datasource
* as we are now in edit mode
*/
setItemDataSource(addedItem);
//System.out.println(app.getDataSource().getItem(addedItem));
newContactMode = false;
}
commit();
setReadOnly(true);
}
私は物事をこの方法で行う場合、私は私が(コンテナ内)データソースにフォームに書いたデータの一部を追加しないでください。これらのエントリはテーブルに表示されません。
コードの別のスニペット:
if (source == save) {
/* If the given input is not valid there is no point in continuing */
if (!isValid()) {
return;
}
commit();//changing place of this method
if (newContactMode) {
/* We need to add the new person to the container */
Item addedItem = app.getDataSource().addItem(newPerson);
/*
* We must update the form to use the Item from our datasource
* as we are now in edit mode
*/
setItemDataSource(addedItem);
//System.out.println(app.getDataSource().getItem(addedItem));
newContactMode = false;
}
setReadOnly(true);
}
このバージョンでは正しく動作します。私はこのフォームのこのメソッドが、このフォームの "DataSource"(DataSourceのアイテムを持つ)とのすべてのやりとりをブロックすると結論づけることができます。しかし、別のクラスとコンテナaddItem()
を直接呼び出して、手で行う必要があります。私はcommit()
メソッドについての良い説明は見つかりませんでした。
私はこのtutorialを使用していますが、誰かがチュートリアルでこのGUIを認識している可能性があります。
classは実装されているcommit()メソッドですか?ドキュメントが必要です。 Vaadinはgenerelによく書かれています。 – d2k2
commit()は、ドキュメントよりも多くのことを行います。私の質問を読んでください – Alex
あなたはまだvaadin 6ですか? –