From ef3333028b291ce92bdae34bd2f8487d35d0a0d3 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Mon, 15 Aug 2005 12:11:07 +0000 Subject: [PATCH] Add taylor to default colour check --- src/jalview/jbgui/GAlignFrame.java | 73 +++++++++++++++---------- src/jalview/schemes/ColourSchemeProperty.java | 40 ++++++++++---- 2 files changed, 73 insertions(+), 40 deletions(-) diff --git a/src/jalview/jbgui/GAlignFrame.java b/src/jalview/jbgui/GAlignFrame.java index 463bf70..26e5326 100755 --- a/src/jalview/jbgui/GAlignFrame.java +++ b/src/jalview/jbgui/GAlignFrame.java @@ -133,9 +133,41 @@ public class GAlignFrame colours.add(BLOSUM62Colour); colours.add(nucleotideColour); - noColourmenuItem.setSelected(true); + setColourSelected(jalview.bin.Cache.getDefault("DEFAULT_COLOUR", "None")); - String defaultColour = jalview.bin.Cache.getDefault("DEFAULT_COLOUR", null); + + try + { + jbInit(); + setJMenuBar(alignFrameMenuBar); + + JMenuItem item; + + // dynamically fill save as menu with available formats + for (int i = 0; i < jalview.io.FormatAdapter.formats.size(); i++) + { + item = new JMenuItem( (String) jalview.io.FormatAdapter.formats. + elementAt( + i)); + item.addActionListener(new java.awt.event.ActionListener() + { + public void actionPerformed(ActionEvent e) + { + outputText_actionPerformed(e); + } + }); + + outputTextboxMenu.add(item); + } + } + catch (Exception e) + { + } + + } + + public void setColourSelected(String defaultColour) + { if (defaultColour != null) { @@ -143,6 +175,9 @@ public class GAlignFrame switch (index) { + case ColourSchemeProperty.NONE: + noColourmenuItem.setSelected(true); + break; case ColourSchemeProperty.CLUSTAL: clustalColour.setSelected(true); @@ -163,6 +198,10 @@ public class GAlignFrame break; + case ColourSchemeProperty.TAYLOR: + taylorColour.setSelected(true); + break; + case ColourSchemeProperty.HYDROPHOBIC: hydrophobicityColour.setSelected(true); @@ -200,34 +239,6 @@ public class GAlignFrame } } - try - { - jbInit(); - setJMenuBar(alignFrameMenuBar); - - JMenuItem item; - - // dynamically fill save as menu with available formats - for (int i = 0; i < jalview.io.FormatAdapter.formats.size(); i++) - { - item = new JMenuItem( (String) jalview.io.FormatAdapter.formats. - elementAt( - i)); - item.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(ActionEvent e) - { - outputText_actionPerformed(e); - } - }); - - outputTextboxMenu.add(item); - } - } - catch (Exception e) - { - } - } private void jbInit() @@ -237,6 +248,8 @@ public class GAlignFrame fileMenu.setText("File"); saveAlignmentMenu.setMnemonic('L'); saveAlignmentMenu.setText("Save As"); + saveAlignmentMenu.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java. + awt.event.KeyEvent.VK_S, java.awt.event.KeyEvent.CTRL_MASK, false)); saveAlignmentMenu.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) diff --git a/src/jalview/schemes/ColourSchemeProperty.java b/src/jalview/schemes/ColourSchemeProperty.java index d27dcf0..012c3a9 100755 --- a/src/jalview/schemes/ColourSchemeProperty.java +++ b/src/jalview/schemes/ColourSchemeProperty.java @@ -40,28 +40,32 @@ public class ColourSchemeProperty public static final int ZAPPO = 3; /** DOCUMENT ME!! */ - public static final int HYDROPHOBIC = 4; + public static final int TAYLOR = 4; /** DOCUMENT ME!! */ - public static final int HELIX = 5; + public static final int HYDROPHOBIC = 5; /** DOCUMENT ME!! */ - public static final int STRAND = 6; + public static final int HELIX = 6; /** DOCUMENT ME!! */ - public static final int TURN = 7; + public static final int STRAND = 7; /** DOCUMENT ME!! */ - public static final int BURIED = 8; + public static final int TURN = 8; /** DOCUMENT ME!! */ - public static final int NUCLEOTIDE = 9; + public static final int BURIED = 9; /** DOCUMENT ME!! */ - public static final int USER_DEFINED = 10; + public static final int NUCLEOTIDE = 10; /** DOCUMENT ME!! */ - public static final int NONE = 11; + public static final int USER_DEFINED = 11; + + + /** DOCUMENT ME!! */ + public static final int NONE = 12; /** * DOCUMENT ME! @@ -72,7 +76,7 @@ public class ColourSchemeProperty */ public static int getColourIndexFromName(String name) { - int ret = 11; + int ret = 12; if (name.equalsIgnoreCase("Clustal")) { @@ -90,6 +94,10 @@ public class ColourSchemeProperty { ret = ZAPPO; } + else if (name.equalsIgnoreCase("Taylor")) + { + ret = TAYLOR; + } else if (name.equalsIgnoreCase("Hydrophobic")) { ret = HYDROPHOBIC; @@ -136,7 +144,7 @@ public class ColourSchemeProperty cs = ((ConservationColourScheme) cs).cs; } - int index = 11; + int index = 12; if (cs instanceof ClustalxColourScheme) { @@ -154,6 +162,10 @@ public class ColourSchemeProperty { index = ZAPPO; } + else if (cs instanceof TaylorColourScheme) + { + index = TAYLOR; + } else if (cs instanceof HydrophobicColourScheme) { index = HYDROPHOBIC; @@ -219,6 +231,10 @@ public class ColourSchemeProperty break; + case TAYLOR: + ret = "Taylor"; + break; + case HYDROPHOBIC: ret = "Hydrophobic"; @@ -328,6 +344,10 @@ public class ColourSchemeProperty break; + case TAYLOR: + cs = new TaylorColourScheme(); + break; + case HYDROPHOBIC: cs = new HydrophobicColourScheme(); -- 1.7.10.2