Statistics
| Revision:

root / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / project / documents / table / gui / Statistics.java @ 7304

History | View | Annotate | Download (3.64 KB)

1
package com.iver.cit.gvsig.project.documents.table.gui;
2

    
3
import java.awt.BorderLayout;
4
import java.awt.FlowLayout;
5
import java.awt.event.ActionEvent;
6
import java.awt.event.ActionListener;
7

    
8
import javax.swing.JPanel;
9
import javax.swing.JScrollPane;
10
import javax.swing.JTextArea;
11

    
12
import org.gvsig.gui.beans.swing.JButton;
13

    
14
import com.iver.andami.PluginServices;
15
import com.iver.andami.ui.mdiManager.IWindow;
16
import com.iver.andami.ui.mdiManager.WindowInfo;
17
/**
18
 * @author Fernando Gonz?lez Cort?s
19
 */
20
public class Statistics extends JPanel implements IWindow {
21

    
22
        private JScrollPane jScrollPane = null;
23
        private JTextArea txtStatistics = null;
24
        private JButton jButton = null;
25
        private JPanel jPanel = null;
26
        /**
27
         * This is the default constructor
28
         */
29
        public Statistics() {
30
                super();
31
                initialize();
32
        }
33
        /**
34
         * This method initializes this
35
         * 
36
         * @return void
37
         */
38
        private  void initialize() {
39
                this.setLayout(new BorderLayout());
40
                this.setSize(300,200);
41
                this.add(getJScrollPane(), java.awt.BorderLayout.CENTER);
42
                this.add(getJPanel(), java.awt.BorderLayout.SOUTH);
43
        }
44
        /**
45
         * This method initializes jScrollPane        
46
         *         
47
         * @return javax.swing.JScrollPane        
48
         */    
49
        private JScrollPane getJScrollPane() {
50
                if (jScrollPane == null) {
51
                        jScrollPane = new JScrollPane();
52
                        jScrollPane.setViewportView(getTxtStatistics());
53
                }
54
                return jScrollPane;
55
        }
56
        /**
57
         * This method initializes jTextArea        
58
         *         
59
         * @return javax.swing.JTextArea        
60
         */    
61
        private JTextArea getTxtStatistics() {
62
                if (txtStatistics == null) {
63
                        txtStatistics = new JTextArea();                        
64
                }
65
                return txtStatistics;
66
        }
67
        /**
68
         * This method initializes jButton        
69
         *         
70
         * @return JButton        
71
         */    
72
        private JButton getJButton() {
73
                if (jButton == null) {
74
                        jButton = new JButton();
75
                        jButton.setPreferredSize(new java.awt.Dimension(100,18));
76
                        jButton.setText(PluginServices.getText(this, "cerrar"));
77
                        jButton.addActionListener(new ActionListener() {
78
                public void actionPerformed(ActionEvent e) {
79
                    PluginServices.getMDIManager().closeWindow(Statistics.this);
80
                }
81
            });
82
                }
83
                return jButton;
84
        }
85
        /**
86
         * This method initializes jPanel        
87
         *         
88
         * @return javax.swing.JPanel        
89
         */    
90
        private JPanel getJPanel() {
91
                if (jPanel == null) {
92
                        jPanel = new JPanel();
93
                        FlowLayout layout = new FlowLayout();
94
                        layout.setAlignment(FlowLayout.RIGHT);
95
                        jPanel.setLayout(layout);
96
                        jPanel.add(getJButton(), null);
97
                }
98
                return jPanel;
99
        }
100
    /**
101
     * @see com.iver.andami.ui.mdiManager.IWindow#getWindowInfo()
102
     */
103
    public WindowInfo getWindowInfo() {
104
        WindowInfo vi = new WindowInfo(WindowInfo.MODALDIALOG);
105
        vi.setTitle(PluginServices.getText(this, "estadisticas"));
106
        return vi;
107
    }
108
    /**
109
     * @param i
110
     * @param j
111
     * @param k
112
     * @param l
113
     * @param m
114
     * @param n
115
     * @param o
116
     * @param p
117
     */
118
    public void setStatistics(double media, double maximo, double minimo, double varianza, double desviacion, int numero, double ambito, double suma) {
119
        getTxtStatistics().setText(PluginServices.getText(this, "suma") + ": " + suma + "\n"+
120
                PluginServices.getText(this, "recuento") + ": " + numero + "\n"+
121
                PluginServices.getText(this, "media") + ": " + media + "\n"+
122
                PluginServices.getText(this, "maximo") + ": " + maximo + "\n"+
123
                PluginServices.getText(this, "minimo") + ": " + minimo + "\n"+
124
                PluginServices.getText(this, "ambito") + ": " + ambito + "\n"+
125
                PluginServices.getText(this, "varianza") + ": " + varianza + "\n"+
126
                PluginServices.getText(this, "desviacion_tipica") + ": " + desviacion);        
127
    }
128
    }