root / trunk / libraries / libUIComponent / src-test / org / gvsig / gui / beans / propertiesdialog / TestPropertiesDialog.java @ 11315
History | View | Annotate | Download (1.96 KB)
1 |
package org.gvsig.gui.beans.propertiesdialog; |
---|---|
2 |
|
3 |
import java.util.ArrayList; |
4 |
|
5 |
import javax.swing.JFrame; |
6 |
import javax.swing.UIManager; |
7 |
|
8 |
import org.gvsig.gui.beans.buttonspanel.ButtonsPanel; |
9 |
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelEvent; |
10 |
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelListener; |
11 |
import org.gvsig.gui.beans.propertiesdialog.PropertiesDialog.PropertyStruct; |
12 |
|
13 |
public class TestPropertiesDialog implements ButtonsPanelListener { |
14 |
JFrame frame = null; |
15 |
PropertiesDialog pd = null;
|
16 |
|
17 |
public TestPropertiesDialog() {
|
18 |
initialize(); |
19 |
} |
20 |
|
21 |
public void initialize() { |
22 |
ArrayList type = new ArrayList(); |
23 |
type.add(new Integer(PropertiesDialog.TYPE_SLIDER)); |
24 |
type.add(new Integer(0)); |
25 |
type.add(new Integer(100)); |
26 |
|
27 |
frame = new JFrame(); |
28 |
pd = new PropertiesDialog();
|
29 |
pd.addButtonPressedListener(this);
|
30 |
pd.addValue("Protocolo", "protocolo", "texto", null); |
31 |
pd.addValue("Integer", "var1", new Integer(50), null); |
32 |
pd.addValue("Slider", "slider1", new Integer(50), type); // Slider |
33 |
pd.addValue("Activo", "check1", new Boolean(true), null); // Slider |
34 |
|
35 |
frame.getContentPane().add(pd); |
36 |
frame.show(); |
37 |
pd.resizeLabels(); |
38 |
frame.pack(); |
39 |
frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); |
40 |
} |
41 |
|
42 |
public static void main(String[] args) { |
43 |
try {
|
44 |
UIManager.setLookAndFeel("com.jgoodies.looks.plastic.PlasticXPLookAndFeel"); |
45 |
} catch (Exception e) { |
46 |
System.err.println("No se puede cambiar al LookAndFeel"); |
47 |
} |
48 |
|
49 |
new TestPropertiesDialog();
|
50 |
} |
51 |
|
52 |
public void actionButtonPressed(ButtonsPanelEvent e) { |
53 |
if (e.getButton() == ButtonsPanel.BUTTON_ACCEPT) {
|
54 |
ArrayList values = pd.getValues();
|
55 |
System.out.println("-----"); |
56 |
for (int i=0; i<values.size(); i++) { |
57 |
System.out.println(((PropertyStruct)values.get(i)).key + " (old): " + ((PropertyStruct)values.get(i)).oldValue.toString()); |
58 |
System.out.println(((PropertyStruct)values.get(i)).key + " (new): " + ((PropertyStruct)values.get(i)).newValue.toString()); |
59 |
} |
60 |
} |
61 |
|
62 |
} |
63 |
} |