X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAnnotationLabels.java;h=445ee11e675f90e28f11df608866c9507070161d;hb=refs%2Fheads%2Ffeatures%2Fhmmer_statistics;hp=ce87c727e51645f1506f65f6fc98dcc3c2903bf8;hpb=96356075a122b745936738f478a8ee33ac7e0f0a;p=jalview.git diff --git a/src/jalview/gui/AnnotationLabels.java b/src/jalview/gui/AnnotationLabels.java index ce87c72..445ee11 100755 --- a/src/jalview/gui/AnnotationLabels.java +++ b/src/jalview/gui/AnnotationLabels.java @@ -74,6 +74,7 @@ public class AnnotationLabels extends JPanel implements MouseListener, private static final Pattern LEFT_ANGLE_BRACKET_PATTERN = Pattern .compile("<"); + String TOGGLE_LABELSCALE = MessageManager .getString("label.scale_label_to_column"); @@ -435,25 +436,14 @@ public class AnnotationLabels extends JPanel implements MouseListener, pop.add(item); } } - else if (label.indexOf("Consensus") > -1 - || label.indexOf("Information Content") > -1) + else if (label.indexOf("Consensus") > -1) { - // identifier for type of histogram and/or logo to be shown - int type = 2; - if (label.indexOf("Consensus") > -1) - { - type = 0; - } - else if (label.indexOf("Information Content") > -1) - { - type = 1; - } + pop.addSeparator(); // av and sequencegroup need to implement same interface for final AlignmentAnnotation aaa = aa[selectedRow]; - if (type == 0) - { + final JCheckBoxMenuItem cbmi = new JCheckBoxMenuItem( MessageManager.getString("label.ignore_gaps_consensus"), (aa[selectedRow].groupRef != null) ? aa[selectedRow].groupRef @@ -480,37 +470,6 @@ public class AnnotationLabels extends JPanel implements MouseListener, } }); pop.add(cbmi); - } - if (type == 1) - { - final JCheckBoxMenuItem cbmi = new JCheckBoxMenuItem( - "Ignore Below Background Frequency", - (aa[selectedRow].groupRef != null) - ? aa[selectedRow].groupRef - .getIgnoreBelowBackground() - : ap.av.isIgnoreBelowBackground()); - - cbmi.addActionListener(new ActionListener() - { - @Override - public void actionPerformed(ActionEvent e) - { - if (aaa.groupRef != null) - { - // TODO: pass on reference to ap so the view can be updated. - aaa.groupRef.setIgnoreBelowBackground(cbmi.getState()); - ap.getAnnotationPanel() - .paint(ap.getAnnotationPanel().getGraphics()); - } - else - { - ap.av.setIgnoreBelowBackground(cbmi.getState(), ap); - } - ap.alignmentChanged(); - } - }); - pop.add(cbmi); - } // av and sequencegroup need to implement same interface for if (aaa.groupRef != null) { @@ -649,6 +608,178 @@ public class AnnotationLabels extends JPanel implements MouseListener, consclipbrd.addActionListener(this); pop.add(consclipbrd); } + else if (label.indexOf("Information Content") > -1) // TODO create labels + // in message resource + // for these + { + pop.addSeparator(); + final AlignmentAnnotation aaa = aa[selectedRow]; + + final JCheckBoxMenuItem cbmi = new JCheckBoxMenuItem( + "Ignore Below Background Frequency", + (aa[selectedRow].groupRef != null) + ? aa[selectedRow].groupRef + .getIgnoreBelowBackground() + : ap.av.isIgnoreBelowBackground()); + + cbmi.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + if (aaa.groupRef != null) + { + // TODO: pass on reference to ap so the view can be updated. + aaa.groupRef.setIgnoreBelowBackground(cbmi.getState()); + ap.getAnnotationPanel() + .paint(ap.getAnnotationPanel().getGraphics()); + } + else + { + ap.av.setIgnoreBelowBackground(cbmi.getState(), ap); + } + ap.alignmentChanged(); + } + }); + pop.add(cbmi); + if (aaa.groupRef != null) + { + final JCheckBoxMenuItem chist = new JCheckBoxMenuItem( + MessageManager.getString("label.show_group_histogram"), + aa[selectedRow].groupRef.isShowInformationHistogram()); + chist.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + // TODO: pass on reference + // to ap + // so the + // view + // can be + // updated. + aaa.groupRef.setShowInformationHistogram(chist.getState()); + ap.repaint(); + // ap.annotationPanel.paint(ap.annotationPanel.getGraphics()); + } + }); + pop.add(chist); + final JCheckBoxMenuItem cprofl = new JCheckBoxMenuItem( + MessageManager.getString("label.show_group_logo"), + aa[selectedRow].groupRef.isShowHMMSequenceLogo()); + cprofl.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + // TODO: pass on reference + // to ap + // so the + // view + // can be + // updated. + aaa.groupRef.setshowHMMSequenceLogo(cprofl.getState()); + ap.repaint(); + // ap.annotationPanel.paint(ap.annotationPanel.getGraphics()); + } + }); + pop.add(cprofl); + final JCheckBoxMenuItem cproflnorm = new JCheckBoxMenuItem( + MessageManager.getString("label.normalise_group_logo"), + aa[selectedRow].groupRef.isNormaliseHMMSequenceLogo()); + cproflnorm.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + + // TODO: pass on reference + // to ap + // so the + // view + // can be + // updated. + aaa.groupRef + .setNormaliseHMMSequenceLogo(cproflnorm.getState()); + // automatically enable logo display if we're clicked + aaa.groupRef.setshowHMMSequenceLogo(true); + ap.repaint(); + // ap.annotationPanel.paint(ap.annotationPanel.getGraphics()); + } + }); + pop.add(cproflnorm); + } + else + { + final JCheckBoxMenuItem chist = new JCheckBoxMenuItem( + MessageManager.getString("label.show_histogram"), + av.isShowInformationHistogram()); + chist.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + // TODO: pass on reference + // to ap + // so the + // view + // can be + // updated. + av.setShowInformationHistogram(chist.getState()); + ap.alignFrame.setMenusForViewport(); + ap.repaint(); + // ap.annotationPanel.paint(ap.annotationPanel.getGraphics()); + } + }); + pop.add(chist); + final JCheckBoxMenuItem cprof = new JCheckBoxMenuItem( + MessageManager.getString("label.show_logo"), + av.isShowHMMSequenceLogo()); + cprof.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + // TODO: pass on reference + // to ap + // so the + // view + // can be + // updated. + av.setShowHMMSequenceLogo(cprof.getState()); + ap.alignFrame.setMenusForViewport(); + ap.repaint(); + // ap.annotationPanel.paint(ap.annotationPanel.getGraphics()); + } + }); + pop.add(cprof); + final JCheckBoxMenuItem cprofnorm = new JCheckBoxMenuItem( + MessageManager.getString("label.normalise_logo"), + av.isNormaliseHMMSequenceLogo()); + cprofnorm.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + // TODO: pass on reference + // to ap + // so the + // view + // can be + // updated. + av.setShowHMMSequenceLogo(true); + av.setNormaliseHMMSequenceLogo(cprofnorm.getState()); + ap.alignFrame.setMenusForViewport(); + ap.repaint(); + // ap.annotationPanel.paint(ap.annotationPanel.getGraphics()); + } + }); + pop.add(cprofnorm); + } + final JMenuItem consclipbrd = new JMenuItem(COPYCONS_SEQ); + consclipbrd.addActionListener(this); + pop.add(consclipbrd); + } } pop.show(this, evt.getX(), evt.getY()); }