KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > sellwin > gui > FunnelDialog


1 package sellwin.gui;
2
3 import sellwin.domain.*;
4 import javax.swing.*;
5 import javax.swing.event.*;
6 import javax.swing.border.*;
7 import java.awt.*;
8 import java.awt.event.*;
9
10 // SellWin http://sourceforge.net/projects/sellwincrm
11
//Contact support@open-app.com for commercial help with SellWin
12
//This software is provided "AS IS", without a warranty of any kind.
13

14 /**
15  * This class implements the funnel dialog
16  */

17 public class FunnelDialog extends JDialog implements GUIChars {
18
19     private Whiteboard wb;
20     
21     public final static String JavaDoc[] STAGES = {
22         Opportunity.STAGE_IDENTIFIED,
23         Opportunity.STAGE_CONTACTED,
24         Opportunity.STAGE_BIDDING,
25         Opportunity.STAGE_CHANCE,
26         Opportunity.STAGE_WINNING,
27         Opportunity.STAGE_AWARDED,
28         Opportunity.STAGE_CONTRACT,
29         Opportunity.STAGE_BILLED };
30
31     private PolyPanel polys = null;
32     private JButton closeButton = new JButton("Close");
33     private JButton refreshButton = new JButton("Refresh");
34
35     /**
36      * construct the funnel dialog
37      */

38     public FunnelDialog() {
39         super();
40         wb = MainWindow.getWhiteboard();
41         setTitle(wb.getLang().getString("salesFunnel"));
42         setSize(640,600);
43         getContentPane().setLayout(new BorderLayout());
44         JPanel mainPanel = new JPanel(new BorderLayout());
45         mainPanel.setBorder(new EtchedBorder());
46         try {
47             polys = new PolyPanel();
48         } catch (AngError e) {
49             ErrorHandler.show(this, e);
50         }
51         mainPanel.add(polys, BorderLayout.CENTER);
52         polys.setSize(400,400);
53         getContentPane().add(mainPanel, BorderLayout.CENTER);
54         JPanel buttonPanel = new JPanel();
55         buttonPanel.add(refreshButton);
56         buttonPanel.add(closeButton);
57         getContentPane().add(buttonPanel, BorderLayout.SOUTH);
58
59         WindowListener l = new WindowAdapter() {
60             public void windowClosed(WindowEvent e) {
61             }
62
63             public void windowClosing(WindowEvent e) {
64                 hide();
65             }
66         };
67
68         addWindowListener(l);
69
70         refreshButton.addActionListener(
71             new ActionListener() {
72                 public void actionPerformed(ActionEvent e) {
73                     polys.refresh();
74                 }
75             });
76         closeButton.addActionListener(
77             new ActionListener() {
78                 public void actionPerformed(ActionEvent e) {
79                     hide();
80                 }
81             });
82
83         getRootPane().setDefaultButton(closeButton);
84         setLang();
85         setFonts();
86
87     }
88
89     /**
90      * not used
91      */

92     public void refreshOpportunity() {
93     }
94
95     /**
96      * set the dialog's language
97      */

98     public final void setLang() {
99         closeButton.setText(wb.getLang().getString("close"));
100         refreshButton.setText(wb.getLang().getString("refresh"));
101         setTitle(wb.getLang().getString("salesFunnel"));
102     }
103
104     public void setColors() {}
105
106     public void setFonts() {
107         refreshButton.setFont(MainWindow.LABEL_FONT);
108         closeButton.setFont(MainWindow.LABEL_FONT);
109     }
110 }
111
Popular Tags