File: QualityWindow.java

package info (click to toggle)
proalign 0.603-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 492 kB
  • sloc: java: 8,673; sh: 27; makefile: 4
file content (96 lines) | stat: -rw-r--r-- 2,181 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/**
 * Title:        ProAlign<p>
 * Description:  <p>
 * Copyright:    Copyright (c) Ari Loytynoja<p>
 * License:      GNU GENERAL PUBLIC LICENSE<p>
 * @see          http://www.gnu.org/copyleft/gpl.html
 * Company:      ULB<p>
 * @author Ari Loytynoja
 * @version 1.0
 */
package proalign;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JViewport;
import javax.swing.JScrollPane;
import javax.swing.JScrollBar;
import javax.swing.BorderFactory;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Container;
import java.awt.Point;
import java.awt.event.WindowEvent;
import java.awt.event.WindowAdapter;

public class QualityWindow extends JFrame {

    JScrollPane sPane;
    int height;
    double[] postProb;

    PixelRule pixRule;
    PrintCurve curve;
    ResultWindow rw;
    String name;

    QualityWindow(AlignmentNode root, String name, ResultWindow rw) {

	this.rw = rw;
	this.name = name;

	postProb = new double[root.cellPath.length];
	for(int i=0; i<root.cellPath.length; i++) {
	    postProb[i] = root.getOnePostProbAt(i, name);
	}
	height = this.getHeight();

	curve = new PrintCurve(QualityWindow.this, postProb);

	// pixelruler.
	pixRule = new PixelRule();
	pixRule.setPreferredWidth((int) curve.getPreferredSize().getWidth());
	pixRule.setIncrement(curve.xScale);
	pixRule.setBackground(Color.white);


	sPane = new JScrollPane(curve,
				 JScrollPane.VERTICAL_SCROLLBAR_NEVER,
				 JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);


	sPane.setViewportBorder(BorderFactory.createLineBorder(Color.black));
	sPane.setColumnHeaderView(pixRule);
	sPane.setBackground(Color.white);

	Container cp = getContentPane();
	cp.add(sPane);

	addWindowListener(new WindowAdapter() {
		public void windowClosing(WindowEvent e){
		    PrintTree.numOpenWindows--;
		    dispose();
		}
	    });
    }

    int getVisibleHeight() {
	return sPane.getViewport().getHeight();
    }

    void upDateData(AlignmentNode root, String name){
	postProb = new double[root.cellPath.length];
	for(int i=0; i<root.cellPath.length; i++) {
	    postProb[i] = root.getOnePostProbAt(i, name);
	}
	curve.upDateData(postProb);
    }
}