package jalview.appletgui;
import jalview.renderer.OverviewRenderer;
+import jalview.renderer.seqfeatures.FeatureColourFinder;
import jalview.viewmodel.OverviewDimensions;
import java.awt.Color;
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.Image;
-import java.awt.Panel;
-public class OverviewCanvas extends Panel
+import javax.swing.JComponent;
+
+public class OverviewCanvas extends JComponent
{
// This is set true if the alignment view changes whilst
// the overview is being calculated
}
}
- /**
- * Draw the overview sequences
- *
- * @param showSequenceFeatures
- * true if sequence features are to be shown
- * @param showAnnotation
- * true if the annotation is to be shown
- * @param transferRenderer
- * the renderer to transfer feature colouring from
- */
public void draw(boolean showSequenceFeatures, boolean showAnnotation,
FeatureRenderer transferRenderer)
{
{
fr.transferSettings(transferRenderer);
}
+ FeatureColourFinder finder = new FeatureColourFinder(fr);
setPreferredSize(new Dimension(od.getWidth(), od.getHeight()));
- OverviewRenderer or = new OverviewRenderer(sr, fr, od);
+ OverviewRenderer or = new OverviewRenderer(sr, finder, od);
miniMe = nullFrame.createImage(od.getWidth(), od.getHeight());
offscreen = nullFrame.createImage(od.getWidth(), od.getHeight());
Graphics mg = miniMe.getGraphics();
- // checks for conservation annotation to make sure overview works for DNA
- // too
+ // check for conservation annotation to make sure overview works for DNA too
if (showAnnotation)
{
mg.translate(0, od.getSequencesHeight());
import java.awt.BorderLayout;
import java.awt.Dimension;
-import java.awt.MenuItem;
import java.awt.Panel;
-import java.awt.PopupMenu;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
-import java.awt.event.InputEvent;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
+import javax.swing.JMenuItem;
+import javax.swing.JPopupMenu;
+import javax.swing.SwingUtilities;
+
public class OverviewPanel extends Panel implements Runnable,
MouseMotionListener, MouseListener
{
@Override
public void mouseClicked(MouseEvent evt)
{
- // right button press
- if ((evt.getModifiers() & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK)
+ if (SwingUtilities.isRightMouseButton(evt))
{
showPopupMenu(evt);
}
private void mouseAction(MouseEvent evt)
{
- // right button press
- if ((evt.getModifiers() & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK)
+ if (SwingUtilities.isRightMouseButton(evt))
{
if (!Platform.isAMac())
{
*/
private void showPopupMenu(MouseEvent e)
{
- PopupMenu popup = new PopupMenu();
+ JPopupMenu popup = new JPopupMenu();
ActionListener menuListener = new ActionListener()
{
@Override
toggleHiddenColumns();
}
};
- MenuItem item = new MenuItem(
+ JMenuItem item = new JMenuItem(
MessageManager.getString("label.togglehidden"));
popup.add(item);
item.addActionListener(menuListener);
import jalview.api.AlignViewportI;
import jalview.renderer.OverviewRenderer;
+import jalview.renderer.seqfeatures.FeatureColourFinder;
import jalview.viewmodel.OverviewDimensions;
import java.awt.Color;
{
fr.transferSettings(transferRenderer);
}
+ FeatureColourFinder finder = new FeatureColourFinder(fr);
+ // why do we need to set preferred size again? was set in
+ // updateOverviewImage
setPreferredSize(new Dimension(od.getWidth(), od.getHeight()));
- OverviewRenderer or = new OverviewRenderer(sr, fr, od);
+ OverviewRenderer or = new OverviewRenderer(sr, finder, od);
miniMe = or.draw(od.getRows(av.getAlignment()),
od.getColumns(av.getAlignment().getHiddenColumns()));
import jalview.datamodel.Annotation;
import jalview.datamodel.SequenceI;
import jalview.renderer.seqfeatures.FeatureColourFinder;
-import jalview.renderer.seqfeatures.FeatureRenderer;
import jalview.viewmodel.OverviewDimensions;
import java.awt.Color;
private float pixelsPerSeq;
public OverviewRenderer(jalview.api.SequenceRenderer seqRenderer,
- FeatureRenderer ftRenderer, OverviewDimensions od)
+ FeatureColourFinder colfinder, OverviewDimensions od)
{
sr = seqRenderer;
- finder = new FeatureColourFinder(ftRenderer);
+ finder = colfinder;
pixelsPerCol = od.getPixelsPerCol();
pixelsPerSeq = od.getPixelsPerSeq();