From bc455f675d56d49d0a0f132809d8117f7ffca5ab Mon Sep 17 00:00:00 2001 From: gmungoc Date: Fri, 21 Feb 2020 12:21:09 +0000 Subject: [PATCH] JAL-2422 general pull-up/removal of common or unused fields and methods --- src/jalview/appletgui/ExtJmol.java | 5 - src/jalview/ext/jmol/JalviewJmolBinding.java | 52 ++++------- .../ext/rbvi/chimera/JalviewChimeraBinding.java | 97 ++------------------ src/jalview/gui/AppJmolBinding.java | 24 ----- src/jalview/gui/JalviewChimeraBindingModel.java | 30 ------ .../structures/models/AAStructureBindingModel.java | 38 ++++++++ 6 files changed, 62 insertions(+), 184 deletions(-) diff --git a/src/jalview/appletgui/ExtJmol.java b/src/jalview/appletgui/ExtJmol.java index 179cd55..28381bc 100644 --- a/src/jalview/appletgui/ExtJmol.java +++ b/src/jalview/appletgui/ExtJmol.java @@ -175,11 +175,6 @@ public class ExtJmol extends JalviewJmolBinding } @Override - public void releaseReferences(Object svl) - { - } - - @Override public Map getJSpecViewProperty(String arg0) { return null; diff --git a/src/jalview/ext/jmol/JalviewJmolBinding.java b/src/jalview/ext/jmol/JalviewJmolBinding.java index 9b8fb91..b6e6a65 100644 --- a/src/jalview/ext/jmol/JalviewJmolBinding.java +++ b/src/jalview/ext/jmol/JalviewJmolBinding.java @@ -59,29 +59,19 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel { private String lastMessage; - boolean allChainsSelected = false; - /* * when true, try to search the associated datamodel for sequences that are * associated with any unknown structures in the Jmol view. */ private boolean associateNewStructs = false; - Vector atomsPicked = new Vector<>(); - - /* - * the default or current model displayed if the model cannot be identified - * from the selection message - */ - int frameNo = 0; - - // protected JmolGenericPopup jmolpopup; // not used - remove? + private Vector atomsPicked = new Vector<>(); - String lastCommand; + private String lastCommand; - boolean loadedInline; + private boolean loadedInline; - StringBuffer resetLastRes = new StringBuffer(); + private StringBuffer resetLastRes = new StringBuffer(); public Viewer jmolViewer; @@ -135,7 +125,10 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel /** * superpose the structures associated with sequences in the alignment * according to their corresponding positions. + * + * @deprecated not used - remove? */ + @Deprecated public void superposeStructures(AlignmentI alignment) { superposeStructures(alignment, -1, null); @@ -148,7 +141,9 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel * @param refStructure * - select which pdb file to use as reference (default is -1 - the * first structure in the alignment) + * @deprecated not used - remove? */ + @Deprecated public void superposeStructures(AlignmentI alignment, int refStructure) { superposeStructures(alignment, refStructure, null); @@ -163,7 +158,9 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel * first structure in the alignment) * @param hiddenCols * TODO + * @deprecated not used - remove? */ + @Deprecated public void superposeStructures(AlignmentI alignment, int refStructure, HiddenColumns hiddenCols) { @@ -465,13 +462,6 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel } /** - * instruct the Jalview binding to update the pdbentries vector if necessary - * prior to matching the jmol view's contents to the list of structure files - * Jalview knows about. - */ - public abstract void refreshPdbEntries(); - - /** * 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. @@ -570,9 +560,9 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel jmolHistory(false); StringBuilder cmd = new StringBuilder(64); - cmd.append("select " + pdbResNum); // +modelNum + cmd.append("select ").append(String.valueOf(pdbResNum)); // +modelNum - resetLastRes.append("select " + pdbResNum); // +modelNum + resetLastRes.append("select ").append(String.valueOf(pdbResNum)); // +modelNum cmd.append(":"); resetLastRes.append(":"); @@ -582,8 +572,8 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel resetLastRes.append(chain); } { - cmd.append(" /" + (mdlNum + 1)); - resetLastRes.append("/" + (mdlNum + 1)); + cmd.append(" /").append(String.valueOf(mdlNum + 1)); + resetLastRes.append("/").append(String.valueOf(mdlNum + 1)); } cmd.append(";wireframe 100;" + cmd.toString() + " and not hetero;"); @@ -597,7 +587,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel } - boolean debug = true; + private boolean debug = true; private void jmolHistory(boolean enable) { @@ -658,8 +648,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel chainId = " "; } - String pdbfilename = modelFileNames[frameNo]; // default is first or current - // model + String pdbfilename = modelFileNames[0]; // default is first model if (mdlSep > -1) { if (chainSeparator1 == -1) @@ -1117,13 +1106,6 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel public abstract void showUrl(String url, String target); /** - * called when the binding thinks the UI needs to be refreshed after a Jmol - * state change. this could be because structures were loaded, or because an - * error has occured. - */ - public abstract void refreshGUI(); - - /** * called to show or hide the associated console window container. * * @param show diff --git a/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java b/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java index d7bcc66..0192993 100644 --- a/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java +++ b/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java @@ -82,32 +82,12 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel private AbstractRequestHandler chimeraListener; /* - * set if chimera state is being restored from some source - instructs binding - * not to apply default display style when structure set is updated for first - * time. - */ - private boolean loadingFromArchive = false; - - /* - * flag to indicate if the Chimera viewer should ignore sequence colouring - * events from the structure manager because the GUI is still setting up - */ - private boolean loadingFinished = true; - - /* * Map of ChimeraModel objects keyed by PDB full local file name */ private Map> chimeraMaps = new LinkedHashMap<>(); String lastHighlightCommand; - /* - * incremented every time a load notification is successfully handled - - * lightweight mechanism for other threads to detect when they can start - * referring to new structures. - */ - private long loadNotifiesHandled = 0; - private Thread chimeraMonitor; /** @@ -631,9 +611,6 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel /** * Send a command to Chimera, and optionally log and return any responses. - *

- * Does nothing, and returns null, if the command is the same as the last one - * sent [why?]. * * @param command * @param getResponse @@ -648,23 +625,17 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel return null; } List reply = null; - viewerCommandHistory(false); - if (true /*lastCommand == null || !lastCommand.equals(command)*/) + // trim command or it may never find a match in the replyLog!! + List lastReply = chimeraManager + .sendChimeraCommand(command.trim(), getResponse); + if (getResponse) { - // trim command or it may never find a match in the replyLog!! - List lastReply = chimeraManager.sendChimeraCommand(command.trim(), - getResponse); - if (getResponse) + reply = lastReply; + if (debug) { - reply = lastReply; - if (debug) - { - log("Response from command ('" + command + "') was:\n" - + lastReply); - } + log("Response from command ('" + command + "') was:\n" + lastReply); } } - viewerCommandHistory(true); return reply; } @@ -706,13 +677,6 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel // ////////////////////////// /** - * instruct the Jalview binding to update the pdbentries vector if necessary - * prior to matching the viewer's contents to the list of structure files - * Jalview knows about. - */ - public abstract void refreshPdbEntries(); - - /** * 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. @@ -889,53 +853,6 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel System.err.println("## Chimera log: " + message); } - private void viewerCommandHistory(boolean enable) - { - // log("(Not yet implemented) History " - // + ((debug || enable) ? "on" : "off")); - } - - public long getLoadNotifiesHandled() - { - return loadNotifiesHandled; - } - - /** - * called when the binding thinks the UI needs to be refreshed after a Chimera - * state change. this could be because structures were loaded, or because an - * error has occurred. - */ - public abstract void refreshGUI(); - - @Override - public void setLoadingFromArchive(boolean loadingFromArchive) - { - this.loadingFromArchive = loadingFromArchive; - } - - /** - * - * @return true if Chimeral is still restoring state or loading is still going - * on (see setFinsihedLoadingFromArchive) - */ - @Override - public boolean isLoadingFromArchive() - { - return loadingFromArchive && !loadingFinished; - } - - /** - * modify flag which controls if sequence colouring events are honoured by the - * binding. Should be true for normal operation - * - * @param finishedLoading - */ - @Override - public void setFinishedLoadingFromArchive(boolean finishedLoading) - { - loadingFinished = finishedLoading; - } - /** * Ask Chimera to save its session to the given file. Returns true if * successful, else false. diff --git a/src/jalview/gui/AppJmolBinding.java b/src/jalview/gui/AppJmolBinding.java index aa6a159..db698ac 100644 --- a/src/jalview/gui/AppJmolBinding.java +++ b/src/jalview/gui/AppJmolBinding.java @@ -104,21 +104,6 @@ public class AppJmolBinding extends JalviewJmolBinding } @Override - public void updateColours(Object source) - { - AlignmentPanel ap = (AlignmentPanel) source; - // ignore events from panels not used to colour this view - if (!getViewer().isUsedForColourBy(ap)) - { - return; - } - if (!isLoadingFromArchive()) - { - colourBySequence(ap); - } - } - - @Override public void notifyScriptTermination(String strStatus, int msWalltime) { // todo - script termination doesn't happen ? @@ -142,15 +127,6 @@ public class AppJmolBinding extends JalviewJmolBinding @Override public void selectionChanged(BS arg0) { - // TODO Auto-generated method stub - - } - - @Override - public void refreshPdbEntries() - { - // TODO Auto-generated method stub - } @Override diff --git a/src/jalview/gui/JalviewChimeraBindingModel.java b/src/jalview/gui/JalviewChimeraBindingModel.java index f9071ef..f6cfb59 100644 --- a/src/jalview/gui/JalviewChimeraBindingModel.java +++ b/src/jalview/gui/JalviewChimeraBindingModel.java @@ -63,36 +63,6 @@ public class JalviewChimeraBindingModel extends JalviewChimeraBinding }); } - @Override - public void updateColours(Object source) - { - AlignmentViewPanel ap = (AlignmentViewPanel) source; - // ignore events from panels not used to colour this view - if (!getViewer().isUsedForColourBy(ap)) - { - return; - } - if (!isLoadingFromArchive()) - { - colourBySequence(ap); - } - } - - @Override - public void releaseReferences(Object svl) - { - } - - @Override - protected void releaseUIResources() - { - } - - @Override - public void refreshPdbEntries() - { - } - /** * Send an asynchronous command to Chimera, in a new thread, optionally with * an 'in progress' message in a progress bar somewhere diff --git a/src/jalview/structures/models/AAStructureBindingModel.java b/src/jalview/structures/models/AAStructureBindingModel.java index 8c2dc46..49561d7 100644 --- a/src/jalview/structures/models/AAStructureBindingModel.java +++ b/src/jalview/structures/models/AAStructureBindingModel.java @@ -361,7 +361,11 @@ public abstract class AAStructureBindingModel */ protected void releaseUIResources() { + } + @Override + public void releaseReferences(Object svl) + { } public boolean isColourBySequence() @@ -369,6 +373,25 @@ public abstract class AAStructureBindingModel return colourBySequence; } + /** + * Called when the binding thinks the UI needs to be refreshed after a + * structure viewer state change. This could be because structures were + * loaded, or because an error has occurred. Default does nothing, override as + * required. + */ + public void refreshGUI() + { + } + + /** + * Instruct the Jalview binding to update the pdbentries vector if necessary + * prior to matching the jmol view's contents to the list of structure files + * Jalview knows about. By default does nothing, override as required. + */ + public void refreshPdbEntries() + { + } + public void setColourBySequence(boolean colourBySequence) { this.colourBySequence = colourBySequence; @@ -1108,4 +1131,19 @@ public abstract class AAStructureBindingModel { return chainFile.get(chainId); } + + @Override + public void updateColours(Object source) + { + AlignmentViewPanel ap = (AlignmentViewPanel) source; + // ignore events from panels not used to colour this view + if (!getViewer().isUsedForColourBy(ap)) + { + return; + } + if (!isLoadingFromArchive()) + { + colourBySequence(ap); + } + } } -- 1.7.10.2