Revision 8783 branches/v10+Piloto/libraries/libCq_CMS_praster/src/org/cresques/ui/DefaultDialogPanel.java
DefaultDialogPanel.java | ||
---|---|---|
23 | 23 |
*/ |
24 | 24 |
package org.cresques.ui; |
25 | 25 |
|
26 |
import java.awt.Dimension;
|
|
26 |
import java.awt.FlowLayout;
|
|
27 | 27 |
import java.awt.GridBagConstraints; |
28 | 28 |
import java.awt.GridBagLayout; |
29 | 29 |
import java.awt.event.ComponentEvent; |
... | ... | |
31 | 31 |
|
32 | 32 |
import javax.swing.JButton; |
33 | 33 |
import javax.swing.JPanel; |
34 |
import java.awt.FlowLayout; |
|
34 |
import javax.swing.event.ChangeEvent; |
|
35 |
import javax.swing.event.ChangeListener; |
|
35 | 36 |
|
37 |
import org.cresques.i18n.Messages; |
|
36 | 38 |
|
39 |
|
|
37 | 40 |
/** |
38 | 41 |
* @author Luis W. Sevilla (sevilla_lui@gva.es) |
39 | 42 |
*/ |
... | ... | |
41 | 44 |
final private static long serialVersionUID = -3370601314380922368L; |
42 | 45 |
protected JPanel contentPane = null; |
43 | 46 |
private JPanel tabPane = null; |
44 |
private JPanel buttonPane = null;
|
|
47 |
protected JPanel buttonPane = null;
|
|
45 | 48 |
private JButton acceptButton = null; |
46 | 49 |
private JButton cancelButton = null; |
47 | 50 |
private JButton applyButton = null; |
48 | 51 |
private int flag = 0; |
49 | 52 |
protected int cWidth = 0, difWidth = 0; |
50 | 53 |
protected int cHeight = 0, difHeight = 0; |
54 |
protected JPanel pButton = null; |
|
51 | 55 |
|
52 | 56 |
/** |
53 | 57 |
* Constructor |
... | ... | |
57 | 61 |
if(init) |
58 | 62 |
initialize(); |
59 | 63 |
} |
60 |
|
|
64 |
|
|
61 | 65 |
/** |
62 | 66 |
* Constructor |
63 | 67 |
*/ |
... | ... | |
75 | 79 |
//setBounds(0,0,321,230); |
76 | 80 |
//javax.swing.BoxLayout(jContentPane, javax.swing.BoxLayout.Y_AXIS); |
77 | 81 |
//jContentPane.setLayout(new java.awt.GridLayout(2,1)); |
78 |
GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); |
|
79 |
gridBagConstraints1.insets = new java.awt.Insets(3,22,2,23);
|
|
80 |
gridBagConstraints1.gridy = 1;
|
|
81 |
gridBagConstraints1.gridx = 0;
|
|
82 |
GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
|
|
83 |
gridBagConstraints11.gridx = 0;
|
|
84 |
gridBagConstraints11.insets = new java.awt.Insets(4,0,0,0);
|
|
85 |
gridBagConstraints11.gridy = 1;
|
|
82 | 86 |
GridBagConstraints gridBagConstraints = new GridBagConstraints(); |
83 | 87 |
gridBagConstraints.insets = new java.awt.Insets(5,0,2,0); |
84 | 88 |
gridBagConstraints.gridy = 0; |
... | ... | |
89 | 93 |
//jContentPane.setSize(30, 24); |
90 | 94 |
this.setPreferredSize(new java.awt.Dimension(320, 165)); |
91 | 95 |
this.add(getTabPanel(), gridBagConstraints); |
92 |
this.add(getButtonPanel(), gridBagConstraints1);
|
|
96 |
this.add(getPButton(), gridBagConstraints11);
|
|
93 | 97 |
this.addComponentListener(this); |
94 |
|
|
98 |
|
|
95 | 99 |
} |
96 | 100 |
|
97 | 101 |
/** |
... | ... | |
117 | 121 |
gridBagConstraints2.gridx = 0; |
118 | 122 |
tabPane = new JPanel(); |
119 | 123 |
tabPane.setLayout(new GridBagLayout()); |
120 |
|
|
121 |
|
|
124 |
|
|
125 |
|
|
122 | 126 |
//tabPane.setBounds(6, 7, 309, 189); |
123 | 127 |
tabPane.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.SoftBevelBorder.RAISED)); |
124 | 128 |
tabPane.add(getContentPanel(), gridBagConstraints2); |
... | ... | |
128 | 132 |
} |
129 | 133 |
|
130 | 134 |
/** |
131 |
* Obtiene el panel que contiene los botones de Aceptar, Cancelar y Aplicar |
|
135 |
* This method initializes jPanel |
|
136 |
* |
|
137 |
* @return javax.swing.JPanel |
|
138 |
*/ |
|
139 |
private JPanel getPButton() { |
|
140 |
if (pButton == null) { |
|
141 |
FlowLayout flowLayout1 = new FlowLayout(); |
|
142 |
flowLayout1.setAlignment(java.awt.FlowLayout.RIGHT); |
|
143 |
flowLayout1.setHgap(0); |
|
144 |
flowLayout1.setVgap(0); |
|
145 |
pButton = new JPanel(); |
|
146 |
pButton.setPreferredSize(new java.awt.Dimension(320,25)); |
|
147 |
pButton.setLayout(flowLayout1); |
|
148 |
pButton.add(getButtonPanel(), null); |
|
149 |
} |
|
150 |
return pButton; |
|
151 |
} |
|
152 |
|
|
153 |
|
|
154 |
/** |
|
155 |
* Obtiene el panel que contiene los botones de Aceptar, Cancelar y Aplicar |
|
132 | 156 |
* @return |
133 | 157 |
*/ |
134 | 158 |
protected JPanel getButtonPanel() { |
135 | 159 |
if (buttonPane == null) { |
136 |
GridBagConstraints gridBagConstraints5 = new GridBagConstraints(); |
|
137 |
gridBagConstraints5.insets = new java.awt.Insets(1,0,1,0); |
|
138 |
gridBagConstraints5.gridy = 0; |
|
139 |
gridBagConstraints5.gridx = 2; |
|
140 | 160 |
GridBagConstraints gridBagConstraints4 = new GridBagConstraints(); |
141 |
gridBagConstraints4.insets = new java.awt.Insets(1,0,1,8); |
|
161 |
gridBagConstraints4.gridx = 2; |
|
162 |
gridBagConstraints4.insets = new java.awt.Insets(0,3,0,0); |
|
142 | 163 |
gridBagConstraints4.gridy = 0; |
143 |
gridBagConstraints4.gridx = 1; |
|
144 | 164 |
GridBagConstraints gridBagConstraints3 = new GridBagConstraints(); |
145 |
gridBagConstraints3.insets = new java.awt.Insets(1,0,1,8); |
|
165 |
gridBagConstraints3.gridx = 1; |
|
166 |
gridBagConstraints3.insets = new java.awt.Insets(0,3,0,3); |
|
146 | 167 |
gridBagConstraints3.gridy = 0; |
147 |
gridBagConstraints3.gridx = 0; |
|
168 |
GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); |
|
169 |
gridBagConstraints1.insets = new java.awt.Insets(0,0,0,3); |
|
170 |
gridBagConstraints1.gridy = 0; |
|
171 |
gridBagConstraints1.gridx = 0; |
|
148 | 172 |
buttonPane = new JPanel(); |
149 | 173 |
buttonPane.setLayout(new GridBagLayout()); |
150 |
buttonPane.setSize(309, 25); |
|
151 |
buttonPane.setBounds(6, 200, 309, 25); |
|
152 |
buttonPane.add(getAcceptButton(), gridBagConstraints3); |
|
153 |
buttonPane.add(getCancelButton(), gridBagConstraints4); |
|
154 |
buttonPane.add(getApplyButton(), gridBagConstraints5); |
|
174 |
buttonPane.add(getAcceptButton(), gridBagConstraints1); |
|
175 |
buttonPane.add(getCancelButton(), gridBagConstraints3); |
|
176 |
buttonPane.add(getApplyButton(), gridBagConstraints4); |
|
155 | 177 |
} |
156 | 178 |
|
157 | 179 |
return buttonPane; |
... | ... | |
165 | 187 |
public JButton getAcceptButton() { |
166 | 188 |
if (acceptButton == null) { |
167 | 189 |
acceptButton = new JButton("Aceptar"); |
168 |
acceptButton.setText("Aceptar");
|
|
190 |
acceptButton.setText(Messages.getText("Aceptar"));
|
|
169 | 191 |
} |
170 | 192 |
|
171 | 193 |
return acceptButton; |
... | ... | |
179 | 201 |
public JButton getCancelButton() { |
180 | 202 |
if (cancelButton == null) { |
181 | 203 |
cancelButton = new JButton("Cancelar"); |
182 |
cancelButton.setText("Cancelar");
|
|
204 |
cancelButton.setText(Messages.getText("Cancelar"));
|
|
183 | 205 |
} |
184 | 206 |
|
185 | 207 |
return cancelButton; |
... | ... | |
192 | 214 |
*/ |
193 | 215 |
public JButton getApplyButton() { |
194 | 216 |
if (applyButton == null) { |
195 |
applyButton = new JButton("Aplicar");
|
|
217 |
applyButton = new JButton(Messages.getText("Aplicar"));
|
|
196 | 218 |
} |
197 | 219 |
|
198 | 220 |
return applyButton; |
... | ... | |
200 | 222 |
|
201 | 223 |
public void componentHidden(ComponentEvent e) { |
202 | 224 |
// TODO Auto-generated method stub |
203 |
|
|
225 |
|
|
204 | 226 |
} |
205 | 227 |
|
206 | 228 |
public void componentMoved(ComponentEvent e) { |
207 | 229 |
// TODO Auto-generated method stub |
208 |
|
|
230 |
|
|
209 | 231 |
} |
210 | 232 |
|
211 | 233 |
public void componentResized(ComponentEvent e) { |
... | ... | |
219 | 241 |
cHeight = this.getSize().height; |
220 | 242 |
flag++; |
221 | 243 |
} |
222 |
|
|
244 |
|
|
223 | 245 |
int nWidth = getWidth(); |
224 | 246 |
int nHeight = getHeight(); |
225 | 247 |
difWidth = nWidth - cWidth; |
226 | 248 |
difHeight = nHeight - cHeight; |
227 | 249 |
this.tabPane.setSize(this.tabPane.getSize().width + difWidth, this.tabPane.getSize().height + difHeight); |
228 | 250 |
this.tabPane.setLocation(this.tabPane.getLocation().x - difWidth/2, this.tabPane.getLocation().y - difHeight/2); |
251 |
|
|
229 | 252 |
this.contentPane.setSize(this.contentPane.getSize().width + difWidth, this.contentPane.getSize().height + difHeight); |
230 |
this.buttonPane.setLocation(this.buttonPane.getLocation().x + difWidth/2, this.buttonPane.getLocation().y + difHeight/2); |
|
231 |
|
|
253 |
//this.pButton.setSize(this.getPButton().getWidth() + difWidth/2, 25); |
|
254 |
//this.buttonPane.setLocation(this.buttonPane.getLocation().x + difWidth/2, this.buttonPane.getLocation().y + difHeight/2); |
|
255 |
this.pButton.setLocation(this.pButton.getLocation().x + difWidth/2, this.pButton.getLocation().y + difHeight/2); |
|
256 |
|
|
232 | 257 |
} |
233 |
|
|
258 |
|
|
234 | 259 |
public void componentShown(ComponentEvent e) { |
235 | 260 |
// TODO Auto-generated method stub |
236 |
|
|
261 |
|
|
237 | 262 |
} |
263 |
|
|
264 |
|
|
238 | 265 |
} // @jve:decl-index=0:visual-constraint="12,13" |
Also available in: Unified diff