@shokos2
syoko_sasakiとコードを互いにチェック。
あと相手のプログラムに新機能を追加する、ということをやっています。
▽HomePage.java
public class HomePage extends WebPage { private static final long serialVersionUID = 1L; public HomePage() { add(new FeedbackPanel("feedback")); ValueKeeper value = new ValueKeeper(); Form<ValueKeeper> form = new Form<ValueKeeper>("form", new CompoundPropertyModel<ValueKeeper>(value)); add(form); TextField<String> inputID = new TextField<String>("id"); inputID.setRequired(true); form.add(inputID); PasswordTextField inputPass = new PasswordTextField("password"); inputPass.setRequired(true); form.add(inputPass); TextField<String> inputText = new TextField<String>("text"); inputText.setRequired(true); form.add(inputText); NextButton button = new NextButton("submit", value); form.add(button); } }
コンポーネントのインスタンスを生成したあとに1つずつフォームにaddしてますが
formのaddメソッドは可変長引数をとれるので
form.add(inputID, inputPass, inputText, button);
という風にまとめて書くことができます。
すっきりするので僕は使っています。
あとthisについてですが、僕は明示的に書くことにしてます。
フィールドの名前なのか、引数の名前なのかはっきりするので。