git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'develop' into update_212_Dec_merge_with_21125_chamges
[jalview.git]
/
src
/
jalview
/
gui
/
AnnotationPanel.java
diff --git
a/src/jalview/gui/AnnotationPanel.java
b/src/jalview/gui/AnnotationPanel.java
index
e9ef19c
..
93af6ec
100755
(executable)
--- a/
src/jalview/gui/AnnotationPanel.java
+++ b/
src/jalview/gui/AnnotationPanel.java
@@
-150,6
+150,7
@@
public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
*/
public AnnotationPanel(AlignmentPanel ap)
{
*/
public AnnotationPanel(AlignmentPanel ap)
{
+ setName("AnnotationPanel");
ToolTipManager.sharedInstance().registerComponent(this);
ToolTipManager.sharedInstance().setInitialDelay(0);
ToolTipManager.sharedInstance().setDismissDelay(10000);
ToolTipManager.sharedInstance().registerComponent(this);
ToolTipManager.sharedInstance().setInitialDelay(0);
ToolTipManager.sharedInstance().setDismissDelay(10000);
@@
-726,13
+727,13
@@
public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
}
if (dragMode == DragMode.Undefined)
}
if (dragMode == DragMode.Undefined)
- {
+ {
/*
* drag is diagonal - defer deciding whether to
* treat as up/down or left/right
*/
/*
* drag is diagonal - defer deciding whether to
* treat as up/down or left/right
*/
- return;
- }
+ return;
+ }
try
{
try
{
@@
-749,6
+750,7
@@
public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
int newHeight = Math.max(0, graphAnnotation.graphHeight + deltaY);
graphAnnotation.graphHeight = newHeight;
adjustPanelHeight();
int newHeight = Math.max(0, graphAnnotation.graphHeight + deltaY);
graphAnnotation.graphHeight = newHeight;
adjustPanelHeight();
+ setNoFastPaint();
ap.paintAlignment(false, false);
}
}
ap.paintAlignment(false, false);
}
}
@@
-890,6
+892,10
@@
public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
&& ann.annotations[column] != null)
{
tooltip = ann.annotations[column].description;
&& ann.annotations[column] != null)
{
tooltip = ann.annotations[column].description;
+ if ("".equals(tooltip))
+ {
+ tooltip = null;
+ }
}
return tooltip;
}
return tooltip;
@@
-1001,7
+1007,6
@@
public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
}
private volatile boolean imageFresh = false;
}
private volatile boolean imageFresh = false;
-
private Rectangle visibleRect = new Rectangle(),
clipBounds = new Rectangle();
private Rectangle visibleRect = new Rectangle(),
clipBounds = new Rectangle();
@@
-1014,7
+1019,6
@@
public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
@Override
public void paintComponent(Graphics g)
{
@Override
public void paintComponent(Graphics g)
{
-
// BH: note that this method is generally recommended to
// call super.paintComponent(g). Otherwise, the children of this
// component will not be rendered. That is not needed here
// BH: note that this method is generally recommended to
// call super.paintComponent(g). Otherwise, the children of this
// component will not be rendered. That is not needed here
@@
-1022,11
+1026,12
@@
public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
// just a JPanel contained in a JViewPort.
computeVisibleRect(visibleRect);
// just a JPanel contained in a JViewPort.
computeVisibleRect(visibleRect);
-
g.setColor(Color.white);
g.fillRect(0, 0, visibleRect.width, visibleRect.height);
g.setColor(Color.white);
g.fillRect(0, 0, visibleRect.width, visibleRect.height);
- if (image != null)
+ ViewportRanges ranges = av.getRanges();
+
+ if (allowFastPaint && image != null)
{
// BH 2018 optimizing generation of new Rectangle().
if (fastPaint
{
// BH 2018 optimizing generation of new Rectangle().
if (fastPaint
@@
-1035,15
+1040,17
@@
public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
|| (visibleRect.height != clipBounds.height))
{
|| (visibleRect.height != clipBounds.height))
{
- g.drawImage(image, 0, 0, this);
+
+ g.drawImage(image, 0, 0, this);
fastPaint = false;
return;
}
}
fastPaint = false;
return;
}
}
- imgWidth = (av.getRanges().getEndRes() - av.getRanges().getStartRes()
- + 1) * av.getCharWidth();
+ imgWidth = (ranges.getEndRes() - ranges.getStartRes() + 1)
+ * av.getCharWidth();
if (imgWidth < 1)
{
if (imgWidth < 1)
{
+ fastPaint = false;
return;
}
Graphics2D gg;
return;
}
Graphics2D gg;
@@
-1088,7
+1095,7
@@
public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
gg = (Graphics2D) image.getGraphics();
}
gg = (Graphics2D) image.getGraphics();
}
-
+
drawComponent(gg, av.getRanges().getStartRes(),
av.getRanges().getEndRes() + 1);
gg.dispose();
drawComponent(gg, av.getRanges().getStartRes(),
av.getRanges().getEndRes() + 1);
gg.dispose();
@@
-1097,11
+1104,6
@@
public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
}
/**
}
/**
- * set true to enable redraw timing debug output on stderr
- */
- private final boolean debugRedraw = false;
-
- /**
* non-Thread safe repaint
*
* @param horizontal
* non-Thread safe repaint
*
* @param horizontal
@@
-1122,6
+1124,11
@@
public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
int er = av.getRanges().getEndRes() + 1;
int transX = 0;
int er = av.getRanges().getEndRes() + 1;
int transX = 0;
+ if (er == sr + 1)
+ {
+ fastPaint = false;
+ return;
+ }
Graphics2D gg = (Graphics2D) image.getGraphics();
if (imgWidth>Math.abs(horizontal*av.getCharWidth())) {
Graphics2D gg = (Graphics2D) image.getGraphics();
if (imgWidth>Math.abs(horizontal*av.getCharWidth())) {
@@
-1139,6
+1146,7
@@
public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
er = sr - horizontal;
}
}
er = sr - horizontal;
}
}
+
gg.translate(transX, 0);
drawComponent(gg, sr, er);
gg.translate(transX, 0);
drawComponent(gg, sr, er);
@@
-1146,7
+1154,6
@@
public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
gg.translate(-transX, 0);
gg.dispose();
gg.translate(-transX, 0);
gg.dispose();
-
fastPaint = true;
// Call repaint on alignment panel so that repaints from other alignment
fastPaint = true;
// Call repaint on alignment panel so that repaints from other alignment
@@
-1264,6
+1271,7
@@
public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
private int[] bounds = new int[2];
private int[] bounds = new int[2];
+ private boolean allowFastPaint;
@Override
public int[] getVisibleVRange()
{
@Override
public int[] getVisibleVRange()
{
@@
-1370,4
+1378,13
@@
public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
}
return annotationHeight;
}
}
return annotationHeight;
}
+
+ /**
+ * Clears the flag that allows a 'fast paint' on the next repaint, so
+ * requiring a full repaint
+ */
+ public void setNoFastPaint()
+ {
+ allowFastPaint = false;
+ }
}
}