- public void run() {
- if (url==null)
- return;
- boolean prompt=false;
- try {
- // First - check to see if wee have an old questionnaire/response id pair.
- String lastq=jalview.bin.Cache.getProperty("QUESTIONNAIRE");
- if (lastq==null) {
- prompt = checkresponse(new URL(url+(url.indexOf('?')>-1 ? "&" : "?") +"checkresponse=1"));
- } else {
- String qurl=url+(url.indexOf('?')>-1 ? "&" : "?") +"checkresponse=1";
- // query the server with the old qid/id pair
- String qqid = lastq.indexOf(':')>-1 ? lastq.substring(0,lastq.indexOf(':')) : null;
- if (qqid!=null && qqid.length()>0) {
- qurl+="&qid="+qqid;
- qid=qqid;
- }
- String qrid = lastq.substring(lastq.indexOf(':')+1); // retrieve old rid
- if (qrid!=null && !qrid.equals("null")) {
- rid=qrid;
- qurl+="&rid="+qrid;
- }
- // see if we have already responsed to this questionnaire.
- prompt = checkresponse(new URL(qurl));
- }
- // Update our local property cache with latest qid and rid
- jalview.bin.Cache.setProperty("QUESTIONNAIRE",qid+":"+rid);
- if (prompt) {
- String qurl = url+(url.indexOf('?')>-1 ? "&" : "?") + "qid="+qid+"&rid="+rid;
- jalview.bin.Cache.log.info("Prompting user for questionnaire at "+qurl);
- int reply = JOptionPane.showInternalConfirmDialog(Desktop.desktop,
- "There is a new Questionnaire available." +
- "Would you like to complete it now ?\n",
- "Jalview User Survey",
+ return prompt;
+ }
+
+ public void run()
+ {
+ if (url == null)
+ {
+ return;
+ }
+ boolean prompt = false;
+ try
+ {
+ // First - check to see if wee have an old questionnaire/response id pair.
+ String lastq = jalview.bin.Cache.getProperty("QUESTIONNAIRE");
+ if (lastq == null)
+ {
+ prompt = checkresponse(new URL(url
+ + (url.indexOf('?') > -1 ? "&" : "?") + "checkresponse=1"));
+ }
+ else
+ {
+ String qurl = url + (url.indexOf('?') > -1 ? "&" : "?")
+ + "checkresponse=1";
+ // query the server with the old qid/id pair
+ String qqid = lastq.indexOf(':') > -1 ? lastq.substring(0,
+ lastq.indexOf(':')) : null;
+ if (qqid != null && qqid != "null" && qqid.length() > 0)
+ {
+ qurl += "&qid=" + qqid;
+ qid = qqid;
+ String qrid = lastq.substring(lastq.indexOf(':') + 1); // retrieve
+ // old rid
+ if (qrid != null && !qrid.equals("null"))
+ {
+ rid = qrid;
+ qurl += "&rid=" + qrid;
+ }
+ }
+ // see if we have already responsed to this questionnaire.
+ prompt = checkresponse(new URL(qurl));
+ }
+ if (qid != null && rid != null)
+ {
+ // Update our local property cache with latest qid and rid
+ jalview.bin.Cache.setProperty("QUESTIONNAIRE", qid + ":" + rid);
+ }
+ if (prompt)
+ {
+ String qurl = url + (url.indexOf('?') > -1 ? "&" : "?") + "qid="
+ + qid + "&rid=" + rid;
+ jalview.bin.Cache.log.info("Prompting user for questionnaire at "
+ + qurl);
+ int reply = JOptionPane
+ .showInternalConfirmDialog(Desktop.desktop, MessageManager
+ .getString("label.jalview_new_questionnaire"),
+ MessageManager
+ .getString("label.jalview_user_survey"),