From f0ed39b35bf7581ff35bfeb52bb2403c179060c0 Mon Sep 17 00:00:00 2001 From: jprocter Date: Thu, 28 Jul 2011 11:03:33 +0100 Subject: [PATCH] added 'since 2.x notes to parameters'. User configurable help URL for JalviewLite (JAL-864). resolvetocodebase parameter introduced to allow pre-2.7 style codebase+relative URL resolution (JAL-359, JAL-786) --- examples/appletParameters.html | 4 +- src/jalview/appletgui/AlignFrame.java | 42 +-------------------- src/jalview/bin/JalviewLite.java | 65 +++++++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+), 42 deletions(-) diff --git a/examples/appletParameters.html b/examples/appletParameters.html index 3b2edfb..554419c 100644 --- a/examples/appletParameters.html +++ b/examples/appletParameters.html @@ -288,7 +288,7 @@ showbutton true Show the jalview button on the page. When false, JalviewLite will open immediately. - sortByTree true or false (default is false) automatically sort the associated alignment view by the tree when a new tree is opened. showTreeBootstrapstrue or false (default is true)show or hide branch bootstraps showTreeDistancestrue or false (default is true)show or hide branch lengths showUnlinkedTreeNodestrue or false (default is false)indicate if unassociated nodes should be highlighted in the tree view heightScale 1.0 or greater Adjust the height of each cell in the alignment grid relative to the height of a character in the alignment font. - widthScale 1.0 or greater Adjust the width of each cell in the alignment grid relative to the width of a character in the alignment font. centrecolumnlabels true of false (default is false) When true, text labels associated with a column in the alignment will be shown centered with respect to the column. showUnconserved true of false (default is false) When true, only gaps and symbols different to the consensus sequence for a column will be shown. Useful for visualizing alignments exhibiting low sequence variation, where it is important to highlight mutations. upperCase bold or other value Indicate a text style to apply to uppercase sequence symbols. Currently, only bold is supported. showUnconserved true of false (default is false) When true, only gaps and symbols different to the consensus sequence for a column will be shown. Useful for visualizing alignments exhibiting low sequence variation, where it is important to highlight mutations. automaticScrolling true of false (default is false) When true, alignment panels will automatically scroll to show any regions of the alignment highlighted due to javascript events or when mousing over a position in an associated structure. showGroupConsensus true of false (default is false) When true, shows consensus annotation row for any groups on the alignment. showGroupConservation true of false (default is false) When true, shows amino-acid property conservation annotation row for any groups on the alignment. showConsensusHistogram true of false (default is true) When true, shows the percentage occurence of the consensus symbol for each column as a histogram above the consensus sequence row. showSequenceLogo true of false (default is false) When true, shows a sequence logo above the consensus sequence (overlaid above the Consensus Histogram, if visible, with symbols coloured using the alignment's default colourscheme). oninit after_init() name of javascript function that will be called after the jalviewLite instance has completed its initialisation. relaxedidmatch true or false (default is false) When true, use stem based matching to identify sequences that match features imported from a GFF or Jalview sequence features file, and for associating PDB data (passed on PDBfile parguments) with sequences (based on a given destination sequence ID). alignpdbfiles true or false (default is false) When true, and jalviewLite is able to use jmol as a structure viewer, attempt to show a superposition of all structures loaded onto the alignment, superimposed using the aligned regions of corresponding sequences. [experimental] externalstructureviewer true or false (default is false) re-route jmol colouring commands, selection and mouseover events to an external viewer using javascript callbacks. [experimental] externalstructureviewer true or false (default is false) re-route jmol colouring commands, selection and mouseover events to an external viewer using javascript callbacks. [experimental] annotationcolour_max colour name or RGB hex triplet (default is red) Default colour used for maximum value when shading by annotation. annotationcolour_min colour name or RGB hex triplet (default is orange) Default colour used for minimum value when shading by annotation. + sortByTree true or false (default is false) automatically sort the associated alignment view by the tree when a new tree is opened. showTreeBootstrapstrue or false (default is true)show or hide branch bootstraps showTreeDistancestrue or false (default is true)show or hide branch lengths showUnlinkedTreeNodestrue or false (default is false)indicate if unassociated nodes should be highlighted in the tree view heightScale 1.0 or greater Adjust the height of each cell in the alignment grid relative to the height of a character in the alignment font. (since 2.5.1) + widthScale 1.0 or greater Adjust the width of each cell in the alignment grid relative to the width of a character in the alignment font. (since 2.5.1) centrecolumnlabels true of false (default is false) When true, text labels associated with a column in the alignment will be shown centered with respect to the column. (since 2.4) showUnconserved true of false (default is false) When true, only gaps and symbols different to the consensus sequence for a column will be shown. Useful for visualizing alignments exhibiting low sequence variation, where it is important to highlight mutations. (since 2.5) upperCase bold or other value Indicate a text style to apply to uppercase sequence symbols. Currently, only bold is supported. automaticScrolling true of false (default is false) When true, alignment panels will automatically scroll to show any regions of the alignment highlighted due to javascript events or when mousing over a position in an associated structure. (since 2.6) showGroupConsensus true of false (default is false) When true, shows consensus annotation row for any groups on the alignment. (since 2.7) showGroupConservation true of false (default is false) When true, shows amino-acid property conservation annotation row for any groups on the alignment. (since 2.7) showConsensusHistogram true of false (default is true) When true, shows the percentage occurence of the consensus symbol for each column as a histogram above the consensus sequence row. (since 2.7) showSequenceLogo true of false (default is false) When true, shows a sequence logo above the consensus sequence (overlaid above the Consensus Histogram, if visible, with symbols coloured using the alignment's default colourscheme). (since 2.7) oninit after_init() name of javascript function that will be called after the jalviewLite instance has completed its initialisation. (since 2.7) relaxedidmatch true or false (default is false) When true, use stem based matching to identify sequences that match features imported from a GFF or Jalview sequence features file, and for associating PDB data (passed on PDBfile parguments) with sequences (based on a given destination sequence ID). (since 2.7) alignpdbfiles true or false (default is false) When true, and jalviewLite is able to use jmol as a structure viewer, attempt to show a superposition of all structures loaded onto the alignment, superimposed using the aligned regions of corresponding sequences. [experimental] (since 2.7) externalstructureviewer true or false (default is false) re-route jmol colouring commands, selection and mouseover events to an external viewer using javascript callbacks. [experimental] (since 2.7) annotationcolour_max colour name or RGB hex triplet (default is red) Default colour used for maximum value when shading by annotation. (since 2.7) annotationcolour_min colour name or RGB hex triplet (default is orange) Default colour used for minimum value when shading by annotation. (since 2.7) jalviewhelpurl absolute or relative url or javascript function prefixed by javascript: (default is http://www.jalview.org/help.html) Optional parameter allowing modification of the default Jalview Help URL normally opened when JalviewLite's 'Help' menu item is selected. (since 2.7) resolvetocodebase True or False (False) Set to true to re-instate pre-JalviewLite 2.7 behaviour where relative URLs were prepended with the applet 'codebase' rather than the current document base URL before resolution. (since 2.7)

 

\ No newline at end of file diff --git a/src/jalview/appletgui/AlignFrame.java b/src/jalview/appletgui/AlignFrame.java index 80b01d0..8f8ac5a 100644 --- a/src/jalview/appletgui/AlignFrame.java +++ b/src/jalview/appletgui/AlignFrame.java @@ -2574,7 +2574,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, } protected void documentation_actionPerformed() { - showURL("http://www.jalview.org/help.html", "HELP"); + alignPanel.av.applet.openJalviewHelpUrl(); } protected void about_actionPerformed() @@ -2645,45 +2645,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, } else { - try - { - if (url.indexOf(":") == -1) - { - // TODO: verify (Bas Vroling bug) prepend codebase or server URL to - // form valid URL - // Should really use docbase, not codebase. - if (url.indexOf("/") == 0) - { - String codebase = viewport.applet.getCodeBase().toString(); - url = codebase.substring(0, codebase.length() - - viewport.applet.getCodeBase().getFile().length()) - + url; - } - else - { - url = viewport.applet.getCodeBase() + url; - } - System.out.println("Show url (prepended codebase): " + url); - } - else - { - System.out.println("Show url: " + url); - } - if (url.indexOf("javascript:") == 0) - { - // no target for the javascript context - viewport.applet.getAppletContext().showDocument( - new java.net.URL(url)); - } - else - { - viewport.applet.getAppletContext().showDocument( - new java.net.URL(url), target); - } - } catch (Exception ex) - { - ex.printStackTrace(); - } + viewport.applet.showURL(url, target); } } diff --git a/src/jalview/bin/JalviewLite.java b/src/jalview/bin/JalviewLite.java index 9a4d9e2..08229d6 100644 --- a/src/jalview/bin/JalviewLite.java +++ b/src/jalview/bin/JalviewLite.java @@ -53,6 +53,7 @@ import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.io.BufferedReader; import java.io.InputStreamReader; +import java.net.URL; import java.util.Hashtable; import java.util.StringTokenizer; import java.util.Vector; @@ -2271,6 +2272,70 @@ public class JalviewLite extends Applet implements StructureSelectionManagerProv } + public void openJalviewHelpUrl() + { + String helpUrl=getParameter("jalviewhelpurl"); + if (helpUrl==null || helpUrl.trim().length()<5) + { + helpUrl="http://www.jalview.org/help.html"; + } + showURL(helpUrl, "HELP"); + } + + + /** + * open a URL in the browser - resolving it according to relative refs and coping with javascript: protocol if necessary. + * @param url + * @param target + */ + public void showURL(String url, String target) + { + try + { + if (url.indexOf(":") == -1) + { + // TODO: verify (Bas Vroling bug) prepend codebase or server URL to + // form valid URL + // Should really use docbase, not codebase. + URL base = getDefaultParameter("resolvetocodebase", false) ? getDocumentBase() : getCodeBase(); + String codebase = base.toString(); + if (url.indexOf("/") == 0) + { + url = codebase.substring(0, codebase.length() + - base.getFile().length()) + + url; + } + else + { + url = base + url; + } + if (debug) { + System.err.println("Show url (prepended "+codebase+" - toggle resolvetocodebase if code/docbase resolution is wrong): " + url); + } + } + else + { + if (debug) { + System.err.println("Show url: " + url); + } + } + if (url.indexOf("javascript:") == 0) + { + // no target for the javascript context + getAppletContext().showDocument( + new java.net.URL(url)); + } + else + { + getAppletContext().showDocument( + new java.net.URL(url), target); + } + } catch (Exception ex) + { + ex.printStackTrace(); + } + } + /** * bind structures in a viewer to any matching sequences in an alignFrame (use * sequenceIds to limit scope of search to specific sequences) -- 1.7.10.2