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.release.demos;
16:
17: import org.araneaframework.example.main.TemplateBaseWidget;
18: import org.araneaframework.example.main.release.features.ExampleData;
19: import org.araneaframework.uilib.form.BeanFormWidget;
20: import org.araneaframework.uilib.form.control.TextControl;
21:
22: /**
23: * @author Taimo Peelo (taimo@araneaframework.org)
24: */
25: public class ClientViewWidget extends TemplateBaseWidget {
26: private ExampleData.Client client;
27:
28: public ClientViewWidget(ExampleData.Client client) {
29: this .client = client;
30: }
31:
32: protected void init() throws Exception {
33: setViewSelector("release/demos/clientView");
34:
35: BeanFormWidget form = new BeanFormWidget(
36: ExampleData.Client.class);
37: form.addBeanElement("sex", "sed.Sex", new TextControl(), true);
38: form.addBeanElement("forename", "sed.Forename",
39: new TextControl(), true);
40: form.addBeanElement("surname", "sed.Surname",
41: new TextControl(), true);
42: form.addBeanElement("country", "common.Country",
43: new TextControl(), true);
44:
45: form.readFromBean(client);
46:
47: addWidget("form", form);
48: }
49:
50: public ExampleData.Client getClient() {
51: return client;
52: }
53:
54: private void handleEventReturn() {
55: getFlowCtx().cancel();
56: }
57: }
|