2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
9 package eu
.etaxonomy
.taxeditor
.printpublisher
.wizard
;
13 import org
.eclipse
.jface
.dialogs
.IDialogSettings
;
14 import org
.eclipse
.jface
.wizard
.WizardPage
;
16 import eu
.etaxonomy
.cdm
.print
.PublishConfigurator
;
17 import eu
.etaxonomy
.cdm
.print
.out
.IPublishOutputModule
;
18 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
21 * <p>Abstract AbstractPublishWizardPage class.</p>
24 * @created Apr 27, 2010
26 public abstract class AbstractPublishWizardPage
extends WizardPage
{
28 protected AbstractPublishWizardPage(String pageName
) {
32 public PublishConfigurator
getConfigurator(){
33 return ((AbstractPublishWizard
) getWizard()).getConfigurator();
36 public void setConfigurator(PublishConfigurator configurator
){
37 ((AbstractPublishWizard
) getWizard()).setConfigurator(configurator
);
40 public IPublishOutputModule
getOutputModule(){
41 IPublishOutputModule outputModule
= ((AbstractPublishWizard
) getWizard()).getOutputModule();
42 if(outputModule
== null)
43 throw new IllegalStateException("OutputModule may not be null at this moment");
47 public void putDialogSettingValue(String key
, String value
){
48 getDialogSettingSection().put(key
, value
);
51 public String
getDialogSettingValue(String key
){
52 return getDialogSettingSection().get(key
);
55 public boolean getDialogSettingBooleanValue(String key
){
56 return getDialogSettingSection().getBoolean(key
);
59 private IDialogSettings
getDialogSettingSection(){
60 IDialogSettings wizardDialogSetting
= getWizard().getDialogSettings();
61 if(wizardDialogSetting
== null){
62 throw new IllegalStateException("Wizards dialog setting may not be null");
65 IDialogSettings specificWizardDialogSection
= getOrCreateSettingSection(wizardDialogSetting
, getWizard().getClass().getName());
67 String dataSource
= null;
68 if(getConfigurator().isLocal()){
69 dataSource
= CdmStore
.getActiveCdmSource().getName();
70 }else if(getConfigurator().isRemote()){
71 URL serviceUrl
= getConfigurator().getWebserviceUrl();
72 dataSource
= serviceUrl
.toExternalForm();
74 throw new IllegalStateException("Print publisher configurator should be either local or remote");
77 IDialogSettings specificDataSourceDialogSection
= getOrCreateSettingSection(specificWizardDialogSection
, dataSource
);
79 return specificDataSourceDialogSection
;
82 private IDialogSettings
getOrCreateSettingSection(IDialogSettings setting
, String sectionName
){
83 IDialogSettings section
= setting
.getSection(sectionName
);
86 section
= setting
.addNewSection(sectionName
);