1   package org.wcb.gui.dialog;
2   
3   import org.wcb.gui.component.WaveButton;
4   import org.wcb.gui.component.JXTitlePanel;
5   import org.wcb.gui.forms.RecentFlightExperiencePanel;
6   import org.wcb.resources.MessageResourceRegister;
7   import org.wcb.resources.MessageKey;
8   import org.jdesktop.swingx.border.DropShadowBorder;
9   
10  import javax.swing.*;
11  import javax.swing.border.Border;
12  import javax.swing.border.CompoundBorder;
13  import java.awt.event.ActionListener;
14  import java.awt.*;
15  
16  /**
17   * <small>
18   * Copyright (c)  2006  wbogaardt.
19   * This library is free software; you can redistribute it and/or
20   * modify it under the terms of the GNU Lesser General Public
21   * License as published by the Free Software Foundation; either
22   * version 2.1 of the License, or (at your option) any later version.
23   *
24   * This library is distributed in the hope that it will be useful,
25   * but WITHOUT ANY WARRANTY; without even the implied warranty of
26   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
27   * Lesser General Public License for more details.
28   *
29   * You should have received a copy of the GNU Lesser General Public
30   * License along with this library; if not, write to the Free Software
31   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
32   * <p/>
33   * $File:  $ <br>
34   * $Change:  $ submitted by $Author: wbogaardt $ at $DateTime: Mar 30, 2006 10:35:19 AM $ <br>
35   * </small>
36   *
37   * @author wbogaardt
38   * @version 1
39   *          Date: Mar 30, 2006
40   *          Time: 10:35:19 AM
41   */
42  public class RecencyExperienceDialog extends JDialog  {
43  
44      private JButton okButton;
45      private RecentFlightExperiencePanel messagesPane;
46  
47      public RecencyExperienceDialog() {
48          setTitle("Recency Experiance");
49          setModal(true);
50          setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
51          initComponents();
52      }
53  
54      public void addActionListener(ActionListener listener) {
55          okButton.addActionListener(listener);
56      }
57  
58      public void refresh() {
59          messagesPane.refresh();
60      }
61      /**
62       * Init the componets in the dialog.
63       */
64      private void initComponents() {
65          okButton = new WaveButton(MessageResourceRegister.getInstance().getValue(MessageKey.BUTTON_CLOSE));
66          messagesPane = new RecentFlightExperiencePanel();
67          getContentPane().setLayout(new BorderLayout());
68          JPanel mainPanel =  new JXTitlePanel("Recency", new Color(0x522aec));
69          Border shadow = new DropShadowBorder(Color.BLACK, 1, 10, .5f, 15, false, true, true, true);
70          mainPanel.setBorder(new CompoundBorder(shadow, mainPanel.getBorder()));
71          mainPanel.setLayout(new GridBagLayout());
72          GridBagConstraints gridBagConstraints;
73          gridBagConstraints = new GridBagConstraints();
74          gridBagConstraints.gridx = 0;
75          gridBagConstraints.gridy = 0;
76          gridBagConstraints.anchor = GridBagConstraints.CENTER;
77          mainPanel.add(messagesPane, gridBagConstraints);
78  
79          gridBagConstraints = new GridBagConstraints();
80          gridBagConstraints.gridx = 0;
81          gridBagConstraints.gridy = 1;
82          gridBagConstraints.anchor = GridBagConstraints.WEST;
83          mainPanel.add(okButton, gridBagConstraints);
84  
85          getContentPane().add(mainPanel, BorderLayout.SOUTH);
86          pack();
87      }
88  }