Revision 33267

View differences:

branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.swing/org.gvsig.installer.swing.impl/src/main/java/org/gvsig/installer/swing/impl/InstallerWizardPanel.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
5
* 
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
* as published by the Free Software Foundation; either version 2
9
* 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
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
* MA  02110-1301, USA.
20
* 
21
*/
22

  
23
/*
24
* AUTHORS (In addition to CIT):
25
* 2010 {Prodevelop}   {Task}
26
*/
27
 
28
package org.gvsig.installer.swing.impl;
29

  
30
import javax.swing.JPanel;
31

  
32

  
33
/**
34
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
35
 */
36
public interface InstallerWizardPanel {
37
	/**
38
	 * Returns a title for the panel.
39
	 * @return
40
	 * The panel title.
41
	 */
42
	public String getPanelTitle();
43

  
44
	/**
45
	 * This method is called when the next button is clicked
46
	 */
47
	public void nextPanel() throws NotContinueWizardException;
48

  
49
	/**
50
	 * This method is called when the last button is clicked
51
	 */
52
	public void lastPanel();
53
	
54
	/**
55
	 * This method is called when the panel is displayed
56
	 */
57
	public void updatePanel();
58
		
59
	/**
60
	 * Return the panel to display.
61
	 * @return
62
	 * The panel.
63
	 */
64
	public JPanel getJPanel();
65
}
66

  
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.swing/org.gvsig.installer.swing.impl/src/main/java/org/gvsig/installer/swing/impl/InstallerWizardContainer.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
5
* 
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
* as published by the Free Software Foundation; either version 2
9
* 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
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
* MA  02110-1301, USA.
20
* 
21
*/
22

  
23
/*
24
* AUTHORS (In addition to CIT):
25
* 2010 {Prodevelop}   {Task}
26
*/
27
 
28
package org.gvsig.installer.swing.impl;
29

  
30
import java.awt.BorderLayout;
31

  
32
import javax.swing.JOptionPane;
33

  
34
import jwizardcomponent.JWizardComponents;
35
import jwizardcomponent.JWizardPanel;
36

  
37
import org.slf4j.Logger;
38
import org.slf4j.LoggerFactory;
39

  
40
/**
41
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
42
 */
43
public class InstallerWizardContainer extends JWizardPanel {
44
	private InstallerWizardPanel installerWizardPanel = null;
45
	private static final Logger log = LoggerFactory.getLogger(InstallerWizardContainer.class);
46
	
47
	public InstallerWizardContainer(JWizardComponents wizardComponents,
48
			InstallerWizardPanel wizard) {
49
		super(wizardComponents);	
50
		this.installerWizardPanel = wizard;
51
		setLayout(new BorderLayout());
52
		setBorder(javax.swing.BorderFactory.createCompoundBorder(javax.swing.BorderFactory.createTitledBorder(wizard.getPanelTitle()),
53
				javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5)));
54
		add(wizard.getJPanel(), BorderLayout.CENTER);
55
	}
56

  
57
	/* (non-Javadoc)
58
	 * @see jwizardcomponent.JWizardPanel#back()
59
	 */
60
	@Override
61
	public void back() {
62
		installerWizardPanel.lastPanel();
63
		super.back();		
64
	}
65

  
66
	/* (non-Javadoc)
67
	 * @see jwizardcomponent.JWizardPanel#next()
68
	 */
69
	@Override
70
	public void next() {
71
		try {
72
			installerWizardPanel.nextPanel();
73
			super.next();
74
		} catch (NotContinueWizardException e) {
75
			log.error("It is not possible to continue with the wizard", e);
76
			JOptionPane.showMessageDialog(e.getComponent(), 
77
					e.getMessage());
78
		}		
79
	}
80

  
81
	/* (non-Javadoc)
82
	 * @see jwizardcomponent.JWizardPanel#update()
83
	 */
84
	@Override
85
	public void update() {
86
		installerWizardPanel.updatePanel();
87
		super.update();
88
	}
89
	
90
	
91
}
92

  
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.swing/org.gvsig.installer.swing.impl/src/main/java/org/gvsig/installer/swing/impl/NotContinueWizardException.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
5
* 
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
* as published by the Free Software Foundation; either version 2
9
* 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
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
* MA  02110-1301, USA.
20
* 
21
*/
22

  
23
/*
24
* AUTHORS (In addition to CIT):
25
* 2010 {Prodevelop}   {Task}
26
*/
27
 
28
package org.gvsig.installer.swing.impl;
29

  
30
import java.awt.Component;
31

  
32
import org.gvsig.tools.exception.BaseException;
33

  
34
/**
35
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
36
 */
37
public class NotContinueWizardException extends BaseException{
38
	private static final long serialVersionUID = -850687874081155952L;
39
	private static final String KEY = "not_continue_with_wizard";	
40
	private Component component = null;
41
	/**
42
	 * @see BaseException#BaseException(String, Throwable, String, long)
43
	 */
44
	public NotContinueWizardException(String message, Throwable cause, Component component) {
45
		super(message, cause, KEY, serialVersionUID);		
46
		this.component = component;
47
	}
48
	public Component getComponent() {
49
		return component;
50
	}
51
	
52
	
53

  
54
}
55

  

Also available in: Unified diff