Statistics
| Revision:

root / trunk / extensions / extGeoreferencing / src / org / gvsig / georeferencing / gui / pointsTable / TablePanelButtons.java @ 6214

History | View | Annotate | Download (4.91 KB)

1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2006 IVER T.I. and Generalitat Valenciana.
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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
package org.gvsig.georeferencing.gui.pointsTable;
20

    
21
import java.awt.FlowLayout;
22

    
23
import javax.swing.ImageIcon;
24
import javax.swing.JButton;
25
import javax.swing.JPanel;
26
import javax.swing.JToggleButton;
27

    
28
import com.iver.andami.PluginServices;
29

    
30
/**
31
 * Control para el manejo de tablas. No contiene eventos, estos deben 
32
 * ser manejados desde la clase que lo llame.
33
 * 
34
 * @author Nacho Brodin (brodin_ign@gva.es)
35
 *
36
 */
37
public class TablePanelButtons extends JPanel{
38
        
39
        //**********************Vars**********************************                
40
        private JButton                 bSave = null;
41
        private JButton                 bLoad = null;
42
        private JButton                 bExportToAscii = null;
43
        private JToggleButton         bInsertPoint = null;
44
        private String                        pathToImages = "images/";//"/com/iver/cit/gvsig/gui/panels/images/";
45
        //**********************End Vars******************************
46
        
47
        //**********************Methods*******************************
48
        /**
49
         * This is the default constructor
50
         */
51
        public TablePanelButtons() {
52
                super();
53
                initialize();
54
        }
55

    
56
        /**
57
         * This method initializes this
58
         * 
59
         * @return void
60
         */
61
        private void initialize() {                
62
                this.setSize(new java.awt.Dimension(91,22));
63
                FlowLayout flowLayout5 = new FlowLayout();
64
                flowLayout5.setHgap(0);
65
                flowLayout5.setVgap(0);
66
        
67
                this.setLayout(flowLayout5);
68

    
69
                this.add(getBInsertPoint(), null);
70
                this.add(getBSave(), null);
71
                this.add(getBLoad(), null);
72
                this.add(getBExportToAscii(), null);
73
        }
74
        //**********************End Methods***************************        
75
        
76
        //**********************Getters & Setters*********************
77
        /**
78
         * This method initializes jButton        
79
         *         
80
         * @return javax.swing.JButton        
81
         */    
82
        public JToggleButton getBInsertPoint() {
83
                if (bInsertPoint == null) {
84
                        bInsertPoint = new JToggleButton();
85
                        bInsertPoint.setText("");
86
                        bInsertPoint.setPreferredSize(new java.awt.Dimension(22,22));
87
                        bInsertPoint.setIcon(new ImageIcon(getClass().getClassLoader().getResource(pathToImages + "selectfromview.png")));
88
                        bInsertPoint.setEnabled(false);
89
                        bInsertPoint.setSelected(true);
90
                        bInsertPoint.setToolTipText(PluginServices.getText(this, "selectfromview"));
91
                }
92
                return bInsertPoint;
93
        }
94
        
95
        /**
96
         * This method initializes jButton        
97
         *         
98
         * @return javax.swing.JButton        
99
         */    
100
        public JButton getBLoad() {
101
                if (bLoad == null) {
102
                        bLoad = new JButton();
103
                        bLoad.setPreferredSize(new java.awt.Dimension(22,22));
104
                        bLoad.setEnabled(true);
105
                        bLoad.setIcon(new ImageIcon(getClass().getClassLoader().getResource(pathToImages + "load.png")));
106
                        bLoad.setToolTipText(PluginServices.getText(this, "load_from_xml"));
107
                        bLoad.setVisible(false);
108
                }
109
                return bLoad;
110
        }
111
        
112
        /**
113
         * This method initializes bSave        
114
         *         
115
         * @return javax.swing.JButton        
116
         */
117
        public JButton getBSave() {
118
                if (bSave == null) {
119
                        bSave = new JButton();
120
                        bSave.setText("");
121
                        bSave.setEnabled(false);
122
                        bSave.setPreferredSize(new java.awt.Dimension(22,22));
123
                        bSave.setIcon(new ImageIcon(getClass().getClassLoader().getResource(pathToImages + "save.png")));
124
                        bSave.setActionCommand("");
125
                        bSave.setToolTipText(PluginServices.getText(this, "save_to_xml"));
126
                        bSave.setVisible(false);
127
                }
128
                return bSave;
129
        }
130
        
131
        /**
132
         * This method initializes jButton        
133
         *         
134
         * @return javax.swing.JButton        
135
         */    
136
        public JButton getBExportToAscii() { 
137
                if (bExportToAscii == null) {
138
                        bExportToAscii = new JButton();
139
                        bExportToAscii.setPreferredSize(new java.awt.Dimension(22,22));
140
                        bExportToAscii.setEnabled(false);
141
                        bExportToAscii.setIcon(new ImageIcon(getClass().getClassLoader().getResource(pathToImages + "exportToAscii.png")));
142
                        bExportToAscii.setToolTipText(PluginServices.getText(this, "save_to_ascii"));
143
                        bExportToAscii.setVisible(false);
144
                }
145
                return bExportToAscii;
146
        }
147
        
148
        /**
149
         * Activa o desactiva los botones de exportar capa de puntos y salvar
150
         * la tabla a Ascii.
151
         *@param isPossible Si vale true activa los controles de salvar y exportaci?n
152
         *y si vale false los desactiva
153
         */
154
        public void setSaveToDisk(boolean isPossible){
155
                this.getBSave().setEnabled(isPossible);
156
                this.getBExportToAscii().setEnabled(isPossible);
157
        }
158
        //**********************End Getters & Setters*****************
159
 }