root / trunk / extensions / extGeoreferencing / src / org / gvsig / georeferencing / gui / panels / OptionsPanel.java @ 5217
History | View | Annotate | Download (4.21 KB)
1 |
package org.gvsig.georeferencing.gui.panels; |
---|---|
2 |
|
3 |
import java.awt.BorderLayout; |
4 |
import java.awt.FlowLayout; |
5 |
import java.awt.GridBagConstraints; |
6 |
import java.awt.GridBagLayout; |
7 |
import java.awt.event.ActionEvent; |
8 |
import java.awt.event.ActionListener; |
9 |
|
10 |
import javax.swing.JCheckBox; |
11 |
import javax.swing.JLabel; |
12 |
import javax.swing.JPanel; |
13 |
|
14 |
import org.gvsig.georeferencing.gui.dialogs.GeoreferencingDialog; |
15 |
import org.gvsig.georeferencing.layers.FLyrPoints; |
16 |
|
17 |
import com.iver.andami.PluginServices; |
18 |
import com.iver.cit.gvsig.gui.View; |
19 |
/**
|
20 |
* Panel que contiene opciones de georreferenciaci?n a elegir por
|
21 |
* el usuario. Esta clase no maneja eventos.
|
22 |
*
|
23 |
* @author Nacho Brodin (brodin_ign@gva.es)
|
24 |
*
|
25 |
*/
|
26 |
public class OptionsPanel extends JPanel implements ActionListener{ |
27 |
|
28 |
|
29 |
private JPanel pGeneral = null; |
30 |
private JPanel pShowPoints = null; |
31 |
private JCheckBox CbShowPoints = null; |
32 |
private JLabel jLabel1 = null; |
33 |
private GeoreferencingDialog grd = null; |
34 |
private String text = null; |
35 |
|
36 |
/**
|
37 |
* This is the default constructor
|
38 |
*/
|
39 |
public OptionsPanel(GeoreferencingDialog grd, String text) { |
40 |
super();
|
41 |
this.grd = grd;
|
42 |
this.text = text;
|
43 |
initialize(); |
44 |
} |
45 |
|
46 |
/**
|
47 |
* This method initializes this
|
48 |
*
|
49 |
* @return void
|
50 |
*/
|
51 |
private void initialize() { |
52 |
this.setLayout(new BorderLayout()); |
53 |
this.setPreferredSize(new java.awt.Dimension(370,20)); |
54 |
this.setSize(new java.awt.Dimension(370,20)); |
55 |
this.setLocation(new java.awt.Point(0,0)); |
56 |
this.add(getPGeneral(), java.awt.BorderLayout.CENTER);
|
57 |
} |
58 |
|
59 |
/**
|
60 |
* This method initializes jPanel
|
61 |
*
|
62 |
* @return javax.swing.JPanel
|
63 |
*/
|
64 |
private JPanel getPGeneral() { |
65 |
if (pGeneral == null) { |
66 |
GridBagConstraints gridBagConstraints5 = new GridBagConstraints(); |
67 |
pGeneral = new JPanel(); |
68 |
pGeneral.setLayout(new GridBagLayout()); |
69 |
pGeneral.setPreferredSize(new java.awt.Dimension(370,20)); |
70 |
gridBagConstraints5.gridx = 0;
|
71 |
gridBagConstraints5.gridy = 0;
|
72 |
gridBagConstraints5.anchor = java.awt.GridBagConstraints.CENTER; |
73 |
gridBagConstraints5.gridheight = 1;
|
74 |
gridBagConstraints5.gridwidth = 1;
|
75 |
pGeneral.add(getPShowPoints(), gridBagConstraints5); |
76 |
} |
77 |
return pGeneral;
|
78 |
} |
79 |
/**
|
80 |
* This method initializes jPanel1
|
81 |
*
|
82 |
* @return javax.swing.JPanel
|
83 |
*/
|
84 |
private JPanel getPShowPoints() { |
85 |
if (pShowPoints == null) { |
86 |
FlowLayout flowLayout6 = new FlowLayout(); |
87 |
pShowPoints = new JPanel(); |
88 |
pShowPoints.setLayout(flowLayout6); |
89 |
pShowPoints.setPreferredSize(new java.awt.Dimension(370,20)); |
90 |
flowLayout6.setAlignment(java.awt.FlowLayout.LEFT); |
91 |
flowLayout6.setHgap(2);
|
92 |
flowLayout6.setVgap(0);
|
93 |
pShowPoints.add(getCbCheckBox(), null);
|
94 |
} |
95 |
return pShowPoints;
|
96 |
} |
97 |
/**
|
98 |
* This method initializes jCheckBox1
|
99 |
*
|
100 |
* @return javax.swing.JCheckBox
|
101 |
*/
|
102 |
public JCheckBox getCbCheckBox() { |
103 |
if (CbShowPoints == null) { |
104 |
CbShowPoints = new JCheckBox(); |
105 |
CbShowPoints.setSelected(true);
|
106 |
CbShowPoints.setText(PluginServices.getText(this, this.text)); |
107 |
CbShowPoints.setName(this.text);
|
108 |
} |
109 |
return CbShowPoints;
|
110 |
} |
111 |
|
112 |
/* (non-Javadoc)
|
113 |
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
|
114 |
*/
|
115 |
public void actionPerformed(ActionEvent e) { |
116 |
|
117 |
FLyrPoints lyrPoints = grd.getConectorPanel().getDataPointsTabPanel().getSelectPointsPanel().getLyrPoints(); |
118 |
View theView = null; |
119 |
try{
|
120 |
theView = (View) PluginServices.getMDIManager().getActiveView();
|
121 |
}catch(ClassCastException exc){ |
122 |
return;
|
123 |
} |
124 |
|
125 |
if(e.getSource() == getCbCheckBox()){
|
126 |
|
127 |
if(getCbCheckBox().isSelected()){ //Mostramos el n?mero de punto |
128 |
grd.getConectorPanel().getDataPointsTabPanel().getSelectPointsPanel().getLyrPoints().setShowNumber(true);
|
129 |
grd.getConectorPanel().getAdjustGeorefPanel().getZoomLeft().draw(); |
130 |
grd.getConectorPanel().getAdjustGeorefPanel().getZoomRight().draw(); |
131 |
theView.getMapControl().getMapContext().invalidate(); |
132 |
}else{ //Ocultamos el n?mero de punto |
133 |
grd.getConectorPanel().getDataPointsTabPanel().getSelectPointsPanel().getLyrPoints().setShowNumber(false);
|
134 |
grd.getConectorPanel().getAdjustGeorefPanel().getZoomLeft().draw(); |
135 |
grd.getConectorPanel().getAdjustGeorefPanel().getZoomRight().draw(); |
136 |
theView.getMapControl().getMapContext().invalidate(); |
137 |
} |
138 |
} |
139 |
|
140 |
} |
141 |
|
142 |
public String getText() { |
143 |
return text;
|
144 |
} |
145 |
|
146 |
} |