01: package org.dbbrowser.ui.helper.exporthelper.wizard;
02:
03: import infrastructure.internationalization.InternationalizationManager;
04: import javax.swing.table.AbstractTableModel;
05: import org.dbbrowser.ui.helper.exporthelper.ExportHelperException;
06: import org.dbbrowser.ui.helper.exporthelper.wizard.paneldescriptors.DateFormatPanelDescriptor;
07: import org.dbbrowser.ui.helper.exporthelper.wizard.paneldescriptors.ExportConfirmationPanelDescriptor;
08: import org.dbbrowser.ui.helper.exporthelper.wizard.paneldescriptors.ExportProgressPanelDescriptor;
09: import org.dbbrowser.ui.helper.exporthelper.wizard.paneldescriptors.ExportTypePanelDescriptor;
10: import org.dbbrowser.ui.helper.exporthelper.wizard.paneldescriptors.HeaderFooterPanelDescriptor;
11: import org.dbbrowser.ui.helper.exporthelper.wizard.paneldescriptors.IncludeTableColumnsPanelDescriptor;
12: import org.dbbrowser.ui.helper.exporthelper.wizard.paneldescriptors.OverviewPanelDescriptor;
13: import org.dbbrowser.ui.helper.exporthelper.wizard.paneldescriptors.PageSetupPanelDescriptor;
14: import com.nexes.wizard.Wizard;
15:
16: /**
17: * Class used to export a table to PDF file
18: */
19: public class DataExporterUsingWizard {
20: private static final String TITLE = InternationalizationManager
21: .getInstance().getMessage("dbbrowser-ui",
22: "dbbrowser-ui-dbbrowser-window-title-label", null);;
23:
24: /**
25: * Export the data in the table to the specified file as a PDF file
26: * @param abstractTableModel
27: * @throws ExportHelperException
28: */
29: public void export(AbstractTableModel abstractTableModel) {
30: //Clean the Wizardstate
31: WizardState.getInstance().clearState();
32:
33: Wizard wizard = new Wizard();
34: wizard.getDialog().setTitle(TITLE);
35:
36: OverviewPanelDescriptor overviewPanelDescriptor = new OverviewPanelDescriptor();
37: wizard.registerWizardPanel(OverviewPanelDescriptor.IDENTIFIER,
38: overviewPanelDescriptor);
39:
40: ExportTypePanelDescriptor exportTypePanelDescriptor = new ExportTypePanelDescriptor();
41: wizard.registerWizardPanel(
42: ExportTypePanelDescriptor.IDENTIFIER,
43: exportTypePanelDescriptor);
44:
45: DateFormatPanelDescriptor dateFormatPanelDescriptor = new DateFormatPanelDescriptor();
46: wizard.registerWizardPanel(
47: DateFormatPanelDescriptor.IDENTIFIER,
48: dateFormatPanelDescriptor);
49:
50: IncludeTableColumnsPanelDescriptor includeTableColumnsPanelDescriptor = new IncludeTableColumnsPanelDescriptor(
51: abstractTableModel);
52: wizard.registerWizardPanel(
53: IncludeTableColumnsPanelDescriptor.IDENTIFIER,
54: includeTableColumnsPanelDescriptor);
55:
56: ExportConfirmationPanelDescriptor exportConfirmationPanelDescriptor = new ExportConfirmationPanelDescriptor();
57: wizard.registerWizardPanel(
58: ExportConfirmationPanelDescriptor.IDENTIFIER,
59: exportConfirmationPanelDescriptor);
60:
61: HeaderFooterPanelDescriptor headerFooterPanelDescriptor = new HeaderFooterPanelDescriptor();
62: wizard.registerWizardPanel(
63: HeaderFooterPanelDescriptor.IDENTIFIER,
64: headerFooterPanelDescriptor);
65:
66: PageSetupPanelDescriptor pageSetupPanelDescriptor = new PageSetupPanelDescriptor();
67: wizard.registerWizardPanel(PageSetupPanelDescriptor.IDENTIFIER,
68: pageSetupPanelDescriptor);
69:
70: ExportProgressPanelDescriptor exportProgressPanelDescriptor = new ExportProgressPanelDescriptor(
71: abstractTableModel);
72: wizard.registerWizardPanel(
73: ExportProgressPanelDescriptor.IDENTIFIER,
74: exportProgressPanelDescriptor);
75:
76: wizard.setCurrentPanel(OverviewPanelDescriptor.IDENTIFIER);
77:
78: wizard.getDialog().setSize(600, 400);
79: wizard.getDialog().setLocationRelativeTo(null);
80:
81: int ret = wizard.showModalDialog();
82: }
83: }
|