Revision 17c6b2e1
Added by Andreas Kohlbecker almost 3 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/media/ImageFileElement.java | ||
---|---|---|
9 | 9 |
|
10 | 10 |
package eu.etaxonomy.taxeditor.ui.section.media; |
11 | 11 |
|
12 |
import java.net.URI; |
|
13 |
|
|
14 |
import javax.swing.plaf.basic.BasicFileChooserUI.SelectionListener; |
|
15 |
|
|
12 | 16 |
import org.apache.commons.io.FileUtils; |
13 | 17 |
import org.eclipse.core.runtime.IProgressMonitor; |
14 | 18 |
import org.eclipse.core.runtime.IStatus; |
15 |
import org.eclipse.core.runtime.Status; |
|
16 | 19 |
import org.eclipse.core.runtime.jobs.Job; |
17 |
import org.eclipse.swt.events.SelectionListener; |
|
18 | 20 |
|
21 |
import eu.etaxonomy.cdm.api.service.media.MediaMedadataFileReader; |
|
19 | 22 |
import eu.etaxonomy.cdm.common.media.CdmImageInfo; |
20 |
import eu.etaxonomy.cdm.common.URI; |
|
21 | 23 |
import eu.etaxonomy.cdm.model.media.ImageFile; |
22 | 24 |
import eu.etaxonomy.taxeditor.store.StoreUtil; |
23 | 25 |
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection; |
... | ... | |
48 | 50 |
@Override |
49 | 51 |
protected IStatus run(IProgressMonitor monitor) { |
50 | 52 |
try{ |
51 |
CdmImageInfo imageInfo = CdmImageInfo.NewInstanceWithMetaData(uri, 10000);
|
|
53 |
CdmImageInfo imageInfo = new MediaMedadataFileReader(uri).readBaseInfo().readMetaData().getCdmImageInfo();
|
|
52 | 54 |
ImageFileElement.this.getLayoutComposite().getDisplay().asyncExec(()->{ |
53 | 55 |
element_keyValue.setInput(imageInfo.getMetaData()); |
54 | 56 |
try { |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/media/MediaDetailElement.java | ||
---|---|---|
8 | 8 |
*/ |
9 | 9 |
package eu.etaxonomy.taxeditor.ui.section.media; |
10 | 10 |
|
11 |
import java.awt.Button; |
|
12 |
import java.awt.Label; |
|
11 | 13 |
import java.io.IOException; |
14 |
import java.net.URI; |
|
12 | 15 |
import java.util.List; |
13 | 16 |
import java.util.Set; |
14 | 17 |
|
18 |
import javax.print.attribute.standard.Media; |
|
19 |
|
|
15 | 20 |
import org.apache.commons.imaging.ImageReadException; |
16 | 21 |
import org.apache.http.HttpException; |
17 | 22 |
import org.eclipse.core.runtime.IProgressMonitor; |
18 | 23 |
import org.eclipse.core.runtime.IStatus; |
19 |
import org.eclipse.core.runtime.Status; |
|
20 | 24 |
import org.eclipse.core.runtime.jobs.Job; |
21 | 25 |
import org.eclipse.swt.SWT; |
22 | 26 |
import org.eclipse.swt.events.SelectionAdapter; |
23 | 27 |
import org.eclipse.swt.events.SelectionEvent; |
24 |
import org.eclipse.swt.widgets.Button; |
|
25 |
import org.eclipse.swt.widgets.Label; |
|
26 | 28 |
|
27 |
import eu.etaxonomy.cdm.common.URI;
|
|
29 |
import eu.etaxonomy.cdm.api.service.media.MediaMedadataFileReader;
|
|
28 | 30 |
import eu.etaxonomy.cdm.common.UriUtils; |
29 | 31 |
import eu.etaxonomy.cdm.common.media.CdmImageInfo; |
30 | 32 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
31 | 33 |
import eu.etaxonomy.cdm.model.media.ImageFile; |
32 |
import eu.etaxonomy.cdm.model.media.Media; |
|
33 | 34 |
import eu.etaxonomy.cdm.model.media.MediaRepresentation; |
34 | 35 |
import eu.etaxonomy.cdm.model.media.MediaRepresentationPart; |
35 | 36 |
import eu.etaxonomy.cdm.model.media.MediaUtils; |
... | ... | |
74 | 75 |
|
75 | 76 |
UriUtils.getInputStream(uri);// will fail with a FileNotFoundException if not |
76 | 77 |
|
77 |
CdmImageInfo imageInfo = CdmImageInfo.NewInstance(uri, 10000);//will fail when it is no image file
|
|
78 |
CdmImageInfo imageInfo = new MediaMedadataFileReader(uri).readBaseInfo().readMetaData().getCdmImageInfo(); //will fail when it is no image file
|
|
78 | 79 |
MediaDetailElement.this.getLayoutComposite().getDisplay().asyncExec(()->{ |
79 | 80 |
singleMediaRepresentationPart.setSize((int) imageInfo.getLength()); |
80 | 81 |
if(singleMediaRepresentationPart.isInstanceOf(ImageFile.class)){ |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/media/MediaRepresentationElement.java | ||
---|---|---|
10 | 10 |
package eu.etaxonomy.taxeditor.ui.section.media; |
11 | 11 |
|
12 | 12 |
import java.io.IOException; |
13 |
import java.net.URI; |
|
13 | 14 |
import java.util.Collection; |
14 | 15 |
|
16 |
import javax.swing.plaf.basic.BasicFileChooserUI.SelectionListener; |
|
17 |
|
|
15 | 18 |
import org.apache.http.HttpException; |
16 | 19 |
import org.eclipse.core.runtime.IProgressMonitor; |
17 | 20 |
import org.eclipse.core.runtime.IStatus; |
18 |
import org.eclipse.core.runtime.Status; |
|
19 | 21 |
import org.eclipse.core.runtime.jobs.Job; |
20 |
import org.eclipse.swt.events.SelectionListener; |
|
21 | 22 |
|
22 |
import eu.etaxonomy.cdm.common.URI;
|
|
23 |
import eu.etaxonomy.cdm.api.service.media.MediaMedadataFileReader;
|
|
23 | 24 |
import eu.etaxonomy.cdm.common.UriUtils; |
24 | 25 |
import eu.etaxonomy.cdm.common.media.CdmImageInfo; |
25 | 26 |
import eu.etaxonomy.cdm.model.media.ImageFile; |
... | ... | |
97 | 98 |
return Status.CANCEL_STATUS; |
98 | 99 |
} |
99 | 100 |
try { |
100 |
CdmImageInfo imageInfo = CdmImageInfo.NewInstance(uri, 10000);
|
|
101 |
CdmImageInfo imageInfo = new MediaMedadataFileReader(uri).readBaseInfo().readMetaData().getCdmImageInfo();
|
|
101 | 102 |
String mimeType = imageInfo.getMimeType(); |
102 | 103 |
getEntity().setMimeType(mimeType); |
103 | 104 |
getEntity().setSuffix(imageInfo.getSuffix()); |
Also available in: Unified diff
ref #9607 adapting to changes in image metadata factories