Statistics
| Revision:

svn-gvsig-desktop / tags / v1_1_Build_914 / extensions / extGeoreferencing / src / org / gvsig / georeferencing / gui / panels / ConectorPanel.java @ 11873

History | View | Annotate | Download (5.22 KB)

1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2006 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
package org.gvsig.georeferencing.gui.panels;
20

    
21
import java.awt.BorderLayout;
22
import java.awt.Dimension;
23
import java.awt.GridBagConstraints;
24
import java.awt.GridBagLayout;
25

    
26
import javax.swing.JPanel;
27

    
28
import org.gvsig.georeferencing.gui.dialog.GeoreferencingDialog;
29

    
30

    
31
/**
32
 * Panel que contiene opciones de georreferenciaci?n a elegir por
33
 * el usuario. Esta clase no maneja eventos.
34
 * 
35
 * @author Nacho Brodin (brodin_ign@gva.es)
36
 *
37
 */
38
public class ConectorPanel extends JPanel{
39

    
40
        private AdjustGeorefPanel adjustGeorefPanel = null; 
41
        private DataPointsTabPanel dataPointsTabPanel = null;
42
        private GeoreferencingDialog grd = null;
43
        private JPanel pNorth = null;
44
        private JPanel pSouth = null;
45
        private int heightConectorPanel = 395;
46
        private int heightSouthPanel = 185;
47
        private int heightNorthPanel = 210;
48
        
49
        /**
50
         * This is the default constructor
51
         */
52
        public ConectorPanel(GeoreferencingDialog grd) {
53
                super();
54
                this.grd = grd;
55
                initialize();
56
        }
57

    
58
        /**
59
         * This is the default constructor
60
         */
61
        public ConectorPanel() {
62
                super();
63
                initialize();
64
        }
65
        
66
        /**
67
         * This method initializes this
68
         * 
69
         * @return void
70
         */
71
        private void initialize() {        
72
        GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
73
        gridBagConstraints1.gridx = 0;
74
        gridBagConstraints1.fill = java.awt.GridBagConstraints.NONE;
75
        gridBagConstraints1.anchor = java.awt.GridBagConstraints.CENTER;
76
        gridBagConstraints1.gridy = 1;
77
        GridBagConstraints gridBagConstraints = new GridBagConstraints();
78
        gridBagConstraints.gridx = 0;
79
        gridBagConstraints.gridy = 0;
80
        this.setLayout(new GridBagLayout());
81
        this.setPreferredSize(new java.awt.Dimension(395, heightConectorPanel));
82
        this.setSize(new java.awt.Dimension(395, heightConectorPanel));
83
        this.setLocation(new java.awt.Point(0,0));
84
        this.add(getPNorth(), gridBagConstraints);
85
        this.add(getPSouth(), gridBagConstraints1);
86
        }
87

    
88
        
89
        public AdjustGeorefPanel getAdjustGeorefPanel() {
90
                if (adjustGeorefPanel == null) {
91
                        adjustGeorefPanel = new AdjustGeorefPanel(grd);
92
                        adjustGeorefPanel.setSize(400, 275);
93
                        adjustGeorefPanel.setPreferredSize(new Dimension(400, 275));
94
                        adjustGeorefPanel.setVisible(true);
95
                }
96
                return adjustGeorefPanel;
97
        }
98
        
99
        public DataPointsTabPanel getDataPointsTabPanel() {
100
                if (dataPointsTabPanel == null) {
101
                        dataPointsTabPanel = new DataPointsTabPanel(grd);
102
                        dataPointsTabPanel.setVisible(true);
103
                }
104
                return dataPointsTabPanel;
105
        }
106

    
107
        /**
108
         * This method initializes jPanel        
109
         *         
110
         * @return javax.swing.JPanel        
111
         */
112
        private JPanel getPNorth() {
113
                if (pNorth == null) {
114
                        BorderLayout borderLayout = new BorderLayout();
115
                        pNorth = new JPanel();
116
                        pNorth.setLayout(borderLayout);
117
                        pNorth.setPreferredSize(new java.awt.Dimension(395, heightNorthPanel));
118
                        pNorth.add(getDataPointsTabPanel(), BorderLayout.CENTER);
119
                }
120
                return pNorth;
121
        }
122

    
123
        /**
124
         * This method initializes jPanel1        
125
         *         
126
         * @return javax.swing.JPanel        
127
         */
128
        private JPanel getPSouth() {
129
                if (pSouth == null) {
130
                        BorderLayout borderLayout = new BorderLayout();
131
                        pSouth = new JPanel();
132
                        pSouth.setLayout(borderLayout);
133
                        pSouth.setPreferredSize(new java.awt.Dimension(395, heightSouthPanel));
134
                        pSouth.add(getAdjustGeorefPanel(), BorderLayout.CENTER);
135
                }
136
                return pSouth;
137
        }
138
        
139
        /**
140
         * Asigna al canvas de los controles de zoom la propiedad de visibilidad a 
141
         * verdadero o falso.
142
         * @param visible true para mostrar los canvas y false para ocultarlos
143
         */
144
        public void setCanvasVisible(boolean visible){
145
                this.getAdjustGeorefPanel().getZoomLeft().setVisible(visible);
146
                this.getAdjustGeorefPanel().getZoomRight().setVisible(visible);
147
        }
148
        
149
        /**
150
         * Calculo del nuevo tama?o a partir de un frame redimensionado
151
         * @param w Ancho del frame
152
         * @param h Alto del frame
153
         */
154
        public void newFrameSize(int w, int h){        
155
                int newWidth = (int)(w * 0.98);
156
                this.setSize(new java.awt.Dimension(newWidth, heightConectorPanel));
157
                this.setPreferredSize(new java.awt.Dimension(newWidth, heightConectorPanel));
158
                
159
        this.getPNorth().setSize(new java.awt.Dimension(newWidth, heightNorthPanel));
160
        this.getPNorth().setPreferredSize(new java.awt.Dimension(newWidth, heightNorthPanel));
161
        this.getPSouth().setSize(new java.awt.Dimension(newWidth, heightSouthPanel));
162
        this.getPSouth().setPreferredSize(new java.awt.Dimension(newWidth, heightSouthPanel));
163
        
164
        this.getDataPointsTabPanel().newFrameSize(newWidth, h);
165
        }
166
}