1 package org.wcb.gui.forms;
2
3 import org.wcb.model.service.impl.RecencyExperianceValidationService;
4 import org.wcb.model.service.IServicesConstants;
5 import org.wcb.model.util.SpringUtil;
6 import org.wcb.model.bd.LogbookDelegate;
7
8 import javax.swing.*;
9 import java.awt.*;
10
11 /**
12 * <small>
13 * Copyright (c) 2006 wbogaardt.
14 * This library is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU Lesser General Public
16 * License as published by the Free Software Foundation; either
17 * version 2.1 of the License, or (at your option) any later version.
18 *
19 * This library is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * Lesser General Public License for more details.
23 *
24 * You should have received a copy of the GNU Lesser General Public
25 * License along with this library; if not, write to the Free Software
26 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
27 * <p/>
28 * $File: $ <br>
29 * $Change: $ submitted by $Author: wbogaardt $ at $DateTime: Apr 7, 2006 10:16:01 AM $ <br>
30 * </small>
31 *
32 * @author wbogaardt
33 * @version 1
34 * Date: Apr 7, 2006
35 * Time: 10:16:01 AM
36 */
37
38 public class RecentFlightExperiencePanel extends JPanel {
39
40 private JTextArea area;
41
42 public RecentFlightExperiencePanel() {
43 init();
44 }
45
46 private void init() {
47 setLayout(new FlowLayout());
48 area = new JTextArea(10,50);
49 area.setEditable(false);
50 area.setWrapStyleWord(true);
51 area.setLineWrap(true);
52 area.setBackground(new Color(0xefd67a));
53 add(new JScrollPane(area));
54 }
55
56 public void refresh() {
57 RecencyExperianceValidationService recencyValidator = (RecencyExperianceValidationService) SpringUtil.getApplicationContext().getBean(IServicesConstants.LOGBOOK_RECENCY_EXPERIANCE);
58 LogbookDelegate delegate = (LogbookDelegate) SpringUtil.getApplicationContext().getBean(IServicesConstants.LOGBOOK_DELEGATE);
59 recencyValidator.setObject(delegate.getAllLogbookEntries());
60 recencyValidator.validate();
61 String messages = recencyValidator.getMessage();
62 area.setText(messages);
63 }
64 }