Revision 36376
trunk/libraries/libUIComponent/src/org/gvsig/gui/beans/wizard/WizardPanel.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.gui.beans.wizard; |
|
29 |
|
|
30 |
|
|
31 |
/** |
|
32 |
* This interface must be implemented by all the wizards. It just have a |
|
33 |
* methods to manage the events that the wizard throws. |
|
34 |
* |
|
35 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
|
36 |
*/ |
|
37 |
public interface WizardPanel { |
|
38 |
|
|
39 |
/** |
|
40 |
* @param wizardActionListener |
|
41 |
* sets the listener for the action events. |
|
42 |
*/ |
|
43 |
public void setWizardPanelActionListener(WizardPanelActionListener wizardActionListener); |
|
44 |
|
|
45 |
/** |
|
46 |
* @return |
|
47 |
* the listener for the action events |
|
48 |
*/ |
|
49 |
public WizardPanelActionListener getWizardPanelActionListener(); |
|
50 |
} |
|
51 |
|
|
0 | 52 |
trunk/libraries/libUIComponent/src/org/gvsig/gui/beans/wizard/WizardPanelActionListener.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.gui.beans.wizard; |
|
29 |
/** |
|
30 |
* <p> |
|
31 |
* Listener for the wizard. It has methods to manage the events that can |
|
32 |
* be thrown by the wizard. |
|
33 |
* </p> |
|
34 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
|
35 |
*/ |
|
36 |
public interface WizardPanelActionListener { |
|
37 |
|
|
38 |
/** |
|
39 |
* This event is thrown when the finish button is clicked. |
|
40 |
* @param wizardPanel |
|
41 |
* The wizard that has thrown the event. |
|
42 |
*/ |
|
43 |
public void finish(WizardPanel wizardPanel); |
|
44 |
|
|
45 |
/** |
|
46 |
* This event is thrown when the cancel button is clicked. |
|
47 |
* @param wizardPanel |
|
48 |
* The wizard that has thrown the event. |
|
49 |
*/ |
|
50 |
public void cancel(WizardPanel wizardPanel); |
|
51 |
|
|
52 |
} |
|
53 |
|
|
0 | 54 |
trunk/libraries/libUIComponent/src/org/gvsig/gui/beans/wizard/WizardPanelCancelAction.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.gui.beans.wizard; |
|
29 |
|
|
30 |
import jwizardcomponent.CancelAction; |
|
31 |
import jwizardcomponent.JWizardComponents; |
|
32 |
|
|
33 |
/** |
|
34 |
* <p> |
|
35 |
* This class links the click action in the cancel button method |
|
36 |
* and calls the {@link WizardPanelActionListener#cancel(WizardPanel)} |
|
37 |
* method. |
|
38 |
* </p> |
|
39 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
|
40 |
*/ |
|
41 |
public class WizardPanelCancelAction extends CancelAction{ |
|
42 |
private WizardPanel wizardPanel = null; |
|
43 |
|
|
44 |
public WizardPanelCancelAction(JWizardComponents wizardComponents, WizardPanel wizardPanel) { |
|
45 |
super(wizardComponents); |
|
46 |
this.wizardPanel = wizardPanel; |
|
47 |
} |
|
48 |
|
|
49 |
public void performAction() { |
|
50 |
if (wizardPanel.getWizardPanelActionListener() != null){ |
|
51 |
wizardPanel.getWizardPanelActionListener().cancel(wizardPanel); |
|
52 |
} |
|
53 |
} |
|
54 |
} |
|
55 |
|
|
0 | 56 |
trunk/libraries/libUIComponent/src/org/gvsig/gui/beans/wizard/WizardPanelWithLogo.java | ||
---|---|---|
1 |
package org.gvsig.gui.beans.wizard; |
|
2 |
|
|
3 |
import java.awt.BorderLayout; |
|
4 |
import java.awt.Color; |
|
5 |
|
|
6 |
import javax.swing.ImageIcon; |
|
7 |
import javax.swing.JLabel; |
|
8 |
import javax.swing.JPanel; |
|
9 |
import javax.swing.JSeparator; |
|
10 |
|
|
11 |
import jwizardcomponent.CancelAction; |
|
12 |
import jwizardcomponent.DefaultJWizardComponents; |
|
13 |
import jwizardcomponent.FinishAction; |
|
14 |
import jwizardcomponent.common.SimpleButtonPanel; |
|
15 |
|
|
16 |
import org.gvsig.gui.beans.wizard.panel.OptionPanel; |
|
17 |
import org.gvsig.gui.beans.wizard.panel.OptionPanelContainer; |
|
18 |
|
|
19 |
public class WizardPanelWithLogo extends JPanel { |
|
20 |
|
|
21 |
private static final long serialVersionUID = 7506729926181935234L; |
|
22 |
public final static int ACTION_PREVIOUS = 0; |
|
23 |
public final static int ACTION_NEXT = 1; |
|
24 |
public final static int ACTION_CANCEL = 2; |
|
25 |
public final static int ACTION_FINISH = 3; |
|
26 |
|
|
27 |
DefaultJWizardComponents wizardComponents; |
|
28 |
|
|
29 |
JPanel buttonPanel; |
|
30 |
JLabel statusLabel = new JLabel(); |
|
31 |
|
|
32 |
ImageIcon logo; |
|
33 |
|
|
34 |
public WizardPanelWithLogo(ImageIcon logo) { |
|
35 |
this.logo = logo; |
|
36 |
wizardComponents = new DefaultJWizardComponents(); |
|
37 |
init(); |
|
38 |
} |
|
39 |
|
|
40 |
private void init() { |
|
41 |
JPanel logoPanel = new JPanel(); |
|
42 |
|
|
43 |
logoPanel.add(new JLabel(logo)); |
|
44 |
logoPanel.setBackground(Color.WHITE); |
|
45 |
this.setLayout(new BorderLayout()); |
|
46 |
this.add(logoPanel, BorderLayout.WEST); |
|
47 |
this.add(wizardComponents.getWizardPanelsContainer(), |
|
48 |
BorderLayout.CENTER); |
|
49 |
|
|
50 |
JPanel auxPanel = new JPanel(new BorderLayout()); |
|
51 |
auxPanel.add(new JSeparator(), BorderLayout.NORTH); |
|
52 |
|
|
53 |
buttonPanel = new SimpleButtonPanel(wizardComponents); |
|
54 |
auxPanel.add(buttonPanel); |
|
55 |
this.add(auxPanel, BorderLayout.SOUTH); |
|
56 |
|
|
57 |
wizardComponents.setFinishAction(new FinishAction(wizardComponents) { |
|
58 |
|
|
59 |
public void performAction() { |
|
60 |
// dispose(); |
|
61 |
} |
|
62 |
}); |
|
63 |
wizardComponents.setCancelAction(new CancelAction(wizardComponents) { |
|
64 |
|
|
65 |
public void performAction() { |
|
66 |
// dispose(); |
|
67 |
} |
|
68 |
}); |
|
69 |
} |
|
70 |
|
|
71 |
public void doAction(int action) { |
|
72 |
switch (action) { |
|
73 |
case ACTION_NEXT: |
|
74 |
getWizardComponents().getNextButton().getActionListeners()[0] |
|
75 |
.actionPerformed(null); |
|
76 |
break; |
|
77 |
case ACTION_PREVIOUS: |
|
78 |
getWizardComponents().getBackButton().getActionListeners()[0] |
|
79 |
.actionPerformed(null); |
|
80 |
break; |
|
81 |
} |
|
82 |
} |
|
83 |
|
|
84 |
public DefaultJWizardComponents getWizardComponents() { |
|
85 |
return wizardComponents; |
|
86 |
} |
|
87 |
|
|
88 |
public void setWizardComponents(DefaultJWizardComponents aWizardComponents) { |
|
89 |
wizardComponents = aWizardComponents; |
|
90 |
} |
|
91 |
|
|
92 |
@Override |
|
93 |
public void show() { |
|
94 |
wizardComponents.updateComponents(); |
|
95 |
super.setVisible(true); |
|
96 |
} |
|
97 |
|
|
98 |
public void addOptionPanel(OptionPanel optionPanel) { |
|
99 |
getWizardComponents().addWizardPanel( |
|
100 |
new OptionPanelContainer(getWizardComponents(), optionPanel)); |
|
101 |
} |
|
102 |
|
|
103 |
public void setNextButtonEnabled(boolean isEnabled) { |
|
104 |
getWizardComponents().getNextButton().setEnabled(isEnabled); |
|
105 |
} |
|
106 |
|
|
107 |
public void setFinishButtonEnabled(boolean isVisible) { |
|
108 |
getWizardComponents().getFinishButton().setEnabled(isVisible); |
|
109 |
} |
|
110 |
|
|
111 |
public void setCancelButtonEnabled(boolean isVisible) { |
|
112 |
getWizardComponents().getCancelButton().setEnabled(isVisible); |
|
113 |
} |
|
114 |
|
|
115 |
private void setFinishAction(FinishAction finishAction) { |
|
116 |
getWizardComponents().setFinishAction(finishAction); |
|
117 |
} |
|
118 |
|
|
119 |
private void setCancelAction(CancelAction cancelAction) { |
|
120 |
getWizardComponents().setCancelAction(cancelAction); |
|
121 |
} |
|
122 |
|
|
123 |
public void setWizardListener(WizardPanel wizardPanel) { |
|
124 |
setFinishAction(new WizardPanelFinishAction(getWizardComponents(), |
|
125 |
wizardPanel)); |
|
126 |
setCancelAction(new WizardPanelCancelAction(getWizardComponents(), |
|
127 |
wizardPanel)); |
|
128 |
} |
|
129 |
|
|
130 |
public void setBackButtonEnabled(boolean isEnabled) { |
|
131 |
getWizardComponents().getBackButton().setEnabled(isEnabled); |
|
132 |
} |
|
133 |
} |
|
0 | 134 |
trunk/libraries/libUIComponent/src/org/gvsig/gui/beans/wizard/WizardPanelFinishAction.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.gui.beans.wizard; |
|
29 |
|
|
30 |
import jwizardcomponent.FinishAction; |
|
31 |
import jwizardcomponent.JWizardComponents; |
|
32 |
|
|
33 |
/** |
|
34 |
* <p> |
|
35 |
* This class links the click action in the cancel button method |
|
36 |
* and calls the {@link WizardPanelActionListener#finish(WizardPanel)} |
|
37 |
* method. |
|
38 |
* </p> |
|
39 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
|
40 |
*/ |
|
41 |
public class WizardPanelFinishAction extends FinishAction{ |
|
42 |
private WizardPanel wizardPanel = null; |
|
43 |
|
|
44 |
public WizardPanelFinishAction(JWizardComponents wizardComponents, WizardPanel wizardPanel) { |
|
45 |
super(wizardComponents); |
|
46 |
this.wizardPanel = wizardPanel; |
|
47 |
} |
|
48 |
|
|
49 |
public void performAction() { |
|
50 |
if (wizardPanel.getWizardPanelActionListener() != null){ |
|
51 |
wizardPanel.getWizardPanelActionListener().finish(wizardPanel); |
|
52 |
} |
|
53 |
} |
|
54 |
} |
|
55 |
|
|
0 | 56 |
Also available in: Unified diff