root / trunk / extensions / extCAD / src / com / iver / cit / gvsig / TestJWizard.java @ 5014
History | View | Annotate | Download (4.21 KB)
1 | 4416 | fjp | package com.iver.cit.gvsig; |
---|---|---|---|
2 | |||
3 | import java.util.ArrayList; |
||
4 | |||
5 | import javax.swing.ImageIcon; |
||
6 | import javax.swing.JFrame; |
||
7 | import javax.swing.JLabel; |
||
8 | import javax.swing.SwingUtilities; |
||
9 | import javax.swing.UIManager; |
||
10 | |||
11 | import jwizardcomponent.FinishAction; |
||
12 | import jwizardcomponent.JWizardComponents; |
||
13 | import jwizardcomponent.Utilities; |
||
14 | import jwizardcomponent.example.SimpleDynamicWizardPanel; |
||
15 | import jwizardcomponent.example.SimpleLabelWizardPanel; |
||
16 | import jwizardcomponent.frame.SimpleLogoJWizardFrame; |
||
17 | |||
18 | import com.hardcode.driverManager.Driver; |
||
19 | import com.hardcode.driverManager.DriverManager; |
||
20 | import com.hardcode.driverManager.WriterManager; |
||
21 | import com.iver.cit.gvsig.fmap.edition.ISpatialWriter; |
||
22 | import com.iver.cit.gvsig.fmap.layers.LayerFactory; |
||
23 | import com.iver.cit.gvsig.gui.cad.MyFinishAction; |
||
24 | import com.iver.cit.gvsig.gui.cad.panels.ChooseGeometryType; |
||
25 | import com.iver.cit.gvsig.gui.cad.panels.ChooseWriteDriver; |
||
26 | import com.iver.cit.gvsig.gui.cad.panels.JPanelFieldDefinition; |
||
27 | |||
28 | /**
|
||
29 | * <p>Title: JWizardComponent</p>
|
||
30 | * <p>Description: Swing-Based Wizard Framework for Wizards</p>
|
||
31 | * <p>Copyright (C) 2003 William Ready
|
||
32 | 4584 | caballero | *
|
33 | 4416 | fjp | * <br>This library is free software; you can redistribute it and/or
|
34 | * <br>modify it under the terms of the GNU Lesser General Public
|
||
35 | * <br>License as published by the Free Software Foundation; either
|
||
36 | * <br>version 2.1 of the License, or (at your option) any later version.
|
||
37 | *
|
||
38 | * <br>This library is distributed in the hope that it will be useful,
|
||
39 | * <br>but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
40 | 4584 | caballero | * <br>MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
41 | 4416 | fjp | * <br>See the GNU Lesser General Public License for more details.
|
42 | *
|
||
43 | 4584 | caballero | * <br>To receive a copy of the GNU Lesser General Public License
|
44 | * <br>write to: The Free Software Foundation, Inc.,
|
||
45 | * <br>59 Temple Place, Suite 330
|
||
46 | 4416 | fjp | * <br>Boston, MA 02111-1307 USA</p>
|
47 | * @author William Ready
|
||
48 | * @version 1.0
|
||
49 | */
|
||
50 | |||
51 | public class TestJWizard { |
||
52 | |||
53 | static ImageIcon LOGO; |
||
54 | |||
55 | 4584 | caballero | |
56 | 4416 | fjp | public static void main(String [] args) { |
57 | try {
|
||
58 | 4584 | caballero | |
59 | 4416 | fjp | LOGO = new javax.swing.ImageIcon("images/package_graphics.png"); |
60 | // new ImageIcon(DefaultJWizardComponents.class.getResource("images/logo.jpeg"));
|
||
61 | |||
62 | SimpleLogoJWizardFrame wizardFrame = new SimpleLogoJWizardFrame(
|
||
63 | LOGO); |
||
64 | wizardFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||
65 | |||
66 | UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); |
||
67 | SwingUtilities.updateComponentTreeUI(wizardFrame);
|
||
68 | 4584 | caballero | |
69 | 4416 | fjp | wizardFrame.setTitle("Nuevo tema");
|
70 | 4584 | caballero | |
71 | MyFinishAction myFinish = new MyFinishAction(wizardFrame.getWizardComponents(), null, "SHP"); |
||
72 | |||
73 | 4416 | fjp | wizardFrame.getWizardComponents().setFinishAction(myFinish); |
74 | |||
75 | 4584 | caballero | |
76 | 4416 | fjp | /* wizardFrame.getWizardComponents().addWizardPanel(
|
77 | new SimpleLabelWizardPanel(wizardFrame.getWizardComponents(),
|
||
78 | new JLabel("Dynamic Test"))); */
|
||
79 | /* LayerFactory.setDriversPath("d:/Eclipse/workspace/_fwAndami/gvSIG/extensiones/com.iver.cit.gvsig/drivers");
|
||
80 | 4584 | caballero | |
81 | DriverManager writerManager = LayerFactory.getDM();
|
||
82 | 4416 | fjp | ArrayList spatialDrivers = new ArrayList();
|
83 | String[] writerNames = writerManager.getDriverNames();
|
||
84 | for (int i=0; i<writerNames.length; i++)
|
||
85 | {
|
||
86 | Driver drv = writerManager.getDriver(writerNames[i]);
|
||
87 | if (drv instanceof ISpatialWriter)
|
||
88 | spatialDrivers.add(drv.getName());
|
||
89 | }
|
||
90 | |||
91 | 4584 | caballero | |
92 | |||
93 | 4416 | fjp | wizardFrame.getWizardComponents().addWizardPanel(
|
94 | new ChooseWriteDriver(wizardFrame.getWizardComponents(),
|
||
95 | 4584 | caballero | "Dynamic Test", (String[]) spatialDrivers.toArray(new String[0])));
|
96 | 4416 | fjp | */
|
97 | ChooseGeometryType panelChoose = new ChooseGeometryType(wizardFrame.getWizardComponents());
|
||
98 | 4584 | caballero | JPanelFieldDefinition panelFields = new JPanelFieldDefinition(wizardFrame.getWizardComponents());
|
99 | 4416 | fjp | wizardFrame.getWizardComponents().addWizardPanel(panelChoose); |
100 | |||
101 | wizardFrame.getWizardComponents().addWizardPanel(panelFields); |
||
102 | |||
103 | /* wizardFrame.getWizardComponents().addWizardPanel(
|
||
104 | new SimpleLabelWizardPanel(wizardFrame.getWizardComponents(),
|
||
105 | new JLabel("Done!"))); */
|
||
106 | wizardFrame.setSize(540, 350); |
||
107 | Utilities.centerComponentOnScreen(wizardFrame);
|
||
108 | wizardFrame.show(); |
||
109 | 4584 | caballero | |
110 | 4416 | fjp | // System.out.println("Salgo con " + panelChoose.getLayerName());
|
111 | 4584 | caballero | |
112 | 4416 | fjp | } catch (Exception e) { |
113 | e.printStackTrace(); |
||
114 | } |
||
115 | } |
||
116 | |||
117 | } |