From 4618ad78a2bb127995d1eb92fd2286d24ec3c87a Mon Sep 17 00:00:00 2001 From: gmungoc Date: Mon, 23 Feb 2015 15:48:13 +0000 Subject: [PATCH] JAL-845 repaint of complementary selection (applet) --- src/jalview/appletgui/AlignFrame.java | 23 ++++++++++++++++ src/jalview/appletgui/SeqPanel.java | 4 +-- src/jalview/appletgui/SplitFrame.java | 47 +++++++++++++++++++++++---------- 3 files changed, 58 insertions(+), 16 deletions(-) diff --git a/src/jalview/appletgui/AlignFrame.java b/src/jalview/appletgui/AlignFrame.java index dc4539e..447f5e3 100644 --- a/src/jalview/appletgui/AlignFrame.java +++ b/src/jalview/appletgui/AlignFrame.java @@ -23,6 +23,7 @@ package jalview.appletgui; import jalview.analysis.AlignmentSorter; import jalview.api.AlignViewControllerGuiI; import jalview.api.AlignViewControllerI; +import jalview.api.AlignViewportI; import jalview.api.FeatureRenderer; import jalview.api.SequenceStructureBinding; import jalview.bin.JalviewLite; @@ -64,6 +65,7 @@ import jalview.schemes.TurnColourScheme; import jalview.schemes.ZappoColourScheme; import jalview.structure.StructureSelectionManager; import jalview.structures.models.AAStructureBindingModel; +import jalview.util.MappingUtils; import jalview.util.MessageManager; import java.awt.BorderLayout; @@ -1585,6 +1587,12 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, return originalSource; } + /** + * Move the currently selected sequences up or down one position in the + * alignment + * + * @param up + */ public void moveSelectedSequences(boolean up) { SequenceGroup sg = viewport.getSelectionGroup(); @@ -1595,6 +1603,21 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, viewport.getAlignment().moveSelectedSequencesByOne(sg, up ? null : viewport.getHiddenRepSequences(), up); alignPanel.paintAlignment(true); + + /* + * Also move cDNA/protein complement sequences + */ + AlignViewportI complement = viewport.getCodingComplement(); + if (complement != null) + { + SequenceGroup mappedSelection = MappingUtils.mapSequenceGroup(sg, + viewport, complement); + complement.getAlignment().moveSelectedSequencesByOne(mappedSelection, + up ? null : complement.getHiddenRepSequences(), up); + // TODO need to trigger a repaint of the complementary panel - how? + // would prefer to handle in SplitFrame but it is not overriding key + // listener chiz + } } synchronized void slideSequences(boolean right, int size) diff --git a/src/jalview/appletgui/SeqPanel.java b/src/jalview/appletgui/SeqPanel.java index 8a526ac..090779e 100644 --- a/src/jalview/appletgui/SeqPanel.java +++ b/src/jalview/appletgui/SeqPanel.java @@ -1965,8 +1965,8 @@ public class SeqPanel extends Panel implements MouseMotionListener, av.setColumnSelection(cs); av.isColSelChanged(true); - firePropertyChange("alignment", null, av.getAlignment().getSequences()); - // PaintRefresher.Refresh(this, av.getSequenceSetId()); + ap.scalePanelHolder.repaint(); + ap.repaint(); return true; } diff --git a/src/jalview/appletgui/SplitFrame.java b/src/jalview/appletgui/SplitFrame.java index 4f61f4a..fb11a5c 100644 --- a/src/jalview/appletgui/SplitFrame.java +++ b/src/jalview/appletgui/SplitFrame.java @@ -8,8 +8,12 @@ import jalview.datamodel.AlignmentI; import jalview.structure.StructureSelectionManager; import java.awt.BorderLayout; +import java.awt.Component; import java.awt.GridLayout; +import java.awt.MouseInfo; import java.awt.Panel; +import java.awt.Point; +import java.awt.Rectangle; public class SplitFrame extends EmbmenuFrame { @@ -39,16 +43,7 @@ public class SplitFrame extends EmbmenuFrame */ public void init() { - setMenuBar(null); - outermost = new Panel(new GridLayout(2, 1)); - - Panel topPanel = new Panel(); - Panel bottomPanel = new Panel(); - outermost.add(topPanel); - outermost.add(bottomPanel); - - addAlignFrameComponents(topFrame, topPanel); - addAlignFrameComponents(bottomFrame, bottomPanel); + constructSplit(); /* * Try to make and add dna/protein sequence mappings @@ -74,16 +69,40 @@ public class SplitFrame extends EmbmenuFrame ssm.addCommandListener(protein); } - /* - * Expand protein to 3 times character width of dna - */ + setCharacterWidth(protein, cdna); + } + + /** + * + */ + protected void constructSplit() + { + setMenuBar(null); + outermost = new Panel(new GridLayout(2, 1)); + + Panel topPanel = new Panel(); + Panel bottomPanel = new Panel(); + outermost.add(topPanel); + outermost.add(bottomPanel); + + addAlignFrameComponents(topFrame, topPanel); + addAlignFrameComponents(bottomFrame, bottomPanel); + } + + /** + * Expand protein to 3 times character width of dna + * + * @param protein + * @param cdna + */ + protected void setCharacterWidth(AlignViewport protein, AlignViewport cdna) + { if (protein != null && cdna != null) { ViewStyleI vs = protein.getViewStyle(); vs.setCharWidth(3 * vs.getCharWidth()); protein.setViewStyle(vs); } - } /** -- 1.7.10.2