Revision 548ba7b9
Added by Patrick Plitzner almost 10 years ago
- adapted info text for import wizard
- added toggle button for date field
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