From: gmungoc Date: Fri, 4 Oct 2019 14:18:36 +0000 (+0100) Subject: JAL-3253 miscellaneous tidying up before merge to JS-develop X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=27555f103dbf71e346da16206f784f14e20af3d0;p=jalview.git JAL-3253 miscellaneous tidying up before merge to JS-develop --- diff --git a/src/jalview/gui/AnnotationPanel.java b/src/jalview/gui/AnnotationPanel.java index af7bc26..1347624 100755 --- a/src/jalview/gui/AnnotationPanel.java +++ b/src/jalview/gui/AnnotationPanel.java @@ -1133,7 +1133,6 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, gg.dispose(); - fastPaint = true; // Call repaint on alignment panel so that repaints from other alignment diff --git a/src/jalview/gui/CalculationChooser.java b/src/jalview/gui/CalculationChooser.java index 13506a5..5248306 100644 --- a/src/jalview/gui/CalculationChooser.java +++ b/src/jalview/gui/CalculationChooser.java @@ -762,7 +762,6 @@ public class CalculationChooser extends JPanel public PCAPanel getPcaPanel() { - // only called for FreeUpMemoryTest return pcaPanel; } } diff --git a/src/jalview/gui/Console.java b/src/jalview/gui/Console.java index f44dae1..1484ef4 100644 --- a/src/jalview/gui/Console.java +++ b/src/jalview/gui/Console.java @@ -313,7 +313,6 @@ public class Console extends WindowAdapter initConsole(false); JalviewAppender jappender = new JalviewAppender(); jappender.setLayout(new SimpleLayout()); - // BH 2019 JalviewAppender.setTextArea(textArea); jappender.setTextArea(textArea); org.apache.log4j.Logger.getRootLogger().addAppender(jappender); } diff --git a/src/jalview/gui/FeatureRenderer.java b/src/jalview/gui/FeatureRenderer.java index 61d3266..401fc7d 100644 --- a/src/jalview/gui/FeatureRenderer.java +++ b/src/jalview/gui/FeatureRenderer.java @@ -20,8 +20,6 @@ */ package jalview.gui; -import java.awt.Color; - /** * DOCUMENT ME! * @@ -32,8 +30,6 @@ public class FeatureRenderer extends jalview.renderer.seqfeatures.FeatureRenderer implements jalview.api.FeatureRenderer { - Color resBoxColour; - AlignmentPanel ap; /** diff --git a/src/jalview/gui/JalviewAppender.java b/src/jalview/gui/JalviewAppender.java index c1140a1..df19f7c 100644 --- a/src/jalview/gui/JalviewAppender.java +++ b/src/jalview/gui/JalviewAppender.java @@ -32,10 +32,7 @@ import org.apache.log4j.spi.LoggingEvent; */ public class JalviewAppender extends WriterAppender { - - // BH 2019 was static - - private JTextArea jTextArea = null; + JTextArea jTextArea = null; /** Set the target JTextArea for the logging information to appear. */ public void setTextArea(JTextArea jTextArea) diff --git a/src/jalview/gui/JvSwingUtils.java b/src/jalview/gui/JvSwingUtils.java index 7dd8e6c..fc2ecde 100644 --- a/src/jalview/gui/JvSwingUtils.java +++ b/src/jalview/gui/JvSwingUtils.java @@ -56,8 +56,7 @@ import javax.swing.border.TitledBorder; */ public final class JvSwingUtils { - public static final String HTML_PREFIX = "
"; - + static final String HTML_PREFIX = "
"; /** * wrap a bare html safe string to around 60 characters per line using a CSS @@ -110,11 +109,7 @@ public final class JvSwingUtils return enclose ? "" + ttext + "" : ttext; } // BH 2018,2019 - return (enclose - ? HTML_PREFIX - + ttext - + "
" - : ttext); + return (enclose ? HTML_PREFIX + ttext + "
" : ttext); } @@ -358,6 +353,7 @@ public final class JvSwingUtils combo.setToolTipText(tooltips.get(j)); } } + @Override public void mouseExited(MouseEvent e) { diff --git a/src/jalview/gui/OverviewPanel.java b/src/jalview/gui/OverviewPanel.java index 9245104..05f6afc 100755 --- a/src/jalview/gui/OverviewPanel.java +++ b/src/jalview/gui/OverviewPanel.java @@ -79,7 +79,7 @@ public class OverviewPanel extends JPanel private Dimension dim; - private boolean showProgress = !Platform.isJS(); // Jalview.getInstance().getShowStatus() + private boolean showProgress = !Platform.isJS(); /** * Creates a new OverviewPanel object. @@ -220,15 +220,17 @@ public class OverviewPanel extends JPanel }); } + /*** + * Resize is called on the initial display of the Overview. This code adjusts + * sizes to account for the progress bar if it has not already been accounted + * for, which triggers another resize call for the correct sizing, at which + * point the overview image is updated. (This avoids a double recalculation of + * the image.) + */ protected void resizePanel() { int ph = (progressPanel.getParent() == null ? 0 : progressPanel.getHeight()); - // Resize is called on the initial display of the overview. - // This code adjusts sizes to account for the progress bar if it has not - // already been accounted for, which triggers another resize call for - // the correct sizing, at which point the overview image is updated. - // (This avoids a double recalculation of the image.) if (getWidth() == od.getWidth() && getHeight() == od.getHeight() + ph) { if (canvas.lastMiniMe == null) @@ -254,7 +256,7 @@ public class OverviewPanel extends JPanel } /** - * Create the appropriate type of OverViewDimensions, with the desired size. + * Creates the appropriate type of OverviewDimensions, with the desired size */ private void createOverviewDimensions() { @@ -270,7 +272,6 @@ public class OverviewPanel extends JPanel od = new OverviewDimensionsHideHidden(av.getRanges(), showAnnotation, dim); } - } /** @@ -312,20 +313,7 @@ public class OverviewPanel extends JPanel } /** - * Updates the overview image when the related alignment panel is updated. - * - * Cases: - * - * AlignFrame.setFeatureGroupState - * - * AlignmentPanel.paintAlignment(true,...) (117 references) - * - * OverviewPanel..componentResized() OverviewPanel.toggleHiddenColumns() - * - * PopupMenu for action.reveal_sequences, action.reveal_all - * - * SliderPanel.mouseReleased() - * + * Updates the overview image when the related alignment panel is updated */ public void updateOverviewImage() { @@ -373,7 +361,6 @@ public class OverviewPanel extends JPanel /** * Update the overview panel box when the associated alignment panel is * changed - * */ private void setBoxPositionOnly() { diff --git a/src/jalview/gui/PCAPanel.java b/src/jalview/gui/PCAPanel.java index d1e7565..bec8aae 100644 --- a/src/jalview/gui/PCAPanel.java +++ b/src/jalview/gui/PCAPanel.java @@ -66,7 +66,7 @@ public class PCAPanel extends GPCAPanel private static final int MIN_HEIGHT = 250; - private RotatableCanvas rc; + RotatableCanvas rc; AlignmentPanel ap; @@ -411,6 +411,7 @@ public class PCAPanel extends GPCAPanel } } + @Override public void makePCAImage(ImageMaker.TYPE type) { int width = getRotatableCanvas().getWidth(); @@ -504,13 +505,6 @@ public class PCAPanel extends GPCAPanel } - /* - * (non-Javadoc) - * - * @see - * jalview.jbgui.GPCAPanel#outputPoints_actionPerformed(java.awt.event.ActionEvent - * ) - */ @Override protected void outputPoints_actionPerformed() { @@ -530,13 +524,6 @@ public class PCAPanel extends GPCAPanel } } - /* - * (non-Javadoc) - * - * @see - * jalview.jbgui.GPCAPanel#outputProjPoints_actionPerformed(java.awt.event - * .ActionEvent) - */ @Override protected void outputProjPoints_actionPerformed() { @@ -556,58 +543,10 @@ public class PCAPanel extends GPCAPanel } } - /* - * (non-Javadoc) - * - * @see jalview.gui.IProgressIndicator#setProgressBar(java.lang.String, long) - */ @Override public void setProgressBar(String message, long id) { progressBar.setProgressBar(message, id); - // if (progressBars == null) - // { - // progressBars = new Hashtable(); - // progressBarHandlers = new Hashtable(); - // } - // - // JPanel progressPanel; - // Long lId = new Long(id); - // GridLayout layout = (GridLayout) statusPanel.getLayout(); - // if (progressBars.get(lId) != null) - // { - // progressPanel = (JPanel) progressBars.get(new Long(id)); - // statusPanel.remove(progressPanel); - // progressBars.remove(lId); - // progressPanel = null; - // if (message != null) - // { - // statusBar.setText(message); - // } - // if (progressBarHandlers.contains(lId)) - // { - // progressBarHandlers.remove(lId); - // } - // layout.setRows(layout.getRows() - 1); - // } - // else - // { - // progressPanel = new JPanel(new BorderLayout(10, 5)); - // - // JProgressBar progressBar = new JProgressBar(); - // progressBar.setIndeterminate(true); - // - // progressPanel.add(new JLabel(message), BorderLayout.WEST); - // progressPanel.add(progressBar, BorderLayout.CENTER); - // - // layout.setRows(layout.getRows() + 1); - // statusPanel.add(progressPanel); - // - // progressBars.put(lId, progressPanel); - // } - // // update GUI - // // setMenusForViewport(); - // validate(); } @Override @@ -615,31 +554,6 @@ public class PCAPanel extends GPCAPanel final IProgressIndicatorHandler handler) { progressBar.registerHandler(id, handler); - // if (progressBarHandlers == null || !progressBars.contains(new Long(id))) - // { - // throw new - // Error(MessageManager.getString("error.call_setprogressbar_before_registering_handler")); - // } - // progressBarHandlers.put(new Long(id), handler); - // final JPanel progressPanel = (JPanel) progressBars.get(new Long(id)); - // if (handler.canCancel()) - // { - // JButton cancel = new JButton( - // MessageManager.getString("action.cancel")); - // final IProgressIndicator us = this; - // cancel.addActionListener(new ActionListener() - // { - // - // @Override - // public void actionPerformed(ActionEvent e) - // { - // handler.cancelActivity(id); - // us.setProgressBar(MessageManager.formatMessage("label.cancelled_params", - // new String[]{((JLabel) progressPanel.getComponent(0)).getText()}), id); - // } - // }); - // progressPanel.add(cancel, BorderLayout.EAST); - // } } /** diff --git a/src/jalview/gui/SeqCanvas.java b/src/jalview/gui/SeqCanvas.java index 35be292..5165aea 100755 --- a/src/jalview/gui/SeqCanvas.java +++ b/src/jalview/gui/SeqCanvas.java @@ -371,7 +371,6 @@ public class SeqCanvas extends JPanel implements ViewportListenerI @Override public void paintComponent(Graphics g) { - if (av.getAlignPanel().getHoldRepaint()) { return; @@ -505,14 +504,14 @@ public class SeqCanvas extends JPanel implements ViewportListenerI * Using the current font, determine fields labelWidthEast and labelWidthWest, * and return the number of residues that can fill the remaining width * - * @param width + * @param w * the width in pixels (possibly including scales) * * @return the visible width in residues, after allowing for East or West * scales (if shown) * */ - public int getWrappedCanvasWidth(int width) + public int getWrappedCanvasWidth(int w) { int charWidth = av.getCharWidth(); @@ -526,7 +525,7 @@ public class SeqCanvas extends JPanel implements ViewportListenerI labelWidthWest = av.getScaleLeftWrapped() ? labelWidth : 0; - return (width - labelWidthEast - labelWidthWest) / charWidth; + return (w - labelWidthEast - labelWidthWest) / charWidth; } /** diff --git a/src/jalview/gui/StructureChooser.java b/src/jalview/gui/StructureChooser.java index 9c4f6c8..d9bac9e 100644 --- a/src/jalview/gui/StructureChooser.java +++ b/src/jalview/gui/StructureChooser.java @@ -72,7 +72,7 @@ public class StructureChooser extends GStructureChooser protected SequenceI selectedSequence; - public SequenceI[] selectedSequences; + SequenceI[] selectedSequences; private IProgressIndicator progressIndicator; @@ -1127,53 +1127,53 @@ public class StructureChooser extends GStructureChooser protected void txt_search_ActionPerformed() { String text = txt_search.getText().trim(); - if (text.length() >= PDB_ID_MIN) - { - new Thread() + if (text.length() >= PDB_ID_MIN) { - - @Override - public void run() + new Thread() { - errorWarning.setLength(0); - isValidPBDEntry = false; - if (text.length() > 0) + + @Override + public void run() { - String searchTerm = text.toLowerCase(); - searchTerm = searchTerm.split(":")[0]; - // System.out.println(">>>>> search term : " + searchTerm); - List wantedFields = new ArrayList<>(); - FTSRestRequest pdbRequest = new FTSRestRequest(); - pdbRequest.setAllowEmptySeq(false); - pdbRequest.setResponseSize(1); - pdbRequest.setFieldToSearchBy("(pdb_id:"); - pdbRequest.setWantedFields(wantedFields); - pdbRequest.setSearchTerm(searchTerm + ")"); - pdbRequest.setAssociatedSequence(selectedSequence); - pdbRestClient = PDBFTSRestClient.getInstance(); - wantedFields.add(pdbRestClient.getPrimaryKeyColumn()); - FTSRestResponse resultList; - try - { - resultList = pdbRestClient.executeRequest(pdbRequest); - } catch (Exception e) + errorWarning.setLength(0); + isValidPBDEntry = false; + if (text.length() > 0) { - errorWarning.append(e.getMessage()); - return; - } finally - { - validateSelections(); - } - if (resultList.getSearchSummary() != null - && resultList.getSearchSummary().size() > 0) - { - isValidPBDEntry = true; + String searchTerm = text.toLowerCase(); + searchTerm = searchTerm.split(":")[0]; + // System.out.println(">>>>> search term : " + searchTerm); + List wantedFields = new ArrayList<>(); + FTSRestRequest pdbRequest = new FTSRestRequest(); + pdbRequest.setAllowEmptySeq(false); + pdbRequest.setResponseSize(1); + pdbRequest.setFieldToSearchBy("(pdb_id:"); + pdbRequest.setWantedFields(wantedFields); + pdbRequest.setSearchTerm(searchTerm + ")"); + pdbRequest.setAssociatedSequence(selectedSequence); + pdbRestClient = PDBFTSRestClient.getInstance(); + wantedFields.add(pdbRestClient.getPrimaryKeyColumn()); + FTSRestResponse resultList; + try + { + resultList = pdbRestClient.executeRequest(pdbRequest); + } catch (Exception e) + { + errorWarning.append(e.getMessage()); + return; + } finally + { + validateSelections(); + } + if (resultList.getSearchSummary() != null + && resultList.getSearchSummary().size() > 0) + { + isValidPBDEntry = true; + } } + validateSelections(); } - validateSelections(); - } - }.start(); - } + }.start(); + } } @Override diff --git a/src/jalview/io/vamsas/Tree.java b/src/jalview/io/vamsas/Tree.java index e4e0b6c..447eabd 100644 --- a/src/jalview/io/vamsas/Tree.java +++ b/src/jalview/io/vamsas/Tree.java @@ -517,7 +517,6 @@ public class Tree extends DatastoreItem * referenced in input data has already been associated with jalview objects. * * @param tp - * @param loaderFrame * @return Object[] { AlignmentView, AlignmentI - reference alignment for * input } */ diff --git a/src/jalview/structure/StructureSelectionManager.java b/src/jalview/structure/StructureSelectionManager.java index 012dff3..82d66f2 100644 --- a/src/jalview/structure/StructureSelectionManager.java +++ b/src/jalview/structure/StructureSelectionManager.java @@ -86,7 +86,7 @@ public class StructureSelectionManager implements ApplicationSingletonI /* * instances of this class scoped by some context class */ - private IdentityHashMap structureSelections; + private IdentityHashMap selectionManagers; /** * Answers an instance of this class for the current application (Java or JS @@ -125,11 +125,11 @@ public class StructureSelectionManager implements ApplicationSingletonI StructureSelectionManager getInstanceForContext( StructureSelectionManagerProvider context) { - StructureSelectionManager instance = structureSelections.get(context); + StructureSelectionManager instance = selectionManagers.get(context); if (instance == null) { instance = new StructureSelectionManager(); - structureSelections.put(context, instance); + selectionManagers.put(context, instance); } return instance; } @@ -142,7 +142,7 @@ public class StructureSelectionManager implements ApplicationSingletonI public static void release(StructureSelectionManagerProvider provider) { - getInstance().structureSelections.remove(provider); + getInstance().selectionManagers.remove(provider); } /** @@ -151,7 +151,7 @@ public class StructureSelectionManager implements ApplicationSingletonI */ private StructureSelectionManager() { - structureSelections = new IdentityHashMap<>(); + selectionManagers = new IdentityHashMap<>(); } /** diff --git a/src/jalview/structures/models/AAStructureBindingModel.java b/src/jalview/structures/models/AAStructureBindingModel.java index a98e4b1..56d2e9b 100644 --- a/src/jalview/structures/models/AAStructureBindingModel.java +++ b/src/jalview/structures/models/AAStructureBindingModel.java @@ -512,10 +512,10 @@ public abstract class AAStructureBindingModel } /** + * Returns a readable description of all mappings for the wrapped pdbfile to + * any mapped sequences * - * @return a readable description of all mappings for the wrapped pdbfile to - * any mapped sequences - * + * @return */ public String printMappings() { diff --git a/src/jalview/urls/IdentifiersUrlProvider.java b/src/jalview/urls/IdentifiersUrlProvider.java index 8744958..b43db57 100644 --- a/src/jalview/urls/IdentifiersUrlProvider.java +++ b/src/jalview/urls/IdentifiersUrlProvider.java @@ -85,7 +85,7 @@ private HashMap readIdentifiers(String idFileName) { // NOTE: THIS WILL FAIL IN SWINGJS BECAUSE IT INVOLVES A FILE READER - System.out.println("IDentifiersURLProvider.idFileName=" + idFileName); + // System.out.println("IDentifiersURLProvider.idFileName=" + idFileName); FileReader reader = new FileReader(idFileName); String key = ""; Map obj = (Map) JSONUtils.parse(reader); @@ -119,8 +119,7 @@ private HashMap readIdentifiers(String idFileName) } } catch (IOException | ParseException e) { - // unnecessary - e.printStackTrace(); + //e.printStackTrace(); // Note how in JavaScript we can grab the first bytes from any file reader. // Typical report here is "NetworkError" because the file does not exist. // "https://." is coming from System.getProperty("user.home"), but this could diff --git a/src/jalview/util/GroupUrlLink.java b/src/jalview/util/GroupUrlLink.java index e4c4ad0..d0545b9 100644 --- a/src/jalview/util/GroupUrlLink.java +++ b/src/jalview/util/GroupUrlLink.java @@ -26,12 +26,9 @@ import java.util.Hashtable; import com.stevesoft.pat.Regex; -/** - * This class is not implemented because Preferences never puts anything in - * groupURLLinks. - * - * @author hansonr - * +/* + * This class is not currently instantiated because Preferences never puts anything in + * groupURLLinks */ public class GroupUrlLink { diff --git a/src/jalview/ws/sifts/SiftsClient.java b/src/jalview/ws/sifts/SiftsClient.java index bf4d970..b45d007 100644 --- a/src/jalview/ws/sifts/SiftsClient.java +++ b/src/jalview/ws/sifts/SiftsClient.java @@ -824,7 +824,7 @@ public class SiftsClient implements SiftsClientI */ private boolean isResidueObserved(Residue residue) { - Set annotations = getResidueAnnotaitons(residue, + Set annotations = getResidueAnnotations(residue, ResidueDetailType.ANNOTATION); if (annotations == null || annotations.isEmpty()) { @@ -847,7 +847,7 @@ public class SiftsClient implements SiftsClientI * @param type * @return */ - private Set getResidueAnnotaitons(Residue residue, + private Set getResidueAnnotations(Residue residue, ResidueDetailType type) { HashSet foundAnnotations = new HashSet<>(); diff --git a/src/jalview/ws/sifts/SiftsSettings.java b/src/jalview/ws/sifts/SiftsSettings.java index 88aaed4..a042bb9 100644 --- a/src/jalview/ws/sifts/SiftsSettings.java +++ b/src/jalview/ws/sifts/SiftsSettings.java @@ -27,13 +27,12 @@ import java.util.Objects; public class SiftsSettings implements ApplicationSingletonI { - /** - * public only for testng + * Constructor * * @return */ - public static SiftsSettings getInstance() + private static SiftsSettings getInstance() { return (SiftsSettings) ApplicationSingletonProvider .getInstance(SiftsSettings.class);