Revision 5b087075
Added by Patrick Plitzner over 10 years ago
- completely removed EntityDetailType enum and all its uses
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/media/MediaRepresentationElement.java | ||
---|---|---|
1 | 1 |
// $Id$ |
2 | 2 |
/** |
3 | 3 |
* Copyright (C) 2007 EDIT |
4 |
* European Distributed Institute of Taxonomy
|
|
4 |
* European Distributed Institute of Taxonomy |
|
5 | 5 |
* http://www.e-taxonomy.eu |
6 |
*
|
|
6 |
* |
|
7 | 7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
8 | 8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
9 | 9 |
*/ |
... | ... | |
24 | 24 |
import eu.etaxonomy.taxeditor.store.StoreUtil; |
25 | 25 |
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection; |
26 | 26 |
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; |
27 |
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.EntityDetailType; |
|
28 | 27 |
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; |
29 | 28 |
import eu.etaxonomy.taxeditor.ui.element.LayoutConstants; |
30 | 29 |
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement; |
... | ... | |
58 | 57 |
int style) { |
59 | 58 |
super(cdmFormFactory, section, element, removeListener, null, style); |
60 | 59 |
} |
61 |
|
|
60 |
|
|
62 | 61 |
/* (non-Javadoc) |
63 | 62 |
* @see eu.etaxonomy.taxeditor.forms.section.AbstractEntityCollectionElement#createControls(eu.etaxonomy.taxeditor.forms.ICdmFormElement, int) |
64 | 63 |
*/ |
... | ... | |
67 | 66 |
public void createControls(ICdmFormElement element, int style) { |
68 | 67 |
text_mimeType = formFactory.createTextWithLabelElement(element, "Mime Type", null, style); |
69 | 68 |
text_suffix = formFactory.createTextWithLabelElement(element, "Suffix", null, style); |
70 |
section_mediaRepresentationPart = (MediaRepresentationPartSection) formFactory.createEntityDetailSection(EntityDetailType.MEDIAREPRESENTATIONPART, getConversationHolder(), element, style);
|
|
69 |
section_mediaRepresentationPart = formFactory.createMediaRepresentationPartSection(getConversationHolder(), element, style);
|
|
71 | 70 |
section_mediaRepresentationPart.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1)); |
72 | 71 |
} |
73 | 72 |
|
... | ... | |
79 | 78 |
text_mimeType.setText(element.getMimeType()); |
80 | 79 |
text_suffix.setText(element.getSuffix()); |
81 | 80 |
} |
82 |
|
|
81 |
|
|
83 | 82 |
/* |
84 | 83 |
* (non-Javadoc) |
85 | 84 |
* @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#handleEvent(java.lang.Object) |
... | ... | |
94 | 93 |
getEntity().setSuffix(text_suffix.getText()); |
95 | 94 |
} |
96 | 95 |
// FIXME HACK automatically set the mime type to the first mediaRepresentationPart's mimetype |
97 |
else if(eventSource == section_mediaRepresentationPart){
|
|
96 |
else if(eventSource == section_mediaRepresentationPart){ |
|
98 | 97 |
firePropertyChangeEvent(this); |
99 |
|
|
98 |
|
|
100 | 99 |
Collection<MediaRepresentationPart> imageFileElements = section_mediaRepresentationPart.getCollection(section_mediaRepresentationPart.getEntity()); |
101 |
|
|
100 |
|
|
102 | 101 |
if(! imageFileElements.iterator().hasNext()){ |
103 |
return;
|
|
102 |
return; |
|
104 | 103 |
} |
105 |
|
|
104 |
|
|
106 | 105 |
MediaRepresentationPart mediaRepresentationPart = imageFileElements.iterator().next(); |
107 | 106 |
if(mediaRepresentationPart == null || !(mediaRepresentationPart instanceof ImageFile)){ |
108 | 107 |
return; |
... | ... | |
118 | 117 |
String mimeType = imageInfo.getMimeType(); |
119 | 118 |
text_mimeType.setText(mimeType); |
120 | 119 |
getEntity().setMimeType(mimeType); |
121 |
text_suffix.setText(imageInfo.getSuffix());
|
|
120 |
text_suffix.setText(imageInfo.getSuffix()); |
|
122 | 121 |
getEntity().setSuffix(imageInfo.getSuffix()); |
123 | 122 |
} catch (IOException e) { |
124 | 123 |
StoreUtil.error(getClass(), e); |
Also available in: Unified diff