From: Jim Procter Date: Mon, 2 Jul 2018 14:41:53 +0000 (+0100) Subject: Merge branch 'Jalview-BH/JAL-3026' into Jalview-BH/JAL-3048_dialogs X-Git-Tag: Develop-2_11_2_0-d20201215~24^2~68^2~603^2~4 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=da04ae1cccaba668a0ae3eb0cbaaf31ae558fd87;hp=8aeecfc716415947d5a41446d78a57950df7d5ba;p=jalview.git Merge branch 'Jalview-BH/JAL-3026' into Jalview-BH/JAL-3048_dialogs --- diff --git a/src/jalview/gui/FeatureSettings.java b/src/jalview/gui/FeatureSettings.java index 75e8ec9..5709ab5 100644 --- a/src/jalview/gui/FeatureSettings.java +++ b/src/jalview/gui/FeatureSettings.java @@ -233,7 +233,7 @@ public class FeatureSettings extends JPanel table.setDefaultEditor(FeatureMatcherSet.class, new FilterEditor(this)); table.setDefaultRenderer(FeatureMatcherSet.class, new FilterRenderer()); - + TableColumn colourColumn = new TableColumn(COLOUR_COLUMN, 75, new ColorRenderer(), new ColorEditor(this)); table.addColumn(colourColumn); diff --git a/src/jalview/gui/JvSwingUtils.java b/src/jalview/gui/JvSwingUtils.java index 4658668..d44080a 100644 --- a/src/jalview/gui/JvSwingUtils.java +++ b/src/jalview/gui/JvSwingUtils.java @@ -96,8 +96,19 @@ public final class JvSwingUtils } return (enclose ? "" : "") - + "

" - + ttext + "

" + ((enclose ? "" : "")); + + // BH 2018 + + + "
" + +// + "

" + + + ttext + + + "

" +// + "

" + + ((enclose ? "" : "")); } diff --git a/src/jalview/gui/SeqPanel.java b/src/jalview/gui/SeqPanel.java index 8b2e7bc..18c6acc 100644 --- a/src/jalview/gui/SeqPanel.java +++ b/src/jalview/gui/SeqPanel.java @@ -62,7 +62,9 @@ import java.awt.event.MouseWheelListener; import java.util.Collections; import java.util.List; +import javax.swing.JLabel; import javax.swing.JPanel; +import javax.swing.JToolTip; import javax.swing.SwingUtilities; import javax.swing.ToolTipManager; @@ -158,6 +160,8 @@ public class SeqPanel extends JPanel ToolTipManager.sharedInstance().registerComponent(this); ToolTipManager.sharedInstance().setInitialDelay(0); ToolTipManager.sharedInstance().setDismissDelay(10000); + + this.av = viewport; setBackground(Color.white); @@ -694,6 +698,8 @@ public class SeqPanel extends JPanel String lastMessage; + private String formattedTooltipText; + @Override public void mouseOverSequence(SequenceI sequence, int index, int pos) { @@ -863,16 +869,20 @@ public class SeqPanel extends JPanel String textString = tooltipText.toString(); if (lastTooltip == null || !lastTooltip.equals(textString)) { - String formattedTooltipText = JvSwingUtils.wrapTooltip(true, + formattedTooltipText = JvSwingUtils.wrapTooltip(true, textString); setToolTipText(formattedTooltipText); + lastTooltip = textString; } } } + private Point lastp = null; + private JToolTip tempTip = new JLabel().createToolTip(); + /* * (non-Javadoc) * @@ -881,19 +891,31 @@ public class SeqPanel extends JPanel @Override public Point getToolTipLocation(MouseEvent event) { - int x = event.getX(), w = getWidth(); - int wdth = (w - x < 200) ? -(w / 2) : 5; // switch sides when tooltip is too - // close to edge + // BH 2018 + + if (tooltipText == null || tooltipText.length() == 6) + return null; + + if (lastp != null && event.isShiftDown()) + return lastp; + Point p = lastp; - if (!event.isShiftDown() || p == null) - { - p = (tooltipText != null && tooltipText.length() > 6) - ? new Point(event.getX() + wdth, event.getY() - 20) - : null; - } + int x = event.getX(); + int y = event.getY(); + int w = getWidth(); + + tempTip.setTipText(formattedTooltipText); + int tipWidth = (int) tempTip.getPreferredSize().getWidth(); + + // was x += (w - x < 200) ? -(w / 2) : 5; + x = (x + tipWidth < w ? x + 10 : w - tipWidth); + p = new Point(x, y + 20); // BH 2018 was - 20? /* * TODO: try to modify position region is not obcured by tooltip + * + * Done? */ + return lastp = p; } diff --git a/swingjs/SwingJS-site.zip b/swingjs/SwingJS-site.zip index edd8197..11f9d44 100644 Binary files a/swingjs/SwingJS-site.zip and b/swingjs/SwingJS-site.zip differ diff --git a/swingjs/net.sf.j2s.core.jar b/swingjs/net.sf.j2s.core.jar index 9fff088..950a40e 100644 Binary files a/swingjs/net.sf.j2s.core.jar and b/swingjs/net.sf.j2s.core.jar differ diff --git a/template.html b/template.html index 5005060..2a22a77 100644 --- a/template.html +++ b/template.html @@ -8,6 +8,7 @@ if (!self.SwingJS)alert('swingjs2.js was not found. It needs to be in swingjs fo Info = { code: _CODE_, main: _MAIN_, + core: "NONE", width: 850, height: 550, readyFunction: null,