Statistics
| Revision:

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

History | View | Annotate | Download (5.68 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.Frame;
44
import java.awt.event.MouseEvent;
45
import java.awt.event.MouseListener;
46
import java.awt.geom.Rectangle2D;
47

    
48
import javax.swing.JDialog;
49

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

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

    
61

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

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

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

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

    
153
    /* (non-Javadoc)
154
     * @see java.awt.event.MouseListener#mousePressed(java.awt.event.MouseEvent)
155
     */
156
    public void mousePressed(MouseEvent e) {
157
        // TODO Auto-generated method stub
158
        
159
    }
160

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