Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.app / org.gvsig.app.mainplugin / src / main / java / org / gvsig / app / project / documents / view / legend / gui / InformationPanelController.java @ 43142

History | View | Annotate | Download (2.86 KB)

1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2017 gvSIG Association
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
 * MA  02110-1301, USA.
19
 *
20
 * For any additional information, do not hesitate to contact us
21
 * at info AT gvsig.com, or visit our website www.gvsig.com.
22
 */
23
package org.gvsig.app.project.documents.view.legend.gui;
24

    
25
import java.util.Locale;
26

    
27
import javax.swing.JComponent;
28

    
29
import org.slf4j.Logger;
30
import org.slf4j.LoggerFactory;
31

    
32
import org.gvsig.fmap.mapcontext.layers.FLayer;
33
import org.gvsig.tools.ToolsLocator;
34
import org.gvsig.tools.i18n.I18nManager;
35
import org.gvsig.tools.swing.api.Component;
36

    
37

    
38
/**
39
 * @author fdiaz
40
 *
41
 */
42
public class InformationPanelController extends InformationPanelView implements Component {
43

    
44
    /**
45
     *
46
     */
47
    private static final long serialVersionUID = 2386492505441108866L;
48

    
49
    @SuppressWarnings("unused")
50
    private static final Logger LOG = LoggerFactory.getLogger(InformationPanelController.class);
51

    
52

    
53
    public InformationPanelController() {
54
        translate();
55
    }
56

    
57
    private void translate() {
58
        I18nManager i18nManager = ToolsLocator.getI18nManager();
59
        txtFieldName.setToolTipText(i18nManager.getTranslation(txtFieldName.getToolTipText()));
60
        nameLabel.setText(i18nManager.getTranslation(nameLabel.getText()));
61
        txtAreaInformation.setToolTipText(i18nManager.getTranslation(txtAreaInformation.getToolTipText()));
62
        informationLabel.setText(i18nManager.getTranslation(informationLabel.getText()));
63
    }
64

    
65
    /**
66
     * @param locale
67
    *
68
    */
69
    public void setLocate(Locale locale) {
70
        Locale l = super.getLocale();
71
        if (!l.equals(locale)) {
72
            translate();
73
        }
74
        super.setLocale(locale);
75
    }
76

    
77
    /**
78
     * @param layer
79
     */
80
    public void set(FLayer layer){
81
//        this.layer = layer;
82
        txtFieldName.setText(layer.getName());
83
        txtAreaInformation.setText(layer.getInfoString());
84
    }
85

    
86
    /**
87
     * @param layer
88
     * @return 
89
     */
90
    public boolean fetch(FLayer layer){
91
        layer.setName(txtFieldName.getText());
92
        layer.getMapContext().invalidate();
93
        return true;
94
    }
95

    
96
    @Override
97
    public JComponent asJComponent() {
98
        return this;
99
    }
100

    
101
}