From 86b0e83560beed0d399802f866762b3532c6c468 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Mon, 7 Nov 2016 11:52:23 +0000 Subject: [PATCH] JAL-2282 show url links that need checked; remove 'www' from default --- src/jalview/gui/Desktop.java | 32 +++++++++++++++++++------------- src/jalview/jbgui/GSequenceLink.java | 2 +- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index d06dd26..28606f1 100644 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -2282,12 +2282,19 @@ public class Desktop extends jalview.jbgui.GDesktop implements // only need to check links if there is one with a // SEQUENCE_ID which is not the default EMBL_EBI link ListIterator li = links.listIterator(); - Boolean check = false; - while (li.hasNext() && !check) + boolean check = false; + List urls = new ArrayList(); + while (li.hasNext()) { String link = li.next(); - check = (link.contains(SEQUENCE_ID) && !link - .equals(EMBLEBI_STRING)); + if (link.contains(SEQUENCE_ID) && !link.equals(EMBLEBI_STRING)) + { + check = true; + int barPos = link.indexOf("|"); + String urlMsg = barPos == -1 ? link : link.substring(0, + barPos) + ": " + link.substring(barPos + 1); + urls.add(new JLabel(urlMsg)); + } } if (!check) { @@ -2306,6 +2313,10 @@ public class Desktop extends jalview.jbgui.GDesktop implements MessageManager .getString("label.SEQUENCE_ID_for_DB_ACCESSION2")); msgPanel.add(msg); + for (JLabel url : urls) + { + msgPanel.add(url); + } msgPanel.add(msg2); final JCheckBox jcb = new JCheckBox( @@ -2315,15 +2326,10 @@ public class Desktop extends jalview.jbgui.GDesktop implements @Override public void actionPerformed(ActionEvent e) { - // update Cache settings if checkbox is selected - if (jcb.isSelected()) - { - Cache.setProperty("CHECKURLLINKS", "false"); - } - else - { - Cache.setProperty("CHECKURLLINKS", "true"); - } + // update Cache settings for "don't show this again" + boolean showWarningAgain = !jcb.isSelected(); + Cache.setProperty("CHECKURLLINKS", + Boolean.valueOf(showWarningAgain).toString()); } }); msgPanel.add(jcb); diff --git a/src/jalview/jbgui/GSequenceLink.java b/src/jalview/jbgui/GSequenceLink.java index b27752e..2689946 100755 --- a/src/jalview/jbgui/GSequenceLink.java +++ b/src/jalview/jbgui/GSequenceLink.java @@ -67,7 +67,7 @@ public class GSequenceLink extends Panel } }); urlTB.setFont(JvSwingUtils.getLabelFont()); - urlTB.setText("http://www."); + urlTB.setText("http://"); urlTB.setBounds(new Rectangle(78, 40, 309, 23)); urlTB.addKeyListener(new KeyAdapter() { -- 1.7.10.2