From: gmungoc Date: Sun, 3 Jun 2018 07:43:15 +0000 (+0100) Subject: JAL-3010 method extracted for setSubtypesVisibility X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=ca64811a3fd9aedab9153f287a1a4cf4f04ae768;p=jalview.git JAL-3010 method extracted for setSubtypesVisibility --- diff --git a/src/jalview/gui/FeatureSettings.java b/src/jalview/gui/FeatureSettings.java index f645d83..fe905c0 100644 --- a/src/jalview/gui/FeatureSettings.java +++ b/src/jalview/gui/FeatureSettings.java @@ -1361,9 +1361,11 @@ public class FeatureSettings extends JPanel } }); - summaryView = new JCheckBox(MessageManager.getString("summary_view")); + summaryView = new JCheckBox( + MessageManager.getString("label.summary_view")); summaryView - .setToolTipText(MessageManager.getString("summary_view_tip")); + .setToolTipText( + MessageManager.getString("label.summary_view_tip")); summaryView.addActionListener(new ActionListener() { @Override @@ -1738,23 +1740,35 @@ public class FeatureSettings extends JPanel fireTableCellUpdated(row, col); if (summaryView.isSelected() && col == SHOW_COLUMN) { - String type = (String) data[row][TYPE_COLUMN]; - OntologyI so = SequenceOntologyFactory.getInstance(); - for (int r = 0; r < data.length; r++) + setSubtypesVisibility(row, (Boolean) value); + } + updateFeatureRenderer(data); + } + + /** + * Sets the visibility of any feature types which are sub-types of the type + * in the given row of the table + * + * @param row + * @param value + */ + protected void setSubtypesVisibility(int row, Boolean value) + { + String type = (String) data[row][TYPE_COLUMN]; + OntologyI so = SequenceOntologyFactory.getInstance(); + + for (int r = 0; r < data.length; r++) + { + String type2 = (String) data[r][TYPE_COLUMN]; + if (!type2.equals(type)) { - if (r != row) + if (so.isA(type2, type)) { - String type2 = (String) data[r][TYPE_COLUMN]; - if (so.isA(type2, type)) - { - data[r][col] = value; - fireTableCellUpdated(r, col); - } + data[r][SHOW_COLUMN] = value; + fireTableCellUpdated(r, SHOW_COLUMN); } } } - - updateFeatureRenderer(data); } }