Project

General

Profile

« Previous | Next » 

Revision 548ba7b9

Added by Patrick Plitzner almost 10 years ago

  • adapted info text for import wizard
    • added toggle button for date field

View differences:

eu.etaxonomy.taxeditor.editor/plugin.xml
1278 1278
            id="eu.etaxonomy.taxeditor.editor.view.dataimport.SpecimenSearchWizard"
1279 1279
            name="Specimen Search/Import">
1280 1280
         <description>
1281
            Queries data provider (currently only GBIF) for specimens with specified parameters.
1281
            Queries data provider for specimens with specified parameters.
1282
Note: Query results are currently limited to 100.
1282 1283
         </description>
1283 1284
      </wizard>
1284 1285
   </extension>
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/specimenSearch/SpecimenSearchComposite.java
10 10
package eu.etaxonomy.taxeditor.view.specimenSearch;
11 11

  
12 12
import org.eclipse.swt.SWT;
13
import org.eclipse.swt.widgets.Button;
13 14
import org.eclipse.swt.widgets.Composite;
14 15
import org.eclipse.swt.widgets.DateTime;
15 16
import org.eclipse.swt.widgets.Display;
......
35 36
    private final Text textCountry;
36 37
    private final DateTime dateFrom;
37 38
    private final DateTime dateTo;
39
    private final Button btnShowDate;
38 40

  
39 41
    /**
40 42
     * Create the composite.
......
98 100

  
99 101
        Label lblCollectionDate = new Label(this, SWT.NONE);
100 102
        lblCollectionDate.setText("Collection Date");
101
        new Label(this, SWT.NONE);
103

  
104
        btnShowDate = new Button(this, SWT.CHECK);
102 105

  
103 106
        Label lblFrom = new Label(this, SWT.NONE);
104 107
        lblFrom.setLayoutData(new TableWrapData(TableWrapData.RIGHT, TableWrapData.TOP, 1, 1));
......
106 109

  
107 110
        dateFrom = new DateTime(this, SWT.NONE);
108 111
        dateFrom.setLayoutData(new TableWrapData(TableWrapData.FILL, TableWrapData.TOP, 1, 1));
109
        formToolkit.adapt(dateFrom);
110 112
        formToolkit.paintBordersFor(dateFrom);
111 113

  
112 114
        Label lblTo = new Label(this, SWT.NONE);
113 115
        lblTo.setLayoutData(new TableWrapData(TableWrapData.RIGHT, TableWrapData.TOP, 1, 1));
114 116
        lblTo.setText("to");
115 117

  
116
        dateTo = new DateTime(this, SWT.DROP_DOWN);
118
        dateTo = new DateTime(this, SWT.NONE);
117 119
        dateTo.setLayoutData(new TableWrapData(TableWrapData.FILL, TableWrapData.TOP, 1, 1));
118
        formToolkit.adapt(dateTo);
119 120
        formToolkit.paintBordersFor(dateTo);
120 121

  
121 122
    }
......
152 153
    public DateTime getDateTo() {
153 154
        return dateTo;
154 155
    }
156
    public Button getBtnShowDate() {
157
        return btnShowDate;
158
    }
155 159
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/specimenSearch/SpecimenSearchController.java
13 13
import java.util.GregorianCalendar;
14 14

  
15 15
import org.eclipse.swt.SWT;
16
import org.eclipse.swt.widgets.Button;
16 17
import org.eclipse.swt.widgets.Composite;
18
import org.eclipse.swt.widgets.Event;
19
import org.eclipse.swt.widgets.Listener;
17 20

  
18 21
/**
19 22
 * Controller class for handling a {@link SpecimenSearchComposite}.
......
21 24
 * @date 03.09.2013
22 25
 *
23 26
 */
24
public class SpecimenSearchController {
27
public class SpecimenSearchController implements Listener{
25 28

  
26 29
    private final SpecimenSearchComposite specimenSearchComposite;
27 30

  
......
31 34
     */
32 35
    public SpecimenSearchController(Composite parent) {
33 36
        this.specimenSearchComposite = new SpecimenSearchComposite(parent, SWT.NONE);
37
        specimenSearchComposite.getBtnShowDate().addListener(SWT.Selection, this);
38
        specimenSearchComposite.getBtnShowDate().setSelection(false);
39
        specimenSearchComposite.getDateFrom().setEnabled(false);
40
        specimenSearchComposite.getDateTo().setEnabled(false);
41
    }
42

  
43
    /* (non-Javadoc)
44
     * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
45
     */
46
    @Override
47
    public void handleEvent(Event event) {
48
        Button btnShowDate = specimenSearchComposite.getBtnShowDate();
49
        if(event.widget==btnShowDate){
50
            specimenSearchComposite.getDateFrom().setEnabled(btnShowDate.getSelection());
51
            specimenSearchComposite.getDateTo().setEnabled(btnShowDate.getSelection());
52
        }
34 53
    }
35 54

  
36 55
    /**
......
112 131
     * @see eu.etaxonomy.taxeditor.view.specimenSearch.SpecimenSearchComposite#getDateFrom()
113 132
     */
114 133
    public Calendar getDateFrom() {
115
        Calendar dateFrom = new GregorianCalendar();
116
        dateFrom.clear();
117
        dateFrom.set(specimenSearchComposite.getDateFrom().getYear(), specimenSearchComposite.getDateFrom().getMonth(), specimenSearchComposite.getDateFrom().getDay());
118
        return dateFrom;
134
        if(specimenSearchComposite.getBtnShowDate().getSelection()){
135
            Calendar dateFrom = new GregorianCalendar();
136
            dateFrom.clear();
137
            dateFrom.set(specimenSearchComposite.getDateFrom().getYear(), specimenSearchComposite.getDateFrom().getMonth(), specimenSearchComposite.getDateFrom().getDay());
138
            return dateFrom;
139
        }
140
        return null;
119 141
    }
120 142

  
121 143
    /**
......
124 146
     * @see eu.etaxonomy.taxeditor.view.specimenSearch.SpecimenSearchComposite#getDateTo()
125 147
     */
126 148
    public Calendar getDateTo() {
127
        Calendar dateTo = new GregorianCalendar();
128
        dateTo.clear();
129
        dateTo.set(specimenSearchComposite.getDateTo().getYear(), specimenSearchComposite.getDateTo().getMonth(), specimenSearchComposite.getDateTo().getDay());
130
        return dateTo;
149
        if(specimenSearchComposite.getBtnShowDate().getSelection()){
150
            Calendar dateTo = new GregorianCalendar();
151
            dateTo.clear();
152
            dateTo.set(specimenSearchComposite.getDateTo().getYear(), specimenSearchComposite.getDateTo().getMonth(), specimenSearchComposite.getDateTo().getDay());
153
            return dateTo;
154
        }
155
        return null;
131 156
    }
132 157

  
133 158
}

Also available in: Unified diff