Project

General

Profile

Revision 7f4db90c

ID7f4db90c9a2eb63d618ddca014e6f0656e2f55f7
Parent 19971743
Child e759655c

Added by Andreas Müller over 2 years ago

ref #7421 continue refactor verbatim date sections and elements

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java
1247 1247
     * @return a {@link eu.etaxonomy.taxeditor.ui.element.TimePeriodElement}
1248 1248
     *         object.
1249 1249
     */
1250
    public TimePeriodElement<TimePeriod> createTimePeriodElement(ICdmFormElement parentElement, String labelString,
1250
    public TimePeriodElement createTimePeriodElement(ICdmFormElement parentElement, String labelString,
1251 1251
            TimePeriod timePeriod, int style) {
1252
        TimePeriodElement<TimePeriod> element = new TimePeriodElement<TimePeriod>(this, parentElement, labelString, timePeriod, style);
1252
        TimePeriodElement element = new TimePeriodElement(this, parentElement, labelString, timePeriod, style);
1253 1253
        adapt(element);
1254 1254
        parentElement.addElement(element);
1255 1255
        return element;
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/DateDetailSection.java
10 10
package eu.etaxonomy.taxeditor.ui.element;
11 11

  
12 12
import eu.etaxonomy.cdm.model.common.TimePeriod;
13
import eu.etaxonomy.cdm.strategy.parser.TimePeriodParser;
13 14

  
14 15
/**
15 16
 * <p>
......
29 30
	protected TimePeriod newInstance(){
30 31
		return TimePeriod.NewInstance();
31 32
	}
33
	
34
	protected TimePeriod parseNewInstance() {
35
		TimePeriod result = TimePeriodParser.parseString(getText_parseText().getText());
36
		return result;
37
	}
32 38

  
33 39
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/DateDetailSectionBase.java
149 149
		firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null));
150 150
	}
151 151

  
152
	protected T parseNewInstance() {
153
		@SuppressWarnings("unchecked")
154
		T result = (T)TimePeriodParser.parseString(getText_parseText().getText());
155
		return result;
156
	}
152
	protected abstract T parseNewInstance() ;
157 153

  
158 154
	protected void updateTitle(){
159 155
		String title = CdmUtils.Nz(getEntity().toString());
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/TimePeriodElement.java
21 21
 * @author n.hoffmann
22 22
 * @created Nov 17, 2009
23 23
 */
24
public class TimePeriodElement<T extends TimePeriod>
24
public class TimePeriodElement
25 25
			extends TimePeriodElementBase<TimePeriod> {
26 26

  
27 27
    
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/VerbatimDateDetailSection.java
12 12

  
13 13
import eu.etaxonomy.cdm.model.common.TimePeriod;
14 14
import eu.etaxonomy.cdm.model.common.VerbatimTimePeriod;
15
import eu.etaxonomy.cdm.strategy.parser.TimePeriodParser;
15 16

  
16 17
/**
17 18
 * @author k.luther
......
55 56
	protected VerbatimTimePeriod newInstance(){
56 57
		return VerbatimTimePeriod.NewVerbatimInstance();
57 58
	}
59
    
60
	protected VerbatimTimePeriod parseNewInstance() {
61
		VerbatimTimePeriod result = TimePeriodParser.parseStringVerbatim(getText_parseText().getText());
62
		return result;
63
	}
58 64

  
59

  
60
    /**
61
     * <p>
62
     * Setter for the field <code>timePeriod</code>.
63
     * </p>
64
     *
65
     * @param timePeriod
66
     *            a {@link eu.etaxonomy.cdm.model.common.TimePeriod} object.
67
     */
68

  
69
    public void setEntity(VerbatimTimePeriod timePeriod) {
70
        setEntityInternally(timePeriod);
71
        updateTitle();
72
        getText_parseText().setText(timePeriod.toString());
73

  
74
    }
65
//
66
//    /**
67
//     * <p>
68
//     * Setter for the field <code>timePeriod</code>.
69
//     * </p>
70
//     *
71
//     * @param timePeriod
72
//     *            a {@link eu.etaxonomy.cdm.model.common.TimePeriod} object.
73
//     */
74
//
75
//    public void setEntity(VerbatimTimePeriod timePeriod) {
76
//        setEntityInternally(timePeriod);
77
//        updateTitle();
78
//        getText_parseText().setText(timePeriod.toString());
79
//
80
//    }
75 81
    
76 82
    @Override
77 83
    protected void handleEvent(Object eventSource) {
......
81 87
            if(entity instanceof VerbatimTimePeriod){
82 88
                ((VerbatimTimePeriod)entity).setVerbatimDate(text_VerbatimDate.getText());
83 89
            }else{
84
                VerbatimTimePeriod newEntity = VerbatimTimePeriod.NewVerbatimInstance();
90
                VerbatimTimePeriod newEntity = newInstance();
85 91
                newEntity.setEnd(entity.getEnd());
86 92
                newEntity.setStart(entity.getStart());
87 93
                newEntity.setFreeText(entity.getFreeText());
......
102 108
        super.setEntityInternally(timePeriod);
103 109
        ((Text) text_VerbatimDate.getMainControl()).setSelection(super.getCursorPosition());
104 110
        text_VerbatimDate.setText(timePeriod.getVerbatimDate());
105
        super.setEntity(timePeriod);
111
//        super.setEntity(timePeriod);
106 112
    }
107 113

  
108 114
}

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)