752ef9e1d379734f563d19c9e989ba35da0a9c91
[taxeditor.git] / eu.etaxonomy.taxeditor.editor / src / main / java / eu / etaxonomy / taxeditor / editor / molecular / PherogramViewPart.java
1 /**
2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
5 *
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
8 */
9 package eu.etaxonomy.taxeditor.editor.molecular;
10
11
12 import info.bioinfweb.libralign.pherogram.PherogramFormats.QualityOutputType;
13 import info.bioinfweb.libralign.pherogram.model.PherogramComponentModel;
14 import info.bioinfweb.libralign.pherogram.view.PherogramView;
15
16 import org.eclipse.swt.SWT;
17 import org.eclipse.swt.widgets.Composite;
18 import org.eclipse.ui.PartInitException;
19 import org.eclipse.ui.PlatformUI;
20 import org.eclipse.ui.part.ViewPart;
21
22
23
24 /**
25 * Component that allows to view a pherogram without the distortion due to aligning it to a sequence as in
26 * {@link AlignmentEditor}.
27 *
28 * @author Ben Stöver
29 * @date Nov 20, 2014
30 */
31 public class PherogramViewPart extends ViewPart {
32 public static final String ID = "eu.etaxonomy.taxeditor.editor.molecular.PherogramView";
33
34 private PherogramView pherogramView = null;
35
36
37 public static PherogramViewPart createView(PherogramComponentModel model) throws PartInitException {
38 PherogramViewPart view = (PherogramViewPart)PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(ID);
39 view.getPherogramView().getTraceCurveView().setModel(model);
40 view.getPherogramView().assignSize();
41 return view;
42 }
43
44
45 public PherogramView getPherogramView() {
46 if (pherogramView == null) {
47 pherogramView = new PherogramView();
48 pherogramView.getTraceCurveView().getFormats().setShowProbabilityValues(true);
49 pherogramView.getTraceCurveView().setHorizontalScale(1);
50 pherogramView.getTraceCurveView().setVerticalScale(100);
51 pherogramView.getTraceCurveView().getFormats().setQualityOutputType(QualityOutputType.NONE); //TODO Make this user defined
52 pherogramView.getTraceCurveView().getFormats().setShowProbabilityValues(false);
53 }
54 return pherogramView;
55 }
56
57
58 @Override
59 public void createPartControl(Composite parent) {
60 getPherogramView().createSWTWidget(parent, SWT.NONE);
61 getPherogramView().assignSize();
62 }
63
64
65 @Override
66 public void setFocus() {} // nothing to do
67 }