From 675952adfc6e4c165f3e3fdb8384d6688637e972 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Fri, 21 Feb 2020 14:23:41 +0000 Subject: [PATCH] JAL-2422 tidy of methods and parameters --- src/jalview/ext/jmol/JalviewJmolBinding.java | 17 +++------- .../ext/rbvi/chimera/JalviewChimeraBinding.java | 14 -------- src/jalview/gui/AppJmol.java | 33 +++++++++--------- src/jalview/gui/ChimeraViewFrame.java | 12 +++---- src/jalview/gui/StructureViewerBase.java | 35 +++++++++----------- src/jalview/jbgui/GStructureViewer.java | 35 ++++++++++---------- 6 files changed, 59 insertions(+), 87 deletions(-) diff --git a/src/jalview/ext/jmol/JalviewJmolBinding.java b/src/jalview/ext/jmol/JalviewJmolBinding.java index b6e6a65..3b4a958 100644 --- a/src/jalview/ext/jmol/JalviewJmolBinding.java +++ b/src/jalview/ext/jmol/JalviewJmolBinding.java @@ -379,28 +379,21 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel } if (selectioncom.length() > 0) { - // TODO is performing selectioncom redundant here? is done later on - // System.out.println("Select regions:\n" + selectioncom.toString()); - executeCommand("select *; cartoons off; backbone; select (" - + selectioncom.toString() + "); cartoons; ", false); - // selcom.append("; ribbons; "); String cmdString = command.toString(); - // System.out.println("Superimpose command(s):\n" + cmdString); - executeCommand(cmdString, false); } } if (selectioncom.length() > 0) - {// finally, mark all regions that were superposed. - if (selectioncom.substring(selectioncom.length() - 1).equals("|")) + { + /* + * finally, highlight with cartoons the residues that were superposed + */ + if (selectioncom.charAt(selectioncom.length() - 1) == '|') { selectioncom.setLength(selectioncom.length() - 1); } - // System.out.println("Select regions:\n" + selectioncom.toString()); executeCommand("select *; cartoons off; backbone; select (" + selectioncom.toString() + "); cartoons; ", false); - // evalStateCommand("select *; backbone; select "+selcom.toString()+"; - // cartoons; center "+selcom.toString()); } return null; diff --git a/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java b/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java index 0192993..9695eae 100644 --- a/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java +++ b/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java @@ -673,18 +673,6 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel } } - // End StructureListener - // ////////////////////////// - - /** - * map between index of model filename returned from getPdbFile and the first - * index of models from this file in the viewer. Note - this is not trimmed - - * use getPdbFile to get number of unique models. - */ - private int _modelFileNameMap[]; - - // //////////////////////////////// - // /StructureListener @Override public synchronized String[] getStructureFiles() { @@ -941,8 +929,6 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel public int sendFeaturesToViewer(AlignmentViewPanel avp) { // TODO refactor as required to pull up to an interface - AlignmentI alignment = avp.getAlignment(); - String[] files = getStructureFiles(); if (files == null) { diff --git a/src/jalview/gui/AppJmol.java b/src/jalview/gui/AppJmol.java index daf31fc..0768c00 100644 --- a/src/jalview/gui/AppJmol.java +++ b/src/jalview/gui/AppJmol.java @@ -28,6 +28,7 @@ import jalview.datamodel.SequenceI; import jalview.gui.StructureViewer.ViewerType; import jalview.structures.models.AAStructureBindingModel; import jalview.util.BrowserLauncher; +import jalview.util.ImageMaker; import jalview.util.MessageManager; import jalview.util.Platform; import jalview.ws.dbsources.Pdb; @@ -38,7 +39,6 @@ import java.awt.Dimension; import java.awt.Font; import java.awt.Graphics; import java.awt.Rectangle; -import java.awt.event.ActionEvent; import java.io.File; import java.util.ArrayList; import java.util.List; @@ -404,7 +404,7 @@ public class AppJmol extends StructureViewerBase } else { - alignStructs_withAllAlignPanels(); + alignStructsWithAllAlignPanels(); } } }); @@ -516,41 +516,40 @@ public class AppJmol extends StructureViewerBase } @Override - public void eps_actionPerformed(ActionEvent e) + public void eps_actionPerformed() { - makePDBImage(jalview.util.ImageMaker.TYPE.EPS); + makePDBImage(ImageMaker.TYPE.EPS); } @Override - public void png_actionPerformed(ActionEvent e) + public void png_actionPerformed() { - makePDBImage(jalview.util.ImageMaker.TYPE.PNG); + makePDBImage(ImageMaker.TYPE.PNG); } - void makePDBImage(jalview.util.ImageMaker.TYPE type) + void makePDBImage(ImageMaker.TYPE type) { int width = getWidth(); int height = getHeight(); - jalview.util.ImageMaker im; + ImageMaker im; - if (type == jalview.util.ImageMaker.TYPE.PNG) + if (type == ImageMaker.TYPE.PNG) { - im = new jalview.util.ImageMaker(this, - jalview.util.ImageMaker.TYPE.PNG, "Make PNG image from view", + im = new ImageMaker(this, ImageMaker.TYPE.PNG, + "Make PNG image from view", width, height, null, null, null, 0, false); } - else if (type == jalview.util.ImageMaker.TYPE.EPS) + else if (type == ImageMaker.TYPE.EPS) { - im = new jalview.util.ImageMaker(this, - jalview.util.ImageMaker.TYPE.EPS, "Make EPS file from view", + im = new ImageMaker(this, ImageMaker.TYPE.EPS, + "Make EPS file from view", width, height, null, this.getTitle(), null, 0, false); } else { - im = new jalview.util.ImageMaker(this, - jalview.util.ImageMaker.TYPE.SVG, "Make SVG file from PCA", + ImageMaker.TYPE.SVG, "Make SVG file from PCA", width, height, null, this.getTitle(), null, 0, false); } @@ -562,7 +561,7 @@ public class AppJmol extends StructureViewerBase } @Override - public void showHelp_actionPerformed(ActionEvent actionEvent) + public void showHelp_actionPerformed() { try { diff --git a/src/jalview/gui/ChimeraViewFrame.java b/src/jalview/gui/ChimeraViewFrame.java index a92fe77..22336b9 100644 --- a/src/jalview/gui/ChimeraViewFrame.java +++ b/src/jalview/gui/ChimeraViewFrame.java @@ -556,7 +556,7 @@ public class ChimeraViewFrame extends StructureViewerBase @Override public void run() { - alignStructs_withAllAlignPanels(); + alignStructsWithAllAlignPanels(); } }).start(); } @@ -632,21 +632,21 @@ public class ChimeraViewFrame extends StructureViewerBase } @Override - public void eps_actionPerformed(ActionEvent e) + public void eps_actionPerformed() { throw new Error(MessageManager .getString("error.eps_generation_not_implemented")); } @Override - public void png_actionPerformed(ActionEvent e) + public void png_actionPerformed() { throw new Error(MessageManager .getString("error.png_generation_not_implemented")); } @Override - public void showHelp_actionPerformed(ActionEvent actionEvent) + public void showHelp_actionPerformed() { try { @@ -762,9 +762,9 @@ public class ChimeraViewFrame extends StructureViewerBase * @return */ @Override - protected String alignStructs_withAllAlignPanels() + protected String alignStructsWithAllAlignPanels() { - String reply = super.alignStructs_withAllAlignPanels(); + String reply = super.alignStructsWithAllAlignPanels(); if (reply != null) { statusBar.setText("Superposition failed: " + reply); diff --git a/src/jalview/gui/StructureViewerBase.java b/src/jalview/gui/StructureViewerBase.java index d3e6d75..aa39ee7 100644 --- a/src/jalview/gui/StructureViewerBase.java +++ b/src/jalview/gui/StructureViewerBase.java @@ -604,7 +604,7 @@ public abstract class StructureViewerBase extends GStructureViewer @Override public void actionPerformed(ActionEvent actionEvent) { - viewerColour_actionPerformed(actionEvent); + viewerColour_actionPerformed(); } }); colourMenu.add(viewerColour); @@ -620,7 +620,7 @@ public abstract class StructureViewerBase extends GStructureViewer @Override public void actionPerformed(ActionEvent actionEvent) { - background_actionPerformed(actionEvent); + background_actionPerformed(); } }); colourMenu.add(backGround); @@ -651,7 +651,7 @@ public abstract class StructureViewerBase extends GStructureViewer @Override public void actionPerformed(ActionEvent actionEvent) { - seqColour_actionPerformed(actionEvent); + seqColour_actionPerformed(); } }); @@ -663,7 +663,7 @@ public abstract class StructureViewerBase extends GStructureViewer @Override public void actionPerformed(ActionEvent actionEvent) { - chainColour_actionPerformed(actionEvent); + chainColour_actionPerformed(); } }); @@ -675,7 +675,7 @@ public abstract class StructureViewerBase extends GStructureViewer @Override public void actionPerformed(ActionEvent actionEvent) { - chargeColour_actionPerformed(actionEvent); + chargeColour_actionPerformed(); } }); @@ -707,7 +707,7 @@ public abstract class StructureViewerBase extends GStructureViewer else { // update the Chimera display now. - seqColour_actionPerformed(null); + seqColour_actionPerformed(); } } }); @@ -757,12 +757,7 @@ public abstract class StructureViewerBase extends GStructureViewer * the operation. */ @Override - protected String alignStructs_actionPerformed(ActionEvent actionEvent) - { - return alignStructs_withAllAlignPanels(); - } - - protected String alignStructs_withAllAlignPanels() + protected String alignStructsWithAllAlignPanels() { if (getAlignmentPanel() == null) { @@ -809,7 +804,7 @@ public abstract class StructureViewerBase extends GStructureViewer } @Override - public void background_actionPerformed(ActionEvent actionEvent) + public void background_actionPerformed() { Color col = JColorChooser.showDialog(this, MessageManager.getString("label.select_background_colour"), @@ -821,7 +816,7 @@ public abstract class StructureViewerBase extends GStructureViewer } @Override - public void viewerColour_actionPerformed(ActionEvent actionEvent) + public void viewerColour_actionPerformed() { if (viewerColour.isSelected()) { @@ -831,21 +826,21 @@ public abstract class StructureViewerBase extends GStructureViewer } @Override - public void chainColour_actionPerformed(ActionEvent actionEvent) + public void chainColour_actionPerformed() { chainColour.setSelected(true); getBinding().colourByChain(); } @Override - public void chargeColour_actionPerformed(ActionEvent actionEvent) + public void chargeColour_actionPerformed() { chargeColour.setSelected(true); getBinding().colourByCharge(); } @Override - public void seqColour_actionPerformed(ActionEvent actionEvent) + public void seqColour_actionPerformed() { AAStructureBindingModel binding = getBinding(); binding.setColourBySequence(seqColour.isSelected()); @@ -873,7 +868,7 @@ public abstract class StructureViewerBase extends GStructureViewer } @Override - public void pdbFile_actionPerformed(ActionEvent actionEvent) + public void pdbFile_actionPerformed() { JalviewFileChooser chooser = new JalviewFileChooser( Cache.getProperty("LAST_DIRECTORY")); @@ -924,7 +919,7 @@ public abstract class StructureViewerBase extends GStructureViewer } @Override - public void viewMapping_actionPerformed(ActionEvent actionEvent) + public void viewMapping_actionPerformed() { CutAndPasteTransfer cap = new CutAndPasteTransfer(); try @@ -986,7 +981,7 @@ public abstract class StructureViewerBase extends GStructureViewer if (!binding.isLoadingFromArchive()) { - seqColour_actionPerformed(null); + seqColour_actionPerformed(); } } diff --git a/src/jalview/jbgui/GStructureViewer.java b/src/jalview/jbgui/GStructureViewer.java index 83d8590..1fccdcb 100644 --- a/src/jalview/jbgui/GStructureViewer.java +++ b/src/jalview/jbgui/GStructureViewer.java @@ -104,7 +104,7 @@ public abstract class GStructureViewer extends JInternalFrame @Override public void actionPerformed(ActionEvent actionEvent) { - pdbFile_actionPerformed(actionEvent); + pdbFile_actionPerformed(); } }); @@ -115,7 +115,7 @@ public abstract class GStructureViewer extends JInternalFrame @Override public void actionPerformed(ActionEvent actionEvent) { - png_actionPerformed(actionEvent); + png_actionPerformed(); } }); @@ -126,7 +126,7 @@ public abstract class GStructureViewer extends JInternalFrame @Override public void actionPerformed(ActionEvent actionEvent) { - eps_actionPerformed(actionEvent); + eps_actionPerformed(); } }); @@ -137,7 +137,7 @@ public abstract class GStructureViewer extends JInternalFrame @Override public void actionPerformed(ActionEvent actionEvent) { - viewMapping_actionPerformed(actionEvent); + viewMapping_actionPerformed(); } }); @@ -167,7 +167,7 @@ public abstract class GStructureViewer extends JInternalFrame @Override public void actionPerformed(ActionEvent actionEvent) { - showHelp_actionPerformed(actionEvent); + showHelp_actionPerformed(); } }); alignStructs = new JMenuItem(); @@ -178,7 +178,7 @@ public abstract class GStructureViewer extends JInternalFrame @Override public void actionPerformed(ActionEvent actionEvent) { - alignStructs_actionPerformed(actionEvent); + alignStructsWithAllAlignPanels(); } }); @@ -216,54 +216,53 @@ public abstract class GStructureViewer extends JInternalFrame { } - protected void viewerColour_actionPerformed(ActionEvent actionEvent) + protected void viewerColour_actionPerformed() { } - protected abstract String alignStructs_actionPerformed( - ActionEvent actionEvent); + protected abstract String alignStructsWithAllAlignPanels(); - public void pdbFile_actionPerformed(ActionEvent actionEvent) + public void pdbFile_actionPerformed() { } - public void png_actionPerformed(ActionEvent actionEvent) + public void png_actionPerformed() { } - public void eps_actionPerformed(ActionEvent actionEvent) + public void eps_actionPerformed() { } - public void viewMapping_actionPerformed(ActionEvent actionEvent) + public void viewMapping_actionPerformed() { } - public void seqColour_actionPerformed(ActionEvent actionEvent) + public void seqColour_actionPerformed() { } - public void chainColour_actionPerformed(ActionEvent actionEvent) + public void chainColour_actionPerformed() { } - public void chargeColour_actionPerformed(ActionEvent actionEvent) + public void chargeColour_actionPerformed() { } - public void background_actionPerformed(ActionEvent actionEvent) + public void background_actionPerformed() { } - public void showHelp_actionPerformed(ActionEvent actionEvent) + public void showHelp_actionPerformed() { } -- 1.7.10.2