01: /*
02: * $Id: HelloWorld.java 4942 2006-03-14 22:38:34 -0800 (Tue, 14 Mar 2006)
03: * ivaynberg $ $Revision: 4942 $ $Date: 2006-03-14 22:38:34 -0800 (Tue, 14 Mar
04: * 2006) $
05: *
06: * ==================================================================== Licensed
07: * under the Apache License, Version 2.0 (the "License"); you may not use this
08: * file except in compliance with the License. You may obtain a copy of the
09: * License at
10: *
11: * http://www.apache.org/licenses/LICENSE-2.0
12: *
13: * Unless required by applicable law or agreed to in writing, software
14: * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15: * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16: * License for the specific language governing permissions and limitations under
17: * the License.
18: */
19: package wicket.examples.echo;
20:
21: import wicket.examples.WicketExamplePage;
22: import wicket.markup.html.basic.Label;
23: import wicket.markup.html.form.Form;
24: import wicket.markup.html.form.TextField;
25: import wicket.model.PropertyModel;
26:
27: /**
28: * The simplest form application possible. Just prints any user input to a
29: * label.
30: *
31: * @author Eelco Hillenius
32: */
33: public class Echo extends WicketExamplePage {
34: private String message = "[type your message to the world here]";
35:
36: /**
37: * Constructor.
38: */
39: public Echo() {
40: // This model references the page's message property and is
41: // shared by the label and form component
42: PropertyModel messageModel = new PropertyModel(this , "message");
43:
44: // The label displays the currently set message
45: add(new Label("msg", messageModel));
46:
47: // Add a form to change the message. We don't need to do anything
48: // else with this form as the shared model is automatically updated
49: // on form submits
50: Form form = new Form("form");
51: form.add(new TextField("msgInput", messageModel));
52: add(form);
53: }
54:
55: /**
56: * @return the message
57: */
58: public String getMessage() {
59: return message;
60: }
61:
62: /**
63: * @param message
64: * the message to set
65: */
66: public void setMessage(String message) {
67: this.message = message;
68: }
69: }
|