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.contract;
16:
17: import java.math.BigDecimal;
18: import org.apache.commons.logging.Log;
19: import org.apache.commons.logging.LogFactory;
20: import org.araneaframework.example.main.TemplateBaseWidget;
21: import org.araneaframework.uilib.form.FormWidget;
22: import org.araneaframework.uilib.form.control.FloatControl;
23: import org.araneaframework.uilib.form.control.TextControl;
24: import org.araneaframework.uilib.form.data.BigDecimalData;
25: import org.araneaframework.uilib.form.data.StringData;
26:
27: /**
28: * @author <a href="mailto:rein@araneaframework.org">Rein Raudjärv</a>
29: */
30: public class ContractNotesEditWidget extends TemplateBaseWidget {
31:
32: private static final long serialVersionUID = 1L;
33: private static final Log log = LogFactory
34: .getLog(ContractNotesEditWidget.class);
35: private FormWidget form;
36:
37: public FormWidget getForm() {
38: return form;
39: }
40:
41: public void setForm(FormWidget form) {
42: this .form = form;
43: }
44:
45: public void setNotes(String notes) {
46: form.setValueByFullName("notes", notes);
47: }
48:
49: public String getNotes() {
50: return (String) form.getValueByFullName("notes");
51: }
52:
53: public void setTotal(BigDecimal total) {
54: form.setValueByFullName("total", total);
55: }
56:
57: public BigDecimal getTotal() {
58: return (BigDecimal) form.getValueByFullName("total");
59: }
60:
61: protected void init() throws Exception {
62: setViewSelector("contract/contractNotesEdit");
63: log.debug("TemplateContractNotesEditWidget init called");
64:
65: form = new FormWidget();
66: form.addElement("notes", "#Notes", new TextControl(),
67: new StringData(), false);
68: form.addElement("total", "#Total", new FloatControl(),
69: new BigDecimalData(), false);
70: addWidget("form", form);
71: }
72: }
|