From c36a5cbdcbb1c099320e1454c1038327efa04efa Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Wed, 15 Dec 2004 17:15:25 +0000 Subject: [PATCH] REpainting after graph panel setVisible fixed --- src/jalview/gui/AlignmentPanel.java | 160 ++--------------------------------- 1 file changed, 9 insertions(+), 151 deletions(-) diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index fcb5a57..bc6ea86 100755 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -75,8 +75,11 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene public void setGraphPanelVisible(boolean b) { - scorePanelHolder.setVisible(b); idSpaceFillerPanel.setVisible(b); + scorePanelHolder.setVisible(b); + + RefreshPanels(); + // bit annoying to call this twice, can you do better? RefreshPanels(); } @@ -113,168 +116,21 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene seqPanel.seqCanvas.paintFlag = true; repaint(); } - /* - seqCanvas.paintFlag = true; - if (av.getSelection().size() == 0) - { - seqCanvas.globalColorScheme = cs; - for (int i = 0; i < av.alignment.getGroups().size();i++) - { - SequenceGroup sg = (SequenceGroup)av.alignment.getGroups().elementAt(i); - sg.cs = cs; - if(!showConservation - && !(sg.cs instanceof Blosum62ColourScheme) - && sg.cs instanceof ConservationColourScheme) - { - // remove ConservationColouring from existing Conservation group - ConservationColourScheme ccs = (ConservationColourScheme)sg.cs; - sg.cs = ccs.cs; - } - else if(showConservation && !(sg.cs instanceof ConservationColourScheme)) - { - // add ConservationColouring to new group - Conservation c = sg.getConservation(); - Alignment al = (Alignment) av.getAlignment(); - c = new Conservation("All", al.cons, - ResidueProperties.propHash, 3, sg.sequences, 0, - al.getWidth() ); - c.calculate(); - c.verdict(false, 100); - sg.setConservation(c); - sg.cs = new ConservationColourScheme(sg); - } - } - } - else - { - SequenceGroup sg = av.alignment.findGroup((Sequence)av.sel.sequenceAt(0)); - - if( isNewSelection(sg) ) - { - sg = av.getAlignment().addGroup(); - for (int i=0; i < av.getSelection().size(); i++) - { - av.alignment.removeFromGroup(av.alignment.findGroup( (Sequence) av. - sel.sequenceAt(i)), - (Sequence) av.sel.sequenceAt(i)); - av.alignment.addToGroup(sg, (Sequence) av.sel.sequenceAt(i)); - } - } - - - sg.cs = cs; - - // Selection is made, we only want to change the conservationColour for selected group - if( showConservation - && !(sg.cs instanceof ConservationColourScheme) - && !(sg.cs instanceof Blosum62ColourScheme)) - { - Conservation c = sg.getConservation(); - Alignment al = (Alignment) av.getAlignment(); - - c = new Conservation("All", al.cons, - ResidueProperties.propHash, 3, sg.sequences, 0, - al.getWidth() ); - c.calculate(); - c.verdict(false, 100); - sg.setConservation(c); - sg.cs = new ConservationColourScheme(sg); - } - else if( !showConservation && sg.cs instanceof ConservationColourScheme) - { - ConservationColourScheme ccs = (ConservationColourScheme)sg.cs; - sg.cs = ccs.cs; - } - } - repaint(); - } - - boolean isNewSelection(SequenceGroup sg) - { - if(sg==null) - return true; - - if(sg.getSize()!=av.getSelection().size()) - return true; - - for(int i=0; i0) - return av.alignment.findGroup((Sequence)av.sel.sequenceAt(0)).cs; - else - return seqCanvas.globalColorScheme; - } -*/ - -/* public void setColourScheme(jalview.schemes.ColourSchemeI cs, boolean conservation) - { - seqPanel.setColourScheme(cs, conservation); - - av.setGlobalColourScheme(cs); - - if(overviewPanel!=null) - overviewPanel.updateOverviewImage(); - } - - void updateResidueView() - { - if (viewport.getSelection().size() == 0) - { - for (int i = 0; i < viewport.alignment.getGroups().size(); i++) - { - SequenceGroup sg = (SequenceGroup) viewport.alignment.getGroups().elementAt(i); - sg.setDisplayBoxes( viewBoxesMenuItem.isSelected() ); - sg.setDisplayText( viewTextMenuItem.isSelected() ); - sg.setColourText( colourTextMenuItem.isSelected() ); - } - } - else - { - SequenceGroup sg = viewport.alignment.findGroup( (Sequence) viewport.sel.sequenceAt(0)); - if (alignPanel.seqPanel.isNewSelection(sg)) - { - sg = viewport.getAlignment().addGroup(); - for (int i = 0; i < viewport.getSelection().size(); i++) - { - viewport.alignment.removeFromGroup(viewport.alignment.findGroup( ( - Sequence) viewport.sel.sequenceAt(i)), - (Sequence) viewport.sel.sequenceAt( - i)); - viewport.alignment.addToGroup(sg, - (Sequence) viewport.sel.sequenceAt(i)); - } - } - - sg.setDisplayBoxes(viewBoxesMenuItem.isSelected()); - sg.setDisplayText(viewTextMenuItem.isSelected()); - sg.setColourText(colourTextMenuItem.isSelected()); - } - alignPanel.RefreshPanels(); - }*/ - - public void RefreshPanels() { + invalidate(); seqPanel.seqCanvas.paintFlag = true; idPanel.idCanvas.paintFlag = true; idPanelHolder.setPreferredSize( idPanel.idCanvas.getPreferredSize() ); setScrollValues(av.getStartRes(), av.getStartSeq()); av.getConsensus(true); - validate(); - repaint(); if(overviewPanel!=null) overviewPanel.updateOverviewImage(); + validate(); + repaint(); } int hextent = 0; @@ -299,6 +155,8 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene hscroll.setValues(x,hextent,0,av.getAlignment().getWidth()); vscroll.setValues(y,vextent,0,av.getAlignment().getHeight() ); + + repaint(); } -- 1.7.10.2