svn-gvsig-desktop / trunk / extensions / extGeoreferencing / src / com / iver / cit / gvsig / gui / Panels / OptionsPanel.java @ 4641
History | View | Annotate | Download (5.41 KB)
1 | 3014 | nacho | package com.iver.cit.gvsig.gui.Panels; |
---|---|---|---|
2 | |||
3 | 3037 | nacho | import java.awt.BorderLayout; |
4 | import java.awt.FlowLayout; |
||
5 | import java.awt.GridBagConstraints; |
||
6 | import java.awt.GridBagLayout; |
||
7 | 3102 | nacho | import java.awt.event.ActionEvent; |
8 | import java.awt.event.ActionListener; |
||
9 | 3037 | nacho | |
10 | import javax.swing.JCheckBox; |
||
11 | import javax.swing.JLabel; |
||
12 | 3014 | nacho | import javax.swing.JPanel; |
13 | |||
14 | 3037 | nacho | import com.iver.andami.PluginServices; |
15 | 3102 | nacho | 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 | 3014 | nacho | /**
|
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 | 3102 | nacho | public class OptionsPanel extends JPanel implements ActionListener{ |
26 | 3014 | nacho | |
27 | |||
28 | 3037 | nacho | private JPanel pGeneral = null; |
29 | 3102 | nacho | private JPanel pShowPoints = null; |
30 | private JCheckBox CbActivePoint = null; |
||
31 | 3037 | nacho | private JLabel jLabel = null; |
32 | 3102 | nacho | private JCheckBox CbShowPoints = null; |
33 | private JLabel jLabel1 = null; |
||
34 | private GeoreferencingDialog grd = null; |
||
35 | |||
36 | 3014 | nacho | /**
|
37 | * This is the default constructor
|
||
38 | */
|
||
39 | 3102 | nacho | public OptionsPanel(GeoreferencingDialog grd) {
|
40 | 3014 | nacho | super();
|
41 | 3102 | nacho | this.grd = grd;
|
42 | 3014 | nacho | initialize(); |
43 | } |
||
44 | |||
45 | /**
|
||
46 | * This method initializes this
|
||
47 | *
|
||
48 | * @return void
|
||
49 | */
|
||
50 | private void initialize() { |
||
51 | 3037 | nacho | this.setLayout(new BorderLayout()); |
52 | 3039 | nacho | this.setPreferredSize(new java.awt.Dimension(380,20)); |
53 | this.setSize(new java.awt.Dimension(380,20)); |
||
54 | 3014 | nacho | this.setLocation(new java.awt.Point(0,0)); |
55 | 3037 | nacho | this.add(getPGeneral(), java.awt.BorderLayout.CENTER);
|
56 | 3014 | nacho | } |
57 | |||
58 | 3037 | nacho | /**
|
59 | * This method initializes jPanel
|
||
60 | *
|
||
61 | * @return javax.swing.JPanel
|
||
62 | */
|
||
63 | private JPanel getPGeneral() { |
||
64 | if (pGeneral == null) { |
||
65 | GridBagConstraints gridBagConstraints5 = new GridBagConstraints(); |
||
66 | pGeneral = new JPanel(); |
||
67 | pGeneral.setLayout(new GridBagLayout()); |
||
68 | 3039 | nacho | pGeneral.setPreferredSize(new java.awt.Dimension(380,20)); |
69 | 3037 | nacho | gridBagConstraints5.gridx = 0;
|
70 | gridBagConstraints5.gridy = 0;
|
||
71 | gridBagConstraints5.anchor = java.awt.GridBagConstraints.CENTER; |
||
72 | gridBagConstraints5.gridheight = 1;
|
||
73 | gridBagConstraints5.gridwidth = 1;
|
||
74 | 3102 | nacho | pGeneral.add(getPShowPoints(), gridBagConstraints5); |
75 | 3037 | nacho | } |
76 | return pGeneral;
|
||
77 | } |
||
78 | /**
|
||
79 | * This method initializes jPanel1
|
||
80 | *
|
||
81 | * @return javax.swing.JPanel
|
||
82 | */
|
||
83 | 3102 | nacho | private JPanel getPShowPoints() { |
84 | if (pShowPoints == null) { |
||
85 | jLabel1 = new JLabel(); |
||
86 | jLabel1.setText(PluginServices.getText(this,"mostrar_puntos")); |
||
87 | jLabel1.setPreferredSize(new java.awt.Dimension(130,15)); |
||
88 | 3037 | nacho | jLabel = new JLabel(); |
89 | FlowLayout flowLayout6 = new FlowLayout(); |
||
90 | 3102 | nacho | pShowPoints = new JPanel(); |
91 | pShowPoints.setLayout(flowLayout6); |
||
92 | pShowPoints.setPreferredSize(new java.awt.Dimension(380,20)); |
||
93 | 3037 | nacho | flowLayout6.setAlignment(java.awt.FlowLayout.LEFT); |
94 | 3039 | nacho | flowLayout6.setHgap(10);
|
95 | 3037 | nacho | flowLayout6.setVgap(0);
|
96 | 3102 | nacho | jLabel.setText(PluginServices.getText(this,"activo")); |
97 | jLabel.setPreferredSize(new java.awt.Dimension(150,15)); |
||
98 | 3037 | nacho | jLabel.setToolTipText("");
|
99 | 3102 | nacho | pShowPoints.add(getCbActivePoint(), null);
|
100 | pShowPoints.add(jLabel, null);
|
||
101 | pShowPoints.add(getCbShowPoints(), null);
|
||
102 | pShowPoints.add(jLabel1, null);
|
||
103 | 3037 | nacho | } |
104 | 3102 | nacho | return pShowPoints;
|
105 | 3037 | nacho | } |
106 | /**
|
||
107 | * This method initializes jCheckBox
|
||
108 | *
|
||
109 | * @return javax.swing.JCheckBox
|
||
110 | */
|
||
111 | 3102 | nacho | public JCheckBox getCbActivePoint() { |
112 | if (CbActivePoint == null) { |
||
113 | CbActivePoint = new JCheckBox(); |
||
114 | CbActivePoint.setVerticalAlignment(javax.swing.SwingConstants.CENTER); |
||
115 | CbActivePoint.setSelected(true);
|
||
116 | CbActivePoint.setHorizontalAlignment(javax.swing.SwingConstants.LEADING); |
||
117 | CbActivePoint.addActionListener(this);
|
||
118 | 3037 | nacho | } |
119 | 3102 | nacho | return CbActivePoint;
|
120 | 3037 | nacho | } |
121 | 3102 | nacho | |
122 | /**
|
||
123 | * This method initializes jCheckBox1
|
||
124 | *
|
||
125 | * @return javax.swing.JCheckBox
|
||
126 | */
|
||
127 | public JCheckBox getCbShowPoints() { |
||
128 | if (CbShowPoints == null) { |
||
129 | CbShowPoints = new JCheckBox(); |
||
130 | CbShowPoints.setSelected(true);
|
||
131 | CbShowPoints.addActionListener(this);
|
||
132 | } |
||
133 | return CbShowPoints;
|
||
134 | } |
||
135 | |||
136 | /* (non-Javadoc)
|
||
137 | * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
|
||
138 | */
|
||
139 | public void actionPerformed(ActionEvent e) { |
||
140 | |||
141 | FLyrPoints lyrPoints = grd.getConectorPanel().getDataPointsTabPanel().getSelectPointsPanel().getLyrPoints(); |
||
142 | View theView = null; |
||
143 | try{
|
||
144 | theView = (View) PluginServices.getMDIManager().getActiveView();
|
||
145 | }catch(ClassCastException exc){ |
||
146 | return;
|
||
147 | } |
||
148 | |||
149 | if(e.getSource() == getCbShowPoints()){
|
||
150 | |||
151 | if(getCbShowPoints().isSelected()){ //Mostramos el n?mero de punto |
||
152 | grd.getConectorPanel().getDataPointsTabPanel().getSelectPointsPanel().getLyrPoints().setShowNumber(true);
|
||
153 | grd.getConectorPanel().getAdjustGeorefPanel().getZoomLeft().draw(); |
||
154 | grd.getConectorPanel().getAdjustGeorefPanel().getZoomRight().draw(); |
||
155 | theView.getMapControl().getMapContext().invalidate(); |
||
156 | }else{ //Ocultamos el n?mero de punto |
||
157 | grd.getConectorPanel().getDataPointsTabPanel().getSelectPointsPanel().getLyrPoints().setShowNumber(false);
|
||
158 | grd.getConectorPanel().getAdjustGeorefPanel().getZoomLeft().draw(); |
||
159 | grd.getConectorPanel().getAdjustGeorefPanel().getZoomRight().draw(); |
||
160 | theView.getMapControl().getMapContext().invalidate(); |
||
161 | } |
||
162 | } |
||
163 | |||
164 | if(e.getSource() == getCbActivePoint()){
|
||
165 | if(lyrPoints != null){ |
||
166 | if(getCbActivePoint().isSelected())
|
||
167 | lyrPoints.setPointActive(grd.getSelectedPoint(), true);
|
||
168 | else
|
||
169 | lyrPoints.setPointActive(grd.getSelectedPoint(), false);
|
||
170 | |||
171 | theView.getMapControl().getMapContext().invalidate(); |
||
172 | grd.getZoomControlLeft().draw(); |
||
173 | grd.getZoomControlRight().draw(); |
||
174 | } |
||
175 | } |
||
176 | } |
||
177 | |||
178 | /*if(e.getSource() == this.){
|
||
179 | |||
180 | }*/
|
||
181 | 3039 | nacho | } |