Statistics
| Revision:

svn-gvsig-desktop / trunk / extensions / extCatalogYNomenclator / src / es / gva / cit / gvsig / gazetteer / gui / SearchDialog.java @ 3480

History | View | Annotate | Download (5.44 KB)

1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
*
3
* Copyright (C) 2004 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
* For more information, contact:
20
*
21
*  Generalitat Valenciana
22
*   Conselleria d'Infraestructures i Transport
23
*   Av. Blasco Ib??ez, 50
24
*   46010 VALENCIA
25
*   SPAIN
26
*
27
*      +34 963862235
28
*   gvsig@gva.es
29
*      www.gvsig.gva.es
30
*
31
*    or
32
*
33
*   IVER T.I. S.A
34
*   Salamanca 50
35
*   46005 Valencia
36
*   Spain
37
*
38
*   +34 963163400
39
*   dac@iver.es
40
*/
41
package es.gva.cit.gvsig.gazetteer.gui;
42

    
43
import java.awt.event.MouseEvent;
44
import java.awt.event.MouseListener;
45
import java.awt.geom.Rectangle2D;
46

    
47
import javax.swing.JDialog;
48

    
49
import com.iver.andami.PluginServices;
50
import com.iver.andami.ui.mdiManager.View;
51
import com.iver.andami.ui.mdiManager.ViewInfo;
52

    
53
import es.gva.cit.catalogClient.querys.Coordinates;
54
import es.gva.cit.gazetteer.GazetteerClient;
55
import es.gva.cit.gazetteer.querys.Feature;
56
import es.gva.cit.gazetteer.ui.search.SearchDialogPanel;
57
import es.gva.cit.gvsig.catalogClient.translation.AndamiTranslation;
58

    
59

    
60
/**
61
 * @author Jorge Piera Llodra (piera_jor@gva.es)
62
 */
63
public class SearchDialog extends SearchDialogPanel
64
implements View,MouseListener {
65
    private JDialog frame = null;
66
    
67
    public SearchDialog(GazetteerClient client,JDialog frame){
68
        super(client,new AndamiTranslation());
69
        this.frame = frame;  
70
            setMouseListener();        
71
    }
72
    
73
    /* (non-Javadoc)
74
     * @see com.iver.andami.ui.mdiManager.View#getViewInfo()
75
     */
76
    public ViewInfo getViewInfo() {
77
        ViewInfo m_viewinfo=new ViewInfo(ViewInfo.MODALDIALOG);
78
                m_viewinfo.setTitle(PluginServices.getText(this, "gazetteer_search"));
79
                return m_viewinfo;
80
    }
81
    
82
    public void ShowResultsActionPerformed(Feature[] features) {
83
        ShowResultsDialog dialog = new ShowResultsDialog(client,
84
                features,
85
                lowerPanel.getNPaginas(),
86
                lowerPanel.isGoToClicked(),
87
                lowerPanel.isKeepOldClicked());
88
                dialog.setBounds(0, 0, 420, 227);
89
                dialog.setName(PluginServices.getText(this, "gazetteer_search"));
90
                dialog.setVisible(true);
91
                dialog.setSearchDialog(this);
92
                PluginServices.getMDIManager().addView(dialog);
93
                
94
    }
95
    
96
    public void closeButtonActionPerformed() {
97
             frame.setVisible(false);
98
         }
99
    
100
         /**
101
          * Size button action performed
102
          */         
103
         public void sizeButtonActionPerformed(){
104
                if (isMinimized){
105
                    frame.setSize(525,455);
106
                    getLowerPanel().setVisible(true);
107
                    getLowerPanel().repaint();
108
                    getUpperPanel().setUpIcon();
109
                    frame.setVisible(true);
110
                }else{
111
                    frame.setSize(525,120);
112
                    getLowerPanel().setVisible(false);
113
                    getUpperPanel().setDownIcon();
114
                }
115
                isMinimized = !isMinimized;
116
         }
117
    
118
    public void closeJDialog() {
119
                PluginServices.getMDIManager().closeView(this);
120
        }
121

    
122
    /* (non-Javadoc)
123
     * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
124
     */
125
    public void mouseClicked(MouseEvent e) {
126
        // TODO Auto-generated method stub
127
        
128
    }
129

    
130
    /* (non-Javadoc)
131
     * @see java.awt.event.MouseListener#mouseEntered(java.awt.event.MouseEvent)
132
     */
133
    public void mouseEntered(MouseEvent e) {
134
        // TODO Auto-generated method stub
135
        
136
    }
137

    
138
    /* (non-Javadoc)
139
     * @see java.awt.event.MouseListener#mouseExited(java.awt.event.MouseEvent)
140
     */
141
    public void mouseExited(MouseEvent e) {
142
        // TODO Auto-generated method stub
143
        
144
    }
145

    
146
    /* (non-Javadoc)
147
     * @see java.awt.event.MouseListener#mousePressed(java.awt.event.MouseEvent)
148
     */
149
    public void mousePressed(MouseEvent e) {
150
        // TODO Auto-generated method stub
151
        
152
    }
153

    
154
    /* (non-Javadoc)
155
     * @see java.awt.event.MouseListener#mouseReleased(java.awt.event.MouseEvent)
156
     */
157
    public void mouseReleased(MouseEvent e) {
158
        com.iver.cit.gvsig.gui.View activeView = 
159
                        (com.iver.cit.gvsig.gui.View) PluginServices.getMDIManager().getActiveView();
160
       
161
        Rectangle2D r2d= activeView.getMapControl().getViewPort().getExtent();
162
        
163
        try{
164
        getLowerPanel().setCoordinates(new Coordinates(r2d.getMinX(),
165
                r2d.getMaxY(),
166
                r2d.getMaxX(),
167
                r2d.getMinY()));
168
        }catch(NullPointerException E){
169
            //We cant retrieve the coordinates if it doesn't 
170
            //exist a loaded layer
171
        }
172
        
173
    }
174
    /**
175
     * This methos joins the mouse event to the listener
176
     */
177
    public void setMouseListener(){
178
        com.iver.cit.gvsig.gui.View activeView = 
179
                        (com.iver.cit.gvsig.gui.View) PluginServices.getMDIManager().getActiveView();
180
       
181
        activeView.getMapControl().addMouseListener(this);
182
        mouseReleased(null);
183
    }
184
    
185
 
186
    
187
   
188
}