Revision 7eda66ff
Added by Niels Hoffmann almost 13 years ago
eu.etaxonomy.taxeditor.printpublisher/src/main/java/eu/etaxonomy/taxeditor/printpublisher/wizard/AbstractPublishWizardPage.java | ||
---|---|---|
10 | 10 |
|
11 | 11 |
package eu.etaxonomy.taxeditor.printpublisher.wizard; |
12 | 12 |
|
13 |
import java.net.URL; |
|
14 |
import java.nio.channels.IllegalSelectorException; |
|
15 |
|
|
16 |
import org.eclipse.jface.dialogs.IDialogSettings; |
|
13 | 17 |
import org.eclipse.jface.wizard.WizardPage; |
14 | 18 |
|
15 | 19 |
import eu.etaxonomy.cdm.print.PublishConfigurator; |
16 | 20 |
import eu.etaxonomy.cdm.print.out.IPublishOutputModule; |
21 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
|
17 | 22 |
|
18 | 23 |
/** |
19 | 24 |
* <p>Abstract AbstractPublishWizardPage class.</p> |
... | ... | |
62 | 67 |
throw new IllegalStateException("OutputModule may not be null at this moment"); |
63 | 68 |
return outputModule; |
64 | 69 |
} |
70 |
|
|
71 |
public void putDialogSettingValue(String key, String value){ |
|
72 |
getDialogSettingSection().put(key, value); |
|
73 |
} |
|
74 |
|
|
75 |
public String getDialogSettingValue(String key){ |
|
76 |
return getDialogSettingSection().get(key); |
|
77 |
} |
|
78 |
|
|
79 |
public boolean getDialogSettingBooleanValue(String key){ |
|
80 |
return getDialogSettingSection().getBoolean(key); |
|
81 |
} |
|
82 |
|
|
83 |
private IDialogSettings getDialogSettingSection(){ |
|
84 |
IDialogSettings wizardDialogSetting = getWizard().getDialogSettings(); |
|
85 |
if(wizardDialogSetting == null){ |
|
86 |
throw new IllegalStateException("Wizards dialog setting may not be null"); |
|
87 |
} |
|
88 |
|
|
89 |
IDialogSettings specificWizardDialogSection = getOrCreateSettingSection(wizardDialogSetting, getWizard().getClass().getName()); |
|
90 |
|
|
91 |
String dataSource = null; |
|
92 |
if(getConfigurator().isLocal()){ |
|
93 |
dataSource = CdmStore.getDataSource().getName(); |
|
94 |
}else if(getConfigurator().isRemote()){ |
|
95 |
URL serviceUrl = getConfigurator().getWebserviceUrl(); |
|
96 |
dataSource = serviceUrl.toExternalForm(); |
|
97 |
}else{ |
|
98 |
throw new IllegalStateException("Print publisher configurator should be either local or remote"); |
|
99 |
} |
|
100 |
|
|
101 |
IDialogSettings specificDataSourceDialogSection = getOrCreateSettingSection(specificWizardDialogSection, dataSource); |
|
102 |
|
|
103 |
return specificDataSourceDialogSection; |
|
104 |
} |
|
105 |
|
|
106 |
private IDialogSettings getOrCreateSettingSection(IDialogSettings setting, String sectionName){ |
|
107 |
IDialogSettings section = setting.getSection(sectionName); |
|
108 |
|
|
109 |
if(section == null){ |
|
110 |
section = setting.addNewSection(sectionName); |
|
111 |
} |
|
112 |
|
|
113 |
return section; |
|
114 |
} |
|
65 | 115 |
} |
Also available in: Unified diff
Improved PrintPublisher Wizard; Integrated SpecimenCdmExcel import