Revision bdc4f441
Added by Cherian Mathew over 8 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/feature/FeatureDistributionDetailElement.java | ||
---|---|---|
19 | 19 |
import org.eclipse.swt.SWT; |
20 | 20 |
import org.eclipse.swt.widgets.Label; |
21 | 21 |
|
22 |
import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteConfiguration;
|
|
22 |
import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteController;
|
|
23 | 23 |
import eu.etaxonomy.cdm.common.UriUtils; |
24 | 24 |
import eu.etaxonomy.cdm.ext.geo.IEditGeoService; |
25 | 25 |
import eu.etaxonomy.cdm.model.common.Language; |
26 |
import eu.etaxonomy.cdm.model.description.DescriptionElementBase; |
|
26 | 27 |
import eu.etaxonomy.cdm.model.description.PresenceAbsenceTerm; |
27 | 28 |
import eu.etaxonomy.cdm.model.description.TaxonDescription; |
28 | 29 |
import eu.etaxonomy.taxeditor.model.FeatureNodeContainer; |
... | ... | |
71 | 72 |
URI serviceUri = new URI(serviceUriString); |
72 | 73 |
if(UriUtils.isServiceAvailable(serviceUri, 500)){ |
73 | 74 |
image = formFactory.createBrowserElement(formElement, null, style); |
74 |
String mapUriString = getMapUriString(getEntity()); |
|
75 |
image.setImageUriString(mapUriString); |
|
75 |
// FIXME : This is a temporary workaround which ic |
|
76 |
// waiting for #5357 to be fixed |
|
77 |
if(!isUnsavedDistribution(getEntity())) { |
|
78 |
String mapUriString = getMapUriString(getEntity()); |
|
79 |
image.setImageUriString(mapUriString); |
|
80 |
message = mapUriString; |
|
81 |
} |
|
76 | 82 |
formElement.getLayoutComposite().layout(); |
77 |
message = mapUriString; |
|
83 |
|
|
78 | 84 |
return; |
79 | 85 |
} else { |
80 | 86 |
message = String.format("The service is not available: %s", serviceUriString); |
... | ... | |
110 | 116 |
int width = image.calculateWidth(); |
111 | 117 |
IEditGeoService editGeoService; |
112 | 118 |
List<Language> languages = Arrays.asList(new Language[]{CdmStore.getDefaultLanguage()}); |
113 |
if(CdmStore.getCurrentApplicationConfiguration() instanceof CdmApplicationRemoteConfiguration) {
|
|
114 |
editGeoService = ((CdmApplicationRemoteConfiguration)CdmStore.getCurrentApplicationConfiguration()).getEditGeoService();
|
|
119 |
if(CdmStore.getCurrentSessionManager().isRemoting()) {
|
|
120 |
editGeoService = ((CdmApplicationRemoteController)CdmStore.getCurrentApplicationConfiguration()).getEditGeoService();
|
|
115 | 121 |
}else{ |
116 | 122 |
editGeoService =(IEditGeoService) CdmStore.getCurrentApplicationConfiguration().getBean( |
117 | 123 |
"editGeoService"); |
118 | 124 |
} |
125 |
|
|
119 | 126 |
String parameter = editGeoService.getDistributionServiceRequestParameterString( |
120 | 127 |
getTaxonDescriptions(), |
121 | 128 |
false, |
... | ... | |
135 | 142 |
return Arrays.asList(((TaxonDescription) getEntity().getDescription()).getTaxon().getDescriptions().toArray(new TaxonDescription[0])); |
136 | 143 |
} |
137 | 144 |
|
145 |
private boolean isUnsavedDistribution(FeatureNodeContainer container) { |
|
146 |
for(DescriptionElementBase dist : container.getDescriptionElements()) { |
|
147 |
if(dist.getId() == 0) { |
|
148 |
return true; |
|
149 |
} |
|
150 |
} |
|
151 |
return false; |
|
152 |
} |
|
153 |
|
|
138 | 154 |
} |
Also available in: Unified diff
#5357 Add check to avoid transient object exception