Project

General

Profile

Download (1.81 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.view.specimenView;
11

    
12
import org.eclipse.jface.viewers.TableViewer;
13
import org.eclipse.jface.viewers.TableViewerColumn;
14
import org.eclipse.swt.SWT;
15
import org.eclipse.swt.widgets.Composite;
16
import org.eclipse.ui.part.ViewPart;
17

    
18
/**
19
 * This class visualizes a list of field units associated to taxon.
20
 *
21
 * @author pplitzner
22
 * @date Sep 7, 2015
23
 *
24
 */
25
public class SpecimenView extends ViewPart{
26

    
27
    public SpecimenView() {
28
    }
29

    
30
    private TableViewer viewer;
31

    
32
    @Override
33
    public void createPartControl(Composite parent) {
34

    
35
        //create table viewer
36
        viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
37

    
38
        //table columns
39
        TableViewerColumn countryColumn = new TableViewerColumn(viewer, SWT.CENTER);
40
        countryColumn.getColumn().setText("Country");
41
        countryColumn.getColumn().setWidth(100);
42
        TableViewerColumn herbariumColumn = new TableViewerColumn(viewer, SWT.CENTER);
43
        herbariumColumn.getColumn().setText("Herbarium");
44
        herbariumColumn.getColumn().setWidth(100);
45

    
46
        //lable and content provider
47
        viewer.setLabelProvider(new SpecimenViewLabelProvider());
48
        viewer.setContentProvider(new SpecimenViewContentProvider());
49

    
50
        //provide selections
51
        getSite().setSelectionProvider(viewer);
52

    
53
        //enable header
54
        viewer.getTable().setHeaderVisible(true);
55

    
56
        //set the input
57
        viewer.setInput("");
58

    
59
    }
60

    
61
    @Override
62
    public void setFocus() {
63
        viewer.getControl().setFocus();
64
    }
65

    
66
}
(1-1/3)