X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FFeatureTypeSettings.java;h=200911d7df77430fb0a7a5742266613616fe300e;hb=da98b580a62f583db2e12c8910e6d68862c22623;hp=735e514530d60344e4581bbf8327faae8afc0929;hpb=370ddb214bd5c3fb7bd5ae9e68be1a0db45e263c;p=jalview.git diff --git a/src/jalview/gui/FeatureTypeSettings.java b/src/jalview/gui/FeatureTypeSettings.java index 735e514..200911d 100644 --- a/src/jalview/gui/FeatureTypeSettings.java +++ b/src/jalview/gui/FeatureTypeSettings.java @@ -20,8 +20,10 @@ */ package jalview.gui; +import jalview.api.AlignViewportI; import jalview.api.AlignmentViewPanel; import jalview.api.FeatureColourI; +import jalview.bin.Cache; import jalview.datamodel.GraphLine; import jalview.datamodel.features.FeatureAttributes; import jalview.datamodel.features.FeatureAttributes.Datatype; @@ -164,7 +166,7 @@ public class FeatureTypeSettings extends JalviewDialog JPanel maxColour = new JPanel(); - private JComboBox threshold = new JComboBox<>(); + private JComboBox threshold = new JComboBox<>(); JSlider slider = new JSlider(); @@ -181,17 +183,17 @@ public class FeatureTypeSettings extends JalviewDialog /* * choice of option for 'colour for no value' */ - private JComboBox noValueCombo; + private JComboBox noValueCombo; /* * choice of what to colour by text (Label or attribute) */ - private JComboBox colourByTextCombo; + private JComboBox colourByTextCombo; /* * choice of what to colour by range (Score or attribute) */ - private JComboBox colourByRangeCombo; + private JComboBox colourByRangeCombo; private JRadioButton andFilters; @@ -675,7 +677,7 @@ public class FeatureTypeSettings extends JalviewDialog */ if (ap != null) { - ap.paintAlignment(true, true); + refreshDisplay(true); } } }); @@ -891,7 +893,7 @@ public class FeatureTypeSettings extends JalviewDialog * save the colour, and repaint stuff */ fr.setColour(featureType, acg); - ap.paintAlignment(updateStructsAndOverview, updateStructsAndOverview); + refreshDisplay(updateStructsAndOverview); updateColoursPanel(); } @@ -1030,7 +1032,7 @@ public class FeatureTypeSettings extends JalviewDialog { fr.setColour(featureType, originalColour); fr.setFeatureFilter(featureType, originalFilter); - ap.paintAlignment(true, true); + refreshDisplay(true); } /** @@ -1121,7 +1123,7 @@ public class FeatureTypeSettings extends JalviewDialog * @param withRange * @param withText */ - protected JComboBox populateAttributesDropdown( + protected JComboBox populateAttributesDropdown( List attNames, boolean withRange, boolean withText) { List displayAtts = new ArrayList<>(); @@ -1160,9 +1162,11 @@ public class FeatureTypeSettings extends JalviewDialog tooltips.add(desc == null ? "" : desc); } - JComboBox attCombo = JvSwingUtils - .buildComboWithTooltips(displayAtts, tooltips); - + // now convert String List to Object List for buildComboWithTooltips + List displayAttsObjects = new ArrayList<>(displayAtts); + JComboBox attCombo = JvSwingUtils + .buildComboWithTooltips(displayAttsObjects, tooltips); + return attCombo; } @@ -1340,8 +1344,8 @@ public class FeatureTypeSettings extends JalviewDialog * drop-down choice of attribute, with description as a tooltip * if we can obtain it */ - JComboBox attCombo = populateAttributesDropdown(attNames, true, - true); + final JComboBox attCombo = populateAttributesDropdown(attNames, + true, true); String filterBy = setSelectedAttribute(attCombo, filter); JComboBox condCombo = new JComboBox<>(); @@ -1442,12 +1446,13 @@ public class FeatureTypeSettings extends JalviewDialog if (!patternField.isEnabled() || (pattern != null && pattern.trim().length() > 0)) { - JButton removeCondition = new JButton("\u2717"); // Dingbats cursive x + JButton removeCondition = new JButton("\u2717"); + // Dingbats cursive x removeCondition.setBorder(new EmptyBorder(0, 0, 0, 0)); removeCondition.setBackground(Color.WHITE); removeCondition.setPreferredSize(new Dimension(23, 17)); - removeCondition - .setToolTipText(MessageManager.getString("label.delete_row")); + removeCondition.setToolTipText( + MessageManager.getString("label.delete_condition")); removeCondition.addActionListener(new ActionListener() { @Override @@ -1470,7 +1475,7 @@ public class FeatureTypeSettings extends JalviewDialog * @param attCombo * @param filter */ - private String setSelectedAttribute(JComboBox attCombo, + private String setSelectedAttribute(JComboBox attCombo, FeatureMatcherI filter) { String item = null; @@ -1687,11 +1692,19 @@ public class FeatureTypeSettings extends JalviewDialog * @param valueField * @param filterIndex */ - protected boolean updateFilter(JComboBox attCombo, + protected boolean updateFilter(JComboBox attCombo, JComboBox condCombo, JTextField valueField, int filterIndex) { - String attName = (String) attCombo.getSelectedItem(); + String attName; + try + { + attName = (String) attCombo.getSelectedItem(); + } catch (Exception e) + { + Cache.log.error("Problem casting Combo box entry to String"); + attName = attCombo.getSelectedItem().toString(); + } Condition cond = (Condition) condCombo.getSelectedItem(); String pattern = valueField.getText().trim(); @@ -1768,8 +1781,26 @@ public class FeatureTypeSettings extends JalviewDialog * (note this might now be an empty filter with no conditions) */ fr.setFeatureFilter(featureType, combined.isEmpty() ? null : combined); - ap.paintAlignment(true, true); + refreshDisplay(true); updateFiltersPanel(); } + + /** + * Repaints alignment, structure and overview (if shown). If there is a + * complementary view which is showing this view's features, then also + * repaints that. + * + * @param updateStructsAndOverview + */ + void refreshDisplay(boolean updateStructsAndOverview) + { + ap.paintAlignment(true, updateStructsAndOverview); + AlignViewportI complement = ap.getAlignViewport().getCodingComplement(); + if (complement != null && complement.isShowComplementFeatures()) + { + AlignFrame af2 = Desktop.getAlignFrameFor(complement); + af2.alignPanel.paintAlignment(true, updateStructsAndOverview); + } + } }