Statistics
| Revision:

root / branches / v10 / extensions / extPublish / src / com / iver / cit / gvsig / publish / gui / view / MainControlsPanel.java @ 13570

History | View | Annotate | Download (2.99 KB)

1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004-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
 * For more information, contact:
20
 *
21
 *   Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Iba?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 com.iver.cit.gvsig.publish.gui.view;
42

    
43
import java.awt.Dimension;
44
import java.awt.FlowLayout;
45
import java.awt.event.ActionListener;
46
import java.util.EventListener;
47

    
48
import javax.swing.JButton;
49
import javax.swing.JPanel;
50

    
51
import com.iver.andami.PluginServices;
52
import com.iver.cit.gvsig.publish.gui.control.MainController;
53

    
54
public class MainControlsPanel extends JPanel {
55
        /**
56
         * 
57
         */
58
        private static final long serialVersionUID = -1427894060994635634L;
59
        /**
60
         * Components
61
         */
62
        private JButton acceptButton = null;
63
        private JButton cancelButton = null;
64
        
65
        public MainControlsPanel(){
66
                super();
67
                initialize();
68
        }
69
        
70
        public void setListener(final EventListener listener){
71
                this.getAcceptButton().addActionListener((ActionListener)listener);
72
                this.getCancelButton().addActionListener((ActionListener)listener);
73
        }
74
        
75
        private void initialize(){
76
                final FlowLayout flowLayout = new FlowLayout();
77
                flowLayout.setAlignment(java.awt.FlowLayout.RIGHT);
78
                this.setPreferredSize(new java.awt.Dimension(250,50));
79
                this.setLayout(flowLayout);
80
                this.add(getAcceptButton(), null);
81
                this.add(getCancelButton(), null);
82
        }
83

    
84
        private JButton getCancelButton() {
85
                if (this.cancelButton == null) {
86
                        this.cancelButton = new JButton();
87
                        this.cancelButton.setText(PluginServices.getText(this, "cancel_publish"));
88
                        this.cancelButton.setPreferredSize(new Dimension(100,30));
89
                        this.cancelButton.setActionCommand(MainController.PUBLISH_EVENT_CANCEL);
90
                }
91
                return cancelButton;
92
        }
93

    
94
        private JButton getAcceptButton() {
95
                if (this.acceptButton == null) {
96
                        this.acceptButton = new JButton();
97
                        this.acceptButton.setText(PluginServices.getText(this, "accept_publish"));
98
                        this.acceptButton.setPreferredSize(new Dimension(100,30));
99
                        this.acceptButton.setActionCommand(MainController.PUBLISH_EVENT_ACCEPT);
100
                }
101
                return acceptButton;
102
        }
103

    
104

    
105
}