01: /**
02: * Copyright 2006 Webmedia Group Ltd.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: **/package org.araneaframework.example.main.web.sample;
16:
17: import org.araneaframework.example.main.TemplateBaseWidget;
18: import org.araneaframework.uilib.form.FormWidget;
19: import org.araneaframework.uilib.form.control.TextControl;
20: import org.araneaframework.uilib.form.data.StringData;
21:
22: /**
23: * @author Taimo Peelo (taimo@araneaframework.org)
24: */
25: public class NameWidget extends TemplateBaseWidget {
26: private static final long serialVersionUID = 1L;
27: private FormWidget form;
28: private boolean returnGoo = false;
29:
30: public NameWidget() {
31: }
32:
33: public NameWidget(boolean doGoo) {
34: returnGoo = doGoo;
35: }
36:
37: protected void init() throws Exception {
38: if (returnGoo)
39: getFlowCtx().finish("Goo");
40:
41: setViewSelector("sample/nameForm");
42:
43: form = new FormWidget();
44: form.addElement("name", "#Enter your name", new TextControl(),
45: new StringData(), true);
46: addWidget("form", form);
47: }
48:
49: public void handleEventReturn() throws Exception {
50: if (form.convertAndValidate()) {
51: getFlowCtx().finish(form.getValueByFullName("name"));
52: }
53: }
54: }
|