Project

General

Profile

Download (2.43 KB) Statistics
| Branch: | Tag: | Revision:
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
}
    (1-1/1)