Statistics
| Revision:

root / branches / CatalogYNomenclator_v1_1_0_1005 / applications / appCatalogYNomenclatorClient / src / es / gva / cit / catalogClient / ui / search / SearchButtonPanel.java @ 12733

History | View | Annotate | Download (4.29 KB)

1
package es.gva.cit.catalogClient.ui.search;
2

    
3
import java.awt.event.ActionListener;
4

    
5
import javax.swing.JPanel;
6

    
7
import org.gvsig.i18n.Messages;
8

    
9
import es.gva.cit.catalogClient.utils.CatalogConstants;
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 12733 2007-07-23 07:14:25Z jorpiell $
54
 * $Log$
55
 * Revision 1.1.2.3  2007-07-23 07:14:24  jorpiell
56
 * Catalog refactoring
57
 *
58
 * Revision 1.1.2.2  2007/07/13 12:00:35  jorpiell
59
 * Add the posibility to add a new panel
60
 *
61
 * Revision 1.1.2.1  2007/07/11 13:01:50  jorpiell
62
 * Catalog UI updated
63
 *
64
 * Revision 1.1.2.1  2007/07/10 11:18:03  jorpiell
65
 * Added the registers
66
 *
67
 *
68
 */
69
/**
70
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
71
 */
72
public class SearchButtonPanel extends JPanel{
73
        private javax.swing.JButton cancelButton;
74
    private javax.swing.JButton closeButton;
75
    private javax.swing.JButton lastButton;
76
    private javax.swing.JButton searchButton;
77
  
78
    /** Creates new form SearchButtonsPanel */
79
    public SearchButtonPanel() {
80
        initComponents();
81
        initLabels();
82
        initButtonSize();
83
    }
84
    
85
    /** This method is called from within the constructor to
86
     * initialize the form.
87
     * WARNING: Do NOT modify this code. The content of this method is
88
     * always regenerated by the Form Editor.
89
     */
90
    // <editor-fold defaultstate="collapsed" desc=" C?digo Generado  ">                          
91
    private void initComponents() {
92
             searchButton = new javax.swing.JButton();
93
         cancelButton = new javax.swing.JButton();
94
         lastButton = new javax.swing.JButton();
95
         closeButton = new javax.swing.JButton();
96

    
97
         setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT));
98

    
99
         setPreferredSize(new java.awt.Dimension(200, 35));
100
         searchButton.setText("jButton1");
101
         add(searchButton);
102

    
103
         cancelButton.setText("jButton2");
104
         add(cancelButton);
105

    
106
         lastButton.setText("jButton3");
107
         add(lastButton);
108

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