Revision 4269
trunk/extensions/extRasterTools/src/com/iver/cit/gvsig/rasterTools/saveRaster/pruebas2/MethodDataInputListener.java | ||
---|---|---|
16 | 16 |
public class MethodDataInputListener implements ActionListener, ChangeListener, MouseListener, FocusListener, |
17 | 17 |
KeyListener { |
18 | 18 |
|
19 |
private MethodDataInputPanel panel = null; |
|
19 |
private MethodSaveRasterSelectorPanel selectorPanel = null; |
|
20 |
private MethodDataInputPanel panel = null; |
|
20 | 21 |
|
21 | 22 |
/** |
22 | 23 |
* This is the default constructor |
23 | 24 |
*/ |
24 | 25 |
public MethodDataInputListener(MethodDataInputPanel panel) { |
25 | 26 |
this.panel = panel; |
26 |
//rgbInputPanel = ((RGBInputPanel)panel.getPRGBInput());
|
|
27 |
/*rgbInputPanel.getTBlue().addFocusListener(this);
|
|
28 |
rgbInputPanel.getTGreen().addFocusListener(this);
|
|
29 |
rgbInputPanel.getTRed().addFocusListener(this);*/
|
|
27 |
selectorPanel = (MethodSaveRasterSelectorPanel)panel.getPWest();
|
|
28 |
selectorPanel.getRbScale().addActionListener(this);
|
|
29 |
selectorPanel.getRbSize().addActionListener(this);
|
|
30 |
selectorPanel.getRbMtsPixel().addActionListener(this);
|
|
30 | 31 |
} |
31 | 32 |
|
32 | 33 |
//******************************* |
33 | 34 |
//ChangeListener |
34 | 35 |
|
35 |
public void focusGained(FocusEvent e) { |
|
36 |
// TODO Auto-generated method stub |
|
37 |
|
|
36 |
public void focusGained(FocusEvent e) { |
|
38 | 37 |
} |
39 | 38 |
|
40 | 39 |
public void focusLost(FocusEvent e) { |
41 |
// TODO Auto-generated method stub |
|
42 | 40 |
} |
43 | 41 |
|
44 | 42 |
public void stateChanged(ChangeEvent e) { |
45 |
// TODO Auto-generated method stub |
|
46 |
|
|
47 | 43 |
} |
48 | 44 |
|
49 | 45 |
//******************************* |
50 | 46 |
//MouseListener |
51 | 47 |
public void mouseClicked(MouseEvent e) { |
52 |
// TODO Auto-generated method stub |
|
53 |
|
|
54 | 48 |
} |
55 | 49 |
|
56 | 50 |
public void mouseEntered(MouseEvent e) { |
57 |
// TODO Auto-generated method stub |
|
58 |
|
|
59 | 51 |
} |
60 | 52 |
|
61 | 53 |
public void mouseExited(MouseEvent e) { |
62 |
// TODO Auto-generated method stub |
|
63 |
|
|
64 | 54 |
} |
65 | 55 |
|
66 |
public void mousePressed(MouseEvent e) { |
|
67 |
// TODO Auto-generated method stub |
|
68 |
|
|
56 |
public void mousePressed(MouseEvent e) { |
|
69 | 57 |
} |
70 | 58 |
|
71 |
public void mouseReleased(MouseEvent e) { |
|
72 |
// TODO Auto-generated method stub |
|
73 |
|
|
59 |
public void mouseReleased(MouseEvent e) { |
|
74 | 60 |
} |
75 | 61 |
|
76 |
public void keyPressed(KeyEvent e) { |
|
77 |
// TODO Auto-generated method stub |
|
78 |
|
|
62 |
public void keyPressed(KeyEvent e) { |
|
79 | 63 |
} |
80 | 64 |
|
81 |
public void keyReleased(KeyEvent e) { |
|
82 |
// TODO Auto-generated method stub |
|
83 |
|
|
65 |
public void keyReleased(KeyEvent e) { |
|
84 | 66 |
} |
85 | 67 |
|
86 |
public void keyTyped(KeyEvent e) { |
|
87 |
// TODO Auto-generated method stub |
|
88 |
|
|
68 |
public void keyTyped(KeyEvent e) { |
|
89 | 69 |
} |
90 | 70 |
|
91 | 71 |
//******************************* |
92 | 72 |
//ActionListener |
93 | 73 |
|
94 | 74 |
public void actionPerformed(ActionEvent e) { |
95 |
// TODO Auto-generated method stub |
|
75 |
if(e.getSource() == selectorPanel.getRbScale()){ |
|
76 |
((InputScaleDataPanel)panel.getPEast()).setActiveScale(0); |
|
77 |
((InputSizeDataPanel)panel.getPSouth()).setActive(false); |
|
78 |
} |
|
96 | 79 |
|
80 |
if(e.getSource() == selectorPanel.getRbMtsPixel()){ |
|
81 |
((InputScaleDataPanel)panel.getPEast()).setActiveScale(1); |
|
82 |
((InputSizeDataPanel)panel.getPSouth()).setActive(false); |
|
83 |
} |
|
84 |
|
|
85 |
if(e.getSource() == selectorPanel.getRbSize()){ |
|
86 |
((InputScaleDataPanel)panel.getPEast()).setActiveScale(2); |
|
87 |
((InputSizeDataPanel)panel.getPSouth()).setActive(true); |
|
88 |
} |
|
97 | 89 |
} |
98 | 90 |
|
99 | 91 |
} |
trunk/extensions/extRasterTools/src/com/iver/cit/gvsig/rasterTools/saveRaster/pruebas2/InputScaleDataPanel.java | ||
---|---|---|
1 | 1 |
package com.iver.cit.gvsig.rasterTools.saveRaster.pruebas2; |
2 | 2 |
|
3 |
import javax.swing.JPanel; |
|
3 |
import java.awt.Color; |
|
4 |
import java.awt.FlowLayout; |
|
5 |
import java.awt.GridBagConstraints; |
|
4 | 6 |
import java.awt.GridBagLayout; |
5 |
import java.awt.GridBagConstraints; |
|
7 |
|
|
8 |
import javax.swing.JComboBox; |
|
6 | 9 |
import javax.swing.JLabel; |
10 |
import javax.swing.JPanel; |
|
7 | 11 |
import javax.swing.JTextField; |
8 |
import javax.swing.JComboBox; |
|
9 |
import java.awt.FlowLayout; |
|
10 | 12 |
|
11 | 13 |
public class InputScaleDataPanel extends JPanel { |
12 | 14 |
|
... | ... | |
25 | 27 |
public InputScaleDataPanel() { |
26 | 28 |
super(); |
27 | 29 |
initialize(); |
30 |
setActiveScale(0); |
|
28 | 31 |
} |
29 | 32 |
|
30 | 33 |
/** |
... | ... | |
87 | 90 |
pResolution.setLayout(flowLayout1); |
88 | 91 |
pResolution.setPreferredSize(new java.awt.Dimension(180,34)); |
89 | 92 |
pResolution.add(lResolution, null); |
90 |
pResolution.add(getCResolution(), null); |
|
93 |
pResolution.add(getCbResolution(), null);
|
|
91 | 94 |
} |
92 | 95 |
return pResolution; |
93 | 96 |
} |
... | ... | |
143 | 146 |
* |
144 | 147 |
* @return javax.swing.JComboBox |
145 | 148 |
*/ |
146 |
private JComboBox getCResolution() { |
|
149 |
private JComboBox getCbResolution() {
|
|
147 | 150 |
if (cResolution == null) { |
148 | 151 |
cResolution = new JComboBox(); |
149 | 152 |
cResolution.setPreferredSize(new java.awt.Dimension(80,24)); |
153 |
cResolution.addItem(75+""); |
|
154 |
cResolution.addItem(150+""); |
|
155 |
cResolution.addItem(300+""); |
|
150 | 156 |
} |
151 | 157 |
return cResolution; |
152 | 158 |
} |
153 | 159 |
|
160 |
/** |
|
161 |
* Pone como activo el input scale o mts por pixel dependiendo del |
|
162 |
* valor del par?metro. |
|
163 |
* @param active Si vale 0 activa la Escala y desactiva mts/pixel. |
|
164 |
* Si vale 1 activa mts/pixel y desactiva la Escala. |
|
165 |
* Si vale 2 desactiva ambos. |
|
166 |
*/ |
|
167 |
public void setActiveScale(int active){ |
|
168 |
Color backgroudColor = getBackground(); |
|
169 |
this.getCbResolution().setEnabled(true); |
|
170 |
|
|
171 |
if(active == 0){ |
|
172 |
getTScale().setEnabled(true); |
|
173 |
getTMtsPixel().setEnabled(false); |
|
174 |
getTScale().setBackground(Color.white); |
|
175 |
getTMtsPixel().setBackground(backgroudColor); |
|
176 |
}else if(active == 1){ |
|
177 |
getTScale().setEnabled(false); |
|
178 |
getTMtsPixel().setEnabled(true); |
|
179 |
getTScale().setBackground(backgroudColor); |
|
180 |
getTMtsPixel().setBackground(Color.white); |
|
181 |
}else if(active == 2){ |
|
182 |
getTScale().setEnabled(false); |
|
183 |
getTMtsPixel().setEnabled(false); |
|
184 |
getTScale().setBackground(backgroudColor); |
|
185 |
getTMtsPixel().setBackground(backgroudColor); |
|
186 |
} |
|
187 |
} |
|
154 | 188 |
} |
trunk/extensions/extRasterTools/src/com/iver/cit/gvsig/rasterTools/saveRaster/pruebas2/MethodSaveRasterSelectorPanel.java | ||
---|---|---|
1 | 1 |
package com.iver.cit.gvsig.rasterTools.saveRaster.pruebas2; |
2 | 2 |
|
3 |
import java.awt.FlowLayout; |
|
4 |
import java.awt.GridBagConstraints; |
|
5 |
import java.awt.GridBagLayout; |
|
6 |
|
|
7 |
import javax.swing.ButtonGroup; |
|
3 | 8 |
import javax.swing.JPanel; |
4 |
import java.awt.GridBagLayout; |
|
5 | 9 |
import javax.swing.JRadioButton; |
6 |
import java.awt.GridBagConstraints; |
|
7 |
import java.awt.FlowLayout; |
|
8 | 10 |
|
9 | 11 |
public class MethodSaveRasterSelectorPanel extends JPanel { |
10 | 12 |
|
11 |
private JPanel pMethodSelector = null; |
|
12 |
private JRadioButton rbScale = null; |
|
13 |
private JRadioButton rbMtsPixel = null; |
|
14 |
private JRadioButton rbSize = null; |
|
13 |
private JPanel pMethodSelector = null; |
|
14 |
private JRadioButton rbScale = null; |
|
15 |
private JRadioButton rbMtsPixel = null; |
|
16 |
private JRadioButton rbSize = null; |
|
17 |
private ButtonGroup group = null; |
|
15 | 18 |
|
16 | 19 |
/** |
17 | 20 |
* This is the default constructor |
... | ... | |
33 | 36 |
this.setLayout(flowLayout); |
34 | 37 |
this.setSize(98, 73); |
35 | 38 |
this.setPreferredSize(new java.awt.Dimension(98,73)); |
39 |
group = new ButtonGroup(); |
|
36 | 40 |
this.add(getPMethodSelector(), null); |
37 | 41 |
} |
38 | 42 |
|
... | ... | |
41 | 45 |
* |
42 | 46 |
* @return javax.swing.JPanel |
43 | 47 |
*/ |
44 |
private JPanel getPMethodSelector() {
|
|
48 |
public JPanel getPMethodSelector() {
|
|
45 | 49 |
if (pMethodSelector == null) { |
46 | 50 |
GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); |
47 | 51 |
gridBagConstraints2.gridx = 0; |
... | ... | |
59 | 63 |
pMethodSelector.setLayout(new GridBagLayout()); |
60 | 64 |
pMethodSelector.setBorder(javax.swing.BorderFactory.createLineBorder(java.awt.Color.gray,1)); |
61 | 65 |
pMethodSelector.setPreferredSize(new java.awt.Dimension(105,71)); |
66 |
group.add(getRbScale()); |
|
67 |
group.add(getRbMtsPixel()); |
|
68 |
group.add(getRbSize()); |
|
62 | 69 |
pMethodSelector.add(getRbScale(), gridBagConstraints1); |
63 | 70 |
pMethodSelector.add(getRbMtsPixel(), gridBagConstraints); |
64 | 71 |
pMethodSelector.add(getRbSize(), gridBagConstraints2); |
... | ... | |
71 | 78 |
* |
72 | 79 |
* @return javax.swing.JRadioButton |
73 | 80 |
*/ |
74 |
private JRadioButton getRbScale() {
|
|
81 |
public JRadioButton getRbScale() {
|
|
75 | 82 |
if (rbScale == null) { |
76 | 83 |
rbScale = new JRadioButton(); |
77 | 84 |
rbScale.setText("Escala"); |
... | ... | |
85 | 92 |
* |
86 | 93 |
* @return javax.swing.JRadioButton |
87 | 94 |
*/ |
88 |
private JRadioButton getRbMtsPixel() {
|
|
95 |
public JRadioButton getRbMtsPixel() {
|
|
89 | 96 |
if (rbMtsPixel == null) { |
90 | 97 |
rbMtsPixel = new JRadioButton(); |
91 | 98 |
rbMtsPixel.setText("Mts/Pixel"); |
... | ... | |
98 | 105 |
* |
99 | 106 |
* @return javax.swing.JRadioButton |
100 | 107 |
*/ |
101 |
private JRadioButton getRbSize() {
|
|
108 |
public JRadioButton getRbSize() {
|
|
102 | 109 |
if (rbSize == null) { |
103 | 110 |
rbSize = new JRadioButton(); |
104 | 111 |
rbSize.setText("Tama?o"); |
trunk/extensions/extRasterTools/src/com/iver/cit/gvsig/rasterTools/saveRaster/pruebas2/InputSizeDataPanel.java | ||
---|---|---|
4 | 4 |
import javax.swing.JLabel; |
5 | 5 |
import javax.swing.JTextField; |
6 | 6 |
import javax.swing.JComboBox; |
7 |
|
|
8 |
import java.awt.Color; |
|
7 | 9 |
import java.awt.FlowLayout; |
8 | 10 |
|
9 | 11 |
public class InputSizeDataPanel extends JPanel { |
... | ... | |
21 | 23 |
public InputSizeDataPanel() { |
22 | 24 |
super(); |
23 | 25 |
initialize(); |
26 |
this.setActive(false); |
|
24 | 27 |
} |
25 | 28 |
|
26 | 29 |
/** |
... | ... | |
108 | 111 |
return cbMeasureType; |
109 | 112 |
} |
110 | 113 |
|
114 |
/** |
|
115 |
* Activa o desactiva las cajas de texto con los datos |
|
116 |
* ancho y alto. |
|
117 |
* @param active true activa los JTextBox y false los desactiva |
|
118 |
*/ |
|
119 |
public void setActive(boolean active){ |
|
120 |
Color backgroudColor = getBackground(); |
|
121 |
|
|
122 |
this.getTWidth().setEnabled(active); |
|
123 |
this.getTHeight().setEnabled(active); |
|
124 |
this.getCbMeasureType().setEnabled(active); |
|
125 |
|
|
126 |
if(active){ |
|
127 |
getTWidth().setBackground(Color.white); |
|
128 |
getTHeight().setBackground(Color.white); |
|
129 |
}else{ |
|
130 |
getTWidth().setBackground(backgroudColor); |
|
131 |
getTHeight().setBackground(backgroudColor); |
|
132 |
} |
|
133 |
} |
|
111 | 134 |
} |
trunk/extensions/extRasterTools/src/com/iver/cit/gvsig/rasterTools/saveRaster/pruebas2/PruebaFrame.java | ||
---|---|---|
1 |
package com.iver.cit.gvsig.rasterTools.saveRaster.pruebas2; |
|
2 |
|
|
3 |
import javax.swing.JFrame; |
|
4 |
|
|
5 |
public class PruebaFrame extends JFrame{ |
|
6 |
|
|
7 |
public PruebaFrame(){ |
|
8 |
this.setSize(350,170); |
|
9 |
this.getContentPane().add(new MethodDataInputPanel()); |
|
10 |
this.show(); |
|
11 |
} |
|
12 |
/** |
|
13 |
* @param args |
|
14 |
*/ |
|
15 |
public static void main(String[] args) { |
|
16 |
PruebaFrame f = new PruebaFrame(); |
|
17 |
} |
|
18 |
|
|
19 |
} |
|
0 | 20 |
trunk/extensions/extRasterTools/src/com/iver/cit/gvsig/rasterTools/saveRaster/pruebas2/MethodDataInputPanel.java | ||
---|---|---|
12 | 12 |
private InputSizeDataPanel pSouth = null; |
13 | 13 |
private MethodSaveRasterSelectorPanel pWest = null; |
14 | 14 |
private InputScaleDataPanel pEast = null; |
15 |
private MethodDataInputListener listener = null; |
|
15 | 16 |
|
16 | 17 |
/** |
17 | 18 |
* This is the default constructor |
... | ... | |
19 | 20 |
public MethodDataInputPanel() { |
20 | 21 |
super(); |
21 | 22 |
initialize(); |
23 |
listener = new MethodDataInputListener(this); |
|
22 | 24 |
} |
23 | 25 |
|
24 | 26 |
/** |
... | ... | |
47 | 49 |
* |
48 | 50 |
* @return javax.swing.JPanel |
49 | 51 |
*/ |
50 |
private JPanel getPNorth() {
|
|
52 |
public JPanel getPNorth() {
|
|
51 | 53 |
if (pNorth == null) { |
52 | 54 |
FlowLayout flowLayout = new FlowLayout(); |
53 | 55 |
flowLayout.setHgap(0); |
... | ... | |
65 | 67 |
* |
66 | 68 |
* @return javax.swing.JPanel |
67 | 69 |
*/ |
68 |
private JPanel getPSouth() {
|
|
70 |
public JPanel getPSouth() {
|
|
69 | 71 |
if (pSouth == null) { |
70 | 72 |
pSouth = new InputSizeDataPanel(); |
71 | 73 |
pSouth.setPreferredSize(new java.awt.Dimension(337,30)); |
... | ... | |
78 | 80 |
* |
79 | 81 |
* @return javax.swing.JPanel |
80 | 82 |
*/ |
81 |
private JPanel getPWest() {
|
|
83 |
public JPanel getPWest() {
|
|
82 | 84 |
if (pWest == null) { |
83 | 85 |
FlowLayout flowLayout1 = new FlowLayout(); |
84 | 86 |
flowLayout1.setVgap(5); |
... | ... | |
94 | 96 |
* |
95 | 97 |
* @return javax.swing.JPanel |
96 | 98 |
*/ |
97 |
private JPanel getPEast() {
|
|
99 |
public JPanel getPEast() {
|
|
98 | 100 |
if (pEast == null) { |
99 | 101 |
pEast = new InputScaleDataPanel(); |
100 | 102 |
pEast.setPreferredSize(new java.awt.Dimension(215,92)); |
Also available in: Unified diff