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
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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 }