Statistics
| Revision:

gvsig-catalog / trunk / appCatalog / src / org / gvsig / catalog / ui / search / SearchButtonPanel.java @ 6

History | View | Annotate | Download (4.58 KB)

1
package org.gvsig.catalog.ui.search;
2

    
3
import java.awt.event.ActionListener;
4

    
5
import javax.swing.JPanel;
6

    
7
import org.gvsig.catalog.utils.CatalogConstants;
8
import org.gvsig.i18n.Messages;
9

    
10

    
11
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
12
 *
13
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
14
 *
15
 * This program is free software; you can redistribute it and/or
16
 * modify it under the terms of the GNU General Public License
17
 * as published by the Free Software Foundation; either version 2
18
 * of the License, or (at your option) any later version.
19
 *
20
 * This program is distributed in the hope that it will be useful,
21
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23
 * GNU General Public License for more details.
24
 *
25
 * You should have received a copy of the GNU General Public License
26
 * along with this program; if not, write to the Free Software
27
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
28
 *
29
 * For more information, contact:
30
 *
31
 *  Generalitat Valenciana
32
 *   Conselleria d'Infraestructures i Transport
33
 *   Av. Blasco Ib??ez, 50
34
 *   46010 VALENCIA
35
 *   SPAIN
36
 *
37
 *      +34 963862235
38
 *   gvsig@gva.es
39
 *      www.gvsig.gva.es
40
 *
41
 *    or
42
 *
43
 *   IVER T.I. S.A
44
 *   Salamanca 50
45
 *   46005 Valencia
46
 *   Spain
47
 *
48
 *   +34 963163400
49
 *   dac@iver.es
50
 */
51
/* CVS MESSAGES:
52
 *
53
 * $Id: SearchButtonPanel.java 561 2007-07-27 06:49:30 +0000 (Fri, 27 Jul 2007) jpiera $
54
 * $Log$
55
 * Revision 1.1.2.4  2007/07/24 09:45:52  jorpiell
56
 * Fix some interface bugs
57
 *
58
 * Revision 1.1.2.3  2007/07/23 07:14:24  jorpiell
59
 * Catalog refactoring
60
 *
61
 * Revision 1.1.2.2  2007/07/13 12:00:35  jorpiell
62
 * Add the posibility to add a new panel
63
 *
64
 * Revision 1.1.2.1  2007/07/11 13:01:50  jorpiell
65
 * Catalog UI updated
66
 *
67
 * Revision 1.1.2.1  2007/07/10 11:18:03  jorpiell
68
 * Added the registers
69
 *
70
 *
71
 */
72
/**
73
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
74
 */
75
public class SearchButtonPanel extends JPanel{
76
        private javax.swing.JButton cancelButton;
77
    private javax.swing.JButton closeButton;
78
    private javax.swing.JButton lastButton;
79
    private javax.swing.JButton searchButton;
80
  
81
    /** Creates new form SearchButtonsPanel */
82
    public SearchButtonPanel() {
83
        initComponents();
84
        initLabels();
85
        initButtonSize();
86
    }
87
    
88
    /** This method is called from within the constructor to
89
     * initialize the form.
90
     * WARNING: Do NOT modify this code. The content of this method is
91
     * always regenerated by the Form Editor.
92
     */
93
    // <editor-fold defaultstate="collapsed" desc=" C?digo Generado  ">                          
94
    private void initComponents() {
95
             searchButton = new javax.swing.JButton();
96
         cancelButton = new javax.swing.JButton();
97
         lastButton = new javax.swing.JButton();
98
         closeButton = new javax.swing.JButton();
99

    
100
         setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT));
101

    
102
         setPreferredSize(new java.awt.Dimension(200, 35));
103
         searchButton.setText("jButton1");
104
         add(searchButton);
105

    
106
         cancelButton.setText("jButton2");
107
         add(cancelButton);
108

    
109
         lastButton.setText("jButton3");
110
         add(lastButton);
111

    
112
         closeButton.setText("jButton4");
113
         add(closeButton);
114
    }// </editor-fold>                    
115
    
116
    /**
117
         * Rewrite the labels
118
         */
119
        private void initLabels(){
120
                searchButton.setText(Messages.getText("searchButton"));
121
                closeButton.setText(Messages.getText("close"));
122
                lastButton.setText(Messages.getText("last"));
123
                cancelButton.setText(Messages.getText("cancel"));
124
        }
125
        
126
        /**
127
         * Initialize the buttons size
128
         */
129
        private void initButtonSize(){
130
                searchButton.setPreferredSize(CatalogConstants.BUTTON_SIZE);
131
                closeButton.setPreferredSize(CatalogConstants.BUTTON_SIZE);
132
                lastButton.setPreferredSize(CatalogConstants.BUTTON_SIZE);
133
                cancelButton.setPreferredSize(CatalogConstants.BUTTON_SIZE);
134
        }
135
        
136
    /**
137
     * Add a listener for the buttons
138
     * @param listener
139
     * Listener to add
140
     */
141
    public void addActionListener(ActionListener listener){
142
            cancelButton.addActionListener(listener);
143
            cancelButton.setActionCommand(CatalogConstants.CANCEL_BUTTON_ACTION_COMMAND);
144
            closeButton.addActionListener(listener);
145
            closeButton.setActionCommand(CatalogConstants.CLOSE_BUTTON_ACTION_COMMAND);
146
            lastButton.addActionListener(listener);
147
            lastButton.setActionCommand(CatalogConstants.LAST_BUTTON_ACTION_COMMAND);
148
            searchButton.addActionListener(listener);
149
            searchButton.setActionCommand(CatalogConstants.SEARCH_BUTTON_ACTION_COMMAND);
150
    }
151
    
152
}