X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FAlignFrame.java;h=221f793d9c83fe1ad7d492c3fa9c404b8c6a5978;hb=d87d21c30c8d1f6a70f7d04f3f33e5210d0f367a;hp=175b17105ad67d93672dc0936b8ca62bd1267ef8;hpb=cd4e2687751aab1c9c5974e6966e610a3332236b;p=jalview.git diff --git a/src/jalview/appletgui/AlignFrame.java b/src/jalview/appletgui/AlignFrame.java index 175b171..221f793 100644 --- a/src/jalview/appletgui/AlignFrame.java +++ b/src/jalview/appletgui/AlignFrame.java @@ -22,6 +22,7 @@ package jalview.appletgui; import jalview.analysis.AlignmentSorter; import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder; +import jalview.analysis.NJTree; import jalview.api.AlignViewControllerGuiI; import jalview.api.AlignViewControllerI; import jalview.api.AlignViewportI; @@ -52,6 +53,8 @@ import jalview.io.AppletFormatAdapter; import jalview.io.DataSourceType; import jalview.io.FeaturesFile; import jalview.io.FileFormat; +import jalview.io.FileFormatI; +import jalview.io.FileFormats; import jalview.io.TCoffeeScoreFile; import jalview.schemes.Blosum62ColourScheme; import jalview.schemes.BuriedColourScheme; @@ -62,7 +65,7 @@ import jalview.schemes.HydrophobicColourScheme; import jalview.schemes.NucleotideColourScheme; import jalview.schemes.PIDColourScheme; import jalview.schemes.PurinePyrimidineColourScheme; -import jalview.schemes.RNAHelicesColourChooser; +import jalview.schemes.RNAHelicesColour; import jalview.schemes.StrandColourScheme; import jalview.schemes.TCoffeeColourScheme; import jalview.schemes.TaylorColourScheme; @@ -282,6 +285,16 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, } if (viewport.getAlignment().isNucleotide()) { + conservationMenuItem.setEnabled(false); + clustalColour.setEnabled(false); + BLOSUM62Colour.setEnabled(false); + zappoColour.setEnabled(false); + taylorColour.setEnabled(false); + hydrophobicityColour.setEnabled(false); + helixColour.setEnabled(false); + strandColour.setEnabled(false); + turnColour.setEnabled(false); + buriedColour.setEnabled(false); viewport.updateStrucConsensus(alignPanel); if (viewport.getAlignment().hasRNAStructure()) { @@ -296,6 +309,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, { RNAHelixColour.setEnabled(false); purinePyrimidineColour.setEnabled(false); + nucleotideColour.setEnabled(false); } // Some JVMS send keyevents to Top frame or lowest panel, // Havent worked out why yet. So add to both this frame and seqCanvas for @@ -1255,7 +1269,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, // } else if (source == RNAHelixColour) { - new RNAHelicesColourChooser(viewport, alignPanel); + changeColour(new RNAHelicesColour(viewport.getAlignment())); + // new RNAHelicesColourChooser(viewport, alignPanel); } else if (source == modifyPID) { @@ -1362,7 +1377,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, "label.alignment_output_command", new Object[] { e.getActionCommand() }), 600, 500); - FileFormat fileFormat = FileFormat.valueOf(e.getActionCommand()); + FileFormatI fileFormat = FileFormats.getInstance().forName( + e.getActionCommand()); cap.setText(new AppletFormatAdapter(alignPanel).formatSequences( fileFormat, viewport.getAlignment(), viewport.getShowJVSuffix())); @@ -2626,26 +2642,6 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, @Override public void changeColour(ColourSchemeI cs) { - - if (cs != null) - { - if (viewport.getAbovePIDThreshold()) - { - viewport.setThreshold(SliderPanel.setPIDSliderSource(alignPanel, - cs, "Background")); - } - - if (viewport.getConservationSelected()) - { - cs.setConservationApplied(true); - viewport.setIncrement(SliderPanel.setConservationSlider(alignPanel, - cs, "Background")); - } - else - { - cs.setConservationApplied(false); - } - } viewport.setGlobalColourScheme(cs); alignPanel.paintAlignment(true); @@ -2657,7 +2653,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, && viewport.getGlobalColourScheme() != null) { SliderPanel.setPIDSliderSource(alignPanel, - viewport.getGlobalColourScheme(), "Background"); + viewport.getResidueShading(), alignPanel.getViewName()); SliderPanel.showPIDSlider(); } } @@ -2668,33 +2664,50 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, && viewport.getGlobalColourScheme() != null) { SliderPanel.setConservationSlider(alignPanel, - viewport.getGlobalColourScheme(), "Background"); + viewport.getResidueShading(), alignPanel.getViewName()); SliderPanel.showConservationSlider(); } } protected void conservationMenuItem_actionPerformed() { - viewport.setConservationSelected(conservationMenuItem.getState()); + boolean selected = conservationMenuItem.getState(); + modifyConservation.setEnabled(selected); + viewport.setConservationSelected(selected); - viewport.setAbovePIDThreshold(false); - abovePIDThreshold.setState(false); + // viewport.setAbovePIDThreshold(false); + // abovePIDThreshold.setState(false); changeColour(viewport.getGlobalColourScheme()); - modifyConservation_actionPerformed(); + if (selected) + { + modifyConservation_actionPerformed(); + } + else + { + SliderPanel.hideConservationSlider(); + } } public void abovePIDThreshold_actionPerformed() { - viewport.setAbovePIDThreshold(abovePIDThreshold.getState()); - - conservationMenuItem.setState(false); - viewport.setConservationSelected(false); + boolean selected = abovePIDThreshold.getState(); + modifyPID.setEnabled(selected); + viewport.setAbovePIDThreshold(selected); + // conservationMenuItem.setState(false); + // viewport.setConservationSelected(false); changeColour(viewport.getGlobalColourScheme()); - modifyPID_actionPerformed(); + if (selected) + { + modifyPID_actionPerformed(); + } + else + { + SliderPanel.hidePIDSlider(); + } } public void sortPairwiseMenuItem_actionPerformed() @@ -2793,22 +2806,26 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, public void averageDistanceTreeMenuItem_actionPerformed() { - NewTreePanel("AV", "PID", "Average distance tree using PID"); + NewTreePanel(NJTree.AVERAGE_DISTANCE, "PID", + "Average distance tree using PID"); } public void neighbourTreeMenuItem_actionPerformed() { - NewTreePanel("NJ", "PID", "Neighbour joining tree using PID"); + NewTreePanel(NJTree.NEIGHBOUR_JOINING, "PID", + "Neighbour joining tree using PID"); } protected void njTreeBlosumMenuItem_actionPerformed() { - NewTreePanel("NJ", "BL", "Neighbour joining tree using BLOSUM62"); + NewTreePanel(NJTree.NEIGHBOUR_JOINING, "BL", + "Neighbour joining tree using BLOSUM62"); } protected void avTreeBlosumMenuItem_actionPerformed() { - NewTreePanel("AV", "BL", "Average distance tree using BLOSUM62"); + NewTreePanel(NJTree.AVERAGE_DISTANCE, "BL", + "Average distance tree using BLOSUM62"); } void NewTreePanel(String type, String pwType, String title) @@ -3239,7 +3256,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, inputText.addActionListener(this); Menu outputTextboxMenu = new Menu( MessageManager.getString("label.out_to_textbox")); - for (String ff : FileFormat.getWritableFormats(true)) + for (String ff : FileFormats.getInstance().getWritableFormats(true)) { MenuItem item = new MenuItem(ff); @@ -3439,7 +3456,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, .getString("label.colour_text")); colourTextMenuItem.addItemListener(this); displayNonconservedMenuItem.setLabel(MessageManager - .getString("label.show_non_conversed")); + .getString("label.show_non_conserved")); displayNonconservedMenuItem.addItemListener(this); wrapMenuItem.setLabel(MessageManager.getString("action.wrap")); wrapMenuItem.addItemListener(this); @@ -3462,45 +3479,50 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, .getString("label.apply_colour_to_all_groups")); applyToAllGroups.setState(true); applyToAllGroups.addItemListener(this); - clustalColour.setLabel(MessageManager.getString("label.clustalx")); + clustalColour.setLabel(MessageManager + .getString("label.colourScheme_clustal")); clustalColour.addActionListener(this); - zappoColour.setLabel(MessageManager.getString("label.zappo")); + zappoColour.setLabel(MessageManager + .getString("label.colourScheme_zappo")); zappoColour.addActionListener(this); - taylorColour.setLabel(MessageManager.getString("label.taylor")); + taylorColour.setLabel(MessageManager + .getString("label.colourScheme_taylor")); taylorColour.addActionListener(this); hydrophobicityColour.setLabel(MessageManager - .getString("label.hydrophobicity")); + .getString("label.colourScheme_hydrophobic")); hydrophobicityColour.addActionListener(this); - helixColour - .setLabel(MessageManager.getString("label.helix_propensity")); + helixColour.setLabel(MessageManager + .getString("label.colourScheme_helix_propensity")); helixColour.addActionListener(this); strandColour.setLabel(MessageManager - .getString("label.strand_propensity")); + .getString("label.colourScheme_strand_propensity")); strandColour.addActionListener(this); - turnColour.setLabel(MessageManager.getString("label.turn_propensity")); + turnColour.setLabel(MessageManager + .getString("label.colourScheme_turn_propensity")); turnColour.addActionListener(this); - buriedColour.setLabel(MessageManager.getString("label.buried_index")); + buriedColour.setLabel(MessageManager + .getString("label.colourScheme_buried_index")); buriedColour.addActionListener(this); purinePyrimidineColour.setLabel(MessageManager - .getString("label.purine_pyrimidine")); + .getString("label.colourScheme_purine/pyrimidine")); purinePyrimidineColour.addActionListener(this); // RNAInteractionColour.setLabel(MessageManager // .getString("label.rna_interaction")); // RNAInteractionColour.addActionListener(this); RNAHelixColour.setLabel(MessageManager - .getString("action.by_rna_helixes")); + .getString("label.colourScheme_rna_helices")); RNAHelixColour.addActionListener(this); userDefinedColour.setLabel(MessageManager .getString("action.user_defined")); userDefinedColour.addActionListener(this); PIDColour.setLabel(MessageManager - .getString("label.percentage_identity")); + .getString("label.colourScheme_%_identity")); PIDColour.addActionListener(this); BLOSUM62Colour.setLabel(MessageManager - .getString("label.blosum62_score")); + .getString("label.colourScheme_blosum62")); BLOSUM62Colour.addActionListener(this); - tcoffeeColour - .setLabel(MessageManager.getString("label.tcoffee_scores")); + tcoffeeColour.setLabel(MessageManager + .getString("label.colourScheme_t-coffee_scores")); // it will be enabled only if a score file is provided tcoffeeColour.setEnabled(false); tcoffeeColour.addActionListener(this); @@ -3512,13 +3534,16 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, abovePIDThreshold.setLabel(MessageManager .getString("label.above_identity_threshold")); abovePIDThreshold.addItemListener(this); - nucleotideColour.setLabel(MessageManager.getString("label.nucleotide")); + nucleotideColour.setLabel(MessageManager + .getString("label.colourScheme_nucleotide")); nucleotideColour.addActionListener(this); modifyPID.setLabel(MessageManager .getString("label.modify_identity_threshold")); + modifyPID.setEnabled(abovePIDThreshold.getState()); modifyPID.addActionListener(this); modifyConservation.setLabel(MessageManager .getString("label.modify_conservation_threshold")); + modifyConservation.setEnabled(conservationMenuItem.getState()); modifyConservation.addActionListener(this); annotationColour.setLabel(MessageManager .getString("action.by_annotation")); @@ -3552,7 +3577,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, .getString("label.neighbour_joining_identity")); neighbourTreeMenuItem.addActionListener(this); avDistanceTreeBlosumMenuItem.setLabel(MessageManager - .getString("label.average_distance_bloslum62")); + .getString("label.average_distance_blosum62")); avDistanceTreeBlosumMenuItem.addActionListener(this); njTreeBlosumMenuItem.setLabel(MessageManager .getString("label.neighbour_blosum62"));