From: Jim Procter Date: Thu, 12 Oct 2017 16:40:50 +0000 (+0100) Subject: JAL-2773 add new flag to paintAlignment(updateOverview,updateStructures) and first... X-Git-Tag: Release_2_10_3b1~109^2~1 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=106a3890f956e2aa7780b2985f4326655912a558;p=jalview.git JAL-2773 add new flag to paintAlignment(updateOverview,updateStructures) and first pass at limiting updates of structure to just those that are necessary. --- diff --git a/src/jalview/api/AlignmentViewPanel.java b/src/jalview/api/AlignmentViewPanel.java index ef59996..0b1ca21 100644 --- a/src/jalview/api/AlignmentViewPanel.java +++ b/src/jalview/api/AlignmentViewPanel.java @@ -43,9 +43,10 @@ public interface AlignmentViewPanel extends OOMHandlerI * * @param updateOverview * - if true, the overview panel will also be updated and repainted + * @param updateStructures + * - if true then any linked structure views will also be updated */ - - void paintAlignment(boolean updateOverview); + void paintAlignment(boolean updateOverview, boolean updateStructures); /** * automatically adjust annotation panel height for new annotation whilst diff --git a/src/jalview/appletgui/APopupMenu.java b/src/jalview/appletgui/APopupMenu.java index 9d44479..46bd4fd 100644 --- a/src/jalview/appletgui/APopupMenu.java +++ b/src/jalview/appletgui/APopupMenu.java @@ -383,7 +383,7 @@ public class APopupMenu extends java.awt.PopupMenu void addFeatureLinks(final SequenceI seq, List links) { Menu linkMenu = new Menu(MessageManager.getString("action.link")); - Map> linkset = new LinkedHashMap>(); + Map> linkset = new LinkedHashMap<>(); for (String link : links) { @@ -485,8 +485,8 @@ public class APopupMenu extends java.awt.PopupMenu * Temporary store to hold distinct calcId / type pairs for the tooltip. * Using TreeMap means calcIds are shown in alphabetical order. */ - SortedMap tipEntries = new TreeMap(); - final Map> candidates = new LinkedHashMap>(); + SortedMap tipEntries = new TreeMap<>(); + final Map> candidates = new LinkedHashMap<>(); AlignmentI al = this.ap.av.getAlignment(); AlignmentUtils.findAddableReferenceAnnotations(forSequences, tipEntries, candidates, al); @@ -825,8 +825,8 @@ public class APopupMenu extends java.awt.PopupMenu } int gSize = sg.getSize(); - List seqs = new ArrayList(); - List features = new ArrayList(); + List seqs = new ArrayList<>(); + List features = new ArrayList<>(); for (int i = 0; i < gSize; i++) { @@ -930,7 +930,7 @@ public class APopupMenu extends java.awt.PopupMenu { seq.setName(dialog.getName()); seq.setDescription(dialog.getDescription()); - ap.paintAlignment(false); + ap.paintAlignment(false, false); } } @@ -1163,7 +1163,7 @@ public class APopupMenu extends java.awt.PopupMenu void refresh() { - ap.paintAlignment(true); + ap.paintAlignment(true, true); } protected void clustalColour_actionPerformed() @@ -1339,7 +1339,7 @@ public class APopupMenu extends java.awt.PopupMenu SequenceGroup sg = ap.av.getSelectionGroup(); ap.av.getAlignment().deleteGroup(sg); ap.av.setSelectionGroup(null); - ap.paintAlignment(true); + ap.paintAlignment(true, true); } void createGroupMenuItem_actionPerformed() @@ -1440,8 +1440,8 @@ public class APopupMenu extends java.awt.PopupMenu * the insertion order, which is the order of the annotations on the * alignment. */ - Map>> shownTypes = new LinkedHashMap>>(); - Map>> hiddenTypes = new LinkedHashMap>>(); + Map>> shownTypes = new LinkedHashMap<>(); + Map>> hiddenTypes = new LinkedHashMap<>(); AlignmentAnnotationUtils.getShownHiddenTypes(shownTypes, hiddenTypes, AlignmentAnnotationUtils.asList(annotations), forSequences); diff --git a/src/jalview/appletgui/AlignFrame.java b/src/jalview/appletgui/AlignFrame.java index ed04a0a..676d3cf 100644 --- a/src/jalview/appletgui/AlignFrame.java +++ b/src/jalview/appletgui/AlignFrame.java @@ -343,7 +343,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, createAlignFrameWindow(embedded); validate(); alignPanel.adjustAnnotationHeight(); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(true, true); } public AlignViewport getAlignViewport() @@ -415,7 +415,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, { viewport.featureSettings.refreshTable(); } - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(true, true); statusBar.setText(MessageManager .getString("label.successfully_added_features_alignment")); } @@ -691,7 +691,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, break; } - alignPanel.paintAlignment(true); + // TODO: repaint flags set only if the keystroke warrants it + alignPanel.paintAlignment(true, true); } /** @@ -917,7 +918,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, { applyAutoAnnotationSettings_actionPerformed(); } - alignPanel.paintAlignment(true); + // TODO: repaint flags set only if warranted + alignPanel.paintAlignment(true, true); } /** @@ -1094,7 +1096,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, else if (source == invertColSel) { viewport.invertColumnSelection(); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(false, false); viewport.sendSelection(); } else if (source == remove2LeftMenuItem) @@ -1128,34 +1130,34 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, else if (source == showColumns) { viewport.showAllHiddenColumns(); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(true, true); viewport.sendSelection(); } else if (source == showSeqs) { viewport.showAllHiddenSeqs(); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(true, true); // uncomment if we want to slave sequence selections in split frame // viewport.sendSelection(); } else if (source == hideColumns) { viewport.hideSelectedColumns(); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(true, true); viewport.sendSelection(); } else if (source == hideSequences && viewport.getSelectionGroup() != null) { viewport.hideAllSelectedSeqs(); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(true, true); // uncomment if we want to slave sequence selections in split frame // viewport.sendSelection(); } else if (source == hideAllButSelection) { toggleHiddenRegions(false, false); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(true, true); viewport.sendSelection(); } else if (source == hideAllSelection) @@ -1164,14 +1166,14 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, viewport.expandColSelection(sg, false); viewport.hideAllSelectedSeqs(); viewport.hideSelectedColumns(); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(true, true); viewport.sendSelection(); } else if (source == showAllHidden) { viewport.showAllHiddenColumns(); viewport.showAllHiddenSeqs(); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(true, true); viewport.sendSelection(); } else if (source == showGroupConsensus) @@ -1781,7 +1783,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, } viewport.getAlignment().moveSelectedSequencesByOne(sg, up ? null : viewport.getHiddenRepSequences(), up); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(true, false); /* * Also move cDNA/protein complement sequences @@ -1793,7 +1795,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, viewport, complement); complement.getAlignment().moveSelectedSequencesByOne(mappedSelection, up ? null : complement.getHiddenRepSequences(), up); - getSplitFrame().getComplement(this).alignPanel.paintAlignment(true); + getSplitFrame().getComplement(this).alignPanel.paintAlignment(true, + false); } } @@ -2226,7 +2229,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, { PaintRefresher.Refresh(this, viewport.getSequenceSetId()); alignPanel.updateAnnotation(); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(true, true); } } @@ -2263,7 +2266,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, // JAL-2034 - should delegate to // alignPanel to decide if overview needs // updating. - alignPanel.paintAlignment(false); + alignPanel.paintAlignment(false, false); PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId()); viewport.sendSelection(); } @@ -2283,7 +2286,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, // JAL-2034 - should delegate to // alignPanel to decide if overview needs // updating. - alignPanel.paintAlignment(false); + alignPanel.paintAlignment(false, false); PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId()); viewport.sendSelection(); } @@ -2303,7 +2306,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, public void invertColSel_actionPerformed() { viewport.invertColumnSelection(); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(true, false); PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId()); viewport.sendSelection(); } @@ -2595,19 +2598,19 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, { viewport.setShowJVSuffix(seqLimits.getState()); alignPanel.fontChanged(); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(true, false); } protected void colourTextMenuItem_actionPerformed() { viewport.setColourText(colourTextMenuItem.getState()); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(false, false); } protected void displayNonconservedMenuItem_actionPerformed() { viewport.setShowUnconserved(displayNonconservedMenuItem.getState()); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(false, false); } protected void wrapMenuItem_actionPerformed() @@ -2617,7 +2620,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, scaleAbove.setEnabled(wrapMenuItem.getState()); scaleLeft.setEnabled(wrapMenuItem.getState()); scaleRight.setEnabled(wrapMenuItem.getState()); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(true, false); } public void overviewMenuItem_actionPerformed() @@ -2660,7 +2663,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, { viewport.setGlobalColourScheme(cs); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(true, true); } protected void modifyPID_actionPerformed() @@ -2735,7 +2738,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, addHistoryItem(new OrderCommand("Pairwise Sort", oldOrder, viewport.getAlignment())); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(true, false); } public void sortIDMenuItem_actionPerformed() @@ -2744,7 +2747,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, AlignmentSorter.sortByID(viewport.getAlignment()); addHistoryItem( new OrderCommand("ID Sort", oldOrder, viewport.getAlignment())); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(true, false); } public void sortLengthMenuItem_actionPerformed() @@ -2753,7 +2756,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, AlignmentSorter.sortByLength(viewport.getAlignment()); addHistoryItem(new OrderCommand("Length Sort", oldOrder, viewport.getAlignment())); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(true, false); } public void sortGroupMenuItem_actionPerformed() @@ -2762,7 +2765,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, AlignmentSorter.sortByGroup(viewport.getAlignment()); addHistoryItem(new OrderCommand("Group Sort", oldOrder, viewport.getAlignment())); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(true, false); } @@ -2802,7 +2805,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, current.insertCharAt(Width - 1, viewport.getGapCharacter()); } } - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(false, false); } if ((viewport.getSelectionGroup() != null @@ -2866,7 +2869,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, current.insertCharAt(Width - 1, viewport.getGapCharacter()); } } - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(false, false); } @@ -2919,7 +2922,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, addHistoryItem(new OrderCommand(MessageManager .formatMessage("label.order_by_params", new String[] { title }), oldOrder, viewport.getAlignment())); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(true, false); } /** @@ -2977,7 +2980,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, addHistoryItem(new OrderCommand(undoname, oldOrder, viewport.getAlignment())); } - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(true, false); return true; } diff --git a/src/jalview/appletgui/AlignmentPanel.java b/src/jalview/appletgui/AlignmentPanel.java index 8e333ba..906acc1 100644 --- a/src/jalview/appletgui/AlignmentPanel.java +++ b/src/jalview/appletgui/AlignmentPanel.java @@ -530,7 +530,7 @@ public class AlignmentPanel extends Panel vpRanges.scrollToWrappedVisible(start); } - paintAlignment(redrawOverview); + paintAlignment(redrawOverview, false); return true; } @@ -579,7 +579,7 @@ public class AlignmentPanel extends Panel apvscroll.addNotify(); hscroll.addNotify(); validate(); - paintAlignment(true); + paintAlignment(true, false); } /** @@ -930,7 +930,8 @@ public class AlignmentPanel extends Panel * Repaint the alignment and annotations, and, optionally, any overview window */ @Override - public void paintAlignment(boolean updateOverview) + public void paintAlignment(boolean updateOverview, + boolean updateStructures) { final AnnotationSorter sorter = new AnnotationSorter(getAlignment(), av.isShowAutocalculatedAbove()); @@ -938,13 +939,14 @@ public class AlignmentPanel extends Panel av.getSortAnnotationsBy()); repaint(); - if (updateOverview) + if (updateStructures) { - // TODO: determine if this paintAlignment changed structure colours jalview.structure.StructureSelectionManager .getStructureSelectionManager(av.applet) .sequenceColoursChanged(this); - + } + if (updateOverview) + { if (overviewPanel != null) { overviewPanel.updateOverviewImage(); diff --git a/src/jalview/appletgui/AnnotationColourChooser.java b/src/jalview/appletgui/AnnotationColourChooser.java index 8de751a..533226e 100644 --- a/src/jalview/appletgui/AnnotationColourChooser.java +++ b/src/jalview/appletgui/AnnotationColourChooser.java @@ -85,7 +85,7 @@ public class AnnotationColourChooser extends Panel implements oldcs = av.getGlobalColourScheme(); if (av.getAlignment().getGroups() != null) { - oldgroupColours = new HashMap(); + oldgroupColours = new HashMap<>(); for (SequenceGroup sg : ap.av.getAlignment().getGroups()) { oldgroupColours.put(sg, sg.getColourScheme()); @@ -180,8 +180,8 @@ public class AnnotationColourChooser extends Panel implements // TODO remove duplication with gui.AnnotationRowFilter // TODO add 'per sequence only' option / parameter - annotationLabels = new HashMap(); - Vector list = new Vector(); + annotationLabels = new HashMap<>(); + Vector list = new Vector<>(); AlignmentAnnotation[] anns = av.getAlignment().getAlignmentAnnotation(); if (anns == null) { @@ -376,7 +376,7 @@ public class AnnotationColourChooser extends Panel implements else if (evt.getSource() == cancel) { reset(); - ap.paintAlignment(true); + ap.paintAlignment(true, true); frame.setVisible(false); } @@ -417,7 +417,7 @@ public class AnnotationColourChooser extends Panel implements } currentAnnotation.threshold.value = slider.getValue() / 1000f; - ap.paintAlignment(false); + ap.paintAlignment(false, false); } } @@ -559,7 +559,7 @@ public class AnnotationColourChooser extends Panel implements // update colours in linked windows ap.alignmentChanged(); - ap.paintAlignment(true); + ap.paintAlignment(true, true); } void reset() @@ -572,7 +572,7 @@ public class AnnotationColourChooser extends Panel implements sg.setColourScheme(oldgroupColours.get(sg)); } } - ap.paintAlignment(true); + ap.paintAlignment(true, true); } @Override @@ -588,7 +588,7 @@ public class AnnotationColourChooser extends Panel implements @Override public void mouseReleased(MouseEvent evt) { - ap.paintAlignment(true); + ap.paintAlignment(true, true); } @Override diff --git a/src/jalview/appletgui/AnnotationColumnChooser.java b/src/jalview/appletgui/AnnotationColumnChooser.java index b4c1d54..7674de716 100644 --- a/src/jalview/appletgui/AnnotationColumnChooser.java +++ b/src/jalview/appletgui/AnnotationColumnChooser.java @@ -306,7 +306,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements av.getAlignment().setHiddenColumns(oldHidden); } av.sendSelection(); - ap.paintAlignment(true); + ap.paintAlignment(true, true); } } @@ -348,7 +348,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements sliderDragging = false; valueChanged(true); } - ap.paintAlignment(true); + ap.paintAlignment(true, true); } }); } @@ -359,8 +359,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements if (slider.isEnabled()) { getCurrentAnnotation().threshold.value = slider.getValue() / 1000f; - updateView(); - ap.paintAlignment(false); + updateView(); // this also calls paintAlignment(true,true) } } @@ -515,7 +514,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements filterParams = null; av.setAnnotationColumnSelectionState(this); av.sendSelection(); - ap.paintAlignment(true); + ap.paintAlignment(true, true); } public HiddenColumns getOldHiddenColumns() diff --git a/src/jalview/appletgui/AnnotationLabels.java b/src/jalview/appletgui/AnnotationLabels.java index 2fb737a..d8f65a5 100755 --- a/src/jalview/appletgui/AnnotationLabels.java +++ b/src/jalview/appletgui/AnnotationLabels.java @@ -226,7 +226,8 @@ public class AnnotationLabels extends Panel ap.annotationPanel.adjustPanelHeight(); setSize(getSize().width, ap.annotationPanel.getSize().height); ap.validate(); - ap.paintAlignment(true); + // TODO: only paint if we needed to + ap.paintAlignment(true, true); } boolean editLabelDescription(AlignmentAnnotation annotation) @@ -548,7 +549,7 @@ public class AnnotationLabels extends Panel { ap.av.setIgnoreGapsConsensus(cbmi.getState(), ap); } - ap.paintAlignment(true); + ap.paintAlignment(true, true); } }); popup.add(cbmi); @@ -756,7 +757,7 @@ public class AnnotationLabels extends Panel } } } - ap.paintAlignment(false); + ap.paintAlignment(false, false); PaintRefresher.Refresh(ap, ap.av.getSequenceSetId()); ap.av.sendSelection(); } @@ -813,7 +814,7 @@ public class AnnotationLabels extends Panel sg.addSequence(aa[selectedRow].sequenceRef, false); } ap.av.setSelectionGroup(sg); - ap.paintAlignment(false); + ap.paintAlignment(false, false); PaintRefresher.Refresh(ap, ap.av.getSequenceSetId()); ap.av.sendSelection(); } diff --git a/src/jalview/appletgui/AnnotationPanel.java b/src/jalview/appletgui/AnnotationPanel.java index 6fe71de..c06f7b1 100755 --- a/src/jalview/appletgui/AnnotationPanel.java +++ b/src/jalview/appletgui/AnnotationPanel.java @@ -439,7 +439,8 @@ public class AnnotationPanel extends Panel graphStretchY = evt.getY(); av.calcPanelHeight(); needValidating = true; - ap.paintAlignment(true); + // TODO: only update overview visible geometry + ap.paintAlignment(true, false); } else { diff --git a/src/jalview/appletgui/AnnotationRowFilter.java b/src/jalview/appletgui/AnnotationRowFilter.java index 5efd177..c96dbab 100644 --- a/src/jalview/appletgui/AnnotationRowFilter.java +++ b/src/jalview/appletgui/AnnotationRowFilter.java @@ -114,7 +114,7 @@ public abstract class AnnotationRowFilter extends Panel public void cancel_actionPerformed(ActionEvent e) { reset(); - ap.paintAlignment(true); + ap.paintAlignment(true, true); frame.setVisible(false); } diff --git a/src/jalview/appletgui/FeatureRenderer.java b/src/jalview/appletgui/FeatureRenderer.java index b35c079..df407d6 100644 --- a/src/jalview/appletgui/FeatureRenderer.java +++ b/src/jalview/appletgui/FeatureRenderer.java @@ -493,7 +493,7 @@ public class FeatureRenderer } // findAllFeatures(); - ap.paintAlignment(true); + ap.paintAlignment(true, true); return true; } diff --git a/src/jalview/appletgui/FeatureSettings.java b/src/jalview/appletgui/FeatureSettings.java index 20d4d74..9a67499 100755 --- a/src/jalview/appletgui/FeatureSettings.java +++ b/src/jalview/appletgui/FeatureSettings.java @@ -377,8 +377,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 +391,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)) @@ -600,7 +600,7 @@ public class FeatureSettings extends Panel fr.setFeaturePriority(data); - ap.paintAlignment(updateOverview); + ap.paintAlignment(updateOverview, updateOverview); } MyCheckbox selectedCheck; @@ -680,7 +680,7 @@ public class FeatureSettings extends Panel { featurePanel.removeAll(); resetTable(false); - ap.paintAlignment(true); + ap.paintAlignment(true, true); } @Override @@ -732,7 +732,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 diff --git a/src/jalview/appletgui/FontChooser.java b/src/jalview/appletgui/FontChooser.java index c9a92b2..443ebce 100644 --- a/src/jalview/appletgui/FontChooser.java +++ b/src/jalview/appletgui/FontChooser.java @@ -261,7 +261,7 @@ public class FontChooser extends Panel implements ItemListener { ap.av.setCharWidth(oldCharWidth); } - ap.paintAlignment(true); + ap.paintAlignment(true, false); } else if (tp != null) { diff --git a/src/jalview/appletgui/IdPanel.java b/src/jalview/appletgui/IdPanel.java index 7d9d278..15e269c 100755 --- a/src/jalview/appletgui/IdPanel.java +++ b/src/jalview/appletgui/IdPanel.java @@ -70,7 +70,7 @@ public class IdPanel extends Panel // TODO: add in group link parameter // make a list of label,url pairs - HashMap urlList = new HashMap(); + HashMap urlList = new HashMap<>(); if (viewport.applet != null) { for (int i = 1; i < 10; i++) @@ -198,7 +198,7 @@ public class IdPanel extends Panel } lastid = seq; - alignPanel.paintAlignment(false); + alignPanel.paintAlignment(false, false); } @Override @@ -295,7 +295,7 @@ public class IdPanel extends Panel } else { - nlinks = new ArrayList(); + nlinks = new ArrayList<>(); } for (SequenceFeature sf : sq.getFeatures().getNonPositionalFeatures()) @@ -333,7 +333,7 @@ public class IdPanel extends Panel selectSeq(seq); } - alignPanel.paintAlignment(false); + alignPanel.paintAlignment(false, false); } void selectSeq(int seq) @@ -459,7 +459,7 @@ public class IdPanel extends Panel running = false; } - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(true, false); try { Thread.sleep(100); diff --git a/src/jalview/appletgui/OverviewPanel.java b/src/jalview/appletgui/OverviewPanel.java index e74e1cd..0256055 100755 --- a/src/jalview/appletgui/OverviewPanel.java +++ b/src/jalview/appletgui/OverviewPanel.java @@ -200,7 +200,7 @@ public class OverviewPanel extends Panel implements Runnable, av.getAlignment().getHiddenSequences(), av.getAlignment().getHiddenColumns()); } - ap.paintAlignment(false); + ap.paintAlignment(false, false); } } diff --git a/src/jalview/appletgui/RedundancyPanel.java b/src/jalview/appletgui/RedundancyPanel.java index 2aba20c..bd36b0d 100644 --- a/src/jalview/appletgui/RedundancyPanel.java +++ b/src/jalview/appletgui/RedundancyPanel.java @@ -160,7 +160,7 @@ public class RedundancyPanel extends SliderPanel float value = slider.getValue(); - List redundantSequences = new ArrayList(); + List redundantSequences = new ArrayList<>(); for (int i = 0; i < redundancy.length; i++) { if (value <= redundancy[i]) @@ -247,7 +247,7 @@ public class RedundancyPanel extends SliderPanel ap.av.getAlignment().getSequences()); } - ap.paintAlignment(true); + ap.paintAlignment(true, true); if (historyList.size() == 0) { diff --git a/src/jalview/appletgui/ScalePanel.java b/src/jalview/appletgui/ScalePanel.java index 514c3f9..7d4150d 100755 --- a/src/jalview/appletgui/ScalePanel.java +++ b/src/jalview/appletgui/ScalePanel.java @@ -141,7 +141,7 @@ public class ScalePanel extends Panel sg.setStartRes(min); sg.setEndRes(max); } - ap.paintAlignment(false); + ap.paintAlignment(false, false); av.sendSelection(); } @@ -167,7 +167,7 @@ public class ScalePanel extends Panel { av.showColumn(reveal[0]); reveal = null; - ap.paintAlignment(true); + ap.paintAlignment(true, true); av.sendSelection(); } }); @@ -183,7 +183,7 @@ public class ScalePanel extends Panel { av.showAllHiddenColumns(); reveal = null; - ap.paintAlignment(true); + ap.paintAlignment(true, true); av.sendSelection(); } }); @@ -208,7 +208,7 @@ public class ScalePanel extends Panel av.setSelectionGroup(null); } - ap.paintAlignment(true); + ap.paintAlignment(true, true); av.sendSelection(); } }); @@ -239,7 +239,7 @@ public class ScalePanel extends Panel if (!stretchingGroup) { - ap.paintAlignment(false); + ap.paintAlignment(false, false); return; } @@ -256,7 +256,7 @@ public class ScalePanel extends Panel } stretchingGroup = false; - ap.paintAlignment(false); + ap.paintAlignment(false, false); av.sendSelection(); } @@ -285,7 +285,7 @@ public class ScalePanel extends Panel { stretchingGroup = true; cs.stretchGroup(res, sg, min, max); - ap.paintAlignment(false); + ap.paintAlignment(false, false); } } diff --git a/src/jalview/appletgui/SeqPanel.java b/src/jalview/appletgui/SeqPanel.java index f36a8e2..55320ed 100644 --- a/src/jalview/appletgui/SeqPanel.java +++ b/src/jalview/appletgui/SeqPanel.java @@ -335,7 +335,7 @@ public class SeqPanel extends Panel implements MouseMotionListener, sg.addSequence(sequence, false); av.setSelectionGroup(sg); } - ap.paintAlignment(false); + ap.paintAlignment(false, false); av.sendSelection(); } @@ -983,7 +983,7 @@ public class SeqPanel extends Panel implements MouseMotionListener, lastMousePress = evt.getPoint(); - ap.paintAlignment(false); + ap.paintAlignment(false, false); ap.annotationPanel.image = null; return; } @@ -1450,7 +1450,7 @@ public class SeqPanel extends Panel implements MouseMotionListener, { if (links == null) { - links = new Vector(); + links = new Vector<>(); } links.addAll(sf.links); } @@ -1524,7 +1524,7 @@ public class SeqPanel extends Panel implements MouseMotionListener, } } PaintRefresher.Refresh(ap, av.getSequenceSetId()); - ap.paintAlignment(needOverviewUpdate); + ap.paintAlignment(needOverviewUpdate, needOverviewUpdate); needOverviewUpdate = false; changeEndRes = false; changeStartRes = false; diff --git a/src/jalview/appletgui/SliderPanel.java b/src/jalview/appletgui/SliderPanel.java index 565ebe8..5841e80 100644 --- a/src/jalview/appletgui/SliderPanel.java +++ b/src/jalview/appletgui/SliderPanel.java @@ -441,7 +441,7 @@ public class SliderPanel extends Panel @Override public void mouseReleased(MouseEvent evt) { - ap.paintAlignment(true); + ap.paintAlignment(true, true); } @Override diff --git a/src/jalview/appletgui/SplitFrame.java b/src/jalview/appletgui/SplitFrame.java index ed531d3..777e307 100644 --- a/src/jalview/appletgui/SplitFrame.java +++ b/src/jalview/appletgui/SplitFrame.java @@ -187,9 +187,9 @@ public class SplitFrame extends EmbmenuFrame createSplitFrameWindow(embedded, applet); validate(); topFrame.alignPanel.adjustAnnotationHeight(); - topFrame.alignPanel.paintAlignment(true); + topFrame.alignPanel.paintAlignment(true, true); bottomFrame.alignPanel.adjustAnnotationHeight(); - bottomFrame.alignPanel.paintAlignment(true); + bottomFrame.alignPanel.paintAlignment(true, true); } /** diff --git a/src/jalview/appletgui/UserDefinedColours.java b/src/jalview/appletgui/UserDefinedColours.java index d1c0e1b..6831a73 100644 --- a/src/jalview/appletgui/UserDefinedColours.java +++ b/src/jalview/appletgui/UserDefinedColours.java @@ -64,7 +64,7 @@ public class UserDefinedColours extends Panel Button selectedButton; - Vector oldColours = new Vector(); + Vector oldColours = new Vector<>(); ColourSchemeI oldColourScheme; @@ -520,7 +520,7 @@ public class UserDefinedColours extends Panel ap.av.isIgnoreGapsConsensus()); } ap.seqPanel.seqCanvas.img = null; - ap.paintAlignment(true); + ap.paintAlignment(true, true); } else if (jmol != null) { @@ -599,7 +599,7 @@ public class UserDefinedColours extends Panel { ap.av.setGlobalColourScheme(oldColourScheme); } - ap.paintAlignment(true); + ap.paintAlignment(true, true); } frame.setVisible(false); diff --git a/src/jalview/controller/AlignViewController.java b/src/jalview/controller/AlignViewController.java index dd05843..69e31cf 100644 --- a/src/jalview/controller/AlignViewController.java +++ b/src/jalview/controller/AlignViewController.java @@ -190,7 +190,7 @@ public class AlignViewController implements AlignViewControllerI if (changed) { viewport.setColumnSelection(cs); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(false, false); int columnCount = invert ? (sqcol.getEndRes() - sqcol.getStartRes() + 1) - bs.cardinality() @@ -215,7 +215,7 @@ public class AlignViewController implements AlignViewControllerI if (!extendCurrent) { cs.clear(); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(false, false); } } return false; @@ -337,7 +337,7 @@ public class AlignViewController implements AlignViewControllerI AlignmentSorter.sortByFeature(typ, gps, start, stop, al, method); avcg.addHistoryItem(new OrderCommand(methodText, oldOrder, viewport.getAlignment())); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(true, false); } @@ -375,7 +375,7 @@ public class AlignViewController implements AlignViewControllerI { avcg.getFeatureSettingsUI().discoverAllFeatureData(); } - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(true, true); } return featuresFile; @@ -414,7 +414,7 @@ public class AlignViewController implements AlignViewControllerI if (changed) { viewport.setColumnSelection(cs); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(false, false); int columnCount = invert ? (sqcol.getEndRes() - sqcol.getStartRes() + 1) - bs.cardinality() @@ -438,7 +438,7 @@ public class AlignViewController implements AlignViewControllerI if (!extendCurrent) { cs.clear(); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(false, false); } } return false; diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 13b715e..143e672 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -1711,7 +1711,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } viewport.getAlignment().moveSelectedSequencesByOne(sg, viewport.getHiddenRepSequences(), up); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(true, false); } synchronized void slideSequences(boolean right, int size) @@ -2397,7 +2397,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { PaintRefresher.Refresh(this, viewport.getSequenceSetId()); alignPanel.updateAnnotation(); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(true, true); } } @@ -2423,7 +2423,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, // JAL-2034 - should delegate to // alignPanel to decide if overview needs // updating. - alignPanel.paintAlignment(false); + alignPanel.paintAlignment(false, false); PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId()); } @@ -2448,7 +2448,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, // JAL-2034 - should delegate to // alignPanel to decide if overview needs // updating. - alignPanel.paintAlignment(false); + alignPanel.paintAlignment(false, false); PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId()); viewport.sendSelection(); } @@ -2479,7 +2479,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, // alignPanel to decide if overview needs // updating. - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(true, false); PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId()); viewport.sendSelection(); } @@ -2488,7 +2488,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, public void invertColSel_actionPerformed(ActionEvent e) { viewport.invertColumnSelection(); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(true, false); viewport.sendSelection(); } @@ -2868,21 +2868,21 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, alignPanel.getIdPanel().getIdCanvas() .setPreferredSize(alignPanel.calculateIdWidth()); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(true, false); } @Override public void idRightAlign_actionPerformed(ActionEvent e) { viewport.setRightAlignIds(idRightAlign.isSelected()); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(false, false); } @Override public void centreColumnLabels_actionPerformed(ActionEvent e) { viewport.setCentreColumnLabels(centreColumnLabelsMenuItem.getState()); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(false, false); } /* @@ -2915,7 +2915,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, protected void colourTextMenuItem_actionPerformed(ActionEvent e) { viewport.setColourText(colourTextMenuItem.isSelected()); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(false, false); } /** @@ -2944,7 +2944,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, public void showAllColumns_actionPerformed(ActionEvent e) { viewport.showAllHiddenColumns(); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(true, true); viewport.sendSelection(); } @@ -3048,7 +3048,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, viewport.expandColSelection(sg, false); viewport.hideAllSelectedSeqs(); viewport.hideSelectedColumns(); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(true, true); viewport.sendSelection(); } @@ -3064,7 +3064,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { viewport.showAllHiddenColumns(); viewport.showAllHiddenSeqs(); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(true, true); viewport.sendSelection(); } @@ -3072,7 +3072,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, public void hideSelColumns_actionPerformed(ActionEvent e) { viewport.hideSelectedColumns(); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(true, true); viewport.sendSelection(); } @@ -3093,7 +3093,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, protected void scaleAbove_actionPerformed(ActionEvent e) { viewport.setScaleAboveWrapped(scaleAbove.isSelected()); - alignPanel.paintAlignment(true); + // TODO: do we actually need to update overview for scale above change ? + alignPanel.paintAlignment(true, false); } /** @@ -3106,7 +3107,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, protected void scaleLeft_actionPerformed(ActionEvent e) { viewport.setScaleLeftWrapped(scaleLeft.isSelected()); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(true, false); } /** @@ -3119,7 +3120,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, protected void scaleRight_actionPerformed(ActionEvent e) { viewport.setScaleRightWrapped(scaleRight.isSelected()); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(true, false); } /** @@ -3132,7 +3133,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, public void viewBoxesMenuItem_actionPerformed(ActionEvent e) { viewport.setShowBoxes(viewBoxesMenuItem.isSelected()); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(false, false); } /** @@ -3145,7 +3146,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, public void viewTextMenuItem_actionPerformed(ActionEvent e) { viewport.setShowText(viewTextMenuItem.isSelected()); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(false, false); } /** @@ -3158,7 +3159,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, protected void renderGapsMenuItem_actionPerformed(ActionEvent e) { viewport.setRenderGaps(renderGapsMenuItem.isSelected()); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(false, false); } public FeatureSettings featureSettings; @@ -3196,7 +3197,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, public void showSeqFeatures_actionPerformed(ActionEvent evt) { viewport.setShowSequenceFeatures(showSeqFeatures.isSelected()); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(true, true); } /** @@ -3353,7 +3354,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, viewport.setGlobalColourScheme(cs); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(true, true); } /** @@ -3438,7 +3439,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, viewport.getAlignment().getSequenceAt(0)); addHistoryItem(new OrderCommand("Pairwise Sort", oldOrder, viewport.getAlignment())); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(true, false); } /** @@ -3454,7 +3455,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, AlignmentSorter.sortByID(viewport.getAlignment()); addHistoryItem( new OrderCommand("ID Sort", oldOrder, viewport.getAlignment())); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(true, false); } /** @@ -3470,7 +3471,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, AlignmentSorter.sortByLength(viewport.getAlignment()); addHistoryItem(new OrderCommand("Length Sort", oldOrder, viewport.getAlignment())); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(true, false); } /** @@ -3487,7 +3488,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, addHistoryItem(new OrderCommand("Group Sort", oldOrder, viewport.getAlignment())); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(true, false); } /** @@ -3644,7 +3645,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, addHistoryItem(new OrderCommand(order.getName(), oldOrder, viewport.getAlignment())); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(true, false); } }); } @@ -3673,7 +3674,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, viewport.getAlignment());// ,viewport.getSelectionGroup()); addHistoryItem(new OrderCommand("Sort by " + scoreLabel, oldOrder, viewport.getAlignment())); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(true, false); } }); } @@ -3788,7 +3789,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, addHistoryItem(new OrderCommand(undoname, oldOrder, viewport.getAlignment())); } - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(true, false); return true; } @@ -4503,7 +4504,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, assocfiles++; } } - alignPanel.paintAlignment(true); + // TODO: do we need to update overview ? only if features are + // shown I guess + alignPanel.paintAlignment(true, false); } } } @@ -4650,7 +4653,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { if (parseFeaturesFile(file, sourceType)) { - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(true, true); } } else @@ -4665,7 +4668,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, alignPanel.adjustAnnotationHeight(); viewport.updateSequenceIdColours(); buildSortByAnnotationScoresMenu(); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(true, true); } } catch (Exception ex) { @@ -5190,7 +5193,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, protected void showUnconservedMenuItem_actionPerformed(ActionEvent e) { viewport.setShowUnconserved(showNonconservedMenuItem.getState()); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(false, false); } /* @@ -5279,7 +5282,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { PaintRefresher.Refresh(this, viewport.getSequenceSetId()); alignPanel.updateAnnotation(); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(true, true); } } @@ -5291,7 +5294,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, viewport.getAlignment().setSeqrep(null); PaintRefresher.Refresh(this, viewport.getSequenceSetId()); alignPanel.updateAnnotation(); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(true, true); } } @@ -5381,7 +5384,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, this.alignPanel.av.setSortAnnotationsBy(getAnnotationSortOrder()); this.alignPanel.av .setShowAutocalculatedAbove(isShowAutoCalculatedAbove()); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(false, false); } /** diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index c700635..ff2ffbb 100644 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -214,7 +214,8 @@ public class AlignmentPanel extends GAlignmentPanel implements alignFrame.updateEditMenuBar(); - paintAlignment(true); + // no idea if we need to update structure + paintAlignment(true, true); } @@ -481,7 +482,7 @@ public class AlignmentPanel extends GAlignmentPanel implements scrollNeeded = vpRanges.scrollToWrappedVisible(start); } - paintAlignment(redrawOverview); + paintAlignment(redrawOverview, false); return scrollNeeded; } @@ -538,7 +539,9 @@ public class AlignmentPanel extends GAlignmentPanel implements } validateAnnotationDimensions(true); addNotify(); - paintAlignment(true); + // TODO: many places call this method and also paintAlignment with various + // different settings. this means multiple redraws are triggered... + paintAlignment(true, false); } /** @@ -837,12 +840,12 @@ public class AlignmentPanel extends GAlignmentPanel implements repaint(); } - /** - * Repaint the alignment including the annotations and overview panels (if - * shown). + /* (non-Javadoc) + * @see jalview.api.AlignmentViewPanel#paintAlignment(boolean) */ @Override - public void paintAlignment(boolean updateOverview) + public void paintAlignment(boolean updateOverview, + boolean updateStructures) { final AnnotationSorter sorter = new AnnotationSorter(getAlignment(), av.isShowAutocalculatedAbove()); @@ -850,10 +853,12 @@ public class AlignmentPanel extends GAlignmentPanel implements av.getSortAnnotationsBy()); repaint(); - if (updateOverview) + if (updateStructures) { - // TODO: determine if this paintAlignment changed structure colours av.getStructureSelectionManager().sequenceColoursChanged(this); + } + if (updateOverview) + { if (overviewPanel != null) { @@ -1866,7 +1871,7 @@ public class AlignmentPanel extends GAlignmentPanel implements if (adjustHeight) { // sort, repaint, update overview - paintAlignment(true); + paintAlignment(true, false); } else { diff --git a/src/jalview/gui/AnnotationChooser.java b/src/jalview/gui/AnnotationChooser.java index 26796de..84883d7 100644 --- a/src/jalview/gui/AnnotationChooser.java +++ b/src/jalview/gui/AnnotationChooser.java @@ -82,7 +82,7 @@ public class AnnotationChooser extends JPanel private boolean applyToUnselectedSequences; // currently selected 'annotation type' checkboxes - private Map selectedTypes = new HashMap(); + private Map selectedTypes = new HashMap<>(); /** * Constructor. @@ -202,7 +202,7 @@ public class AnnotationChooser extends JPanel // this.ap.alabels.setSize(this.ap.alabels.getSize().width, // this.ap.annotationPanel.getSize().height); // this.ap.validate(); - this.ap.paintAlignment(true); + this.ap.paintAlignment(true, false); } /** @@ -233,7 +233,7 @@ public class AnnotationChooser extends JPanel // this.ap.alabels.setSize(this.ap.alabels.getSize().width, // this.ap.annotationPanel.getSize().height); // this.ap.validate(); - this.ap.paintAlignment(true); + this.ap.paintAlignment(true, false); } /** @@ -251,7 +251,7 @@ public class AnnotationChooser extends JPanel this.ap.updateAnnotation(); // this.ap.annotationPanel.adjustPanelHeight(); - this.ap.paintAlignment(true); + this.ap.paintAlignment(true, false); } /** @@ -356,7 +356,7 @@ public class AnnotationChooser extends JPanel public static List getAnnotationTypes(AlignmentI alignment, boolean sequenceSpecificOnly) { - List result = new ArrayList(); + List result = new ArrayList<>(); for (AlignmentAnnotation aa : alignment.getAlignmentAnnotation()) { if (!sequenceSpecificOnly || aa.sequenceRef != null) diff --git a/src/jalview/gui/AnnotationColourChooser.java b/src/jalview/gui/AnnotationColourChooser.java index 8d123bb..153f70c 100644 --- a/src/jalview/gui/AnnotationColourChooser.java +++ b/src/jalview/gui/AnnotationColourChooser.java @@ -79,7 +79,7 @@ public class AnnotationColourChooser extends AnnotationRowFilter oldcs = av.getGlobalColourScheme(); if (av.getAlignment().getGroups() != null) { - oldgroupColours = new Hashtable(); + oldgroupColours = new Hashtable<>(); for (SequenceGroup sg : ap.av.getAlignment().getGroups()) { if (sg.getColourScheme() != null) @@ -122,7 +122,7 @@ public class AnnotationColourChooser extends AnnotationRowFilter } Vector annotItems = getAnnotationItems( seqAssociated.isSelected()); - annotations = new JComboBox(annotItems); + annotations = new JComboBox<>(annotItems); populateThresholdComboBox(threshold); @@ -341,7 +341,7 @@ public class AnnotationColourChooser extends AnnotationRowFilter getCurrentAnnotation().threshold.value = slider.getValue() / 1000f; propagateSeqAssociatedThreshold(updateAllAnnotation, getCurrentAnnotation()); - ap.paintAlignment(false); + ap.paintAlignment(false, false); } } @@ -415,12 +415,9 @@ public class AnnotationColourChooser extends AnnotationRowFilter colorAlignmentContaining(getCurrentAnnotation(), selectedThresholdItem); ap.alignmentChanged(); - // ensure all associated views (overviews, structures, etc) are notified of - // updated colours. - ap.paintAlignment(true); } - protected boolean colorAlignmentContaining(AlignmentAnnotation currentAnn, + protected void colorAlignmentContaining(AlignmentAnnotation currentAnn, int selectedThresholdOption) { @@ -460,7 +457,6 @@ public class AnnotationColourChooser extends AnnotationRowFilter acg.getInstance(sg, ap.av.getHiddenRepSequences())); } } - return false; } } diff --git a/src/jalview/gui/AnnotationColumnChooser.java b/src/jalview/gui/AnnotationColumnChooser.java index 84b2c6f..020e027 100644 --- a/src/jalview/gui/AnnotationColumnChooser.java +++ b/src/jalview/gui/AnnotationColumnChooser.java @@ -254,7 +254,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter av.getAlignment().setHiddenColumns(oldHidden); } av.sendSelection(); - ap.paintAlignment(true); + ap.paintAlignment(true, true); } } @@ -267,7 +267,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter updateView(); propagateSeqAssociatedThreshold(updateAllAnnotation, getCurrentAnnotation()); - ap.paintAlignment(false); + ap.paintAlignment(false, false); } } @@ -391,7 +391,8 @@ public class AnnotationColumnChooser extends AnnotationRowFilter av.getColumnSelection().filterAnnotations( getCurrentAnnotation().annotations, filterParams); - if (getActionOption() == ACTION_OPTION_HIDE) + boolean hideCols = getActionOption() == ACTION_OPTION_HIDE; + if (hideCols) { av.hideSelectedColumns(); } @@ -399,7 +400,8 @@ public class AnnotationColumnChooser extends AnnotationRowFilter filterParams = null; av.setAnnotationColumnSelectionState(this); - ap.paintAlignment(true); + // only update overview and structures if columns were hidden + ap.paintAlignment(hideCols, hideCols); } public HiddenColumns getOldHiddenColumns() diff --git a/src/jalview/gui/AnnotationLabels.java b/src/jalview/gui/AnnotationLabels.java index d07cae2..b94a615 100755 --- a/src/jalview/gui/AnnotationLabels.java +++ b/src/jalview/gui/AnnotationLabels.java @@ -705,7 +705,7 @@ public class AnnotationLabels extends JPanel d = ap.annotationSpaceFillerHolder.getPreferredSize(); ap.annotationSpaceFillerHolder .setPreferredSize(new Dimension(d.width, d.height - dif)); - ap.paintAlignment(true); + ap.paintAlignment(true, false); } ap.addNotify(); @@ -855,7 +855,7 @@ public class AnnotationLabels extends JPanel } } - ap.paintAlignment(false); + ap.paintAlignment(false, false); PaintRefresher.Refresh(ap, ap.av.getSequenceSetId()); ap.av.sendSelection(); } @@ -912,7 +912,7 @@ public class AnnotationLabels extends JPanel sg.addSequence(aa[selectedRow].sequenceRef, false); } ap.av.setSelectionGroup(sg); - ap.paintAlignment(false); + ap.paintAlignment(false, false); PaintRefresher.Refresh(ap, ap.av.getSequenceSetId()); ap.av.sendSelection(); } diff --git a/src/jalview/gui/AnnotationPanel.java b/src/jalview/gui/AnnotationPanel.java index be8f5f6..12d1369 100755 --- a/src/jalview/gui/AnnotationPanel.java +++ b/src/jalview/gui/AnnotationPanel.java @@ -670,7 +670,7 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, } graphStretchY = evt.getY(); adjustPanelHeight(); - ap.paintAlignment(true); + ap.paintAlignment(false, false); } else { diff --git a/src/jalview/gui/AnnotationRowFilter.java b/src/jalview/gui/AnnotationRowFilter.java index 8b2486f..71ad6a5 100644 --- a/src/jalview/gui/AnnotationRowFilter.java +++ b/src/jalview/gui/AnnotationRowFilter.java @@ -80,7 +80,7 @@ public abstract class AnnotationRowFilter extends JPanel */ protected boolean sliderDragging = false; - protected JComboBox threshold = new JComboBox(); + protected JComboBox threshold = new JComboBox<>(); protected JComboBox annotations; @@ -177,7 +177,6 @@ public abstract class AnnotationRowFilter extends JPanel sliderDragging = false; valueChanged(true); } - ap.paintAlignment(true); } }); } @@ -192,9 +191,9 @@ public abstract class AnnotationRowFilter extends JPanel */ public Vector getAnnotationItems(boolean isSeqAssociated) { - annotationLabels = new HashMap(); + annotationLabels = new HashMap<>(); - Vector list = new Vector(); + Vector list = new Vector<>(); int index = 1; int[] anmap = new int[av.getAlignment() .getAlignmentAnnotation().length]; @@ -271,7 +270,7 @@ public abstract class AnnotationRowFilter extends JPanel public void cancel_actionPerformed() { reset(); - ap.paintAlignment(true); + ap.paintAlignment(true, true); try { frame.setClosed(true); @@ -413,6 +412,11 @@ public abstract class AnnotationRowFilter extends JPanel this.currentAnnotation = annotation; } + /** + * update associated view model and trigger any necessary repaints. + * + * @param updateAllAnnotation + */ protected abstract void valueChanged(boolean updateAllAnnotation); protected abstract void updateView(); diff --git a/src/jalview/gui/FeatureColourChooser.java b/src/jalview/gui/FeatureColourChooser.java index b27328d..2e9f0ed 100644 --- a/src/jalview/gui/FeatureColourChooser.java +++ b/src/jalview/gui/FeatureColourChooser.java @@ -147,7 +147,7 @@ public class FeatureColourChooser extends JalviewDialog */ if (ap != null) { - ap.paintAlignment(true); + ap.paintAlignment(true, true); } } }); @@ -507,7 +507,7 @@ public class FeatureColourChooser extends JalviewDialog } fr.setColour(type, acg); cs = acg; - ap.paintAlignment(updateOverview); + ap.paintAlignment(updateOverview, updateOverview); } @Override @@ -539,7 +539,7 @@ public class FeatureColourChooser extends JalviewDialog void reset() { fr.setColour(type, oldcs); - ap.paintAlignment(true); + ap.paintAlignment(true, true); cs = null; } @@ -565,7 +565,7 @@ public class FeatureColourChooser extends JalviewDialog /* * force repaint of any Overview window or structure */ - ap.paintAlignment(true); + ap.paintAlignment(true, true); } catch (NumberFormatException ex) { } diff --git a/src/jalview/gui/FeatureRenderer.java b/src/jalview/gui/FeatureRenderer.java index 17f5a71..9c4b009 100644 --- a/src/jalview/gui/FeatureRenderer.java +++ b/src/jalview/gui/FeatureRenderer.java @@ -243,7 +243,7 @@ public class FeatureRenderer JPanel choosePanel = new JPanel(); choosePanel.add(new JLabel( MessageManager.getString("label.select_feature") + ":")); - final JComboBox overlaps = new JComboBox(); + final JComboBox overlaps = new JComboBox<>(); List added = new ArrayList<>(); for (SequenceFeature sf : features) { @@ -487,7 +487,7 @@ public class FeatureRenderer featuresAdded(); - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(true, true); return true; } @@ -497,7 +497,7 @@ public class FeatureRenderer } } - alignPanel.paintAlignment(true); + alignPanel.paintAlignment(true, true); return true; } diff --git a/src/jalview/gui/FeatureSettings.java b/src/jalview/gui/FeatureSettings.java index 0963b31..c5454ab 100644 --- a/src/jalview/gui/FeatureSettings.java +++ b/src/jalview/gui/FeatureSettings.java @@ -485,7 +485,7 @@ public class FeatureSettings extends JPanel @Override synchronized public void discoverAllFeatureData() { - Set allGroups = new HashSet(); + Set allGroups = new HashSet<>(); AlignmentI alignment = af.getViewport().getAlignment(); for (int i = 0; i < alignment.getHeight(); i++) @@ -557,12 +557,12 @@ public class FeatureSettings extends JPanel return; } resettingTable = true; - typeWidth = new Hashtable(); + typeWidth = new Hashtable<>(); // TODO: change avWidth calculation to 'per-sequence' average and use long // rather than float - Set displayableTypes = new HashSet(); - Set foundGroups = new HashSet(); + Set displayableTypes = new HashSet<>(); + Set foundGroups = new HashSet<>(); /* * determine which feature types may be visible depending on @@ -578,7 +578,7 @@ public class FeatureSettings extends JPanel * 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 || checkGroupState(group)) @@ -1058,7 +1058,7 @@ public class FeatureSettings extends JPanel { if (fr.setFeaturePriority(data, visibleNew)) { - af.alignPanel.paintAlignment(true); + af.alignPanel.paintAlignment(true, true); } } @@ -1238,7 +1238,7 @@ public class FeatureSettings extends JPanel public void stateChanged(ChangeEvent evt) { fr.setTransparency((100 - transparency.getValue()) / 100f); - af.alignPanel.paintAlignment(true); + af.alignPanel.paintAlignment(true, true); } }); diff --git a/src/jalview/gui/FontChooser.java b/src/jalview/gui/FontChooser.java index 6cddcca..80ac189 100755 --- a/src/jalview/gui/FontChooser.java +++ b/src/jalview/gui/FontChooser.java @@ -183,7 +183,7 @@ public class FontChooser extends GFontChooser { ap.av.antiAlias = smoothFont.isSelected(); ap.getAnnotationPanel().image = null; - ap.paintAlignment(true); + ap.paintAlignment(true, false); if (ap.av.getCodingComplement() != null && ap.av.isProteinFontAsCdna()) { ((AlignViewport) ap.av @@ -235,7 +235,7 @@ public class FontChooser extends GFontChooser ap.av.setScaleProteinAsCdna(oldProteinScale); ap.av.setProteinFontAsCdna(oldMirrorFont); ap.av.antiAlias = oldSmoothFont; - ap.paintAlignment(true); + ap.paintAlignment(true, false); if (scaleAsCdna.isVisible() && scaleAsCdna.isEnabled()) { diff --git a/src/jalview/gui/IdPanel.java b/src/jalview/gui/IdPanel.java index 3cc0ed3..a46c2c1 100755 --- a/src/jalview/gui/IdPanel.java +++ b/src/jalview/gui/IdPanel.java @@ -138,7 +138,7 @@ public class IdPanel extends JPanel } lastid = seq; - alignPanel.paintAlignment(false); + alignPanel.paintAlignment(false, false); } /** @@ -313,7 +313,7 @@ public class IdPanel extends JPanel av.isSelectionGroupChanged(true); - alignPanel.paintAlignment(false); + alignPanel.paintAlignment(false, false); } /** @@ -507,7 +507,7 @@ public class IdPanel extends JPanel running = false; } - alignPanel.paintAlignment(false); + alignPanel.paintAlignment(false, false); try { diff --git a/src/jalview/gui/IdwidthAdjuster.java b/src/jalview/gui/IdwidthAdjuster.java index 3c4107f..8400543 100755 --- a/src/jalview/gui/IdwidthAdjuster.java +++ b/src/jalview/gui/IdwidthAdjuster.java @@ -75,6 +75,7 @@ public class IdwidthAdjuster extends JPanel * @param evt * DOCUMENT ME! */ + @Override public void mousePressed(MouseEvent evt) { oldX = evt.getX(); @@ -86,6 +87,7 @@ public class IdwidthAdjuster extends JPanel * @param evt * DOCUMENT ME! */ + @Override public void mouseReleased(MouseEvent evt) { active = false; @@ -112,6 +114,7 @@ public class IdwidthAdjuster extends JPanel * @param evt * DOCUMENT ME! */ + @Override public void mouseEntered(MouseEvent evt) { active = true; @@ -124,6 +127,7 @@ public class IdwidthAdjuster extends JPanel * @param evt * DOCUMENT ME! */ + @Override public void mouseExited(MouseEvent evt) { active = false; @@ -136,6 +140,7 @@ public class IdwidthAdjuster extends JPanel * @param evt * DOCUMENT ME! */ + @Override public void mouseDragged(MouseEvent evt) { active = true; @@ -149,7 +154,7 @@ public class IdwidthAdjuster extends JPanel { viewport.setIdWidth(newWidth); - ap.paintAlignment(true); + ap.paintAlignment(true, false); } oldX = evt.getX(); @@ -161,6 +166,7 @@ public class IdwidthAdjuster extends JPanel * @param evt * DOCUMENT ME! */ + @Override public void mouseMoved(MouseEvent evt) { } @@ -171,6 +177,7 @@ public class IdwidthAdjuster extends JPanel * @param evt * DOCUMENT ME! */ + @Override public void mouseClicked(MouseEvent evt) { } @@ -181,6 +188,7 @@ public class IdwidthAdjuster extends JPanel * @param g * DOCUMENT ME! */ + @Override public void paintComponent(Graphics g) { g.setColor(Color.white); diff --git a/src/jalview/gui/PopupMenu.java b/src/jalview/gui/PopupMenu.java index 846ba64..850a09a 100644 --- a/src/jalview/gui/PopupMenu.java +++ b/src/jalview/gui/PopupMenu.java @@ -1743,7 +1743,7 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener } sequence.setName(dialog.getName().replace(' ', '_')); - ap.paintAlignment(false); + ap.paintAlignment(false, false); } sequence.setDescription(dialog.getDescription()); diff --git a/src/jalview/gui/RedundancyPanel.java b/src/jalview/gui/RedundancyPanel.java index 8bf2fba..c4390c0 100755 --- a/src/jalview/gui/RedundancyPanel.java +++ b/src/jalview/gui/RedundancyPanel.java @@ -54,7 +54,7 @@ public class RedundancyPanel extends GSliderPanel implements Runnable AlignmentPanel ap; - Stack historyList = new Stack(); + Stack historyList = new Stack<>(); // simpler than synching with alignFrame. @@ -194,7 +194,7 @@ public class RedundancyPanel extends GSliderPanel implements Runnable } float value = slider.getValue(); - List redundantSequences = new ArrayList(); + List redundantSequences = new ArrayList<>(); for (int i = 0; i < redundancy.length; i++) { if (value <= redundancy[i]) @@ -295,7 +295,7 @@ public class RedundancyPanel extends GSliderPanel implements Runnable af.updateEditMenuBar(); } - ap.paintAlignment(true); + ap.paintAlignment(true, true); if (historyList.size() == 0) { diff --git a/src/jalview/gui/ScalePanel.java b/src/jalview/gui/ScalePanel.java index 1db4051..e677769 100755 --- a/src/jalview/gui/ScalePanel.java +++ b/src/jalview/gui/ScalePanel.java @@ -168,7 +168,7 @@ public class ScalePanel extends JPanel { av.showColumn(reveal[0]); reveal = null; - ap.paintAlignment(true); + ap.paintAlignment(true, true); av.sendSelection(); } }); @@ -184,7 +184,7 @@ public class ScalePanel extends JPanel { av.showAllHiddenColumns(); reveal = null; - ap.paintAlignment(true); + ap.paintAlignment(true, true); av.sendSelection(); } }); @@ -208,7 +208,7 @@ public class ScalePanel extends JPanel av.setSelectionGroup(null); } - ap.paintAlignment(true); + ap.paintAlignment(true, true); av.sendSelection(); } }); @@ -260,7 +260,7 @@ public class ScalePanel extends JPanel sg.setEndRes(max); } av.setSelectionGroup(sg); - ap.paintAlignment(false); + ap.paintAlignment(false, false); av.sendSelection(); } @@ -297,7 +297,7 @@ public class ScalePanel extends JPanel } else { - ap.paintAlignment(false); + ap.paintAlignment(false, false); } return; } @@ -316,7 +316,7 @@ public class ScalePanel extends JPanel } } stretchingGroup = false; - ap.paintAlignment(false); + ap.paintAlignment(false, false); av.sendSelection(); } @@ -346,7 +346,7 @@ public class ScalePanel extends JPanel { stretchingGroup = true; cs.stretchGroup(res, sg, min, max); - ap.paintAlignment(false); + ap.paintAlignment(false, false); } } diff --git a/src/jalview/gui/SeqPanel.java b/src/jalview/gui/SeqPanel.java index e99e577..531eca6 100644 --- a/src/jalview/gui/SeqPanel.java +++ b/src/jalview/gui/SeqPanel.java @@ -484,7 +484,7 @@ public class SeqPanel extends JPanel av.setSelectionGroup(sg); } - ap.paintAlignment(false); + ap.paintAlignment(false, false); av.sendSelection(); } @@ -1057,7 +1057,7 @@ public class SeqPanel extends JPanel } if (newWidth > 0) { - ap.paintAlignment(false); + ap.paintAlignment(false, false); if (copyChanges) { /* @@ -1841,7 +1841,9 @@ public class SeqPanel extends JPanel } } PaintRefresher.Refresh(this, av.getSequenceSetId()); - ap.paintAlignment(needOverviewUpdate); + // TODO: structure colours only need updating if stretchGroup used to or now + // does contain sequences with structure views + ap.paintAlignment(needOverviewUpdate, needOverviewUpdate); needOverviewUpdate = false; changeEndRes = false; changeStartRes = false; diff --git a/src/jalview/gui/SliderPanel.java b/src/jalview/gui/SliderPanel.java index e6ec822..93a2457 100755 --- a/src/jalview/gui/SliderPanel.java +++ b/src/jalview/gui/SliderPanel.java @@ -127,7 +127,7 @@ public class SliderPanel extends GSliderPanel @Override public void mouseReleased(MouseEvent evt) { - ap.paintAlignment(true); + ap.paintAlignment(true, true); } }); diff --git a/src/jalview/gui/StructureViewerBase.java b/src/jalview/gui/StructureViewerBase.java index 3ba9947..c8854a7 100644 --- a/src/jalview/gui/StructureViewerBase.java +++ b/src/jalview/gui/StructureViewerBase.java @@ -83,18 +83,18 @@ public abstract class StructureViewerBase extends GStructureViewer /** * list of sequenceSet ids associated with the view */ - protected List _aps = new ArrayList(); + protected List _aps = new ArrayList<>(); /** * list of alignment panels to use for superposition */ - protected Vector _alignwith = new Vector(); + protected Vector _alignwith = new Vector<>(); /** * list of alignment panels that are used for colouring structures by aligned * sequences */ - protected Vector _colourwith = new Vector(); + protected Vector _colourwith = new Vector<>(); private String viewId = null; @@ -170,7 +170,7 @@ public abstract class StructureViewerBase extends GStructureViewer { if (_alignwith == null) { - _alignwith = new Vector(); + _alignwith = new Vector<>(); } if (_alignwith.size() == 0 && ap != null) { @@ -468,7 +468,9 @@ public abstract class StructureViewerBase extends GStructureViewer if (apanel.getSeqPanel().seqCanvas.fr != null) { apanel.getSeqPanel().seqCanvas.fr.featuresAdded(); - apanel.paintAlignment(true); + // note - we don't do a refresh for structure here because we do it + // explicitly for all panels later on + apanel.paintAlignment(true, false); } /* @@ -717,11 +719,11 @@ public abstract class StructureViewerBase extends GStructureViewer if (_colourwith == null) { - _colourwith = new Vector(); + _colourwith = new Vector<>(); } if (_alignwith == null) { - _alignwith = new Vector(); + _alignwith = new Vector<>(); } ViewSelectionMenu seqColourBy = new ViewSelectionMenu( @@ -888,7 +890,7 @@ public abstract class StructureViewerBase extends GStructureViewer binding.setColourBySequence(seqColour.isSelected()); if (_colourwith == null) { - _colourwith = new Vector(); + _colourwith = new Vector<>(); } if (binding.isColourBySequence()) { diff --git a/src/jalview/gui/TextColourChooser.java b/src/jalview/gui/TextColourChooser.java index 3986561..53e2dee 100644 --- a/src/jalview/gui/TextColourChooser.java +++ b/src/jalview/gui/TextColourChooser.java @@ -184,9 +184,9 @@ public class TextColourChooser */ protected void saveInitialSettings() { - groupColour1 = new HashMap(); - groupColour2 = new HashMap(); - groupThreshold = new HashMap(); + groupColour1 = new HashMap<>(); + groupColour2 = new HashMap<>(); + groupThreshold = new HashMap<>(); if (sg == null) { @@ -237,7 +237,7 @@ public class TextColourChooser sg.textColour = col; } - ap.paintAlignment(true); + ap.paintAlignment(false, false); } void colour2Changed(Color col) @@ -255,7 +255,7 @@ public class TextColourChooser sg.textColour2 = col; } - ap.paintAlignment(true); + ap.paintAlignment(false, false); } void thresholdChanged(int value) @@ -273,7 +273,7 @@ public class TextColourChooser sg.thresholdTextColour = value; } - ap.paintAlignment(true); + ap.paintAlignment(false, false); } void setGroupTextColour() diff --git a/src/jalview/gui/TreePanel.java b/src/jalview/gui/TreePanel.java index 5e14fce..9403057 100755 --- a/src/jalview/gui/TreePanel.java +++ b/src/jalview/gui/TreePanel.java @@ -493,7 +493,7 @@ public class TreePanel extends GTreePanel if (treeCanvas.applyToAllViews) { - final ArrayList commands = new ArrayList(); + final ArrayList commands = new ArrayList<>(); for (AlignmentPanel ap : PaintRefresher .getAssociatedPanels(av.getSequenceSetId())) { @@ -550,13 +550,14 @@ public class TreePanel extends GTreePanel public CommandI sortAlignmentIn(AlignmentPanel ap) { + // TODO: move to alignment view controller AlignmentViewport viewport = ap.av; SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray(); AlignmentSorter.sortByTree(viewport.getAlignment(), tree); CommandI undo; undo = new OrderCommand("Tree Sort", oldOrder, viewport.getAlignment()); - ap.paintAlignment(true); + ap.paintAlignment(true, false); return undo; } diff --git a/src/jalview/gui/UserDefinedColours.java b/src/jalview/gui/UserDefinedColours.java index 8b45c40..3290500 100755 --- a/src/jalview/gui/UserDefinedColours.java +++ b/src/jalview/gui/UserDefinedColours.java @@ -136,7 +136,7 @@ public class UserDefinedColours extends GUserDefinedColours UserDefinedColours() { super(); - selectedButtons = new ArrayList(); + selectedButtons = new ArrayList<>(); } void showFrame() @@ -163,7 +163,7 @@ public class UserDefinedColours extends GUserDefinedColours if (upperCaseButtons == null) { - upperCaseButtons = new ArrayList(); + upperCaseButtons = new ArrayList<>(); } for (int i = 0; i < 20; i++) @@ -194,7 +194,7 @@ public class UserDefinedColours extends GUserDefinedColours if (lowerCaseButtons == null) { - lowerCaseButtons = new ArrayList(); + lowerCaseButtons = new ArrayList<>(); } for (int i = 0; i < 20; i++) @@ -631,8 +631,8 @@ public class UserDefinedColours extends GUserDefinedColours @Override protected void loadbutton_actionPerformed() { - upperCaseButtons = new ArrayList(); - lowerCaseButtons = new ArrayList(); + upperCaseButtons = new ArrayList<>(); + lowerCaseButtons = new ArrayList<>(); JalviewFileChooser chooser = new JalviewFileChooser("jc", "Jalview User Colours"); @@ -876,7 +876,7 @@ public class UserDefinedColours extends GUserDefinedColours protected void cancelButton_actionPerformed() { ap.alignFrame.changeColour(oldColourScheme); - ap.paintAlignment(true); + ap.paintAlignment(true, true); try { diff --git a/src/jalview/io/WSWUBlastClient.java b/src/jalview/io/WSWUBlastClient.java index 6e7df71..d526a31 100755 --- a/src/jalview/io/WSWUBlastClient.java +++ b/src/jalview/io/WSWUBlastClient.java @@ -184,7 +184,7 @@ public class WSWUBlastClient } } } - ap.paintAlignment(true); + ap.paintAlignment(true, false); } diff --git a/src/jalview/schemes/RNAHelicesColourChooser.java b/src/jalview/schemes/RNAHelicesColourChooser.java index 15cb157..9809fa9 100644 --- a/src/jalview/schemes/RNAHelicesColourChooser.java +++ b/src/jalview/schemes/RNAHelicesColourChooser.java @@ -58,7 +58,7 @@ public class RNAHelicesColourChooser oldcs = av.getGlobalColourScheme(); if (av.getAlignment().getGroups() != null) { - oldgroupColours = new Hashtable(); + oldgroupColours = new Hashtable<>(); for (SequenceGroup sg : ap.getAlignment().getGroups()) { if (sg.getColourScheme() != null) @@ -71,7 +71,7 @@ public class RNAHelicesColourChooser this.ap = ap; adjusting = true; - Vector list = new Vector(); + Vector list = new Vector<>(); int index = 1; AlignmentAnnotation[] anns = av.getAlignment().getAlignmentAnnotation(); if (anns != null) @@ -105,6 +105,6 @@ public class RNAHelicesColourChooser av.setGlobalColourScheme(rhc); - ap.paintAlignment(true); + ap.paintAlignment(true, true); } } diff --git a/src/jalview/workers/AnnotationWorker.java b/src/jalview/workers/AnnotationWorker.java index 8569039..8f37f15 100644 --- a/src/jalview/workers/AnnotationWorker.java +++ b/src/jalview/workers/AnnotationWorker.java @@ -51,7 +51,7 @@ class AnnotationWorker extends AlignCalcWorker AnnotationProviderI counter) { super(viewport, panel); - ourAnnots = new ArrayList(); + ourAnnots = new ArrayList<>(); this.counter = counter; calcMan.registerWorker(this); } @@ -121,7 +121,10 @@ class AnnotationWorker extends AlignCalcWorker if (ap != null) { ap.adjustAnnotationHeight(); - ap.paintAlignment(true); + // TODO: only need to update colour and geometry if panel height changes + // and view is coloured by annotation, and the annotation is actually + // changed! + ap.paintAlignment(true, true); } } diff --git a/src/jalview/workers/ColumnCounterSetWorker.java b/src/jalview/workers/ColumnCounterSetWorker.java index 24cb717..74695fe 100644 --- a/src/jalview/workers/ColumnCounterSetWorker.java +++ b/src/jalview/workers/ColumnCounterSetWorker.java @@ -57,7 +57,7 @@ class ColumnCounterSetWorker extends AlignCalcWorker AlignmentViewPanel panel, FeatureSetCounterI counter) { super(viewport, panel); - ourAnnots = new ArrayList(); + ourAnnots = new ArrayList<>(); this.counter = counter; calcMan.registerWorker(this); } @@ -116,7 +116,7 @@ class ColumnCounterSetWorker extends AlignCalcWorker { ap.adjustAnnotationHeight(); } - ap.paintAlignment(true); + ap.paintAlignment(true, true); } } diff --git a/src/jalview/workers/ConsensusThread.java b/src/jalview/workers/ConsensusThread.java index 4242b2a..335529c 100644 --- a/src/jalview/workers/ConsensusThread.java +++ b/src/jalview/workers/ConsensusThread.java @@ -64,7 +64,7 @@ public class ConsensusThread extends AlignCalcWorker { if (ap != null) { - ap.paintAlignment(false); + ap.paintAlignment(false, false); } Thread.sleep(200); } catch (Exception ex) @@ -93,7 +93,7 @@ public class ConsensusThread extends AlignCalcWorker if (ap != null) { - ap.paintAlignment(true); + ap.paintAlignment(true, true); } } catch (OutOfMemoryError error) { diff --git a/src/jalview/workers/ConservationThread.java b/src/jalview/workers/ConservationThread.java index 571234c..54b0191 100644 --- a/src/jalview/workers/ConservationThread.java +++ b/src/jalview/workers/ConservationThread.java @@ -75,7 +75,7 @@ public class ConservationThread extends AlignCalcWorker abortAndDestroy(); return; } - List ourAnnot = new ArrayList(); + List ourAnnot = new ArrayList<>(); AlignmentI alignment = alignViewport.getAlignment(); conservation = alignViewport.getAlignmentConservationAnnotation(); quality = alignViewport.getAlignmentQualityAnnot(); @@ -123,7 +123,7 @@ public class ConservationThread extends AlignCalcWorker } if (ap != null) { - ap.paintAlignment(true); + ap.paintAlignment(true, true); } } diff --git a/src/jalview/workers/StrucConsensusThread.java b/src/jalview/workers/StrucConsensusThread.java index 5ed2885..61ec3d0 100644 --- a/src/jalview/workers/StrucConsensusThread.java +++ b/src/jalview/workers/StrucConsensusThread.java @@ -139,7 +139,7 @@ public class StrucConsensusThread extends AlignCalcWorker calcMan.workerComplete(this); if (ap != null) { - ap.paintAlignment(true); + ap.paintAlignment(true, true); } } diff --git a/src/jalview/ws/DasSequenceFeatureFetcher.java b/src/jalview/ws/DasSequenceFeatureFetcher.java index 0a61dff..c661e2c 100644 --- a/src/jalview/ws/DasSequenceFeatureFetcher.java +++ b/src/jalview/ws/DasSequenceFeatureFetcher.java @@ -135,7 +135,7 @@ public class DasSequenceFeatureFetcher boolean useJDasMultiThread) { this.useJDASMultiThread = useJDasMultiThread; - this.selectedSources = new ArrayList(); + this.selectedSources = new ArrayList<>(); // filter both sequences and sources to eliminate duplicates for (jalviewSourceI src : selectedSources2) { @@ -316,17 +316,17 @@ public class DasSequenceFeatureFetcher FeaturesClientMultipleSources fc = new FeaturesClientMultipleSources(); fc.setConnProps(sourceRegistry.getSessionHandler()); // Now sending requests one at a time to each server - ArrayList srcobj = new ArrayList(); - ArrayList src = new ArrayList(); - List> ids = new ArrayList>(); - List> idobj = new ArrayList>(); - List> sqset = new ArrayList>(); + ArrayList srcobj = new ArrayList<>(); + ArrayList src = new ArrayList<>(); + List> ids = new ArrayList<>(); + List> idobj = new ArrayList<>(); + List> sqset = new ArrayList<>(); for (jalviewSourceI _sr : selectedSources) { - Map slist = new HashMap(); - List idob = new ArrayList(); - List qset = new ArrayList(); + Map slist = new HashMap<>(); + List idob = new ArrayList<>(); + List qset = new ArrayList<>(); for (SequenceI seq : sequences) { @@ -368,8 +368,8 @@ public class DasSequenceFeatureFetcher sqset.add(slist); } } - Map, Exception>> errors = new HashMap, Exception>>(); - Map, DasGFFAdapter>> results = new HashMap, DasGFFAdapter>>(); + Map, Exception>> errors = new HashMap<>(); + Map, DasGFFAdapter>> results = new HashMap<>(); if (!useJDASMultiThread) { Iterator sources = src.iterator(); @@ -390,7 +390,7 @@ public class DasSequenceFeatureFetcher if (ers == null) { results.put(source, - ers = new HashMap, DasGFFAdapter>()); + ers = new HashMap<>()); } ers.put(qid, dga); } catch (Exception ex) @@ -399,7 +399,7 @@ public class DasSequenceFeatureFetcher if (ers == null) { errors.put(source, - ers = new HashMap, Exception>()); + ers = new HashMap<>()); } ers.put(qid, ex); } @@ -438,7 +438,7 @@ public class DasSequenceFeatureFetcher Map, DasGFFAdapter> results, Map, Exception> errors) { - Set sequences = new HashSet(); + Set sequences = new HashSet<>(); String source = jvsource.getSourceURL(); // process features DasGFFAdapter result = (results == null) ? null : results.get(ids); @@ -622,7 +622,7 @@ public class DasSequenceFeatureFetcher if (seq == af.getViewport().getAlignment().getSequenceAt(index) .getDatasetSequence()) { - af.alignPanel.paintAlignment(true); + af.alignPanel.paintAlignment(true, true); index = end; break; } @@ -647,8 +647,8 @@ public class DasSequenceFeatureFetcher // TODO: minimal list of DAS queries to make by querying with untyped ID if // distinct from any typed IDs - List ids = new ArrayList(); - List qstring = new ArrayList(); + List ids = new ArrayList<>(); + List qstring = new ArrayList<>(); boolean dasCoordSysFound = false; if (uprefs != null) diff --git a/src/jalview/ws/jws2/AADisorderClient.java b/src/jalview/ws/jws2/AADisorderClient.java index c24ea05..9a2316c 100644 --- a/src/jalview/ws/jws2/AADisorderClient.java +++ b/src/jalview/ws/jws2/AADisorderClient.java @@ -99,22 +99,22 @@ public class AADisorderClient extends JabawsCalcWorker { // TODO: turn this into some kind of configuration file that's a bit easier // to edit - featureMap = new HashMap>(); + featureMap = new HashMap<>(); Map fmap; featureMap.put(compbio.ws.client.Services.IUPredWS.toString(), - fmap = new HashMap()); + fmap = new HashMap<>()); fmap.put("Glob", new String[] { "Globular Domain", "Predicted globular domain" }); featureMap.put(compbio.ws.client.Services.JronnWS.toString(), - fmap = new HashMap()); + fmap = new HashMap<>()); featureMap.put(compbio.ws.client.Services.DisemblWS.toString(), - fmap = new HashMap()); + fmap = new HashMap<>()); fmap.put("REM465", new String[] { "REM465", "Missing density" }); fmap.put("HOTLOOPS", new String[] { "HOTLOOPS", "Flexible loops" }); fmap.put("COILS", new String[] { "COILS", "Random coil" }); featureMap.put(compbio.ws.client.Services.GlobPlotWS.toString(), - fmap = new HashMap()); + fmap = new HashMap<>()); fmap.put("GlobDoms", new String[] { "Globular Domain", "Predicted globular domain" }); @@ -122,9 +122,9 @@ public class AADisorderClient extends JabawsCalcWorker new String[] { "Protein Disorder", "Probable unstructured peptide region" }); Map> amap; - annotMap = new HashMap>>(); + annotMap = new HashMap<>(); annotMap.put(compbio.ws.client.Services.GlobPlotWS.toString(), - amap = new HashMap>()); + amap = new HashMap<>()); amap.put("Dydx", new HashMap()); amap.get("Dydx").put(DONTCOMBINE, DONTCOMBINE); amap.get("Dydx").put(THRESHOLD, new double[] { 1, 0 }); @@ -135,7 +135,7 @@ public class AADisorderClient extends JabawsCalcWorker amap.put("RawScore", new HashMap()); amap.get("RawScore").put(INVISIBLE, INVISIBLE); annotMap.put(compbio.ws.client.Services.DisemblWS.toString(), - amap = new HashMap>()); + amap = new HashMap<>()); amap.put("COILS", new HashMap()); amap.put("HOTLOOPS", new HashMap()); amap.put("REM465", new HashMap()); @@ -148,7 +148,7 @@ public class AADisorderClient extends JabawsCalcWorker amap.get("REM465").put(RANGE, new float[] { 0, 1 }); annotMap.put(compbio.ws.client.Services.IUPredWS.toString(), - amap = new HashMap>()); + amap = new HashMap<>()); amap.put("Long", new HashMap()); amap.put("Short", new HashMap()); amap.get("Long").put(THRESHOLD, new double[] { 1, 0.5 }); @@ -156,7 +156,7 @@ public class AADisorderClient extends JabawsCalcWorker amap.get("Short").put(THRESHOLD, new double[] { 1, 0.5 }); amap.get("Short").put(RANGE, new float[] { 0, 1 }); annotMap.put(compbio.ws.client.Services.JronnWS.toString(), - amap = new HashMap>()); + amap = new HashMap<>()); amap.put("JRonn", new HashMap()); amap.get("JRonn").put(THRESHOLD, new double[] { 1, 0.5 }); amap.get("JRonn").put(RANGE, new float[] { 0, 1 }); @@ -173,8 +173,8 @@ public class AADisorderClient extends JabawsCalcWorker Map> annotTypeMap = annotMap .get(service.serviceType); boolean dispFeatures = false; - Map fc = new Hashtable(); - List ourAnnot = new ArrayList(); + Map fc = new Hashtable<>(); + List ourAnnot = new ArrayList<>(); /** * grouping for any annotation rows created */ @@ -358,7 +358,6 @@ public class AADisorderClient extends JabawsCalcWorker // only do this if the alignFrame is currently showing this view. af.setShowSeqFeatures(true); } - ap.paintAlignment(true); } if (ourAnnot.size() > 0) { @@ -366,6 +365,7 @@ public class AADisorderClient extends JabawsCalcWorker // new alignment annotation rows created. updateOurAnnots(ourAnnot); ap.adjustAnnotationHeight(); + ap.paintAlignment(true, true); } } } diff --git a/src/jalview/ws/jws2/AbstractJabaCalcWorker.java b/src/jalview/ws/jws2/AbstractJabaCalcWorker.java index 26fe0a2..b972ab8 100644 --- a/src/jalview/ws/jws2/AbstractJabaCalcWorker.java +++ b/src/jalview/ws/jws2/AbstractJabaCalcWorker.java @@ -372,7 +372,8 @@ public abstract class AbstractJabaCalcWorker extends AlignCalcWorker { guiProgress.setProgressBar("", progressId); } - ap.paintAlignment(true); + // TODO: may not need to paintAlignment again ! + ap.paintAlignment(false, false); } if (msg.length() > 0) { @@ -582,7 +583,7 @@ public abstract class AbstractJabaCalcWorker extends AlignCalcWorker protected boolean checkDone() { calcMan.notifyStart(this); - ap.paintAlignment(false); + ap.paintAlignment(false, false); while (!calcMan.notifyWorking(this)) { if (calcMan.isWorking(this)) @@ -593,7 +594,7 @@ public abstract class AbstractJabaCalcWorker extends AlignCalcWorker { if (ap != null) { - ap.paintAlignment(false); + ap.paintAlignment(false, false); } Thread.sleep(200);