From 08873667c3fbbf2b925c7b6ac12950f6da102e17 Mon Sep 17 00:00:00 2001 From: hansonr Date: Sun, 12 May 2019 21:15:37 -0500 Subject: [PATCH] better preferences/properties --- src/jalview/gui/Preferences.java | 37 ++++++++++++++++++++++++++++ src/jalview/io/vamsas/Tree.java | 2 +- src/jalview/jbgui/GAlignFrame.java | 3 ++- src/jalview/jbgui/GDesktop.java | 3 ++- src/jalview/jbgui/GPCAPanel.java | 5 ++-- src/jalview/jbgui/GRnaStructureViewer.java | 6 ++--- src/jalview/jbgui/GSplitFrame.java | 3 ++- src/jalview/jbgui/GStructureViewer.java | 3 ++- src/jalview/jbgui/GTreePanel.java | 3 ++- src/jalview/util/Platform.java | 33 ++++++++++++++++++++++++- 10 files changed, 86 insertions(+), 12 deletions(-) diff --git a/src/jalview/gui/Preferences.java b/src/jalview/gui/Preferences.java index facc826..359eabe 100755 --- a/src/jalview/gui/Preferences.java +++ b/src/jalview/gui/Preferences.java @@ -871,6 +871,43 @@ public class Preferences extends GPreferences } } + public static void setAppletDefaults() + { + + // http://www.jalview.org/old/v2_8/examples/appletParameters.html + + // showConservation true or false Default is true. + // showQuality true or false Default is true. + // showConsensus true or false Default is true. + // showFeatureSettings true or false Shows the feature settings window when + // startin + // showTreeBootstraps true or false (default is true) show or hide branch + // bootstraps + // showTreeDistances true or false (default is true) show or hide branch + // lengths + // showUnlinkedTreeNodes true or false (default is false) indicate if + // unassociated nodes should be highlighted in the tree view + // showUnconserved true of false (default is false) When true, only gaps and + // symbols different to the consensus sequence ions of the alignment + // 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 + // showConsensusHistogram true of false (default is true) When true, shows + // the percentage occurence of the consensus symbol for each column as a + // showSequenceLogo true of false (default is false) When true, shows a + // sequence logo above the consensus sequence (overlaid above the Consensus + + Cache.setPropertyNoSave("SHOW_CONSERVATION", "true"); + Cache.setPropertyNoSave("SHOW_QUALITY", "false"); + Cache.setPropertyNoSave("SHOW_CONCENSUS", "true"); + Cache.setPropertyNoSave("SHOW_UNCONSERVED", "false"); + Cache.setPropertyNoSave("SHOW_GROUP_CONSERVATION", "false"); + Cache.setPropertyNoSave("SHOW_GROUP_CONCENSUS", "false"); + + // TODO -- just a start here + } + /** * Do any necessary validation before saving settings. Return focus to the * first tab which fails validation. diff --git a/src/jalview/io/vamsas/Tree.java b/src/jalview/io/vamsas/Tree.java index c0f65c4..e4e0b6c 100644 --- a/src/jalview/io/vamsas/Tree.java +++ b/src/jalview/io/vamsas/Tree.java @@ -517,7 +517,7 @@ public class Tree extends DatastoreItem * referenced in input data has already been associated with jalview objects. * * @param tp - * @param alignFrame + * @param loaderFrame * @return Object[] { AlignmentView, AlignmentI - reference alignment for * input } */ diff --git a/src/jalview/jbgui/GAlignFrame.java b/src/jalview/jbgui/GAlignFrame.java index de20556..dbe46f6 100755 --- a/src/jalview/jbgui/GAlignFrame.java +++ b/src/jalview/jbgui/GAlignFrame.java @@ -25,6 +25,7 @@ import jalview.analysis.GeneticCodeI; import jalview.analysis.GeneticCodes; import jalview.api.SplitContainerI; import jalview.bin.Cache; +import jalview.bin.Jalview; import jalview.gui.JvSwingUtils; import jalview.gui.Preferences; import jalview.io.FileFormats; @@ -221,7 +222,7 @@ public class GAlignFrame extends JInternalFrame { // for Web-page embedding using id=align-frame-div - setName("jalview-alignment"); + setName(Jalview.getAppID("alignment")); jbInit(); setJMenuBar(alignFrameMenuBar); diff --git a/src/jalview/jbgui/GDesktop.java b/src/jalview/jbgui/GDesktop.java index 943e705..051bac7 100755 --- a/src/jalview/jbgui/GDesktop.java +++ b/src/jalview/jbgui/GDesktop.java @@ -21,6 +21,7 @@ package jalview.jbgui; import jalview.api.AlignmentViewPanel; +import jalview.bin.Jalview; import jalview.io.FileFormatException; import jalview.util.MessageManager; import jalview.util.Platform; @@ -150,7 +151,7 @@ public abstract class GDesktop extends JFrame */ private void jbInit() throws Exception { - setName("jalview-desktop"); + setName(Jalview.getAppID("desktop")); FileMenu.setText(MessageManager.getString("action.file")); HelpMenu.setText(MessageManager.getString("action.help")); VamsasMenu.setText("Vamsas"); diff --git a/src/jalview/jbgui/GPCAPanel.java b/src/jalview/jbgui/GPCAPanel.java index a6498d2..04aab37 100755 --- a/src/jalview/jbgui/GPCAPanel.java +++ b/src/jalview/jbgui/GPCAPanel.java @@ -20,6 +20,7 @@ */ package jalview.jbgui; +import jalview.bin.Jalview; import jalview.util.ImageMaker.TYPE; import jalview.util.MessageManager; @@ -88,8 +89,8 @@ public class GPCAPanel extends JInternalFrame private void jbInit() throws Exception { - setName("jalview-pca"); - this.getContentPane().setLayout(new BorderLayout()); + setName(Jalview.getAppID("pca")); + getContentPane().setLayout(new BorderLayout()); JPanel jPanel2 = new JPanel(); jPanel2.setLayout(new FlowLayout()); JLabel jLabel1 = new JLabel(); diff --git a/src/jalview/jbgui/GRnaStructureViewer.java b/src/jalview/jbgui/GRnaStructureViewer.java index e0bec25..a90bd48 100644 --- a/src/jalview/jbgui/GRnaStructureViewer.java +++ b/src/jalview/jbgui/GRnaStructureViewer.java @@ -20,6 +20,8 @@ */ package jalview.jbgui; +import jalview.bin.Jalview; + import javax.swing.JInternalFrame; @SuppressWarnings("serial") @@ -38,9 +40,7 @@ public class GRnaStructureViewer extends JInternalFrame private void jbInit() throws Exception { - - setName("jalview-rnastructureviewer"); - + setName(Jalview.getAppID("rnastructureviewer")); } } diff --git a/src/jalview/jbgui/GSplitFrame.java b/src/jalview/jbgui/GSplitFrame.java index a75760d..ed715c8 100644 --- a/src/jalview/jbgui/GSplitFrame.java +++ b/src/jalview/jbgui/GSplitFrame.java @@ -20,6 +20,7 @@ */ package jalview.jbgui; +import jalview.bin.Jalview; import jalview.util.Platform; import java.awt.Component; @@ -57,7 +58,7 @@ public class GSplitFrame extends JInternalFrame */ public GSplitFrame(GAlignFrame top, GAlignFrame bottom) { - setName("jalview-splitframe"); + setName(Jalview.getAppID("splitframe")); this.topFrame = top; this.bottomFrame = bottom; diff --git a/src/jalview/jbgui/GStructureViewer.java b/src/jalview/jbgui/GStructureViewer.java index dfee3e2..e16d63a 100644 --- a/src/jalview/jbgui/GStructureViewer.java +++ b/src/jalview/jbgui/GStructureViewer.java @@ -21,6 +21,7 @@ package jalview.jbgui; import jalview.api.structures.JalviewStructureDisplayI; +import jalview.bin.Jalview; import jalview.gui.ColourMenuHelper.ColourChangeListener; import jalview.util.ImageMaker.TYPE; import jalview.util.MessageManager; @@ -89,7 +90,7 @@ public abstract class GStructureViewer extends JInternalFrame private void jbInit() throws Exception { - setName("jalview-structureviewer"); + setName(Jalview.getAppID("structureviewer")); JMenuBar menuBar = new JMenuBar(); this.setJMenuBar(menuBar); diff --git a/src/jalview/jbgui/GTreePanel.java b/src/jalview/jbgui/GTreePanel.java index d184e76..0f9c2a2 100755 --- a/src/jalview/jbgui/GTreePanel.java +++ b/src/jalview/jbgui/GTreePanel.java @@ -20,6 +20,7 @@ */ package jalview.jbgui; +import jalview.bin.Jalview; import jalview.util.ImageMaker.TYPE; import jalview.util.MessageManager; @@ -92,7 +93,7 @@ public class GTreePanel extends JInternalFrame private void jbInit() throws Exception { - setName("jalview-tree"); + setName(Jalview.getAppID("tree")); this.getContentPane().setLayout(borderLayout1); this.setBackground(Color.white); this.setFont(new java.awt.Font("Verdana", 0, 12)); diff --git a/src/jalview/util/Platform.java b/src/jalview/util/Platform.java index 66ce556..96940e5 100644 --- a/src/jalview/util/Platform.java +++ b/src/jalview/util/Platform.java @@ -32,6 +32,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; +import java.net.MalformedURLException; import java.net.URL; import java.util.Properties; @@ -458,7 +459,7 @@ public class Platform System.out.println( "Platform id=" + id + " reading Info." + key + " = " + value); - p.put(id + "_" + key, value); + p.put(key, value); /** * @j2sNative @@ -612,4 +613,34 @@ public class Platform } + public static URL getDocumentBase() + { + try + { + return (isJS() ? new URL(/** + * @j2sNative J2S.thisApplet._applet.appletViewer.appletDocumentBase + * || + */ + "") : null); + } catch (MalformedURLException e) + { + return null; + } + } + + public static URL getCodeBase() + { + try + { + return (isJS() ? new URL(/** + * @j2sNative J2S.thisApplet._applet.appletViewer.appletCodeBase + * || + */ + "") : null); + } catch (MalformedURLException e) + { + return null; + } + } + } -- 1.7.10.2