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 org.apache.commons.logging.Log;
18: import org.apache.commons.logging.LogFactory;
19: import org.araneaframework.example.main.TemplateBaseWidget;
20: import org.araneaframework.example.main.business.model.ContractMO;
21: import org.araneaframework.example.main.web.company.CompanyViewWidget;
22: import org.araneaframework.example.main.web.person.PersonViewWidget;
23:
24: /**
25: * This widget is for displaying a contract. It cancels current call only.
26: *
27: * @author Rein Raudjärv <reinra@ut.ee>
28: */
29: public class ContractViewWidget extends TemplateBaseWidget {
30:
31: private static final long serialVersionUID = 1L;
32:
33: private static final Log log = LogFactory
34: .getLog(ContractViewWidget.class);
35:
36: private Long id = null;
37:
38: private ContractMO contract;
39:
40: /**
41: * @param id
42: * Company's Id.
43: */
44: public ContractViewWidget(Long id) {
45: super ();
46: this .id = id;
47: }
48:
49: protected void init() throws Exception {
50: log.debug("TemplateContractViewWidget init called");
51: setViewSelector("contract/contractView");
52:
53: contract = (ContractMO) getGeneralDAO().getById(
54: ContractMO.class, id);
55: putViewData("contract", contract);
56: }
57:
58: public void handleEventViewCompany(String eventParameter)
59: throws Exception {
60: getFlowCtx().start(
61: new CompanyViewWidget(contract.getCompany().getId()));
62: }
63:
64: public void handleEventViewPerson(String eventParameter)
65: throws Exception {
66: getFlowCtx().start(
67: new PersonViewWidget(contract.getPerson().getId()));
68: }
69:
70: public void handleEventReturn(String eventParameter)
71: throws Exception {
72: getFlowCtx().cancel();
73: }
74: }
|