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
made ws warning dialog optional, and fixed its wording (JAL-693)
[jalview.git]
/
src
/
jalview
/
gui
/
WsPreferences.java
diff --git
a/src/jalview/gui/WsPreferences.java
b/src/jalview/gui/WsPreferences.java
index
4fb8e6e
..
ff149c1
100644
(file)
--- a/
src/jalview/gui/WsPreferences.java
+++ b/
src/jalview/gui/WsPreferences.java
@@
-19,6
+19,7
@@
package jalview.gui;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
import java.net.URL;
import java.util.Vector;
import java.net.URL;
import java.util.Vector;
@@
-45,7
+46,7
@@
public class WsPreferences extends GWsPreferences
private boolean needWsMenuUpdate;
private boolean oldJws1, oldJws2, oldIndexByHost, oldIndexByType,
private boolean needWsMenuUpdate;
private boolean oldJws1, oldJws2, oldIndexByHost, oldIndexByType,
- oldEnfin;
+ oldEnfin, oldWsWarning;
private void initFromPreferences()
{
private void initFromPreferences()
{
@@
-63,16
+64,34
@@
public class WsPreferences extends GWsPreferences
updateList();
enableEnfinServices.setSelected(oldEnfin = Cache.getDefault(
"SHOW_ENFIN_SERVICES", true));
updateList();
enableEnfinServices.setSelected(oldEnfin = Cache.getDefault(
"SHOW_ENFIN_SERVICES", true));
+ enableEnfinServices.addActionListener(updateAction);
enableJws1Services.setSelected(oldJws1 = Cache.getDefault(
"SHOW_JWS1_SERVICES", true));
enableJws1Services.setSelected(oldJws1 = Cache.getDefault(
"SHOW_JWS1_SERVICES", true));
+ enableJws1Services.addActionListener(updateAction);
enableJws2Services.setSelected(oldJws2 = Cache.getDefault(
"SHOW_JWS2_SERVICES", true));
enableJws2Services.setSelected(oldJws2 = Cache.getDefault(
"SHOW_JWS2_SERVICES", true));
+ enableJws2Services.addActionListener(updateAction);
indexByHost.setSelected(oldIndexByHost = Cache.getDefault(
"WSMENU_BYHOST", true));
indexByHost.setSelected(oldIndexByHost = Cache.getDefault(
"WSMENU_BYHOST", true));
+ indexByHost.addActionListener(updateAction);
indexByType.setSelected(oldIndexByType = Cache.getDefault(
"WSMENU_BYTYPE", true));
indexByType.setSelected(oldIndexByType = Cache.getDefault(
"WSMENU_BYTYPE", true));
+ indexByType.addActionListener(updateAction);
+ displayWsWarning.setSelected(oldWsWarning = Cache.getDefault(
+ "SHOW_WSDISCOVERY_ERRORS", true));
}
}
+ ActionListener updateAction = new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ update++;
+ }
+
+ };
+
private void updateList()
{
wsList.setListData(wsUrls);
private void updateList()
{
wsList.setListData(wsUrls);
@@
-97,6
+116,7
@@
public class WsPreferences extends GWsPreferences
if (sel > -1)
{
wsUrls.removeElementAt(sel);
if (sel > -1)
{
wsUrls.removeElementAt(sel);
+ update++;
updateList();
}
}
updateList();
}
}
@@
-119,6
+139,7
@@
public class WsPreferences extends GWsPreferences
int present = wsUrls.indexOf(url);
if (present == -1)
{
int present = wsUrls.indexOf(url);
if (present == -1)
{
+ update++;
wsUrls.setElementAt(url, sel);
updateList();
}
wsUrls.setElementAt(url, sel);
updateList();
}
@@
-165,6
+186,8
@@
public class WsPreferences extends GWsPreferences
"WSMENU_BYTYPE",
Boolean.valueOf(old ? oldIndexByType : indexByType.isSelected())
.toString());
"WSMENU_BYTYPE",
Boolean.valueOf(old ? oldIndexByType : indexByType.isSelected())
.toString());
+ Cache.setProperty("SHOW_WSDISCOVERY_ERRORS",
+ Boolean.valueOf(old ? oldWsWarning : displayWsWarning.isSelected()).toString());
updateServiceList();
}
updateServiceList();
}
@@
-297,6
+320,7
@@
public class WsPreferences extends GWsPreferences
{
wsUrls.addElement(url);
}
{
wsUrls.addElement(url);
}
+ update++;
updateList();
}
}
updateList();
}
}
@@
-316,6
+340,8
@@
public class WsPreferences extends GWsPreferences
public void run()
{
public void run()
{
+ // force a refresh.
+ lastrefresh = update - 1;
updateWsMenuConfig(false);
refreshWsMenu(true);
}
updateWsMenuConfig(false);
refreshWsMenu(true);
}
@@
-324,6
+350,8
@@
public class WsPreferences extends GWsPreferences
}
/**
}
/**
+ * Refresh the web services menus - but only if there has been a change in the
+ * configuration (indicated by update!=lastrefresh)
*
* @param showProgress
* show progress in dialog or on desktop
*
* @param showProgress
* show progress in dialog or on desktop
@@
-340,8
+368,12
@@
public class WsPreferences extends GWsPreferences
progressBar.setVisible(true);
validate();
progressBar.setIndeterminate(true);
progressBar.setVisible(true);
validate();
progressBar.setIndeterminate(true);
- Desktop.instance.startServiceDiscovery(true); // wait around for all
- // threads to complete
+ if (lastrefresh != update)
+ {
+ lastrefresh = update;
+ Desktop.instance.startServiceDiscovery(true); // wait around for all
+ // threads to complete
+ }
progressBar.setIndeterminate(false);
progressBar.setVisible(false);
validate();
progressBar.setIndeterminate(false);
progressBar.setVisible(false);
validate();
@@
-359,15
+391,23
@@
public class WsPreferences extends GWsPreferences
long ct = System.currentTimeMillis();
Desktop.instance.setProgressBar("Refreshing Web Service Menus",
ct);
long ct = System.currentTimeMillis();
Desktop.instance.setProgressBar("Refreshing Web Service Menus",
ct);
- Desktop.instance.startServiceDiscovery(true);
- Desktop.instance.setProgressBar(null,
- ct);
+ if (lastrefresh != update)
+ {
+ lastrefresh = update;
+ Desktop.instance.startServiceDiscovery(true);
+ }
+ Desktop.instance.setProgressBar(null, ct);
}
}).start();
}
}
}
}).start();
}
}
+ /**
+ * state counters for ensuring that updates only happen if config has changed.
+ */
+ private long update = 0, lastrefresh = 0;
+
/*
* (non-Javadoc)
*
/*
* (non-Javadoc)
*