root / tags / v1_1_Build_1004 / extensions / extGeoreferencing / src / org / gvsig / georeferencing / gui / pointsTable / TablePanelButtons.java @ 12319
History | View | Annotate | Download (5.16 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 |
try{
|
88 |
bInsertPoint.setIcon(new ImageIcon(getClass().getClassLoader().getResource(pathToImages + "selectfromview.png"))); |
89 |
}catch(NullPointerException e){ |
90 |
//Sin icono
|
91 |
} |
92 |
bInsertPoint.setEnabled(false);
|
93 |
bInsertPoint.setSelected(true);
|
94 |
bInsertPoint.setToolTipText(PluginServices.getText(this, "selectfromview")); |
95 |
} |
96 |
return bInsertPoint;
|
97 |
} |
98 |
|
99 |
/**
|
100 |
* This method initializes jButton
|
101 |
*
|
102 |
* @return javax.swing.JButton
|
103 |
*/
|
104 |
public JButton getBLoad() { |
105 |
if (bLoad == null) { |
106 |
bLoad = new JButton(); |
107 |
bLoad.setPreferredSize(new java.awt.Dimension(22,22)); |
108 |
bLoad.setEnabled(true);
|
109 |
try{
|
110 |
bLoad.setIcon(new ImageIcon(getClass().getClassLoader().getResource(pathToImages + "load.png"))); |
111 |
}catch(NullPointerException e){ |
112 |
//Sin icono
|
113 |
} |
114 |
bLoad.setToolTipText(PluginServices.getText(this, "load_from_xml")); |
115 |
bLoad.setVisible(false);
|
116 |
} |
117 |
return bLoad;
|
118 |
} |
119 |
|
120 |
/**
|
121 |
* This method initializes bSave
|
122 |
*
|
123 |
* @return javax.swing.JButton
|
124 |
*/
|
125 |
public JButton getBSave() { |
126 |
if (bSave == null) { |
127 |
bSave = new JButton(); |
128 |
bSave.setText("");
|
129 |
bSave.setEnabled(false);
|
130 |
bSave.setPreferredSize(new java.awt.Dimension(22,22)); |
131 |
try{
|
132 |
bSave.setIcon(new ImageIcon(getClass().getClassLoader().getResource(pathToImages + "save.png"))); |
133 |
}catch(NullPointerException e){ |
134 |
//Sin icono
|
135 |
} |
136 |
bSave.setActionCommand("");
|
137 |
bSave.setToolTipText(PluginServices.getText(this, "save_to_xml")); |
138 |
bSave.setVisible(false);
|
139 |
} |
140 |
return bSave;
|
141 |
} |
142 |
|
143 |
/**
|
144 |
* This method initializes jButton
|
145 |
*
|
146 |
* @return javax.swing.JButton
|
147 |
*/
|
148 |
public JButton getBExportToAscii() { |
149 |
if (bExportToAscii == null) { |
150 |
bExportToAscii = new JButton(); |
151 |
bExportToAscii.setPreferredSize(new java.awt.Dimension(22,22)); |
152 |
bExportToAscii.setEnabled(false);
|
153 |
try{
|
154 |
bExportToAscii.setIcon(new ImageIcon(getClass().getClassLoader().getResource(pathToImages + "exportToAscii.png"))); |
155 |
}catch(NullPointerException e){ |
156 |
//Sin icono
|
157 |
} |
158 |
bExportToAscii.setToolTipText(PluginServices.getText(this, "save_to_ascii")); |
159 |
bExportToAscii.setVisible(false);
|
160 |
} |
161 |
return bExportToAscii;
|
162 |
} |
163 |
|
164 |
/**
|
165 |
* Activa o desactiva los botones de exportar capa de puntos y salvar
|
166 |
* la tabla a Ascii.
|
167 |
*@param isPossible Si vale true activa los controles de salvar y exportaci?n
|
168 |
*y si vale false los desactiva
|
169 |
*/
|
170 |
public void setSaveToDisk(boolean isPossible){ |
171 |
this.getBSave().setEnabled(isPossible);
|
172 |
this.getBExportToAscii().setEnabled(isPossible);
|
173 |
} |
174 |
//**********************End Getters & Setters*****************
|
175 |
} |