X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FFeatureSettings.java;h=489cbb145d0bf7941f320502430479403782f43a;hb=5a352aa2f3330ae269d9b70c4a7374c2518bfb2e;hp=20d4d7453dcd0d026c9946bd2dc14928703b82df;hpb=f4766a7bbcfae845fc95923b01fa14ff83d589ff;p=jalview.git diff --git a/src/jalview/appletgui/FeatureSettings.java b/src/jalview/appletgui/FeatureSettings.java index 20d4d74..489cbb1 100755 --- a/src/jalview/appletgui/FeatureSettings.java +++ b/src/jalview/appletgui/FeatureSettings.java @@ -25,6 +25,7 @@ import jalview.api.FeatureSettingsControllerI; import jalview.datamodel.AlignmentI; import jalview.datamodel.SequenceI; import jalview.util.MessageManager; +import jalview.viewmodel.seqfeatures.FeatureRendererModel.FeatureSettingsBean; import java.awt.BorderLayout; import java.awt.Button; @@ -65,7 +66,7 @@ import java.util.Set; public class FeatureSettings extends Panel implements ItemListener, MouseListener, MouseMotionListener, - ActionListener, AdjustmentListener, FeatureSettingsControllerI + AdjustmentListener, FeatureSettingsControllerI { FeatureRenderer fr; @@ -120,8 +121,17 @@ public class FeatureSettings extends Panel add(scrollPane, BorderLayout.CENTER); } - Button invert = new Button("Invert Selection"); - invert.addActionListener(this); + Button invert = new Button( + MessageManager.getString("label.invert_selection")); + invert.addActionListener(new ActionListener() + { + + @Override + public void actionPerformed(ActionEvent e) + { + invertSelection(); + } + }); Panel lowerPanel = new Panel(new GridLayout(2, 1, 5, 10)); lowerPanel.add(invert); @@ -377,8 +387,8 @@ public class FeatureSettings extends Panel // Group selection states void resetTable(boolean groupsChanged) { - List displayableTypes = new ArrayList(); - Set foundGroups = new HashSet(); + List displayableTypes = new ArrayList<>(); + Set foundGroups = new HashSet<>(); AlignmentI alignment = av.getAlignment(); @@ -391,7 +401,7 @@ public class FeatureSettings extends Panel * and keep track of which groups are visible */ Set groups = seq.getFeatures().getFeatureGroups(true); - Set visibleGroups = new HashSet(); + Set visibleGroups = new HashSet<>(); for (String group : groups) { // if (group == null || fr.checkGroupVisibility(group, true)) @@ -545,8 +555,7 @@ public class FeatureSettings extends Panel } } - @Override - public void actionPerformed(ActionEvent evt) + protected void invertSelection() { for (int i = 0; i < featurePanel.getComponentCount(); i++) { @@ -583,24 +592,21 @@ public class FeatureSettings extends Panel { Component[] comps = featurePanel.getComponents(); int cSize = comps.length; - - Object[][] tmp = new Object[cSize][3]; - int tmpSize = 0; - for (int i = 0; i < cSize; i++) - { - MyCheckbox check = (MyCheckbox) comps[i]; - tmp[tmpSize][0] = check.type; - tmp[tmpSize][1] = fr.getFeatureStyle(check.type); - tmp[tmpSize][2] = new Boolean(check.getState()); - tmpSize++; + FeatureSettingsBean[] rowData = new FeatureSettingsBean[cSize]; + int i = 0; + for (Component comp : comps) + { + MyCheckbox check = (MyCheckbox) comp; + // feature filter set to null as not (yet) offered in applet + FeatureColourI colour = fr.getFeatureStyle(check.type); + rowData[i] = new FeatureSettingsBean(check.type, colour, null, + check.getState()); + i++; } - Object[][] data = new Object[tmpSize][3]; - System.arraycopy(tmp, 0, data, 0, tmpSize); - - fr.setFeaturePriority(data); + fr.setFeaturePriority(rowData); - ap.paintAlignment(updateOverview); + ap.paintAlignment(updateOverview, updateOverview); } MyCheckbox selectedCheck; @@ -680,7 +686,7 @@ public class FeatureSettings extends Panel { featurePanel.removeAll(); resetTable(false); - ap.paintAlignment(true); + ap.paintAlignment(true, true); } @Override @@ -697,7 +703,7 @@ public class FeatureSettings extends Panel public void mouseClicked(MouseEvent evt) { MyCheckbox check = (MyCheckbox) evt.getSource(); - if ((evt.getModifiers() & InputEvent.BUTTON3_MASK) != 0) + if ((evt.getModifiersEx() & InputEvent.BUTTON3_DOWN_MASK) != 0) { this.popupSort(check, fr.getMinMax(), evt.getX(), evt.getY()); } @@ -732,7 +738,7 @@ public class FeatureSettings extends Panel public void adjustmentValueChanged(AdjustmentEvent evt) { fr.setTransparency((100 - transparency.getValue()) / 100f); - ap.paintAlignment(true); + ap.paintAlignment(true, true); } class MyCheckbox extends Checkbox