Statistics
| Revision:

root / org.gvsig.educa.batovi / trunk / org.gvsig.educa.batovi.mapviewer / org.gvsig.educa.batovi.mapviewer / src / main / java / org / gvsig / educa / batovi / mapviewer / StatusBar.java @ 128

History | View | Annotate | Download (3.77 KB)

1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.educa.batovi.mapviewer;
23

    
24
import java.awt.Dimension;
25

    
26
import javax.swing.Box;
27
import javax.swing.JLabel;
28
import javax.swing.JToolBar;
29

    
30
/**
31
 * Status bar widget
32
 * 
33
 * @author gvSIG Team
34
 * @version $Id$
35
 * 
36
 */
37
public class StatusBar extends JToolBar {
38

    
39
    /**
40
     *
41
     */
42
    private static final long serialVersionUID = -6785797381430943587L;
43
    private JLabel labelX;
44
    private JLabel x;
45
    private JLabel labelY;
46
    private JLabel y;
47
    private JLabel crs;
48
    private JLabel scale;
49
    private JLabel info;
50

    
51
    /**
52
     *
53
     */
54
    public StatusBar() {
55
        super();
56
        initControls();
57
    }
58

    
59
    private void initControls() {
60
        Main main = Main.getInstance();
61
        Dimension minLableSize = new Dimension(30, 20);
62
        labelX = new JLabel();
63
        labelX.setMinimumSize(minLableSize);
64
        add(labelX);
65

    
66
        x = new JLabel();
67
        x.setMinimumSize(minLableSize);
68
        add(x);
69

    
70
        add(Box.createHorizontalStrut(18));
71

    
72
        labelY = new JLabel();
73
        labelY.setMinimumSize(minLableSize);
74
        add(labelY);
75

    
76
        y = new JLabel();
77
        y.setMinimumSize(minLableSize);
78
        add(y);
79

    
80
        add(Box.createHorizontalStrut(52));
81
        add(new JLabel(main.translate("CRS").concat(":")));
82
        crs = new JLabel();
83
        crs.setMinimumSize(minLableSize);
84
        add(crs);
85

    
86
        add(Box.createHorizontalStrut(52));
87
        add(new JLabel(main.translate("Scale").concat(" 1:")));
88
        scale = new JLabel();
89
        scale.setMinimumSize(minLableSize);
90
        add(scale);
91

    
92
        add(Box.createHorizontalStrut(52));
93

    
94
        info = new JLabel();
95
        add(info);
96
    }
97

    
98
    /**
99
     * Update additional informations
100
     * 
101
     * @param string
102
     */
103
    public void setInfo(String string) {
104
        info.setText(string);
105
    }
106

    
107
    /**
108
     * Sets current X coordinate value
109
     * 
110
     * @param x
111
     */
112
    public void setX(String x) {
113
        this.x.setText(x);
114
    }
115

    
116
    /**
117
     * Sets current Y coordinate value
118
     * 
119
     * @param y
120
     */
121
    public void setY(String y) {
122
        this.y.setText(y);
123
    }
124

    
125
    /**
126
     * Sets current CRS name
127
     * 
128
     * @param crs
129
     */
130
    public void setCRS(String crs) {
131
        this.crs.setText(crs);
132
    }
133

    
134
    /**
135
     * Sets current scale value
136
     * 
137
     * @param scale
138
     */
139
    public void setScale(String scale) {
140
        this.scale.setText(scale);
141
    }
142

    
143
    /**
144
     * Sets X coordinate label
145
     * 
146
     * @param string
147
     */
148
    public void setXLabel(String string) {
149
        labelX.setText(string);
150
    }
151

    
152
    /**
153
     * Sets Y coordinate label
154
     * 
155
     * @param string
156
     */
157
    public void setYLabel(String string) {
158
        labelY.setText(string);
159
    }
160

    
161
    /**
162
     *
163
     */
164
    public void clear() {
165
        x.setText("");
166
        y.setText("");
167
        labelX.setText("");
168
        labelY.setText("");
169
        scale.setText("");
170
        crs.setText("");
171
    }
172
}