Skip to content
Snippets Groups Projects
Commit 10021fdb authored by tjc's avatar tjc
Browse files

changes to extend with AbstractGraphPanel

git-svn-id: svn+ssh://svn.internal.sanger.ac.uk/repos/svn/pathsoft/artemis/trunk@14824 ee4ac58c-ac51-4696-9907-e4b3aa274f04
parent e8886f38
No related branches found
No related tags found
No related merge requests found
......@@ -31,8 +31,6 @@ import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.geom.GeneralPath;
import java.util.Enumeration;
import java.util.Hashtable;
......@@ -40,21 +38,15 @@ import java.util.List;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import net.sf.samtools.AlignmentBlock;
import net.sf.samtools.SAMRecord;
public class CoveragePanel extends JPanel
public class CoveragePanel extends AbstractGraphPanel
{
private static final long serialVersionUID = 1L;
private int start;
private int end;
private float pixPerBase;
private BamView jamView;
private JPopupMenu popup;
private static LineAttributes lines[];
private boolean includeCombined = false;
......@@ -63,8 +55,8 @@ import net.sf.samtools.SAMRecord;
super();
setBackground(Color.white);
this.jamView = jamView;
initPopupMenu(this);
popup = new JPopupMenu();
JMenuItem configure = new JMenuItem("Configure...");
configure.addActionListener(new ActionListener()
{
......@@ -93,8 +85,6 @@ import net.sf.samtools.SAMRecord;
});
popup.add(showCombined);
}
addMouseListener(new PopupListener());
}
/**
......@@ -109,7 +99,15 @@ import net.sf.samtools.SAMRecord;
if(readsInView == null)
return;
int windowSize = (jamView.getBasesInView()/200);
int windowSize;
if(autoWinSize)
{
windowSize = (jamView.getBasesInView()/200);
userWinSize = windowSize;
}
else
windowSize = userWinSize;
if(windowSize < 1)
windowSize = 1;
......@@ -251,17 +249,6 @@ import net.sf.samtools.SAMRecord;
return(AlphaComposite.getInstance(type, alpha));
}
protected void setStartAndEnd(int start, int end)
{
this.start = start;
this.end = end;
}
protected void setPixPerBase(float pixPerBase)
{
this.pixPerBase = pixPerBase;
}
protected static LineAttributes[] getLineAttributes(int nsize)
{
......@@ -276,37 +263,4 @@ import net.sf.samtools.SAMRecord;
}
return lines;
}
/**
* Popup menu listener
*/
class PopupListener extends MouseAdapter
{
JMenuItem gotoMateMenuItem;
JMenuItem showDetails;
public void mouseClicked(MouseEvent e)
{
}
public void mousePressed(MouseEvent e)
{
maybeShowPopup(e);
}
public void mouseReleased(MouseEvent e)
{
maybeShowPopup(e);
}
private void maybeShowPopup(MouseEvent e)
{
if(e.isPopupTrigger())
{
popup.show(e.getComponent(),
e.getX(), e.getY());
}
}
}
}
\ No newline at end of file
......@@ -29,17 +29,14 @@ import java.awt.Color;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.geom.GeneralPath;
import java.util.List;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JTextField;
import uk.ac.sanger.artemis.io.Range;
......@@ -49,15 +46,11 @@ import uk.ac.sanger.artemis.util.OutOfRangeException;
import net.sf.samtools.AlignmentBlock;
import net.sf.samtools.SAMRecord;
public class SnpPanel extends JPanel
public class SnpPanel extends AbstractGraphPanel
{
private static final long serialVersionUID = 1L;
private int start;
private int end;
private float pixPerBase;
private BamView bamView;
private JPopupMenu popup;
private Bases bases;
private float minBaseQualityFilter = 0;
......@@ -67,8 +60,8 @@ import net.sf.samtools.SAMRecord;
setBackground(Color.white);
this.bamView = bamView;
this.bases = bases;
initPopupMenu(this);
popup = new JPopupMenu();
JMenuItem configure = new JMenuItem("Filter by Base Quality...");
configure.addActionListener(new ActionListener()
{
......@@ -94,7 +87,6 @@ import net.sf.samtools.SAMRecord;
}
});
popup.add(configure);
addMouseListener(new PopupListener());
}
/**
......@@ -112,7 +104,16 @@ import net.sf.samtools.SAMRecord;
if(readsInView == null)
return;
int windowSize = (bamView.getBasesInView()/300);
int windowSize;
if(autoWinSize)
{
windowSize = (bamView.getBasesInView()/300);
userWinSize = windowSize;
}
else
windowSize = userWinSize;
if(windowSize < 1)
windowSize = 1;
......@@ -243,46 +244,4 @@ import net.sf.samtools.SAMRecord;
return max;
}
protected void setStartAndEnd(int start, int end)
{
this.start = start;
this.end = end;
}
protected void setPixPerBase(float pixPerBase)
{
this.pixPerBase = pixPerBase;
}
/**
* Popup menu listener
*/
class PopupListener extends MouseAdapter
{
JMenuItem gotoMateMenuItem;
JMenuItem showDetails;
public void mouseClicked(MouseEvent e)
{
}
public void mousePressed(MouseEvent e)
{
maybeShowPopup(e);
}
public void mouseReleased(MouseEvent e)
{
maybeShowPopup(e);
}
private void maybeShowPopup(MouseEvent e)
{
if(e.isPopupTrigger())
{
popup.show(e.getComponent(),
e.getX(), e.getY());
}
}
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment