svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.projection / org.gvsig.projection.cresques / org.gvsig.projection.cresques.ui / src / main / java / org / cresques / ui / DefaultDialogPanel.java @ 40559
History | View | Annotate | Download (5.59 KB)
1 | 40559 | jjdelcerro | /**
|
---|---|---|---|
2 | * gvSIG. Desktop Geographic Information System.
|
||
3 | 40455 | jjdelcerro | *
|
4 | 40559 | jjdelcerro | * Copyright (C) 2007-2013 gvSIG Association.
|
5 | 40455 | jjdelcerro | *
|
6 | * This program is free software; you can redistribute it and/or
|
||
7 | * modify it under the terms of the GNU General Public License
|
||
8 | 40559 | jjdelcerro | * as published by the Free Software Foundation; either version 3
|
9 | 40455 | jjdelcerro | * of the License, or (at your option) any later version.
|
10 | *
|
||
11 | * This program is distributed in the hope that it will be useful,
|
||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
14 | * GNU General Public License for more details.
|
||
15 | *
|
||
16 | * You should have received a copy of the GNU General Public License
|
||
17 | * along with this program; if not, write to the Free Software
|
||
18 | 40559 | jjdelcerro | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 | * MA 02110-1301, USA.
|
||
20 | 40455 | jjdelcerro | *
|
21 | 40559 | jjdelcerro | * For any additional information, do not hesitate to contact us
|
22 | * at info AT gvsig.com, or visit our website www.gvsig.com.
|
||
23 | 40455 | jjdelcerro | */
|
24 | package org.cresques.ui; |
||
25 | |||
26 | import java.awt.FlowLayout; |
||
27 | import java.awt.GridBagConstraints; |
||
28 | import java.awt.GridBagLayout; |
||
29 | |||
30 | import javax.swing.JButton; |
||
31 | import javax.swing.JPanel; |
||
32 | |||
33 | import org.cresques.Messages; |
||
34 | |||
35 | |||
36 | /**
|
||
37 | * @author Luis W. Sevilla (sevilla_lui@gva.es)
|
||
38 | */
|
||
39 | public class DefaultDialogPanel extends JPanel { // implements |
||
40 | // ComponentListener{
|
||
41 | final private static long serialVersionUID = -3370601314380922368L; |
||
42 | protected JPanel contentPane = null; |
||
43 | private JPanel tabPane = null; |
||
44 | protected JPanel buttonPane = null; |
||
45 | private JButton acceptButton = null; |
||
46 | private JButton cancelButton = null; |
||
47 | protected int cWidth = 0, difWidth = 0; |
||
48 | protected int cHeight = 0, difHeight = 0; |
||
49 | protected JPanel pButton = null; |
||
50 | |||
51 | /**
|
||
52 | * Constructor
|
||
53 | * @param init
|
||
54 | */
|
||
55 | public DefaultDialogPanel(boolean init){ |
||
56 | if(init)
|
||
57 | initialize(); |
||
58 | } |
||
59 | |||
60 | /**
|
||
61 | * Constructor
|
||
62 | */
|
||
63 | public DefaultDialogPanel() {
|
||
64 | super();
|
||
65 | this.initialize();
|
||
66 | } |
||
67 | |||
68 | /**
|
||
69 | * This method initializes this
|
||
70 | *
|
||
71 | * @return void
|
||
72 | */
|
||
73 | public void initialize() { |
||
74 | GridBagConstraints gridBagConstraints11 = new GridBagConstraints(); |
||
75 | gridBagConstraints11.gridx = 0;
|
||
76 | gridBagConstraints11.insets = new java.awt.Insets(4,0,0,0); |
||
77 | gridBagConstraints11.gridy = 1;
|
||
78 | GridBagConstraints gridBagConstraints = new GridBagConstraints(); |
||
79 | gridBagConstraints.insets = new java.awt.Insets(5,0,2,0); |
||
80 | gridBagConstraints.gridy = 0;
|
||
81 | gridBagConstraints.gridx = 0;
|
||
82 | setLayout(new GridBagLayout()); |
||
83 | setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5)); |
||
84 | |||
85 | this.add(getTabPanel(), gridBagConstraints);
|
||
86 | this.add(getPButton(), gridBagConstraints11);
|
||
87 | } |
||
88 | |||
89 | /**
|
||
90 | * Obtiene el panel general
|
||
91 | * @return
|
||
92 | */
|
||
93 | protected JPanel getContentPanel() { |
||
94 | if (contentPane == null) { |
||
95 | contentPane = new JPanel(); |
||
96 | contentPane.setLayout(new GridBagLayout()); |
||
97 | } |
||
98 | |||
99 | return contentPane;
|
||
100 | } |
||
101 | |||
102 | public JPanel getTabPanel() { |
||
103 | if (tabPane == null) { |
||
104 | GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); |
||
105 | gridBagConstraints2.insets = new java.awt.Insets(5,0,0,0); |
||
106 | gridBagConstraints2.gridy = 0;
|
||
107 | gridBagConstraints2.gridx = 0;
|
||
108 | tabPane = new JPanel(); |
||
109 | tabPane.setLayout(new GridBagLayout()); |
||
110 | |||
111 | tabPane.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.SoftBevelBorder.RAISED));
|
||
112 | tabPane.add(getContentPanel(), gridBagConstraints2); |
||
113 | } |
||
114 | |||
115 | return tabPane;
|
||
116 | } |
||
117 | |||
118 | /**
|
||
119 | * This method initializes jPanel
|
||
120 | *
|
||
121 | * @return javax.swing.JPanel
|
||
122 | */
|
||
123 | private JPanel getPButton() { |
||
124 | if (pButton == null) { |
||
125 | FlowLayout flowLayout1 = new FlowLayout(); |
||
126 | flowLayout1.setAlignment(java.awt.FlowLayout.RIGHT); |
||
127 | flowLayout1.setHgap(0);
|
||
128 | flowLayout1.setVgap(0);
|
||
129 | pButton = new JPanel(); |
||
130 | pButton.setLayout(flowLayout1); |
||
131 | pButton.add(getButtonPanel(), null);
|
||
132 | } |
||
133 | return pButton;
|
||
134 | } |
||
135 | |||
136 | |||
137 | /**
|
||
138 | * Obtiene el panel que contiene los botones de Aceptar, Cancelar y Aplicar
|
||
139 | * @return
|
||
140 | */
|
||
141 | protected JPanel getButtonPanel() { |
||
142 | if (buttonPane == null) { |
||
143 | GridBagConstraints gridBagConstraints3 = new GridBagConstraints(); |
||
144 | gridBagConstraints3.gridx = 1;
|
||
145 | gridBagConstraints3.insets = new java.awt.Insets(0,3,0,3); |
||
146 | gridBagConstraints3.gridy = 0;
|
||
147 | GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); |
||
148 | gridBagConstraints1.insets = new java.awt.Insets(0,0,0,3); |
||
149 | gridBagConstraints1.gridy = 0;
|
||
150 | gridBagConstraints1.gridx = 0;
|
||
151 | buttonPane = new JPanel(); |
||
152 | buttonPane.setLayout(new GridBagLayout()); |
||
153 | buttonPane.add(getAcceptButton(), gridBagConstraints1); |
||
154 | buttonPane.add(getCancelButton(), gridBagConstraints3); |
||
155 | } |
||
156 | |||
157 | return buttonPane;
|
||
158 | } |
||
159 | |||
160 | /**
|
||
161 | * This method initializes Accept button
|
||
162 | *
|
||
163 | * @return javax.swing.JButton
|
||
164 | */
|
||
165 | public JButton getAcceptButton() { |
||
166 | if (acceptButton == null) { |
||
167 | acceptButton = new JButton("Aceptar"); |
||
168 | acceptButton.setText(Messages.getText("Aceptar"));
|
||
169 | } |
||
170 | |||
171 | return acceptButton;
|
||
172 | } |
||
173 | |||
174 | /**
|
||
175 | * This method initializes Cancel Button
|
||
176 | *
|
||
177 | * @return javax.swing.JButton
|
||
178 | */
|
||
179 | public JButton getCancelButton() { |
||
180 | if (cancelButton == null) { |
||
181 | cancelButton = new JButton("Cancelar"); |
||
182 | cancelButton.setText(Messages.getText("Cancelar"));
|
||
183 | } |
||
184 | |||
185 | return cancelButton;
|
||
186 | } |
||
187 | } |