9d79e27e92a61e581d171e7fc4fd93b8fc5cab94
[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 import info.bioinfweb.tic.SWTComponentFactory;
16
17 import org.eclipse.swt.SWT;
18 import org.eclipse.swt.widgets.Composite;
19 import org.eclipse.ui.PartInitException;
20 import org.eclipse.ui.PlatformUI;
21 import org.eclipse.ui.part.ViewPart;
22
23
24
25 /**
26 * Component that allows to view a pherogram without the distortion due to aligning it to a sequence as in
27 * {@link AlignmentEditor}.
28 *
29 * @author Ben Stöver
30 * @date Nov 20, 2014
31 */
32 public class PherogramViewPart extends ViewPart {
33 public static final String ID = "eu.etaxonomy.taxeditor.editor.molecular.PherogramView";
34
35 private PherogramView pherogramView = null;
36
37
38 public static PherogramViewPart createView(PherogramComponentModel model) throws PartInitException {
39 PherogramViewPart view = (PherogramViewPart)PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(ID);
40 view.getPherogramView().getTraceCurveView().setModel(model);
41 view.getPherogramView().assignSize();
42 return view;
43 }
44
45
46 public PherogramView getPherogramView() {
47 if (pherogramView == null) {
48 pherogramView = new PherogramView();
49 pherogramView.getTraceCurveView().getFormats().setShowProbabilityValues(true);
50 pherogramView.getTraceCurveView().setHorizontalScale(1);
51 pherogramView.getTraceCurveView().setVerticalScale(100);
52 pherogramView.getTraceCurveView().getFormats().setQualityOutputType(QualityOutputType.NONE); //TODO Make this user defined
53 pherogramView.getTraceCurveView().getFormats().setShowProbabilityValues(false);
54 }
55 return pherogramView;
56 }
57
58
59 @Override
60 public void createPartControl(Composite parent) {
61 SWTComponentFactory.getInstance().getSWTComponent(getPherogramView(), parent, SWT.NONE);
62 getPherogramView().assignSize();
63 }
64
65
66 @Override
67 public void setFocus() {} // nothing to do
68 }