Statistics
| Revision:

svn-gvsig-desktop / trunk / extensions / extCAD / src / com / iver / cit / gvsig / TestJWizard.java @ 5571

History | View | Annotate | Download (4.21 KB)

1
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
 *
33
 * <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
 * <br>MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
41
 * <br>See the GNU Lesser General Public License for more details.
42
 *
43
 * <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
 * <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

    
56
  public static void main(String [] args) {
57
    try {
58

    
59
            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

    
69
      wizardFrame.setTitle("Nuevo tema");
70

    
71
      MyFinishAction myFinish = new MyFinishAction(wizardFrame.getWizardComponents(), null, "SHP");
72

    
73
          wizardFrame.getWizardComponents().setFinishAction(myFinish);
74

    
75

    
76
      /* 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

81
      DriverManager writerManager = LayerFactory.getDM();
82
      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

92

93
      wizardFrame.getWizardComponents().addWizardPanel(
94
                      new ChooseWriteDriver(wizardFrame.getWizardComponents(),
95
              "Dynamic Test", (String[]) spatialDrivers.toArray(new String[0])));
96
      */
97
                ChooseGeometryType panelChoose = new ChooseGeometryType(wizardFrame.getWizardComponents());
98
                JPanelFieldDefinition panelFields = new JPanelFieldDefinition(wizardFrame.getWizardComponents());
99
                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

    
110
            // System.out.println("Salgo con " + panelChoose.getLayerName());
111

    
112
    } catch (Exception e) {
113
      e.printStackTrace();
114
    }
115
  }
116

    
117
}