root / trunk / extensions / extGeoreferencing / src / com / iver / cit / gvsig / gui / Panels / DataPointsTabPanel.java @ 3049
History | View | Annotate | Download (3.01 KB)
1 |
package com.iver.cit.gvsig.gui.Panels; |
---|---|
2 |
|
3 |
import javax.swing.JPanel; |
4 |
import javax.swing.JTabbedPane; |
5 |
import javax.swing.event.ChangeEvent; |
6 |
import javax.swing.event.ChangeListener; |
7 |
|
8 |
import com.iver.andami.PluginServices; |
9 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
10 |
import com.iver.cit.gvsig.fmap.layers.FLyrPoints; |
11 |
import com.iver.cit.gvsig.fmap.layers.FLyrPoints.GeoPoint; |
12 |
import com.iver.cit.gvsig.gui.View; |
13 |
import com.iver.cit.gvsig.gui.Dialogs.GeoreferencingDialog; |
14 |
import com.iver.cit.gvsig.gui.Panels.TablePointsPanel.PointTable; |
15 |
|
16 |
public class DataPointsTabPanel extends JPanel implements ChangeListener{ |
17 |
|
18 |
private GeoreferencingDialog parent = null; |
19 |
private SelectPointsPanel selectPointsPanel = null; |
20 |
private TablePointsPanel tablePointsPanel = null; |
21 |
private JTabbedPane tbPoints = null; |
22 |
private int widthTab = 380, heightTab = 185; |
23 |
|
24 |
/**
|
25 |
* This is the default constructor
|
26 |
*/
|
27 |
public DataPointsTabPanel(GeoreferencingDialog p) {
|
28 |
super();
|
29 |
this.parent = p;
|
30 |
initialize(); |
31 |
} |
32 |
|
33 |
/**
|
34 |
* This method initializes this
|
35 |
*
|
36 |
* @return void
|
37 |
*/
|
38 |
private void initialize() { |
39 |
this.setPreferredSize(new java.awt.Dimension(widthTab, heightTab)); |
40 |
this.setSize(new java.awt.Dimension(widthTab, heightTab)); |
41 |
this.setLocation(new java.awt.Point(0,0)); |
42 |
this.add(getTbPoints(), null); |
43 |
} |
44 |
|
45 |
/**
|
46 |
* @return Returns the selectPointsPanel.
|
47 |
*/
|
48 |
public TablePointsPanel getTablePointsPanel() {
|
49 |
if(tablePointsPanel == null){ |
50 |
tablePointsPanel = new TablePointsPanel(parent);
|
51 |
} |
52 |
return tablePointsPanel;
|
53 |
} |
54 |
|
55 |
/**
|
56 |
* @return Returns the selectPointsPanel.
|
57 |
*/
|
58 |
public SelectPointsPanel getSelectPointsPanel() {
|
59 |
if(selectPointsPanel == null){ |
60 |
selectPointsPanel = new SelectPointsPanel(parent);
|
61 |
} |
62 |
return selectPointsPanel;
|
63 |
} |
64 |
|
65 |
/**
|
66 |
* This method initializes jTabbedPane
|
67 |
*
|
68 |
* @return javax.swing.JTabbedPane
|
69 |
*/
|
70 |
private JTabbedPane getTbPoints() { |
71 |
if (tbPoints == null) { |
72 |
tbPoints = new JTabbedPane(); |
73 |
tbPoints.setSize(widthTab, heightTab); |
74 |
tbPoints.setPreferredSize(new java.awt.Dimension(widthTab, heightTab));
|
75 |
tbPoints.addTab("georef", this.getSelectPointsPanel()); |
76 |
tbPoints.addTab("table", this.getTablePointsPanel()); |
77 |
tbPoints.addChangeListener(this);
|
78 |
} |
79 |
return tbPoints;
|
80 |
} |
81 |
|
82 |
/**
|
83 |
* Controlamos que la ventana sea redimensionable solo cuando
|
84 |
* est? en el tab de tabla
|
85 |
*/
|
86 |
public void stateChanged(ChangeEvent ev) { |
87 |
if (((JTabbedPane)ev.getSource()).getSelectedIndex() == 0){ |
88 |
parent.getFrame().setResizable(false);
|
89 |
} |
90 |
|
91 |
if (((JTabbedPane)ev.getSource()).getSelectedIndex() == 1){ |
92 |
parent.getFrame().setResizable(true);
|
93 |
} |
94 |
|
95 |
} |
96 |
|
97 |
/**
|
98 |
* Calculo del nuevo tama?o a partir de un frame redimensionado
|
99 |
* @param w Ancho del frame
|
100 |
* @param h Alto del frame
|
101 |
*/
|
102 |
public void newFrameSize(int w, int h){ |
103 |
int initWFrame = 385; |
104 |
int initHFrame = 185; |
105 |
int initW = 380; |
106 |
|
107 |
widthTab = (int)((initW * w)/initWFrame);
|
108 |
|
109 |
this.resize(new java.awt.Dimension(widthTab, heightTab)); |
110 |
|
111 |
this.getTablePointsPanel().newFrameSize(w, h);
|
112 |
|
113 |
} |
114 |
|
115 |
} |