Project

General

Profile

« Previous | Next » 

Revision 2b6aa4fb

Added by Patrick Plitzner over 8 years ago

Initial implementation of SpecimenView

View differences:

eu.etaxonomy.taxeditor.store/plugin.xml
277 277
        id="eu.etaxonomy.taxeditor.view.sessions.SessionsViewPart"
278 278
        name="Sessions"
279 279
        restorable="false">
280
  </view>
281
  <view
282
        class="eu.etaxonomy.taxeditor.view.specimenView.SpecimenView"
283
        id="eu.etaxonomy.taxeditor.view.specimenView.SpecimenView"
284
        name="Specimen View"
285
        restorable="true">
280 286
  </view>
281 287
   </extension>
282 288
   <extension
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/specimenView/SpecimenView.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.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
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/specimenView/SpecimenViewContentProvider.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.view.specimenView;
11

  
12
import org.eclipse.jface.viewers.IStructuredContentProvider;
13
import org.eclipse.jface.viewers.Viewer;
14

  
15
/**
16
 * @author pplitzner
17
 * @date Sep 7, 2015
18
 *
19
 */
20
public class SpecimenViewContentProvider implements IStructuredContentProvider{
21

  
22
    @Override
23
    public void dispose() {
24
        // TODO Auto-generated method stub
25

  
26
    }
27

  
28
    @Override
29
    public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
30
        // TODO Auto-generated method stub
31

  
32
    }
33

  
34
    @Override
35
    public Object[] getElements(Object inputElement) {
36
//        CdmStore.getService(ITaxonService.class).get
37
        return new String[]{"bla","ble"};
38
    }
39

  
40
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/specimenView/SpecimenViewLabelProvider.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.view.specimenView;
11

  
12
import org.eclipse.jface.viewers.ITableLabelProvider;
13
import org.eclipse.jface.viewers.LabelProvider;
14
import org.eclipse.swt.graphics.Image;
15

  
16
/**
17
 * @author pplitzner
18
 * @date Sep 7, 2015
19
 *
20
 */
21
public class SpecimenViewLabelProvider extends LabelProvider implements ITableLabelProvider{
22

  
23
    @Override
24
    public Image getColumnImage(Object element, int columnIndex) {
25
        return null;
26
    }
27

  
28
    @Override
29
    public String getColumnText(Object element, int columnIndex) {
30
        return columnIndex==0?"<^^>":"<vv>";
31
    }
32

  
33

  
34
}

Also available in: Unified diff