Revision e11fa59e
Added by Patrick Plitzner over 8 years ago
- ID e11fa59e9113a4f66da9fd7dcf35b8179a0c65b0
- Parent d06b07d3
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/specimenView/FieldUnitDTOSection.java | ||
---|---|---|
1 |
// $Id$ |
|
2 |
/** |
|
3 |
* Copyright (C) 2015 EDIT |
|
4 |
* European Distributed Institute of Taxonomy |
|
5 |
* http://www.e-taxonomy.eu |
|
6 |
* |
|
7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
9 |
*/ |
|
10 |
package eu.etaxonomy.taxeditor.ui.section.occurrence.specimenView; |
|
11 |
|
|
12 |
import org.eclipse.jface.resource.JFaceResources; |
|
13 |
import org.eclipse.swt.SWT; |
|
14 |
import org.eclipse.swt.widgets.Composite; |
|
15 |
import org.eclipse.swt.widgets.Label; |
|
16 |
import org.eclipse.ui.forms.widgets.Section; |
|
17 |
|
|
18 |
import eu.etaxonomy.cdm.api.service.dto.FieldUnitDTO; |
|
19 |
import eu.etaxonomy.cdm.api.service.dto.PreservedSpecimenDTO; |
|
20 |
import eu.etaxonomy.taxeditor.ui.element.LayoutConstants; |
|
21 |
|
|
22 |
/** |
|
23 |
* @author pplitzner |
|
24 |
* @date Oct 2, 2015 |
|
25 |
* |
|
26 |
*/ |
|
27 |
public class FieldUnitDTOSection extends Section{ |
|
28 |
|
|
29 |
public FieldUnitDTOSection(FieldUnitDTO dto, Composite parent, int style) { |
|
30 |
super(parent, style); |
|
31 |
setBackground(parent.getBackground()); |
|
32 |
setText("Details"); |
|
33 |
init(dto, parent); |
|
34 |
setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); |
|
35 |
} |
|
36 |
|
|
37 |
private void init(FieldUnitDTO dto, Composite parent) { |
|
38 |
Composite client = new Composite(this, SWT.NONE); |
|
39 |
client.setLayout(LayoutConstants.LAYOUT(2, false)); |
|
40 |
client.setBackground(parent.getBackground()); |
|
41 |
|
|
42 |
//citation |
|
43 |
addLabel("Citation", true, parent, client); |
|
44 |
addLabel(dto.getCitation(), false, parent, client); |
|
45 |
|
|
46 |
//determination |
|
47 |
addLabel("Determination", true, parent, client); |
|
48 |
addLabel(dto.getTaxonName(), false, parent, client); |
|
49 |
|
|
50 |
addLabel("Specimens", true, parent, client); |
|
51 |
addLabel("", false, parent, client); |
|
52 |
|
|
53 |
//list specimens |
|
54 |
for (PreservedSpecimenDTO preservedSpecimenDTO : dto.getPreservedSpecimenDTOs()) { |
|
55 |
addLabel("\t"+preservedSpecimenDTO.getAccessionNumber(), false, parent, client); |
|
56 |
addLabel("", false, parent, client); |
|
57 |
} |
|
58 |
|
|
59 |
setClient(client); |
|
60 |
|
|
61 |
} |
|
62 |
|
|
63 |
private Label addLabel(String labelText, boolean bold, Composite parent, Composite client) { |
|
64 |
Label lblDetermination = new Label(client, SWT.NONE); |
|
65 |
lblDetermination.setText(labelText); |
|
66 |
if(bold){ |
|
67 |
lblDetermination.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); |
|
68 |
} |
|
69 |
lblDetermination.setBackground(parent.getBackground()); |
|
70 |
return lblDetermination; |
|
71 |
} |
|
72 |
|
|
73 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java | ||
---|---|---|
22 | 22 |
|
23 | 23 |
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade; |
24 | 24 |
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeNotSupportedException; |
25 |
import eu.etaxonomy.cdm.api.service.dto.FieldUnitDTO; |
|
25 | 26 |
import eu.etaxonomy.cdm.ext.occurrence.gbif.GbifResponse; |
26 | 27 |
import eu.etaxonomy.cdm.model.agent.Person; |
27 | 28 |
import eu.etaxonomy.cdm.model.agent.Team; |
... | ... | |
102 | 103 |
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SingleReadPherogramCollectionDetailSection; |
103 | 104 |
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.TissueSampleGeneralDetailSection; |
104 | 105 |
import eu.etaxonomy.taxeditor.ui.section.occurrence.media.MediaSpecimenGeneralDetailSection; |
106 |
import eu.etaxonomy.taxeditor.ui.section.occurrence.specimenView.FieldUnitDTOSection; |
|
105 | 107 |
import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailSection; |
106 | 108 |
import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceDetailSection; |
107 | 109 |
import eu.etaxonomy.taxeditor.ui.section.supplemental.RightsSection; |
... | ... | |
314 | 316 |
createTermVocabularySection(rootElement); |
315 | 317 |
} else if (input instanceof DefinedTermBase) { |
316 | 318 |
createDefinedTermSection(rootElement); |
319 |
} else if (input instanceof FieldUnitDTO) { |
|
320 |
createFieldUnitDTOSection((FieldUnitDTO) input); |
|
317 | 321 |
} |
322 |
|
|
318 | 323 |
else { |
319 | 324 |
createEmptySection(rootElement); |
320 | 325 |
} |
321 | 326 |
layout(); |
322 | 327 |
} |
323 | 328 |
|
329 |
private void createFieldUnitDTOSection(FieldUnitDTO dto) { |
|
330 |
destroySections(); |
|
331 |
|
|
332 |
new FieldUnitDTOSection(dto, rootElement.getLayoutComposite(), ExpandableComposite.EXPANDED | ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT); |
|
333 |
|
|
334 |
} |
|
324 | 335 |
|
325 | 336 |
private void createEmptySection(RootElement parent) { |
326 | 337 |
destroySections(); |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/specimenView/SpecimenView.java | ||
---|---|---|
27 | 27 |
|
28 | 28 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
29 | 29 |
import eu.etaxonomy.taxeditor.model.AbstractUtility; |
30 |
import eu.etaxonomy.taxeditor.model.IPartContentHasDetails; |
|
30 | 31 |
|
31 | 32 |
/** |
32 | 33 |
* This class visualizes a list of field units associated to a taxon. |
... | ... | |
35 | 36 |
* @date Sep 7, 2015 |
36 | 37 |
* |
37 | 38 |
*/ |
38 |
public class SpecimenView extends ViewPart implements ISelectionListener{ |
|
39 |
public class SpecimenView extends ViewPart implements ISelectionListener, IPartContentHasDetails{
|
|
39 | 40 |
|
40 | 41 |
static final int COUNTRY_COLUMN = 0; |
41 | 42 |
static final int DATE_COLUMN = COUNTRY_COLUMN+1; |
... | ... | |
57 | 58 |
ISelectionService selectionService = getSite().getWorkbenchWindow().getSelectionService(); |
58 | 59 |
selectionService.addSelectionListener(this); |
59 | 60 |
|
61 |
// Propagate selection from viewer |
|
62 |
getSite().setSelectionProvider(viewer); |
|
63 |
|
|
60 | 64 |
//create table viewer |
61 | 65 |
viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION); |
62 | 66 |
|
Also available in: Unified diff
Enable DetailsView for SpecimenView selection