ref #6902 migrate alignment editor and pherogram view
[taxeditor.git] / eu.etaxonomy.taxeditor.molecular / src / main / java / eu / etaxonomy / taxeditor / molecular / editor / e4 / PherogramPartE4.java
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/PherogramPartE4.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/PherogramPartE4.java
new file mode 100644 (file)
index 0000000..eb7a88e
--- /dev/null
@@ -0,0 +1,61 @@
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.molecular.editor.e4;
+
+
+import javax.annotation.PostConstruct;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+
+import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor;
+import info.bioinfweb.libralign.pherogram.PherogramFormats.QualityOutputType;
+import info.bioinfweb.libralign.pherogram.model.PherogramComponentModel;
+import info.bioinfweb.libralign.pherogram.view.PherogramView;
+import info.bioinfweb.tic.SWTComponentFactory;
+
+
+
+/**
+ * Component that allows to view a pherogram without the distortion due to aligning it to a sequence as in
+ * {@link AlignmentEditor}.
+ *
+ * @author Ben Stöver
+ * @date Nov 20, 2014
+ */
+public class PherogramPartE4 {
+    public static final String ID = "eu.etaxonomy.taxeditor.molecular.PherogramView"; //$NON-NLS-1$
+
+    private PherogramView pherogramView = null;
+
+    public PherogramView getPherogramView() {
+               if (pherogramView == null) {
+                       pherogramView = new PherogramView();
+                       pherogramView.getTraceCurveView().getFormats().setShowProbabilityValues(true);
+                       pherogramView.getTraceCurveView().setHorizontalScale(1);
+                       pherogramView.getTraceCurveView().setVerticalScale(100);
+                       pherogramView.getTraceCurveView().getFormats().setQualityOutputType(QualityOutputType.NONE);  //TODO Make this user defined
+                       pherogramView.getTraceCurveView().getFormats().setShowProbabilityValues(false);
+               }
+               return pherogramView;
+       }
+
+
+       @PostConstruct
+       public void createPartControl(Composite parent) {
+               SWTComponentFactory.getInstance().getSWTComponent(getPherogramView(), parent, SWT.NONE);
+               getPherogramView().assignSize();
+       }
+
+       public void init(PherogramComponentModel model){
+           getPherogramView().getTraceCurveView().setModel(model);
+           getPherogramView().assignSize();
+       }
+
+}