Project

General

Profile

« Previous | Next » 

Revision 460cc149

Added by Katja Luther about 4 years ago

adapt taxeditor to mediaCreated as timePeriod

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/media/MediaMetaElement.java
10 10
import org.eclipse.swt.events.SelectionEvent;
11 11
import org.eclipse.swt.events.SelectionListener;
12 12
import org.eclipse.swt.widgets.Button;
13
import org.joda.time.DateTime;
14 13

  
15 14
import eu.etaxonomy.cdm.common.CdmUtils;
16 15
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
17 16
import eu.etaxonomy.cdm.model.agent.AgentBase;
18 17
import eu.etaxonomy.cdm.model.common.Language;
19 18
import eu.etaxonomy.cdm.model.common.LanguageString;
19
import eu.etaxonomy.cdm.model.common.TimePeriod;
20 20
import eu.etaxonomy.cdm.model.media.Media;
21 21
import eu.etaxonomy.taxeditor.model.AbstractUtility;
22 22
import eu.etaxonomy.taxeditor.model.ImageResources;
......
28 28
import eu.etaxonomy.taxeditor.ui.element.ISelectableElement;
29 29
import eu.etaxonomy.taxeditor.ui.element.LanguageStringWithLabelElement;
30 30
import eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator;
31
import eu.etaxonomy.taxeditor.ui.mvc.element.DateElement;
31
import eu.etaxonomy.taxeditor.ui.element.TimePeriodElement;
32 32
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
33 33
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
34 34
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
......
44 44
    private LanguageStringWithLabelElement text_description;
45 45
    private LanguageStringWithLabelElement text_title;
46 46
    private MediaDetailElement mediaDetailElement;
47
    private DateElement mediaCreated;
47
    private TimePeriodElement mediaCreated;
48 48
    private SelectionArbitrator selectionArbitrator;
49 49

  
50 50
    public MediaMetaElement(CdmFormFactory cdmFormFactory,
......
77 77
                element, "Artist", null, EntitySelectionElement.ALL, style);
78 78
        addElement(selection_artist);
79 79

  
80
        mediaCreated = formFactory.createDateElement(element, "Media Created", getEntity().getMediaCreated(), style, false);
81
        addElement(mediaCreated.getController());
80
        mediaCreated = formFactory.createTimePeriodElement(element, "Media Created", getEntity().getMediaCreated(), style);
81
        addElement(mediaCreated);
82 82
        text_description = formFactory.createLanguageStringWithLabelElement(element, "Description", null, 100, true, style);
83 83

  
84 84

  
......
142 142
            if (getParentElement() instanceof AbstractCdmDetailSection) {
143 143
                ((AbstractCdmDetailSection<?>) getParentElement()).updateTitle();
144 144
            }
145
        } else if (eventSource == mediaCreated.getController()){
146
        	DateTime date = mediaCreated.getController().getDateTime();
145
        } else if (eventSource == mediaCreated){
146
        	TimePeriod date = mediaCreated.getTimePeriod();
147 147
        	getEntity().setMediaCreated(date);
148 148
        }
149 149
    }
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/media/MediaSpecimenGeneralDetailElement.java
8 8
 */
9 9
package eu.etaxonomy.taxeditor.ui.section.occurrence.media;
10 10

  
11
import org.joda.time.DateTime;
12

  
13 11
import eu.etaxonomy.cdm.api.service.IVocabularyService;
14 12
import eu.etaxonomy.cdm.model.agent.AgentBase;
15 13
import eu.etaxonomy.cdm.model.common.DefinedTerm;
......
30 28
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
31 29
import eu.etaxonomy.taxeditor.ui.element.LanguageStringWithLabelElement;
32 30
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
33
import eu.etaxonomy.taxeditor.ui.mvc.element.DateElement;
31
import eu.etaxonomy.taxeditor.ui.element.TimePeriodElement;
34 32
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
35 33
import eu.etaxonomy.taxeditor.ui.section.media.ITogglableMediaElement;
36 34
import eu.etaxonomy.taxeditor.ui.section.media.MediaDetailElement;
......
48 46
    private TermComboElement<DefinedTerm> comboKindOfUnit;
49 47
    private LanguageStringWithLabelElement textTitleLanguageString;
50 48
    private EntitySelectionElement<AgentBase> selectionArtist;
51
    private DateElement date;
49
    private TimePeriodElement date;
52 50
    private LanguageStringWithLabelElement textMethodLanguageString;
53 51
    private EntitySelectionElement<Collection> selection_collection;
54 52
    private TextWithLabelElement text_accessionNumber;
......
77 75
                    formElement, "Prepared by", media.getArtist(), EntitySelectionElement.ALL, style);
78 76
            TimePeriod mediaCreated = entity.getMediaSpecimen().getMediaCreated();
79 77

  
80
            date = formFactory.createDateElement(formElement, "Preparation Date", mediaCreated, style, true);
78
            date = formFactory.createTimePeriodElement(formElement, "Preparation Date", mediaCreated, style);
81 79
            textMethodLanguageString = formFactory.createLanguageStringWithLabelElement(formElement, "Method", media.getDescription(Language.getDefaultLanguage()), style);
82 80
            selection_collection = formFactory.createSelectionElement(Collection.class,// getConversationHolder(),
83 81
                    formElement, "Collection", entity.getCollection(), EntitySelectionElement.ALL, style);
......
113 111
        else if(eventSource==textTitleLanguageString){
114 112
            media.putTitle(textTitleLanguageString.getLanguageString());
115 113
        }
116
        else if(eventSource==date.getController()){
117
            DateTime dateTime = date.getController().getDateTime();
114
        else if(eventSource==date){
115
            TimePeriod dateTime = date.getTimePeriod();
118 116
            media.setMediaCreated(dateTime);
119 117
        }
120 118
        else if(eventSource==selectionArtist){

Also available in: Unified diff