From: gmungoc Date: Thu, 30 Mar 2017 10:01:08 +0000 (+0100) Subject: Merge branch 'develop' into bug/JAL-2346annotationChoice X-Git-Tag: Release_2_10_3b1~336^2~2^2~1^2~2^2~3 X-Git-Url: http://source.jalview.org/gitweb/?p=jalview.git;a=commitdiff_plain;h=d5bcc3830eab04e6db816e1c2ad8fce1dc189612 Merge branch 'develop' into bug/JAL-2346annotationChoice Conflicts: src/jalview/gui/AnnotationRowFilter.java --- d5bcc3830eab04e6db816e1c2ad8fce1dc189612 diff --cc src/jalview/gui/AnnotationRowFilter.java index bc5bc54,7705bc3..c2bf41b --- a/src/jalview/gui/AnnotationRowFilter.java +++ b/src/jalview/gui/AnnotationRowFilter.java @@@ -78,38 -83,6 +78,38 @@@ public abstract class AnnotationRowFilt */ protected boolean sliderDragging = false; + protected JComboBox threshold = new JComboBox(); + + protected JComboBox annotations; + + /* + * map from annotation to its menu item display label + * - so we know which item to pre-select on restore + */ + private Map annotationLabels; + + private AlignmentAnnotation currentAnnotation; + + /** + * Constructor + * - * @param av - * @param ap ++ * @param viewport ++ * @param alignPanel + */ - public AnnotationRowFilter(AlignViewport av, final AlignmentPanel ap) ++ public AnnotationRowFilter(AlignViewport viewport, final AlignmentPanel alignPanel) + { - this.av = av; - this.ap = ap; ++ this.av = viewport; ++ this.ap = alignPanel; + thresholdValue.addFocusListener(new FocusAdapter() + { + @Override + public void focusLost(FocusEvent e) + { + thresholdValue_actionPerformed(); + } + }); + } + protected void addSliderChangeListener() { @@@ -159,18 -132,27 +159,18 @@@ }); } - /** - * Builds and returns a list of menu items (display text) for choice of - * annotation. Also builds maps between annotations, their positions in the - * list, and their display labels in the list. - * - * @param isSeqAssociated - * @return - */ - public AnnotationRowFilter(AlignViewport av, final AlignmentPanel ap) - { - this.av = av; - this.ap = ap; - thresholdValue.addFocusListener(new FocusAdapter() - { - @Override - public void focusLost(FocusEvent e) - { - thresholdValue_actionPerformed(); - } - }); - } - - public AnnotationRowFilter() - { - - } - ++/** ++ * Builds and returns a list of menu items (display text) for choice of ++ * annotation. Also builds maps between annotations, their positions in the ++ * list, and their display labels in the list. ++ * ++ * @param isSeqAssociated ++ * @return ++ */ public Vector getAnnotationItems(boolean isSeqAssociated) { + annotationLabels = new HashMap(); + Vector list = new Vector(); int index = 1; int[] anmap = new int[av.getAlignment().getAlignmentAnnotation().length]; @@@ -363,107 -339,76 +363,107 @@@ } } - protected boolean colorAlignmContaining(AlignmentAnnotation currentAnn, - int selectedThresholdOption) + public AlignmentAnnotation getCurrentAnnotation() { + return currentAnnotation; + } - protected void setCurrentAnnotation(AlignmentAnnotation currentAnnotation) - AnnotationColourGradient acg = null; - if (currentColours.isSelected()) - { - acg = new AnnotationColourGradient(currentAnn, - av.getGlobalColourScheme(), selectedThresholdOption); - } - else - { - acg = new AnnotationColourGradient(currentAnn, - minColour.getBackground(), maxColour.getBackground(), - selectedThresholdOption); - } - acg.setSeqAssociated(seqAssociated.isSelected()); ++ protected void setCurrentAnnotation(AlignmentAnnotation annotation) + { - this.currentAnnotation = currentAnnotation; ++ this.currentAnnotation = annotation; + } - if (currentAnn.graphMin == 0f && currentAnn.graphMax == 0f) - { - acg.setPredefinedColours(true); - } + protected abstract void valueChanged(boolean updateAllAnnotation); - acg.thresholdIsMinMax = thresholdIsMin.isSelected(); + protected abstract void updateView(); - av.setGlobalColourScheme(acg); + protected abstract void reset(); - if (av.getAlignment().getGroups() != null) + protected String getAnnotationMenuLabel(AlignmentAnnotation ann) + { + return annotationLabels.get(ann); + } + + protected void jbInit() + { + ok.setOpaque(false); + ok.setText(MessageManager.getString("action.ok")); + ok.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) + { + ok_actionPerformed(); + } + }); - for (SequenceGroup sg : ap.av.getAlignment().getGroups()) + cancel.setOpaque(false); + cancel.setText(MessageManager.getString("action.cancel")); + cancel.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) { - if (sg.cs == null) - { - continue; - } + cancel_actionPerformed(); + } + }); - AnnotationColourGradient scheme = null; - if (currentColours.isSelected()) - { - scheme = new AnnotationColourGradient(currentAnn, - sg.getColourScheme(), selectedThresholdOption); - } - else - { - scheme = new AnnotationColourGradient(currentAnn, - minColour.getBackground(), maxColour.getBackground(), - selectedThresholdOption); - } - scheme.setSeqAssociated(seqAssociated.isSelected()); - sg.setColourScheme(scheme); + annotations.addItemListener(new ItemListener() + { + @Override + public void itemStateChanged(ItemEvent e) + { + selectedAnnotationChanged(); } - } - return false; + }); + annotations.setToolTipText(MessageManager + .getString("info.select_annotation_row")); + + threshold.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + threshold_actionPerformed(); + } + }); + + thresholdValue.setEnabled(false); + thresholdValue.setColumns(7); + thresholdValue.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + thresholdValue_actionPerformed(); + } + }); + + slider.setPaintLabels(false); + slider.setPaintTicks(true); + slider.setBackground(Color.white); + slider.setEnabled(false); + slider.setOpaque(false); + slider.setPreferredSize(new Dimension(100, 32)); } - public jalview.datamodel.AlignmentAnnotation getCurrentAnnotation() + public JComboBox getThreshold() { - return currentAnnotation; + return threshold; } - public void setCurrentAnnotation( - jalview.datamodel.AlignmentAnnotation currentAnnotation) + public void setThreshold(JComboBox thresh) { - this.currentAnnotation = currentAnnotation; + this.threshold = thresh; } - public abstract void valueChanged(boolean updateAllAnnotation); - - public abstract void updateView(); + public JComboBox getAnnotations() + { + return annotations; + } - public abstract void reset(); + public void setAnnotations(JComboBox anns) + { + this.annotations = anns; + } }