Revision 10761 trunk/libraries/libUIComponent/src/org/gvsig/gui/beans/dialogPanel/DialogPanel.java
DialogPanel.java | ||
---|---|---|
1 | 1 |
package org.gvsig.gui.beans.dialogPanel; |
2 | 2 |
|
3 |
import java.awt.Dimension; |
|
3 |
import java.awt.Component; |
|
4 |
import java.awt.LayoutManager; |
|
4 | 5 |
|
5 | 6 |
import javax.swing.JPanel; |
6 | 7 |
|
7 | 8 |
import org.gvsig.gui.beans.buttonsPanel.ButtonsPanel; |
8 |
|
|
9 |
/** |
|
10 |
* <code>DialogPanel</code> es un Panel que hereda de <code>JPanel</code> con |
|
11 |
* el a?adido de poder definir una botonera por defecto. |
|
12 |
* |
|
13 |
* @version 03/15/07 |
|
14 |
* @author Borja S?nchez Zamorano (borja.sanchez@iver.es) |
|
15 |
*/ |
|
9 | 16 |
public class DialogPanel extends JPanel { |
10 | 17 |
ButtonsPanel bp = null; |
11 | 18 |
JPanel content = null; |
12 |
|
|
19 |
|
|
20 |
/** |
|
21 |
* Crea el <code>DialogPanel</code> con los botones por defecto. |
|
22 |
*/ |
|
13 | 23 |
public DialogPanel() { |
14 |
setLayout(new java.awt.BorderLayout(5, 5)); |
|
24 |
super.setLayout(new java.awt.BorderLayout(5, 5));
|
|
15 | 25 |
getButtonsPanel().addAccept(); |
16 | 26 |
getButtonsPanel().addCancel(); |
17 | 27 |
getButtonsPanel().addApply(); |
18 |
add(getButtonsPanel(), java.awt.BorderLayout.SOUTH); |
|
19 |
add(getContent(), java.awt.BorderLayout.CENTER); |
|
28 |
super.add(getButtonsPanel(), java.awt.BorderLayout.SOUTH);
|
|
29 |
super.add(getContent(), java.awt.BorderLayout.CENTER);
|
|
20 | 30 |
} |
21 | 31 |
|
32 |
/** |
|
33 |
* Crea el <code>DialogPanel</code> con los botones que definamos de la clase |
|
34 |
* <code>ButtonsPanel</code> |
|
35 |
* |
|
36 |
* @param buttons Constante para definir que botones se crear?n |
|
37 |
*/ |
|
22 | 38 |
public DialogPanel(int buttons) { |
23 |
setLayout(new java.awt.BorderLayout(5, 5)); |
|
39 |
super.setLayout(new java.awt.BorderLayout(5, 5));
|
|
24 | 40 |
bp = new ButtonsPanel(buttons); |
25 |
add(getButtonsPanel(), java.awt.BorderLayout.SOUTH); |
|
26 |
add(getContent(), java.awt.BorderLayout.CENTER); |
|
41 |
super.add(getButtonsPanel(), java.awt.BorderLayout.SOUTH);
|
|
42 |
super.add(getContent(), java.awt.BorderLayout.CENTER);
|
|
27 | 43 |
} |
28 | 44 |
|
45 |
/** |
|
46 |
* Obtener el objeto <code>ButtonsPanel</code> del <code>DialogPanel</code>. |
|
47 |
* En caso de no estar creado, lo crear?. |
|
48 |
* |
|
49 |
* @return El componente bp |
|
50 |
*/ |
|
29 | 51 |
public ButtonsPanel getButtonsPanel() { |
30 |
if (bp == null) {
|
|
52 |
if (bp == null) |
|
31 | 53 |
bp = new ButtonsPanel(); |
32 |
} |
|
33 | 54 |
return bp; |
34 | 55 |
} |
35 | 56 |
|
57 |
/** |
|
58 |
* Obtener el contenido del <code>DialogPanel</code>. En caso de no estar creado, |
|
59 |
* lo crear?. |
|
60 |
* |
|
61 |
* @return El componente content |
|
62 |
*/ |
|
36 | 63 |
public JPanel getContent() { |
37 |
if (content == null) {
|
|
64 |
if (content == null) |
|
38 | 65 |
content = new JPanel(); |
39 |
content.setLayout(new java.awt.BorderLayout()); |
|
40 |
} |
|
41 | 66 |
return content; |
42 | 67 |
} |
43 |
} |
|
68 |
|
|
69 |
/* |
|
70 |
* (non-Javadoc) |
|
71 |
* @see java.awt.Container#getLayout() |
|
72 |
*/ |
|
73 |
public LayoutManager getLayout() { |
|
74 |
return getContent().getLayout(); |
|
75 |
} |
|
76 |
|
|
77 |
/* |
|
78 |
* (non-Javadoc) |
|
79 |
* @see java.awt.Container#setLayout(java.awt.LayoutManager) |
|
80 |
*/ |
|
81 |
public void setLayout(LayoutManager mgr) { |
|
82 |
getContent().setLayout(mgr); |
|
83 |
} |
|
84 |
|
|
85 |
/* |
|
86 |
* (non-Javadoc) |
|
87 |
* @see java.awt.Container#add(java.awt.Component) |
|
88 |
*/ |
|
89 |
public Component add(Component comp) { |
|
90 |
return getContent().add(comp); |
|
91 |
} |
|
92 |
|
|
93 |
/* |
|
94 |
* (non-Javadoc) |
|
95 |
* @see java.awt.Container#add(java.awt.Component, int) |
|
96 |
*/ |
|
97 |
public Component add(Component comp, int index) { |
|
98 |
return getContent().add(comp, index); |
|
99 |
} |
|
100 |
|
|
101 |
/* |
|
102 |
* (non-Javadoc) |
|
103 |
* @see java.awt.Container#add(java.awt.Component, java.lang.Object) |
|
104 |
*/ |
|
105 |
public void add(Component comp, Object constraints) { |
|
106 |
getContent().add(comp, constraints); |
|
107 |
} |
|
108 |
|
|
109 |
/* |
|
110 |
* (non-Javadoc) |
|
111 |
* @see java.awt.Container#add(java.awt.Component, java.lang.Object, int) |
|
112 |
*/ |
|
113 |
public void add(Component comp, Object constraints, int index) { |
|
114 |
getContent().add(comp, constraints, index); |
|
115 |
} |
|
116 |
|
|
117 |
/* |
|
118 |
* (non-Javadoc) |
|
119 |
* @see java.awt.Container#add(java.lang.String, java.awt.Component) |
|
120 |
*/ |
|
121 |
public Component add(String name, Component comp) { |
|
122 |
return getContent().add(name, comp); |
|
123 |
} |
|
124 |
} |
Also available in: Unified diff