Statistics
| Revision:

svn-gvsig-desktop / trunk / extensions / extGeoreferencing / src / com / iver / cit / gvsig / gui / panels / ConectorPanel.java @ 4831

History | View | Annotate | Download (4.24 KB)

1 4686 nacho
package com.iver.cit.gvsig.gui.panels;
2
3
import java.awt.BorderLayout;
4
import java.awt.Dimension;
5
import java.awt.FlowLayout;
6
import java.awt.GridBagConstraints;
7
import java.awt.GridBagLayout;
8
9
import javax.swing.JPanel;
10
11
import com.iver.cit.gvsig.gui.dialogs.GeoreferencingDialog;
12
13
/**
14
 * Panel que contiene opciones de georreferenciaci?n a elegir por
15
 * el usuario. Esta clase no maneja eventos.
16
 *
17
 * @author Nacho Brodin (brodin_ign@gva.es)
18
 *
19
 */
20
public class ConectorPanel extends JPanel{
21
22
        private AdjustGeorefPanel adjustGeorefPanel = null;
23
        private DataPointsTabPanel dataPointsTabPanel = null;
24
        private GeoreferencingDialog grd = null;
25
        private JPanel pNorth = null;
26
        private JPanel pSouth = null;
27 4735 nacho
        private int heightConectorPanel = 385;
28 4686 nacho
        private int heightSouthPanel = 175;
29 4735 nacho
        private int heightNorthPanel = 210;
30 4686 nacho
31
        /**
32
         * This is the default constructor
33
         */
34
        public ConectorPanel(GeoreferencingDialog grd) {
35
                super();
36
                this.grd = grd;
37
                initialize();
38
        }
39
40
        /**
41
         * This method initializes this
42
         *
43
         * @return void
44
         */
45
        private void initialize() {
46
        GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
47
        gridBagConstraints1.gridx = 0;
48
        gridBagConstraints1.fill = java.awt.GridBagConstraints.NONE;
49
        gridBagConstraints1.anchor = java.awt.GridBagConstraints.CENTER;
50
        gridBagConstraints1.gridy = 1;
51
        GridBagConstraints gridBagConstraints = new GridBagConstraints();
52
        gridBagConstraints.gridx = 0;
53
        gridBagConstraints.gridy = 0;
54
        this.setLayout(new GridBagLayout());
55 4735 nacho
        this.setPreferredSize(new java.awt.Dimension(395,385));
56
        this.setSize(new java.awt.Dimension(395,385));
57 4686 nacho
        this.setLocation(new java.awt.Point(0,0));
58
        this.add(getPNorth(), gridBagConstraints);
59
        this.add(getPSouth(), gridBagConstraints1);
60
        }
61
62
63
        public AdjustGeorefPanel getAdjustGeorefPanel() {
64
                if (adjustGeorefPanel == null) {
65
                        adjustGeorefPanel = new AdjustGeorefPanel(grd);
66
                        adjustGeorefPanel.setSize(400, 275);
67
                        adjustGeorefPanel.setPreferredSize(new Dimension(400, 275));
68
                        adjustGeorefPanel.setVisible(true);
69
                }
70
                return adjustGeorefPanel;
71
        }
72
73
        public DataPointsTabPanel getDataPointsTabPanel() {
74
                if (dataPointsTabPanel == null) {
75
                        dataPointsTabPanel = new DataPointsTabPanel(grd);
76
                        dataPointsTabPanel.setVisible(true);
77
                }
78
                return dataPointsTabPanel;
79
        }
80
81
        /**
82
         * This method initializes jPanel
83
         *
84
         * @return javax.swing.JPanel
85
         */
86
        private JPanel getPNorth() {
87
                if (pNorth == null) {
88
                        BorderLayout borderLayout = new BorderLayout();
89
                        pNorth = new JPanel();
90
                        pNorth.setLayout(borderLayout);
91 4735 nacho
                        pNorth.setPreferredSize(new java.awt.Dimension(395,210));
92 4686 nacho
                        pNorth.add(getDataPointsTabPanel(), BorderLayout.CENTER);
93
                }
94
                return pNorth;
95
        }
96
97
        /**
98
         * This method initializes jPanel1
99
         *
100
         * @return javax.swing.JPanel
101
         */
102
        private JPanel getPSouth() {
103
                if (pSouth == null) {
104
                        BorderLayout borderLayout = new BorderLayout();
105
                        pSouth = new JPanel();
106
                        pSouth.setLayout(borderLayout);
107
                        pSouth.setPreferredSize(new java.awt.Dimension(395,175));
108
                        pSouth.add(getAdjustGeorefPanel(), BorderLayout.CENTER);
109
                }
110
                return pSouth;
111
        }
112
113
        /**
114
         * Asigna al canvas de los controles de zoom la propiedad de visibilidad a
115
         * verdadero o falso.
116
         * @param visible true para mostrar los canvas y false para ocultarlos
117
         */
118
        public void setCanvasVisible(boolean visible){
119
                this.getAdjustGeorefPanel().getZoomLeft().setVisible(visible);
120
                this.getAdjustGeorefPanel().getZoomRight().setVisible(visible);
121
        }
122
123
        /**
124
         * Calculo del nuevo tama?o a partir de un frame redimensionado
125
         * @param w Ancho del frame
126
         * @param h Alto del frame
127
         */
128
        public void newFrameSize(int w, int h){
129
                int newWidth = (int)(w * 0.98);
130
                this.setSize(new java.awt.Dimension(newWidth, heightConectorPanel));
131
                this.setPreferredSize(new java.awt.Dimension(newWidth, heightConectorPanel));
132
133
        this.getPNorth().setSize(new java.awt.Dimension(newWidth, heightNorthPanel));
134
        this.getPNorth().setPreferredSize(new java.awt.Dimension(newWidth, heightNorthPanel));
135
        this.getPSouth().setSize(new java.awt.Dimension(newWidth, heightSouthPanel));
136
        this.getPSouth().setPreferredSize(new java.awt.Dimension(newWidth, heightSouthPanel));
137
138
        this.getDataPointsTabPanel().newFrameSize(newWidth, h);
139
        }
140
}