01: /*
02: * Copyright 2001-2006 C:1 Financial Services GmbH
03: *
04: * This software is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License Version 2.1, as published by the Free Software Foundation.
07: *
08: * This software is distributed in the hope that it will be useful,
09: * but WITHOUT ANY WARRANTY; without even the implied warranty of
10: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11: * Lesser General Public License for more details.
12: *
13: * You should have received a copy of the GNU Lesser General Public
14: * License along with this library; if not, write to the Free Software
15: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
16: */
17:
18: package de.finix.contelligent.client.wizard;
19:
20: import javax.swing.JComponent;
21: import javax.swing.JDialog;
22: import javax.swing.JLabel;
23: import javax.swing.JPanel;
24:
25: import de.finix.contelligent.client.ContelligentClient;
26: import de.finix.contelligent.client.i18n.Resources;
27: import de.finix.contelligent.client.util.JTextUtil;
28: import de.finix.contelligent.client.util.TableLayout;
29:
30: public class IconWizard extends AbstractWizard {
31: private String iconIdentifier;
32: private String environment;
33:
34: public IconWizard(String iconIdentifier, String environment) {
35: super ();
36: this .iconIdentifier = iconIdentifier;
37: this .environment = environment;
38: }
39:
40: public int startWizard(int step) {
41: return showIconDialog(step);
42: }
43:
44: public String getIconIdentifier() {
45: return iconIdentifier;
46: }
47:
48: private int showIconDialog(int step) {
49: JPanel panel = new JPanel(new TableLayout(
50: new double[][] {
51: { 250 },
52: { TableLayout.PREFERRED, 5,
53: TableLayout.PREFERRED, 10,
54: TableLayout.PREFERRED,
55: TableLayout.PREFERRED } }));
56:
57: JLabel title = JTextUtil.createTitle(Resources
58: .getLocalString("icon_wizard_title"));
59: panel.add(title, "0,0");
60: JComponent info = JTextUtil.createMessageArea(Resources
61: .getLocalString("icon_wizard_description"));
62: info.setOpaque(false);
63: panel.add(info, "0,2");
64: IconPane iconPane = new IconPane(iconIdentifier, environment);
65: panel.add(iconPane, "0,4");
66: if (step == FIRST_STEP) {
67: setOptions(new String[] { CANCEL, NEXT });
68: } else if (step == MIDDLE_STEP) {
69: setOptions(new String[] { CANCEL, BACK, NEXT });
70: } else if (step == LAST_STEP) {
71: setOptions(new String[] { CANCEL, BACK, FINISH });
72: }
73: setMessage(panel);
74: JDialog dialog = createDialog(ContelligentClient.getFrame(),
75: Resources.getLocalString("icon_wizard_title"));
76: dialog.setVisible(true);
77: if (getValue() == NEXT || getValue() == BACK
78: || getValue() == FINISH) {
79: iconIdentifier = iconPane.getIconIdentifier();
80: if (getValue() == BACK)
81: return BACK_OPTION;
82: return NEXT_OPTION;
83: }
84: return CANCEL_OPTION;
85: }
86:
87: }
|