From: amwaterhouse Date: Sat, 16 Apr 2005 13:46:56 +0000 (+0000) Subject: AlignPanel RefreshPanels put into paintComponent X-Git-Tag: Release_2_0~401 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=79f4b175e12f4c16d598b4cb56ffe62532b592a1;p=jalview.git AlignPanel RefreshPanels put into paintComponent --- diff --git a/src/jalview/analysis/SequenceFeatureFetcher.java b/src/jalview/analysis/SequenceFeatureFetcher.java index 667a2dd..2c0aaac 100755 --- a/src/jalview/analysis/SequenceFeatureFetcher.java +++ b/src/jalview/analysis/SequenceFeatureFetcher.java @@ -99,7 +99,7 @@ public class SequenceFeatureFetcher implements Runnable } }catch(Exception ex){ex.printStackTrace();} - ap.RefreshPanels(); + ap.repaint(); findMissingIds(align); if(sbuffer.length()>0) { diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 3625e45..c12cf09 100755 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -247,8 +247,7 @@ public class AlignFrame extends GAlignFrame viewport.setAlignment( new Alignment(seq) ); updateEditMenuBar(); viewport.updateConsensus(); - alignPanel.RefreshPanels(); - alignPanel.RefreshPanels(); + alignPanel.repaint(); } public void moveSelectedSequences(boolean up) @@ -290,7 +289,7 @@ public class AlignFrame extends GAlignFrame } } - alignPanel.RefreshPanels(); + alignPanel.repaint(); } @@ -365,7 +364,7 @@ public class AlignFrame extends GAlignFrame viewport.alignment.getWidth(); viewport.updateConservation(); viewport.updateConsensus(); - alignPanel.RefreshPanels(); + alignPanel.repaint(); } }catch(Exception ex){}// could be anything being pasted in here @@ -408,7 +407,7 @@ public class AlignFrame extends GAlignFrame }catch(Exception ex){} viewport.updateConservation(); viewport.updateConsensus(); - alignPanel.RefreshPanels(); + alignPanel.repaint(); } @@ -421,8 +420,8 @@ public class AlignFrame extends GAlignFrame viewport.setAlignment( new Alignment(seq) ); updateEditMenuBar(); viewport.updateConsensus(); - alignPanel.RefreshPanels(); - alignPanel.RefreshPanels(); + alignPanel.repaint(); + alignPanel.repaint(); } @@ -431,7 +430,7 @@ public class AlignFrame extends GAlignFrame viewport.alignment.deleteAllGroups(); viewport.setSelectionGroup(null); - alignPanel.RefreshPanels(); + alignPanel.repaint(); } @@ -489,7 +488,7 @@ public class AlignFrame extends GAlignFrame viewport.alignment.deleteGroup(sg); } - alignPanel.RefreshPanels(); + alignPanel.repaint(); } } @@ -514,7 +513,7 @@ public class AlignFrame extends GAlignFrame - alignPanel.RefreshPanels(); + alignPanel.repaint(); } } @@ -525,7 +524,7 @@ public class AlignFrame extends GAlignFrame viewport.getAlignment().removeGaps(); viewport.updateConservation(); viewport.updateConsensus(); - alignPanel.RefreshPanels(); + alignPanel.repaint(); } public void removeAllGapsMenuItem_actionPerformed(ActionEvent e) @@ -547,7 +546,7 @@ public class AlignFrame extends GAlignFrame } viewport.updateConservation(); viewport.updateConsensus(); - alignPanel.RefreshPanels(); + alignPanel.repaint(); } public void setGapCharMenuItem_actionPerformed(ActionEvent e) @@ -561,7 +560,7 @@ public class AlignFrame extends GAlignFrame } setGapCharMenuItem.setText("Set gap character to \""+nextChar+"\""); viewport.setGapCharacter(thisChar); - alignPanel.RefreshPanels(); + alignPanel.repaint(); } public void findMenuItem_actionPerformed(ActionEvent e) @@ -589,13 +588,13 @@ public class AlignFrame extends GAlignFrame viewport.setShowFullId( fullSeqId.isSelected() ); alignPanel.idPanel.idCanvas.setPreferredSize( alignPanel.calculateIdWidth() ); - alignPanel.RefreshPanels(); + alignPanel.repaint(); } protected void colourTextMenuItem_actionPerformed(ActionEvent e) { viewport.setColourText( colourTextMenuItem.isSelected() ); - alignPanel.RefreshPanels(); + alignPanel.repaint(); } protected void wrapMenuItem_actionPerformed(ActionEvent e) @@ -605,7 +604,7 @@ public class AlignFrame extends GAlignFrame scaleAbove.setVisible( wrapMenuItem.isSelected() ); scaleLeft.setVisible( wrapMenuItem.isSelected() ); scaleRight.setVisible( wrapMenuItem.isSelected() ); - alignPanel.RefreshPanels(); + alignPanel.repaint(); } protected void scaleAbove_actionPerformed(ActionEvent e) @@ -631,20 +630,20 @@ public class AlignFrame extends GAlignFrame public void viewBoxesMenuItem_actionPerformed(ActionEvent e) { viewport.setShowBoxes( viewBoxesMenuItem.isSelected() ); - alignPanel.RefreshPanels(); + alignPanel.repaint(); } public void viewTextMenuItem_actionPerformed(ActionEvent e) { viewport.setShowText( viewTextMenuItem.isSelected() ); - alignPanel.RefreshPanels(); + alignPanel.repaint(); } protected void renderGapsMenuItem_actionPerformed(ActionEvent e) { viewport.setRenderGaps(renderGapsMenuItem.isSelected()); - alignPanel.RefreshPanels(); + alignPanel.repaint(); } public void sequenceFeatures_actionPerformed(ActionEvent evt) @@ -655,7 +654,7 @@ public class AlignFrame extends GAlignFrame AlignmentUtil.fetchSequenceFeatures( viewport.alignment , alignPanel); ((Alignment)viewport.alignment).featuresAdded = true; } - alignPanel.RefreshPanels(); + alignPanel.repaint(); } public void annotationPanelMenuItem_actionPerformed(ActionEvent e) @@ -870,7 +869,7 @@ public class AlignFrame extends GAlignFrame - alignPanel.RefreshPanels(); + alignPanel.repaint(); } protected void modifyPID_actionPerformed(ActionEvent e) @@ -952,14 +951,14 @@ public class AlignFrame extends GAlignFrame { addHistoryItem("sort"); AlignmentSorter.sortByPID(viewport.getAlignment(), viewport.getAlignment().getSequenceAt(0)); - alignPanel.RefreshPanels(); + alignPanel.repaint(); } public void sortIDMenuItem_actionPerformed(ActionEvent e) { addHistoryItem("sort"); AlignmentSorter.sortByID( viewport.getAlignment() ); - alignPanel.RefreshPanels(); + alignPanel.repaint(); } public void sortGroupMenuItem_actionPerformed(ActionEvent e) @@ -967,7 +966,7 @@ public class AlignFrame extends GAlignFrame addHistoryItem("sort"); AlignmentSorter.sortByGroup(viewport.getAlignment()); AlignmentSorter.sortGroups(viewport.getAlignment()); - alignPanel.RefreshPanels(); + alignPanel.repaint(); } public void removeRedundancyMenuItem_actionPerformed(ActionEvent e) @@ -1078,7 +1077,7 @@ public class AlignFrame extends GAlignFrame { addHistoryItem("sort"); AlignmentSorter.sortByTree(viewport.getAlignment(), treePanel.getTree()); - alignPanel.RefreshPanels(); + alignPanel.repaint(); } }); diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index 0cbdfbe..98eb180 100755 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -59,19 +59,7 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene scalePanelHolder.add(scalePanel, BorderLayout.CENTER); seqPanelHolder.add(seqPanel, BorderLayout.CENTER); - javax.swing.SwingUtilities.invokeLater(new Runnable() - { - public void run() - { - invalidate(); - setScrollValues(0,0); - Dimension d = calculateIdWidth(); - d.setSize( d.width+4, d.height); - idPanel.idCanvas.setPreferredSize( d ); - RefreshPanels(); - } - }); - + setScrollValues(0, 0); hscroll.addAdjustmentListener(this); vscroll.addAdjustmentListener(this); @@ -80,7 +68,7 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene { public void componentResized(ComponentEvent evt) { - RefreshPanels(); + repaint(); } }); @@ -93,7 +81,7 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene { case 27: // escape key av.setSelectionGroup(null); - RefreshPanels(); + repaint(); break; case KeyEvent.VK_X: if(evt.isControlDown()) @@ -203,14 +191,6 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene { annotationSpaceFillerHolder.setVisible(b); annotationScroller.setVisible(b); - javax.swing.SwingUtilities.invokeLater(new Runnable() - { - public void run() - { - RefreshPanels(); - } - }); - } @@ -224,13 +204,8 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene annotationScroller.setVisible(!wrap); annotationSpaceFillerHolder.setVisible(!wrap); idSpaceFillerPanel1.setVisible(!wrap); - javax.swing.SwingUtilities.invokeLater(new Runnable() - { - public void run() - { - RefreshPanels(); - } - }); + + repaint(); } @@ -255,30 +230,6 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene } - RefreshPanels(); - } - - - public void RefreshPanels() - { - - Dimension d = idPanel.idCanvas.getPreferredSize(); - idPanelHolder.setPreferredSize(d); - hscrollFillerPanel.setPreferredSize(new Dimension(d.width, 12)); - - if (av.getWrapAlignment()) - { - int max = av.alignment.getWidth() / seqPanel.seqCanvas.getWrappedCanvasWidth(seqPanel.seqCanvas.getWidth()); - vscroll.setValues(0, 1, 0, max); - } - else - { - if (overviewPanel != null) - overviewPanel.updateOverviewImage(); - setScrollValues(av.getStartRes(), av.getStartSeq()); - } - - validate(); repaint(); } @@ -403,6 +354,31 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene } + public void paintComponent(Graphics g) + { + invalidate(); + + Dimension d = idPanel.idCanvas.getPreferredSize(); + idPanelHolder.setPreferredSize(d); + hscrollFillerPanel.setPreferredSize(new Dimension(d.width, 12)); + + if (av.getWrapAlignment()) + { + int max = av.alignment.getWidth() / seqPanel.seqCanvas.getWrappedCanvasWidth(seqPanel.seqCanvas.getWidth()); + vscroll.setMaximum(max); + vscroll.setUnitIncrement(1); + } + else + { + if (overviewPanel != null) + overviewPanel.updateOverviewImage(); + setScrollValues(av.getStartRes(), av.getStartSeq()); + } + + validate(); + + } + public int print(Graphics pg, PageFormat pf, int pi) throws PrinterException { pg.translate((int)pf.getImageableX(), (int)pf.getImageableY()); diff --git a/src/jalview/gui/AnnotationLabels.java b/src/jalview/gui/AnnotationLabels.java index 3332f08..26cba7a 100755 --- a/src/jalview/gui/AnnotationLabels.java +++ b/src/jalview/gui/AnnotationLabels.java @@ -84,7 +84,7 @@ public class AnnotationLabels extends JPanel implements MouseListener, MouseMoti } ap.annotationPanel.adjustPanelHeight(); - ap.RefreshPanels(); + ap.repaint(); } @@ -156,7 +156,7 @@ public class AnnotationLabels extends JPanel implements MouseListener, MouseMoti ap.annotationScroller.setPreferredSize(new Dimension(d.width,d.height - dif)); d = ap.annotationSpaceFillerHolder.getPreferredSize(); ap.annotationSpaceFillerHolder.setPreferredSize(new Dimension(d.width,d.height - dif)); - ap.RefreshPanels(); + ap.repaint(); } ap.addNotify(); } diff --git a/src/jalview/gui/FontChooser.java b/src/jalview/gui/FontChooser.java index 3edbdb6..e04c177 100755 --- a/src/jalview/gui/FontChooser.java +++ b/src/jalview/gui/FontChooser.java @@ -52,7 +52,7 @@ public class FontChooser extends GFontChooser protected void cancel_actionPerformed(ActionEvent e) { ap.av.setFont(oldFont); - ap.RefreshPanels(); + ap.repaint(); fontName.setSelectedItem(oldFont.getName()); fontSize.setSelectedItem(oldFont.getSize()+""); fontStyle.setSelectedIndex(oldFont.getStyle()); diff --git a/src/jalview/gui/IdwidthAdjuster.java b/src/jalview/gui/IdwidthAdjuster.java index 81e9da7..6872136 100755 --- a/src/jalview/gui/IdwidthAdjuster.java +++ b/src/jalview/gui/IdwidthAdjuster.java @@ -38,8 +38,7 @@ public class IdwidthAdjuster extends JPanel implements MouseListener, MouseMotio if(d.width+dif>20 || dif>0) { ap.idPanel.idCanvas.setPreferredSize(new Dimension(d.width + dif,d.height)); - ap.invalidate(); - ap.RefreshPanels(); + ap.repaint(); } oldX = evt.getX(); diff --git a/src/jalview/gui/PopupMenu.java b/src/jalview/gui/PopupMenu.java index b04530c..b07dce8 100755 --- a/src/jalview/gui/PopupMenu.java +++ b/src/jalview/gui/PopupMenu.java @@ -546,7 +546,7 @@ public class PopupMenu extends JPopupMenu if(s!=null) { sequence.setName(s); - ap.RefreshPanels(); + ap.repaint(); } } @@ -556,7 +556,7 @@ public class PopupMenu extends JPopupMenu SequenceGroup sg = ap.av.getSelectionGroup(); ap.av.alignment.deleteGroup(sg); ap.av.setSelectionGroup(null); - ap.RefreshPanels(); + ap.repaint(); } void pdbMenuItem_actionPerformed(ActionEvent e) diff --git a/src/jalview/gui/RedundancyPanel.java b/src/jalview/gui/RedundancyPanel.java index 3eec476..93ffd9c 100755 --- a/src/jalview/gui/RedundancyPanel.java +++ b/src/jalview/gui/RedundancyPanel.java @@ -76,7 +76,7 @@ public class RedundancyPanel extends GSliderPanel } } - ap.RefreshPanels(); + ap.repaint(); } @@ -85,7 +85,7 @@ public class RedundancyPanel extends GSliderPanel undoButton.setEnabled(false); ap.av.setAlignment( new Alignment(oldAlignment) ); oldAlignment = null; - ap.RefreshPanels(); + ap.repaint(); } diff --git a/src/jalview/gui/ScalePanel.java b/src/jalview/gui/ScalePanel.java index 01ba119..e49eb17 100755 --- a/src/jalview/gui/ScalePanel.java +++ b/src/jalview/gui/ScalePanel.java @@ -65,7 +65,7 @@ public class ScalePanel extends JPanel ap.annotationPanel.addEditableColumn(res); } av.setSelectionGroup(sg); - ap.RefreshPanels(); + ap.repaint(); } public void doMouseReleased(MouseEvent evt) @@ -87,7 +87,7 @@ public class ScalePanel extends JPanel sg.setStartRes(res); stretchingGroup = false; - ap.RefreshPanels(); + ap.repaint(); } public void doMouseDragged(MouseEvent evt) @@ -105,7 +105,7 @@ public class ScalePanel extends JPanel sg.setStartRes(res); ap.annotationPanel.addEditableColumn(res); - ap.RefreshPanels(); + ap.repaint(); } } diff --git a/src/jalview/gui/SeqCanvas.java b/src/jalview/gui/SeqCanvas.java index 6dc2acd..c243a2e 100755 --- a/src/jalview/gui/SeqCanvas.java +++ b/src/jalview/gui/SeqCanvas.java @@ -133,11 +133,19 @@ public void fastPaint(int horizontal, int vertical) else if (vertical > 0) // scroll down { - transY = imgHeight - vertical * av.charHeight; ss = es - vertical; + if(ss av.endSeq) + es = av.endSeq; + } + gg.translate(transX, transY); diff --git a/src/jalview/gui/SeqPanel.java b/src/jalview/gui/SeqPanel.java index 0fa6d17..0b84fa5 100755 --- a/src/jalview/gui/SeqPanel.java +++ b/src/jalview/gui/SeqPanel.java @@ -115,8 +115,7 @@ public class SeqPanel extends JPanel seqEditOccurred = -1; - ap.RefreshPanels(); - repaint(); + ap.repaint(); } diff --git a/src/jalview/gui/UserDefinedColours.java b/src/jalview/gui/UserDefinedColours.java index 05edac5..25820c9 100755 --- a/src/jalview/gui/UserDefinedColours.java +++ b/src/jalview/gui/UserDefinedColours.java @@ -119,7 +119,7 @@ public class UserDefinedColours extends GUserDefinedColours implements ChangeLis else ap.av.setGlobalColourScheme(ucs); - ap.RefreshPanels(); + ap.repaint(); } protected void loadbutton_actionPerformed(ActionEvent e) @@ -200,7 +200,7 @@ public class UserDefinedColours extends GUserDefinedColours implements ChangeLis else ap.av.setGlobalColourScheme(ucs); - ap.RefreshPanels(); + ap.repaint(); }