Improved PrintPublisher Wizard; Integrated SpecimenCdmExcel import
[taxeditor.git] / eu.etaxonomy.taxeditor.printpublisher / src / main / java / eu / etaxonomy / taxeditor / printpublisher / wizard / SelectOptionsWizardPage.java
1 // $Id$
2 /**
3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
6 *
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
9 */
10
11 package eu.etaxonomy.taxeditor.printpublisher.wizard;
12
13 import org.eclipse.swt.SWT;
14 import org.eclipse.swt.events.SelectionEvent;
15 import org.eclipse.swt.events.SelectionListener;
16 import org.eclipse.swt.layout.GridLayout;
17 import org.eclipse.swt.widgets.Button;
18 import org.eclipse.swt.widgets.Composite;
19
20 /**
21 * <p>OptionsWizardPage class.</p>
22 *
23 * @author n.hoffmann
24 * @created Jul 26, 2010
25 * @version 1.0
26 */
27 public class SelectOptionsWizardPage extends AbstractPublishWizardPage
28 implements SelectionListener, IHasPersistableSettings{
29
30 private static final String DIALOG_SETTING_PUBLISH_ENTIRE_BRANCHES = "dialogSettingPublishEntireBranch";
31 private static final String DIALOG_SETTING_DO_SYNONYMS = "dialogSettingDoSynonyms";
32 private static final String DIALOG_SETTING_DO_DESCRIPTIONS = "dialogSettingDoDescriptions";
33 private static final String DIALOG_SETTING_DO_IMAGES = "dialogSettingDoImages";
34
35 private Button button_doSynonymy;
36 private Button button_doDescriptions;
37 private Button button_doImages;
38 private Button button_doPublishEntireBranches;
39 private Composite composite;
40 private Boolean doImages;
41 private Boolean doDescriptions;
42 private Boolean doSynonymy;
43 private Boolean entireBranches;
44
45 /**
46 * <p>Constructor for OptionsWizardPage.</p>
47 *
48 * @param pageName a {@link java.lang.String} object.
49 */
50 protected SelectOptionsWizardPage(String pageName) {
51 super(pageName);
52 setTitle("Select options");
53 }
54
55 /** {@inheritDoc} */
56 @Override
57 public void createControl(Composite parent) {
58
59 composite = new Composite(parent, SWT.NULL);
60 composite.setLayout(new GridLayout());
61
62 button_doPublishEntireBranches = new Button(composite, SWT.CHECK);
63 button_doPublishEntireBranches.setText("Publish the entire branch for selected taxa (i.e. all taxonomically included taxa)");
64 button_doPublishEntireBranches.addSelectionListener(this);
65
66 button_doSynonymy = new Button(composite, SWT.CHECK);
67 button_doSynonymy.setText("Publish Synonymy");
68 button_doSynonymy.addSelectionListener(this);
69
70 button_doDescriptions = new Button(composite, SWT.CHECK);
71 button_doDescriptions.setText("Publish Descriptions");
72 button_doDescriptions.addSelectionListener(this);
73
74 button_doImages = new Button(composite, SWT.CHECK);
75 button_doImages.setText("Publish Images (not supported yet)");
76 button_doImages.addSelectionListener(this);
77
78 loadSettings();
79
80 setControl(composite);
81 }
82
83 @Override
84 public void loadSettings() {
85 if(getDialogSettingValue(DIALOG_SETTING_PUBLISH_ENTIRE_BRANCHES) != null){
86 button_doPublishEntireBranches.setSelection(getDialogSettingBooleanValue(DIALOG_SETTING_PUBLISH_ENTIRE_BRANCHES));
87 }else{
88 button_doPublishEntireBranches.setSelection(getConfigurator().isDoPublishEntireBranches());
89 }
90
91 if(getDialogSettingValue(DIALOG_SETTING_DO_SYNONYMS) != null){
92 button_doSynonymy.setSelection(getDialogSettingBooleanValue(DIALOG_SETTING_DO_SYNONYMS));
93 }else{
94 button_doSynonymy.setSelection(getConfigurator().isDoSynonymy());
95 }
96
97 if(getDialogSettingValue(DIALOG_SETTING_DO_DESCRIPTIONS) != null){
98 button_doDescriptions.setSelection(getDialogSettingBooleanValue(DIALOG_SETTING_DO_DESCRIPTIONS));
99 }else{
100 button_doDescriptions.setSelection(getConfigurator().isDoDescriptions());
101 }
102
103 if(getDialogSettingValue(DIALOG_SETTING_DO_IMAGES) != null){
104 button_doImages.setSelection(getDialogSettingBooleanValue(DIALOG_SETTING_DO_IMAGES));
105 }else{
106 button_doImages.setSelection(getConfigurator().isDoImages());
107 }
108
109 // trigger selection
110 widgetSelected(null);
111 }
112
113 /** {@inheritDoc} */
114 @Override
115 public void widgetSelected(SelectionEvent e) {
116 entireBranches = button_doPublishEntireBranches.getSelection();
117 getConfigurator().setDoPublishEntireBranches(entireBranches);
118 putDialogSettingValue(DIALOG_SETTING_PUBLISH_ENTIRE_BRANCHES, entireBranches.toString());
119
120 doSynonymy = button_doSynonymy.getSelection();
121 getConfigurator().setDoSynonymy(doSynonymy);
122 putDialogSettingValue(DIALOG_SETTING_DO_SYNONYMS, doSynonymy.toString());
123
124 doDescriptions = button_doDescriptions.getSelection();
125 getConfigurator().setDoDescriptions(doDescriptions);
126 putDialogSettingValue(DIALOG_SETTING_DO_DESCRIPTIONS, doDescriptions.toString());
127
128 doImages = button_doImages.getSelection();
129 getConfigurator().setDoImages(doImages);
130 putDialogSettingValue(DIALOG_SETTING_DO_IMAGES, doImages.toString());
131 }
132
133 /** {@inheritDoc} */
134 @Override
135 public void widgetDefaultSelected(SelectionEvent e) {}
136 }