svn-gvsig-desktop / trunk / extensions / extGeoreferencing / src / com / iver / cit / gvsig / gui / panels / OptionsPanel.java @ 4734
History | View | Annotate | Download (4.22 KB)
1 |
package com.iver.cit.gvsig.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 com.iver.andami.PluginServices; |
15 |
import com.iver.cit.gvsig.fmap.layers.FLyrPoints; |
16 |
import com.iver.cit.gvsig.gui.View; |
17 |
import com.iver.cit.gvsig.gui.dialogs.GeoreferencingDialog; |
18 |
/**
|
19 |
* Panel que contiene opciones de georreferenciaci?n a elegir por
|
20 |
* el usuario. Esta clase no maneja eventos.
|
21 |
*
|
22 |
* @author Nacho Brodin (brodin_ign@gva.es)
|
23 |
*
|
24 |
*/
|
25 |
public class OptionsPanel extends JPanel implements ActionListener{ |
26 |
|
27 |
|
28 |
private JPanel pGeneral = null; |
29 |
private JPanel pShowPoints = null; |
30 |
private JCheckBox CbShowPoints = null; |
31 |
private JLabel jLabel1 = null; |
32 |
private GeoreferencingDialog grd = null; |
33 |
|
34 |
/**
|
35 |
* This is the default constructor
|
36 |
*/
|
37 |
public OptionsPanel(GeoreferencingDialog grd) {
|
38 |
super();
|
39 |
this.grd = grd;
|
40 |
initialize(); |
41 |
} |
42 |
|
43 |
/**
|
44 |
* This method initializes this
|
45 |
*
|
46 |
* @return void
|
47 |
*/
|
48 |
private void initialize() { |
49 |
this.setLayout(new BorderLayout()); |
50 |
this.setPreferredSize(new java.awt.Dimension(370,20)); |
51 |
this.setSize(new java.awt.Dimension(370,20)); |
52 |
this.setLocation(new java.awt.Point(0,0)); |
53 |
this.add(getPGeneral(), java.awt.BorderLayout.CENTER);
|
54 |
} |
55 |
|
56 |
/**
|
57 |
* This method initializes jPanel
|
58 |
*
|
59 |
* @return javax.swing.JPanel
|
60 |
*/
|
61 |
private JPanel getPGeneral() { |
62 |
if (pGeneral == null) { |
63 |
GridBagConstraints gridBagConstraints5 = new GridBagConstraints(); |
64 |
pGeneral = new JPanel(); |
65 |
pGeneral.setLayout(new GridBagLayout()); |
66 |
pGeneral.setPreferredSize(new java.awt.Dimension(370,20)); |
67 |
gridBagConstraints5.gridx = 0;
|
68 |
gridBagConstraints5.gridy = 0;
|
69 |
gridBagConstraints5.anchor = java.awt.GridBagConstraints.CENTER; |
70 |
gridBagConstraints5.gridheight = 1;
|
71 |
gridBagConstraints5.gridwidth = 1;
|
72 |
pGeneral.add(getPShowPoints(), gridBagConstraints5); |
73 |
} |
74 |
return pGeneral;
|
75 |
} |
76 |
/**
|
77 |
* This method initializes jPanel1
|
78 |
*
|
79 |
* @return javax.swing.JPanel
|
80 |
*/
|
81 |
private JPanel getPShowPoints() { |
82 |
if (pShowPoints == null) { |
83 |
jLabel1 = new JLabel(); |
84 |
jLabel1.setText(PluginServices.getText(this,"mostrar_puntos")); |
85 |
jLabel1.setPreferredSize(new java.awt.Dimension(130,15)); |
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(getCbShowPoints(), null);
|
94 |
pShowPoints.add(jLabel1, null);
|
95 |
} |
96 |
return pShowPoints;
|
97 |
} |
98 |
/**
|
99 |
* This method initializes jCheckBox1
|
100 |
*
|
101 |
* @return javax.swing.JCheckBox
|
102 |
*/
|
103 |
public JCheckBox getCbShowPoints() { |
104 |
if (CbShowPoints == null) { |
105 |
CbShowPoints = new JCheckBox(); |
106 |
CbShowPoints.setSelected(true);
|
107 |
CbShowPoints.addActionListener(this);
|
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() == getCbShowPoints()){
|
126 |
|
127 |
if(getCbShowPoints().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 |
} |