From 3d0101179759ef157b088ea135423cd909512d9f Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Wed, 16 Aug 2017 22:22:11 +0100 Subject: [PATCH] JAL-2418 source formatting --- src/MCview/AppletPDBCanvas.java | 61 +- src/MCview/AppletPDBViewer.java | 20 +- src/MCview/PDBCanvas.java | 59 +- src/MCview/PDBChain.java | 45 +- src/MCview/PDBfile.java | 12 +- src/jalview/analysis/AAFrequency.java | 39 +- src/jalview/analysis/AlignSeq.java | 47 +- src/jalview/analysis/AlignmentAnnotationUtils.java | 9 +- src/jalview/analysis/AlignmentSorter.java | 50 +- src/jalview/analysis/AlignmentUtils.java | 196 +++--- src/jalview/analysis/AnnotationSorter.java | 13 +- src/jalview/analysis/AverageDistanceTree.java | 4 +- src/jalview/analysis/Conservation.java | 32 +- src/jalview/analysis/CrossRef.java | 96 +-- src/jalview/analysis/Dna.java | 32 +- src/jalview/analysis/Finder.java | 11 +- src/jalview/analysis/Grouping.java | 8 +- src/jalview/analysis/NJTree.java | 10 +- src/jalview/analysis/PCA.java | 7 +- src/jalview/analysis/ParseProperties.java | 12 +- src/jalview/analysis/Rna.java | 20 +- src/jalview/analysis/SecStrConsensus.java | 4 +- src/jalview/analysis/SeqsetUtils.java | 14 +- src/jalview/analysis/SequenceIdMatcher.java | 18 +- src/jalview/analysis/StructureFrequency.java | 20 +- src/jalview/analysis/TreeBuilder.java | 77 +-- src/jalview/analysis/TreeModel.java | 34 +- .../analysis/scoremodels/FeatureDistanceModel.java | 4 +- src/jalview/analysis/scoremodels/PIDModel.java | 4 +- src/jalview/analysis/scoremodels/ScoreMatrix.java | 13 +- src/jalview/analysis/scoremodels/ScoreModels.java | 7 +- .../analysis/scoremodels/SimilarityParams.java | 4 +- .../analysis/scoremodels/SmithWatermanModel.java | 4 +- src/jalview/api/DBRefEntryI.java | 3 +- src/jalview/api/analysis/ScoreModelI.java | 3 +- src/jalview/appletgui/APopupMenu.java | 222 ++++--- src/jalview/appletgui/AlignFrame.java | 566 ++++++++-------- src/jalview/appletgui/AlignViewport.java | 42 +- src/jalview/appletgui/AlignmentPanel.java | 44 +- src/jalview/appletgui/AnnotationColourChooser.java | 47 +- src/jalview/appletgui/AnnotationColumnChooser.java | 62 +- src/jalview/appletgui/AnnotationLabels.java | 93 +-- src/jalview/appletgui/AnnotationPanel.java | 53 +- src/jalview/appletgui/AnnotationRowFilter.java | 5 +- src/jalview/appletgui/AppletJmol.java | 58 +- src/jalview/appletgui/AppletJmolBinding.java | 4 +- src/jalview/appletgui/CutAndPasteTransfer.java | 133 ++-- src/jalview/appletgui/EmbmenuFrame.java | 4 +- src/jalview/appletgui/ExtJmol.java | 9 +- src/jalview/appletgui/FeatureColourChooser.java | 40 +- src/jalview/appletgui/FeatureRenderer.java | 39 +- src/jalview/appletgui/FeatureSettings.java | 64 +- src/jalview/appletgui/Finder.java | 28 +- src/jalview/appletgui/FontChooser.java | 12 +- src/jalview/appletgui/IdCanvas.java | 54 +- src/jalview/appletgui/IdPanel.java | 24 +- src/jalview/appletgui/IdwidthAdjuster.java | 4 +- src/jalview/appletgui/JVDialog.java | 4 +- src/jalview/appletgui/OverviewPanel.java | 26 +- src/jalview/appletgui/PCAPanel.java | 31 +- src/jalview/appletgui/PairwiseAlignPanel.java | 20 +- src/jalview/appletgui/RedundancyPanel.java | 20 +- src/jalview/appletgui/RotatableCanvas.java | 11 +- src/jalview/appletgui/ScalePanel.java | 30 +- src/jalview/appletgui/SeqCanvas.java | 84 +-- src/jalview/appletgui/SeqPanel.java | 135 ++-- src/jalview/appletgui/SequenceRenderer.java | 48 +- src/jalview/appletgui/SliderPanel.java | 27 +- src/jalview/appletgui/SplitFrame.java | 22 +- src/jalview/appletgui/Tooltip.java | 16 +- src/jalview/appletgui/TreeCanvas.java | 26 +- src/jalview/appletgui/TreePanel.java | 24 +- src/jalview/appletgui/UserDefinedColours.java | 18 +- src/jalview/bin/Cache.java | 165 ++--- src/jalview/bin/Jalview.java | 159 ++--- src/jalview/bin/JalviewLite.java | 216 +++--- src/jalview/bin/JalviewLiteURLRetrieve.java | 12 +- src/jalview/binding/Alignment.java | 4 +- src/jalview/binding/Annotation.java | 4 +- src/jalview/binding/AnnotationElement.java | 4 +- src/jalview/binding/Colour.java | 7 +- src/jalview/binding/Feature.java | 4 +- src/jalview/binding/FeatureSettings.java | 16 +- src/jalview/binding/Features.java | 4 +- src/jalview/binding/JGroup.java | 7 +- src/jalview/binding/JSeq.java | 28 +- src/jalview/binding/JalviewModel.java | 4 +- src/jalview/binding/JalviewModelSequence.java | 28 +- src/jalview/binding/JalviewUserColours.java | 16 +- src/jalview/binding/Pdbentry.java | 4 +- src/jalview/binding/PdbentryItem.java | 12 +- src/jalview/binding/Pdbids.java | 4 +- src/jalview/binding/Property.java | 4 +- src/jalview/binding/Sequence.java | 4 +- src/jalview/binding/SequenceSet.java | 28 +- src/jalview/binding/SequenceType.java | 4 +- src/jalview/binding/Setting.java | 4 +- src/jalview/binding/Tree.java | 4 +- src/jalview/binding/UserColourScheme.java | 8 +- src/jalview/binding/UserColours.java | 4 +- src/jalview/binding/VAMSAS.java | 25 +- src/jalview/binding/VamsasModel.java | 7 +- src/jalview/binding/Viewport.java | 4 +- src/jalview/commands/EditCommand.java | 62 +- src/jalview/commands/RemoveGapsCommand.java | 14 +- src/jalview/controller/AlignViewController.java | 64 +- src/jalview/datamodel/AlignedCodonFrame.java | 36 +- src/jalview/datamodel/Alignment.java | 50 +- src/jalview/datamodel/AlignmentAnnotation.java | 132 ++-- src/jalview/datamodel/AlignmentOrder.java | 6 +- src/jalview/datamodel/AlignmentView.java | 158 +++-- src/jalview/datamodel/AllColsCollection.java | 7 +- src/jalview/datamodel/AllColsIterator.java | 4 +- src/jalview/datamodel/AllRowsCollection.java | 1 - src/jalview/datamodel/AllRowsIterator.java | 2 - src/jalview/datamodel/Annotation.java | 14 +- src/jalview/datamodel/BinaryNode.java | 3 +- src/jalview/datamodel/BinarySequence.java | 8 +- src/jalview/datamodel/CigarArray.java | 7 +- src/jalview/datamodel/CigarBase.java | 52 +- src/jalview/datamodel/CigarCigar.java | 4 +- src/jalview/datamodel/ColumnSelection.java | 23 +- src/jalview/datamodel/DBRefEntry.java | 37 +- src/jalview/datamodel/FeatureProperties.java | 4 +- src/jalview/datamodel/GraphLine.java | 14 +- src/jalview/datamodel/HiddenColumns.java | 186 +++--- src/jalview/datamodel/HiddenSequences.java | 4 +- src/jalview/datamodel/Mapping.java | 15 +- src/jalview/datamodel/PDBEntry.java | 9 +- src/jalview/datamodel/Profile.java | 1 - src/jalview/datamodel/Profiles.java | 3 +- src/jalview/datamodel/ResidueCount.java | 20 +- src/jalview/datamodel/SearchResults.java | 6 +- src/jalview/datamodel/SeqCigar.java | 80 ++- src/jalview/datamodel/Sequence.java | 30 +- src/jalview/datamodel/SequenceFeature.java | 8 +- src/jalview/datamodel/SequenceGroup.java | 26 +- src/jalview/datamodel/VisibleColsCollection.java | 1 + src/jalview/datamodel/VisibleColsIterator.java | 1 - src/jalview/datamodel/VisibleRowsCollection.java | 1 - src/jalview/datamodel/VisibleRowsIterator.java | 4 +- src/jalview/datamodel/xdb/embl/EmblEntry.java | 104 +-- src/jalview/datamodel/xdb/embl/EmblFile.java | 5 +- src/jalview/ext/ensembl/EnsemblGene.java | 18 +- src/jalview/ext/ensembl/EnsemblRestClient.java | 62 +- src/jalview/ext/ensembl/EnsemblSeqProxy.java | 58 +- .../ext/ensembl/EnsemblSequenceFetcher.java | 3 +- src/jalview/ext/ensembl/EnsemblSymbol.java | 3 +- src/jalview/ext/ensembl/Species.java | 6 +- src/jalview/ext/htsjdk/HtsContigDb.java | 7 +- src/jalview/ext/jmol/JalviewJmolBinding.java | 85 +-- src/jalview/ext/jmol/JmolCommands.java | 21 +- src/jalview/ext/jmol/JmolParser.java | 48 +- src/jalview/ext/paradise/Annotate3D.java | 27 +- src/jalview/ext/rbvi/chimera/AtomSpecModel.java | 2 +- src/jalview/ext/rbvi/chimera/ChimeraCommands.java | 24 +- src/jalview/ext/rbvi/chimera/ChimeraListener.java | 10 +- .../ext/rbvi/chimera/JalviewChimeraBinding.java | 50 +- src/jalview/ext/so/SequenceOntology.java | 8 +- src/jalview/ext/varna/JalviewVarnaBinding.java | 4 +- src/jalview/ext/varna/VarnaCommands.java | 24 +- .../fts/core/DecimalFormatTableCellRenderer.java | 12 +- src/jalview/fts/core/FTSDataColumnPreferences.java | 12 +- src/jalview/fts/core/FTSRestClient.java | 16 +- src/jalview/fts/core/FTSRestRequest.java | 7 +- src/jalview/fts/core/FTSRestResponse.java | 33 +- src/jalview/fts/core/GFTSPanel.java | 104 ++- src/jalview/fts/service/pdb/PDBFTSPanel.java | 38 +- src/jalview/fts/service/pdb/PDBFTSRestClient.java | 49 +- .../fts/service/uniprot/UniProtFTSRestClient.java | 42 +- .../fts/service/uniprot/UniprotFTSPanel.java | 32 +- src/jalview/gui/AlignExportSettings.java | 7 +- src/jalview/gui/AlignFrame.java | 700 ++++++++++---------- src/jalview/gui/AlignViewport.java | 67 +- src/jalview/gui/AlignmentPanel.java | 134 ++-- src/jalview/gui/AnnotationChooser.java | 3 +- src/jalview/gui/AnnotationColourChooser.java | 93 +-- src/jalview/gui/AnnotationColumnChooser.java | 112 ++-- src/jalview/gui/AnnotationExporter.java | 48 +- src/jalview/gui/AnnotationLabels.java | 83 +-- src/jalview/gui/AnnotationPanel.java | 61 +- src/jalview/gui/AnnotationRowFilter.java | 44 +- src/jalview/gui/AppJmol.java | 47 +- src/jalview/gui/AppJmolBinding.java | 8 +- src/jalview/gui/AppVarna.java | 31 +- src/jalview/gui/AppVarnaBinding.java | 4 +- src/jalview/gui/AssociatePdbFileWithSeq.java | 4 +- src/jalview/gui/BlogReader.java | 63 +- src/jalview/gui/CalculationChooser.java | 50 +- src/jalview/gui/ChimeraViewFrame.java | 60 +- src/jalview/gui/ColourMenuHelper.java | 26 +- src/jalview/gui/Console.java | 12 +- src/jalview/gui/CrossRefAction.java | 24 +- src/jalview/gui/CutAndPasteHtmlTransfer.java | 8 +- src/jalview/gui/CutAndPasteTransfer.java | 38 +- src/jalview/gui/DasSourceBrowser.java | 82 +-- src/jalview/gui/Desktop.java | 472 ++++++------- src/jalview/gui/EPSOptions.java | 3 +- src/jalview/gui/FeatureColourChooser.java | 28 +- src/jalview/gui/FeatureRenderer.java | 39 +- src/jalview/gui/FeatureSettings.java | 109 ++- src/jalview/gui/Finder.java | 30 +- src/jalview/gui/FontChooser.java | 28 +- src/jalview/gui/HTMLOptions.java | 3 +- src/jalview/gui/IdCanvas.java | 40 +- src/jalview/gui/IdPanel.java | 12 +- src/jalview/gui/IdwidthAdjuster.java | 4 +- src/jalview/gui/JDatabaseTree.java | 55 +- src/jalview/gui/Jalview2XML.java | 446 +++++++------ src/jalview/gui/Jalview2XML_V1.java | 68 +- src/jalview/gui/JalviewChimeraBindingModel.java | 4 +- src/jalview/gui/JvOptionPane.java | 96 +-- src/jalview/gui/JvSwingUtils.java | 17 +- src/jalview/gui/OOMWarning.java | 14 +- src/jalview/gui/OptsAndParamsPage.java | 85 ++- src/jalview/gui/OverviewPanel.java | 38 +- src/jalview/gui/PCAPanel.java | 65 +- src/jalview/gui/PaintRefresher.java | 4 +- src/jalview/gui/PairwiseAlignPanel.java | 12 +- src/jalview/gui/PopupMenu.java | 291 ++++---- src/jalview/gui/Preferences.java | 157 ++--- src/jalview/gui/ProgressBar.java | 12 +- src/jalview/gui/PromptUserConfig.java | 6 +- src/jalview/gui/RedundancyPanel.java | 19 +- src/jalview/gui/RestInputParamEditDialog.java | 24 +- src/jalview/gui/RestServiceEditorPane.java | 76 ++- src/jalview/gui/RotatableCanvas.java | 21 +- src/jalview/gui/SVGOptions.java | 3 +- src/jalview/gui/ScalePanel.java | 24 +- src/jalview/gui/SeqCanvas.java | 68 +- src/jalview/gui/SeqPanel.java | 83 +-- src/jalview/gui/SequenceFetcher.java | 142 ++-- src/jalview/gui/SequenceRenderer.java | 56 +- src/jalview/gui/SliderPanel.java | 44 +- src/jalview/gui/SplashScreen.java | 12 +- src/jalview/gui/SplitFrame.java | 25 +- src/jalview/gui/StructureChooser.java | 125 ++-- src/jalview/gui/StructureViewer.java | 22 +- src/jalview/gui/StructureViewerBase.java | 57 +- src/jalview/gui/TextColourChooser.java | 26 +- src/jalview/gui/TreeCanvas.java | 41 +- src/jalview/gui/TreePanel.java | 93 +-- src/jalview/gui/UserDefinedColours.java | 66 +- src/jalview/gui/UserQuestionnaireCheck.java | 36 +- src/jalview/gui/VamsasApplication.java | 122 ++-- src/jalview/gui/ViewSelectionMenu.java | 9 +- src/jalview/gui/WebserviceInfo.java | 71 +- src/jalview/gui/WsJobParameters.java | 122 ++-- src/jalview/gui/WsParamSetManager.java | 31 +- src/jalview/gui/WsPreferences.java | 82 +-- src/jalview/httpserver/AbstractRequestHandler.java | 8 +- src/jalview/httpserver/HttpServer.java | 8 +- src/jalview/io/AlignFile.java | 12 +- src/jalview/io/AnnotationFile.java | 159 ++--- src/jalview/io/AppletFormatAdapter.java | 52 +- src/jalview/io/BioJsHTMLOutput.java | 28 +- src/jalview/io/ClustalFile.java | 21 +- src/jalview/io/FastaFile.java | 4 +- src/jalview/io/FeaturesFile.java | 45 +- src/jalview/io/FileLoader.java | 66 +- src/jalview/io/FileParse.java | 42 +- src/jalview/io/FormatAdapter.java | 4 +- src/jalview/io/HTMLOutput.java | 152 ++--- src/jalview/io/HtmlSvgOutput.java | 128 ++-- src/jalview/io/IdentifyFile.java | 22 +- src/jalview/io/JPredFile.java | 31 +- src/jalview/io/JSONFile.java | 138 ++-- src/jalview/io/JalviewFileChooser.java | 14 +- src/jalview/io/JalviewFileView.java | 8 +- src/jalview/io/JnetAnnotationMaker.java | 29 +- src/jalview/io/MSFfile.java | 8 +- src/jalview/io/ModellerDescription.java | 11 +- src/jalview/io/NewickFile.java | 91 ++- src/jalview/io/PfamFile.java | 8 +- src/jalview/io/PhylipFile.java | 26 +- src/jalview/io/PileUpfile.java | 4 +- src/jalview/io/RnamlFile.java | 35 +- src/jalview/io/ScoreMatrixFile.java | 25 +- src/jalview/io/SequenceAnnotationReport.java | 37 +- src/jalview/io/SimpleBlastFile.java | 13 +- src/jalview/io/StockholmFile.java | 74 ++- src/jalview/io/StructureFile.java | 34 +- src/jalview/io/TCoffeeScoreFile.java | 25 +- src/jalview/io/VamsasAppDatastore.java | 371 ++++++----- src/jalview/io/WSWUBlastClient.java | 24 +- src/jalview/io/cache/AppCache.java | 6 - src/jalview/io/cache/JvCacheableInputBox.java | 36 +- src/jalview/io/gff/ExonerateHelper.java | 7 +- src/jalview/io/gff/Gff3Helper.java | 15 +- src/jalview/io/gff/GffHelperBase.java | 15 +- src/jalview/io/gff/InterProScanHelper.java | 11 +- src/jalview/io/packed/ParsePackedSet.java | 15 +- src/jalview/io/vamsas/Datasetsequence.java | 14 +- src/jalview/io/vamsas/DatastoreItem.java | 62 +- src/jalview/io/vamsas/Dbref.java | 34 +- src/jalview/io/vamsas/Rangetype.java | 34 +- src/jalview/io/vamsas/Sequencefeature.java | 23 +- src/jalview/io/vamsas/Sequencemapping.java | 35 +- src/jalview/io/vamsas/Tree.java | 73 +- src/jalview/javascript/JSFunctionExec.java | 9 +- src/jalview/javascript/JalviewLiteJsApi.java | 20 +- src/jalview/javascript/JsSelectionSender.java | 18 +- src/jalview/javascript/MouseOverListener.java | 11 +- .../javascript/MouseOverStructureListener.java | 44 +- src/jalview/jbgui/GAlignExportSettings.java | 24 +- src/jalview/jbgui/GAlignFrame.java | 311 ++++----- src/jalview/jbgui/GCutAndPasteHtmlTransfer.java | 24 +- src/jalview/jbgui/GCutAndPasteTransfer.java | 16 +- src/jalview/jbgui/GDasSourceBrowser.java | 39 +- src/jalview/jbgui/GDesktop.java | 70 +- src/jalview/jbgui/GFinder.java | 32 +- src/jalview/jbgui/GPCAPanel.java | 12 +- src/jalview/jbgui/GPairwiseAlignPanel.java | 19 +- src/jalview/jbgui/GPreferences.java | 308 ++++----- src/jalview/jbgui/GRestInputParamEditDialog.java | 20 +- src/jalview/jbgui/GRestServiceEditorPane.java | 54 +- src/jalview/jbgui/GSequenceLink.java | 7 +- src/jalview/jbgui/GSliderPanel.java | 4 +- src/jalview/jbgui/GSplitFrame.java | 7 +- src/jalview/jbgui/GStructureChooser.java | 81 +-- src/jalview/jbgui/GStructureViewer.java | 11 +- src/jalview/jbgui/GTreePanel.java | 21 +- src/jalview/jbgui/GUserDefinedColours.java | 16 +- src/jalview/jbgui/GWebserviceInfo.java | 11 +- src/jalview/jbgui/GWsPreferences.java | 36 +- .../json/binding/biojs/BioJSRepositoryPojo.java | 4 +- .../biojson/v1/AlignmentAnnotationPojo.java | 3 +- .../json/binding/biojson/v1/AlignmentPojo.java | 9 +- .../json/binding/biojson/v1/AnnotationPojo.java | 3 +- .../json/binding/biojson/v1/SequencePojo.java | 10 +- src/jalview/math/Matrix.java | 21 +- src/jalview/math/MatrixI.java | 2 +- src/jalview/math/RotatableMatrix.java | 12 +- src/jalview/math/SparseMatrix.java | 3 +- src/jalview/renderer/AnnotationRenderer.java | 166 ++--- src/jalview/renderer/OverviewRenderer.java | 9 +- src/jalview/renderer/ResidueShader.java | 38 +- src/jalview/renderer/ResidueShaderI.java | 3 +- .../renderer/seqfeatures/FeatureRenderer.java | 21 +- src/jalview/schemes/AnnotationColourGradient.java | 32 +- src/jalview/schemes/Blosum62ColourScheme.java | 1 + src/jalview/schemes/ClustalxColourScheme.java | 8 +- src/jalview/schemes/ColourSchemeLoader.java | 36 +- src/jalview/schemes/ColourSchemeProperty.java | 18 +- src/jalview/schemes/ColourSchemes.java | 2 +- src/jalview/schemes/CovariationColourScheme.java | 7 +- src/jalview/schemes/FeatureColour.java | 15 +- src/jalview/schemes/JalviewColourScheme.java | 28 +- src/jalview/schemes/PIDColourScheme.java | 3 +- src/jalview/schemes/RNAHelicesColour.java | 14 +- src/jalview/schemes/ResidueColourScheme.java | 8 +- src/jalview/schemes/ResidueProperties.java | 42 +- src/jalview/schemes/TCoffeeColourScheme.java | 7 +- src/jalview/schemes/UserColourScheme.java | 11 +- .../structure/SecondaryStructureListener.java | 3 +- src/jalview/structure/SelectionListener.java | 3 +- .../structure/StructureSelectionManager.java | 52 +- .../structures/models/AAStructureBindingModel.java | 26 +- .../models/SequenceStructureBindingModel.java | 4 +- src/jalview/urls/CustomUrlProvider.java | 16 +- src/jalview/urls/IdentifiersUrlProvider.java | 7 +- src/jalview/urls/UrlLinkDisplay.java | 4 +- src/jalview/urls/UrlLinkTableModel.java | 4 +- src/jalview/urls/UrlProvider.java | 10 +- src/jalview/urls/UrlProviderImpl.java | 8 +- src/jalview/urls/api/UrlProviderFactoryI.java | 1 - src/jalview/util/AWTConsole.java | 4 +- src/jalview/util/BrowserLauncher.java | 120 ++-- src/jalview/util/CaseInsensitiveString.java | 4 +- src/jalview/util/ColorUtils.java | 42 +- src/jalview/util/Comparison.java | 23 +- src/jalview/util/DBRefUtils.java | 75 +-- src/jalview/util/Format.java | 7 +- src/jalview/util/GroupUrlLink.java | 73 +- src/jalview/util/ImageMaker.java | 23 +- src/jalview/util/MapList.java | 33 +- src/jalview/util/MappingUtils.java | 57 +- src/jalview/util/MessageManager.java | 8 +- src/jalview/util/ParseHtmlBodyAndLinks.java | 4 +- src/jalview/util/Platform.java | 4 +- src/jalview/util/QuickSort.java | 28 +- src/jalview/util/SparseCount.java | 6 +- src/jalview/util/StringUtils.java | 24 +- src/jalview/util/TableSorter.java | 7 +- src/jalview/util/UrlLink.java | 23 +- src/jalview/viewmodel/AlignmentViewport.java | 99 +-- src/jalview/viewmodel/OverviewDimensions.java | 3 +- .../viewmodel/OverviewDimensionsShowHidden.java | 19 +- src/jalview/viewmodel/PCAModel.java | 3 +- src/jalview/viewmodel/ViewportRanges.java | 4 +- .../AnnotationFilterParameter.java | 3 +- .../seqfeatures/FeatureRendererModel.java | 35 +- src/jalview/viewmodel/styles/ViewStyle.java | 19 +- src/jalview/workers/AlignCalcManager.java | 17 +- .../workers/AlignmentAnnotationFactory.java | 20 +- src/jalview/workers/AnnotationWorker.java | 4 +- src/jalview/workers/ConsensusThread.java | 3 +- src/jalview/ws/AWSThread.java | 20 +- src/jalview/ws/DBRefFetcher.java | 109 +-- src/jalview/ws/DasSequenceFeatureFetcher.java | 65 +- src/jalview/ws/HttpClientUtils.java | 29 +- src/jalview/ws/JobStateSummary.java | 6 +- src/jalview/ws/SequenceFetcher.java | 10 +- src/jalview/ws/dbsources/EmblXmlSource.java | 4 +- src/jalview/ws/dbsources/Pdb.java | 19 +- src/jalview/ws/dbsources/PfamFull.java | 1 + src/jalview/ws/dbsources/PfamSeed.java | 1 + src/jalview/ws/dbsources/RfamFull.java | 1 + src/jalview/ws/dbsources/Uniprot.java | 11 +- src/jalview/ws/dbsources/Xfam.java | 13 +- .../dbsources/das/datamodel/DasSequenceSource.java | 49 +- .../dbsources/das/datamodel/DasSourceRegistry.java | 30 +- .../ws/dbsources/das/datamodel/JalviewSource.java | 39 +- src/jalview/ws/jws1/Annotate3D.java | 12 +- src/jalview/ws/jws1/Discoverer.java | 87 ++- src/jalview/ws/jws1/JPredClient.java | 48 +- src/jalview/ws/jws1/JPredThread.java | 117 ++-- src/jalview/ws/jws1/MsaWSClient.java | 39 +- src/jalview/ws/jws1/MsaWSThread.java | 60 +- src/jalview/ws/jws1/SeqSearchWSClient.java | 52 +- src/jalview/ws/jws1/SeqSearchWSThread.java | 91 +-- src/jalview/ws/jws1/WS1Client.java | 9 +- src/jalview/ws/jws2/AADisorderClient.java | 39 +- src/jalview/ws/jws2/AbstractJabaCalcWorker.java | 35 +- src/jalview/ws/jws2/JWs2Job.java | 10 +- src/jalview/ws/jws2/JabaParamStore.java | 59 +- src/jalview/ws/jws2/JabaPreset.java | 20 +- src/jalview/ws/jws2/JabaWsServerQuery.java | 4 +- src/jalview/ws/jws2/JabawsCalcWorker.java | 6 +- .../ws/jws2/JabawsMsaInterfaceAlignCalcWorker.java | 13 +- src/jalview/ws/jws2/Jws2Client.java | 50 +- src/jalview/ws/jws2/Jws2Discoverer.java | 91 +-- src/jalview/ws/jws2/MsaWSClient.java | 91 ++- src/jalview/ws/jws2/MsaWSThread.java | 115 ++-- src/jalview/ws/jws2/ParameterUtils.java | 14 +- src/jalview/ws/jws2/RNAalifoldClient.java | 42 +- .../ws/jws2/SequenceAnnotationWSClient.java | 54 +- src/jalview/ws/jws2/dm/AAConSettings.java | 16 +- src/jalview/ws/jws2/dm/JabaOption.java | 5 +- src/jalview/ws/jws2/dm/JabaValueConstrain.java | 9 +- src/jalview/ws/jws2/dm/JabaWsParamSet.java | 10 +- src/jalview/ws/jws2/jabaws2/Jws2Instance.java | 6 +- .../ws/jws2/jabaws2/Jws2InstanceFactory.java | 3 +- src/jalview/ws/params/ParamManager.java | 3 +- src/jalview/ws/params/simple/BooleanOption.java | 3 +- src/jalview/ws/params/simple/IntegerParameter.java | 16 +- src/jalview/ws/params/simple/Parameter.java | 4 +- src/jalview/ws/rest/HttpResultSet.java | 9 +- src/jalview/ws/rest/InputType.java | 22 +- src/jalview/ws/rest/RestClient.java | 116 ++-- src/jalview/ws/rest/RestJob.java | 12 +- src/jalview/ws/rest/RestJobThread.java | 101 ++- src/jalview/ws/rest/RestServiceDescription.java | 29 +- src/jalview/ws/rest/params/Alignment.java | 26 +- src/jalview/ws/rest/params/AnnotationFile.java | 16 +- src/jalview/ws/rest/params/JobConstant.java | 11 +- .../ws/rest/params/SeqGroupIndexVector.java | 22 +- src/jalview/ws/rest/params/SeqIdVector.java | 9 +- src/jalview/ws/rest/params/SeqVector.java | 8 +- src/jalview/ws/rest/params/Tree.java | 5 +- src/jalview/ws/seqfetcher/ASequenceFetcher.java | 43 +- src/jalview/ws/seqfetcher/DbSourceProxyImpl.java | 3 +- src/jalview/ws/sifts/MappingOutputPojo.java | 10 +- src/jalview/ws/sifts/SiftsClient.java | 70 +- src/jalview/ws/utils/UrlDownloadClient.java | 8 +- 465 files changed, 9345 insertions(+), 9038 deletions(-) diff --git a/src/MCview/AppletPDBCanvas.java b/src/MCview/AppletPDBCanvas.java index 39111c3..f94faba 100644 --- a/src/MCview/AppletPDBCanvas.java +++ b/src/MCview/AppletPDBCanvas.java @@ -52,8 +52,8 @@ import java.io.PrintStream; import java.util.List; import java.util.Vector; -public class AppletPDBCanvas extends Panel implements MouseListener, - MouseMotionListener, StructureListener +public class AppletPDBCanvas extends Panel + implements MouseListener, MouseMotionListener, StructureListener { MCMatrix idmat = new MCMatrix(3, 3); @@ -191,10 +191,9 @@ public class AppletPDBCanvas extends Panel implements MouseListener, for (int i = 0; i < pdb.getChains().size(); i++) { - mappingDetails - .append("\n\nPDB Sequence is :\nSequence = " - + pdb.getChains().elementAt(i).sequence - .getSequenceAsString()); + mappingDetails.append("\n\nPDB Sequence is :\nSequence = " + + pdb.getChains().elementAt(i).sequence + .getSequenceAsString()); mappingDetails.append("\nNo of residues = " + pdb.getChains().elementAt(i).residues.size() + "\n\n"); @@ -203,8 +202,9 @@ public class AppletPDBCanvas extends Panel implements MouseListener, // Align the sequence to the pdb // TODO: DNa/Pep switch AlignSeq as = new AlignSeq(sequence, - pdb.getChains().elementAt(i).sequence, pdb.getChains() - .elementAt(i).isNa ? AlignSeq.DNA : AlignSeq.PEP); + pdb.getChains().elementAt(i).sequence, + pdb.getChains().elementAt(i).isNa ? AlignSeq.DNA + : AlignSeq.PEP); as.calcScoreMatrix(); as.traceAlignment(); PrintStream ps = new PrintStream(System.out) @@ -488,9 +488,8 @@ public class AppletPDBCanvas extends Panel implements MouseListener, g.fillRect(0, 0, getSize().width, getSize().height); g.setColor(Color.black); g.setFont(new Font("Verdana", Font.BOLD, 14)); - g.drawString( - MessageManager.getString("label.error_loading_pdb_data"), 50, - getSize().height / 2); + g.drawString(MessageManager.getString("label.error_loading_pdb_data"), + 50, getSize().height / 2); return; } @@ -614,8 +613,8 @@ public class AppletPDBCanvas extends Panel implements MouseListener, if (pos > 0) { pos = sequence[s].findIndex(pos); - tmp.endCol = sr - .getResidueColour(sequence[s], pos, finder); + tmp.endCol = sr.getResidueColour(sequence[s], pos, + finder); } } } @@ -644,11 +643,15 @@ public class AppletPDBCanvas extends Panel implements MouseListener, { tmpBond = visiblebonds.elementAt(i); - xstart = (int) (((tmpBond.start[0] - centre[0]) * scale) + (getSize().width / 2)); - ystart = (int) (((centre[1] - tmpBond.start[1]) * scale) + (getSize().height / 2)); + xstart = (int) (((tmpBond.start[0] - centre[0]) * scale) + + (getSize().width / 2)); + ystart = (int) (((centre[1] - tmpBond.start[1]) * scale) + + (getSize().height / 2)); - xend = (int) (((tmpBond.end[0] - centre[0]) * scale) + (getSize().width / 2)); - yend = (int) (((centre[1] - tmpBond.end[1]) * scale) + (getSize().height / 2)); + xend = (int) (((tmpBond.end[0] - centre[0]) * scale) + + (getSize().width / 2)); + yend = (int) (((centre[1] - tmpBond.end[1]) * scale) + + (getSize().height / 2)); xmid = (xend + xstart) / 2; ymid = (yend + ystart) / 2; @@ -965,8 +968,10 @@ public class AppletPDBCanvas extends Panel implements MouseListener, if (n == 1) { - int xstart = (int) (((b.start[0] - centre[0]) * scale) + (getSize().width / 2)); - int ystart = (int) (((centre[1] - b.start[1]) * scale) + (getSize().height / 2)); + int xstart = (int) (((b.start[0] - centre[0]) * scale) + + (getSize().width / 2)); + int ystart = (int) (((centre[1] - b.start[1]) * scale) + + (getSize().height / 2)); g.setColor(Color.red); g.drawString(b.at1.resName + "-" + b.at1.resNumber, xstart, ystart); @@ -974,8 +979,10 @@ public class AppletPDBCanvas extends Panel implements MouseListener, if (n == 2) { - int xstart = (int) (((b.end[0] - centre[0]) * scale) + (getSize().width / 2)); - int ystart = (int) (((centre[1] - b.end[1]) * scale) + (getSize().height / 2)); + int xstart = (int) (((b.end[0] - centre[0]) * scale) + + (getSize().width / 2)); + int ystart = (int) (((centre[1] - b.end[1]) * scale) + + (getSize().height / 2)); g.setColor(Color.red); g.drawString(b.at2.resName + "-" + b.at2.resNumber, xstart, ystart); @@ -1004,11 +1011,13 @@ public class AppletPDBCanvas extends Panel implements MouseListener, { tmpBond = bonds.elementAt(i); - truex = (int) (((tmpBond.start[0] - centre[0]) * scale) + (getSize().width / 2)); + truex = (int) (((tmpBond.start[0] - centre[0]) * scale) + + (getSize().width / 2)); if (Math.abs(truex - x) <= 2) { - int truey = (int) (((centre[1] - tmpBond.start[1]) * scale) + (getSize().height / 2)); + int truey = (int) (((centre[1] - tmpBond.start[1]) * scale) + + (getSize().height / 2)); if (Math.abs(truey - y) <= 2) { @@ -1021,11 +1030,13 @@ public class AppletPDBCanvas extends Panel implements MouseListener, // Still here? Maybe its the last bond - truex = (int) (((tmpBond.end[0] - centre[0]) * scale) + (getSize().width / 2)); + truex = (int) (((tmpBond.end[0] - centre[0]) * scale) + + (getSize().width / 2)); if (Math.abs(truex - x) <= 2) { - int truey = (int) (((tmpBond.end[1] - centre[1]) * scale) + (getSize().height / 2)); + int truey = (int) (((tmpBond.end[1] - centre[1]) * scale) + + (getSize().height / 2)); if (Math.abs(truey - y) <= 2) { diff --git a/src/MCview/AppletPDBViewer.java b/src/MCview/AppletPDBViewer.java index 133565c..adf833f 100644 --- a/src/MCview/AppletPDBViewer.java +++ b/src/MCview/AppletPDBViewer.java @@ -46,8 +46,8 @@ import java.awt.event.ActionListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; -public class AppletPDBViewer extends EmbmenuFrame implements - ActionListener, ItemListener +public class AppletPDBViewer extends EmbmenuFrame + implements ActionListener, ItemListener { AppletPDBCanvas pdbcanvas; @@ -67,8 +67,8 @@ public class AppletPDBViewer extends EmbmenuFrame implements embedMenuIfNeeded(pdbcanvas); add(pdbcanvas, BorderLayout.CENTER); - StringBuffer title = new StringBuffer(seq[0].getName() + ":" - + pdbcanvas.pdbentry.getFile()); + StringBuffer title = new StringBuffer( + seq[0].getName() + ":" + pdbcanvas.pdbentry.getFile()); jalview.bin.JalviewLite.addFrame(this, title.toString(), 400, 400); @@ -185,8 +185,8 @@ public class AppletPDBViewer extends EmbmenuFrame implements zbuffer.addItemListener(this); charge.setLabel(MessageManager.getString("label.charge_cysteine")); charge.addActionListener(this); - hydro.setLabel(MessageManager - .getString("label.colourScheme_hydrophobic")); + hydro.setLabel( + MessageManager.getString("label.colourScheme_hydrophobic")); hydro.addActionListener(this); chain.setLabel(MessageManager.getString("action.by_chain")); chain.addActionListener(this); @@ -206,11 +206,11 @@ public class AppletPDBViewer extends EmbmenuFrame implements strand.setLabel(MessageManager .getString("label.colourScheme_strand_propensity")); strand.addActionListener(this); - turn.setLabel(MessageManager - .getString("label.colourScheme_turn_propensity")); + turn.setLabel( + MessageManager.getString("label.colourScheme_turn_propensity")); turn.addActionListener(this); - buried.setLabel(MessageManager - .getString("label.colourScheme_buried_index")); + buried.setLabel( + MessageManager.getString("label.colourScheme_buried_index")); buried.addActionListener(this); user.setLabel(MessageManager.getString("action.user_defined")); user.addActionListener(this); diff --git a/src/MCview/PDBCanvas.java b/src/MCview/PDBCanvas.java index 83642cc..b2f2503 100644 --- a/src/MCview/PDBCanvas.java +++ b/src/MCview/PDBCanvas.java @@ -55,8 +55,8 @@ import java.util.Vector; import javax.swing.JPanel; import javax.swing.ToolTipManager; -public class PDBCanvas extends JPanel implements MouseListener, - MouseMotionListener, StructureListener +public class PDBCanvas extends JPanel + implements MouseListener, MouseMotionListener, StructureListener { boolean redrawneeded = true; @@ -190,10 +190,9 @@ public class PDBCanvas extends JPanel implements MouseListener, for (int i = 0; i < pdb.getChains().size(); i++) { - mappingDetails - .append("\n\nPDB Sequence is :\nSequence = " - + pdb.getChains().elementAt(i).sequence - .getSequenceAsString()); + mappingDetails.append("\n\nPDB Sequence is :\nSequence = " + + pdb.getChains().elementAt(i).sequence + .getSequenceAsString()); mappingDetails.append("\nNo of residues = " + pdb.getChains().elementAt(i).residues.size() + "\n\n"); @@ -582,8 +581,8 @@ public class PDBCanvas extends JPanel implements MouseListener, if (pos > 0) { pos = sequence[s].findIndex(pos); - tmp.endCol = sr - .getResidueColour(sequence[s], pos, finder); + tmp.endCol = sr.getResidueColour(sequence[s], pos, + finder); } } @@ -613,11 +612,15 @@ public class PDBCanvas extends JPanel implements MouseListener, { tmpBond = visiblebonds.elementAt(i); - xstart = (int) (((tmpBond.start[0] - centre[0]) * scale) + (getWidth() / 2)); - ystart = (int) (((centre[1] - tmpBond.start[1]) * scale) + (getHeight() / 2)); + xstart = (int) (((tmpBond.start[0] - centre[0]) * scale) + + (getWidth() / 2)); + ystart = (int) (((centre[1] - tmpBond.start[1]) * scale) + + (getHeight() / 2)); - xend = (int) (((tmpBond.end[0] - centre[0]) * scale) + (getWidth() / 2)); - yend = (int) (((centre[1] - tmpBond.end[1]) * scale) + (getHeight() / 2)); + xend = (int) (((tmpBond.end[0] - centre[0]) * scale) + + (getWidth() / 2)); + yend = (int) (((centre[1] - tmpBond.end[1]) * scale) + + (getHeight() / 2)); xmid = (xend + xstart) / 2; ymid = (yend + ystart) / 2; @@ -681,8 +684,8 @@ public class PDBCanvas extends JPanel implements MouseListener, if (highlightBond1 != null && highlightBond1 == tmpBond) { - g.setColor(tmpBond.endCol.brighter().brighter().brighter() - .brighter()); + g.setColor( + tmpBond.endCol.brighter().brighter().brighter().brighter()); drawLine(g, xmid, ymid, xend, yend); } @@ -818,8 +821,8 @@ public class PDBCanvas extends JPanel implements MouseListener, if (fatom != null) { - this.setToolTipText(chain.id + ":" + fatom.resNumber + " " - + fatom.resName); + this.setToolTipText( + chain.id + ":" + fatom.resNumber + " " + fatom.resName); } else { @@ -929,16 +932,20 @@ public class PDBCanvas extends JPanel implements MouseListener, g.setColor(Color.red); if (n == 1) { - int xstart = (int) (((b.start[0] - centre[0]) * scale) + (getWidth() / 2)); - int ystart = (int) (((centre[1] - b.start[1]) * scale) + (getHeight() / 2)); + int xstart = (int) (((b.start[0] - centre[0]) * scale) + + (getWidth() / 2)); + int ystart = (int) (((centre[1] - b.start[1]) * scale) + + (getHeight() / 2)); g.drawString(b.at1.resName + "-" + b.at1.resNumber, xstart, ystart); } if (n == 2) { - int xstart = (int) (((b.end[0] - centre[0]) * scale) + (getWidth() / 2)); - int ystart = (int) (((centre[1] - b.end[1]) * scale) + (getHeight() / 2)); + int xstart = (int) (((b.end[0] - centre[0]) * scale) + + (getWidth() / 2)); + int ystart = (int) (((centre[1] - b.end[1]) * scale) + + (getHeight() / 2)); g.drawString(b.at2.resName + "-" + b.at2.resNumber, xstart, ystart); } @@ -964,11 +971,13 @@ public class PDBCanvas extends JPanel implements MouseListener, { tmpBond = bond; - truex = (int) (((tmpBond.start[0] - centre[0]) * scale) + (getWidth() / 2)); + truex = (int) (((tmpBond.start[0] - centre[0]) * scale) + + (getWidth() / 2)); if (Math.abs(truex - x) <= 2) { - int truey = (int) (((centre[1] - tmpBond.start[1]) * scale) + (getHeight() / 2)); + int truey = (int) (((centre[1] - tmpBond.start[1]) * scale) + + (getHeight() / 2)); if (Math.abs(truey - y) <= 2) { @@ -981,11 +990,13 @@ public class PDBCanvas extends JPanel implements MouseListener, // Still here? Maybe its the last bond - truex = (int) (((tmpBond.end[0] - centre[0]) * scale) + (getWidth() / 2)); + truex = (int) (((tmpBond.end[0] - centre[0]) * scale) + + (getWidth() / 2)); if (Math.abs(truex - x) <= 2) { - int truey = (int) (((tmpBond.end[1] - centre[1]) * scale) + (getHeight() / 2)); + int truey = (int) (((tmpBond.end[1] - centre[1]) * scale) + + (getHeight() / 2)); if (Math.abs(truey - y) <= 2) { diff --git a/src/MCview/PDBChain.java b/src/MCview/PDBChain.java index ba93046..f2dd3d0 100755 --- a/src/MCview/PDBChain.java +++ b/src/MCview/PDBChain.java @@ -213,7 +213,8 @@ public class PDBChain tx.setEnd(1 + residues.elementAt(tx.getEnd() - offset).atoms .elementAt(0).alignmentMapping); tx.setStatus(status - + ((tx.getStatus() == null || tx.getStatus().length() == 0) ? "" + + ((tx.getStatus() == null || tx.getStatus().length() == 0) + ? "" : ":" + tx.getStatus())); if (tx.begin != 0 && tx.end != 0) { @@ -349,14 +350,14 @@ public class PDBChain // Add inserted residues as features to the base residue Atom currAtom = resAtoms.get(0); - if (currAtom.insCode != ' ' - && !residues.isEmpty() - && residues.lastElement().atoms.get(0).resNumber == currAtom.resNumber) + if (currAtom.insCode != ' ' && !residues.isEmpty() + && residues.lastElement().atoms + .get(0).resNumber == currAtom.resNumber) { SequenceFeature sf = new SequenceFeature("INSERTION", currAtom.resName + ":" + currAtom.resNumIns + " " + pdbid - + id, "", offset + count - 1, offset + count - 1, - "PDB_INS"); + + id, + "", offset + count - 1, offset + count - 1, "PDB_INS"); resFeatures.addElement(sf); residues.lastElement().atoms.addAll(resAtoms); } @@ -369,27 +370,28 @@ public class PDBChain Residue tmpres = residues.lastElement(); Atom tmpat = tmpres.atoms.get(0); // Make A new SequenceFeature for the current residue numbering - SequenceFeature sf = new SequenceFeature(RESNUM_FEATURE, tmpat.resName - + ":" + tmpat.resNumIns + " " + pdbid + id, "", offset - + count, offset + count, pdbid); + SequenceFeature sf = new SequenceFeature(RESNUM_FEATURE, + tmpat.resName + ":" + tmpat.resNumIns + " " + pdbid + id, + "", offset + count, offset + count, pdbid); resFeatures.addElement(sf); resAnnotation.addElement(new Annotation(tmpat.tfactor)); // Keep totting up the sequence - if ((symbol = ResidueProperties.getAA3Hash().get(tmpat.resName)) == null) + if ((symbol = ResidueProperties.getAA3Hash() + .get(tmpat.resName)) == null) { String nucname = tmpat.resName.trim(); // use the aaIndex rather than call 'toLower' - which would take a bit // more time. deoxyn = nucname.length() == 2 - && ResidueProperties.aaIndex[nucname.charAt(0)] == ResidueProperties.aaIndex['D']; + && ResidueProperties.aaIndex[nucname + .charAt(0)] == ResidueProperties.aaIndex['D']; if (tmpat.name.equalsIgnoreCase("CA") || ResidueProperties.nucleotideIndex[nucname .charAt((deoxyn ? 1 : 0))] == -1) { - char r = ResidueProperties - .getSingleCharacterCode(ResidueProperties - .getCanonicalAminoAcid(tmpat.resName)); + char r = ResidueProperties.getSingleCharacterCode( + ResidueProperties.getCanonicalAminoAcid(tmpat.resName)); seq.append(r == '0' ? 'X' : r); // System.err.println("PDBReader:Null aa3Hash for " + // tmpat.resName); @@ -405,8 +407,8 @@ public class PDBChain { if (nucleotide) { - System.err - .println("Warning: mixed nucleotide and amino acid chain.. its gonna do bad things to you!"); + System.err.println( + "Warning: mixed nucleotide and amino acid chain.. its gonna do bad things to you!"); } seq.append(ResidueProperties.aa[((Integer) symbol).intValue()]); } @@ -518,8 +520,8 @@ public class PDBChain try { index = ResidueProperties.aa3Hash.get(b.at1.resName).intValue(); - b.startCol = cs.findColour(ResidueProperties.aa[index].charAt(0), - 0, null, null, 0f); + b.startCol = cs.findColour(ResidueProperties.aa[index].charAt(0), 0, + null, null, 0f); index = ResidueProperties.aa3Hash.get(b.at2.resName).intValue(); b.endCol = cs.findColour(ResidueProperties.aa[index].charAt(0), 0, @@ -569,8 +571,8 @@ public class PDBChain for (AlignmentAnnotation ana : shadow.getAnnotation()) { - List transfer = sq.getAlignmentAnnotations( - ana.getCalcId(), ana.label); + List transfer = sq + .getAlignmentAnnotations(ana.getCalcId(), ana.label); if (transfer == null || transfer.size() == 0) { ana = new AlignmentAnnotation(ana); @@ -611,7 +613,8 @@ public class PDBChain // Useful for debugging mappings - adds annotation for mapped position float min = -1, max = 0; Annotation[] an = new Annotation[sq.getEnd() - sq.getStart() + 1]; - for (int i = sq.getStart(), j = sq.getEnd(), k = 0; i <= j; i++, k++) + for (int i = sq.getStart(), j = sq + .getEnd(), k = 0; i <= j; i++, k++) { int prn = mapping.getPDBResNum(k + 1); diff --git a/src/MCview/PDBfile.java b/src/MCview/PDBfile.java index 6d3d342..ebc52aa 100755 --- a/src/MCview/PDBfile.java +++ b/src/MCview/PDBfile.java @@ -48,8 +48,7 @@ public class PDBfile extends StructureFile public PDBfile(boolean addAlignmentAnnotations, boolean predictSecStr, boolean externalSecStr, String dataObject, - DataSourceType sourceType) - throws IOException + DataSourceType sourceType) throws IOException { super(false, dataObject, sourceType); addSettings(addAlignmentAnnotations, predictSecStr, externalSecStr); @@ -190,9 +189,8 @@ public class PDBfile extends StructureFile } catch (OutOfMemoryError er) { System.out.println("OUT OF MEMORY LOADING PDB FILE"); - throw new IOException( - MessageManager - .getString("exception.outofmemory_loading_pdb_file")); + throw new IOException(MessageManager + .getString("exception.outofmemory_loading_pdb_file")); } catch (NumberFormatException ex) { if (line != null) @@ -228,8 +226,8 @@ public class PDBfile extends StructureFile public static String relocateCalcId(String calcId, Hashtable alreadyLoadedPDB) throws Exception { - int s = CALC_ID_PREFIX.length(), end = calcId - .indexOf(CALC_ID_PREFIX, s); + int s = CALC_ID_PREFIX.length(), + end = calcId.indexOf(CALC_ID_PREFIX, s); String between = calcId.substring(s, end - 1); return CALC_ID_PREFIX + alreadyLoadedPDB.get(between) + ":" + calcId.substring(end); diff --git a/src/jalview/analysis/AAFrequency.java b/src/jalview/analysis/AAFrequency.java index b806355..f8e8379 100755 --- a/src/jalview/analysis/AAFrequency.java +++ b/src/jalview/analysis/AAFrequency.java @@ -147,8 +147,8 @@ public class AAFrequency { if (sequences[row] == null) { - System.err - .println("WARNING: Consensus skipping null sequence - possible race condition."); + System.err.println( + "WARNING: Consensus skipping null sequence - possible race condition."); continue; } char[] seq = sequences[row].getSequence(); @@ -316,7 +316,7 @@ public class AAFrequency // always set ranges again gaprow.graphMax = nseq; gaprow.graphMin = 0; - double scale = 0.8/nseq; + double scale = 0.8 / nseq; for (int i = startCol; i < endCol; i++) { ProfileI profile = profiles.get(i); @@ -334,9 +334,9 @@ public class AAFrequency String description = "" + gapped; - gaprow.annotations[i] = new Annotation("", description, - '\0', gapped, jalview.util.ColorUtils.bleachColour( - Color.DARK_GRAY, (float) scale * gapped)); + gaprow.annotations[i] = new Annotation("", description, '\0', gapped, + jalview.util.ColorUtils.bleachColour(Color.DARK_GRAY, + (float) scale * gapped)); } } @@ -345,7 +345,8 @@ public class AAFrequency *
    *
  • the full profile (percentages of all residues present), if * showSequenceLogo is true, or
  • - *
  • just the modal (most common) residue(s), if showSequenceLogo is false
  • + *
  • just the modal (most common) residue(s), if showSequenceLogo is + * false
  • *
* Percentages are as a fraction of all sequence, or only ungapped sequences * if ignoreGaps is true. @@ -366,8 +367,8 @@ public class AAFrequency String description = null; if (counts != null && showSequenceLogo) { - int normaliseBy = ignoreGaps ? profile.getNonGapped() : profile - .getHeight(); + int normaliseBy = ignoreGaps ? profile.getNonGapped() + : profile.getHeight(); description = counts.getTooltip(normaliseBy, dp); } else @@ -424,8 +425,8 @@ public class AAFrequency QuickSort.sort(values, symbols); int nextArrayPos = 2; int totalPercentage = 0; - final int divisor = ignoreGaps ? profile.getNonGapped() : profile - .getHeight(); + final int divisor = ignoreGaps ? profile.getNonGapped() + : profile.getHeight(); /* * traverse the arrays in reverse order (highest counts first) @@ -542,8 +543,8 @@ public class AAFrequency { continue; } - List codons = MappingUtils - .findCodonsFor(seq, col, mappings); + List codons = MappingUtils.findCodonsFor(seq, col, + mappings); for (char[] codon : codons) { int codonEncoded = CodingUtils.encodeCodon(codon); @@ -623,10 +624,10 @@ public class AAFrequency int modalCodonEncoded = codons[codons.length - 1]; int modalCodonCount = sortedCodonCounts[codons.length - 1]; - String modalCodon = String.valueOf(CodingUtils - .decodeCodon(modalCodonEncoded)); - if (sortedCodonCounts.length > 1 - && sortedCodonCounts[codons.length - 2] == sortedCodonCounts[codons.length - 1]) + String modalCodon = String + .valueOf(CodingUtils.decodeCodon(modalCodonEncoded)); + if (sortedCodonCounts.length > 1 && sortedCodonCounts[codons.length + - 2] == sortedCodonCounts[codons.length - 1]) { /* * two or more codons share the modal count @@ -685,8 +686,8 @@ public class AAFrequency { if (samePercent.length() > 0) { - mouseOver.append(samePercent).append(": ") - .append(lastPercent).append("% "); + mouseOver.append(samePercent).append(": ").append(lastPercent) + .append("% "); } samePercent.setLength(0); samePercent.append(codon); diff --git a/src/jalview/analysis/AlignSeq.java b/src/jalview/analysis/AlignSeq.java index 07f43da..34a21e6 100755 --- a/src/jalview/analysis/AlignSeq.java +++ b/src/jalview/analysis/AlignSeq.java @@ -123,9 +123,12 @@ public class AlignSeq /** * Creates a new AlignSeq object. * - * @param s1 first sequence for alignment - * @param s2 second sequence for alignment - * @param type molecule type, either AlignSeq.PEP or AlignSeq.DNA + * @param s1 + * first sequence for alignment + * @param s2 + * second sequence for alignment + * @param type + * molecule type, either AlignSeq.PEP or AlignSeq.DNA */ public AlignSeq(SequenceI s1, SequenceI s2, String type) { @@ -258,8 +261,8 @@ public class AlignSeq SequenceI alSeq1 = new Sequence(s1.getName(), getAStr1()); alSeq1.setStart(s1.getStart() + getSeq1Start() - 1); alSeq1.setEnd(s1.getStart() + getSeq1End() - 1); - alSeq1.setDatasetSequence(s1.getDatasetSequence() == null ? s1 : s1 - .getDatasetSequence()); + alSeq1.setDatasetSequence( + s1.getDatasetSequence() == null ? s1 : s1.getDatasetSequence()); return alSeq1; } @@ -272,8 +275,8 @@ public class AlignSeq SequenceI alSeq2 = new Sequence(s2.getName(), getAStr2()); alSeq2.setStart(s2.getStart() + getSeq2Start() - 1); alSeq2.setEnd(s2.getStart() + getSeq2End() - 1); - alSeq2.setDatasetSequence(s2.getDatasetSequence() == null ? s2 : s2 - .getDatasetSequence()); + alSeq2.setDatasetSequence( + s2.getDatasetSequence() == null ? s2 : s2.getDatasetSequence()); return alSeq2; } @@ -314,9 +317,9 @@ public class AlignSeq if (s1str.length() == 0 || s2str.length() == 0) { - output.append("ALL GAPS: " - + (s1str.length() == 0 ? s1.getName() : " ") - + (s2str.length() == 0 ? s2.getName() : "")); + output.append( + "ALL GAPS: " + (s1str.length() == 0 ? s1.getName() : " ") + + (s2str.length() == 0 ? s2.getName() : "")); return; } @@ -337,14 +340,14 @@ public class AlignSeq if (!PEP.equals(moleculeType) && !DNA.equals(moleculeType)) { output.append("Wrong type = dna or pep only"); - throw new Error(MessageManager.formatMessage( - "error.unknown_type_dna_or_pep", - new String[] { moleculeType })); + throw new Error(MessageManager + .formatMessage("error.unknown_type_dna_or_pep", new String[] + { moleculeType })); } type = moleculeType; - scoreMatrix = ScoreModels.getInstance().getDefaultModel( - PEP.equals(type)); + scoreMatrix = ScoreModels.getInstance() + .getDefaultModel(PEP.equals(type)); } /** @@ -676,8 +679,8 @@ public class AlignSeq float pairwiseScore = scoreMatrix.getPairwiseScore(s1str.charAt(i), s2str.charAt(j)); - score[i][j] = max(score[i - 1][j - 1] - + (pairwiseScore * 10), E[i][j], F[i][j]); + score[i][j] = max(score[i - 1][j - 1] + (pairwiseScore * 10), + E[i][j], F[i][j]); traceback[i][j] = findTrace(i, j); } } @@ -863,7 +866,8 @@ public class AlignSeq */ public jalview.datamodel.Mapping getMappingFromS1(boolean allowmismatch) { - ArrayList as1 = new ArrayList(), as2 = new ArrayList(); + ArrayList as1 = new ArrayList(), + as2 = new ArrayList(); int pdbpos = s2.getStart() + getSeq2Start() - 2; int alignpos = s1.getStart() + getSeq1Start() - 2; int lp2 = pdbpos - 3, lp1 = alignpos - 3; @@ -907,8 +911,8 @@ public class AlignSeq } // construct range pairs - int[] mapseq1 = new int[as1.size() + (lastmatch ? 1 : 0)], mapseq2 = new int[as2 - .size() + (lastmatch ? 1 : 0)]; + int[] mapseq1 = new int[as1.size() + (lastmatch ? 1 : 0)], + mapseq2 = new int[as2.size() + (lastmatch ? 1 : 0)]; int i = 0; for (Integer ip : as1) { @@ -951,7 +955,8 @@ public class AlignSeq List ochains, AlignmentI al, String dnaOrProtein, boolean removeOldAnnots) { - List orig = new ArrayList(), repl = new ArrayList(); + List orig = new ArrayList(), + repl = new ArrayList(); List aligs = new ArrayList(); if (al != null && al.getHeight() > 0) { diff --git a/src/jalview/analysis/AlignmentAnnotationUtils.java b/src/jalview/analysis/AlignmentAnnotationUtils.java index 5cf7f08..f5626ce 100644 --- a/src/jalview/analysis/AlignmentAnnotationUtils.java +++ b/src/jalview/analysis/AlignmentAnnotationUtils.java @@ -91,9 +91,8 @@ public class AlignmentAnnotationUtils { continue; } - if (forSequences != null - && (aa.sequenceRef != null && forSequences - .contains(aa.sequenceRef))) + if (forSequences != null && (aa.sequenceRef != null + && forSequences.contains(aa.sequenceRef))) { String calcId = aa.getCalcId(); @@ -114,8 +113,8 @@ public class AlignmentAnnotationUtils .get(calcId); if (groupLabelsForCalcId.containsKey(aa.graphGroup)) { - if (!groupLabelsForCalcId.get(aa.graphGroup).contains( - displayLabel)) + if (!groupLabelsForCalcId.get(aa.graphGroup) + .contains(displayLabel)) { groupLabelsForCalcId.get(aa.graphGroup).add(displayLabel); } diff --git a/src/jalview/analysis/AlignmentSorter.java b/src/jalview/analysis/AlignmentSorter.java index 693e794..6b8ea4a 100755 --- a/src/jalview/analysis/AlignmentSorter.java +++ b/src/jalview/analysis/AlignmentSorter.java @@ -109,8 +109,9 @@ public class AlignmentSorter true); for (int i = 0; i < nSeq; i++) { - scores[i] = (float) PIDModel.computePID(align.getSequenceAt(i) - .getSequenceAsString(), refSeq, pidParams); + scores[i] = (float) PIDModel.computePID( + align.getSequenceAt(i).getSequenceAsString(), refSeq, + pidParams); seqs[i] = align.getSequenceAt(i); } @@ -416,7 +417,8 @@ public class AlignmentSorter } else { - setReverseOrder(align, vectorSubsetToArray(tmp, align.getSequences())); + setReverseOrder(align, + vectorSubsetToArray(tmp, align.getSequences())); } } @@ -451,12 +453,9 @@ public class AlignmentSorter if (tmp.size() != nSeq) { - System.err - .println("WARNING: tmp.size()=" - + tmp.size() - + " != nseq=" - + nSeq - + " in getOrderByTree - tree contains sequences not in alignment"); + System.err.println("WARNING: tmp.size()=" + tmp.size() + " != nseq=" + + nSeq + + " in getOrderByTree - tree contains sequences not in alignment"); } } @@ -492,7 +491,8 @@ public class AlignmentSorter } else { - setReverseOrder(align, vectorSubsetToArray(tmp, align.getSequences())); + setReverseOrder(align, + vectorSubsetToArray(tmp, align.getSequences())); } } @@ -704,11 +704,10 @@ public class AlignmentSorter int start, int stop, AlignmentI alignment, String method) { sortByFeature( - featureLabel == null ? null - : Arrays.asList(new String[] { featureLabel }), - groupLabel == null ? null : Arrays - .asList(new String[] { groupLabel }), start, stop, - alignment, method); + featureLabel == null ? null : Arrays.asList(new String[] + { featureLabel }), + groupLabel == null ? null : Arrays.asList(new String[] + { groupLabel }), start, stop, alignment, method); } private static boolean containsIgnoreCase(final String lab, @@ -739,9 +738,8 @@ public class AlignmentSorter if (method != FEATURE_SCORE && method != FEATURE_LABEL && method != FEATURE_DENSITY) { - throw new Error( - MessageManager - .getString("error.implementation_error_sortbyfeature")); + throw new Error(MessageManager + .getString("error.implementation_error_sortbyfeature")); } boolean ignoreScore = method != FEATURE_SCORE; @@ -820,13 +818,12 @@ public class AlignmentSorter */ boolean noOverlap = seqs[i].findIndex(feature.getBegin()) > stop + 1 || seqs[i].findIndex(feature.getEnd()) < start + 1; - boolean skipFeatureType = featureLabels != null - && !AlignmentSorter.containsIgnoreCase(feature.type, - featureLabels); + boolean skipFeatureType = featureLabels != null && !AlignmentSorter + .containsIgnoreCase(feature.type, featureLabels); boolean skipFeatureGroup = groupLabels != null - && (feature.getFeatureGroup() != null && !AlignmentSorter - .containsIgnoreCase(feature.getFeatureGroup(), - groupLabels)); + && (feature.getFeatureGroup() != null + && !AlignmentSorter.containsIgnoreCase( + feature.getFeatureGroup(), groupLabels)); if (noOverlap || skipFeatureType || skipFeatureGroup) { // forget about this feature @@ -867,8 +864,9 @@ public class AlignmentSorter String[] labs = new String[fs.length]; for (int l = 0; l < labs.length; l++) { - labs[l] = (fs[l].getDescription() != null ? fs[l] - .getDescription() : fs[l].getType()); + labs[l] = (fs[l].getDescription() != null + ? fs[l].getDescription() + : fs[l].getType()); } QuickSort.sort(labs, ((Object[]) feats[i])); } diff --git a/src/jalview/analysis/AlignmentUtils.java b/src/jalview/analysis/AlignmentUtils.java index 232cb5d..1b8f84f 100644 --- a/src/jalview/analysis/AlignmentUtils.java +++ b/src/jalview/analysis/AlignmentUtils.java @@ -171,10 +171,12 @@ public class AlignmentUtils } } // TODO use Character.toLowerCase to avoid creating String objects? - char[] upstream = new String(ds.getSequence(s.getStart() - 1 - - ustream_ds, s.getStart() - 1)).toLowerCase().toCharArray(); - char[] downstream = new String(ds.getSequence(s_end - 1, s_end - + dstream_ds)).toLowerCase().toCharArray(); + char[] upstream = new String(ds + .getSequence(s.getStart() - 1 - ustream_ds, s.getStart() - 1)) + .toLowerCase().toCharArray(); + char[] downstream = new String( + ds.getSequence(s_end - 1, s_end + dstream_ds)).toLowerCase() + .toCharArray(); char[] coreseq = s.getSequence(); char[] nseq = new char[offset + upstream.length + downstream.length + coreseq.length]; @@ -189,8 +191,8 @@ public class AlignmentUtils System.arraycopy(upstream, 0, nseq, p, upstream.length); System.arraycopy(coreseq, 0, nseq, p + upstream.length, coreseq.length); - System.arraycopy(downstream, 0, nseq, p + coreseq.length - + upstream.length, downstream.length); + System.arraycopy(downstream, 0, nseq, + p + coreseq.length + upstream.length, downstream.length); s.setSequence(new String(nseq)); s.setStart(s.getStart() - ustream_ds); s.setEnd(s_end + downstream.length); @@ -317,9 +319,9 @@ public class AlignmentUtils * @return */ protected static boolean mapProteinToCdna( - final AlignmentI proteinAlignment, - final AlignmentI cdnaAlignment, Set mappedDna, - Set mappedProtein, boolean xrefsOnly) + final AlignmentI proteinAlignment, final AlignmentI cdnaAlignment, + Set mappedDna, Set mappedProtein, + boolean xrefsOnly) { boolean mappingExistsOrAdded = false; List thisSeqs = proteinAlignment.getSequences(); @@ -348,9 +350,8 @@ public class AlignmentUtils * Don't map non-xrefd sequences more than once each. This heuristic * allows us to pair up similar sequences in ordered alignments. */ - if (!xrefsOnly - && (mappedProtein.contains(aaSeq) || mappedDna - .contains(cdnaSeq))) + if (!xrefsOnly && (mappedProtein.contains(aaSeq) + || mappedDna.contains(cdnaSeq))) { continue; } @@ -403,7 +404,8 @@ public class AlignmentUtils /** * Builds a mapping (if possible) of a cDNA to a protein sequence. *
    - *
  • first checks if the cdna translates exactly to the protein sequence
  • + *
  • first checks if the cdna translates exactly to the protein + * sequence
  • *
  • else checks for translation after removing a STOP codon
  • *
  • else checks for translation after removing a START codon
  • *
  • if that fails, inspect CDS features on the cDNA sequence
  • @@ -425,8 +427,9 @@ public class AlignmentUtils * String objects. */ final SequenceI proteinDataset = proteinSeq.getDatasetSequence(); - char[] aaSeqChars = proteinDataset != null ? proteinDataset - .getSequence() : proteinSeq.getSequence(); + char[] aaSeqChars = proteinDataset != null + ? proteinDataset.getSequence() + : proteinSeq.getSequence(); final SequenceI cdnaDataset = cdnaSeq.getDatasetSequence(); char[] cdnaSeqChars = cdnaDataset != null ? cdnaDataset.getSequence() : cdnaSeq.getSequence(); @@ -467,8 +470,7 @@ public class AlignmentUtils * If lengths still don't match, try ignoring start codon. */ int startOffset = 0; - if (cdnaLength != mappedLength - && cdnaLength > 2 + if (cdnaLength != mappedLength && cdnaLength > 2 && String.valueOf(cdnaSeqChars, 0, CODON_LENGTH).toUpperCase() .equals(ResidueProperties.START)) { @@ -482,8 +484,9 @@ public class AlignmentUtils /* * protein is translation of dna (+/- start/stop codons) */ - MapList map = new MapList(new int[] { cdnaStart, cdnaEnd }, new int[] - { proteinStart, proteinEnd }, CODON_LENGTH, 1); + MapList map = new MapList(new int[] { cdnaStart, cdnaEnd }, + new int[] + { proteinStart, proteinEnd }, CODON_LENGTH, 1); return map; } @@ -513,7 +516,8 @@ public class AlignmentUtils int aaPos = 0; int dnaPos = cdnaStart; - for (; dnaPos < cdnaSeqChars.length - 2 && aaPos < aaSeqChars.length; dnaPos += CODON_LENGTH, aaPos++) + for (; dnaPos < cdnaSeqChars.length - 2 + && aaPos < aaSeqChars.length; dnaPos += CODON_LENGTH, aaPos++) { String codon = String.valueOf(cdnaSeqChars, dnaPos, CODON_LENGTH); final String translated = ResidueProperties.codonTranslate(codon); @@ -632,10 +636,9 @@ public class AlignmentUtils * @param preserveUnmappedGaps * @param preserveMappedGaps */ - public static void alignSequenceAs(SequenceI alignTo, - SequenceI alignFrom, AlignedCodonFrame mapping, String myGap, - char sourceGap, boolean preserveMappedGaps, - boolean preserveUnmappedGaps) + public static void alignSequenceAs(SequenceI alignTo, SequenceI alignFrom, + AlignedCodonFrame mapping, String myGap, char sourceGap, + boolean preserveMappedGaps, boolean preserveUnmappedGaps) { // TODO generalise to work for Protein-Protein, dna-dna, dna-protein @@ -830,8 +833,9 @@ public class AlignmentUtils } else { - gapsToAdd = Math.min(intronLength + trailingGapLength - - sourceGapMappedLength, trailingGapLength); + gapsToAdd = Math.min( + intronLength + trailingGapLength - sourceGapMappedLength, + trailingGapLength); } } } @@ -930,7 +934,8 @@ public class AlignmentUtils * @return */ static boolean alignCdsSequenceAsProtein(SequenceI cdsSeq, - AlignmentI protein, List mappings, char gapChar) + AlignmentI protein, List mappings, + char gapChar) { SequenceI cdsDss = cdsSeq.getDatasetSequence(); if (cdsDss == null) @@ -957,20 +962,19 @@ public class AlignmentUtils mapList = mapList.getInverse(); } int cdsLength = cdsDss.getLength(); - int mappedFromLength = MappingUtils.getLength(mapList - .getFromRanges()); + int mappedFromLength = MappingUtils + .getLength(mapList.getFromRanges()); int mappedToLength = MappingUtils .getLength(mapList.getToRanges()); boolean addStopCodon = (cdsLength == mappedFromLength * CODON_LENGTH + CODON_LENGTH) - || (peptide.getDatasetSequence().getLength() == mappedFromLength - 1); + || (peptide.getDatasetSequence() + .getLength() == mappedFromLength - 1); if (cdsLength != mappedToLength && !addStopCodon) { - System.err - .println(String - .format("Can't align cds as protein (length mismatch %d/%d): %s", - cdsLength, mappedToLength, - cdsSeq.getName())); + System.err.println(String.format( + "Can't align cds as protein (length mismatch %d/%d): %s", + cdsLength, mappedToLength, cdsSeq.getName())); } /* @@ -1031,7 +1035,8 @@ public class AlignmentUtils break; } } - for (int i = nucleotides.length - CODON_LENGTH; i < nucleotides.length; i++) + for (int i = nucleotides.length + - CODON_LENGTH; i < nucleotides.length; i++) { alignedCds[cdsCol++] = nucleotides[i]; } @@ -1087,8 +1092,8 @@ public class AlignmentUtils if (prot != null) { Mapping seqMap = mapping.getMappingForSequence(dnaSeq); - addCodonPositions(dnaSeq, prot, protein.getGapCharacter(), - seqMap, alignedCodons); + addCodonPositions(dnaSeq, prot, protein.getGapCharacter(), seqMap, + alignedCodons); unmappedProtein.remove(prot); } } @@ -1141,8 +1146,8 @@ public class AlignmentUtils AlignedCodon codon = sequenceCodon.getValue(); if (codon.peptideCol > 1) { - System.err - .println("Problem mapping protein with >1 unmapped start positions: " + System.err.println( + "Problem mapping protein with >1 unmapped start positions: " + seq.getName()); } else if (codon.peptideCol == 1) @@ -1153,8 +1158,8 @@ public class AlignmentUtils if (lastCodon != null) { AlignedCodon firstPeptide = new AlignedCodon(lastCodon.pos1, - lastCodon.pos2, lastCodon.pos3, String.valueOf(seq - .getCharAt(0)), 0); + lastCodon.pos2, lastCodon.pos3, + String.valueOf(seq.getCharAt(0)), 0); toAdd.put(seq, firstPeptide); } else @@ -1303,7 +1308,8 @@ public class AlignmentUtils *
      *
    • One alignment must be nucleotide, and the other protein
    • *
    • At least one pair of sequences must be already mapped, or mappable
    • - *
    • Mappable means the nucleotide translation matches the protein sequence
    • + *
    • Mappable means the nucleotide translation matches the protein + * sequence
    • *
    • The translation may ignore start and stop codons if present in the * nucleotide
    • *
    @@ -1359,9 +1365,10 @@ public class AlignmentUtils return false; } - SequenceI dnaDs = dnaSeq.getDatasetSequence() == null ? dnaSeq : dnaSeq - .getDatasetSequence(); - SequenceI proteinDs = proteinSeq.getDatasetSequence() == null ? proteinSeq + SequenceI dnaDs = dnaSeq.getDatasetSequence() == null ? dnaSeq + : dnaSeq.getDatasetSequence(); + SequenceI proteinDs = proteinSeq.getDatasetSequence() == null + ? proteinSeq : proteinSeq.getDatasetSequence(); for (AlignedCodonFrame mapping : mappings) @@ -1398,8 +1405,7 @@ public class AlignmentUtils * the alignment to check for presence of annotations */ public static void findAddableReferenceAnnotations( - List sequenceScope, - Map labelForCalcId, + List sequenceScope, Map labelForCalcId, final Map> candidates, AlignmentI al) { @@ -1503,8 +1509,8 @@ public class AlignmentUtils /** * Set visibility of alignment annotations of specified types (labels), for - * specified sequences. This supports controls like - * "Show all secondary structure", "Hide all Temp factor", etc. + * specified sequences. This supports controls like "Show all secondary + * structure", "Hide all Temp factor", etc. * * @al the alignment to scan for annotations * @param types @@ -1528,9 +1534,8 @@ public class AlignmentUtils { if (anyType || types.contains(aa.label)) { - if ((aa.sequenceRef != null) - && (forSequences == null || forSequences - .contains(aa.sequenceRef))) + if ((aa.sequenceRef != null) && (forSequences == null + || forSequences.contains(aa.sequenceRef))) { aa.visible = doShow; } @@ -1618,8 +1623,8 @@ public class AlignmentUtils productSeqs = new HashSet(); for (SequenceI seq : products) { - productSeqs.add(seq.getDatasetSequence() == null ? seq : seq - .getDatasetSequence()); + productSeqs.add(seq.getDatasetSequence() == null ? seq + : seq.getDatasetSequence()); } } @@ -1712,8 +1717,9 @@ public class AlignmentUtils /* * add a mapping from CDS to the (unchanged) mapped to range */ - List cdsRange = Collections.singletonList(new int[] { 1, - cdsSeq.getLength() }); + List cdsRange = Collections + .singletonList(new int[] + { 1, cdsSeq.getLength() }); MapList cdsToProteinMap = new MapList(cdsRange, mapList.getToRanges(), mapList.getFromRatio(), mapList.getToRatio()); @@ -1778,12 +1784,11 @@ public class AlignmentUtils // 'CDS|emblcdsacc' // assuming cds version same as dna ?!? - DBRefEntry proteinToCdsRef = new DBRefEntry( - primRef.getSource(), primRef.getVersion(), - cdsSeq.getName()); + DBRefEntry proteinToCdsRef = new DBRefEntry(primRef.getSource(), + primRef.getVersion(), cdsSeq.getName()); // - proteinToCdsRef.setMap(new Mapping(cdsSeqDss, cdsToProteinMap - .getInverse())); + proteinToCdsRef.setMap( + new Mapping(cdsSeqDss, cdsToProteinMap.getInverse())); proteinProduct.addDBRef(proteinToCdsRef); } @@ -1796,8 +1801,8 @@ public class AlignmentUtils } } - AlignmentI cds = new Alignment(cdsSeqs.toArray(new SequenceI[cdsSeqs - .size()])); + AlignmentI cds = new Alignment( + cdsSeqs.toArray(new SequenceI[cdsSeqs.size()])); cds.setDataset(dataset); return cds; @@ -1834,8 +1839,8 @@ public class AlignmentUtils * is this mapping from the whole dna sequence (i.e. CDS)? * allowing for possible stop codon on dna but not peptide */ - int mappedFromLength = MappingUtils.getLength(aMapping.getMap() - .getFromRanges()); + int mappedFromLength = MappingUtils + .getLength(aMapping.getMap().getFromRanges()); int dnaLength = seqDss.getLength(); if (mappedFromLength == dnaLength || mappedFromLength == dnaLength - CODON_LENGTH) @@ -1859,8 +1864,8 @@ public class AlignmentUtils && proteinProduct == mapping.getTo() && seqDss != map.getFromSeq()) { - mappedFromLength = MappingUtils.getLength(mapping.getMap() - .getFromRanges()); + mappedFromLength = MappingUtils + .getLength(mapping.getMap().getFromRanges()); if (mappedFromLength == map.getFromSeq().getLength()) { /* @@ -1958,8 +1963,8 @@ public class AlignmentUtils } else { - System.err - .println("JAL-2154 regression: warning - found (and ignnored a duplicate CDS sequence):" + System.err.println( + "JAL-2154 regression: warning - found (and ignnored a duplicate CDS sequence):" + mtch.toString()); } } @@ -2011,16 +2016,17 @@ public class AlignmentUtils for (DBRefEntry cdsref : direct) { // clone maplist and mapping - MapList cdsposmap = new MapList(Arrays.asList(new int[][] { new int[] - { cdsSeq.getStart(), cdsSeq.getEnd() } }), cdsref.getMap().getMap() - .getToRanges(), 3, 1); - Mapping cdsmap = new Mapping(cdsref.getMap().getTo(), cdsref.getMap() - .getMap()); + MapList cdsposmap = new MapList( + Arrays.asList(new int[][] + { new int[] { cdsSeq.getStart(), cdsSeq.getEnd() } }), + cdsref.getMap().getMap().getToRanges(), 3, 1); + Mapping cdsmap = new Mapping(cdsref.getMap().getTo(), + cdsref.getMap().getMap()); // create dbref DBRefEntry newref = new DBRefEntry(cdsref.getSource(), - cdsref.getVersion(), cdsref.getAccessionId(), new Mapping( - cdsmap.getTo(), cdsposmap)); + cdsref.getVersion(), cdsref.getAccessionId(), + new Mapping(cdsmap.getTo(), cdsposmap)); // and see if we can map to the protein product for this mapping. // onSource is the filtered set of accessions on protein that we are @@ -2240,8 +2246,8 @@ public class AlignmentUtils if (begin > end) { // shouldn't happen! - System.err - .println("Error: start phase extends beyond start CDS in " + System.err.println( + "Error: start phase extends beyond start CDS in " + dnaSeq.getName()); } } @@ -2455,8 +2461,8 @@ public class AlignmentUtils * are currently ignored here */ String trans = codon.contains("-") ? "-" - : (codon.length() > CODON_LENGTH ? null : ResidueProperties - .codonTranslate(codon)); + : (codon.length() > CODON_LENGTH ? null + : ResidueProperties.codonTranslate(codon)); if (trans != null && !trans.equals(residue)) { String residue3Char = StringUtils @@ -2482,10 +2488,8 @@ public class AlignmentUtils StringBuilder link = new StringBuilder(32); try { - link.append(desc) - .append(" ") - .append(id) - .append("|http://www.ensembl.org/Homo_sapiens/Variation/Summary?v=") + link.append(desc).append(" ").append(id).append( + "|http://www.ensembl.org/Homo_sapiens/Variation/Summary?v=") .append(URLEncoder.encode(id, "UTF-8")); sf.addLink(link.toString()); } catch (UnsupportedEncodingException e) @@ -2588,8 +2592,8 @@ public class AlignmentUtils * get this peptide's codon positions e.g. [3, 4, 5] or [4, 7, 10] */ int[] codon = peptidePosition == lastPeptidePostion ? lastCodon - : MappingUtils.flattenRanges(dnaToProtein.locateInFrom( - peptidePosition, peptidePosition)); + : MappingUtils.flattenRanges(dnaToProtein + .locateInFrom(peptidePosition, peptidePosition)); lastPeptidePostion = peptidePosition; lastCodon = codon; @@ -2598,8 +2602,8 @@ public class AlignmentUtils */ for (int codonPos = 0; codonPos < CODON_LENGTH; codonPos++) { - String nucleotide = String.valueOf( - dnaSeq.getCharAt(codon[codonPos] - dnaStart)) + String nucleotide = String + .valueOf(dnaSeq.getCharAt(codon[codonPos] - dnaStart)) .toUpperCase(); List codonVariant = codonVariants[codonPos]; if (codon[codonPos] == dnaCol) @@ -2811,8 +2815,8 @@ public class AlignmentUtils */ for (SequenceI seq : unaligned.getSequences()) { - List alignedSequences = alignedDatasets.get(seq - .getDatasetSequence()); + List alignedSequences = alignedDatasets + .get(seq.getDatasetSequence()); // TODO: getSequenceAsString() will be deprecated in the future // TODO: need to leave to SequenceI implementor to update gaps seq.setSequence(alignedSequences.get(0).getSequenceAsString()); @@ -2836,7 +2840,8 @@ public class AlignmentUtils * @return */ static SortedMap> buildMappedColumnsMap( - AlignmentI unaligned, AlignmentI aligned, List unmapped) + AlignmentI unaligned, AlignmentI aligned, + List unmapped) { /* * Map will hold, for each aligned column position, a map of @@ -2871,7 +2876,8 @@ public class AlignmentUtils } /** - * Helper method that adds to a map the mapped column positions of a sequence.
    + * Helper method that adds to a map the mapped column positions of a sequence. + *
    * For example if aaTT-Tg-gAAA is mapped to TTTAAA then the map should record * that columns 3,4,6,10,11,12 map to characters T,T,T,A,A,A of the mapped to * sequence. @@ -2900,8 +2906,8 @@ public class AlignmentUtils */ if (seqMap.getTo() == fromSeq.getDatasetSequence()) { - seqMap = new Mapping(seq.getDatasetSequence(), seqMap.getMap() - .getInverse()); + seqMap = new Mapping(seq.getDatasetSequence(), + seqMap.getMap().getInverse()); } char[] fromChars = fromSeq.getSequence(); diff --git a/src/jalview/analysis/AnnotationSorter.java b/src/jalview/analysis/AnnotationSorter.java index 711e8c9..2f556f1 100644 --- a/src/jalview/analysis/AnnotationSorter.java +++ b/src/jalview/analysis/AnnotationSorter.java @@ -50,8 +50,8 @@ public class AnnotationSorter public enum SequenceAnnotationOrder { // Text descriptions surface in the Preferences Sort by... options - SEQUENCE_AND_LABEL("Sequence"), LABEL_AND_SEQUENCE("Label"), NONE( - "No sort"); + SEQUENCE_AND_LABEL("Sequence"), LABEL_AND_SEQUENCE("Label"), + NONE("No sort"); private String description; @@ -108,7 +108,8 @@ public class AnnotationSorter *
      *
    • annotations with a reference to a sequence in the alignment are sorted * on sequence ordering
    • - *
    • other annotations go 'at the end', with their mutual order unchanged
    • + *
    • other annotations go 'at the end', with their mutual order + * unchanged
    • *
    • within the same sequence ref, sort by label (non-case-sensitive)
    • *
    */ @@ -169,7 +170,8 @@ public class AnnotationSorter *
      *
    • annotations with a reference to a sequence in the alignment are sorted * on label (non-case-sensitive)
    • - *
    • other annotations go 'at the end', with their mutual order unchanged
    • + *
    • other annotations go 'at the end', with their mutual order + * unchanged
    • *
    • within the same label, sort by order of the related sequences
    • *
    */ @@ -278,7 +280,8 @@ public class AnnotationSorter // cache 'alignment sequence position' for the annotations saveSequenceIndices(alignmentAnnotations); - Comparator comparator = getComparator(order); + Comparator comparator = getComparator( + order); if (alignmentAnnotations != null) { diff --git a/src/jalview/analysis/AverageDistanceTree.java b/src/jalview/analysis/AverageDistanceTree.java index 907109e..9bf6742 100644 --- a/src/jalview/analysis/AverageDistanceTree.java +++ b/src/jalview/analysis/AverageDistanceTree.java @@ -46,8 +46,8 @@ public class AverageDistanceTree extends TreeBuilder { if ((l != i) && (l != j)) { - newdist[l] = ((distances.getValue(i, l) * noi) + (distances - .getValue(j, l) * noj)) / (noi + noj); + newdist[l] = ((distances.getValue(i, l) * noi) + + (distances.getValue(j, l) * noj)) / (noi + noj); } else { diff --git a/src/jalview/analysis/Conservation.java b/src/jalview/analysis/Conservation.java index 2b5a8f6..ba4f705 100755 --- a/src/jalview/analysis/Conservation.java +++ b/src/jalview/analysis/Conservation.java @@ -143,8 +143,8 @@ public class Conservation * @param end * end column position */ - public Conservation(String name, int threshold, - List sequences, int start, int end) + public Conservation(String name, int threshold, List sequences, + int start, int end) { this.name = name; this.threshold = threshold; @@ -244,8 +244,8 @@ public class Conservation else { // JBPNote INFO level debug - System.err - .println("ERROR: calcSeqNum called with out of range sequence index for Alignment\n"); + System.err.println( + "ERROR: calcSeqNum called with out of range sequence index for Alignment\n"); } } @@ -414,7 +414,8 @@ public class Conservation continue; } - char c = sequences[i].getCharAt(column); // gaps do not have upper/lower case + char c = sequences[i].getCharAt(column); // gaps do not have upper/lower + // case if (Comparison.isGap((c))) { @@ -618,7 +619,8 @@ public class Conservation * @param endCol * @param scoreMatrix */ - protected void findQuality(int startCol, int endCol, ScoreMatrix scoreMatrix) + protected void findQuality(int startCol, int endCol, + ScoreMatrix scoreMatrix) { quality = new Vector(); @@ -798,11 +800,11 @@ public class Conservation float vprop = value - min; vprop /= max; int consp = i - start; - String conssym = (value > 0 && consp > -1 && consp < consSymbs.length) ? consSymbs[consp] - : ""; + String conssym = (value > 0 && consp > -1 + && consp < consSymbs.length) ? consSymbs[consp] : ""; conservation.annotations[i] = new Annotation(String.valueOf(c), - conssym, ' ', value, new Color(minR + (maxR * vprop), minG - + (maxG * vprop), minB + (maxB * vprop))); + conssym, ' ', value, new Color(minR + (maxR * vprop), + minG + (maxG * vprop), minB + (maxB * vprop))); } // Quality calc @@ -811,10 +813,9 @@ public class Conservation value = quality.elementAt(i).floatValue(); float vprop = value - qmin; vprop /= qmax; - quality2.annotations[i] = new Annotation(" ", - String.valueOf(value), ' ', value, new Color(minR - + (maxR * vprop), minG + (maxG * vprop), minB - + (maxB * vprop))); + quality2.annotations[i] = new Annotation(" ", String.valueOf(value), + ' ', value, new Color(minR + (maxR * vprop), + minG + (maxG * vprop), minB + (maxB * vprop))); } } } @@ -869,7 +870,8 @@ public class Conservation char val = column < sequence.length ? sequence[column] : '-'; boolean hasConservation = val != '-' && val != '0'; int consp = column - start; - String tip = (hasConservation && consp > -1 && consp < consSymbs.length) ? consSymbs[consp] + String tip = (hasConservation && consp > -1 && consp < consSymbs.length) + ? consSymbs[consp] : ""; return tip; } diff --git a/src/jalview/analysis/CrossRef.java b/src/jalview/analysis/CrossRef.java index 4ba7e41..1a56393 100644 --- a/src/jalview/analysis/CrossRef.java +++ b/src/jalview/analysis/CrossRef.java @@ -164,8 +164,8 @@ public class CrossRef */ for (SequenceI rs : foundSeqs) { - DBRefEntry[] xrs = DBRefUtils - .selectDbRefs(!fromDna, rs.getDBRefs()); + DBRefEntry[] xrs = DBRefUtils.selectDbRefs(!fromDna, + rs.getDBRefs()); addXrefsToSources(xrs, sources); } } @@ -230,8 +230,8 @@ public class CrossRef dss = dss.getDatasetSequence(); } boolean found = false; - DBRefEntry[] xrfs = DBRefUtils - .selectDbRefs(!fromDna, dss.getDBRefs()); + DBRefEntry[] xrfs = DBRefUtils.selectDbRefs(!fromDna, + dss.getDBRefs()); // ENST & ENSP comes in to both Protein and nucleotide, so we need to // filter them // out later. @@ -291,13 +291,10 @@ public class CrossRef if (matchInDataset != null && xref.getMap().getTo() != null && matchInDataset != xref.getMap().getTo()) { - System.err - .println("Implementation problem (reopen JAL-2154): CrossRef.findInDataset seems to have recovered a different sequence than the one explicitly mapped for xref." - + "Found:" - + matchInDataset - + "\nExpected:" - + xref.getMap().getTo() - + "\nFor xref:" + System.err.println( + "Implementation problem (reopen JAL-2154): CrossRef.findInDataset seems to have recovered a different sequence than the one explicitly mapped for xref." + + "Found:" + matchInDataset + "\nExpected:" + + xref.getMap().getTo() + "\nFor xref:" + xref); } /*matcher.findIdMatch(mappedTo);*/ @@ -323,8 +320,9 @@ public class CrossRef } else { - cf.addMap(matchInDataset, dss, xref.getMap().getMap() - .getInverse(), xref.getMap().getMappedFromId()); + cf.addMap(matchInDataset, dss, + xref.getMap().getMap().getInverse(), + xref.getMap().getMappedFromId()); } } @@ -340,8 +338,8 @@ public class CrossRef if (fromDna) { // map is from dna seq to a protein product - cf.addMap(dss, rsq, xref.getMap().getMap(), xref.getMap() - .getMappedFromId()); + cf.addMap(dss, rsq, xref.getMap().getMap(), + xref.getMap().getMappedFromId()); } else { @@ -355,8 +353,8 @@ public class CrossRef if (!found) { - SequenceI matchedSeq = matcher.findIdMatch(xref.getSource() + "|" - + xref.getAccessionId()); + SequenceI matchedSeq = matcher.findIdMatch( + xref.getSource() + "|" + xref.getAccessionId()); // if there was a match, check it's at least the right type of // molecule! if (matchedSeq != null && matchedSeq.isProtein() == fromDna) @@ -406,8 +404,8 @@ public class CrossRef { ASequenceFetcher sftch = SequenceFetcherFactory.getSequenceFetcher(); SequenceI[] retrieved = null; - SequenceI dss = seq.getDatasetSequence() == null ? seq : seq - .getDatasetSequence(); + SequenceI dss = seq.getDatasetSequence() == null ? seq + : seq.getDatasetSequence(); // first filter in case we are retrieving crossrefs that have already been // retrieved. this happens for cases where a database record doesn't yield // protein products for CDS @@ -423,8 +421,8 @@ public class CrossRef retrieved = sftch.getSequences(sourceRefs, !fromDna); } catch (Exception e) { - System.err - .println("Problem whilst retrieving cross references for Sequence : " + System.err.println( + "Problem whilst retrieving cross references for Sequence : " + seq.getName()); e.printStackTrace(); } @@ -432,14 +430,16 @@ public class CrossRef if (retrieved != null) { boolean addedXref = false; - List newDsSeqs = new ArrayList(), doNotAdd = new ArrayList(); + List newDsSeqs = new ArrayList(), + doNotAdd = new ArrayList(); for (SequenceI retrievedSequence : retrieved) { // dataset gets contaminated ccwith non-ds sequences. why ??! // try: Ensembl -> Nuc->Ensembl, Nuc->Uniprot-->Protein->EMBL-> - SequenceI retrievedDss = retrievedSequence.getDatasetSequence() == null ? retrievedSequence - : retrievedSequence.getDatasetSequence(); + SequenceI retrievedDss = retrievedSequence + .getDatasetSequence() == null ? retrievedSequence + : retrievedSequence.getDatasetSequence(); addedXref |= importCrossRefSeq(cf, newDsSeqs, doNotAdd, dss, retrievedDss); } @@ -452,8 +452,9 @@ public class CrossRef { // dataset gets contaminated ccwith non-ds sequences. why ??! // try: Ensembl -> Nuc->Ensembl, Nuc->Uniprot-->Protein->EMBL-> - SequenceI retrievedDss = retrievedSequence.getDatasetSequence() == null ? retrievedSequence - : retrievedSequence.getDatasetSequence(); + SequenceI retrievedDss = retrievedSequence + .getDatasetSequence() == null ? retrievedSequence + : retrievedSequence.getDatasetSequence(); addedXref |= importCrossRefSeq(cf, newDsSeqs, doNotAdd, dss, retrievedDss); } @@ -577,9 +578,8 @@ public class CrossRef int sf = map.getMap().getToLowest(); int st = map.getMap().getToHighest(); SequenceI mappedrg = ms.getSubSequence(sf, st); - if (mappedrg.getLength() > 0 - && ms.getSequenceAsString().equals( - matched.getSequenceAsString())) + if (mappedrg.getLength() > 0 && ms.getSequenceAsString() + .equals(matched.getSequenceAsString())) { /* * sequences were a match, @@ -597,8 +597,8 @@ public class CrossRef */ for (DBRefEntry ref : toRefs) { - if (dbref.getSrcAccString().equals( - ref.getSrcAccString())) + if (dbref.getSrcAccString() + .equals(ref.getSrcAccString())) { continue; // avoid overwriting the ref on source sequence } @@ -645,8 +645,8 @@ public class CrossRef cf.addMap(retrievedSequence, map.getTo(), map.getMap()); } catch (Exception e) { - System.err - .println("Exception when consolidating Mapped sequence set..."); + System.err.println( + "Exception when consolidating Mapped sequence set..."); e.printStackTrace(System.err); } } @@ -725,8 +725,8 @@ public class CrossRef SequenceI mapsTo = xref.getMap().getTo(); String name = xref.getAccessionId(); String name2 = xref.getSource() + "|" + name; - SequenceI dss = mapsTo.getDatasetSequence() == null ? mapsTo : mapsTo - .getDatasetSequence(); + SequenceI dss = mapsTo.getDatasetSequence() == null ? mapsTo + : mapsTo.getDatasetSequence(); // first check ds if ds is directly referenced if (dataset.findIndex(dss) > -1) { @@ -741,8 +741,8 @@ public class CrossRef for (SequenceI seq : dataset.getSequences()) { // first check primary refs. - List match = DBRefUtils.searchRefs(seq.getPrimaryDBRefs() - .toArray(new DBRefEntry[0]), template); + List match = DBRefUtils.searchRefs( + seq.getPrimaryDBRefs().toArray(new DBRefEntry[0]), template); if (match != null && match.size() == 1 && sameSequence(seq, dss)) { return seq; @@ -752,9 +752,8 @@ public class CrossRef * returns sequences with a dbref to the matched accession id * which we don't want */ - if (firstIdMatch == null - && (name.equals(seq.getName()) || seq.getName().startsWith( - name2))) + if (firstIdMatch == null && (name.equals(seq.getName()) + || seq.getName().startsWith(name2))) { if (sameSequence(seq, dss)) { @@ -865,8 +864,8 @@ public class CrossRef MapList mapping = null; SequenceI dsmapFrom = mapFrom.getDatasetSequence() == null ? mapFrom : mapFrom.getDatasetSequence(); - SequenceI dsmapTo = mapTo.getDatasetSequence() == null ? mapTo : mapTo - .getDatasetSequence(); + SequenceI dsmapTo = mapTo.getDatasetSequence() == null ? mapTo + : mapTo.getDatasetSequence(); /* * look for a reverse mapping, if found make its inverse. * Note - we do this on dataset sequences only. @@ -950,7 +949,8 @@ public class CrossRef * @return true if matches were found. */ private boolean searchDatasetXrefs(boolean fromDna, SequenceI sequenceI, - DBRefEntry[] lrfs, List foundSeqs, AlignedCodonFrame cf) + DBRefEntry[] lrfs, List foundSeqs, + AlignedCodonFrame cf) { boolean found = false; if (lrfs == null) @@ -963,7 +963,8 @@ public class CrossRef // add in wildcards xref.setVersion(null); xref.setMap(null); - found |= searchDataset(fromDna, sequenceI, xref, foundSeqs, cf, false); + found |= searchDataset(fromDna, sequenceI, xref, foundSeqs, cf, + false); } return found; } @@ -1019,10 +1020,9 @@ public class CrossRef { if (nxt.getDatasetSequence() != null) { - System.err - .println("Implementation warning: CrossRef initialised with a dataset alignment with non-dataset sequences in it! (" - + nxt.getDisplayId(true) - + " has ds reference " + System.err.println( + "Implementation warning: CrossRef initialised with a dataset alignment with non-dataset sequences in it! (" + + nxt.getDisplayId(true) + " has ds reference " + nxt.getDatasetSequence().getDisplayId(true) + ")"); } diff --git a/src/jalview/analysis/Dna.java b/src/jalview/analysis/Dna.java index 799a8ed..0128624 100644 --- a/src/jalview/analysis/Dna.java +++ b/src/jalview/analysis/Dna.java @@ -120,7 +120,8 @@ public class Dna * @param ac2 * @return */ - public static final int compareCodonPos(AlignedCodon ac1, AlignedCodon ac2) + public static final int compareCodonPos(AlignedCodon ac1, + AlignedCodon ac2) { return comparator.compare(ac1, ac2); // return jalview_2_8_2compare(ac1, ac2); @@ -134,7 +135,8 @@ public class Dna * @param ac2 * @return */ - private static int jalview_2_8_2compare(AlignedCodon ac1, AlignedCodon ac2) + private static int jalview_2_8_2compare(AlignedCodon ac1, + AlignedCodon ac2) { if (ac1 == null || ac2 == null || (ac1.equals(ac2))) { @@ -435,7 +437,8 @@ public class Dna /* * Filled up a reading frame... */ - AlignedCodon alignedCodon = new AlignedCodon(cdp[0], cdp[1], cdp[2]); + AlignedCodon alignedCodon = new AlignedCodon(cdp[0], cdp[1], + cdp[2]); String aa = ResidueProperties.codonTranslate(new String(codon)); rf = 0; final String gapString = String.valueOf(gapChar); @@ -444,10 +447,11 @@ public class Dna aa = gapString; if (skipint == null) { - skipint = new int[] { alignedCodon.pos1, alignedCodon.pos3 /* - * cdp[0], - * cdp[2] - */}; + skipint = new int[] { alignedCodon.pos1, + alignedCodon.pos3 /* + * cdp[0], + * cdp[2] + */ }; } skipint[1] = alignedCodon.pos3; // cdp[2]; } @@ -502,8 +506,8 @@ public class Dna } if (vc + 2 < t.length) { - System.arraycopy(scontigs, vc + 2, t, vc, t.length - - vc + 2); + System.arraycopy(scontigs, vc + 2, t, vc, + t.length - vc + 2); } scontigs = t; } @@ -596,9 +600,9 @@ public class Dna } else if (!alignedCodons[aspos].equals(alignedCodon)) { - throw new IllegalStateException("Tried to coalign " - + alignedCodons[aspos].toString() + " with " - + alignedCodon.toString()); + throw new IllegalStateException( + "Tried to coalign " + alignedCodons[aspos].toString() + + " with " + alignedCodon.toString()); } if (aspos >= aaWidth) { @@ -790,8 +794,8 @@ public class Dna { for (SequenceFeature sf : sfs) { - fgstate = (featureGroups == null) ? null : featureGroups - .get(sf.featureGroup); + fgstate = (featureGroups == null) ? null + : featureGroups.get(sf.featureGroup); if ((featureTypes == null || featureTypes.containsKey(sf.getType())) && (fgstate == null || fgstate.booleanValue())) { diff --git a/src/jalview/analysis/Finder.java b/src/jalview/analysis/Finder.java index 25ee7d2..191f6e8 100644 --- a/src/jalview/analysis/Finder.java +++ b/src/jalview/analysis/Finder.java @@ -207,9 +207,8 @@ public class Finder { resIndex = regex.matchedFrom(); - if ((selection != null && selection.getSize() > 0) - && (resIndex + spaces.get(resIndex) < selection - .getStartRes())) + if ((selection != null && selection.getSize() > 0) && (resIndex + + spaces.get(resIndex) < selection.getStartRes())) { continue; } @@ -218,9 +217,9 @@ public class Finder int eres = seq.findPosition(regex.matchedTo() - 1 + (spaces.get(regex.matchedTo() - 1))); // only add result if not contained in previous result - if (lastm == null - || (lastm.getSequence() != seq || (!(lastm.getStart() <= sres && lastm - .getEnd() >= eres)))) + if (lastm == null || (lastm.getSequence() != seq + || (!(lastm.getStart() <= sres + && lastm.getEnd() >= eres)))) { lastm = searchResults.addResult(seq, sres, eres); } diff --git a/src/jalview/analysis/Grouping.java b/src/jalview/analysis/Grouping.java index 2ddd015..066814e 100644 --- a/src/jalview/analysis/Grouping.java +++ b/src/jalview/analysis/Grouping.java @@ -91,8 +91,8 @@ public class Grouping i = 0; for (String key : gps.keySet()) { - SequenceGroup group = new SequenceGroup(gps.get(key), "Subseq: " - + key, null, true, true, false, 0, width - 1); + SequenceGroup group = new SequenceGroup(gps.get(key), + "Subseq: " + key, null, true, true, false, 0, width - 1); groups[i++] = group; } @@ -178,8 +178,8 @@ public class Grouping i = 0; for (String key : gps.keySet()) { - SequenceGroup group = new SequenceGroup(gps.get(key), "Subseq: " - + key, null, true, true, false, 0, width - 1); + SequenceGroup group = new SequenceGroup(gps.get(key), + "Subseq: " + key, null, true, true, false, 0, width - 1); groups[i++] = group; } diff --git a/src/jalview/analysis/NJTree.java b/src/jalview/analysis/NJTree.java index 487e85e..522c2b1 100644 --- a/src/jalview/analysis/NJTree.java +++ b/src/jalview/analysis/NJTree.java @@ -108,25 +108,25 @@ public class NJTree extends TreeBuilder * @param j */ @Override - protected - void findClusterDistance(int i, int j) + protected void findClusterDistance(int i, int j) { // New distances from cluster i to others double[] newdist = new double[noseqs]; - + double ijDistance = distances.getValue(i, j); for (int l = 0; l < noseqs; l++) { if ((l != i) && (l != j)) { - newdist[l] = (distances.getValue(i, l) + distances.getValue(j, l) - ijDistance) / 2; + newdist[l] = (distances.getValue(i, l) + distances.getValue(j, l) + - ijDistance) / 2; } else { newdist[l] = 0; } } - + for (int ii = 0; ii < noseqs; ii++) { distances.setValue(i, ii, newdist[ii]); diff --git a/src/jalview/analysis/PCA.java b/src/jalview/analysis/PCA.java index 3ec7995..42a168d 100755 --- a/src/jalview/analysis/PCA.java +++ b/src/jalview/analysis/PCA.java @@ -43,7 +43,7 @@ public class PCA implements Runnable final private AlignmentView seqs; private ScoreModelI scoreModel; - + private SimilarityParamsI similarityParams; public PCA(AlignmentView s, ScoreModelI sm, SimilarityParamsI options) @@ -51,7 +51,7 @@ public class PCA implements Runnable this.seqs = s; this.similarityParams = options; this.scoreModel = sm; - + details.append("PCA calculation using " + sm.getName() + " sequence similarity matrix\n========\n\n"); } @@ -193,7 +193,8 @@ public class PCA implements Runnable q.printStackTrace(); details.append("\n*** Unexpected exception when performing PCA ***\n" + q.getLocalizedMessage()); - details.append("*** Matrices below may not be fully diagonalised. ***\n"); + details.append( + "*** Matrices below may not be fully diagonalised. ***\n"); } details.append(" --- New diagonalization matrix ---\n"); diff --git a/src/jalview/analysis/ParseProperties.java b/src/jalview/analysis/ParseProperties.java index eb639b6..629a8a3 100644 --- a/src/jalview/analysis/ParseProperties.java +++ b/src/jalview/analysis/ParseProperties.java @@ -58,7 +58,8 @@ public class ParseProperties String ScoreDescriptions, String regex, boolean repeat) { return getScoresFromDescription(new String[] { ScoreName }, - new String[] { ScoreDescriptions }, regex, repeat); + new String[] + { ScoreDescriptions }, regex, repeat); } public int getScoresFromDescription(String[] ScoreNames, @@ -85,9 +86,8 @@ public class ParseProperties * description string of each sequence * @return total number of sequences that matched the regex */ - public int getScoresFromDescription(SequenceI[] seqs, - String[] ScoreNames, String[] ScoreDescriptions, String regex, - boolean repeat) + public int getScoresFromDescription(SequenceI[] seqs, String[] ScoreNames, + String[] ScoreDescriptions, String regex, boolean repeat) { int count = 0; Regex pattern = new Regex(regex); @@ -141,8 +141,8 @@ public class ParseProperties continue; } // add score to sequence annotation. - AlignmentAnnotation an = new AlignmentAnnotation(ScoreNames[cols] - + ((reps > 0) ? "_" + reps : ""), + AlignmentAnnotation an = new AlignmentAnnotation( + ScoreNames[cols] + ((reps > 0) ? "_" + reps : ""), ScoreDescriptions[cols], null); an.setScore(score); System.out.println(seqs[i].getName() + " score: '" diff --git a/src/jalview/analysis/Rna.java b/src/jalview/analysis/Rna.java index 89c5c30..94544e7 100644 --- a/src/jalview/analysis/Rna.java +++ b/src/jalview/analysis/Rna.java @@ -48,7 +48,8 @@ public class Rna */ public static boolean isOpeningParenthesis(char c) { - return ('A' <= c && c <= 'Z' || c == '(' || c == '[' || c == '{' || c == '<'); + return ('A' <= c && c <= 'Z' || c == '(' || c == '[' || c == '{' + || c == '<'); } /** @@ -73,7 +74,8 @@ public class Rna */ public static boolean isClosingParenthesis(char c) { - return ('a' <= c && c <= 'z' || c == ')' || c == ']' || c == '}' || c == '>'); + return ('a' <= c && c <= 'z' || c == ')' || c == ']' || c == '}' + || c == '>'); } /** @@ -159,8 +161,8 @@ public class Rna if (!stacks.containsKey(opening)) { throw new WUSSParseException(MessageManager.formatMessage( - "exception.mismatched_unseen_closing_char", - new String[] { String.valueOf(base) }), i); + "exception.mismatched_unseen_closing_char", new String[] + { String.valueOf(base) }), i); } Stack stack = stacks.get(opening); @@ -168,8 +170,8 @@ public class Rna { // error whilst parsing i'th position. pass back throw new WUSSParseException(MessageManager.formatMessage( - "exception.mismatched_closing_char", - new String[] { String.valueOf(base) }), i); + "exception.mismatched_closing_char", new String[] + { String.valueOf(base) }), i); } int temp = stack.pop(); @@ -187,9 +189,9 @@ public class Rna * i (length of input string) */ throw new WUSSParseException(MessageManager.formatMessage( - "exception.mismatched_opening_char", - new String[] { String.valueOf(opening), - String.valueOf(stack.pop()) }), i); + "exception.mismatched_opening_char", new String[] + { String.valueOf(opening), String.valueOf(stack.pop()) }), + i); } } return pairs; diff --git a/src/jalview/analysis/SecStrConsensus.java b/src/jalview/analysis/SecStrConsensus.java index 3e007c4..05c20a0 100644 --- a/src/jalview/analysis/SecStrConsensus.java +++ b/src/jalview/analysis/SecStrConsensus.java @@ -179,8 +179,8 @@ public class SecStrConsensus { fact2 = tab[k + 1][j]; } - tab[i][j] = Math.max(tab[i][j], basePairScore(seq, i, k) - + fact1 + fact2); + tab[i][j] = Math.max(tab[i][j], + basePairScore(seq, i, k) + fact1 + fact2); } } } diff --git a/src/jalview/analysis/SeqsetUtils.java b/src/jalview/analysis/SeqsetUtils.java index 21ad1cc..2b21e5e 100755 --- a/src/jalview/analysis/SeqsetUtils.java +++ b/src/jalview/analysis/SeqsetUtils.java @@ -131,14 +131,13 @@ public class SeqsetUtils { sq.setDescription(description); } - if ((seqds != null) - && !(seqds.getName().equals("THISISAPLACEHOLDER") && seqds - .getLength() == 0)) + if ((seqds != null) && !(seqds.getName().equals("THISISAPLACEHOLDER") + && seqds.getLength() == 0)) { if (sfeatures != null) { - System.err - .println("Implementation error: setting dataset sequence for a sequence which has sequence features.\n\tDataset sequence features will not be visible."); + System.err.println( + "Implementation error: setting dataset sequence for a sequence which has sequence features.\n\tDataset sequence features will not be visible."); } sq.setDatasetSequence(seqds); } @@ -261,8 +260,9 @@ public class SeqsetUtils if (unmatched.size() > 0 && !quiet) { System.err.println("Did not find matches for :"); - for (Enumeration i = unmatched.elements(); i.hasMoreElements(); System.out - .println(((SequenceI) i.nextElement()).getName())) + for (Enumeration i = unmatched.elements(); i + .hasMoreElements(); System.out + .println(((SequenceI) i.nextElement()).getName())) { ; } diff --git a/src/jalview/analysis/SequenceIdMatcher.java b/src/jalview/analysis/SequenceIdMatcher.java index c12de4e..3d4cbe7 100755 --- a/src/jalview/analysis/SequenceIdMatcher.java +++ b/src/jalview/analysis/SequenceIdMatcher.java @@ -147,9 +147,8 @@ public class SequenceIdMatcher names.put(new SeqIdName(cand.getName()), cand); int q, w, candlen = cand.getName().length(); // keep the one with an id 'closer' to the given seqnam string - if ((q = Math.abs(matchlen - namlen)) > (w = Math.abs(candlen - - namlen)) - && candlen > matchlen) + if ((q = Math.abs(matchlen - namlen)) > (w = Math + .abs(candlen - namlen)) && candlen > matchlen) { best.clear(); match = cand; @@ -301,8 +300,8 @@ public class SequenceIdMatcher @Override public int hashCode() { - return ((id.length() >= 4) ? id.substring(0, 4).hashCode() : id - .hashCode()); + return ((id.length() >= 4) ? id.substring(0, 4).hashCode() + : id.hashCode()); } @Override @@ -348,13 +347,16 @@ public class SequenceIdMatcher { if (id.length() > s.length()) { - return id.startsWith(s) ? (WORD_SEP.indexOf(id.charAt(s.length())) > -1) + return id.startsWith(s) + ? (WORD_SEP.indexOf(id.charAt(s.length())) > -1) : false; } else { - return s.startsWith(id) ? (s.equals(id) ? true : (WORD_SEP - .indexOf(s.charAt(id.length())) > -1)) : false; + return s.startsWith(id) + ? (s.equals(id) ? true + : (WORD_SEP.indexOf(s.charAt(id.length())) > -1)) + : false; } } diff --git a/src/jalview/analysis/StructureFrequency.java b/src/jalview/analysis/StructureFrequency.java index 7b0858d..b681aa6 100644 --- a/src/jalview/analysis/StructureFrequency.java +++ b/src/jalview/analysis/StructureFrequency.java @@ -149,8 +149,8 @@ public class StructureFrequency { if (sequences[j] == null) { - System.err - .println("WARNING: Consensus skipping null sequence - possible race condition."); + System.err.println( + "WARNING: Consensus skipping null sequence - possible race condition."); continue; } @@ -195,8 +195,9 @@ public class StructureFrequency if (profile) { // TODO 1-dim array with jsize in [0], nongapped in [1]; or Pojo - residueHash.put(PROFILE, new int[][] { values, - new int[] { jSize, (jSize - values['-']) } }); + residueHash.put(PROFILE, + new int[][] + { values, new int[] { jSize, (jSize - values['-']) } }); residueHash.put(PAIRPROFILE, pairs); } @@ -217,7 +218,8 @@ public class StructureFrequency { if (canonicalOrWobblePairCount >= otherPairCount) { - maxResidue = (canonicalOrWobblePairCount - canonical) < canonical ? "(" + maxResidue = (canonicalOrWobblePairCount - canonical) < canonical + ? "(" : "["; } else @@ -252,8 +254,9 @@ public class StructureFrequency residueHash = new Hashtable(); if (profile) { - residueHash.put(PROFILE, new int[][] { values, - new int[] { jSize, (jSize - values['-']) } }); + residueHash.put(PROFILE, + new int[][] + { values, new int[] { jSize, (jSize - values['-']) } }); residueHash.put(PAIRPROFILE, pairs); } @@ -444,7 +447,8 @@ public class StructureFrequency int valuesCount = 0; rtnval[1] = 0; int offset = 2; - final int divisor = profile[1][ignoreGapsInConsensusCalculation ? 1 : 0]; + final int divisor = profile[1][ignoreGapsInConsensusCalculation ? 1 + : 0]; for (int c = 624; c > 0; c--) { if (vl[c] > 0) diff --git a/src/jalview/analysis/TreeBuilder.java b/src/jalview/analysis/TreeBuilder.java index effef9a..b290428 100644 --- a/src/jalview/analysis/TreeBuilder.java +++ b/src/jalview/analysis/TreeBuilder.java @@ -79,8 +79,8 @@ public abstract class TreeBuilder { start = av.getSelectionGroup().getStartRes(); end = av.getSelectionGroup().getEndRes() + 1; - this.sequences = av.getSelectionGroup().getSequencesInOrder( - av.getAlignment()); + this.sequences = av.getSelectionGroup() + .getSequencesInOrder(av.getAlignment()); } init(seqStrings, start, end); @@ -107,11 +107,11 @@ public abstract class TreeBuilder { return maxheight; } - + if ((nd.left() == null) && (nd.right() == null)) { nd.height = ((SequenceNode) nd.parent()).height + nd.dist; - + if (nd.height > maxheight) { return nd.height; @@ -132,11 +132,11 @@ public abstract class TreeBuilder maxheight = 0; nd.height = (float) 0.0; } - + maxheight = findHeight((SequenceNode) (nd.left())); maxheight = findHeight((SequenceNode) (nd.right())); } - + return maxheight; } @@ -164,23 +164,24 @@ public abstract class TreeBuilder { // if (_lycount<_lylimit) // { - // System.err.println("Warning: depth of _recount greater than number of nodes."); + // System.err.println("Warning: depth of _recount greater than number of + // nodes."); // } if (nd == null) { return; } // _lycount++; - + if ((nd.left() != null) && (nd.right() != null)) { - + _reCount((SequenceNode) nd.left()); _reCount((SequenceNode) nd.right()); - + SequenceNode l = (SequenceNode) nd.left(); SequenceNode r = (SequenceNode) nd.right(); - + nd.count = l.count + r.count; nd.ycount = (l.ycount + r.ycount) / 2; } @@ -234,18 +235,18 @@ public abstract class TreeBuilder while (noClus > 2) { findMinDistance(); - + joinClusters(mini, minj); - + noClus--; } - + int rightChild = done.nextClearBit(0); int leftChild = done.nextClearBit(rightChild + 1); - + joinClusters(leftChild, rightChild); top = (node.elementAt(leftChild)); - + reCount(top); findHeight(top); findMaxDist(top); @@ -275,11 +276,11 @@ public abstract class TreeBuilder protected void computeTree(ScoreModelI sm, SimilarityParamsI scoreOptions) { distances = sm.findDistances(seqData, scoreOptions); - + makeLeaves(); - + noClus = clusters.size(); - + cluster(); } @@ -295,11 +296,11 @@ public abstract class TreeBuilder { return; } - + if ((nd.left() == null) && (nd.right() == null)) { double dist = nd.dist; - + if (dist > maxDistValue) { maxdist = nd; @@ -324,7 +325,7 @@ public abstract class TreeBuilder protected double findr(int i, int j) { double tmp = 1; - + for (int k = 0; k < noseqs; k++) { if ((k != i) && (k != j) && (!done.get(k))) @@ -332,12 +333,12 @@ public abstract class TreeBuilder tmp = tmp + distances.getValue(i, k); } } - + if (noClus > 2) { tmp = tmp / (noClus - 2); } - + return tmp; } @@ -359,14 +360,14 @@ public abstract class TreeBuilder sdata.addOperation(CigarArray.M, end - start + 1); this.seqData = new AlignmentView(sdata, start); } - + /* * count the non-null sequences */ noseqs = 0; - + done = new BitSet(); - + for (SequenceI seq : sequences) { if (seq != null) @@ -385,27 +386,27 @@ public abstract class TreeBuilder void joinClusters(final int i, final int j) { double dist = distances.getValue(i, j); - + ri = findr(i, j); rj = findr(j, i); - + findClusterDistance(i, j); - + SequenceNode sn = new SequenceNode(); - + sn.setLeft((node.elementAt(i))); sn.setRight((node.elementAt(j))); - + SequenceNode tmpi = (node.elementAt(i)); SequenceNode tmpj = (node.elementAt(j)); - + findNewDistances(tmpi, tmpj, dist); - + tmpi.setParent(sn); tmpj.setParent(sn); - + node.setElementAt(sn, i); - + /* * move the members of cluster(j) to cluster(i) * and mark cluster j as out of the game @@ -438,11 +439,11 @@ public abstract class TreeBuilder void makeLeaves() { clusters = new Vector(); - + for (int i = 0; i < noseqs; i++) { SequenceNode sn = new SequenceNode(); - + sn.setElement(sequences[i]); sn.setName(sequences[i].getName()); node.addElement(sn); diff --git a/src/jalview/analysis/TreeModel.java b/src/jalview/analysis/TreeModel.java index 5a41802..a50634e 100644 --- a/src/jalview/analysis/TreeModel.java +++ b/src/jalview/analysis/TreeModel.java @@ -77,10 +77,11 @@ public class TreeModel * @param treefile * NewickFile */ - public TreeModel(SequenceI[] seqs, AlignmentView odata, NewickFile treefile) + public TreeModel(SequenceI[] seqs, AlignmentView odata, + NewickFile treefile) { - this(seqs, treefile.getTree(), treefile.HasDistances(), treefile - .HasBootstrap(), treefile.HasRootDistance()); + this(seqs, treefile.getTree(), treefile.HasDistances(), + treefile.HasBootstrap(), treefile.HasRootDistance()); seqData = odata; associateLeavesToSequences(seqs); @@ -93,8 +94,8 @@ public class TreeModel */ public TreeModel(TreeBuilder tree) { - this(tree.getSequences(), tree.getTopNode(), tree.hasDistances(), tree - .hasBootstrap(), tree.hasRootDistance()); + this(tree.getSequences(), tree.getTopNode(), tree.hasDistances(), + tree.hasBootstrap(), tree.hasRootDistance()); seqData = tree.getOriginalData(); } @@ -187,8 +188,12 @@ public class TreeModel { NewickFile fout = new NewickFile(getTopNode()); - return fout.print(hasBootstrap(), hasDistances(), - hasRootDistance()); // output all data available for tree + return fout.print(hasBootstrap(), hasDistances(), hasRootDistance()); // output + // all + // data + // available + // for + // tree } /** @@ -248,8 +253,8 @@ public class TreeModel if (!leaf.isPlaceholder()) { // Construct a new placeholder sequence object for this leaf - leaf.setElement(new Sequence(leaf.getName(), - "THISISAPLACEHLDER")); + leaf.setElement( + new Sequence(leaf.getName(), "THISISAPLACEHLDER")); } leaf.setPlaceholder(true); @@ -478,8 +483,8 @@ public class TreeModel System.out.println(" name = " + ((SequenceI) nd.element()).getName()); } - System.out.println(" dist = " + nd.dist + " " + nd.count + " " - + nd.height); + System.out.println( + " dist = " + nd.dist + " " + nd.count + " " + nd.height); } /** @@ -508,7 +513,8 @@ public class TreeModel { // if (_lycount<_lylimit) // { - // System.err.println("Warning: depth of _recount greater than number of nodes."); + // System.err.println("Warning: depth of _recount greater than number of + // nodes."); // } if (nd == null) { @@ -659,8 +665,8 @@ public class TreeModel public void applyToNodes(NodeTransformI nodeTransformI) { for (Enumeration nodes = node.elements(); nodes - .hasMoreElements(); nodeTransformI.transform(nodes - .nextElement())) + .hasMoreElements(); nodeTransformI + .transform(nodes.nextElement())) { ; } diff --git a/src/jalview/analysis/scoremodels/FeatureDistanceModel.java b/src/jalview/analysis/scoremodels/FeatureDistanceModel.java index 056ecdb..c20d4f1 100644 --- a/src/jalview/analysis/scoremodels/FeatureDistanceModel.java +++ b/src/jalview/analysis/scoremodels/FeatureDistanceModel.java @@ -124,8 +124,8 @@ public class FeatureDistanceModel extends DistanceScoreModel /* * first record feature types in this column for each sequence */ - Map> sfap = findFeatureTypesAtColumn( - seqs, cpos); + Map> sfap = findFeatureTypesAtColumn(seqs, + cpos); /* * count feature types on either i'th or j'th sequence but not both diff --git a/src/jalview/analysis/scoremodels/PIDModel.java b/src/jalview/analysis/scoremodels/PIDModel.java index 721ba45..f4599e8 100644 --- a/src/jalview/analysis/scoremodels/PIDModel.java +++ b/src/jalview/analysis/scoremodels/PIDModel.java @@ -14,8 +14,8 @@ import jalview.util.Comparison; * Instances of this class are immutable and thread-safe, so the same object is * returned from calls to getInstance(). */ -public class PIDModel extends SimilarityScoreModel implements - PairwiseScoreModelI +public class PIDModel extends SimilarityScoreModel + implements PairwiseScoreModelI { private static final String NAME = "PID"; diff --git a/src/jalview/analysis/scoremodels/ScoreMatrix.java b/src/jalview/analysis/scoremodels/ScoreMatrix.java index efaeb43..6cdfacb 100644 --- a/src/jalview/analysis/scoremodels/ScoreMatrix.java +++ b/src/jalview/analysis/scoremodels/ScoreMatrix.java @@ -36,8 +36,8 @@ import java.util.Arrays; * symbols. Instances of this class are immutable and thread-safe, so the same * object is returned from calls to getInstance(). */ -public class ScoreMatrix extends SimilarityScoreModel implements - PairwiseScoreModelI +public class ScoreMatrix extends SimilarityScoreModel + implements PairwiseScoreModelI { private static final char GAP_CHARACTER = Comparison.GAP_DASH; @@ -98,7 +98,7 @@ public class ScoreMatrix extends SimilarityScoreModel implements private float minValue; private float maxValue; - + /** * Constructor given a name, symbol alphabet, and matrix of scores for pairs * of symbols. The matrix should be square and of the same size as the @@ -130,8 +130,8 @@ public class ScoreMatrix extends SimilarityScoreModel implements * @param values * Pairwise scores indexed according to the symbol alphabet */ - public ScoreMatrix(String theName, String theDescription, - char[] alphabet, float[][] values) + public ScoreMatrix(String theName, String theDescription, char[] alphabet, + float[][] values) { if (alphabet.length != values.length) { @@ -454,7 +454,8 @@ public class ScoreMatrix extends SimilarityScoreModel implements * @param params * @return */ - protected MatrixI findSimilarities(String[] seqs, SimilarityParamsI params) + protected MatrixI findSimilarities(String[] seqs, + SimilarityParamsI params) { double[][] values = new double[seqs.length][]; for (int row = 0; row < seqs.length; row++) diff --git a/src/jalview/analysis/scoremodels/ScoreModels.java b/src/jalview/analysis/scoremodels/ScoreModels.java index 654136a..ea7b30e 100644 --- a/src/jalview/analysis/scoremodels/ScoreModels.java +++ b/src/jalview/analysis/scoremodels/ScoreModels.java @@ -68,14 +68,15 @@ public class ScoreModels /* * delegate parsing to ScoreMatrixFile */ - FileParse fp = new FileParse(resourcePath, DataSourceType.CLASSLOADER); + FileParse fp = new FileParse(resourcePath, + DataSourceType.CLASSLOADER); ScoreMatrix sm = new ScoreMatrixFile(fp).parseMatrix(); registerScoreModel(sm); return sm; } catch (IOException e) { - System.err.println("Error reading " + resourcePath + ": " - + e.getMessage()); + System.err.println( + "Error reading " + resourcePath + ": " + e.getMessage()); } return null; } diff --git a/src/jalview/analysis/scoremodels/SimilarityParams.java b/src/jalview/analysis/scoremodels/SimilarityParams.java index e5751ca..4d8c3fc 100644 --- a/src/jalview/analysis/scoremodels/SimilarityParams.java +++ b/src/jalview/analysis/scoremodels/SimilarityParams.java @@ -20,8 +20,8 @@ public class SimilarityParams implements SimilarityParamsI * Based on Jalview's Comparison.PID method, which includes gaps and counts * them as matching; it counts over the length of the shorter sequence */ - public static final SimilarityParamsI Jalview = new SimilarityParams( - true, true, true, true); + public static final SimilarityParamsI Jalview = new SimilarityParams(true, + true, true, true); /** * 'SeqSpace' mode PCA calculation includes gaps but does not count them as diff --git a/src/jalview/analysis/scoremodels/SmithWatermanModel.java b/src/jalview/analysis/scoremodels/SmithWatermanModel.java index f88101f..ca6d279 100644 --- a/src/jalview/analysis/scoremodels/SmithWatermanModel.java +++ b/src/jalview/analysis/scoremodels/SmithWatermanModel.java @@ -51,8 +51,8 @@ public class SmithWatermanModel extends SimilarityScoreModel public MatrixI findSimilarities(AlignmentView seqData, SimilarityParamsI options) { - SequenceI[] sequenceString = seqData.getVisibleAlignment( - Comparison.GAP_SPACE).getSequencesArray(); + SequenceI[] sequenceString = seqData + .getVisibleAlignment(Comparison.GAP_SPACE).getSequencesArray(); int noseqs = sequenceString.length; double[][] distances = new double[noseqs][noseqs]; diff --git a/src/jalview/api/DBRefEntryI.java b/src/jalview/api/DBRefEntryI.java index 51c35c5..672d6b4 100644 --- a/src/jalview/api/DBRefEntryI.java +++ b/src/jalview/api/DBRefEntryI.java @@ -92,7 +92,8 @@ public interface DBRefEntryI public boolean updateFrom(DBRefEntryI otherEntry); /** - * Answers true if the ref looks like a primary (direct) database reference.
    + * Answers true if the ref looks like a primary (direct) database reference. + *
    * The only way a dbref's mappings can be fully verified is via the local * sequence frame, so rather than use isPrimaryCandidate directly, please use * SequenceI.getPrimaryDbRefs().
    diff --git a/src/jalview/api/analysis/ScoreModelI.java b/src/jalview/api/analysis/ScoreModelI.java index 7f138cd..1f81e63 100644 --- a/src/jalview/api/analysis/ScoreModelI.java +++ b/src/jalview/api/analysis/ScoreModelI.java @@ -65,7 +65,8 @@ public interface ScoreModelI * @param options * @return */ - MatrixI findSimilarities(AlignmentView seqData, SimilarityParamsI options); + MatrixI findSimilarities(AlignmentView seqData, + SimilarityParamsI options); /** * Returns a score model object configured for the given alignment view. diff --git a/src/jalview/appletgui/APopupMenu.java b/src/jalview/appletgui/APopupMenu.java index 86610a2..6fdb49c 100644 --- a/src/jalview/appletgui/APopupMenu.java +++ b/src/jalview/appletgui/APopupMenu.java @@ -76,8 +76,8 @@ import java.util.SortedMap; import java.util.TreeMap; import java.util.Vector; -public class APopupMenu extends java.awt.PopupMenu implements - ActionListener, ItemListener +public class APopupMenu extends java.awt.PopupMenu + implements ActionListener, ItemListener { Menu groupMenu = new Menu(); @@ -262,8 +262,9 @@ public class APopupMenu extends java.awt.PopupMenu implements purinePyrimidineColour.setEnabled(false); nucleotideColour.setEnabled(false); } - editGroupName.setLabel(MessageManager.formatMessage( - "label.name_param", new Object[] { sg.getName() })); + editGroupName.setLabel( + MessageManager.formatMessage("label.name_param", new Object[] + { sg.getName() })); showText.setState(sg.getDisplayText()); showColourText.setState(sg.getColourText()); showBoxes.setState(sg.getDisplayBoxes()); @@ -304,17 +305,18 @@ public class APopupMenu extends java.awt.PopupMenu implements seqMenu.setLabel(seq.getName()); if (seq == ap.av.getAlignment().getSeqrep()) { - makeReferenceSeq.setLabel(MessageManager - .getString("action.unmark_as_reference"));// Unmark - // representative"); + makeReferenceSeq.setLabel( + MessageManager.getString("action.unmark_as_reference"));// Unmark + // representative"); } else { - makeReferenceSeq.setLabel(MessageManager - .getString("action.set_as_reference")); // ); + makeReferenceSeq.setLabel( + MessageManager.getString("action.set_as_reference")); // ); } - repGroup.setLabel(MessageManager.formatMessage( - "label.represent_group_with", new Object[] { seq.getName() })); + repGroup.setLabel(MessageManager + .formatMessage("label.represent_group_with", new Object[] + { seq.getName() })); } else { @@ -446,8 +448,9 @@ public class APopupMenu extends java.awt.PopupMenu implements /* * First for the currently selected sequence (if there is one): */ - final List selectedSequence = (seq == null ? Collections - . emptyList() : Arrays.asList(seq)); + final List selectedSequence = (seq == null + ? Collections. emptyList() + : Arrays.asList(seq)); buildAnnotationTypesMenus(seqShowAnnotationsMenu, seqHideAnnotationsMenu, selectedSequence); configureReferenceAnnotationsMenu(seqAddReferenceAnnotations, @@ -456,9 +459,9 @@ public class APopupMenu extends java.awt.PopupMenu implements /* * and repeat for the current selection group (if there is one): */ - final List selectedGroup = (ap.av.getSelectionGroup() == null ? Collections - . emptyList() : ap.av.getSelectionGroup() - .getSequences()); + final List selectedGroup = (ap.av.getSelectionGroup() == null + ? Collections. emptyList() + : ap.av.getSelectionGroup().getSequences()); buildAnnotationTypesMenus(groupShowAnnotationsMenu, groupHideAnnotationsMenu, selectedGroup); configureReferenceAnnotationsMenu(groupAddReferenceAnnotations, @@ -485,8 +488,8 @@ public class APopupMenu extends java.awt.PopupMenu implements SortedMap tipEntries = new TreeMap(); final Map> candidates = new LinkedHashMap>(); AlignmentI al = this.ap.av.getAlignment(); - AlignmentUtils.findAddableReferenceAnnotations(forSequences, - tipEntries, candidates, al); + AlignmentUtils.findAddableReferenceAnnotations(forSequences, tipEntries, + candidates, al); if (!candidates.isEmpty()) { StringBuilder tooltip = new StringBuilder(64); @@ -751,9 +754,10 @@ public class APopupMenu extends java.awt.PopupMenu implements seq = sg.getSequenceAt(0); } - EditNameDialog dialog = new EditNameDialog(seq.getSequenceAsString( - sg.getStartRes(), sg.getEndRes() + 1), null, - "Edit Sequence ", null, + EditNameDialog dialog = new EditNameDialog( + seq.getSequenceAsString(sg.getStartRes(), + sg.getEndRes() + 1), + null, "Edit Sequence ", null, ap.alignFrame, "Edit Sequence", 500, 100, true); @@ -761,16 +765,16 @@ public class APopupMenu extends java.awt.PopupMenu implements { EditCommand editCommand = new EditCommand( MessageManager.getString("label.edit_sequences"), - Action.REPLACE, dialog.getName().replace(' ', - ap.av.getGapCharacter()), + Action.REPLACE, + dialog.getName().replace(' ', ap.av.getGapCharacter()), sg.getSequencesAsArray(ap.av.getHiddenRepSequences()), sg.getStartRes(), sg.getEndRes() + 1, ap.av.getAlignment()); ap.alignFrame.addHistoryItem(editCommand); - ap.av.firePropertyChange("alignment", null, ap.av.getAlignment() - .getSequences()); + ap.av.firePropertyChange("alignment", null, + ap.av.getAlignment().getSequences()); } } } @@ -807,8 +811,8 @@ public class APopupMenu extends java.awt.PopupMenu implements ap.alignFrame.addHistoryItem(caseCommand); - ap.av.firePropertyChange("alignment", null, ap.av.getAlignment() - .getSequences()); + ap.av.firePropertyChange("alignment", null, + ap.av.getAlignment().getSequences()); } } @@ -860,15 +864,15 @@ public class APopupMenu extends java.awt.PopupMenu implements Frame frame = new Frame(); frame.add(cap); - JalviewLite.addFrame(frame, MessageManager.formatMessage( - "label.selection_output_command", - new Object[] { e.getActionCommand() }), 600, 500); + JalviewLite.addFrame(frame, MessageManager + .formatMessage("label.selection_output_command", new Object[] + { e.getActionCommand() }), 600, 500); // JBPNote: getSelectionAsNewSequence behaviour has changed - this method // now returns a full copy of sequence data // TODO consider using getSequenceSelection instead here - FileFormatI fileFormat = FileFormats.getInstance().forName( - e.getActionCommand()); + FileFormatI fileFormat = FileFormats.getInstance() + .forName(e.getActionCommand()); cap.setText(new AppletFormatAdapter().formatSequences(fileFormat, ap.av.getShowJVSuffix(), ap, true)); @@ -892,25 +896,26 @@ public class APopupMenu extends java.awt.PopupMenu implements StringBuilder contents = new StringBuilder(128); for (SequenceI seq : sequences) { - contents.append(MessageManager.formatMessage( - "label.annotation_for_displayid", - new Object[] { seq.getDisplayId(true) })); + contents.append(MessageManager + .formatMessage("label.annotation_for_displayid", new Object[] + { seq.getDisplayId(true) })); new SequenceAnnotationReport(null).createSequenceAnnotationReport( - contents, - seq, - true, - true, - (ap.seqPanel.seqCanvas.fr != null) ? ap.seqPanel.seqCanvas.fr - .getMinMax() : null); + contents, seq, true, true, + (ap.seqPanel.seqCanvas.fr != null) + ? ap.seqPanel.seqCanvas.fr.getMinMax() + : null); contents.append("

    "); } Frame frame = new Frame(); frame.add(cap); - jalview.bin.JalviewLite.addFrame(frame, "Sequence Details for " - + (sequences.length == 1 ? sequences[0].getDisplayId(true) - : "Selection"), 600, 500); - cap.setText(MessageManager.formatMessage("label.html_content", - new Object[] { contents.toString() })); + jalview.bin.JalviewLite.addFrame(frame, + "Sequence Details for " + (sequences.length == 1 + ? sequences[0].getDisplayId(true) + : "Selection"), + 600, 500); + cap.setText( + MessageManager.formatMessage("label.html_content", new Object[] + { contents.toString() })); } void editName() @@ -942,21 +947,22 @@ public class APopupMenu extends java.awt.PopupMenu implements } else { - new MCview.AppletPDBViewer(entry, new SequenceI[] { seq }, null, - ap, DataSourceType.URL); + new MCview.AppletPDBViewer(entry, new SequenceI[] { seq }, null, ap, + DataSourceType.URL); } } else { - CutAndPasteTransfer cap = new CutAndPasteTransfer(true, ap.alignFrame); + CutAndPasteTransfer cap = new CutAndPasteTransfer(true, + ap.alignFrame); cap.setText(MessageManager.getString("label.paste_pdb_file")); cap.setPDBImport(seq); Frame frame = new Frame(); frame.add(cap); JalviewLite.addFrame(frame, MessageManager.formatMessage( - "label.paste_pdb_file_for_sequence", - new Object[] { seq.getName() }), 400, 300); + "label.paste_pdb_file_for_sequence", new Object[] + { seq.getName() }), 400, 300); } } @@ -966,12 +972,12 @@ public class APopupMenu extends java.awt.PopupMenu implements sequenceFeature.addActionListener(this); editGroupName.addActionListener(this); - unGroupMenuItem.setLabel(MessageManager - .getString("action.remove_group")); + unGroupMenuItem + .setLabel(MessageManager.getString("action.remove_group")); unGroupMenuItem.addActionListener(this); - createGroupMenuItem.setLabel(MessageManager - .getString("action.create_group")); + createGroupMenuItem + .setLabel(MessageManager.getString("action.create_group")); createGroupMenuItem.addActionListener(this); modifyPID.setEnabled(abovePIDColour.getState()); @@ -983,8 +989,8 @@ public class APopupMenu extends java.awt.PopupMenu implements sequenceName.addActionListener(this); sequenceDetails.addActionListener(this); selSeqDetails.addActionListener(this); - displayNonconserved.setLabel(MessageManager - .getString("label.show_non_conserved")); + displayNonconserved + .setLabel(MessageManager.getString("label.show_non_conserved")); displayNonconserved.setState(false); displayNonconserved.addItemListener(this); showText.setLabel(MessageManager.getString("action.text")); @@ -995,8 +1001,9 @@ public class APopupMenu extends java.awt.PopupMenu implements seqMenu.setLabel(MessageManager.getString("label.sequence")); pdb.setLabel(MessageManager.getString("label.view_pdb_structure")); hideSeqs.setLabel(MessageManager.getString("action.hide_sequences")); - repGroup.setLabel(MessageManager.formatMessage( - "label.represent_group_with", new Object[] { "" })); + repGroup.setLabel(MessageManager + .formatMessage("label.represent_group_with", new Object[] + { "" })); revealAll.setLabel(MessageManager.getString("action.reveal_all")); revealSeq.setLabel(MessageManager.getString("action.reveal_sequences")); menu1.setLabel(MessageManager.getString("label.group:")); @@ -1042,28 +1049,28 @@ public class APopupMenu extends java.awt.PopupMenu implements /* * setName allows setSelectedColour to do its thing */ - clustalColour.setLabel(MessageManager - .getString("label.colourScheme_clustal")); + clustalColour.setLabel( + MessageManager.getString("label.colourScheme_clustal")); clustalColour.setName(JalviewColourScheme.Clustal.toString()); clustalColour.addItemListener(this); - BLOSUM62Colour.setLabel(MessageManager - .getString("label.colourScheme_blosum62")); + BLOSUM62Colour.setLabel( + MessageManager.getString("label.colourScheme_blosum62")); BLOSUM62Colour.setName(JalviewColourScheme.Blosum62.toString()); BLOSUM62Colour.addItemListener(this); - PIDColour.setLabel(MessageManager - .getString("label.colourScheme_%_identity")); + PIDColour.setLabel( + MessageManager.getString("label.colourScheme_%_identity")); PIDColour.setName(JalviewColourScheme.PID.toString()); PIDColour.addItemListener(this); - zappoColour.setLabel(MessageManager - .getString("label.colourScheme_zappo")); + zappoColour + .setLabel(MessageManager.getString("label.colourScheme_zappo")); zappoColour.setName(JalviewColourScheme.Zappo.toString()); zappoColour.addItemListener(this); - taylorColour.setLabel(MessageManager - .getString("label.colourScheme_taylor")); + taylorColour.setLabel( + MessageManager.getString("label.colourScheme_taylor")); taylorColour.setName(JalviewColourScheme.Taylor.toString()); taylorColour.addItemListener(this); - hydrophobicityColour.setLabel(MessageManager - .getString("label.colourScheme_hydrophobic")); + hydrophobicityColour.setLabel( + MessageManager.getString("label.colourScheme_hydrophobic")); hydrophobicityColour .setName(JalviewColourScheme.Hydrophobic.toString()); hydrophobicityColour.addItemListener(this); @@ -1075,36 +1082,36 @@ public class APopupMenu extends java.awt.PopupMenu implements .getString("label.colourScheme_strand_propensity")); strandColour.setName(JalviewColourScheme.Strand.toString()); strandColour.addItemListener(this); - turnColour.setLabel(MessageManager - .getString("label.colourScheme_turn_propensity")); + turnColour.setLabel( + MessageManager.getString("label.colourScheme_turn_propensity")); turnColour.setName(JalviewColourScheme.Turn.toString()); turnColour.addItemListener(this); - buriedColour.setLabel(MessageManager - .getString("label.colourScheme_buried_index")); + buriedColour.setLabel( + MessageManager.getString("label.colourScheme_buried_index")); buriedColour.setName(JalviewColourScheme.Buried.toString()); buriedColour.addItemListener(this); - nucleotideColour.setLabel(MessageManager - .getString("label.colourScheme_nucleotide")); + nucleotideColour.setLabel( + MessageManager.getString("label.colourScheme_nucleotide")); nucleotideColour.setName(JalviewColourScheme.Nucleotide.toString()); nucleotideColour.addItemListener(this); purinePyrimidineColour.setLabel(MessageManager .getString("label.colourScheme_purine/pyrimidine")); - purinePyrimidineColour.setName(JalviewColourScheme.PurinePyrimidine - .toString()); + purinePyrimidineColour + .setName(JalviewColourScheme.PurinePyrimidine.toString()); purinePyrimidineColour.addItemListener(this); - userDefinedColour.setLabel(MessageManager - .getString("action.user_defined")); + userDefinedColour + .setLabel(MessageManager.getString("action.user_defined")); userDefinedColour.addActionListener(this); - abovePIDColour.setLabel(MessageManager - .getString("label.above_identity_threshold")); + abovePIDColour.setLabel( + MessageManager.getString("label.above_identity_threshold")); abovePIDColour.addItemListener(this); - modifyPID.setLabel(MessageManager - .getString("label.modify_identity_threshold")); + modifyPID.setLabel( + MessageManager.getString("label.modify_identity_threshold")); modifyPID.addActionListener(this); - conservationColour.setLabel(MessageManager - .getString("action.by_conservation")); + conservationColour + .setLabel(MessageManager.getString("action.by_conservation")); conservationColour.addItemListener(this); modifyConservation.setLabel(MessageManager .getString("label.modify_conservation_threshold")); @@ -1161,8 +1168,8 @@ public class APopupMenu extends java.awt.PopupMenu implements protected void clustalColour_actionPerformed() { SequenceGroup sg = getGroup(); - sg.cs = new ResidueShader(new ClustalxColourScheme(sg, - ap.av.getHiddenRepSequences())); + sg.cs = new ResidueShader( + new ClustalxColourScheme(sg, ap.av.getHiddenRepSequences())); refresh(); } @@ -1216,8 +1223,7 @@ public class APopupMenu extends java.awt.PopupMenu implements public void purinePyrimidineColour_actionPerformed() { - getGroup().cs = new ResidueShader( - new PurinePyrimidineColourScheme()); + getGroup().cs = new ResidueShader(new PurinePyrimidineColourScheme()); refresh(); } @@ -1231,10 +1237,11 @@ public class APopupMenu extends java.awt.PopupMenu implements if (abovePIDColour.getState()) { - sg.cs.setConsensus(AAFrequency.calculate(sg.getSequences(ap.av - .getHiddenRepSequences()), 0, ap.av.getAlignment().getWidth())); - int threshold = SliderPanel.setPIDSliderSource(ap, sg.cs, getGroup() - .getName()); + sg.cs.setConsensus(AAFrequency.calculate( + sg.getSequences(ap.av.getHiddenRepSequences()), 0, + ap.av.getAlignment().getWidth())); + int threshold = SliderPanel.setPIDSliderSource(ap, sg.cs, + getGroup().getName()); sg.cs.setThreshold(threshold, ap.av.isIgnoreGapsConsensus()); @@ -1260,8 +1267,9 @@ public class APopupMenu extends java.awt.PopupMenu implements { SequenceGroup sg = getGroup(); sg.cs = new ResidueShader(new PIDColourScheme()); - sg.cs.setConsensus(AAFrequency.calculate(sg.getSequences(ap.av - .getHiddenRepSequences()), 0, ap.av.getAlignment().getWidth())); + sg.cs.setConsensus(AAFrequency.calculate( + sg.getSequences(ap.av.getHiddenRepSequences()), 0, + ap.av.getAlignment().getWidth())); refresh(); } @@ -1271,8 +1279,9 @@ public class APopupMenu extends java.awt.PopupMenu implements sg.cs = new ResidueShader(new Blosum62ColourScheme()); - sg.cs.setConsensus(AAFrequency.calculate(sg.getSequences(ap.av - .getHiddenRepSequences()), 0, ap.av.getAlignment().getWidth())); + sg.cs.setConsensus(AAFrequency.calculate( + sg.getSequences(ap.av.getHiddenRepSequences()), 0, + ap.av.getAlignment().getWidth())); refresh(); } @@ -1294,10 +1303,9 @@ public class APopupMenu extends java.awt.PopupMenu implements if (conservationColour.getState()) { Conservation conservation = Conservation.calculateConservation( - "Group", sg - .getSequences(ap.av.getHiddenRepSequences()), 0, ap.av - .getAlignment().getWidth(), false, ap.av.getConsPercGaps(), - false); + "Group", sg.getSequences(ap.av.getHiddenRepSequences()), 0, + ap.av.getAlignment().getWidth(), false, + ap.av.getConsPercGaps(), false); sg.getGroupColourScheme().setConservation(conservation); SliderPanel.setConservationSlider(ap, sg.cs, sg.getName()); SliderPanel.showConservationSlider(); @@ -1412,9 +1420,11 @@ public class APopupMenu extends java.awt.PopupMenu implements showMenu.removeAll(); hideMenu.removeAll(); - final List all = Arrays.asList(new String[] { MessageManager - .getString("label.all") }); - addAnnotationTypeToShowHide(showMenu, forSequences, "", all, true, true); + final List all = Arrays + .asList(new String[] + { MessageManager.getString("label.all") }); + addAnnotationTypeToShowHide(showMenu, forSequences, "", all, true, + true); addAnnotationTypeToShowHide(hideMenu, forSequences, "", all, true, false); showMenu.addSeparator(); diff --git a/src/jalview/appletgui/AlignFrame.java b/src/jalview/appletgui/AlignFrame.java index 65d652d..b48dec9 100644 --- a/src/jalview/appletgui/AlignFrame.java +++ b/src/jalview/appletgui/AlignFrame.java @@ -173,15 +173,15 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, } public AlignFrame(AlignmentI al, SequenceI[] hiddenSeqs, - HiddenColumns hidden, JalviewLite applet, - String title, boolean embedded) + HiddenColumns hidden, JalviewLite applet, String title, + boolean embedded) { this(al, hiddenSeqs, hidden, applet, title, embedded, true); } public AlignFrame(AlignmentI al, SequenceI[] hiddenSeqs, - HiddenColumns hidden, JalviewLite applet, - String title, boolean embedded, boolean addToDisplay) + HiddenColumns hidden, JalviewLite applet, String title, + boolean embedded, boolean addToDisplay) { if (applet != null) { @@ -390,8 +390,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, { Map colours = alignPanel.seqPanel.seqCanvas .getFeatureRenderer().getFeatureColours(); - boolean relaxedIdMatching = viewport.applet.getDefaultParameter( - "relaxedidmatch", false); + boolean relaxedIdMatching = viewport.applet + .getDefaultParameter("relaxedidmatch", false); featuresFile = new FeaturesFile(file, sourceType).parse( viewport.getAlignment(), colours, true, relaxedIdMatching); } catch (Exception ex) @@ -428,9 +428,10 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, ViewportRanges ranges = viewport.getRanges(); if (viewport.cursorMode - && ((evt.getKeyCode() >= KeyEvent.VK_0 && evt.getKeyCode() <= KeyEvent.VK_9) || (evt - .getKeyCode() >= KeyEvent.VK_NUMPAD0 && evt - .getKeyCode() <= KeyEvent.VK_NUMPAD9)) + && ((evt.getKeyCode() >= KeyEvent.VK_0 + && evt.getKeyCode() <= KeyEvent.VK_9) + || (evt.getKeyCode() >= KeyEvent.VK_NUMPAD0 + && evt.getKeyCode() <= KeyEvent.VK_NUMPAD9)) && Character.isDigit(evt.getKeyChar())) { alignPanel.seqPanel.numberPressed(evt.getKeyChar()); @@ -573,9 +574,9 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, case KeyEvent.VK_F2: viewport.cursorMode = !viewport.cursorMode; - statusBar.setText(MessageManager.formatMessage( - "label.keyboard_editing_mode", - new String[] { (viewport.cursorMode ? "on" : "off") })); + statusBar.setText(MessageManager + .formatMessage("label.keyboard_editing_mode", new String[] + { (viewport.cursorMode ? "on" : "off") })); if (viewport.cursorMode) { alignPanel.seqPanel.seqCanvas.cursorX = ranges.getStartRes(); @@ -708,9 +709,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, // Hide everything by the current selection - this is a hack - we do the // invert and then hide // first check that there will be visible columns after the invert. - if (viewport.hasSelectedColumns() - || (sg != null && sg.getSize() > 0 && sg.getStartRes() <= sg - .getEndRes())) + if (viewport.hasSelectedColumns() || (sg != null && sg.getSize() > 0 + && sg.getStartRes() <= sg.getEndRes())) { // now invert the sequence set, if required - empty selection implies // that no hiding is required. @@ -839,16 +839,18 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, { boolean newState = sortAnnBySequence.getState(); sortAnnByLabel.setState(false); - setAnnotationSortOrder(newState ? SequenceAnnotationOrder.SEQUENCE_AND_LABEL - : SequenceAnnotationOrder.NONE); + setAnnotationSortOrder( + newState ? SequenceAnnotationOrder.SEQUENCE_AND_LABEL + : SequenceAnnotationOrder.NONE); setViewportAnnotationOrder(); } else if (source == sortAnnByLabel) { boolean newState = sortAnnByLabel.getState(); sortAnnBySequence.setState(false); - setAnnotationSortOrder(newState ? SequenceAnnotationOrder.LABEL_AND_SEQUENCE - : SequenceAnnotationOrder.NONE); + setAnnotationSortOrder( + newState ? SequenceAnnotationOrder.LABEL_AND_SEQUENCE + : SequenceAnnotationOrder.NONE); setViewportAnnotationOrder(); } else if (source == showAutoFirst) @@ -1208,9 +1210,9 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, cap.setText(contents.toString()); Frame frame = new Frame(); frame.add(cap); - jalview.bin.JalviewLite.addFrame(frame, MessageManager.formatMessage( - "label.alignment_properties", new String[] { getTitle() }), - 400, 250); + jalview.bin.JalviewLite.addFrame(frame, MessageManager + .formatMessage("label.alignment_properties", new String[] + { getTitle() }), 400, 250); } else if (source == overviewMenuItem) { @@ -1371,15 +1373,15 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, CutAndPasteTransfer cap = new CutAndPasteTransfer(true, this); Frame frame = new Frame(); frame.add(cap); - JalviewLite.addFrame(frame, MessageManager.formatMessage( - "label.alignment_output_command", - new Object[] { e.getActionCommand() }), 600, 500); - - FileFormatI fileFormat = FileFormats.getInstance().forName( - e.getActionCommand()); - cap.setText(new AppletFormatAdapter(alignPanel).formatSequences( - fileFormat, viewport.getAlignment(), - viewport.getShowJVSuffix())); + JalviewLite.addFrame(frame, MessageManager + .formatMessage("label.alignment_output_command", new Object[] + { e.getActionCommand() }), 600, 500); + + FileFormatI fileFormat = FileFormats.getInstance() + .forName(e.getActionCommand()); + cap.setText( + new AppletFormatAdapter(alignPanel).formatSequences(fileFormat, + viewport.getAlignment(), viewport.getShowJVSuffix())); } public void loadAnnotations() @@ -1430,13 +1432,15 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, FeaturesFile formatter = new FeaturesFile(); if (format.equalsIgnoreCase("Jalview")) { - features = formatter.printJalviewFormat(viewport.getAlignment() - .getSequencesArray(), getDisplayedFeatureCols()); + features = formatter.printJalviewFormat( + viewport.getAlignment().getSequencesArray(), + getDisplayedFeatureCols()); } else { - features = formatter.printGffFormat(viewport.getAlignment() - .getSequencesArray(), getDisplayedFeatureCols()); + features = formatter.printGffFormat( + viewport.getAlignment().getSequencesArray(), + getDisplayedFeatureCols()); } if (displayTextbox) @@ -1479,8 +1483,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, : "?"; url.append(firstSep); - url.append("open=" - + appendProtocol(viewport.applet.getParameter("file"))); + url.append( + "open=" + appendProtocol(viewport.applet.getParameter("file"))); if (viewport.applet.getParameter("features") != null) { @@ -1491,30 +1495,30 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, if (viewport.applet.getParameter("annotations") != null) { url.append("&annotations="); - url.append(appendProtocol(viewport.applet.getParameter("annotations"))); + url.append( + appendProtocol(viewport.applet.getParameter("annotations"))); } if (viewport.applet.getParameter("jnetfile") != null || viewport.applet.getParameter("jpredfile") != null) { url.append("&annotations="); - url.append(appendProtocol(viewport.applet.getParameter("jnetfile") != null ? viewport.applet - .getParameter("jnetfile") : viewport.applet - .getParameter("jpredfile"))); + url.append(appendProtocol( + viewport.applet.getParameter("jnetfile") != null + ? viewport.applet.getParameter("jnetfile") + : viewport.applet.getParameter("jpredfile"))); } if (viewport.applet.getParameter("defaultColour") != null) { - url.append("&colour=" - + removeWhiteSpace(viewport.applet - .getParameter("defaultColour"))); + url.append("&colour=" + removeWhiteSpace( + viewport.applet.getParameter("defaultColour"))); } if (viewport.applet.getParameter("userDefinedColour") != null) { - url.append("&colour=" - + removeWhiteSpace(viewport.applet - .getParameter("userDefinedColour"))); + url.append("&colour=" + removeWhiteSpace( + viewport.applet.getParameter("userDefinedColour"))); } if (viewport.applet.getParameter("tree") != null) { @@ -1604,9 +1608,9 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, { undoMenuItem.setEnabled(true); CommandI command = viewport.getHistoryList().peek(); - undoMenuItem.setLabel(MessageManager.formatMessage( - "label.undo_command", - new Object[] { command.getDescription() })); + undoMenuItem.setLabel(MessageManager + .formatMessage("label.undo_command", new Object[] + { command.getDescription() })); } else { @@ -1619,9 +1623,9 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, redoMenuItem.setEnabled(true); CommandI command = viewport.getRedoList().peek(); - redoMenuItem.setLabel(MessageManager.formatMessage( - "label.redo_command", - new Object[] { command.getDescription() })); + redoMenuItem.setLabel(MessageManager + .formatMessage("label.redo_command", new Object[] + { command.getDescription() })); } else { @@ -1673,8 +1677,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, // viewport.getColumnSelection().getHiddenColumns() // != null; updateEditMenuBar(); - originalSource.firePropertyChange("alignment", null, originalSource - .getAlignment().getSequences()); + originalSource.firePropertyChange("alignment", null, + originalSource.getAlignment().getSequences()); } /** @@ -1706,8 +1710,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, // != null; updateEditMenuBar(); - originalSource.firePropertyChange("alignment", null, originalSource - .getAlignment().getSequences()); + originalSource.firePropertyChange("alignment", null, + originalSource.getAlignment().getSequences()); } AlignmentViewport getOriginatingSource(CommandI command) @@ -1721,8 +1725,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, { EditCommand editCommand = (EditCommand) command; al = editCommand.getAlignment(); - Vector comps = (Vector) PaintRefresher.components.get(viewport - .getSequenceSetId()); + Vector comps = (Vector) PaintRefresher.components + .get(viewport.getSequenceSetId()); for (int i = 0; i < comps.size(); i++) { if (comps.elementAt(i) instanceof AlignmentPanel) @@ -1787,15 +1791,15 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, List sg = new Vector<>(); if (viewport.cursorMode) { - sg.add(viewport.getAlignment().getSequenceAt( - alignPanel.seqPanel.seqCanvas.cursorY)); + sg.add(viewport.getAlignment() + .getSequenceAt(alignPanel.seqPanel.seqCanvas.cursorY)); } else if (viewport.getSelectionGroup() != null && viewport.getSelectionGroup().getSize() != viewport .getAlignment().getHeight()) { - sg = viewport.getSelectionGroup().getSequences( - viewport.getHiddenRepSequences()); + sg = viewport.getSelectionGroup() + .getSequences(viewport.getHiddenRepSequences()); } if (sg.size() < 1) @@ -1815,8 +1819,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, SequenceI[] seqs1 = sg.toArray(new SequenceI[sg.size()]); - SequenceI[] seqs2 = invertGroup.toArray(new SequenceI[invertGroup - .size()]); + SequenceI[] seqs2 = invertGroup + .toArray(new SequenceI[invertGroup.size()]); for (int i = 0; i < invertGroup.size(); i++) { seqs2[i] = invertGroup.elementAt(i); @@ -1825,13 +1829,13 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, SlideSequencesCommand ssc; if (right) { - ssc = new SlideSequencesCommand("Slide Sequences", seqs2, seqs1, - size, viewport.getGapCharacter()); + ssc = new SlideSequencesCommand("Slide Sequences", seqs2, seqs1, size, + viewport.getGapCharacter()); } else { - ssc = new SlideSequencesCommand("Slide Sequences", seqs1, seqs2, - size, viewport.getGapCharacter()); + ssc = new SlideSequencesCommand("Slide Sequences", seqs1, seqs2, size, + viewport.getGapCharacter()); } int groupAdjustment = 0; @@ -1871,9 +1875,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, if (historyList != null && historyList.size() > 0 && historyList.peek() instanceof SlideSequencesCommand) { - appendHistoryItem = ssc - .appendSlideCommand((SlideSequencesCommand) historyList - .peek()); + appendHistoryItem = ssc.appendSlideCommand( + (SlideSequencesCommand) historyList.peek()); } if (!appendHistoryItem) @@ -1964,14 +1967,10 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, endRes += seq.getStart() - 1; } - copiedSequences.append(seq.getName() - + "\t" - + startRes - + "\t" - + endRes - + "\t" - + seq.getSequenceAsString(sg.getStartRes(), - sg.getEndRes() + 1) + "\n"); + copiedSequences.append(seq.getName() + "\t" + startRes + "\t" + endRes + + "\t" + seq.getSequenceAsString(sg.getStartRes(), + sg.getEndRes() + 1) + + "\n"); } } @@ -2022,8 +2021,9 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, } else { - newtitle = newtitle.concat(MessageManager.formatMessage( - "label.from_msname", new String[] { getTitle() })); + newtitle = newtitle.concat(MessageManager + .formatMessage("label.from_msname", new String[] + { getTitle() })); } AlignFrame af = new AlignFrame(new Alignment(newSeqs), viewport.applet, newtitle, false); @@ -2065,8 +2065,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, viewport.getRanges().setEndSeq(viewport.getAlignment().getHeight()); viewport.getAlignment().getWidth(); - viewport.firePropertyChange("alignment", null, viewport.getAlignment() - .getSequences()); + viewport.firePropertyChange("alignment", null, + viewport.getAlignment().getSequences()); } @@ -2098,15 +2098,15 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, */ if (sg.getSize() == viewport.getAlignment().getHeight()) { - boolean isEntireAlignWidth = (((sg.getEndRes() - sg.getStartRes()) + 1) == viewport - .getAlignment().getWidth()) ? true : false; + boolean isEntireAlignWidth = (((sg.getEndRes() - sg.getStartRes()) + + 1) == viewport.getAlignment().getWidth()) ? true : false; if (isEntireAlignWidth) { String title = MessageManager.getString("label.delete_all"); Panel infoPanel = new Panel(); infoPanel.setLayout(new FlowLayout()); - infoPanel - .add(new Label(MessageManager.getString("warn.delete_all"))); + infoPanel.add( + new Label(MessageManager.getString("warn.delete_all"))); final JVDialog dialog = new JVDialog(this, title, true, 400, 200); dialog.setMainPanel(infoPanel); @@ -2140,8 +2140,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, viewport.setSelectionGroup(null); viewport.getAlignment().deleteGroup(sg); - viewport.firePropertyChange("alignment", null, viewport.getAlignment() - .getSequences()); + viewport.firePropertyChange("alignment", null, + viewport.getAlignment().getSequences()); if (viewport.getAlignment().getHeight() < 1) { @@ -2318,8 +2318,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, SequenceI[] seqs; if (viewport.getSelectionGroup() != null) { - seqs = viewport.getSelectionGroup().getSequencesAsArray( - viewport.getHiddenRepSequences()); + seqs = viewport.getSelectionGroup() + .getSequencesAsArray(viewport.getHiddenRepSequences()); } else { @@ -2339,10 +2339,9 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, column, al); } - statusBar.setText(MessageManager.formatMessage( - "label.removed_columns", - new String[] { Integer.valueOf(trimRegion.getSize()) - .toString() })); + statusBar.setText(MessageManager + .formatMessage("label.removed_columns", new String[] + { Integer.valueOf(trimRegion.getSize()).toString() })); addHistoryItem(trimRegion); for (SequenceGroup sg : al.getGroups()) @@ -2368,8 +2367,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, SequenceI[] seqs; if (viewport.getSelectionGroup() != null) { - seqs = viewport.getSelectionGroup().getSequencesAsArray( - viewport.getHiddenRepSequences()); + seqs = viewport.getSelectionGroup() + .getSequencesAsArray(viewport.getHiddenRepSequences()); start = viewport.getSelectionGroup().getStartRes(); end = viewport.getSelectionGroup().getEndRes(); } @@ -2384,10 +2383,9 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, addHistoryItem(removeGapCols); - statusBar.setText(MessageManager.formatMessage( - "label.removed_empty_columns", - new String[] { Integer.valueOf(removeGapCols.getSize()) - .toString() })); + statusBar.setText(MessageManager + .formatMessage("label.removed_empty_columns", new String[] + { Integer.valueOf(removeGapCols.getSize()).toString() })); // This is to maintain viewport position on first residue // of first sequence @@ -2413,8 +2411,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, SequenceI[] seqs; if (viewport.getSelectionGroup() != null) { - seqs = viewport.getSelectionGroup().getSequencesAsArray( - viewport.getHiddenRepSequences()); + seqs = viewport.getSelectionGroup() + .getSequencesAsArray(viewport.getHiddenRepSequences()); start = viewport.getSelectionGroup().getStartRes(); end = viewport.getSelectionGroup().getEndRes(); } @@ -2428,8 +2426,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, SequenceI seq = al.getSequenceAt(0); int startRes = seq.findPosition(ranges.getStartRes()); - addHistoryItem(new RemoveGapsCommand("Remove Gaps", seqs, start, end, - al)); + addHistoryItem( + new RemoveGapsCommand("Remove Gaps", seqs, start, end, al)); ranges.setStartRes(seq.findIndex(startRes) - 1); @@ -2463,12 +2461,14 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, if (viewport.getAlignment().getAlignmentAnnotation() != null) { - for (int i = 0; i < viewport.getAlignment().getAlignmentAnnotation().length; i++) + for (int i = 0; i < viewport.getAlignment() + .getAlignmentAnnotation().length; i++) { - if (!viewport.getAlignment().getAlignmentAnnotation()[i].autoCalculated) + if (!viewport.getAlignment() + .getAlignmentAnnotation()[i].autoCalculated) { - newal.addAnnotation(viewport.getAlignment() - .getAlignmentAnnotation()[i]); + newal.addAnnotation( + viewport.getAlignment().getAlignmentAnnotation()[i]); } } } @@ -2485,8 +2485,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, PaintRefresher.Register(newaf.alignPanel.seqPanel.seqCanvas, newaf.alignPanel.av.getSequenceSetId()); - Vector comps = (Vector) PaintRefresher.components.get(viewport - .getSequenceSetId()); + Vector comps = (Vector) PaintRefresher.components + .get(viewport.getSequenceSetId()); int viewSize = -1; for (int i = 0; i < comps.size(); i++) { @@ -2620,9 +2620,9 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, final OverviewPanel overview = new OverviewPanel(alignPanel); frame.add(overview); // +50 must allow for applet frame window - jalview.bin.JalviewLite.addFrame(frame, MessageManager.formatMessage( - "label.overview_params", new String[] { this.getTitle() }), - overview.getPreferredSize().width, + jalview.bin.JalviewLite.addFrame(frame, MessageManager + .formatMessage("label.overview_params", new String[] + { this.getTitle() }), overview.getPreferredSize().width, overview.getPreferredSize().height + 50); frame.pack(); @@ -2719,8 +2719,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, public void sortPairwiseMenuItem_actionPerformed() { SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray(); - AlignmentSorter.sortByPID(viewport.getAlignment(), viewport - .getAlignment().getSequenceAt(0)); + AlignmentSorter.sortByPID(viewport.getAlignment(), + viewport.getAlignment().getSequenceAt(0)); addHistoryItem(new OrderCommand("Pairwise Sort", oldOrder, viewport.getAlignment())); @@ -2731,8 +2731,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, { SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray(); AlignmentSorter.sortByID(viewport.getAlignment()); - addHistoryItem(new OrderCommand("ID Sort", oldOrder, - viewport.getAlignment())); + addHistoryItem( + new OrderCommand("ID Sort", oldOrder, viewport.getAlignment())); alignPanel.paintAlignment(true); } @@ -2781,7 +2781,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, SequenceI current; int Width = viewport.getAlignment().getWidth(); - for (int i = 0; i < viewport.getAlignment().getSequences().size(); i++) + for (int i = 0; i < viewport.getAlignment().getSequences() + .size(); i++) { current = viewport.getAlignment().getSequenceAt(i); @@ -2794,8 +2795,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, } if ((viewport.getSelectionGroup() != null - && viewport.getSelectionGroup().getSize() < 4 && viewport - .getSelectionGroup().getSize() > 0) + && viewport.getSelectionGroup().getSize() < 4 + && viewport.getSelectionGroup().getSize() > 0) || viewport.getAlignment().getHeight() < 4) { return; @@ -2824,15 +2825,15 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, protected void njTreeBlosumMenuItem_actionPerformed() { - newTreePanel(TreeBuilder.NEIGHBOUR_JOINING, ScoreModels.getInstance() - .getBlosum62().getName(), + newTreePanel(TreeBuilder.NEIGHBOUR_JOINING, + ScoreModels.getInstance().getBlosum62().getName(), "Neighbour joining tree using BLOSUM62"); } protected void avTreeBlosumMenuItem_actionPerformed() { - newTreePanel(TreeBuilder.AVERAGE_DISTANCE, ScoreModels.getInstance() - .getBlosum62().getName(), + newTreePanel(TreeBuilder.AVERAGE_DISTANCE, + ScoreModels.getInstance().getBlosum62().getName(), "Average distance tree using BLOSUM62"); } @@ -2844,7 +2845,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, SequenceI current; int Width = viewport.getAlignment().getWidth(); - for (int i = 0; i < viewport.getAlignment().getSequences().size(); i++) + for (int i = 0; i < viewport.getAlignment().getSequences() + .size(); i++) { current = viewport.getAlignment().getSequenceAt(i); @@ -2857,8 +2859,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, } - if ((viewport.getSelectionGroup() != null && viewport - .getSelectionGroup().getSize() > 1) + if ((viewport.getSelectionGroup() != null + && viewport.getSelectionGroup().getSize() > 1) || (viewport.getAlignment().getHeight() > 1)) { final TreePanel tp = new TreePanel(alignPanel, type, pwType); @@ -2899,13 +2901,13 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, public void sortByTree(TreePanel treePanel, String title) { SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray(); - AlignmentSorter - .sortByTree(viewport.getAlignment(), treePanel.getTree()); + AlignmentSorter.sortByTree(viewport.getAlignment(), + treePanel.getTree()); // addHistoryItem(new HistoryItem("Sort", viewport.alignment, // HistoryItem.SORT)); - addHistoryItem(new OrderCommand(MessageManager.formatMessage( - "label.order_by_params", new String[] { title }), oldOrder, - viewport.getAlignment())); + addHistoryItem(new OrderCommand(MessageManager + .formatMessage("label.order_by_params", new String[] + { title }), oldOrder, viewport.getAlignment())); alignPanel.paintAlignment(true); } @@ -3001,39 +3003,37 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, // TODO: update this text for each release or centrally store it for // lite and application g.setFont(new Font("Helvetica", Font.BOLD, 14)); - g.drawString(MessageManager.formatMessage( - "label.jalviewLite_release", new String[] { version }), x, - y += fh); + g.drawString(MessageManager + .formatMessage("label.jalviewLite_release", new String[] + { version }), x, y += fh); g.setFont(new Font("Helvetica", Font.BOLD, 12)); - g.drawString(MessageManager.formatMessage( - "label.jaview_build_date", new String[] { builddate }), x, - y += fh); + g.drawString(MessageManager.formatMessage("label.jaview_build_date", + new String[] + { builddate }), x, y += fh); g.setFont(new Font("Helvetica", Font.PLAIN, 12)); - g.drawString(MessageManager.getString("label.jalview_authors_1"), - x, y += fh * 1.5); + g.drawString(MessageManager.getString("label.jalview_authors_1"), x, + y += fh * 1.5); g.drawString(MessageManager.getString("label.jalview_authors_2"), x + 50, y += fh + 8); - g.drawString( - MessageManager.getString("label.jalview_dev_managers"), x, - y += fh); + g.drawString(MessageManager.getString("label.jalview_dev_managers"), + x, y += fh); g.drawString(MessageManager .getString("label.jalview_distribution_lists"), x, y += fh); g.drawString(MessageManager.getString("label.jalview_please_cite"), x, y += fh + 8); g.drawString( - MessageManager.getString("label.jalview_cite_1_authors"), - x, y += fh); - g.drawString( - MessageManager.getString("label.jalview_cite_1_title"), x, + MessageManager.getString("label.jalview_cite_1_authors"), x, y += fh); + g.drawString(MessageManager.getString("label.jalview_cite_1_title"), + x, y += fh); g.drawString(MessageManager.getString("label.jalview_cite_1_ref"), x, y += fh); } } Frame frame = new Frame(); - frame.add(new AboutPanel(JalviewLite.getVersion(), JalviewLite - .getBuildDate())); + frame.add(new AboutPanel(JalviewLite.getVersion(), + JalviewLite.getBuildDate())); jalview.bin.JalviewLite.addFrame(frame, MessageManager.getString("label.jalview"), 580, 220); @@ -3306,20 +3306,20 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, pasteNew.addActionListener(this); pasteThis.setLabel(MessageManager.getString("label.to_this_alignment")); pasteThis.addActionListener(this); - remove2LeftMenuItem.setLabel(MessageManager - .getString("action.remove_left")); + remove2LeftMenuItem + .setLabel(MessageManager.getString("action.remove_left")); remove2LeftMenuItem.addActionListener(this); - remove2RightMenuItem.setLabel(MessageManager - .getString("action.remove_right")); + remove2RightMenuItem + .setLabel(MessageManager.getString("action.remove_right")); remove2RightMenuItem.addActionListener(this); - removeGappedColumnMenuItem.setLabel(MessageManager - .getString("action.remove_empty_columns")); + removeGappedColumnMenuItem.setLabel( + MessageManager.getString("action.remove_empty_columns")); removeGappedColumnMenuItem.addActionListener(this); - removeAllGapsMenuItem.setLabel(MessageManager - .getString("action.remove_all_gaps")); + removeAllGapsMenuItem + .setLabel(MessageManager.getString("action.remove_all_gaps")); removeAllGapsMenuItem.addActionListener(this); - removeRedundancyMenuItem.setLabel(MessageManager - .getString("action.remove_redundancy")); + removeRedundancyMenuItem + .setLabel(MessageManager.getString("action.remove_redundancy")); removeRedundancyMenuItem.addActionListener(this); /* @@ -3329,25 +3329,25 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, findMenuItem.addActionListener(this); selectAllSequenceMenuItem.addActionListener(this); deselectAllSequenceMenuItem.addActionListener(this); - invertSequenceMenuItem.setLabel(MessageManager - .getString("action.invert_sequence_selection")); + invertSequenceMenuItem.setLabel( + MessageManager.getString("action.invert_sequence_selection")); invertSequenceMenuItem.addActionListener(this); - invertColSel.setLabel(MessageManager - .getString("action.invert_column_selection")); + invertColSel.setLabel( + MessageManager.getString("action.invert_column_selection")); invertColSel.addActionListener(this); - deleteGroups.setLabel(MessageManager - .getString("action.undefine_groups")); + deleteGroups + .setLabel(MessageManager.getString("action.undefine_groups")); deleteGroups.addActionListener(this); - grpsFromSelection.setLabel(MessageManager - .getString("action.make_groups_selection")); + grpsFromSelection.setLabel( + MessageManager.getString("action.make_groups_selection")); grpsFromSelection.addActionListener(this); createGroup.setLabel(MessageManager.getString("action.create_group")); createGroup.addActionListener(this); unGroup.setLabel(MessageManager.getString("action.remove_group")); unGroup.addActionListener(this); - annotationColumnSelection.setLabel(MessageManager - .getString("action.select_by_annotation")); + annotationColumnSelection.setLabel( + MessageManager.getString("action.select_by_annotation")); annotationColumnSelection.addActionListener(this); /* @@ -3361,14 +3361,14 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, Menu hideMenu = new Menu(MessageManager.getString("action.hide")); hideColumns .setLabel(MessageManager.getString("label.selected_columns")); - hideSequences.setLabel(MessageManager - .getString("label.selected_sequences")); - hideAllButSelection.setLabel(MessageManager - .getString("label.all_but_selected_region")); - hideAllSelection.setLabel(MessageManager - .getString("label.selected_region")); - showAllHidden.setLabel(MessageManager - .getString("label.all_sequences_columns")); + hideSequences + .setLabel(MessageManager.getString("label.selected_sequences")); + hideAllButSelection.setLabel( + MessageManager.getString("label.all_but_selected_region")); + hideAllSelection + .setLabel(MessageManager.getString("label.selected_region")); + showAllHidden.setLabel( + MessageManager.getString("label.all_sequences_columns")); showColumns.addActionListener(this); showSeqs.addActionListener(this); hideColumns.addActionListener(this); @@ -3376,39 +3376,39 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, hideAllButSelection.addActionListener(this); hideAllSelection.addActionListener(this); showAllHidden.addActionListener(this); - featureSettings.setLabel(MessageManager - .getString("action.feature_settings")); + featureSettings + .setLabel(MessageManager.getString("action.feature_settings")); featureSettings.addActionListener(this); - sequenceFeatures.setLabel(MessageManager - .getString("label.show_sequence_features")); + sequenceFeatures.setLabel( + MessageManager.getString("label.show_sequence_features")); sequenceFeatures.addItemListener(this); sequenceFeatures.setState(false); - followMouseOverFlag.setLabel(MessageManager - .getString("label.automatic_scrolling")); + followMouseOverFlag.setLabel( + MessageManager.getString("label.automatic_scrolling")); followMouseOverFlag.addItemListener(this); alProperties.addActionListener(this); - overviewMenuItem.setLabel(MessageManager - .getString("label.overview_window")); + overviewMenuItem + .setLabel(MessageManager.getString("label.overview_window")); overviewMenuItem.addActionListener(this); /* * Configure Annotations menu items and actions */ - annotationPanelMenuItem.setLabel(MessageManager - .getString("label.show_annotations")); + annotationPanelMenuItem + .setLabel(MessageManager.getString("label.show_annotations")); annotationPanelMenuItem.addItemListener(this); - showGroupConsensus.setLabel(MessageManager - .getString("label.group_consensus")); - showGroupConservation.setLabel(MessageManager - .getString("label.group_conservation")); - showConsensusHistogram.setLabel(MessageManager - .getString("label.show_consensus_histogram")); - showSequenceLogo.setLabel(MessageManager - .getString("label.show_consensus_logo")); - normSequenceLogo.setLabel(MessageManager - .getString("label.norm_consensus_logo")); - applyAutoAnnotationSettings.setLabel(MessageManager - .getString("label.apply_all_groups")); + showGroupConsensus + .setLabel(MessageManager.getString("label.group_consensus")); + showGroupConservation + .setLabel(MessageManager.getString("label.group_conservation")); + showConsensusHistogram.setLabel( + MessageManager.getString("label.show_consensus_histogram")); + showSequenceLogo.setLabel( + MessageManager.getString("label.show_consensus_logo")); + normSequenceLogo.setLabel( + MessageManager.getString("label.norm_consensus_logo")); + applyAutoAnnotationSettings + .setLabel(MessageManager.getString("label.apply_all_groups")); applyAutoAnnotationSettings.setState(true); Menu autoAnnMenu = new Menu( MessageManager.getString("label.autocalculated_annotation")); @@ -3463,44 +3463,44 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, viewTextMenuItem.setLabel(MessageManager.getString("action.text")); viewTextMenuItem.setState(true); viewTextMenuItem.addItemListener(this); - colourTextMenuItem.setLabel(MessageManager - .getString("label.colour_text")); + colourTextMenuItem + .setLabel(MessageManager.getString("label.colour_text")); colourTextMenuItem.addItemListener(this); - displayNonconservedMenuItem.setLabel(MessageManager - .getString("label.show_non_conserved")); + displayNonconservedMenuItem + .setLabel(MessageManager.getString("label.show_non_conserved")); displayNonconservedMenuItem.addItemListener(this); wrapMenuItem.setLabel(MessageManager.getString("action.wrap")); wrapMenuItem.addItemListener(this); - renderGapsMenuItem.setLabel(MessageManager - .getString("action.show_gaps")); + renderGapsMenuItem + .setLabel(MessageManager.getString("action.show_gaps")); renderGapsMenuItem.setState(true); renderGapsMenuItem.addItemListener(this); - centreColumnLabelFlag.setLabel(MessageManager - .getString("label.centre_column_labels")); + centreColumnLabelFlag.setLabel( + MessageManager.getString("label.centre_column_labels")); centreColumnLabelFlag.addItemListener(this); seqLimits.setState(true); - seqLimits.setLabel(MessageManager - .getString("label.show_sequence_limits")); + seqLimits.setLabel( + MessageManager.getString("label.show_sequence_limits")); seqLimits.addItemListener(this); /* * Configure Colour menu items and actions */ - applyToAllGroups.setLabel(MessageManager - .getString("label.apply_colour_to_all_groups")); + applyToAllGroups.setLabel( + MessageManager.getString("label.apply_colour_to_all_groups")); applyToAllGroups.setState(true); applyToAllGroups.addItemListener(this); - clustalColour.setLabel(MessageManager - .getString("label.colourScheme_clustal")); + clustalColour.setLabel( + MessageManager.getString("label.colourScheme_clustal")); clustalColour.addActionListener(this); - zappoColour.setLabel(MessageManager - .getString("label.colourScheme_zappo")); + zappoColour + .setLabel(MessageManager.getString("label.colourScheme_zappo")); zappoColour.addActionListener(this); - taylorColour.setLabel(MessageManager - .getString("label.colourScheme_taylor")); + taylorColour.setLabel( + MessageManager.getString("label.colourScheme_taylor")); taylorColour.addActionListener(this); - hydrophobicityColour.setLabel(MessageManager - .getString("label.colourScheme_hydrophobic")); + hydrophobicityColour.setLabel( + MessageManager.getString("label.colourScheme_hydrophobic")); hydrophobicityColour.addActionListener(this); helixColour.setLabel(MessageManager .getString("label.colourScheme_helix_propensity")); @@ -3508,11 +3508,11 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, strandColour.setLabel(MessageManager .getString("label.colourScheme_strand_propensity")); strandColour.addActionListener(this); - turnColour.setLabel(MessageManager - .getString("label.colourScheme_turn_propensity")); + turnColour.setLabel( + MessageManager.getString("label.colourScheme_turn_propensity")); turnColour.addActionListener(this); - buriedColour.setLabel(MessageManager - .getString("label.colourScheme_buried_index")); + buriedColour.setLabel( + MessageManager.getString("label.colourScheme_buried_index")); buriedColour.addActionListener(this); purinePyrimidineColour.setLabel(MessageManager .getString("label.colourScheme_purine/pyrimidine")); @@ -3520,81 +3520,82 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, // RNAInteractionColour.setLabel(MessageManager // .getString("label.rna_interaction")); // RNAInteractionColour.addActionListener(this); - RNAHelixColour.setLabel(MessageManager - .getString("label.colourScheme_rna_helices")); + RNAHelixColour.setLabel( + MessageManager.getString("label.colourScheme_rna_helices")); RNAHelixColour.addActionListener(this); - userDefinedColour.setLabel(MessageManager - .getString("action.user_defined")); + userDefinedColour + .setLabel(MessageManager.getString("action.user_defined")); userDefinedColour.addActionListener(this); - PIDColour.setLabel(MessageManager - .getString("label.colourScheme_%_identity")); + PIDColour.setLabel( + MessageManager.getString("label.colourScheme_%_identity")); PIDColour.addActionListener(this); - BLOSUM62Colour.setLabel(MessageManager - .getString("label.colourScheme_blosum62")); + BLOSUM62Colour.setLabel( + MessageManager.getString("label.colourScheme_blosum62")); BLOSUM62Colour.addActionListener(this); - tcoffeeColour.setLabel(MessageManager - .getString("label.colourScheme_t-coffee_scores")); + tcoffeeColour.setLabel( + MessageManager.getString("label.colourScheme_t-coffee_scores")); // it will be enabled only if a score file is provided tcoffeeColour.setEnabled(false); tcoffeeColour.addActionListener(this); - conservationMenuItem.setLabel(MessageManager - .getString("action.by_conservation")); + conservationMenuItem + .setLabel(MessageManager.getString("action.by_conservation")); conservationMenuItem.addItemListener(this); noColourmenuItem.setLabel(MessageManager.getString("label.none")); noColourmenuItem.addActionListener(this); - abovePIDThreshold.setLabel(MessageManager - .getString("label.above_identity_threshold")); + abovePIDThreshold.setLabel( + MessageManager.getString("label.above_identity_threshold")); abovePIDThreshold.addItemListener(this); - nucleotideColour.setLabel(MessageManager - .getString("label.colourScheme_nucleotide")); + nucleotideColour.setLabel( + MessageManager.getString("label.colourScheme_nucleotide")); nucleotideColour.addActionListener(this); - modifyPID.setLabel(MessageManager - .getString("label.modify_identity_threshold")); + modifyPID.setLabel( + MessageManager.getString("label.modify_identity_threshold")); modifyPID.setEnabled(abovePIDThreshold.getState()); modifyPID.addActionListener(this); modifyConservation.setLabel(MessageManager .getString("label.modify_conservation_threshold")); modifyConservation.setEnabled(conservationMenuItem.getState()); modifyConservation.addActionListener(this); - annotationColour.setLabel(MessageManager - .getString("action.by_annotation")); + annotationColour + .setLabel(MessageManager.getString("action.by_annotation")); annotationColour.addActionListener(this); /* * Configure Calculate menu items and actions */ - sortPairwiseMenuItem.setLabel(MessageManager - .getString("action.by_pairwise_id")); + sortPairwiseMenuItem + .setLabel(MessageManager.getString("action.by_pairwise_id")); sortPairwiseMenuItem.addActionListener(this); sortIDMenuItem.setLabel(MessageManager.getString("action.by_id")); sortIDMenuItem.addActionListener(this); - sortLengthMenuItem.setLabel(MessageManager - .getString("action.by_length")); + sortLengthMenuItem + .setLabel(MessageManager.getString("action.by_length")); sortLengthMenuItem.addActionListener(this); sortGroupMenuItem.setLabel(MessageManager.getString("action.by_group")); sortGroupMenuItem.addActionListener(this); - pairwiseAlignmentMenuItem.setLabel(MessageManager - .getString("action.pairwise_alignment")); + pairwiseAlignmentMenuItem.setLabel( + MessageManager.getString("action.pairwise_alignment")); pairwiseAlignmentMenuItem.addActionListener(this); - PCAMenuItem.setLabel(MessageManager - .getString("label.principal_component_analysis")); + PCAMenuItem.setLabel( + MessageManager.getString("label.principal_component_analysis")); PCAMenuItem.addActionListener(this); autoCalculate = new CheckboxMenuItem( - MessageManager.getString("label.autocalculate_consensus"), true); - averageDistanceTreeMenuItem.setLabel(MessageManager - .getString("label.average_distance_identity")); + MessageManager.getString("label.autocalculate_consensus"), + true); + averageDistanceTreeMenuItem.setLabel( + MessageManager.getString("label.average_distance_identity")); averageDistanceTreeMenuItem.addActionListener(this); - neighbourTreeMenuItem.setLabel(MessageManager - .getString("label.neighbour_joining_identity")); + neighbourTreeMenuItem.setLabel( + MessageManager.getString("label.neighbour_joining_identity")); neighbourTreeMenuItem.addActionListener(this); - avDistanceTreeBlosumMenuItem.setLabel(MessageManager - .getString("label.average_distance_blosum62")); + avDistanceTreeBlosumMenuItem.setLabel( + MessageManager.getString("label.average_distance_blosum62")); avDistanceTreeBlosumMenuItem.addActionListener(this); - njTreeBlosumMenuItem.setLabel(MessageManager - .getString("label.neighbour_blosum62")); + njTreeBlosumMenuItem + .setLabel(MessageManager.getString("label.neighbour_blosum62")); njTreeBlosumMenuItem.addActionListener(this); - sortByTreeMenu.setLabel(MessageManager - .getString("action.by_tree_order")); + sortByTreeMenu + .setLabel(MessageManager.getString("action.by_tree_order")); Menu sortMenu = new Menu(MessageManager.getString("action.sort")); Menu calculateTreeMenu = new Menu( MessageManager.getString("action.calculate_tree")); @@ -3911,9 +3912,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, theApplet.add(embeddedMenu, BorderLayout.NORTH); theApplet.add(statusBar, BorderLayout.SOUTH); // TODO should size be left to the layout manager? - alignPanel.setSize(theApplet.getSize().width, - theApplet.getSize().height - embeddedMenu.getHeight() - - statusBar.getHeight()); + alignPanel.setSize(theApplet.getSize().width, theApplet.getSize().height + - embeddedMenu.getHeight() - statusBar.getHeight()); theApplet.add(alignPanel, BorderLayout.CENTER); final AlignFrame me = this; theApplet.addFocusListener(new FocusListener() @@ -3959,8 +3959,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, viewer = (Viewer) jmolviewer; } catch (ClassCastException ex) { - System.err.println("Unsupported viewer object :" - + jmolviewer.getClass()); + System.err.println( + "Unsupported viewer object :" + jmolviewer.getClass()); } if (viewer == null) { @@ -4055,8 +4055,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, } // resolve data source // TODO: this code should be a refactored to an io package - DataSourceType protocol = AppletFormatAdapter.resolveProtocol( - pdbFile, FileFormat.PDB); + DataSourceType protocol = AppletFormatAdapter.resolveProtocol(pdbFile, + FileFormat.PDB); if (protocol == null) { return false; @@ -4081,8 +4081,9 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, { if (seqs[i] != null) { - sequences.addElement(new Object[] { seqs[i], - (chains != null) ? chains[i] : null }); + sequences + .addElement(new Object[] + { seqs[i], (chains != null) ? chains[i] : null }); } } seqs = new SequenceI[sequences.size()]; @@ -4108,8 +4109,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, chains = (String[]) sqch[1]; if (seqs == null || seqs.length == 0) { - System.err - .println("JalviewLite.AlignFrame:newStructureView: No sequence to bind structure to."); + System.err.println( + "JalviewLite.AlignFrame:newStructureView: No sequence to bind structure to."); } if (protocol == null) { @@ -4156,8 +4157,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, } if (ajm != null) { - System.err - .println("Incremental adding and aligning structure to existing Jmol view not yet implemented."); + System.err.println( + "Incremental adding and aligning structure to existing Jmol view not yet implemented."); // try and add the pdb structure // ajm.addS ajm = null; @@ -4166,8 +4167,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, // otherwise, create a new window if (applet.jmolAvailable) { - new AppletJmol(pdb, seqs, chains, alignPanel, - protocol); + new AppletJmol(pdb, seqs, chains, alignPanel, protocol); applet.lastFrameX += 40; applet.lastFrameY += 40; } @@ -4250,12 +4250,12 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, */ AlignmentI aln; if ((aln = viewport.getAlignment()) != null - && (aln.getHeight() != file.getHeight() || aln.getWidth() != file - .getWidth())) + && (aln.getHeight() != file.getHeight() + || aln.getWidth() != file.getWidth())) { // TODO: raise a dialog box here rather than bomb out. - System.err - .println("The scores matrix does not match the alignment dimensions"); + System.err.println( + "The scores matrix does not match the alignment dimensions"); } diff --git a/src/jalview/appletgui/AlignViewport.java b/src/jalview/appletgui/AlignViewport.java index 1d2c4bc..b07666e 100644 --- a/src/jalview/appletgui/AlignViewport.java +++ b/src/jalview/appletgui/AlignViewport.java @@ -45,8 +45,8 @@ import jalview.viewmodel.AlignmentViewport; import java.awt.Font; import java.awt.FontMetrics; -public class AlignViewport extends AlignmentViewport implements - SelectionSource +public class AlignViewport extends AlignmentViewport + implements SelectionSource { boolean cursorMode = false; @@ -94,15 +94,15 @@ public class AlignViewport extends AlignmentViewport implements } if (widthScale <= 1.0) { - System.err - .println("Invalid alignment character width scaling factor (" + System.err.println( + "Invalid alignment character width scaling factor (" + widthScale + "). Ignoring."); widthScale = 1; } if (JalviewLite.debug) { - System.err - .println("Alignment character width scaling factor is now " + System.err.println( + "Alignment character width scaling factor is now " + widthScale); } } @@ -117,15 +117,15 @@ public class AlignViewport extends AlignmentViewport implements } if (heightScale <= 1.0) { - System.err - .println("Invalid alignment character height scaling factor (" + System.err.println( + "Invalid alignment character height scaling factor (" + heightScale + "). Ignoring."); heightScale = 1; } if (JalviewLite.debug) { - System.err - .println("Alignment character height scaling factor is now " + System.err.println( + "Alignment character height scaling factor is now " + heightScale); } } @@ -136,8 +136,8 @@ public class AlignViewport extends AlignmentViewport implements if (applet != null) { - setShowJVSuffix(applet.getDefaultParameter("showFullId", - getShowJVSuffix())); + setShowJVSuffix( + applet.getDefaultParameter("showFullId", getShowJVSuffix())); setShowAnnotation(applet.getDefaultParameter("showAnnotation", isShowAnnotation())); @@ -156,8 +156,8 @@ public class AlignViewport extends AlignmentViewport implements setShowUnconserved(applet.getDefaultParameter("showUnconserved", getShowUnconserved())); - setScaleProteinAsCdna(applet.getDefaultParameter( - "scaleProteinAsCdna", isScaleProteinAsCdna())); + setScaleProteinAsCdna(applet.getDefaultParameter("scaleProteinAsCdna", + isScaleProteinAsCdna())); String param = applet.getParameter("upperCase"); if (param != null) @@ -193,9 +193,9 @@ public class AlignViewport extends AlignmentViewport implements if (applet != null) { - String colour = al.isNucleotide() ? applet - .getParameter("defaultColourNuc") : applet - .getParameter("defaultColourProt"); + String colour = al.isNucleotide() + ? applet.getParameter("defaultColourNuc") + : applet.getParameter("defaultColourProt"); if (colour == null) { colour = applet.getParameter("defaultColour"); @@ -221,9 +221,8 @@ public class AlignViewport extends AlignmentViewport implements if (applet.getParameter("userDefinedColour") != null) { - residueShading = new ResidueShader( - new UserColourScheme( - applet.getParameter("userDefinedColour"))); + residueShading = new ResidueShader(new UserColourScheme( + applet.getParameter("userDefinedColour"))); } } initAutoAnnotation(); @@ -260,7 +259,8 @@ public class AlignViewport extends AlignmentViewport implements { Font f2 = new Font(f.getName(), Font.BOLD, f.getSize()); FontMetrics fm = nullFrame.getGraphics().getFontMetrics(f2); - setCharWidth((int) (widthScale * (fm.stringWidth("MMMMMMMMMMM") / 10))); + setCharWidth( + (int) (widthScale * (fm.stringWidth("MMMMMMMMMMM") / 10))); } } diff --git a/src/jalview/appletgui/AlignmentPanel.java b/src/jalview/appletgui/AlignmentPanel.java index d679217..8e333ba 100644 --- a/src/jalview/appletgui/AlignmentPanel.java +++ b/src/jalview/appletgui/AlignmentPanel.java @@ -46,8 +46,8 @@ import java.awt.event.ComponentEvent; import java.beans.PropertyChangeEvent; import java.util.List; -public class AlignmentPanel extends Panel implements AdjustmentListener, - AlignmentViewPanel, ViewportListenerI +public class AlignmentPanel extends Panel + implements AdjustmentListener, AlignmentViewPanel, ViewportListenerI { public AlignViewport av; @@ -234,10 +234,10 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, idPanel.idCanvas.image = null; FontMetrics fm = getFontMetrics(av.getFont()); - scalePanel.setSize(new Dimension(10, av.getCharHeight() - + fm.getDescent())); - idwidthAdjuster.setSize(new Dimension(10, av.getCharHeight() - + fm.getDescent())); + scalePanel.setSize( + new Dimension(10, av.getCharHeight() + fm.getDescent())); + idwidthAdjuster.setSize( + new Dimension(10, av.getCharHeight() + fm.getDescent())); av.updateSequenceIdColours(); annotationPanel.image = null; int ap = annotationPanel.adjustPanelHeight(false); @@ -358,8 +358,7 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, * @return false if results were not found */ public boolean scrollToPosition(SearchResultsI results, - int verticalOffset, - boolean redrawOverview, boolean centre) + int verticalOffset, boolean redrawOverview, boolean centre) { // do we need to scroll the panel? if (results != null && results.getSize() > 0) @@ -380,8 +379,8 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, { if (JalviewLite.debug) {// DEBUG - System.out - .println("DEBUG: scroll didn't happen - results not within alignment : " + System.out.println( + "DEBUG: scroll didn't happen - results not within alignment : " + seq.getStart() + "," + seq.getEnd()); } return false; @@ -405,7 +404,8 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, */ if (centre) { - int offset = (vpRanges.getEndRes() - vpRanges.getStartRes() + 1) / 2 - 1; + int offset = (vpRanges.getEndRes() - vpRanges.getStartRes() + 1) / 2 + - 1; start = Math.max(start - offset, 0); end = end + offset - 1; // end = Math.min(end + offset, seq.getEnd() - 1); @@ -518,8 +518,8 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, /* * Scroll down to make end of search results visible */ - setScrollValues(vpRanges.getStartRes(), starts + seqIndex - ends - + 1); + setScrollValues(vpRanges.getStartRes(), + starts + seqIndex - ends + 1); } /* * Else results are already visible - no need to scroll @@ -571,8 +571,8 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, // this is called after loading new annotation onto alignment if (alignFrame.getSize().height == 0) { - System.out - .println("adjustAnnotationHeight frame size zero NEEDS FIXING"); + System.out.println( + "adjustAnnotationHeight frame size zero NEEDS FIXING"); } fontChanged(); validateAnnotationDimensions(true); @@ -605,8 +605,8 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, */ if (annotationHeight + alignmentHeight > availableHeight) { - annotationHeight = Math.min(annotationHeight, availableHeight - 2 - * rowHeight); + annotationHeight = Math.min(annotationHeight, + availableHeight - 2 * rowHeight); } } else @@ -623,13 +623,13 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, annotationPanel.setSize(new Dimension(d.width, annotationHeight)); annotationPanelHolder.setSize(new Dimension(d.width, annotationHeight)); // seqPanelHolder.setSize(d.width, seqandannot - height); - seqPanel.seqCanvas - .setSize(d.width, seqPanel.seqCanvas.getSize().height); + seqPanel.seqCanvas.setSize(d.width, + seqPanel.seqCanvas.getSize().height); Dimension e = idPanel.getSize(); alabels.setSize(new Dimension(e.width, annotationHeight)); - annotationSpaceFillerHolder.setSize(new Dimension(e.width, - annotationHeight)); + annotationSpaceFillerHolder + .setSize(new Dimension(e.width, annotationHeight)); int s = apvscroll.getValue(); if (s > mheight - annotationHeight) @@ -1156,7 +1156,7 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, @Override /** - * Property change event fired when a change is made to the viewport ranges + * Property change event fired when a change is made to the viewport ranges * object associated with this alignment panel's viewport */ public void propertyChange(PropertyChangeEvent evt) diff --git a/src/jalview/appletgui/AnnotationColourChooser.java b/src/jalview/appletgui/AnnotationColourChooser.java index f516bc9..8de751a 100644 --- a/src/jalview/appletgui/AnnotationColourChooser.java +++ b/src/jalview/appletgui/AnnotationColourChooser.java @@ -109,8 +109,8 @@ public class AnnotationColourChooser extends Panel implements if (oldcs instanceof AnnotationColourGradient) { AnnotationColourGradient acg = (AnnotationColourGradient) oldcs; - currentColours.setState(acg.isPredefinedColours() - || acg.getBaseColour() != null); + currentColours.setState( + acg.isPredefinedColours() || acg.getBaseColour() != null); if (!acg.isPredefinedColours() && acg.getBaseColour() == null) { minColour.setBackground(acg.getMinColour()); @@ -150,9 +150,8 @@ public class AnnotationColourChooser extends Panel implements threshold.select(1); break; default: - throw new Error( - MessageManager - .getString("error.implementation_error_dont_know_threshold_annotationcolourgradient")); + throw new Error(MessageManager.getString( + "error.implementation_error_dont_know_threshold_annotationcolourgradient")); } thresholdIsMin.setState(acg.isThresholdIsMinMax()); thresholdValue.setText("" + acg.getAnnotationThreshold()); @@ -219,8 +218,8 @@ public class AnnotationColourChooser extends Panel implements { minColour.setBackground(av.applet.getDefaultColourParameter( "ANNOTATIONCOLOUR_MIN", Color.orange)); - maxColour.setBackground(av.applet.getDefaultColourParameter( - "ANNOTATIONCOLOUR_MAX", Color.red)); + maxColour.setBackground(av.applet + .getDefaultColourParameter("ANNOTATIONCOLOUR_MAX", Color.red)); } @@ -265,13 +264,13 @@ public class AnnotationColourChooser extends Panel implements thresholdValue.setEnabled(false); thresholdValue.setColumns(5); currentColours.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); - currentColours.setLabel(MessageManager - .getString("label.use_original_colours")); + currentColours.setLabel( + MessageManager.getString("label.use_original_colours")); currentColours.addItemListener(this); thresholdIsMin.setBackground(Color.white); - thresholdIsMin.setLabel(MessageManager - .getString("label.threshold_minmax")); + thresholdIsMin + .setLabel(MessageManager.getString("label.threshold_minmax")); this.setLayout(borderLayout1); @@ -411,8 +410,8 @@ public class AnnotationColourChooser extends Panel implements if (!adjusting) { thresholdValue.setText((slider.getValue() / 1000f) + ""); - if (currentColours.getState() - && !(av.getGlobalColourScheme() instanceof AnnotationColourGradient)) + if (currentColours.getState() && !(av + .getGlobalColourScheme() instanceof AnnotationColourGradient)) { changeColour(); } @@ -467,8 +466,8 @@ public class AnnotationColourChooser extends Panel implements return; } - currentAnnotation = av.getAlignment().getAlignmentAnnotation()[annotations - .getSelectedIndex()]; + currentAnnotation = av.getAlignment() + .getAlignmentAnnotation()[annotations.getSelectedIndex()]; int aboveThreshold = -1; if (threshold.getSelectedIndex() == 1) @@ -494,10 +493,10 @@ public class AnnotationColourChooser extends Panel implements else if (aboveThreshold != AnnotationColourGradient.NO_THRESHOLD && currentAnnotation.threshold == null) { - currentAnnotation - .setThreshold(new jalview.datamodel.GraphLine( - (currentAnnotation.graphMax - currentAnnotation.graphMin) / 2f, - "Threshold", Color.black)); + currentAnnotation.setThreshold(new jalview.datamodel.GraphLine( + (currentAnnotation.graphMax - currentAnnotation.graphMin) + / 2f, + "Threshold", Color.black)); } if (aboveThreshold != AnnotationColourGradient.NO_THRESHOLD) @@ -546,14 +545,14 @@ public class AnnotationColourChooser extends Panel implements if (currentColours.getState()) { - sg.setColourScheme(new AnnotationColourGradient( - currentAnnotation, sg.getColourScheme(), aboveThreshold)); + sg.setColourScheme(new AnnotationColourGradient(currentAnnotation, + sg.getColourScheme(), aboveThreshold)); } else { - sg.setColourScheme(new AnnotationColourGradient( - currentAnnotation, minColour.getBackground(), maxColour - .getBackground(), aboveThreshold)); + sg.setColourScheme(new AnnotationColourGradient(currentAnnotation, + minColour.getBackground(), maxColour.getBackground(), + aboveThreshold)); } } } diff --git a/src/jalview/appletgui/AnnotationColumnChooser.java b/src/jalview/appletgui/AnnotationColumnChooser.java index 3a7188e..b4c1d54 100644 --- a/src/jalview/appletgui/AnnotationColumnChooser.java +++ b/src/jalview/appletgui/AnnotationColumnChooser.java @@ -172,16 +172,12 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements // restore Object state from the previous session if one exists if (lastChooser != null) { - currentSearchPanel = lastChooser - .getCurrentSearchPanel(); + currentSearchPanel = lastChooser.getCurrentSearchPanel(); currentStructureFilterPanel = lastChooser .getCurrentStructureFilterPanel(); - annotations.select(lastChooser - .getAnnotations().getSelectedIndex()); - threshold.select(lastChooser - .getThreshold().getSelectedIndex()); - actionOption = lastChooser - .getActionOption(); + annotations.select(lastChooser.getAnnotations().getSelectedIndex()); + threshold.select(lastChooser.getThreshold().getSelectedIndex()); + actionOption = lastChooser.getActionOption(); percentThreshold.setState(lastChooser.percentThreshold.getState()); } @@ -295,8 +291,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements if (av.getAnnotationColumnSelectionState() != null) { - HiddenColumns oldHidden = av - .getAnnotationColumnSelectionState() + HiddenColumns oldHidden = av.getAnnotationColumnSelectionState() .getOldHiddenColumns(); if (oldHidden != null) { @@ -399,11 +394,11 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements } AnnotationFilterParameter filterParams = new AnnotationFilterParameter(); - setCurrentAnnotation(av.getAlignment().getAlignmentAnnotation()[getAnnotations() - .getSelectedIndex()]); + setCurrentAnnotation(av.getAlignment() + .getAlignmentAnnotation()[getAnnotations().getSelectedIndex()]); - int selectedThresholdItem = getSelectedThresholdItem(getThreshold() - .getSelectedIndex()); + int selectedThresholdItem = getSelectedThresholdItem( + getThreshold().getSelectedIndex()); slider.setEnabled(true); thresholdValue.setEnabled(true); @@ -421,11 +416,10 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements { if (getCurrentAnnotation().threshold == null) { - getCurrentAnnotation() - .setThreshold( - new jalview.datamodel.GraphLine( - (getCurrentAnnotation().graphMax - getCurrentAnnotation().graphMin) / 2f, - "Threshold", Color.black)); + getCurrentAnnotation().setThreshold(new jalview.datamodel.GraphLine( + (getCurrentAnnotation().graphMax + - getCurrentAnnotation().graphMin) / 2f, + "Threshold", Color.black)); } adjusting = true; @@ -434,7 +428,8 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements slider.setMinimum((int) (getCurrentAnnotation().graphMin * 1000)); slider.setMaximum((int) (getCurrentAnnotation().graphMax * 1000)); - slider.setValue((int) (getCurrentAnnotation().threshold.value * 1000)); + slider.setValue( + (int) (getCurrentAnnotation().threshold.value * 1000)); setThresholdValueText(); // slider.setMajorTickSpacing((int) (range / 10f)); slider.setEnabled(true); @@ -443,8 +438,8 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements adjusting = false; // build filter params - filterParams - .setThresholdType(AnnotationFilterParameter.ThresholdType.NO_THRESHOLD); + filterParams.setThresholdType( + AnnotationFilterParameter.ThresholdType.NO_THRESHOLD); if (getCurrentAnnotation().isQuantitative()) { filterParams @@ -452,13 +447,13 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements if (selectedThresholdItem == AnnotationColourGradient.ABOVE_THRESHOLD) { - filterParams - .setThresholdType(AnnotationFilterParameter.ThresholdType.ABOVE_THRESHOLD); + filterParams.setThresholdType( + AnnotationFilterParameter.ThresholdType.ABOVE_THRESHOLD); } else if (selectedThresholdItem == AnnotationColourGradient.BELOW_THRESHOLD) { - filterParams - .setThresholdType(AnnotationFilterParameter.ThresholdType.BELOW_THRESHOLD); + filterParams.setThresholdType( + AnnotationFilterParameter.ThresholdType.BELOW_THRESHOLD); } } } @@ -489,13 +484,13 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements filterParams.setRegexString(currentSearchPanel.searchBox.getText()); if (currentSearchPanel.displayName.getState()) { - filterParams - .addRegexSearchField(AnnotationFilterParameter.SearchableAnnotationField.DISPLAY_STRING); + filterParams.addRegexSearchField( + AnnotationFilterParameter.SearchableAnnotationField.DISPLAY_STRING); } if (currentSearchPanel.description.getState()) { - filterParams - .addRegexSearchField(AnnotationFilterParameter.SearchableAnnotationField.DESCRIPTION); + filterParams.addRegexSearchField( + AnnotationFilterParameter.SearchableAnnotationField.DESCRIPTION); } } else @@ -642,7 +637,8 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements public void syncState() { - if (aColChooser.getActionOption() == AnnotationColumnChooser.ACTION_OPTION_HIDE) + if (aColChooser + .getActionOption() == AnnotationColumnChooser.ACTION_OPTION_HIDE) { furtherAction.select("Hide"); } @@ -670,8 +666,8 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements } } - public class StructureFilterPanel extends TitledPanel implements - ItemListener + public class StructureFilterPanel extends TitledPanel + implements ItemListener { private AnnotationColumnChooser aColChooser; diff --git a/src/jalview/appletgui/AnnotationLabels.java b/src/jalview/appletgui/AnnotationLabels.java index 3f7e523..2fb737a 100755 --- a/src/jalview/appletgui/AnnotationLabels.java +++ b/src/jalview/appletgui/AnnotationLabels.java @@ -52,8 +52,8 @@ import java.util.Arrays; import java.util.Collections; import java.util.Vector; -public class AnnotationLabels extends Panel implements ActionListener, - MouseListener, MouseMotionListener +public class AnnotationLabels extends Panel + implements ActionListener, MouseListener, MouseMotionListener { Image image; @@ -201,8 +201,9 @@ public class AnnotationLabels extends Panel implements ActionListener, ap.alignFrame); Frame frame = new Frame(); frame.add(cap); - jalview.bin.JalviewLite.addFrame(frame, ap.alignFrame.getTitle() - + " - " + aa[selectedRow].label, 500, 100); + jalview.bin.JalviewLite.addFrame(frame, + ap.alignFrame.getTitle() + " - " + aa[selectedRow].label, 500, + 100); cap.setText(aa[selectedRow].toString()); } else if (evt.getActionCommand().equals(COPYCONS_SEQ)) @@ -230,8 +231,9 @@ public class AnnotationLabels extends Panel implements ActionListener, boolean editLabelDescription(AlignmentAnnotation annotation) { - Checkbox padGaps = new Checkbox("Fill Empty Gaps With \"" - + ap.av.getGapCharacter() + "\"", annotation.padGaps); + Checkbox padGaps = new Checkbox( + "Fill Empty Gaps With \"" + ap.av.getGapCharacter() + "\"", + annotation.padGaps); EditNameDialog dialog = new EditNameDialog(annotation.label, annotation.description, " Annotation Label", @@ -320,8 +322,9 @@ public class AnnotationLabels extends Panel implements ActionListener, if (resizePanel) { - Dimension d = ap.annotationPanelHolder.getSize(), e = ap.annotationSpaceFillerHolder - .getSize(), f = ap.seqPanelHolder.getSize(); + Dimension d = ap.annotationPanelHolder.getSize(), + e = ap.annotationSpaceFillerHolder.getSize(), + f = ap.seqPanelHolder.getSize(); int dif = evt.getY() - oldY; dif /= ap.av.getCharHeight(); @@ -331,16 +334,16 @@ public class AnnotationLabels extends Panel implements ActionListener, { ap.annotationPanel.setSize(d.width, d.height - dif); setSize(new Dimension(e.width, d.height - dif)); - ap.annotationSpaceFillerHolder.setSize(new Dimension(e.width, - d.height - dif)); - ap.annotationPanelHolder.setSize(new Dimension(d.width, d.height - - dif)); + ap.annotationSpaceFillerHolder + .setSize(new Dimension(e.width, d.height - dif)); + ap.annotationPanelHolder + .setSize(new Dimension(d.width, d.height - dif)); ap.apvscroll.setValues(ap.apvscroll.getValue(), d.height - dif, 0, av.calcPanelHeight()); f.height += dif; ap.seqPanelHolder.setPreferredSize(f); - ap.setScrollValues(av.getRanges().getStartRes(), av.getRanges() - .getStartSeq()); + ap.setScrollValues(av.getRanges().getStartRes(), + av.getRanges().getStartSeq()); ap.validate(); // ap.paintAlignment(true); ap.addNotify(); @@ -451,7 +454,8 @@ public class AnnotationLabels extends Panel implements ActionListener, .getAlignmentAnnotation(); // DETECT RIGHT MOUSE BUTTON IN AWT - if ((evt.getModifiers() & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK) + if ((evt.getModifiers() + & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK) { PopupMenu popup = new PopupMenu( @@ -525,9 +529,10 @@ public class AnnotationLabels extends Panel implements ActionListener, popup.addSeparator(); final CheckboxMenuItem cbmi = new CheckboxMenuItem( MessageManager.getString("label.ignore_gaps_consensus"), - (aa[selectedRow].groupRef != null) ? aa[selectedRow].groupRef - .getIgnoreGapsConsensus() : ap.av - .isIgnoreGapsConsensus()); + (aa[selectedRow].groupRef != null) + ? aa[selectedRow].groupRef + .getIgnoreGapsConsensus() + : ap.av.isIgnoreGapsConsensus()); final AlignmentAnnotation aaa = aa[selectedRow]; cbmi.addItemListener(new ItemListener() { @@ -631,10 +636,10 @@ public class AnnotationLabels extends Panel implements ActionListener, // can be // updated. av.setShowConsensusHistogram(chist.getState()); - ap.alignFrame.showConsensusHistogram.setState(chist - .getState()); // TODO: implement - // ap.updateGUI()/alignFrame.updateGUI - // for applet + ap.alignFrame.showConsensusHistogram + .setState(chist.getState()); // TODO: implement + // ap.updateGUI()/alignFrame.updateGUI + // for applet ap.repaint(); // ap.annotationPanel.paint(ap.annotationPanel.getGraphics()); } @@ -680,11 +685,12 @@ public class AnnotationLabels extends Panel implements ActionListener, // can be // updated. av.setShowSequenceLogo(true); - ap.alignFrame.normSequenceLogo.setState(cprofn.getState()); // TODO: - // implement - // ap.updateGUI()/alignFrame.updateGUI - // for - // applet + ap.alignFrame.normSequenceLogo + .setState(cprofn.getState()); // TODO: + // implement + // ap.updateGUI()/alignFrame.updateGUI + // for + // applet av.setNormaliseSequenceLogo(cprofn.getState()); ap.repaint(); // ap.annotationPanel.paint(ap.annotationPanel.getGraphics()); @@ -715,17 +721,16 @@ public class AnnotationLabels extends Panel implements ActionListener, ap.seqPanel.ap.idPanel.highlightSearchResults(null); // process modifiers SequenceGroup sg = ap.av.getSelectionGroup(); - if (sg == null - || sg == aa[selectedRow].groupRef - || !(jalview.util.Platform.isControlDown(evt) || evt - .isShiftDown())) + if (sg == null || sg == aa[selectedRow].groupRef + || !(jalview.util.Platform.isControlDown(evt) + || evt.isShiftDown())) { if (jalview.util.Platform.isControlDown(evt) || evt.isShiftDown()) { // clone a new selection group from the associated group - ap.av.setSelectionGroup(new SequenceGroup( - aa[selectedRow].groupRef)); + ap.av.setSelectionGroup( + new SequenceGroup(aa[selectedRow].groupRef)); } else { @@ -757,9 +762,8 @@ public class AnnotationLabels extends Panel implements ActionListener, } else { - ap.seqPanel.ap.idPanel - .highlightSearchResults(aa[selectedRow].groupRef - .getSequences(null)); + ap.seqPanel.ap.idPanel.highlightSearchResults( + aa[selectedRow].groupRef.getSequences(null)); } return; } @@ -768,8 +772,8 @@ public class AnnotationLabels extends Panel implements ActionListener, if (evt.getClickCount() == 1) { ap.seqPanel.ap.idPanel - .highlightSearchResults(Arrays - .asList(new SequenceI[] { aa[selectedRow].sequenceRef })); + .highlightSearchResults(Arrays.asList(new SequenceI[] + { aa[selectedRow].sequenceRef })); } else if (evt.getClickCount() >= 2) { @@ -780,8 +784,8 @@ public class AnnotationLabels extends Panel implements ActionListener, // we make a copy rather than edit the current selection if no // modifiers pressed // see Enhancement JAL-1557 - if (!(jalview.util.Platform.isControlDown(evt) || evt - .isShiftDown())) + if (!(jalview.util.Platform.isControlDown(evt) + || evt.isShiftDown())) { sg = new SequenceGroup(sg); sg.clear(); @@ -833,14 +837,13 @@ public class AnnotationLabels extends Panel implements ActionListener, return; } jalview.appletgui.AlignFrame.copiedSequences = new StringBuffer(); - jalview.appletgui.AlignFrame.copiedSequences.append(sq.getName() + "\t" - + sq.getStart() + "\t" + sq.getEnd() + "\t" - + sq.getSequenceAsString() + "\n"); + jalview.appletgui.AlignFrame.copiedSequences + .append(sq.getName() + "\t" + sq.getStart() + "\t" + sq.getEnd() + + "\t" + sq.getSequenceAsString() + "\n"); if (av.hasHiddenColumns()) { jalview.appletgui.AlignFrame.copiedHiddenColumns = new Vector<>( - av.getAlignment().getHiddenColumns() - .getHiddenColumnsCopy()); + av.getAlignment().getHiddenColumns().getHiddenColumnsCopy()); } } diff --git a/src/jalview/appletgui/AnnotationPanel.java b/src/jalview/appletgui/AnnotationPanel.java index 417bb06..6fe71de 100755 --- a/src/jalview/appletgui/AnnotationPanel.java +++ b/src/jalview/appletgui/AnnotationPanel.java @@ -51,9 +51,9 @@ import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import java.beans.PropertyChangeEvent; -public class AnnotationPanel extends Panel implements AwtRenderPanelI, - AdjustmentListener, ActionListener, MouseListener, - MouseMotionListener, ViewportListenerI +public class AnnotationPanel extends Panel + implements AwtRenderPanelI, AdjustmentListener, ActionListener, + MouseListener, MouseMotionListener, ViewportListenerI { AlignViewport av; @@ -153,7 +153,8 @@ public class AnnotationPanel extends Panel implements AwtRenderPanelI, if (anot.length < av.getColumnSelection().getMax()) { - Annotation[] temp = new Annotation[av.getColumnSelection().getMax() + 2]; + Annotation[] temp = new Annotation[av.getColumnSelection().getMax() + + 2]; System.arraycopy(anot, 0, temp, 0, anot.length); anot = temp; aa[activeRow].annotations = anot; @@ -287,8 +288,8 @@ public class AnnotationPanel extends Panel implements AwtRenderPanelI, anot[index] = new Annotation(label, "", type, 0); } - anot[index].secondaryStructure = type != 'S' ? type : label - .length() == 0 ? ' ' : label.charAt(0); + anot[index].secondaryStructure = type != 'S' ? type + : label.length() == 0 ? ' ' : label.charAt(0); anot[index].displayCharacter = label; } } @@ -353,7 +354,8 @@ public class AnnotationPanel extends Panel implements AwtRenderPanelI, } } - if ((evt.getModifiers() & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK + if ((evt.getModifiers() + & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK && activeRow != -1) { if (av.getColumnSelection() == null @@ -425,11 +427,14 @@ public class AnnotationPanel extends Panel implements AwtRenderPanelI, { if (graphStretch > -1) { - av.getAlignment().getAlignmentAnnotation()[graphStretch].graphHeight += graphStretchY - - evt.getY(); - if (av.getAlignment().getAlignmentAnnotation()[graphStretch].graphHeight < 0) + av.getAlignment() + .getAlignmentAnnotation()[graphStretch].graphHeight += graphStretchY + - evt.getY(); + if (av.getAlignment() + .getAlignmentAnnotation()[graphStretch].graphHeight < 0) { - av.getAlignment().getAlignmentAnnotation()[graphStretch].graphHeight = 0; + av.getAlignment() + .getAlignmentAnnotation()[graphStretch].graphHeight = 0; } graphStretchY = evt.getY(); av.calcPanelHeight(); @@ -509,18 +514,19 @@ public class AnnotationPanel extends Panel implements AwtRenderPanelI, String name; if (av.getAlignment().isNucleotide()) { - name = ResidueProperties.nucleotideName.get(String - .valueOf(residue)); - text.append(" Nucleotide: ").append( - name != null ? name : residue); + name = ResidueProperties.nucleotideName + .get(String.valueOf(residue)); + text.append(" Nucleotide: ") + .append(name != null ? name : residue); } else { - name = 'X' == residue ? "X" : ('*' == residue ? "STOP" - : ResidueProperties.aa2Triplet.get(String - .valueOf(residue))); - text.append(" Residue: ").append( - name != null ? name : residue); + name = 'X' == residue ? "X" + : ('*' == residue ? "STOP" + : ResidueProperties.aa2Triplet + .get(String.valueOf(residue))); + text.append(" Residue: ") + .append(name != null ? name : residue); } int residuePos = seqref.findPosition(column); text.append(" (").append(residuePos).append(")"); @@ -626,8 +632,8 @@ public class AnnotationPanel extends Panel implements AwtRenderPanelI, gg.setColor(Color.white); gg.fillRect(0, 0, getSize().width, getSize().height); - drawComponent(gg, av.getRanges().getStartRes(), av.getRanges() - .getEndRes() + 1); + drawComponent(gg, av.getRanges().getStartRes(), + av.getRanges().getEndRes() + 1); g.drawImage(image, 0, 0, this); } @@ -644,7 +650,8 @@ public class AnnotationPanel extends Panel implements AwtRenderPanelI, gg.copyArea(0, 0, imgWidth, getSize().height, -horizontal * av.getCharWidth(), 0); - int sr = av.getRanges().getStartRes(), er = av.getRanges().getEndRes() + 1, transX = 0; + int sr = av.getRanges().getStartRes(), + er = av.getRanges().getEndRes() + 1, transX = 0; if (horizontal > 0) // scrollbar pulled right, image to the left { diff --git a/src/jalview/appletgui/AnnotationRowFilter.java b/src/jalview/appletgui/AnnotationRowFilter.java index 315ce3b..5efd177 100644 --- a/src/jalview/appletgui/AnnotationRowFilter.java +++ b/src/jalview/appletgui/AnnotationRowFilter.java @@ -154,7 +154,7 @@ public abstract class AnnotationRowFilter extends Panel thresholdValue.setCaretPosition(0); adjusting = oldadj; } - + public void thresholdValue_actionPerformed(ActionEvent e) { try @@ -163,7 +163,8 @@ public abstract class AnnotationRowFilter extends Panel if (percentThreshold.getState()) { int pos = slider.getMinimum() - + (int) ((slider.getMaximum() - slider.getMinimum()) * f / 100f); + + (int) ((slider.getMaximum() - slider.getMinimum()) * f + / 100f); slider.setValue(pos); } else diff --git a/src/jalview/appletgui/AppletJmol.java b/src/jalview/appletgui/AppletJmol.java index c0b4ff0..49219b9 100644 --- a/src/jalview/appletgui/AppletJmol.java +++ b/src/jalview/appletgui/AppletJmol.java @@ -65,7 +65,7 @@ import java.util.List; import java.util.Vector; public class AppletJmol extends EmbmenuFrame implements -// StructureListener, + // StructureListener, KeyListener, ActionListener, ItemListener { @@ -88,7 +88,8 @@ public class AppletJmol extends EmbmenuFrame implements CheckboxMenuItem jmolColour = new CheckboxMenuItem( MessageManager.getString("action.using_jmol"), false); - MenuItem chain = new MenuItem(MessageManager.getString("action.by_chain")); + MenuItem chain = new MenuItem( + MessageManager.getString("action.by_chain")); MenuItem charge = new MenuItem( MessageManager.getString("label.charge_cysteine")); @@ -182,15 +183,15 @@ public class AppletJmol extends EmbmenuFrame implements { this.ap = ap; jmb = new AppletJmolBinding(this, ap.getStructureSelectionManager(), - new PDBEntry[] { pdbentry }, new SequenceI[][] { seq }, - protocol); + new PDBEntry[] + { pdbentry }, new SequenceI[][] { seq }, protocol); jmb.setColourBySequence(true); if (pdbentry.getId() == null || pdbentry.getId().length() < 1) { if (protocol == DataSourceType.PASTE) { - pdbentry.setId("PASTED PDB" - + (chains == null ? "_" : chains.toString())); + pdbentry.setId( + "PASTED PDB" + (chains == null ? "_" : chains.toString())); } else { @@ -210,9 +211,9 @@ public class AppletJmol extends EmbmenuFrame implements StructureFile reader = null; if (alreadyMapped != null) { - reader = StructureSelectionManager.getStructureSelectionManager( - ap.av.applet).setMapping(seq, chains, pdbentry.getFile(), - protocol); + reader = StructureSelectionManager + .getStructureSelectionManager(ap.av.applet) + .setMapping(seq, chains, pdbentry.getFile(), protocol); // PROMPT USER HERE TO ADD TO NEW OR EXISTING VIEW? // FOR NOW, LETS JUST OPEN A NEW WINDOW } @@ -268,15 +269,15 @@ public class AppletJmol extends EmbmenuFrame implements try { - jmb.allocateViewer(renderPanel, true, ap.av.applet.getName() - + "_jmol_", ap.av.applet.getDocumentBase(), - ap.av.applet.getCodeBase(), "-applet", scriptWindow, null); + jmb.allocateViewer(renderPanel, true, + ap.av.applet.getName() + "_jmol_", + ap.av.applet.getDocumentBase(), ap.av.applet.getCodeBase(), + "-applet", scriptWindow, null); } catch (Exception e) { - System.err - .println("Couldn't create a jmol viewer. Args to allocate viewer were:\nDocumentBase=" - + ap.av.applet.getDocumentBase() - + "\nCodebase=" + System.err.println( + "Couldn't create a jmol viewer. Args to allocate viewer were:\nDocumentBase=" + + ap.av.applet.getDocumentBase() + "\nCodebase=" + ap.av.applet.getCodeBase()); e.printStackTrace(); dispose(); @@ -294,7 +295,7 @@ public class AppletJmol extends EmbmenuFrame implements }); pdbentry.setProperty("protocol", protocol); if (pdbentry.getFile() != null) - + { // import structure data from pdbentry.getFile based on given protocol if (protocol == DataSourceType.PASTE) @@ -319,8 +320,8 @@ public class AppletJmol extends EmbmenuFrame implements { if (jalview.bin.JalviewLite.debug) { - System.err - .println("AppletJmol:Trying to reuse existing PDBfile IO parser."); + System.err.println( + "AppletJmol:Trying to reuse existing PDBfile IO parser."); } // re-use the one we opened earlier freader = reader.getReader(); @@ -329,8 +330,8 @@ public class AppletJmol extends EmbmenuFrame implements { if (jalview.bin.JalviewLite.debug) { - System.err - .println("AppletJmol:Creating new PDBfile IO parser."); + System.err.println( + "AppletJmol:Creating new PDBfile IO parser."); } FileParse fp = new FileParse(pdbentry.getFile(), protocol); fp.mark(); @@ -346,9 +347,8 @@ public class AppletJmol extends EmbmenuFrame implements } if (freader == null) { - throw new Exception( - MessageManager - .getString("exception.invalid_datasource_couldnt_obtain_reader")); + throw new Exception(MessageManager.getString( + "exception.invalid_datasource_couldnt_obtain_reader")); } jmb.viewer.openReader(pdbentry.getFile(), pdbentry.getId(), freader); @@ -433,8 +433,8 @@ public class AppletJmol extends EmbmenuFrame implements } catch (OutOfMemoryError ex) { frame.dispose(); - System.err - .println("Out of memory when trying to create dialog box with sequence-structure mapping."); + System.err.println( + "Out of memory when trying to create dialog box with sequence-structure mapping."); return; } jalview.bin.JalviewLite.addFrame(frame, @@ -500,10 +500,10 @@ public class AppletJmol extends EmbmenuFrame implements { try { - ap.av.applet.getAppletContext().showDocument( - new java.net.URL( + ap.av.applet.getAppletContext() + .showDocument(new java.net.URL( "http://jmol.sourceforge.net/docs/JmolUserGuide/"), - "jmolHelp"); + "jmolHelp"); } catch (java.net.MalformedURLException ex) { } diff --git a/src/jalview/appletgui/AppletJmolBinding.java b/src/jalview/appletgui/AppletJmolBinding.java index 9b8a235..d5d53fb 100644 --- a/src/jalview/appletgui/AppletJmolBinding.java +++ b/src/jalview/appletgui/AppletJmolBinding.java @@ -110,8 +110,8 @@ class AppletJmolBinding extends JalviewJmolBinding { try { - appletJmolBinding.ap.av.applet.getAppletContext().showDocument( - new java.net.URL(url), "jmol"); + appletJmolBinding.ap.av.applet.getAppletContext() + .showDocument(new java.net.URL(url), "jmol"); } catch (java.net.MalformedURLException ex) { } diff --git a/src/jalview/appletgui/CutAndPasteTransfer.java b/src/jalview/appletgui/CutAndPasteTransfer.java index 1e806a5..22a49cd 100644 --- a/src/jalview/appletgui/CutAndPasteTransfer.java +++ b/src/jalview/appletgui/CutAndPasteTransfer.java @@ -55,8 +55,8 @@ import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.io.IOException; -public class CutAndPasteTransfer extends Panel implements ActionListener, - MouseListener +public class CutAndPasteTransfer extends Panel + implements ActionListener, MouseListener { boolean pdbImport = false; @@ -211,8 +211,8 @@ public class CutAndPasteTransfer extends Panel implements ActionListener, // TODO: JAL-1102 - should have a warning message in dialog, not simply // overwrite the broken input data with the exception textarea.setText(MessageManager.formatMessage( - "label.could_not_parse_newick_file", - new Object[] { ex.getMessage() })); + "label.could_not_parse_newick_file", new Object[] + { ex.getMessage() })); return false; } return false; @@ -238,65 +238,64 @@ public class CutAndPasteTransfer extends Panel implements ActionListener, al = afa.readFile(text, DataSourceType.PASTE, format); source = afa.getAlignFile(); - if (al != null) - { - al.setDataset(null); // set dataset on alignment/sequences - - /* - * SplitFrame option dependent on applet parameter for now. - */ - boolean allowSplitFrame = alignFrame.viewport.applet - .getDefaultParameter("enableSplitFrame", false); - if (allowSplitFrame && openSplitFrame(al, format)) + if (al != null) { - return; - } - if (newWindow) - { - AlignFrame af; - - if (source instanceof ComplexAlignFile) + al.setDataset(null); // set dataset on alignment/sequences + + /* + * SplitFrame option dependent on applet parameter for now. + */ + boolean allowSplitFrame = alignFrame.viewport.applet + .getDefaultParameter("enableSplitFrame", false); + if (allowSplitFrame && openSplitFrame(al, format)) { + return; + } + if (newWindow) + { + AlignFrame af; + + if (source instanceof ComplexAlignFile) + { HiddenColumns colSel = ((ComplexAlignFile) source) .getHiddenColumns(); - SequenceI[] hiddenSeqs = ((ComplexAlignFile) source) - .getHiddenSequences(); - boolean showSeqFeatures = ((ComplexAlignFile) source) - .isShowSeqFeatures(); - String colourSchemeName = ((ComplexAlignFile) source) - .getGlobalColourScheme(); - af = new AlignFrame(al, hiddenSeqs, colSel, - alignFrame.viewport.applet, "Cut & Paste input - " - + format, false); - af.getAlignViewport().setShowSequenceFeatures(showSeqFeatures); - ColourSchemeI cs = ColourSchemeMapper.getJalviewColourScheme( - colourSchemeName, al); - if (cs != null) + SequenceI[] hiddenSeqs = ((ComplexAlignFile) source) + .getHiddenSequences(); + boolean showSeqFeatures = ((ComplexAlignFile) source) + .isShowSeqFeatures(); + String colourSchemeName = ((ComplexAlignFile) source) + .getGlobalColourScheme(); + af = new AlignFrame(al, hiddenSeqs, colSel, + alignFrame.viewport.applet, + "Cut & Paste input - " + format, false); + af.getAlignViewport().setShowSequenceFeatures(showSeqFeatures); + ColourSchemeI cs = ColourSchemeMapper + .getJalviewColourScheme(colourSchemeName, al); + if (cs != null) + { + af.changeColour(cs); + } + } + else { - af.changeColour(cs); + af = new AlignFrame(al, alignFrame.viewport.applet, + "Cut & Paste input - " + format, false); + if (source instanceof FeaturesSourceI) + { + af.getAlignViewport().setShowSequenceFeatures(true); + } } + + af.statusBar.setText(MessageManager.getString( + "label.successfully_pasted_annotation_to_alignment")); } else { - af = new AlignFrame(al, alignFrame.viewport.applet, - "Cut & Paste input - " + format, false); - if (source instanceof FeaturesSourceI) - { - af.getAlignViewport().setShowSequenceFeatures(true); - } + alignFrame.addSequences(al.getSequencesArray()); + alignFrame.statusBar.setText(MessageManager + .getString("label.successfully_pasted_alignment_file")); } - - af.statusBar - .setText(MessageManager - .getString("label.successfully_pasted_annotation_to_alignment")); } - else - { - alignFrame.addSequences(al.getSequencesArray()); - alignFrame.statusBar.setText(MessageManager - .getString("label.successfully_pasted_alignment_file")); - } - } } catch (IOException ex) { ex.printStackTrace(); @@ -390,17 +389,17 @@ public class CutAndPasteTransfer extends Panel implements ActionListener, alignFrame.alignPanel.fontChanged(); alignFrame.changeColour(new TCoffeeColourScheme( alignFrame.viewport.getAlignment())); - alignFrame.statusBar - .setText(MessageManager - .getString("label.successfully_pasted_tcoffee_scores_to_alignment")); + alignFrame.statusBar.setText(MessageManager.getString( + "label.successfully_pasted_tcoffee_scores_to_alignment")); } else { // file valid but didn't get added to alignment for some reason alignFrame.statusBar.setText(MessageManager.formatMessage( - "label.failed_add_tcoffee_scores", - new Object[] { (tcf.getWarningMessage() != null ? tcf - .getWarningMessage() : "") })); + "label.failed_add_tcoffee_scores", new Object[] + { (tcf.getWarningMessage() != null + ? tcf.getWarningMessage() + : "") })); } } else @@ -418,9 +417,8 @@ public class CutAndPasteTransfer extends Panel implements ActionListener, { alignFrame.alignPanel.fontChanged(); alignFrame.alignPanel.setScrollValues(0, 0); - alignFrame.statusBar - .setText(MessageManager - .getString("label.successfully_pasted_annotation_to_alignment")); + alignFrame.statusBar.setText(MessageManager.getString( + "label.successfully_pasted_annotation_to_alignment")); } else @@ -428,9 +426,8 @@ public class CutAndPasteTransfer extends Panel implements ActionListener, if (!alignFrame.parseFeaturesFile(textarea.getText(), jalview.io.DataSourceType.PASTE)) { - alignFrame.statusBar - .setText(MessageManager - .getString("label.couldnt_parse_pasted_text_as_valid_annotation_feature_GFF_tcoffee_file")); + alignFrame.statusBar.setText(MessageManager.getString( + "label.couldnt_parse_pasted_text_as_valid_annotation_feature_GFF_tcoffee_file")); } } } @@ -487,8 +484,8 @@ public class CutAndPasteTransfer extends Panel implements ActionListener, private void jbInit() throws Exception { textarea.setFont(new java.awt.Font("Monospaced", Font.PLAIN, 10)); - textarea.setText(MessageManager - .getString("label.paste_your_alignment_file")); + textarea.setText( + MessageManager.getString("label.paste_your_alignment_file")); textarea.addMouseListener(this); this.setLayout(borderLayout1); accept.addActionListener(this); @@ -504,8 +501,8 @@ public class CutAndPasteTransfer extends Panel implements ActionListener, @Override public void mousePressed(MouseEvent evt) { - if (textarea.getText().startsWith( - MessageManager.getString("label.paste_your"))) + if (textarea.getText() + .startsWith(MessageManager.getString("label.paste_your"))) { textarea.setText(""); } diff --git a/src/jalview/appletgui/EmbmenuFrame.java b/src/jalview/appletgui/EmbmenuFrame.java index f61077a..53782c0 100644 --- a/src/jalview/appletgui/EmbmenuFrame.java +++ b/src/jalview/appletgui/EmbmenuFrame.java @@ -207,8 +207,8 @@ public class EmbmenuFrame extends Frame implements MouseListener if (popup != null) { embeddedMenu.add(popup); - popup.show(embeddedMenu, source.getBounds().x, source.getBounds().y - + source.getBounds().getSize().height); + popup.show(embeddedMenu, source.getBounds().x, + source.getBounds().y + source.getBounds().getSize().height); } } diff --git a/src/jalview/appletgui/ExtJmol.java b/src/jalview/appletgui/ExtJmol.java index b369318..3966536 100644 --- a/src/jalview/appletgui/ExtJmol.java +++ b/src/jalview/appletgui/ExtJmol.java @@ -49,9 +49,8 @@ public class ExtJmol extends JalviewJmolBinding private AlignmentPanel ap; - protected ExtJmol(AlignFrame alframe, - PDBEntry[] pdbentry, SequenceI[][] seq, - DataSourceType protocol) + protected ExtJmol(AlignFrame alframe, PDBEntry[] pdbentry, + SequenceI[][] seq, DataSourceType protocol) { super(alframe.alignPanel.getStructureSelectionManager(), pdbentry, seq, protocol); @@ -173,8 +172,8 @@ public class ExtJmol extends JalviewJmolBinding { // This never gets called because we haven't overriden the associated Jmol's // console - System.err - .println("WARNING: unexpected call to ExtJmol's showConsole method. (showConsole=" + System.err.println( + "WARNING: unexpected call to ExtJmol's showConsole method. (showConsole=" + show); } diff --git a/src/jalview/appletgui/FeatureColourChooser.java b/src/jalview/appletgui/FeatureColourChooser.java index 72fa982..0d479f9 100644 --- a/src/jalview/appletgui/FeatureColourChooser.java +++ b/src/jalview/appletgui/FeatureColourChooser.java @@ -156,8 +156,8 @@ public class FeatureColourChooser extends Panel implements ActionListener, } catch (Exception ex) { } - threshold.select(cs.isAboveThreshold() ? 1 : (cs.isBelowThreshold() ? 2 - : 0)); + threshold.select( + cs.isAboveThreshold() ? 1 : (cs.isBelowThreshold() ? 2 : 0)); adjusting = false; changeColour(true); @@ -165,9 +165,9 @@ public class FeatureColourChooser extends Panel implements ActionListener, slider.addAdjustmentListener(this); slider.addMouseListener(this); owner = (af != null) ? af : fs.frame; - frame = new JVDialog(owner, MessageManager.formatMessage( - "label.graduated_color_for_params", new String[] { type }), - true, 480, 248); + frame = new JVDialog(owner, MessageManager + .formatMessage("label.graduated_color_for_params", new String[] + { type }), true, 480, 248); frame.setMainPanel(this); validate(); frame.setVisible(true); @@ -196,8 +196,8 @@ public class FeatureColourChooser extends Panel implements ActionListener, private void jbInit() throws Exception { - Label minLabel = new Label(MessageManager.getString("label.min")), maxLabel = new Label( - MessageManager.getString("label.max")); + Label minLabel = new Label(MessageManager.getString("label.min")), + maxLabel = new Label(MessageManager.getString("label.max")); minLabel.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); maxLabel.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); // minColour.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); @@ -243,13 +243,13 @@ public class FeatureColourChooser extends Panel implements ActionListener, jPanel3.setBackground(Color.white); colourFromLabel.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); - colourFromLabel.setLabel(MessageManager - .getString("label.colour_by_label")); + colourFromLabel + .setLabel(MessageManager.getString("label.colour_by_label")); colourFromLabel.setSize(new Dimension(139, 22)); // threshold.setBounds(new Rectangle(11, 3, 139, 22)); thresholdIsMin.setBackground(Color.white); - thresholdIsMin.setLabel(MessageManager - .getString("label.threshold_minmax")); + thresholdIsMin + .setLabel(MessageManager.getString("label.threshold_minmax")); thresholdIsMin.setSize(new Dimension(135, 23)); // thresholdIsMin.setBounds(new Rectangle(328, 3, 135, 23)); jPanel1.add(minLabel); @@ -338,9 +338,9 @@ public class FeatureColourChooser extends Panel implements ActionListener, { if (newCol == null) { - new UserDefinedColours(this, - minColour.getBackground(), owner, - MessageManager.getString("label.select_colour_minimum_value")); + new UserDefinedColours(this, minColour.getBackground(), owner, + MessageManager + .getString("label.select_colour_minimum_value")); } else { @@ -356,9 +356,9 @@ public class FeatureColourChooser extends Panel implements ActionListener, { if (newCol == null) { - new UserDefinedColours(this, - maxColour.getBackground(), owner, - MessageManager.getString("label.select_colour_maximum_value")); + new UserDefinedColours(this, maxColour.getBackground(), owner, + MessageManager + .getString("label.select_colour_maximum_value")); } else { @@ -416,8 +416,10 @@ public class FeatureColourChooser extends Panel implements ActionListener, adjusting = false; } - acg.setAboveThreshold(thresholdOption == AnnotationColourGradient.ABOVE_THRESHOLD); - acg.setBelowThreshold(thresholdOption == AnnotationColourGradient.BELOW_THRESHOLD); + acg.setAboveThreshold( + thresholdOption == AnnotationColourGradient.ABOVE_THRESHOLD); + acg.setBelowThreshold( + thresholdOption == AnnotationColourGradient.BELOW_THRESHOLD); if (thresholdIsMin.getState() && thresholdOption != AnnotationColourGradient.NO_THRESHOLD) diff --git a/src/jalview/appletgui/FeatureRenderer.java b/src/jalview/appletgui/FeatureRenderer.java index 3c2715f..194b18f 100644 --- a/src/jalview/appletgui/FeatureRenderer.java +++ b/src/jalview/appletgui/FeatureRenderer.java @@ -61,8 +61,8 @@ import java.util.List; * @author $author$ * @version $Revision$ */ -public class FeatureRenderer extends - jalview.renderer.seqfeatures.FeatureRenderer +public class FeatureRenderer + extends jalview.renderer.seqfeatures.FeatureRenderer { /* * creating a new feature defaults to the type and group as @@ -269,8 +269,8 @@ public class FeatureRenderer extends FeatureColourI col = getFeatureStyle(name.getText()); if (col == null) { - Color generatedColour = ColorUtils.createColourFromName(name - .getText()); + Color generatedColour = ColorUtils + .createColourFromName(name.getText()); col = new FeatureColour(generatedColour); } @@ -285,17 +285,20 @@ public class FeatureRenderer extends tmp = new Panel(); panel.add(tmp); - tmp.add(new Label(MessageManager.getString("label.name:"), Label.RIGHT)); + tmp.add(new Label(MessageManager.getString("label.name:"), + Label.RIGHT)); tmp.add(name); tmp = new Panel(); panel.add(tmp); - tmp.add(new Label(MessageManager.getString("label.group:"), Label.RIGHT)); + tmp.add(new Label(MessageManager.getString("label.group:"), + Label.RIGHT)); tmp.add(group); tmp = new Panel(); panel.add(tmp); - tmp.add(new Label(MessageManager.getString("label.colour"), Label.RIGHT)); + tmp.add(new Label(MessageManager.getString("label.colour"), + Label.RIGHT)); tmp.add(colourPanel); bigPanel.add(panel, BorderLayout.NORTH); @@ -330,15 +333,16 @@ public class FeatureRenderer extends */ SequenceFeature firstFeature = features.get(0); boolean useLastDefaults = firstFeature.getType() == null; - String featureType = useLastDefaults ? lastFeatureAdded : firstFeature - .getType(); + String featureType = useLastDefaults ? lastFeatureAdded + : firstFeature.getType(); String featureGroup = useLastDefaults ? lastFeatureGroupAdded : firstFeature.getFeatureGroup(); - String title = create ? MessageManager - .getString("label.create_new_sequence_features") + String title = create + ? MessageManager.getString("label.create_new_sequence_features") : MessageManager.formatMessage("label.amend_delete_features", - new String[] { sequences.get(0).getName() }); + new String[] + { sequences.get(0).getName() }); final JVDialog dialog = new JVDialog(ap.alignFrame, title, true, 385, 240); @@ -417,7 +421,8 @@ public class FeatureRenderer extends if (!colourPanel.isGcol) { // update colour - otherwise its already done. - setColour(sf.type, new FeatureColour(colourPanel.getBackground())); + setColour(sf.type, + new FeatureColour(colourPanel.getBackground())); } try { @@ -427,8 +432,8 @@ public class FeatureRenderer extends { // } - boolean typeOrGroupChanged = (!featureType.equals(sf.type) || !featureGroup - .equals(sf.featureGroup)); + boolean typeOrGroupChanged = (!featureType.equals(sf.type) + || !featureGroup.equals(sf.featureGroup)); ffile.parseDescriptionHTML(sf, false); if (typeOrGroupChanged) @@ -454,8 +459,8 @@ public class FeatureRenderer extends { features.get(i).type = enteredType; features.get(i).featureGroup = group.getText().trim(); - features.get(i).description = description.getText() - .replace('\n', ' '); + features.get(i).description = description.getText().replace('\n', + ' '); sequences.get(i).addSequenceFeature(features.get(i)); ffile.parseDescriptionHTML(features.get(i), false); } diff --git a/src/jalview/appletgui/FeatureSettings.java b/src/jalview/appletgui/FeatureSettings.java index 7d00afd..5e15364 100755 --- a/src/jalview/appletgui/FeatureSettings.java +++ b/src/jalview/appletgui/FeatureSettings.java @@ -64,9 +64,9 @@ import java.util.Map; import java.util.Set; import java.util.Vector; -public class FeatureSettings extends Panel implements ItemListener, - MouseListener, MouseMotionListener, ActionListener, - AdjustmentListener, FeatureSettingsControllerI +public class FeatureSettings extends Panel + implements ItemListener, MouseListener, MouseMotionListener, + ActionListener, AdjustmentListener, FeatureSettingsControllerI { FeatureRenderer fr; @@ -136,11 +136,18 @@ public class FeatureSettings extends Panel implements ItemListener, add(lowerPanel, BorderLayout.SOUTH); - groupPanel.setLayout(new GridLayout( - (fr.getFeatureGroupsSize()) / 4 + 1, 4)); // JBPNote - this was - // scaled on number of - // visible groups. seems - // broken + groupPanel.setLayout( + new GridLayout((fr.getFeatureGroupsSize()) / 4 + 1, 4)); // JBPNote + // - this + // was + // scaled + // on + // number + // of + // visible + // groups. + // seems + // broken groupPanel.validate(); add(groupPanel, BorderLayout.NORTH); @@ -175,14 +182,12 @@ public class FeatureSettings extends Panel implements ItemListener, public void paint(Graphics g) { g.setColor(Color.black); - g.drawString(MessageManager - .getString("label.no_features_added_to_this_alignment"), 10, 20); - g.drawString(MessageManager - .getString("label.features_can_be_added_from_searches_1"), 10, - 40); - g.drawString(MessageManager - .getString("label.features_can_be_added_from_searches_2"), 10, - 60); + g.drawString(MessageManager.getString( + "label.no_features_added_to_this_alignment"), 10, 20); + g.drawString(MessageManager.getString( + "label.features_can_be_added_from_searches_1"), 10, 40); + g.drawString(MessageManager.getString( + "label.features_can_be_added_from_searches_2"), 10, 60); } protected void popupSort(final MyCheckbox check, @@ -190,8 +195,9 @@ public class FeatureSettings extends Panel implements ItemListener, { final String type = check.type; final FeatureColourI typeCol = fr.getFeatureStyle(type); - PopupMenu men = new PopupMenu(MessageManager.formatMessage( - "label.settings_for_type", new String[] { type })); + PopupMenu men = new PopupMenu(MessageManager + .formatMessage("label.settings_for_type", new String[] + { type })); java.awt.MenuItem scr = new MenuItem( MessageManager.getString("label.sort_by_score")); men.add(scr); @@ -202,8 +208,9 @@ public class FeatureSettings extends Panel implements ItemListener, @Override public void actionPerformed(ActionEvent e) { - me.ap.alignFrame.avc.sortAlignmentByFeatureScore(Arrays - .asList(new String[] { type })); + me.ap.alignFrame.avc + .sortAlignmentByFeatureScore(Arrays.asList(new String[] + { type })); } }); @@ -215,8 +222,9 @@ public class FeatureSettings extends Panel implements ItemListener, @Override public void actionPerformed(ActionEvent e) { - me.ap.alignFrame.avc.sortAlignmentByFeatureDensity(Arrays - .asList(new String[] { type })); + me.ap.alignFrame.avc + .sortAlignmentByFeatureDensity(Arrays.asList(new String[] + { type })); } }); @@ -280,8 +288,8 @@ public class FeatureSettings extends Panel implements ItemListener, }); men.add(selectContaining); - MenuItem selectNotContaining = new MenuItem( - MessageManager.getString("label.select_columns_not_containing")); + MenuItem selectNotContaining = new MenuItem(MessageManager + .getString("label.select_columns_not_containing")); selectNotContaining.addActionListener(new ActionListener() { @Override @@ -453,8 +461,8 @@ public class FeatureSettings extends Panel implements ItemListener, addCheck(groupsChanged, en.nextElement().toString()); } - featurePanel.setLayout(new GridLayout(featurePanel.getComponentCount(), - 1, 10, 5)); + featurePanel.setLayout( + new GridLayout(featurePanel.getComponentCount(), 1, 10, 5)); featurePanel.validate(); if (scrollPane != null) @@ -633,8 +641,8 @@ public class FeatureSettings extends Panel implements ItemListener, } else { - comp = featurePanel.getComponentAt(evt.getX(), evt.getY() - + evt.getComponent().getLocation().y); + comp = featurePanel.getComponentAt(evt.getX(), + evt.getY() + evt.getComponent().getLocation().y); } if (comp != null && comp instanceof Checkbox) diff --git a/src/jalview/appletgui/Finder.java b/src/jalview/appletgui/Finder.java index f7ebab6..3e089bd 100644 --- a/src/jalview/appletgui/Finder.java +++ b/src/jalview/appletgui/Finder.java @@ -122,9 +122,8 @@ public class Finder extends Panel implements ActionListener for (SearchResultMatchI match : searchResults.getResults()) { seqs.add(match.getSequence().getDatasetSequence()); - features.add(new SequenceFeature(searchString, - "Search Results", null, match.getStart(), match.getEnd(), - "Search Results")); + features.add(new SequenceFeature(searchString, "Search Results", null, + match.getStart(), match.getEnd(), "Search Results")); } if (ap.seqPanel.seqCanvas.getFeatureRenderer().amendFeatures(seqs, @@ -187,8 +186,8 @@ public class Finder extends Panel implements ActionListener // 'SelectRegion' selection if (!haveResults) { - ap.alignFrame.statusBar.setText(MessageManager - .getString("label.finished_searching")); + ap.alignFrame.statusBar.setText( + MessageManager.getString("label.finished_searching")); resIndex = -1; seqIndex = 0; } @@ -196,8 +195,8 @@ public class Finder extends Panel implements ActionListener { if (findAll) { - String message = (idMatch.size() > 0) ? "" + idMatch.size() - + " IDs" : ""; + String message = (idMatch.size() > 0) ? "" + idMatch.size() + " IDs" + : ""; if (idMatch.size() > 0 && searchResults != null && searchResults.getSize() > 0) { @@ -207,16 +206,17 @@ public class Finder extends Panel implements ActionListener { message += searchResults.getSize() + " subsequence matches."; } - ap.alignFrame.statusBar.setText(MessageManager.formatMessage( - "label.search_results", new String[] { searchString, - message })); + ap.alignFrame.statusBar.setText(MessageManager + .formatMessage("label.search_results", new String[] + { searchString, message })); } else { // TODO: indicate sequence and matching position in status bar - ap.alignFrame.statusBar.setText(MessageManager.formatMessage( - "label.found_match_for", new String[] { searchString })); + ap.alignFrame.statusBar.setText(MessageManager + .formatMessage("label.found_match_for", new String[] + { searchString })); } } } @@ -276,8 +276,8 @@ public class Finder extends Panel implements ActionListener caseSensitive.setLabel(MessageManager.getString("label.match_case")); caseSensitive.setBounds(new Rectangle(30, 39, 126, 23)); - searchDescription.setLabel(MessageManager - .getString("label.include_description")); + searchDescription.setLabel( + MessageManager.getString("label.include_description")); searchDescription.setBounds(new Rectangle(30, 59, 170, 23)); actionsPanel.add(findNext, null); actionsPanel.add(findAll, null); diff --git a/src/jalview/appletgui/FontChooser.java b/src/jalview/appletgui/FontChooser.java index 991fb96..c9a92b2 100644 --- a/src/jalview/appletgui/FontChooser.java +++ b/src/jalview/appletgui/FontChooser.java @@ -290,11 +290,11 @@ public class FontChooser extends Panel implements ItemListener } Font newFont = new Font(fontName.getSelectedItem().toString(), - fontStyle.getSelectedIndex(), Integer.parseInt(fontSize - .getSelectedItem().toString())); + fontStyle.getSelectedIndex(), + Integer.parseInt(fontSize.getSelectedItem().toString())); FontMetrics fm = getGraphics().getFontMetrics(newFont); - double mw = fm.getStringBounds("M", getGraphics()).getWidth(), iw = fm - .getStringBounds("I", getGraphics()).getWidth(); + double mw = fm.getStringBounds("M", getGraphics()).getWidth(), + iw = fm.getStringBounds("I", getGraphics()).getWidth(); if (mw < 1 || iw < 1) { // TODO: JAL-1100 @@ -481,8 +481,8 @@ public class FontChooser extends Panel implements ItemListener protected void scaleAsCdna_actionPerformed() { ap.av.setScaleProteinAsCdna(scaleAsCdna.getState()); - ap.av.getCodingComplement().setScaleProteinAsCdna( - scaleAsCdna.getState()); + ap.av.getCodingComplement() + .setScaleProteinAsCdna(scaleAsCdna.getState()); changeFont(); } diff --git a/src/jalview/appletgui/IdCanvas.java b/src/jalview/appletgui/IdCanvas.java index 48c0c40..5eddc4f 100755 --- a/src/jalview/appletgui/IdCanvas.java +++ b/src/jalview/appletgui/IdCanvas.java @@ -118,7 +118,7 @@ public class IdCanvas extends Panel implements ViewportListenerI ss = es - vertical; if (ss < ranges.getStartSeq()) // ie scrolling too fast, more than a page // at a - // time + // time { ss = ranges.getStartSeq(); } @@ -183,8 +183,8 @@ public class IdCanvas extends Panel implements ViewportListenerI // Fill in the background gg.setColor(Color.white); - Font italic = new Font(av.getFont().getName(), Font.ITALIC, av - .getFont().getSize()); + Font italic = new Font(av.getFont().getName(), Font.ITALIC, + av.getFont().getSize()); gg.setFont(italic); gg.fillRect(0, 0, getSize().width, getSize().height); @@ -224,8 +224,8 @@ public class IdCanvas extends Panel implements ViewportListenerI continue; } // hardwired italic IDs in applet currently - Font italic = new Font(av.getFont().getName(), Font.ITALIC, av - .getFont().getSize()); + Font italic = new Font(av.getFont().getName(), Font.ITALIC, + av.getFont().getSize()); gg.setFont(italic); // boolean isrep=false; if (doHiddenCheck) @@ -309,8 +309,8 @@ public class IdCanvas extends Panel implements ViewportListenerI int rowSize = av.getRanges().getViewportWidth(); // hardwired italic IDs in applet currently - Font italic = new Font(av.getFont().getName(), Font.ITALIC, av - .getFont().getSize()); + Font italic = new Font(av.getFont().getName(), Font.ITALIC, + av.getFont().getSize()); gg.setFont(italic); /* @@ -352,7 +352,8 @@ public class IdCanvas extends Panel implements ViewportListenerI void drawMarker(int i, int starty, int yoffset) { - SequenceI[] hseqs = av.getAlignment().getHiddenSequences().hiddenSequences; + SequenceI[] hseqs = av.getAlignment() + .getHiddenSequences().hiddenSequences; // Use this method here instead of calling hiddenSeq adjust // 3 times. int hSize = hseqs.length; @@ -386,27 +387,36 @@ public class IdCanvas extends Panel implements ViewportListenerI gg.setColor(Color.blue); if (below) { - gg.fillPolygon(new int[] { getSize().width - avcharHeight, - getSize().width - avcharHeight, getSize().width }, new int[] { - (i - starty) * avcharHeight + yoffset, - (i - starty) * avcharHeight + yoffset + avcharHeight / 4, - (i - starty) * avcharHeight + yoffset }, 3); + gg.fillPolygon( + new int[] + { getSize().width - avcharHeight, + getSize().width - avcharHeight, getSize().width }, + new int[] + { (i - starty) * avcharHeight + yoffset, + (i - starty) * avcharHeight + yoffset + avcharHeight / 4, + (i - starty) * avcharHeight + yoffset }, + 3); } if (above) { - gg.fillPolygon(new int[] { getSize().width - avcharHeight, - getSize().width - avcharHeight, getSize().width }, new int[] { - (i - starty + 1) * avcharHeight + yoffset, - (i - starty + 1) * avcharHeight + yoffset - avcharHeight / 4, - (i - starty + 1) * avcharHeight + yoffset }, 3); + gg.fillPolygon( + new int[] + { getSize().width - avcharHeight, + getSize().width - avcharHeight, getSize().width }, + new int[] + { (i - starty + 1) * avcharHeight + yoffset, + (i - starty + 1) * avcharHeight + yoffset + - avcharHeight / 4, + (i - starty + 1) * avcharHeight + yoffset }, + 3); } } boolean setHiddenFont(SequenceI seq) { - Font bold = new Font(av.getFont().getName(), Font.BOLD, av.getFont() - .getSize()); + Font bold = new Font(av.getFont().getName(), Font.BOLD, + av.getFont().getSize()); if (av.isReferenceSeq(seq) || av.isHiddenRepSequence(seq)) { @@ -433,8 +443,8 @@ public class IdCanvas extends Panel implements ViewportListenerI { String propertyName = evt.getPropertyName(); if (propertyName.equals(ViewportRanges.STARTSEQ) - || (av.getWrapAlignment() && propertyName - .equals(ViewportRanges.STARTRES))) + || (av.getWrapAlignment() + && propertyName.equals(ViewportRanges.STARTRES))) { fastPaint((int) evt.getNewValue() - (int) evt.getOldValue()); } diff --git a/src/jalview/appletgui/IdPanel.java b/src/jalview/appletgui/IdPanel.java index 66eb053..8ac02be 100755 --- a/src/jalview/appletgui/IdPanel.java +++ b/src/jalview/appletgui/IdPanel.java @@ -39,8 +39,8 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; -public class IdPanel extends Panel implements MouseListener, - MouseMotionListener +public class IdPanel extends Panel + implements MouseListener, MouseMotionListener { protected IdCanvas idCanvas; @@ -177,13 +177,14 @@ public class IdPanel extends Panel implements MouseListener, } if (tooltip == null) { - tooltip = new Tooltip(sequence.getDisplayId(true) + "\n" - + tooltiptext.toString(), idCanvas); + tooltip = new Tooltip( + sequence.getDisplayId(true) + "\n" + tooltiptext.toString(), + idCanvas); } else { - tooltip.setTip(sequence.getDisplayId(true) + "\n" - + tooltiptext.toString()); + tooltip.setTip( + sequence.getDisplayId(true) + "\n" + tooltiptext.toString()); } tooltiptext = null; } @@ -286,7 +287,8 @@ public class IdPanel extends Panel implements MouseListener, int seq = alignPanel.seqPanel.findSeq(e); - if ((e.getModifiers() & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK) + if ((e.getModifiers() + & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK) { Sequence sq = (Sequence) av.getAlignment().getSequenceAt(seq); @@ -323,8 +325,8 @@ public class IdPanel extends Panel implements MouseListener, } if ((av.getSelectionGroup() == null) - || ((!jalview.util.Platform.isControlDown(e) && !e - .isShiftDown()) && av.getSelectionGroup() != null)) + || ((!jalview.util.Platform.isControlDown(e) + && !e.isShiftDown()) && av.getSelectionGroup() != null)) { av.setSelectionGroup(new SequenceGroup()); av.getSelectionGroup().setStartRes(0); @@ -373,8 +375,8 @@ public class IdPanel extends Panel implements MouseListener, } for (int i = start; i <= end; i++) { - av.getSelectionGroup().addSequence( - av.getAlignment().getSequenceAt(i), i == end); + av.getSelectionGroup().addSequence(av.getAlignment().getSequenceAt(i), + i == end); } } diff --git a/src/jalview/appletgui/IdwidthAdjuster.java b/src/jalview/appletgui/IdwidthAdjuster.java index b537112..75e3243 100755 --- a/src/jalview/appletgui/IdwidthAdjuster.java +++ b/src/jalview/appletgui/IdwidthAdjuster.java @@ -29,8 +29,8 @@ import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; -public class IdwidthAdjuster extends Panel implements MouseListener, - MouseMotionListener +public class IdwidthAdjuster extends Panel + implements MouseListener, MouseMotionListener { boolean active = false; diff --git a/src/jalview/appletgui/JVDialog.java b/src/jalview/appletgui/JVDialog.java index a7cc83f..9853d98 100644 --- a/src/jalview/appletgui/JVDialog.java +++ b/src/jalview/appletgui/JVDialog.java @@ -58,8 +58,8 @@ public class JVDialog extends Dialog implements ActionListener width, height); } - public JVDialog(Frame owner, Panel mainPanel, String title, - boolean modal, int width, int height) + public JVDialog(Frame owner, Panel mainPanel, String title, boolean modal, + int width, int height) { super(owner, title, modal); this.owner = owner; diff --git a/src/jalview/appletgui/OverviewPanel.java b/src/jalview/appletgui/OverviewPanel.java index 456a38c..be552c0 100755 --- a/src/jalview/appletgui/OverviewPanel.java +++ b/src/jalview/appletgui/OverviewPanel.java @@ -67,7 +67,8 @@ public class OverviewPanel extends Panel implements Runnable, setLayout(null); od = new OverviewDimensionsShowHidden(av.getRanges(), - (av.isShowAnnotation() && av.getSequenceConsensusHash() != null)); + (av.isShowAnnotation() + && av.getSequenceConsensusHash() != null)); oviewCanvas = new OverviewCanvas(od, av); setLayout(new BorderLayout()); @@ -112,7 +113,8 @@ public class OverviewPanel extends Panel implements Runnable, @Override public void mouseClicked(MouseEvent evt) { - if ((evt.getModifiers() & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK) + if ((evt.getModifiers() + & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK) { showPopupMenu(evt); } @@ -177,7 +179,8 @@ public class OverviewPanel extends Panel implements Runnable, @Override public void mouseDragged(MouseEvent evt) { - if ((evt.getModifiers() & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK) + if ((evt.getModifiers() + & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK) { if (!Platform.isAMac()) { @@ -244,8 +247,8 @@ public class OverviewPanel extends Panel implements Runnable, public void run() { oviewCanvas.draw(av.isShowSequenceFeatures(), - (av.isShowAnnotation() && av - .getAlignmentConservationAnnotation() != null), + (av.isShowAnnotation() + && av.getAlignmentConservationAnnotation() != null), ap.seqPanel.seqCanvas.getFeatureRenderer()); setBoxPosition(); } @@ -257,9 +260,8 @@ public class OverviewPanel extends Panel implements Runnable, */ private void setBoxPosition() { - od.setBoxPosition(av.getAlignment() -.getHiddenSequences(), av - .getAlignment().getHiddenColumns()); + od.setBoxPosition(av.getAlignment().getHiddenSequences(), + av.getAlignment().getHiddenColumns()); repaint(); } @@ -301,15 +303,15 @@ public class OverviewPanel extends Panel implements Runnable, { showHidden = false; od = new OverviewDimensionsHideHidden(av.getRanges(), - (av.isShowAnnotation() && av - .getAlignmentConservationAnnotation() != null)); + (av.isShowAnnotation() + && av.getAlignmentConservationAnnotation() != null)); } else { showHidden = true; od = new OverviewDimensionsShowHidden(av.getRanges(), - (av.isShowAnnotation() && av - .getAlignmentConservationAnnotation() != null)); + (av.isShowAnnotation() + && av.getAlignmentConservationAnnotation() != null)); } oviewCanvas.resetOviewDims(od); updateOverviewImage(); diff --git a/src/jalview/appletgui/PCAPanel.java b/src/jalview/appletgui/PCAPanel.java index 5dc57f9..fc1d359 100644 --- a/src/jalview/appletgui/PCAPanel.java +++ b/src/jalview/appletgui/PCAPanel.java @@ -48,8 +48,8 @@ import java.awt.event.ActionListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; -public class PCAPanel extends EmbmenuFrame implements Runnable, - ActionListener, ItemListener +public class PCAPanel extends EmbmenuFrame + implements Runnable, ActionListener, ItemListener { RotatableCanvas rc; @@ -88,7 +88,8 @@ public class PCAPanel extends EmbmenuFrame implements Runnable, } else { - seqs = viewport.getSelectionGroup().getSequencesInOrder(viewport.getAlignment()); + seqs = viewport.getSelectionGroup() + .getSequencesInOrder(viewport.getAlignment()); } SeqCigar sq[] = seqstrings.getSequences(); int length = sq[0].getWidth(); @@ -103,8 +104,8 @@ public class PCAPanel extends EmbmenuFrame implements Runnable, } } - ScoreModelI scoreModel = ScoreModels.getInstance().getDefaultModel( - !nucleotide); + ScoreModelI scoreModel = ScoreModels.getInstance() + .getDefaultModel(!nucleotide); pcaModel = new PCAModel(seqstrings, seqs, nucleotide, scoreModel, SimilarityParams.SeqSpace); @@ -216,8 +217,8 @@ public class PCAPanel extends EmbmenuFrame implements Runnable, if (!pcaModel.isNucleotide()) { pcaModel.setNucleotide(true); - ScoreModelI scoreModel = ScoreModels.getInstance().getDefaultModel( - false); + ScoreModelI scoreModel = ScoreModels.getInstance() + .getDefaultModel(false); pcaModel.setScoreModel(scoreModel); new Thread(this).start(); } @@ -227,8 +228,8 @@ public class PCAPanel extends EmbmenuFrame implements Runnable, if (pcaModel.isNucleotide()) { pcaModel.setNucleotide(false); - ScoreModelI scoreModel = ScoreModels.getInstance().getDefaultModel( - true); + ScoreModelI scoreModel = ScoreModels.getInstance() + .getDefaultModel(true); pcaModel.setScoreModel(scoreModel); new Thread(this).start(); } @@ -286,11 +287,11 @@ public class PCAPanel extends EmbmenuFrame implements Runnable, if (alAndColsel != null && alAndColsel[0] != null) { Alignment al = new Alignment((SequenceI[]) alAndColsel[0]); - AlignFrame af = new AlignFrame(al, av.applet, - "Original Data for PCA", false); + AlignFrame af = new AlignFrame(al, av.applet, "Original Data for PCA", + false); - af.viewport.getAlignment().setHiddenColumns( - (HiddenColumns) alAndColsel[1]); + af.viewport.getAlignment() + .setHiddenColumns((HiddenColumns) alAndColsel[1]); } } @@ -366,8 +367,8 @@ public class PCAPanel extends EmbmenuFrame implements Runnable, values.setLabel(MessageManager.getString("label.output_values")); values.addActionListener(this); inputData.setLabel(MessageManager.getString("label.input_data")); - nuclSetting.setLabel(MessageManager - .getString("label.nucleotide_matrix")); + nuclSetting + .setLabel(MessageManager.getString("label.nucleotide_matrix")); nuclSetting.addItemListener(this); protSetting.setLabel(MessageManager.getString("label.protein_matrix")); protSetting.addItemListener(this); diff --git a/src/jalview/appletgui/PairwiseAlignPanel.java b/src/jalview/appletgui/PairwiseAlignPanel.java index 7574802..bc775c6 100644 --- a/src/jalview/appletgui/PairwiseAlignPanel.java +++ b/src/jalview/appletgui/PairwiseAlignPanel.java @@ -62,8 +62,8 @@ public class PairwiseAlignPanel extends Panel implements ActionListener } else { - seqs = ap.av.getSelectionGroup().getSequencesInOrder( - ap.av.getAlignment()); + seqs = ap.av.getSelectionGroup() + .getSequencesInOrder(ap.av.getAlignment()); } float scores[][] = new float[seqs.length][seqs.length]; @@ -102,13 +102,13 @@ public class PairwiseAlignPanel extends Panel implements ActionListener if (count > 2) { - System.out - .println("Pairwise alignment scaled similarity score matrix\n"); + System.out.println( + "Pairwise alignment scaled similarity score matrix\n"); for (int i = 0; i < count; i++) { - jalview.util.Format.print(System.out, "%s \n", ("" + i) + " " - + seqs[i].getName()); + jalview.util.Format.print(System.out, "%s \n", + ("" + i) + " " + seqs[i].getName()); } System.out.println("\n"); @@ -117,8 +117,8 @@ public class PairwiseAlignPanel extends Panel implements ActionListener { for (int j = 0; j < i; j++) { - jalview.util.Format.print(System.out, "%7.3f", scores[i][j] - / totscore); + jalview.util.Format.print(System.out, "%7.3f", + scores[i][j] / totscore); } } @@ -165,8 +165,8 @@ public class PairwiseAlignPanel extends Panel implements ActionListener textarea.setFont(new java.awt.Font("Monospaced", 0, 12)); textarea.setText(""); viewInEditorButton.setFont(new java.awt.Font("Verdana", 0, 12)); - viewInEditorButton.setLabel(MessageManager - .getString("label.view_alignment_editor")); + viewInEditorButton.setLabel( + MessageManager.getString("label.view_alignment_editor")); viewInEditorButton.addActionListener(this); this.add(scrollPane, BorderLayout.CENTER); scrollPane.add(textarea); diff --git a/src/jalview/appletgui/RedundancyPanel.java b/src/jalview/appletgui/RedundancyPanel.java index 6be416c..2aba20c 100644 --- a/src/jalview/appletgui/RedundancyPanel.java +++ b/src/jalview/appletgui/RedundancyPanel.java @@ -40,8 +40,8 @@ import java.util.List; import java.util.Stack; import java.util.Vector; -public class RedundancyPanel extends SliderPanel implements Runnable, - WindowListener +public class RedundancyPanel extends SliderPanel + implements Runnable, WindowListener { Stack historyList = new Stack(); // simpler than synching with alignFrame. @@ -63,8 +63,8 @@ public class RedundancyPanel extends SliderPanel implements Runnable, applyButton.setVisible(true); allGroupsCheck.setVisible(false); - label.setText(MessageManager - .getString("label.enter_redundancy_threshold")); + label.setText( + MessageManager.getString("label.enter_redundancy_threshold")); valueField.setText("100"); slider.setVisibleAmount(1); @@ -140,8 +140,8 @@ public class RedundancyPanel extends SliderPanel implements Runnable, redundancy = AlignSeq.computeRedundancyMatrix(originalSequences, omitHidden, start, end, false); - label.setText(MessageManager - .getString("label.enter_redundancy_threshold")); + label.setText( + MessageManager.getString("label.enter_redundancy_threshold")); slider.setVisible(true); applyButton.setEnabled(true); valueField.setVisible(true); @@ -227,8 +227,8 @@ public class RedundancyPanel extends SliderPanel implements Runnable, ap.alignFrame.addHistoryItem(cut); PaintRefresher.Refresh(this, ap.av.getSequenceSetId(), true, true); - ap.av.firePropertyChange("alignment", null, ap.av.getAlignment() - .getSequences()); + ap.av.firePropertyChange("alignment", null, + ap.av.getAlignment().getSequences()); } } @@ -243,8 +243,8 @@ public class RedundancyPanel extends SliderPanel implements Runnable, { ap.av.getHistoryList().remove(command); ap.alignFrame.updateEditMenuBar(); - ap.av.firePropertyChange("alignment", null, ap.av.getAlignment() - .getSequences()); + ap.av.firePropertyChange("alignment", null, + ap.av.getAlignment().getSequences()); } ap.paintAlignment(true); diff --git a/src/jalview/appletgui/RotatableCanvas.java b/src/jalview/appletgui/RotatableCanvas.java index 5c91ea8..afb4e95 100755 --- a/src/jalview/appletgui/RotatableCanvas.java +++ b/src/jalview/appletgui/RotatableCanvas.java @@ -331,8 +331,9 @@ public class RotatableCanvas extends Panel implements MouseListener, if (points == null) { g.setFont(new Font("Verdana", Font.PLAIN, 18)); - g.drawString(MessageManager.getString("label.calculating_pca") - + "....", 20, getSize().height / 2); + g.drawString( + MessageManager.getString("label.calculating_pca") + "....", + 20, getSize().height / 2); } else { @@ -609,8 +610,10 @@ public class RotatableCanvas extends Panel implements MouseListener, for (int i = 0; i < npoint; i++) { SequencePoint sp = (SequencePoint) points.elementAt(i); - int tmp1 = (int) ((sp.coord[0] - centre[0]) * scale + (float) getSize().width / 2.0); - int tmp2 = (int) ((sp.coord[1] - centre[1]) * scale + (float) getSize().height / 2.0); + int tmp1 = (int) ((sp.coord[0] - centre[0]) * scale + + (float) getSize().width / 2.0); + int tmp2 = (int) ((sp.coord[1] - centre[1]) * scale + + (float) getSize().height / 2.0); if (tmp1 > x1 && tmp1 < x2 && tmp2 > y1 && tmp2 < y2) { diff --git a/src/jalview/appletgui/ScalePanel.java b/src/jalview/appletgui/ScalePanel.java index 5e0a2fd..514c3f9 100755 --- a/src/jalview/appletgui/ScalePanel.java +++ b/src/jalview/appletgui/ScalePanel.java @@ -44,8 +44,8 @@ import java.awt.event.MouseMotionListener; import java.beans.PropertyChangeEvent; import java.util.List; -public class ScalePanel extends Panel implements MouseMotionListener, - MouseListener, ViewportListenerI +public class ScalePanel extends Panel + implements MouseMotionListener, MouseListener, ViewportListenerI { protected int offy = 4; @@ -95,7 +95,8 @@ public class ScalePanel extends Panel implements MouseMotionListener, min = res; max = res; - if ((evt.getModifiers() & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK) + if ((evt.getModifiers() + & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK) { rightMouseButtonPressed(evt, res); } @@ -157,7 +158,8 @@ public class ScalePanel extends Panel implements MouseMotionListener, PopupMenu pop = new PopupMenu(); if (reveal != null) { - MenuItem item = new MenuItem(MessageManager.getString("label.reveal")); + MenuItem item = new MenuItem( + MessageManager.getString("label.reveal")); item.addActionListener(new ActionListener() { @Override @@ -200,9 +202,8 @@ public class ScalePanel extends Panel implements MouseMotionListener, public void actionPerformed(ActionEvent e) { av.hideColumns(res, res); - if (av.getSelectionGroup() != null - && av.getSelectionGroup().getSize() == av.getAlignment() - .getHeight()) + if (av.getSelectionGroup() != null && av.getSelectionGroup() + .getSize() == av.getAlignment().getHeight()) { av.setSelectionGroup(null); } @@ -344,8 +345,8 @@ public class ScalePanel extends Panel implements MouseMotionListener, */ if (!av.getWrapAlignment()) { - drawScale(g, av.getRanges().getStartRes(), - av.getRanges().getEndRes(), getSize().width, getSize().height); + drawScale(g, av.getRanges().getStartRes(), av.getRanges().getEndRes(), + getSize().width, getSize().height); } } @@ -446,10 +447,13 @@ public class ScalePanel extends Panel implements MouseMotionListener, continue; } - gg.fillPolygon(new int[] { - -1 + res * avCharWidth - avcharHeight / 4, - -1 + res * avCharWidth + avcharHeight / 4, - -1 + res * avCharWidth }, new int[] { y, y, y + 2 * yOf }, 3); + gg.fillPolygon( + new int[] + { -1 + res * avCharWidth - avcharHeight / 4, + -1 + res * avCharWidth + avcharHeight / 4, + -1 + res * avCharWidth }, + new int[] + { y, y, y + 2 * yOf }, 3); } } } diff --git a/src/jalview/appletgui/SeqCanvas.java b/src/jalview/appletgui/SeqCanvas.java index 9de5452..28c5291 100755 --- a/src/jalview/appletgui/SeqCanvas.java +++ b/src/jalview/appletgui/SeqCanvas.java @@ -113,12 +113,12 @@ public class SeqCanvas extends Panel implements ViewportListenerI { if (mstring != null) { - g.drawString(mstring, mpos * avcharWidth, ypos - - (avcharHeight / 2)); + g.drawString(mstring, mpos * avcharWidth, + ypos - (avcharHeight / 2)); } - g.drawLine((mpos * avcharWidth) + (avcharWidth / 2), (ypos + 2) - - (avcharHeight / 2), (mpos * avcharWidth) - + (avcharWidth / 2), ypos - 2); + g.drawLine((mpos * avcharWidth) + (avcharWidth / 2), + (ypos + 2) - (avcharHeight / 2), + (mpos * avcharWidth) + (avcharWidth / 2), ypos - 2); } } } @@ -167,8 +167,8 @@ public class SeqCanvas extends Panel implements ViewportListenerI { int x = LABEL_WEST - fm.stringWidth(String.valueOf(value)) - avcharWidth / 2; - g.drawString(value + "", x, (ypos + (i * avcharHeight)) - - (avcharHeight / 5)); + g.drawString(value + "", x, + (ypos + (i * avcharHeight)) - (avcharHeight / 5)); } } } @@ -207,8 +207,8 @@ public class SeqCanvas extends Panel implements ViewportListenerI if (value != -1) { - g.drawString(String.valueOf(value), 0, (ypos + (i * avcharHeight)) - - (avcharHeight / 5)); + g.drawString(String.valueOf(value), 0, + (ypos + (i * avcharHeight)) - (avcharHeight / 5)); } } } @@ -237,14 +237,14 @@ public class SeqCanvas extends Panel implements ViewportListenerI lastsr = ranges.getStartRes(); fastPaint = true; - gg.copyArea(horizontal * avcharWidth, vertical * avcharHeight, imgWidth - - horizontal * avcharWidth, + gg.copyArea(horizontal * avcharWidth, vertical * avcharHeight, + imgWidth - horizontal * avcharWidth, imgHeight - vertical * avcharHeight, -horizontal * avcharWidth, -vertical * avcharHeight); - int sr = ranges.getStartRes(), er = ranges.getEndRes(), ss = ranges - .getStartSeq(), es = ranges - .getEndSeq(), transX = 0, transY = 0; + int sr = ranges.getStartRes(), er = ranges.getEndRes(), + ss = ranges.getStartSeq(), es = ranges.getEndSeq(), transX = 0, + transY = 0; if (horizontal > 0) // scrollbar pulled right, image to the left { @@ -261,7 +261,7 @@ public class SeqCanvas extends Panel implements ViewportListenerI ss = es - vertical; if (ss < ranges.getStartSeq()) // ie scrolling too fast, more than a page // at a - // time + // time { ss = ranges.getStartSeq(); } @@ -307,8 +307,8 @@ public class SeqCanvas extends Panel implements ViewportListenerI { if (img != null - && (fastPaint || (getSize().width != g.getClipBounds().width) || (getSize().height != g - .getClipBounds().height))) + && (fastPaint || (getSize().width != g.getClipBounds().width) + || (getSize().height != g.getClipBounds().height))) { g.drawImage(img, 0, 0, this); fastPaint = false; @@ -501,11 +501,15 @@ public class SeqCanvas extends Panel implements ViewportListenerI continue; } - gg.fillPolygon(new int[] { res * avcharWidth - avcharHeight / 4, - res * avcharWidth + avcharHeight / 4, res * avcharWidth }, - new int[] { ypos - (avcharHeight / 2), - ypos - (avcharHeight / 2), - ypos - (avcharHeight / 2) + 8 }, 3); + gg.fillPolygon( + new int[] + { res * avcharWidth - avcharHeight / 4, + res * avcharWidth + avcharHeight / 4, + res * avcharWidth }, + new int[] + { ypos - (avcharHeight / 2), ypos - (avcharHeight / 2), + ypos - (avcharHeight / 2) + 8 }, + 3); } } @@ -594,9 +598,9 @@ public class SeqCanvas extends Panel implements ViewportListenerI { g1.setColor(Color.blue); g1.drawLine((blockEnd - blockStart + 1) * avcharWidth - 1, - 0 + offset, (blockEnd - blockStart + 1) * avcharWidth - - 1, (endSeq - startSeq + 1) * avcharHeight - + offset); + 0 + offset, + (blockEnd - blockStart + 1) * avcharWidth - 1, + (endSeq - startSeq + 1) * avcharHeight + offset); } g1.translate(-screenY * avcharWidth, 0); @@ -649,8 +653,8 @@ public class SeqCanvas extends Panel implements ViewportListenerI if (av.isShowSequenceFeatures()) { - fr.drawSequence(g, nextSeq, startRes, endRes, offset - + ((i - startSeq) * avcharHeight), false); + fr.drawSequence(g, nextSeq, startRes, endRes, + offset + ((i - startSeq) * avcharHeight), false); } // / Highlight search Results once all sequences have been drawn @@ -658,16 +662,15 @@ public class SeqCanvas extends Panel implements ViewportListenerI if (av.hasSearchResults()) { int[] visibleResults = av.getSearchResults().getResults(nextSeq, - startRes, - endRes); + startRes, endRes); if (visibleResults != null) { for (int r = 0; r < visibleResults.length; r += 2) { sr.drawHighlightedText(nextSeq, visibleResults[r], - visibleResults[r + 1], (visibleResults[r] - startRes) - * avcharWidth, offset - + ((i - startSeq) * avcharHeight)); + visibleResults[r + 1], + (visibleResults[r] - startRes) * avcharWidth, + offset + ((i - startSeq) * avcharHeight)); } } } @@ -723,7 +726,8 @@ public class SeqCanvas extends Panel implements ViewportListenerI { sx = (group.getStartRes() - startRes) * avcharWidth; sy = offset + ((i - startSeq) * avcharHeight); - ex = (((group.getEndRes() + 1) - group.getStartRes()) * avcharWidth) - 1; + ex = (((group.getEndRes() + 1) - group.getStartRes()) + * avcharWidth) - 1; if (sx + ex < 0 || sx > imgWidth) { @@ -731,22 +735,20 @@ public class SeqCanvas extends Panel implements ViewportListenerI } if ((sx <= (endRes - startRes) * avcharWidth) - && group.getSequences(null).contains( - av.getAlignment().getSequenceAt(i))) + && group.getSequences(null) + .contains(av.getAlignment().getSequenceAt(i))) { if ((bottom == -1) - && (i >= alHeight || !group.getSequences(null) - .contains( - av.getAlignment().getSequenceAt(i + 1)))) + && (i >= alHeight || !group.getSequences(null).contains( + av.getAlignment().getSequenceAt(i + 1)))) { bottom = sy + avcharHeight; } if (!inGroup) { - if (((top == -1) && (i == 0)) - || !group.getSequences(null).contains( - av.getAlignment().getSequenceAt(i - 1))) + if (((top == -1) && (i == 0)) || !group.getSequences(null) + .contains(av.getAlignment().getSequenceAt(i - 1))) { top = sy; } diff --git a/src/jalview/appletgui/SeqPanel.java b/src/jalview/appletgui/SeqPanel.java index d000c73..be4f9e6 100644 --- a/src/jalview/appletgui/SeqPanel.java +++ b/src/jalview/appletgui/SeqPanel.java @@ -134,8 +134,8 @@ public class SeqPanel extends Panel implements MouseMotionListener, if (editCommand != null && editCommand.getSize() > 0) { ap.alignFrame.addHistoryItem(editCommand); - av.firePropertyChange("alignment", null, av.getAlignment() - .getSequences()); + av.firePropertyChange("alignment", null, + av.getAlignment().getSequences()); } startseq = -1; @@ -185,23 +185,21 @@ public class SeqPanel extends Panel implements MouseMotionListener, { seqCanvas.cursorX += dx; seqCanvas.cursorY += dy; - if (av.hasHiddenColumns() - && !av.getAlignment().getHiddenColumns() - .isVisible(seqCanvas.cursorX)) + if (av.hasHiddenColumns() && !av.getAlignment().getHiddenColumns() + .isVisible(seqCanvas.cursorX)) { int original = seqCanvas.cursorX - dx; int maxWidth = av.getAlignment().getWidth(); while (!av.getAlignment().getHiddenColumns() - .isVisible(seqCanvas.cursorX) - && seqCanvas.cursorX < maxWidth && seqCanvas.cursorX > 0) + .isVisible(seqCanvas.cursorX) && seqCanvas.cursorX < maxWidth + && seqCanvas.cursorX > 0) { seqCanvas.cursorX += dx; } - if (seqCanvas.cursorX >= maxWidth - || !av.getAlignment().getHiddenColumns() - .isVisible(seqCanvas.cursorX)) + if (seqCanvas.cursorX >= maxWidth || !av.getAlignment() + .getHiddenColumns().isVisible(seqCanvas.cursorX)) { seqCanvas.cursorX = original; } @@ -246,8 +244,8 @@ public class SeqPanel extends Panel implements MouseMotionListener, { ranges.scrollUp(false); } - while (seqCanvas.cursorX < hidden.adjustForHiddenColumns(ranges - .getStartRes())) + while (seqCanvas.cursorX < hidden + .adjustForHiddenColumns(ranges.getStartRes())) { if (!ranges.scrollRight(false)) @@ -255,8 +253,8 @@ public class SeqPanel extends Panel implements MouseMotionListener, break; } } - while (seqCanvas.cursorX > hidden.adjustForHiddenColumns(ranges - .getEndRes())) + while (seqCanvas.cursorX > hidden + .adjustForHiddenColumns(ranges.getEndRes())) { if (!ranges.scrollRight(true)) { @@ -445,9 +443,9 @@ public class SeqPanel extends Panel implements MouseMotionListener, } else { - residue = "X".equalsIgnoreCase(displayChar) ? "X" : ("*" - .equals(displayChar) ? "STOP" : ResidueProperties.aa2Triplet - .get(displayChar)); + residue = "X".equalsIgnoreCase(displayChar) ? "X" + : ("*".equals(displayChar) ? "STOP" + : ResidueProperties.aa2Triplet.get(displayChar)); if (residue != null) { text.append(" Residue: ").append(residue); @@ -509,7 +507,8 @@ public class SeqPanel extends Panel implements MouseMotionListener, // For now, ignore the mouseWheel font resizing on Macs // As the Button2_mask always seems to be true - if ((evt.getModifiers() & InputEvent.BUTTON2_MASK) == InputEvent.BUTTON2_MASK + if ((evt.getModifiers() + & InputEvent.BUTTON2_MASK) == InputEvent.BUTTON2_MASK && !av.MAC) { mouseWheelPressed = true; @@ -579,8 +578,8 @@ public class SeqPanel extends Panel implements MouseMotionListener, if (!features.isEmpty()) { SearchResultsI highlight = new SearchResults(); - highlight.addResult(sequence, features.get(0).getBegin(), features - .get(0).getEnd()); + highlight.addResult(sequence, features.get(0).getBegin(), + features.get(0).getEnd()); seqCanvas.highlightSearchResults(highlight); seqCanvas.getFeatureRenderer().amendFeatures( Collections.singletonList(sequence), features, false, ap); @@ -690,8 +689,8 @@ public class SeqPanel extends Panel implements MouseMotionListener, y -= hgap; - seq = Math.min((y % cHeight) / av.getCharHeight(), av.getAlignment() - .getHeight() - 1); + seq = Math.min((y % cHeight) / av.getCharHeight(), + av.getAlignment().getHeight() - 1); if (seq < 0) { seq = -1; @@ -699,10 +698,9 @@ public class SeqPanel extends Panel implements MouseMotionListener, } else { - seq = Math.min((y / av.getCharHeight()) - + av.getRanges().getStartSeq(), - av - .getAlignment().getHeight() - 1); + seq = Math.min( + (y / av.getCharHeight()) + av.getRanges().getStartSeq(), + av.getAlignment().getHeight() - 1); if (seq < 0) { seq = -1; @@ -834,8 +832,7 @@ public class SeqPanel extends Panel implements MouseMotionListener, else { String residue = (ch == 'x' || ch == 'X') ? "X" - : ResidueProperties.aa2Triplet - .get(String.valueOf(ch)); + : ResidueProperties.aa2Triplet.get(String.valueOf(ch)); text.append(" Residue: ").append(residue == null ? ch : residue); } text.append(" (").append(Integer.toString(respos)).append(")"); @@ -849,7 +846,8 @@ public class SeqPanel extends Panel implements MouseMotionListener, { for (int g = 0; g < groups.length; g++) { - if (groups[g].getStartRes() <= column && groups[g].getEndRes() >= column) + if (groups[g].getStartRes() <= column + && groups[g].getEndRes() >= column) { if (!groups[g].getName().startsWith("JTreeGroup") && !groups[g].getName().startsWith("JGroup")) @@ -945,16 +943,14 @@ public class SeqPanel extends Panel implements MouseMotionListener, { for (int i = 0; i < features.length; i++) { - if (av.getFeaturesDisplayed() == null - || !av.getFeaturesDisplayed().isVisible( - features[i].getType())) + if (av.getFeaturesDisplayed() == null || !av.getFeaturesDisplayed() + .isVisible(features[i].getType())) { continue; } - if (features[i].featureGroup != null - && !seqCanvas.fr.checkGroupVisibility( - features[i].featureGroup, false)) + if (features[i].featureGroup != null && !seqCanvas.fr + .checkGroupVisibility(features[i].featureGroup, false)) { continue; } @@ -988,8 +984,8 @@ public class SeqPanel extends Panel implements MouseMotionListener, int oldWidth = av.getCharWidth(); // Which is bigger, left-right or up-down? - if (Math.abs(evt.getY() - lastMousePress.y) > Math.abs(evt.getX() - - lastMousePress.x)) + if (Math.abs(evt.getY() - lastMousePress.y) > Math + .abs(evt.getX() - lastMousePress.x)) { int fontSize = av.font.getSize(); @@ -1098,8 +1094,8 @@ public class SeqPanel extends Panel implements MouseMotionListener, StringBuffer message = new StringBuffer(); if (groupEditing) { - message.append(MessageManager.getString("action.edit_group")).append( - ":"); + message.append(MessageManager.getString("action.edit_group")) + .append(":"); if (editCommand == null) { editCommand = new EditCommand( @@ -1117,8 +1113,9 @@ public class SeqPanel extends Panel implements MouseMotionListener, } if (editCommand == null) { - editCommand = new EditCommand(MessageManager.formatMessage( - "label.edit_params", new String[] { label })); + editCommand = new EditCommand(MessageManager + .formatMessage("label.edit_params", new String[] + { label })); } } @@ -1135,9 +1132,8 @@ public class SeqPanel extends Panel implements MouseMotionListener, ap.alignFrame.statusBar.setText(message.toString()); // Are we editing within a selection group? - if (groupEditing - || (sg != null && sg.getSequences(av.getHiddenRepSequences()) - .contains(seq))) + if (groupEditing || (sg != null + && sg.getSequences(av.getHiddenRepSequences()).contains(seq))) { fixedColumns = true; @@ -1237,8 +1233,8 @@ public class SeqPanel extends Panel implements MouseMotionListener, { for (int j = 0; j < startres - lastres; j++) { - if (!jalview.util.Comparison.isGap(gs.getCharAt(fixedRight - - j))) + if (!jalview.util.Comparison + .isGap(gs.getCharAt(fixedRight - j))) { blank = false; break; @@ -1359,9 +1355,8 @@ public class SeqPanel extends Panel implements MouseMotionListener, } else { - editCommand.appendEdit(Action.INSERT_GAP, - new SequenceI[] { seq }, lastres, startres - lastres, - av.getAlignment(), true); + editCommand.appendEdit(Action.INSERT_GAP, new SequenceI[] { seq }, + lastres, startres - lastres, av.getAlignment(), true); } } else @@ -1395,8 +1390,8 @@ public class SeqPanel extends Panel implements MouseMotionListener, if (max > 0) { editCommand.appendEdit(Action.DELETE_GAP, - new SequenceI[] { seq }, startres, max, - av.getAlignment(), true); + new SequenceI[] + { seq }, startres, max, av.getAlignment(), true); } } } @@ -1491,7 +1486,8 @@ public class SeqPanel extends Panel implements MouseMotionListener, } // DETECT RIGHT MOUSE BUTTON IN AWT - if ((evt.getModifiers() & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK) + if ((evt.getModifiers() + & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK) { List allFeatures = findFeaturesAtRes(sequence, sequence.findPosition(res)); @@ -1804,9 +1800,8 @@ public class SeqPanel extends Panel implements MouseMotionListener, running = av.getRanges().scrollUp(true); } - if (mouseDragging && evt.getY() >= getSize().height - && av.getAlignment().getHeight() > av.getRanges() - .getEndSeq()) + if (mouseDragging && evt.getY() >= getSize().height && av + .getAlignment().getHeight() > av.getRanges().getEndSeq()) { running = av.getRanges().scrollUp(false); } @@ -1843,9 +1838,10 @@ public class SeqPanel extends Panel implements MouseMotionListener, // handles selection messages... // TODO: extend config options to allow user to control if selections may be // shared between viewports. - if (av != null - && (av == source || !av.followSelection || (source instanceof AlignViewport && ((AlignmentViewport) source) - .getSequenceSetId().equals(av.getSequenceSetId())))) + if (av != null && (av == source || !av.followSelection + || (source instanceof AlignViewport + && ((AlignmentViewport) source).getSequenceSetId() + .equals(av.getSequenceSetId())))) { return; } @@ -1874,11 +1870,9 @@ public class SeqPanel extends Panel implements MouseMotionListener, { if (av.getAlignment() == null) { - System.out - .println("Selection message: alignviewport av SeqSetId=" - + av.getSequenceSetId() + " ViewId=" - + av.getViewId() - + " 's alignment is NULL! returning immediatly."); + System.out.println("Selection message: alignviewport av SeqSetId=" + + av.getSequenceSetId() + " ViewId=" + av.getViewId() + + " 's alignment is NULL! returning immediatly."); return; } sgroup = seqsel.intersect(av.getAlignment(), @@ -1898,9 +1892,8 @@ public class SeqPanel extends Panel implements MouseMotionListener, } repaint = av.isSelectionGroupChanged(true); } - if (copycolsel - && (av.getColumnSelection() == null || !av - .isColSelChanged(true))) + if (copycolsel && (av.getColumnSelection() == null + || !av.isColSelChanged(true))) { // the current selection is unset or from a previous message // so import the new colsel. @@ -1926,8 +1919,7 @@ public class SeqPanel extends Panel implements MouseMotionListener, } repaint |= av.isColSelChanged(true); } - if (copycolsel - && av.hasHiddenColumns() + if (copycolsel && av.hasHiddenColumns() && (av.getColumnSelection() == null)) { System.err.println("Bad things"); @@ -1962,8 +1954,8 @@ public class SeqPanel extends Panel implements MouseMotionListener, { row = row < 0 ? ap.av.getRanges().getStartSeq() : row; - ap.scrollTo(ap.av.getRanges().getStartRes(), ap.av.getRanges() - .getStartRes(), row, true, true); + ap.scrollTo(ap.av.getRanges().getStartRes(), + ap.av.getRanges().getStartRes(), row, true, true); } /** @@ -1975,7 +1967,8 @@ public class SeqPanel extends Panel implements MouseMotionListener, { column = column < 0 ? ap.av.getRanges().getStartRes() : column; - ap.scrollTo(column, column, ap.av.getRanges().getStartSeq(), true, true); + ap.scrollTo(column, column, ap.av.getRanges().getStartSeq(), true, + true); } /** diff --git a/src/jalview/appletgui/SequenceRenderer.java b/src/jalview/appletgui/SequenceRenderer.java index 38031e4..a382c60 100755 --- a/src/jalview/appletgui/SequenceRenderer.java +++ b/src/jalview/appletgui/SequenceRenderer.java @@ -162,8 +162,8 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer int length = seq.getLength(); int curStart = -1; - int curWidth = av.getCharWidth(), avCharWidth = av.getCharWidth(), avCharHeight = av - .getCharHeight(); + int curWidth = av.getCharWidth(), avCharWidth = av.getCharWidth(), + avCharHeight = av.getCharHeight(); Color tempColour = null; while (i <= end) @@ -309,8 +309,8 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer } charOffset = (avCharWidth - fm.charWidth(s)) / 2; - graphics.drawString(String.valueOf(s), charOffset + avCharWidth - * (i - start), y1); + graphics.drawString(String.valueOf(s), + charOffset + avCharWidth * (i - start), y1); } } @@ -333,21 +333,25 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer // currentSequenceGroup.getConsensus() char conschar = (usesrep) ? (currentGroup == null || position < currentGroup.getStartRes() - || position > currentGroup.getEndRes() ? av.getAlignment() - .getSeqrep().getCharAt(position) - : (currentGroup.getSeqrep() != null ? currentGroup.getSeqrep() - .getCharAt(position) : av.getAlignment().getSeqrep() - .getCharAt(position))) + || position > currentGroup.getEndRes() + ? av.getAlignment().getSeqrep().getCharAt(position) + : (currentGroup.getSeqrep() != null + ? currentGroup.getSeqrep().getCharAt(position) + : av.getAlignment().getSeqrep() + .getCharAt(position))) : (currentGroup != null && currentGroup.getConsensus() != null && position >= currentGroup.getStartRes() - && position <= currentGroup.getEndRes() && currentGroup - .getConsensus().annotations.length > position) ? currentGroup - .getConsensus().annotations[position].displayCharacter - .charAt(0) - : av.getAlignmentConsensusAnnotation().annotations[position].displayCharacter - .charAt(0); + && position <= currentGroup.getEndRes() + && currentGroup + .getConsensus().annotations.length > position) + ? currentGroup + .getConsensus().annotations[position].displayCharacter + .charAt(0) + : av.getAlignmentConsensusAnnotation().annotations[position].displayCharacter + .charAt(0); if (!jalview.util.Comparison.isGap(conschar) - && (sequenceChar == conschar || sequenceChar + CHAR_TO_UPPER == conschar)) + && (sequenceChar == conschar + || sequenceChar + CHAR_TO_UPPER == conschar)) { sequenceChar = conservedChar; } @@ -374,14 +378,15 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer return false; } - public void drawHighlightedText(SequenceI seq, int start, int end, - int x1, int y1) + public void drawHighlightedText(SequenceI seq, int start, int end, int x1, + int y1) { int avCharWidth = av.getCharWidth(), avCharHeight = av.getCharHeight(); int pady = avCharHeight / 5; int charOffset = 0; graphics.setColor(Color.black); - graphics.fillRect(x1, y1, avCharWidth * (end - start + 1), avCharHeight); + graphics.fillRect(x1, y1, avCharWidth * (end - start + 1), + avCharHeight); graphics.setColor(Color.white); char s = '~'; @@ -396,8 +401,9 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer } charOffset = (avCharWidth - fm.charWidth(s)) / 2; - graphics.drawString(String.valueOf(s), charOffset + x1 - + avCharWidth * (i - start), y1 + avCharHeight - pady); + graphics.drawString(String.valueOf(s), + charOffset + x1 + avCharWidth * (i - start), + y1 + avCharHeight - pady); } } } diff --git a/src/jalview/appletgui/SliderPanel.java b/src/jalview/appletgui/SliderPanel.java index 47a0669..565ebe8 100644 --- a/src/jalview/appletgui/SliderPanel.java +++ b/src/jalview/appletgui/SliderPanel.java @@ -47,8 +47,8 @@ import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.util.List; -public class SliderPanel extends Panel implements ActionListener, - AdjustmentListener, MouseListener +public class SliderPanel extends Panel + implements ActionListener, AdjustmentListener, MouseListener { private static final String BACKGROUND = "Background"; @@ -81,8 +81,8 @@ public class SliderPanel extends Panel implements ActionListener, } conservationSlider.setTitle(MessageManager.formatMessage( - "label.conservation_colour_increment", - new String[] { source == null ? BACKGROUND : source })); + "label.conservation_colour_increment", new String[] + { source == null ? BACKGROUND : source })); List groups = ap.av.getAlignment().getGroups(); if (groups != null && !groups.isEmpty()) { @@ -140,8 +140,8 @@ public class SliderPanel extends Panel implements ActionListener, pid.valueField.setText(String.valueOf(ccs.getThreshold())); } PIDSlider.setTitle(MessageManager.formatMessage( - "label.percentage_identity_threshold", - new String[] { source == null ? BACKGROUND : source })); + "label.percentage_identity_threshold", new String[] + { source == null ? BACKGROUND : source })); if (ap.av.getAlignment().getGroups() != null) { @@ -168,8 +168,8 @@ public class SliderPanel extends Panel implements ActionListener, if (!PIDSlider.isVisible()) { - jalview.bin.JalviewLite.addFrame(PIDSlider, PIDSlider.getTitle(), - 420, 100); + jalview.bin.JalviewLite.addFrame(PIDSlider, PIDSlider.getTitle(), 420, + 100); PIDSlider.addWindowListener(new WindowAdapter() { @Override @@ -205,6 +205,7 @@ public class SliderPanel extends Panel implements ActionListener, conservationSlider = null; } } + public SliderPanel(AlignmentPanel ap, int value, boolean forConserve, ResidueShaderI shader) { @@ -394,7 +395,7 @@ public class SliderPanel extends Panel implements ActionListener, valueChanged(slider.getValue()); } }); - + label.setFont(new java.awt.Font("Verdana", 0, 11)); label.setText(MessageManager.getString("label.set_this_label_text")); jPanel1.setLayout(borderLayout1); @@ -408,10 +409,10 @@ public class SliderPanel extends Panel implements ActionListener, undoButton.addActionListener(this); allGroupsCheck.setEnabled(false); allGroupsCheck.setFont(new java.awt.Font("Verdana", 0, 11)); - allGroupsCheck.setLabel(MessageManager - .getString("action.apply_threshold_all_groups")); - allGroupsCheck.setName(MessageManager - .getString("action.apply_all_groups")); + allGroupsCheck.setLabel( + MessageManager.getString("action.apply_threshold_all_groups")); + allGroupsCheck + .setName(MessageManager.getString("action.apply_all_groups")); this.setBackground(Color.white); this.setForeground(Color.black); jPanel2.add(label, null); diff --git a/src/jalview/appletgui/SplitFrame.java b/src/jalview/appletgui/SplitFrame.java index cbad148..ed531d3 100644 --- a/src/jalview/appletgui/SplitFrame.java +++ b/src/jalview/appletgui/SplitFrame.java @@ -87,7 +87,8 @@ public class SplitFrame extends EmbmenuFrame * Compute cDNA consensus on protein alignment */ protein.initComplementConsensus(); - AlignmentViewPanel ap = topAlignment.isNucleotide() ? bottomFrame.alignPanel + AlignmentViewPanel ap = topAlignment.isNucleotide() + ? bottomFrame.alignPanel : topFrame.alignPanel; protein.updateConsensus(ap); @@ -118,7 +119,8 @@ public class SplitFrame extends EmbmenuFrame { AlignmentViewport cdna = topFrame.getAlignViewport().getAlignment() .isNucleotide() ? topFrame.viewport : bottomFrame.viewport; - AlignmentViewport protein = cdna == topFrame.viewport ? bottomFrame.viewport + AlignmentViewport protein = cdna == topFrame.viewport + ? bottomFrame.viewport : topFrame.viewport; /* @@ -132,14 +134,14 @@ public class SplitFrame extends EmbmenuFrame if (w1 != w3) { Dimension d = topFrame.alignPanel.idPanel.idCanvas.getSize(); - topFrame.alignPanel.idPanel.idCanvas.setSize(new Dimension(w3, - d.height)); + topFrame.alignPanel.idPanel.idCanvas + .setSize(new Dimension(w3, d.height)); } if (w2 != w3) { Dimension d = bottomFrame.alignPanel.idPanel.idCanvas.getSize(); - bottomFrame.alignPanel.idPanel.idCanvas.setSize(new Dimension(w3, - d.height)); + bottomFrame.alignPanel.idPanel.idCanvas + .setSize(new Dimension(w3, d.height)); } /* @@ -165,8 +167,8 @@ public class SplitFrame extends EmbmenuFrame private void addAlignFrameComponents(AlignFrame af, Panel panel) { panel.setLayout(new BorderLayout()); - Panel menuPanel = af - .makeEmbeddedPopupMenu(af.getMenuBar(), true, false); + Panel menuPanel = af.makeEmbeddedPopupMenu(af.getMenuBar(), true, + false); panel.add(menuPanel, BorderLayout.NORTH); panel.add(af.statusBar, BorderLayout.SOUTH); panel.add(af.alignPanel, BorderLayout.CENTER); @@ -209,8 +211,8 @@ public class SplitFrame extends EmbmenuFrame this.add(outermost); int width = Math.max(topFrame.frameWidth, bottomFrame.frameWidth); int height = topFrame.frameHeight + bottomFrame.frameHeight; - jalview.bin.JalviewLite - .addFrame(this, this.getTitle(), width, height); + jalview.bin.JalviewLite.addFrame(this, this.getTitle(), width, + height); } } diff --git a/src/jalview/appletgui/Tooltip.java b/src/jalview/appletgui/Tooltip.java index 7a65ec3..d629cf6 100755 --- a/src/jalview/appletgui/Tooltip.java +++ b/src/jalview/appletgui/Tooltip.java @@ -35,8 +35,8 @@ import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import java.util.StringTokenizer; -public class Tooltip extends Canvas implements MouseListener, - MouseMotionListener +public class Tooltip extends Canvas + implements MouseListener, MouseMotionListener { private String[] tip; @@ -91,8 +91,8 @@ public class Tooltip extends Canvas implements MouseListener, { if (lindex > 0) { - g.drawString(tip[i].substring(0, lindex), 3, (i + 1) * fontHeight - - 3); + g.drawString(tip[i].substring(0, lindex), 3, + (i + 1) * fontHeight - 3); x += fm.stringWidth(tip[i].substring(0, lindex) + 3); } g.drawImage(linkImage, x, i * fontHeight + 1, this); @@ -155,11 +155,11 @@ public class Tooltip extends Canvas implements MouseListener, return; } setLocation( - (owner.getLocationOnScreen().x - mainContainer.getLocationOnScreen().x) - + evt.getX(), + (owner.getLocationOnScreen().x + - mainContainer.getLocationOnScreen().x) + evt.getX(), (owner.getLocationOnScreen().y - - mainContainer.getLocationOnScreen().y + VERTICAL_OFFSET) - + evt.getY()); + - mainContainer.getLocationOnScreen().y + + VERTICAL_OFFSET) + evt.getY()); // correction, whole tool tip must be visible if (mainContainer.getSize().width < (getLocation().x + getSize().width)) diff --git a/src/jalview/appletgui/TreeCanvas.java b/src/jalview/appletgui/TreeCanvas.java index 272a2b3..6ee75bd 100755 --- a/src/jalview/appletgui/TreeCanvas.java +++ b/src/jalview/appletgui/TreeCanvas.java @@ -51,8 +51,8 @@ import java.util.Hashtable; import java.util.List; import java.util.Vector; -public class TreeCanvas extends Panel implements MouseListener, - MouseMotionListener +public class TreeCanvas extends Panel + implements MouseListener, MouseMotionListener { TreeModel tree; @@ -210,8 +210,9 @@ public class TreeCanvas extends Panel implements MouseListener, g.drawString(nodeLabel, xstart + 2, ypos - 2); } - String name = (markPlaceholders && node.isPlaceholder()) ? (PLACEHOLDER + node - .getName()) : node.getName(); + String name = (markPlaceholders && node.isPlaceholder()) + ? (PLACEHOLDER + node.getName()) + : node.getName(); FontMetrics fm = g.getFontMetrics(font); int charWidth = fm.stringWidth(name) + 3; int charHeight = fm.getHeight(); @@ -261,11 +262,10 @@ public class TreeCanvas extends Panel implements MouseListener, g.fillRect(xend - 2, ypos - 2, 4, 4); } - int ystart = (int) (node.left() == null ? 0 : (((SequenceNode) node - .left()).ycount * chunk)) - + offy; - int yend = (int) (node.right() == null ? 0 : (((SequenceNode) node - .right()).ycount * chunk)) + offy; + int ystart = (int) (node.left() == null ? 0 + : (((SequenceNode) node.left()).ycount * chunk)) + offy; + int yend = (int) (node.right() == null ? 0 + : (((SequenceNode) node.right()).ycount * chunk)) + offy; Rectangle pos = new Rectangle(xend - 2, ypos - 2, 5, 5); nodeHash.put(node, pos); @@ -491,7 +491,8 @@ public class TreeCanvas extends Panel implements MouseListener, g.setColor(Color.gray); } - int x = (int) (threshold * (getSize().width - labelLength - 2 * offx) + offx); + int x = (int) (threshold * (getSize().width - labelLength - 2 * offx) + + offx); g.drawLine(x, 0, x, getSize().height); } @@ -656,9 +657,8 @@ public class TreeCanvas extends Panel implements MouseListener, } else { - cs = ColourSchemeProperty.getColourScheme(sg, - ColourSchemeProperty.getColourName(av - .getGlobalColourScheme())); + cs = ColourSchemeProperty.getColourScheme(sg, ColourSchemeProperty + .getColourName(av.getGlobalColourScheme())); } // cs is null if shading is an annotationColourGradient // if (cs != null) diff --git a/src/jalview/appletgui/TreePanel.java b/src/jalview/appletgui/TreePanel.java index c7bf6aa..b5e3342 100644 --- a/src/jalview/appletgui/TreePanel.java +++ b/src/jalview/appletgui/TreePanel.java @@ -45,8 +45,8 @@ import java.awt.event.ActionListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; -public class TreePanel extends EmbmenuFrame implements ActionListener, - ItemListener +public class TreePanel extends EmbmenuFrame + implements ActionListener, ItemListener { SequenceI[] seq; @@ -160,8 +160,8 @@ public class TreePanel extends EmbmenuFrame implements ActionListener, AlignFrame af = new AlignFrame(al, av.applet, "Original Data for Tree", false); - af.viewport.getAlignment().setHiddenColumns( - (HiddenColumns) alAndColsel[1]); + af.viewport.getAlignment() + .setHiddenColumns((HiddenColumns) alAndColsel[1]); } } else @@ -194,8 +194,8 @@ public class TreePanel extends EmbmenuFrame implements ActionListener, ScoreModelI sm1 = ScoreModels.getInstance().getScoreModel(pwtype, treeCanvas.ap); ScoreModelI sm = sm1; - TreeBuilder njtree = type.equals(TreeBuilder.NEIGHBOUR_JOINING) ? new NJTree( - av, sm, SimilarityParams.Jalview) + TreeBuilder njtree = type.equals(TreeBuilder.NEIGHBOUR_JOINING) + ? new NJTree(av, sm, SimilarityParams.Jalview) : new AverageDistanceTree(av, sm, SimilarityParams.Jalview); tree = new TreeModel(njtree); } @@ -217,8 +217,8 @@ public class TreePanel extends EmbmenuFrame implements ActionListener, bootstrapMenu.setState(showBoots); treeCanvas.setShowBootstrap(showBoots); treeCanvas.setShowDistances(showDist); - treeCanvas.setMarkPlaceholders(av.applet.getDefaultParameter( - "showUnlinkedTreeNodes", false)); + treeCanvas.setMarkPlaceholders(av.applet + .getDefaultParameter("showUnlinkedTreeNodes", false)); } treeCanvas.repaint(); @@ -336,13 +336,13 @@ public class TreePanel extends EmbmenuFrame implements ActionListener, jMenu2.setLabel(MessageManager.getString("action.view")); fontSize.setLabel(MessageManager.getString("action.font")); fontSize.addActionListener(this); - bootstrapMenu.setLabel(MessageManager - .getString("label.show_bootstrap_values")); + bootstrapMenu.setLabel( + MessageManager.getString("label.show_bootstrap_values")); bootstrapMenu.addItemListener(this); distanceMenu.setLabel(MessageManager.getString("label.show_distances")); distanceMenu.addItemListener(this); - placeholdersMenu.setLabel(MessageManager - .getString("label.mark_unassociated_leaves")); + placeholdersMenu.setLabel( + MessageManager.getString("label.mark_unassociated_leaves")); placeholdersMenu.addItemListener(this); fitToWindow.setState(true); fitToWindow.setLabel(MessageManager.getString("label.fit_to_window")); diff --git a/src/jalview/appletgui/UserDefinedColours.java b/src/jalview/appletgui/UserDefinedColours.java index 845110e..d1c0e1b 100644 --- a/src/jalview/appletgui/UserDefinedColours.java +++ b/src/jalview/appletgui/UserDefinedColours.java @@ -54,8 +54,8 @@ import java.awt.event.FocusListener; import java.awt.event.MouseEvent; import java.util.Vector; -public class UserDefinedColours extends Panel implements ActionListener, - AdjustmentListener, FocusListener +public class UserDefinedColours extends Panel + implements ActionListener, AdjustmentListener, FocusListener { AlignmentPanel ap; @@ -214,9 +214,8 @@ public class UserDefinedColours extends Panel implements ActionListener, // // not 1.1 compatible! // dialog = new Dialog(((JVDialog)alignframe), title, true); // } else { - throw new Error( - MessageManager - .getString("label.error_unsupported_owwner_user_colour_scheme")); + throw new Error(MessageManager.getString( + "label.error_unsupported_owwner_user_colour_scheme")); } dialog.add(this); @@ -225,11 +224,12 @@ public class UserDefinedColours extends Panel implements ActionListener, int height = 160 + alignframe.getInsets().top + getInsets().bottom; int width = 400; - dialog.setBounds(alignframe.getBounds().x - + (alignframe.getSize().width - width) / 2, + dialog.setBounds( + alignframe.getBounds().x + + (alignframe.getSize().width - width) / 2, alignframe.getBounds().y - + (alignframe.getSize().height - height) / 2, width, - height); + + (alignframe.getSize().height - height) / 2, + width, height); } diff --git a/src/jalview/bin/Cache.java b/src/jalview/bin/Cache.java index da3cb92..dc50843 100755 --- a/src/jalview/bin/Cache.java +++ b/src/jalview/bin/Cache.java @@ -77,7 +77,8 @@ import org.apache.log4j.SimpleLayout; *
  • SHOW_FULLSCREEN boolean
  • *
  • FONT_NAME java font name for alignment text display
  • *
  • FONT_SIZE size of displayed alignment text
  • - *
  • FONT_STYLE style of font displayed (sequence labels are always italic)
  • + *
  • FONT_STYLE style of font displayed (sequence labels are always + * italic)
  • *
  • GAP_SYMBOL character to treat as gap symbol (usually -,.,' ')
  • *
  • LAST_DIRECTORY last directory for browsing alignment
  • *
  • USER_DEFINED_COLOURS list of user defined colour scheme files
  • @@ -237,8 +238,7 @@ public class Cache * Sifts settings */ public static final String DEFAULT_SIFTS_DOWNLOAD_DIR = System - .getProperty("user.home") - + File.separatorChar + .getProperty("user.home") + File.separatorChar + ".sifts_downloads" + File.separatorChar; private final static String DEFAULT_CACHE_THRESHOLD_IN_DAYS = "2"; @@ -310,8 +310,8 @@ public class Cache Logger lcastor = Logger.getLogger("org.exolab.castor"); jalview.bin.Cache.log = Logger.getLogger("jalview.bin.Jalview"); - laxis.setLevel(Level.toLevel(Cache.getDefault("logs.Axis.Level", - Level.INFO.toString()))); + laxis.setLevel(Level.toLevel( + Cache.getDefault("logs.Axis.Level", Level.INFO.toString()))); lcastor.setLevel(Level.toLevel(Cache.getDefault("logs.Castor.Level", Level.INFO.toString()))); lcastor = Logger.getLogger("org.exolab.castor.xml"); @@ -320,8 +320,8 @@ public class Cache // lcastor = Logger.getLogger("org.exolab.castor.xml.Marshaller"); // lcastor.setLevel(Level.toLevel(Cache.getDefault("logs.Castor.Level", // Level.INFO.toString()))); - jalview.bin.Cache.log.setLevel(Level.toLevel(Cache.getDefault( - "logs.Jalview.level", Level.INFO.toString()))); + jalview.bin.Cache.log.setLevel(Level.toLevel(Cache + .getDefault("logs.Jalview.level", Level.INFO.toString()))); // laxis.addAppender(ap); // lcastor.addAppender(ap); // jalview.bin.Cache.log.addAppender(ap); @@ -355,10 +355,10 @@ public class Cache try { fis = new java.net.URL(propertiesFile).openStream(); - System.out.println("Loading jalview properties from : " - + propertiesFile); - System.out - .println("Disabling Jalview writing to user's local properties file."); + System.out.println( + "Loading jalview properties from : " + propertiesFile); + System.out.println( + "Disabling Jalview writing to user's local properties file."); propsAreReadOnly = true; } catch (Exception ex) @@ -382,8 +382,8 @@ public class Cache if (getDefault("USE_PROXY", false)) { - String proxyServer = getDefault("PROXY_SERVER", ""), proxyPort = getDefault( - "PROXY_PORT", "8080"); + String proxyServer = getDefault("PROXY_SERVER", ""), + proxyPort = getDefault("PROXY_PORT", "8080"); System.out.println("Using proxyServer: " + proxyServer + " proxyPort: " + proxyPort); @@ -395,9 +395,9 @@ public class Cache // LOAD THE AUTHORS FROM THE authors.props file try { - String authorDetails = "jar:".concat(Cache.class - .getProtectionDomain().getCodeSource().getLocation() - .toString().concat("!/authors.props")); + String authorDetails = "jar:" + .concat(Cache.class.getProtectionDomain().getCodeSource() + .getLocation().toString().concat("!/authors.props")); java.net.URL localJarFileURL = new java.net.URL(authorDetails); @@ -451,16 +451,16 @@ public class Cache SiftsSettings .setMapWithSifts(Cache.getDefault("MAP_WITH_SIFTS", false)); - SiftsSettings.setSiftDownloadDirectory(jalview.bin.Cache.getDefault( - "sifts_download_dir", DEFAULT_SIFTS_DOWNLOAD_DIR)); + SiftsSettings.setSiftDownloadDirectory(jalview.bin.Cache + .getDefault("sifts_download_dir", DEFAULT_SIFTS_DOWNLOAD_DIR)); - SiftsSettings.setFailSafePIDThreshold(jalview.bin.Cache.getDefault( - "sifts_fail_safe_pid_threshold", - DEFAULT_FAIL_SAFE_PID_THRESHOLD)); + SiftsSettings.setFailSafePIDThreshold( + jalview.bin.Cache.getDefault("sifts_fail_safe_pid_threshold", + DEFAULT_FAIL_SAFE_PID_THRESHOLD)); - SiftsSettings.setCacheThresholdInDays(jalview.bin.Cache.getDefault( - "sifts_cache_threshold_in_days", - DEFAULT_CACHE_THRESHOLD_IN_DAYS)); + SiftsSettings.setCacheThresholdInDays( + jalview.bin.Cache.getDefault("sifts_cache_threshold_in_days", + DEFAULT_CACHE_THRESHOLD_IN_DAYS)); IdOrgSettings.setUrl(getDefault("ID_ORG_HOSTURL", "http://www.jalview.org/services/identifiers")); @@ -478,8 +478,7 @@ public class Cache // "DEFAULT_PDB_FILE_PARSER", DEFAULT_PDB_FILE_PARSER)); // jnlpVersion will be null if we're using InstallAnywhere // Dont do this check if running in headless mode - if (jnlpVersion == null - && getDefault("VERSION_CHECK", true) + if (jnlpVersion == null && getDefault("VERSION_CHECK", true) && (System.getProperty("java.awt.headless") == null || System .getProperty("java.awt.headless").equals("false"))) { @@ -502,11 +501,11 @@ public class Cache { System.setProperty("sun.net.client.defaultConnectTimeout", "5000"); - java.net.URL url = new java.net.URL(Cache.getDefault( - "www.jalview.org", "http://www.jalview.org") + java.net.URL url = new java.net.URL(Cache + .getDefault("www.jalview.org", "http://www.jalview.org") + "/webstart/jalview.jnlp"); - BufferedReader in = new BufferedReader(new InputStreamReader( - url.openStream())); + BufferedReader in = new BufferedReader( + new InputStreamReader(url.openStream())); String line = null; while ((line = in.readLine()) != null) { @@ -522,8 +521,8 @@ public class Cache } } catch (Exception ex) { - System.out - .println("Non-fatal exception when checking version at www.jalview.org :"); + System.out.println( + "Non-fatal exception when checking version at www.jalview.org :"); System.out.println(ex); remoteVersion = getProperty("VERSION"); } @@ -638,8 +637,8 @@ public class Cache } } catch (Exception ex) { - System.out.println("Error setting property: " + key + " " + obj - + "\n" + ex); + System.out.println( + "Error setting property: " + key + " " + obj + "\n" + ex); } return obj; } @@ -690,15 +689,15 @@ public class Cache { try { - if (jalview.jbgui.GDesktop.class.getClassLoader().loadClass( - "uk.ac.vamsas.client.VorbaId") != null) + if (jalview.jbgui.GDesktop.class.getClassLoader() + .loadClass("uk.ac.vamsas.client.VorbaId") != null) { - jalview.bin.Cache.log - .debug("Found Vamsas Classes (uk.ac..vamsas.client.VorbaId can be loaded)"); + jalview.bin.Cache.log.debug( + "Found Vamsas Classes (uk.ac..vamsas.client.VorbaId can be loaded)"); vamsasJarsArePresent = 1; Logger lvclient = Logger.getLogger("uk.ac.vamsas"); - lvclient.setLevel(Level.toLevel(Cache.getDefault( - "logs.Vamsas.Level", Level.INFO.toString()))); + lvclient.setLevel(Level.toLevel(Cache + .getDefault("logs.Vamsas.Level", Level.INFO.toString()))); lvclient.addAppender(log.getAppender("JalviewLogger")); // Tell the user that debug is enabled @@ -729,15 +728,15 @@ public class Cache { try { - if (Cache.class.getClassLoader().loadClass( - "groovy.lang.GroovyObject") != null) + if (Cache.class.getClassLoader() + .loadClass("groovy.lang.GroovyObject") != null) { - jalview.bin.Cache.log - .debug("Found Groovy (groovy.lang.GroovyObject can be loaded)"); + jalview.bin.Cache.log.debug( + "Found Groovy (groovy.lang.GroovyObject can be loaded)"); groovyJarsArePresent = 1; Logger lgclient = Logger.getLogger("groovy"); - lgclient.setLevel(Level.toLevel(Cache.getDefault( - "logs.Groovy.Level", Level.INFO.toString()))); + lgclient.setLevel(Level.toLevel(Cache + .getDefault("logs.Groovy.Level", Level.INFO.toString()))); lgclient.addAppender(log.getAppender("JalviewLogger")); // Tell the user that debug is enabled @@ -778,15 +777,14 @@ public class Cache // try to get the tracker class try { - jgoogleanalyticstracker = Cache.class - .getClassLoader() - .loadClass( - "com.boxysystems.jgoogleanalytics.JGoogleAnalyticsTracker"); - trackerfocus = Cache.class.getClassLoader().loadClass( - "com.boxysystems.jgoogleanalytics.FocusPoint"); + jgoogleanalyticstracker = Cache.class.getClassLoader().loadClass( + "com.boxysystems.jgoogleanalytics.JGoogleAnalyticsTracker"); + trackerfocus = Cache.class.getClassLoader() + .loadClass("com.boxysystems.jgoogleanalytics.FocusPoint"); } catch (Exception e) { - log.debug("com.boxysystems.jgoogleanalytics package is not present - tracking not enabled."); + log.debug( + "com.boxysystems.jgoogleanalytics package is not present - tracking not enabled."); tracker = null; jgoogleanalyticstracker = null; trackerfocus = null; @@ -800,22 +798,22 @@ public class Cache try { // Google analytics tracking code for Library Finder - tracker = jgoogleanalyticstracker.getConstructor( - new Class[] { String.class, String.class, String.class }) - .newInstance( - new Object[] { - "Jalview Desktop", - (vrs = jalview.bin.Cache.getProperty("VERSION") - + "_" - + jalview.bin.Cache.getDefault( - "BUILD_DATE", "unknown")), - "UA-9060947-1" }); - jgoogleanalyticstracker.getMethod("trackAsynchronously", - new Class[] { trackerfocus }).invoke( - tracker, - new Object[] { trackerfocus.getConstructor( - new Class[] { String.class }).newInstance( - new Object[] { "Application Started." }) }); + tracker = jgoogleanalyticstracker + .getConstructor(new Class[] + { String.class, String.class, String.class }) + .newInstance(new Object[] + { "Jalview Desktop", + (vrs = jalview.bin.Cache.getProperty("VERSION") + "_" + + jalview.bin.Cache.getDefault("BUILD_DATE", + "unknown")), + "UA-9060947-1" }); + jgoogleanalyticstracker + .getMethod("trackAsynchronously", new Class[] + { trackerfocus }) + .invoke(tracker, new Object[] + { trackerfocus.getConstructor(new Class[] { String.class }) + .newInstance(new Object[] + { "Application Started." }) }); } catch (RuntimeException e) { re = e; @@ -832,42 +830,45 @@ public class Cache { if (re != null) { - log.debug("Caught runtime exception in googletracker init:", re); + log.debug("Caught runtime exception in googletracker init:", + re); } if (ex != null) { log.warn( "Failed to initialise GoogleTracker for Jalview Desktop with version " - + vrs, ex); + + vrs, + ex); } if (err != null) { log.error( "Whilst initing GoogleTracker for Jalview Desktop version " - + vrs, err); + + vrs, + err); } } else { if (re != null) { - System.err - .println("Debug: Caught runtime exception in googletracker init:" + System.err.println( + "Debug: Caught runtime exception in googletracker init:" + vrs); re.printStackTrace(); } if (ex != null) { - System.err - .println("Warning: Failed to initialise GoogleTracker for Jalview Desktop with version " + System.err.println( + "Warning: Failed to initialise GoogleTracker for Jalview Desktop with version " + vrs); ex.printStackTrace(); } if (err != null) { - System.err - .println("ERROR: Whilst initing GoogleTracker for Jalview Desktop version " + System.err.println( + "ERROR: Whilst initing GoogleTracker for Jalview Desktop version " + vrs); err.printStackTrace(); } @@ -1028,7 +1029,7 @@ public class Cache { return; } - + // In case colours can't be loaded, we'll remove them // from the default list here. StringBuffer coloursFound = new StringBuffer(); @@ -1057,11 +1058,13 @@ public class Cache { if (coloursFound.toString().length() > 1) { - setProperty(UserDefinedColours.USER_DEFINED_COLOURS, coloursFound.toString()); + setProperty(UserDefinedColours.USER_DEFINED_COLOURS, + coloursFound.toString()); } else { - applicationProperties.remove(UserDefinedColours.USER_DEFINED_COLOURS); + applicationProperties + .remove(UserDefinedColours.USER_DEFINED_COLOURS); } } } diff --git a/src/jalview/bin/Jalview.java b/src/jalview/bin/Jalview.java index 954bb34..9ec0033 100755 --- a/src/jalview/bin/Jalview.java +++ b/src/jalview/bin/Jalview.java @@ -188,8 +188,8 @@ public class Jalview void doMain(String[] args) { System.setSecurityManager(null); - System.out.println("Java version: " - + System.getProperty("java.version")); + System.out + .println("Java version: " + System.getProperty("java.version")); System.out.println(System.getProperty("os.arch") + " " + System.getProperty("os.name") + " " + System.getProperty("os.version")); @@ -212,8 +212,8 @@ public class Jalview Cache.loadProperties(usrPropsFile); // must do this before if (usrPropsFile != null) { - System.out.println("CMD [-props " + usrPropsFile - + "] executed successfully!"); + System.out.println( + "CMD [-props " + usrPropsFile + "] executed successfully!"); } // anything else! @@ -224,12 +224,12 @@ public class Jalview try { Jws2Discoverer.getDiscoverer().setPreferredUrl(jabawsUrl); - System.out.println("CMD [-jabaws " + jabawsUrl - + "] executed successfully!"); + System.out.println( + "CMD [-jabaws " + jabawsUrl + "] executed successfully!"); } catch (MalformedURLException e) { - System.err.println("Invalid jabaws parameter: " + jabawsUrl - + " ignored"); + System.err.println( + "Invalid jabaws parameter: " + jabawsUrl + " ignored"); } } @@ -263,9 +263,8 @@ public class Jalview } catch (NoClassDefFoundError error) { error.printStackTrace(); - System.out - .println("\nEssential logging libraries not found." - + "\nUse: java -Djava.ext.dirs=$PATH_TO_LIB$ jalview.bin.Jalview"); + System.out.println("\nEssential logging libraries not found." + + "\nUse: java -Djava.ext.dirs=$PATH_TO_LIB$ jalview.bin.Jalview"); System.exit(0); } @@ -284,12 +283,12 @@ public class Jalview System.setProperty("apple.laf.useScreenMenuBar", "true"); try { - UIManager.setLookAndFeel(ch.randelshofer.quaqua.QuaquaManager - .getLookAndFeel()); + UIManager.setLookAndFeel( + ch.randelshofer.quaqua.QuaquaManager.getLookAndFeel()); } catch (Throwable e) { - System.err.println("Failed to set QuaQua look and feel: " - + e.toString()); + System.err.println( + "Failed to set QuaQua look and feel: " + e.toString()); } } @@ -326,8 +325,8 @@ public class Jalview // questionnaire Cache.log.debug("Starting questionnaire url at " + url); desktop.checkForQuestionnaire(url); - System.out.println("CMD questionnaire[-" + url - + "] executed successfully!"); + System.out.println( + "CMD questionnaire[-" + url + "] executed successfully!"); } else { @@ -339,8 +338,8 @@ public class Jalview // "http://anaplog.compbio.dundee.ac.uk/cgi-bin/questionnaire.pl"; // // String defurl = "http://www.jalview.org/cgi-bin/questionnaire.pl"; - Cache.log.debug("Starting questionnaire with default url: " - + defurl); + Cache.log.debug( + "Starting questionnaire with default url: " + defurl); desktop.checkForQuestionnaire(defurl); } } @@ -383,8 +382,8 @@ public class Jalview { if (desktop == null || headless) { - System.out - .println("Headless vamsas sessions not yet supported. Sorry."); + System.out.println( + "Headless vamsas sessions not yet supported. Sorry."); System.exit(1); } // if we have a file, start a new session and import it. @@ -434,8 +433,8 @@ public class Jalview { if (desktop.joinVamsasSession(vamsasSession)) { - System.out.println("Successfully joined vamsas session " - + vamsasSession); + System.out.println( + "Successfully joined vamsas session " + vamsasSession); } else { @@ -444,16 +443,16 @@ public class Jalview } } catch (Exception e) { - System.err.println("ERROR: Failed to join vamsas session " - + vamsasSession); + System.err.println( + "ERROR: Failed to join vamsas session " + vamsasSession); e.printStackTrace(); } if (vamsasImport != null) { // the Jalview specific remnants can now be imported into the new // session at the user's leisure. - Cache.log - .info("Skipping Push for import of data into existing vamsas session."); // TODO: + Cache.log.info( + "Skipping Push for import of data into existing vamsas session."); // TODO: // enable // this // when @@ -468,8 +467,9 @@ public class Jalview { if (!headless) { - desktop.setProgressBar(MessageManager - .getString("status.processing_commandline_args"), + desktop.setProgressBar( + MessageManager + .getString("status.processing_commandline_args"), progress = System.currentTimeMillis()); } System.out.println("CMD [-open " + file + "] executed successfully!"); @@ -510,13 +510,13 @@ public class Jalview { data.replaceAll("%20", " "); - ColourSchemeI cs = ColourSchemeProperty.getColourScheme(af - .getViewport().getAlignment(), data); + ColourSchemeI cs = ColourSchemeProperty + .getColourScheme(af.getViewport().getAlignment(), data); if (cs != null) { - System.out.println("CMD [-color " + data - + "] executed successfully!"); + System.out.println( + "CMD [-color " + data + "] executed successfully!"); } af.changeColour(cs); } @@ -528,8 +528,8 @@ public class Jalview af.parseFeaturesFile(data, AppletFormatAdapter.checkProtocol(data)); // System.out.println("Added " + data); - System.out.println("CMD groups[-" + data - + "] executed successfully!"); + System.out.println( + "CMD groups[-" + data + "] executed successfully!"); } data = aparser.getValue("features", true); if (data != null) @@ -537,8 +537,8 @@ public class Jalview af.parseFeaturesFile(data, AppletFormatAdapter.checkProtocol(data)); // System.out.println("Added " + data); - System.out.println("CMD [-features " + data - + "] executed successfully!"); + System.out.println( + "CMD [-features " + data + "] executed successfully!"); } data = aparser.getValue("annotations", true); @@ -546,8 +546,8 @@ public class Jalview { af.loadJalviewDataFile(data, null, null, null); // System.out.println("Added " + data); - System.out.println("CMD [-annotations " + data - + "] executed successfully!"); + System.out.println( + "CMD [-annotations " + data + "] executed successfully!"); } // set or clear the sortbytree flag. if (aparser.contains("sortbytree")) @@ -580,12 +580,12 @@ public class Jalview { try { - System.out.println("CMD [-tree " + data - + "] executed successfully!"); + System.out.println( + "CMD [-tree " + data + "] executed successfully!"); NewickFile nf = new NewickFile(data, AppletFormatAdapter.checkProtocol(data)); - af.getViewport().setCurrentTree( - af.showNewickTree(nf, data).getTree()); + af.getViewport() + .setCurrentTree(af.showNewickTree(nf, data).getTree()); } catch (IOException ex) { System.err.println("Couldn't add tree " + data); @@ -666,16 +666,16 @@ public class Jalview } try { - BioJsHTMLOutput - .refreshVersionInfo(BioJsHTMLOutput.BJS_TEMPLATES_LOCAL_DIRECTORY); + BioJsHTMLOutput.refreshVersionInfo( + BioJsHTMLOutput.BJS_TEMPLATES_LOCAL_DIRECTORY); } catch (URISyntaxException e) { e.printStackTrace(); } BioJsHTMLOutput bjs = new BioJsHTMLOutput(af.alignPanel); bjs.exportHTML(file); - System.out.println("Creating BioJS MSA Viwer HTML file: " - + file); + System.out + .println("Creating BioJS MSA Viwer HTML file: " + file); continue; } else if (outputFormat.equalsIgnoreCase("imgMap")) @@ -687,8 +687,8 @@ public class Jalview else if (outputFormat.equalsIgnoreCase("eps")) { File outputFile = new File(file); - System.out.println("Creating EPS file: " - + outputFile.getAbsolutePath()); + System.out.println( + "Creating EPS file: " + outputFile.getAbsolutePath()); af.createEPS(outputFile); continue; } @@ -720,12 +720,12 @@ public class Jalview if (!headless && file == null && vamsasImport == null && jalview.bin.Cache.getDefault("SHOW_STARTUP_FILE", true)) { - file = jalview.bin.Cache.getDefault( - "STARTUP_FILE", + file = jalview.bin.Cache.getDefault("STARTUP_FILE", jalview.bin.Cache.getDefault("www.jalview.org", "http://www.jalview.org") + "/examples/exampleFile_2_7.jar"); - if (file.equals("http://www.jalview.org/examples/exampleFile_2_3.jar")) + if (file.equals( + "http://www.jalview.org/examples/exampleFile_2_3.jar")) { // hardwire upgrade of the startup file file.replace("_2_3.jar", "_2_7.jar"); @@ -781,8 +781,8 @@ public class Jalview } else { - System.err - .println("Sorry. Groovy Support is not available, so ignoring the provided groovy script " + System.err.println( + "Sorry. Groovy Support is not available, so ignoring the provided groovy script " + groovyscript); } } @@ -799,8 +799,8 @@ public class Jalview private static void showUsage() { - System.out - .println("Usage: jalview -open [FILE] [OUTPUT_FORMAT] [OUTPUT_FILE]\n\n" + System.out.println( + "Usage: jalview -open [FILE] [OUTPUT_FORMAT] [OUTPUT_FILE]\n\n" + "-nodisplay\tRun Jalview without User Interface.\n" + "-props FILE\tUse the given Jalview properties file instead of users default.\n" + "-colour COLOURSCHEME\tThe colourscheme to be applied to the alignment\n" @@ -828,14 +828,18 @@ public class Jalview + "-nousagestats\tTurn off google analytics tracking for this session.\n" + "-sortbytree OR -nosortbytree\tEnable or disable sorting of the given alignment by the given tree\n" // + - // "-setprop PROPERTY=VALUE\tSet the given Jalview property, after all other properties files have been read\n\t (quote the 'PROPERTY=VALUE' pair to ensure spaces are passed in correctly)" + // "-setprop PROPERTY=VALUE\tSet the given Jalview property, + // after all other properties files have been read\n\t + // (quote the 'PROPERTY=VALUE' pair to ensure spaces are + // passed in correctly)" + "-jabaws URL\tSpecify URL for Jabaws services (e.g. for a local installation).\n" + "-dasserver nickname=URL\tAdd and enable a das server with given nickname\n\t\t\t(alphanumeric or underscores only) for retrieval of features for all alignments.\n" + "\t\t\tSources that also support the sequence command may be specified by prepending the URL with sequence:\n" + "\t\t\t e.g. sequence:http://localdas.somewhere.org/das/source)\n" + "-fetchfrom nickname\tQuery nickname for features for the alignments and display them.\n" // + - // "-vdoc vamsas-document\tImport vamsas document into new session or join existing session with same URN\n" + // "-vdoc vamsas-document\tImport vamsas document into new + // session or join existing session with same URN\n" // + "-vses vamsas-session\tJoin session with given URN\n" + "-groovy FILE\tExecute groovy script in FILE, after all other arguments have been processed (if FILE is the text 'STDIN' then the file will be read from STDIN)\n" + "\n~Read documentation in Application or visit http://www.jalview.org for description of Features and Annotations file~\n\n"); @@ -846,10 +850,8 @@ public class Jalview /** * start a User Config prompt asking if we can log usage statistics. */ - PromptUserConfig prompter = new PromptUserConfig( - Desktop.desktop, - "USAGESTATS", - "Jalview Usage Statistics", + PromptUserConfig prompter = new PromptUserConfig(Desktop.desktop, + "USAGESTATS", "Jalview Usage Statistics", "Do you want to help make Jalview better by enabling " + "the collection of usage statistics with Google Analytics ?" + "\n\n(you can enable or disable usage tracking in the preferences)", @@ -858,8 +860,8 @@ public class Jalview @Override public void run() { - Cache.log - .debug("Initialising googletracker for usage stats."); + Cache.log.debug( + "Initialising googletracker for usage stats."); Cache.initGoogleTracker(); Cache.log.debug("Tracking enabled."); } @@ -899,10 +901,10 @@ public class Jalview try { tfile = File.createTempFile("jalview", "groovy"); - PrintWriter outfile = new PrintWriter(new OutputStreamWriter( - new FileOutputStream(tfile))); - BufferedReader br = new BufferedReader(new InputStreamReader( - System.in)); + PrintWriter outfile = new PrintWriter( + new OutputStreamWriter(new FileOutputStream(tfile))); + BufferedReader br = new BufferedReader( + new InputStreamReader(System.in)); String line = null; while ((line = br.readLine()) != null) { @@ -915,8 +917,8 @@ public class Jalview } catch (Exception ex) { System.err.println("Failed to read from STDIN into tempfile " - + ((tfile == null) ? "(tempfile wasn't created)" : tfile - .toString())); + + ((tfile == null) ? "(tempfile wasn't created)" + : tfile.toString())); ex.printStackTrace(); return; } @@ -925,8 +927,8 @@ public class Jalview sfile = tfile.toURI().toURL(); } catch (Exception x) { - System.err - .println("Unexpected Malformed URL Exception for temporary file created from STDIN: " + System.err.println( + "Unexpected Malformed URL Exception for temporary file created from STDIN: " + tfile.toURI()); x.printStackTrace(); return; @@ -1013,9 +1015,8 @@ public class Jalview nickname = data.substring(0, pos); } url = data.substring(pos + 1); - if (url != null - && (url.startsWith("http:") || url - .startsWith("sequence:http:"))) + if (url != null && (url.startsWith("http:") + || url.startsWith("sequence:http:"))) { if (nickname == null) { @@ -1030,8 +1031,8 @@ public class Jalview locsources += "\t"; } locsources = locsources + nickname + "|" + url; - System.err - .println("NOTE! dasserver parameter not yet really supported (got args of " + System.err.println( + "NOTE! dasserver parameter not yet really supported (got args of " + nickname + "|" + url); if (source == null) { @@ -1039,8 +1040,8 @@ public class Jalview } source.addElement(nickname); } - System.out.println("CMD [-dasserver " + data - + "] executed successfully!"); + System.out.println( + "CMD [-dasserver " + data + "] executed successfully!"); } // loop until no more server entries are found. if (locsources != null && locsources.indexOf('|') > -1) { diff --git a/src/jalview/bin/JalviewLite.java b/src/jalview/bin/JalviewLite.java index dbc707d..6504290 100644 --- a/src/jalview/bin/JalviewLite.java +++ b/src/jalview/bin/JalviewLite.java @@ -85,8 +85,8 @@ import netscape.javascript.JSObject; * @author $author$ * @version $Revision: 1.92 $ */ -public class JalviewLite extends Applet implements - StructureSelectionManagerProvider, JalviewLiteJsApi +public class JalviewLite extends Applet + implements StructureSelectionManagerProvider, JalviewLiteJsApi { private static final String TRUE = "true"; @@ -208,9 +208,8 @@ public class JalviewLite extends Applet implements final StructureSelectionManagerProvider me = this; final int pos = apos; // use vamsas listener to broadcast to all listeners in scope - if (alignedPosition != null - && (alignedPosition.trim().length() == 0 || alignedPosition - .toLowerCase().indexOf("false") > -1)) + if (alignedPosition != null && (alignedPosition.trim().length() == 0 + || alignedPosition.toLowerCase().indexOf("false") > -1)) { java.awt.EventQueue.invokeLater(new Runnable() { @@ -343,8 +342,8 @@ public class JalviewLite extends Applet implements from--; } catch (NumberFormatException ex) { - System.err - .println("ERROR: Couldn't parse first integer in range element column selection string '" + System.err.println( + "ERROR: Couldn't parse first integer in range element column selection string '" + cl + "' - format is 'from-to'"); return; } @@ -354,8 +353,8 @@ public class JalviewLite extends Applet implements to--; } catch (NumberFormatException ex) { - System.err - .println("ERROR: Couldn't parse second integer in range element column selection string '" + System.err.println( + "ERROR: Couldn't parse second integer in range element column selection string '" + cl + "' - format is 'from-to'"); return; } @@ -421,8 +420,8 @@ public class JalviewLite extends Applet implements } else { - System.err - .println("ERROR: Couldn't parse integer from point selection element of column selection string '" + System.err.println( + "ERROR: Couldn't parse integer from point selection element of column selection string '" + cl + "'"); return; } @@ -486,8 +485,8 @@ public class JalviewLite extends Applet implements @Override public void run() { - alf.select(sel, csel, alf.getAlignViewport().getAlignment() - .getHiddenColumns()); + alf.select(sel, csel, + alf.getAlignViewport().getAlignment().getHiddenColumns()); } }); } @@ -501,7 +500,8 @@ public class JalviewLite extends Applet implements * String, java.lang.String) */ @Override - public String getSelectedSequencesAsAlignment(String format, String suffix) + public String getSelectedSequencesAsAlignment(String format, + String suffix) { return getSelectedSequencesAsAlignmentFrom(getDefaultTargetFrame(), format, suffix); @@ -938,8 +938,8 @@ public class JalviewLite extends Applet implements listener = listener.trim(); if (listener.length() == 0) { - System.err - .println("jalview Javascript error: Ignoring empty function for mouseover listener."); + System.err.println( + "jalview Javascript error: Ignoring empty function for mouseover listener."); return; } } @@ -951,8 +951,9 @@ public class JalviewLite extends Applet implements if (debug) { System.err.println("Added a mouseover listener for " - + ((af == null) ? "All frames" : "Just views for " - + af.getAlignViewport().getSequenceSetId())); + + ((af == null) ? "All frames" + : "Just views for " + + af.getAlignViewport().getSequenceSetId())); System.err.println("There are now " + javascriptListeners.size() + " listeners in total."); } @@ -984,8 +985,8 @@ public class JalviewLite extends Applet implements listener = listener.trim(); if (listener.length() == 0) { - System.err - .println("jalview Javascript error: Ignoring empty function for selection listener."); + System.err.println( + "jalview Javascript error: Ignoring empty function for selection listener."); return; } } @@ -997,8 +998,9 @@ public class JalviewLite extends Applet implements if (debug) { System.err.println("Added a selection listener for " - + ((af == null) ? "All frames" : "Just views for " - + af.getAlignViewport().getSequenceSetId())); + + ((af == null) ? "All frames" + : "Just views for " + + af.getAlignViewport().getSequenceSetId())); System.err.println("There are now " + javascriptListeners.size() + " listeners in total."); } @@ -1023,8 +1025,8 @@ public class JalviewLite extends Applet implements listener = listener.trim(); if (listener.length() == 0) { - System.err - .println("jalview Javascript error: Ignoring empty function for selection listener."); + System.err.println( + "jalview Javascript error: Ignoring empty function for selection listener."); return; } } @@ -1065,9 +1067,8 @@ public class JalviewLite extends Applet implements { Object lstn = javascriptListeners.elementAt(ms); JsCallBack lstner = (JsCallBack) lstn; - if ((af == null || lstner.getAlignFrame() == af) - && (listener == null || lstner.getListenerFunction().equals( - listener))) + if ((af == null || lstner.getAlignFrame() == af) && (listener == null + || lstner.getListenerFunction().equals(listener))) { javascriptListeners.removeElement(lstner); msSize--; @@ -1164,8 +1165,8 @@ public class JalviewLite extends Applet implements * java.lang.String, java.lang.String) */ @Override - public void mouseOverStructure(final String pdbResNum, - final String chain, final String pdbfile) + public void mouseOverStructure(final String pdbResNum, final String chain, + final String pdbfile) { final StructureSelectionManagerProvider me = this; java.awt.EventQueue.invokeLater(new Runnable() @@ -1180,9 +1181,9 @@ public class JalviewLite extends Applet implements chain, pdbfile); if (debug) { - System.err.println("mouseOver for '" + pdbResNum - + "' in chain '" + chain + "' in structure '" + pdbfile - + "'"); + System.err + .println("mouseOver for '" + pdbResNum + "' in chain '" + + chain + "' in structure '" + pdbfile + "'"); } } catch (NumberFormatException e) { @@ -1212,8 +1213,8 @@ public class JalviewLite extends Applet implements { try { - alf.scrollTo(new Integer(topRow).intValue(), new Integer( - leftHandColumn).intValue()); + alf.scrollTo(new Integer(topRow).intValue(), + new Integer(leftHandColumn).intValue()); } catch (Exception ex) { @@ -1280,8 +1281,8 @@ public class JalviewLite extends Applet implements } catch (Exception ex) { - System.err - .println("Couldn't parse integer arguments (leftHandColumn='" + System.err.println( + "Couldn't parse integer arguments (leftHandColumn='" + leftHandColumn + "')"); ex.printStackTrace(); } @@ -1355,8 +1356,8 @@ public class JalviewLite extends Applet implements { try { - BufferedReader reader = new BufferedReader(new InputStreamReader( - url.openStream())); + BufferedReader reader = new BufferedReader( + new InputStreamReader(url.openStream())); String line; while ((line = reader.readLine()) != null) { @@ -1423,8 +1424,8 @@ public class JalviewLite extends Applet implements } catch (Exception ex) { - System.err - .println("Warning: No JalviewLite javascript callbacks available."); + System.err.println( + "Warning: No JalviewLite javascript callbacks available."); if (debug) { ex.printStackTrace(); @@ -1466,9 +1467,8 @@ public class JalviewLite extends Applet implements } else { - throw new Error( - MessageManager - .getString("error.invalid_separator_parameter")); + throw new Error(MessageManager + .getString("error.invalid_separator_parameter")); } } int r = 255; @@ -1625,8 +1625,8 @@ public class JalviewLite extends Applet implements { // do onInit with the JS executor thread new JSFunctionExec(this).executeJavascriptFunction(true, - initjscallback, null, "Calling oninit callback '" - + initjscallback + "'."); + initjscallback, null, + "Calling oninit callback '" + initjscallback + "'."); } catch (Exception e) { System.err.println("Exception when executing _oninit callback '" @@ -1737,8 +1737,8 @@ public class JalviewLite extends Applet implements g.fillRect(0, 0, getSize().width, getSize().height); g.setColor(Color.red); g.drawString( - MessageManager.getString("label.jalview_cannot_open_file"), - 5, 15); + MessageManager.getString("label.jalview_cannot_open_file"), 5, + 15); g.drawString("\"" + file + "\"", 5, 30); } else if (embedded) @@ -1798,8 +1798,8 @@ public class JalviewLite extends Applet implements } if (!jmolAvailable) { - System.out - .println("Jmol not available - Using MCview for structures"); + System.out.println( + "Jmol not available - Using MCview for structures"); } } catch (java.lang.ClassNotFoundException ex) { @@ -1810,8 +1810,8 @@ public class JalviewLite extends Applet implements jmolAvailable = false; if (debug) { - System.err - .println("Skipping Jmol check. Will use MCView (probably)"); + System.err.println( + "Skipping Jmol check. Will use MCView (probably)"); } } checkedForJmol = true; @@ -1949,7 +1949,8 @@ public class JalviewLite extends Applet implements */ private void startLoading() { - dbgMsg("Loading thread started with:\n>>file\n" + _file + ">>endfile"); + dbgMsg("Loading thread started with:\n>>file\n" + _file + + ">>endfile"); dbgMsg("Loading started."); @@ -2050,14 +2051,14 @@ public class JalviewLite extends Applet implements if (protocol == DataSourceType.PASTE) { - newAlignFrame.setTitle(MessageManager.formatMessage( - "label.sequences_from", new Object[] { applet - .getDocumentBase().toString() })); + newAlignFrame.setTitle(MessageManager + .formatMessage("label.sequences_from", new Object[] + { applet.getDocumentBase().toString() })); } newAlignFrame.statusBar.setText(MessageManager.formatMessage( - "label.successfully_loaded_file", - new Object[] { resolvedFile })); + "label.successfully_loaded_file", new Object[] + { resolvedFile })); return newAlignFrame; } @@ -2080,8 +2081,8 @@ public class JalviewLite extends Applet implements dbgMsg(">>>Dump finished."); } catch (Exception e) { - System.err - .println("Exception when trying to dump the content of the file parameter."); + System.err.println( + "Exception when trying to dump the content of the file parameter."); e.printStackTrace(); } } @@ -2104,8 +2105,8 @@ public class JalviewLite extends Applet implements * related to JAL-434 */ - applet.setAlignPdbStructures(getDefaultParameter("alignpdbfiles", - false)); + applet.setAlignPdbStructures( + getDefaultParameter("alignpdbfiles", false)); /* * @@ -2121,9 +2122,11 @@ public class JalviewLite extends Applet implements Vector pdbs = new Vector(); // create a lazy matcher if we're asked to jalview.analysis.SequenceIdMatcher matcher = (applet - .getDefaultParameter("relaxedidmatch", false)) ? new jalview.analysis.SequenceIdMatcher( - alignFrame.getAlignViewport().getAlignment() - .getSequencesArray()) : null; + .getDefaultParameter("relaxedidmatch", false)) + ? new jalview.analysis.SequenceIdMatcher( + alignFrame.getAlignViewport().getAlignment() + .getSequencesArray()) + : null; String param; do @@ -2152,8 +2155,9 @@ public class JalviewLite extends Applet implements String sequence = applet.getParameter("PDBSEQ"); if (sequence != null) { - seqs = new SequenceI[] { matcher == null ? (Sequence) alignFrame - .getAlignViewport().getAlignment().findName(sequence) + seqs = new SequenceI[] { matcher == null + ? (Sequence) alignFrame.getAlignViewport() + .getAlignment().findName(sequence) : matcher.findIdMatch(sequence) }; } @@ -2174,9 +2178,10 @@ public class JalviewLite extends Applet implements tmp2.add(st2.nextToken()); seqstring = st2.nextToken(); } - tmp.add(matcher == null ? (Sequence) alignFrame - .getAlignViewport().getAlignment() - .findName(seqstring) : matcher.findIdMatch(seqstring)); + tmp.add(matcher == null + ? (Sequence) alignFrame.getAlignViewport() + .getAlignment().findName(seqstring) + : matcher.findIdMatch(seqstring)); } seqs = tmp.toArray(new SequenceI[tmp.size()]); @@ -2196,8 +2201,9 @@ public class JalviewLite extends Applet implements if (seqs[i] != null) { ((Sequence) seqs[i]).addPDBId(pdb); - StructureSelectionManager.getStructureSelectionManager( - applet).registerPDBEntry(pdb); + StructureSelectionManager + .getStructureSelectionManager(applet) + .registerPDBEntry(pdb); } else { @@ -2205,8 +2211,8 @@ public class JalviewLite extends Applet implements { // this may not really be a problem but we give a warning // anyway - System.err - .println("Warning: Possible input parsing error: Null sequence for attachment of PDB (sequence " + System.err.println( + "Warning: Possible input parsing error: Null sequence for attachment of PDB (sequence " + i + ")"); } } @@ -2232,7 +2238,8 @@ public class JalviewLite extends Applet implements PDBEntry[] pdb = new PDBEntry[pdbs.size()]; String[][] chains = new String[pdbs.size()][]; String[] protocols = new String[pdbs.size()]; - for (int pdbsi = 0, pdbsiSize = pdbs.size(); pdbsi < pdbsiSize; pdbsi++) + for (int pdbsi = 0, pdbsiSize = pdbs + .size(); pdbsi < pdbsiSize; pdbsi++) { Object[] o = (Object[]) pdbs.elementAt(pdbsi); pdb[pdbsi] = (PDBEntry) o[0]; @@ -2313,8 +2320,8 @@ public class JalviewLite extends Applet implements } else { - System.err - .println("Annotations were not added from annotation file '" + System.err.println( + "Annotations were not added from annotation file '" + param + "'"); } } @@ -2385,14 +2392,14 @@ public class JalviewLite extends Applet implements { if (debug) { - System.err - .println("Attempting to load T-COFFEE score file from the scoreFile parameter"); + System.err.println( + "Attempting to load T-COFFEE score file from the scoreFile parameter"); } result = alignFrame.loadScoreFile(sScoreFile); if (!result) { - System.err - .println("Failed to parse T-COFFEE parameter as a valid score file ('" + System.err.println( + "Failed to parse T-COFFEE parameter as a valid score file ('" + sScoreFile + "')"); } } catch (Exception e) @@ -2489,8 +2496,8 @@ public class JalviewLite extends Applet implements { return initialAlignFrame; } - System.err - .println("Implementation error: Jalview Applet API cannot work out which AlignFrame to use."); + System.err.println( + "Implementation error: Jalview Applet API cannot work out which AlignFrame to use."); return null; } @@ -2568,8 +2575,8 @@ public class JalviewLite extends Applet implements } if (debug) { - System.err.println("Empty Array from '" + separator - + "' separated List"); + System.err.println( + "Empty Array from '" + separator + "' separated List"); } return null; } @@ -2611,16 +2618,16 @@ public class JalviewLite extends Applet implements } if (debug) { - System.err.println("Returning '" + separator - + "' separated List:\n"); + System.err + .println("Returning '" + separator + "' separated List:\n"); System.err.println(v); } return v.toString(); } if (debug) { - System.err.println("Returning empty '" + separator - + "' separated List\n"); + System.err.println( + "Returning empty '" + separator + "' separated List\n"); } return "" + separator; } @@ -2633,8 +2640,8 @@ public class JalviewLite extends Applet implements @Override public String getFeatureGroups() { - String lst = arrayToSeparatorList(getDefaultTargetFrame() - .getFeatureGroups()); + String lst = arrayToSeparatorList( + getDefaultTargetFrame().getFeatureGroups()); return lst; } @@ -2660,8 +2667,8 @@ public class JalviewLite extends Applet implements @Override public String getFeatureGroupsOfState(boolean visible) { - return arrayToSeparatorList(getDefaultTargetFrame() - .getFeatureGroupsOfState(visible)); + return arrayToSeparatorList( + getDefaultTargetFrame().getFeatureGroupsOfState(visible)); } /* @@ -2894,8 +2901,8 @@ public class JalviewLite extends Applet implements Color col = ColorUtils.parseColourString(colprop); if (col == null) { - System.err.println("Couldn't parse '" + colprop - + "' as a colour for " + colparam); + System.err.println("Couldn't parse '" + colprop + "' as a colour for " + + colparam); } return (col == null) ? defcolour : col; } @@ -2930,8 +2937,7 @@ public class JalviewLite extends Applet implements String codebase = localref.toString(); String localfile = localref.getFile(); resolvedPath = codebase.substring(0, - codebase.length() - localfile.length()) - + targetPath; + codebase.length() - localfile.length()) + targetPath; return resolvedPath; } @@ -2965,8 +2971,8 @@ public class JalviewLite extends Applet implements } if (debug) { - System.err.println("resolveUrlForLocalOrAbsolute returning " - + resolvedPath); + System.err.println( + "resolveUrlForLocalOrAbsolute returning " + resolvedPath); } return resolvedPath; } @@ -2988,17 +2994,15 @@ public class JalviewLite extends Applet implements // form valid URL // Should really use docbase, not codebase. URL prepend; - url = resolveUrlForLocalOrAbsolute( - url, - prepend = getDefaultParameter("resolvetocodebase", false) ? getCodeBase() + url = resolveUrlForLocalOrAbsolute(url, + prepend = getDefaultParameter("resolvetocodebase", false) + ? getCodeBase() : getDocumentBase()); if (debug) { - System.err - .println("Show url (prepended " - + prepend - + " - toggle resolvetocodebase if code/docbase resolution is wrong): " - + url); + System.err.println("Show url (prepended " + prepend + + " - toggle resolvetocodebase if code/docbase resolution is wrong): " + + url); } } else diff --git a/src/jalview/bin/JalviewLiteURLRetrieve.java b/src/jalview/bin/JalviewLiteURLRetrieve.java index d6fb090..f2ffda5 100644 --- a/src/jalview/bin/JalviewLiteURLRetrieve.java +++ b/src/jalview/bin/JalviewLiteURLRetrieve.java @@ -86,8 +86,8 @@ public class JalviewLiteURLRetrieve extends Applet } catch (Exception ex) { - System.out.println("Exception checking resources: " + file + " " - + ex); + System.out.println( + "Exception checking resources: " + file + " " + ex); } if (file.indexOf("://") > -1) { @@ -116,8 +116,8 @@ public class JalviewLiteURLRetrieve extends Applet + " cannot be read with protocol==" + protocol); return; } - FileFormatI format = FileFormats.getInstance().forName( - getParameter("format")); + FileFormatI format = FileFormats.getInstance() + .forName(getParameter("format")); if (format == null) { format = new IdentifyFile().identify(file, protocol); @@ -138,8 +138,8 @@ public class JalviewLiteURLRetrieve extends Applet } if (al != null) { - System.out.println(new AppletFormatAdapter().formatSequences( - FileFormat.Fasta, al, false)); + System.out.println(new AppletFormatAdapter() + .formatSequences(FileFormat.Fasta, al, false)); } } catch (Exception e) { diff --git a/src/jalview/binding/Alignment.java b/src/jalview/binding/Alignment.java index b8fcb2c..0116b44 100644 --- a/src/jalview/binding/Alignment.java +++ b/src/jalview/binding/Alignment.java @@ -161,8 +161,8 @@ public class Alignment implements java.io.Serializable throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { - return (jalview.binding.Alignment) Unmarshaller.unmarshal( - jalview.binding.Alignment.class, reader); + return (jalview.binding.Alignment) Unmarshaller + .unmarshal(jalview.binding.Alignment.class, reader); } /** diff --git a/src/jalview/binding/Annotation.java b/src/jalview/binding/Annotation.java index 86f1a63..2c9414b 100644 --- a/src/jalview/binding/Annotation.java +++ b/src/jalview/binding/Annotation.java @@ -440,8 +440,8 @@ public class Annotation implements java.io.Serializable throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { - return (jalview.binding.Annotation) Unmarshaller.unmarshal( - jalview.binding.Annotation.class, reader); + return (jalview.binding.Annotation) Unmarshaller + .unmarshal(jalview.binding.Annotation.class, reader); } /** diff --git a/src/jalview/binding/AnnotationElement.java b/src/jalview/binding/AnnotationElement.java index 1f583c7..505d91e 100644 --- a/src/jalview/binding/AnnotationElement.java +++ b/src/jalview/binding/AnnotationElement.java @@ -286,8 +286,8 @@ public class AnnotationElement implements java.io.Serializable throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { - return (jalview.binding.AnnotationElement) Unmarshaller.unmarshal( - jalview.binding.AnnotationElement.class, reader); + return (jalview.binding.AnnotationElement) Unmarshaller + .unmarshal(jalview.binding.AnnotationElement.class, reader); } /** diff --git a/src/jalview/binding/Colour.java b/src/jalview/binding/Colour.java index c1de152..25cf9bf 100644 --- a/src/jalview/binding/Colour.java +++ b/src/jalview/binding/Colour.java @@ -475,12 +475,13 @@ public class Colour implements java.io.Serializable * if this object is an invalid instance according to the schema * @return the unmarshaled jalview.binding.Colour */ - public static jalview.binding.Colour unmarshal(final java.io.Reader reader) + public static jalview.binding.Colour unmarshal( + final java.io.Reader reader) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { - return (jalview.binding.Colour) Unmarshaller.unmarshal( - jalview.binding.Colour.class, reader); + return (jalview.binding.Colour) Unmarshaller + .unmarshal(jalview.binding.Colour.class, reader); } /** diff --git a/src/jalview/binding/Feature.java b/src/jalview/binding/Feature.java index 1cb6eee..d72b29c 100644 --- a/src/jalview/binding/Feature.java +++ b/src/jalview/binding/Feature.java @@ -285,8 +285,8 @@ public class Feature implements java.io.Serializable throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { - return (jalview.binding.Feature) Unmarshaller.unmarshal( - jalview.binding.Feature.class, reader); + return (jalview.binding.Feature) Unmarshaller + .unmarshal(jalview.binding.Feature.class, reader); } /** diff --git a/src/jalview/binding/FeatureSettings.java b/src/jalview/binding/FeatureSettings.java index c4d5c4f..321536d 100644 --- a/src/jalview/binding/FeatureSettings.java +++ b/src/jalview/binding/FeatureSettings.java @@ -97,9 +97,9 @@ public class FeatureSettings implements java.io.Serializable // check bounds for index if (index < 0 || index >= this._settingList.size()) { - throw new IndexOutOfBoundsException("getSetting: Index value '" - + index + "' not in range [0.." - + (this._settingList.size() - 1) + "]"); + throw new IndexOutOfBoundsException( + "getSetting: Index value '" + index + "' not in range [0.." + + (this._settingList.size() - 1) + "]"); } return (jalview.binding.Setting) _settingList.get(index); @@ -230,9 +230,9 @@ public class FeatureSettings implements java.io.Serializable // check bounds for index if (index < 0 || index >= this._settingList.size()) { - throw new IndexOutOfBoundsException("setSetting: Index value '" - + index + "' not in range [0.." - + (this._settingList.size() - 1) + "]"); + throw new IndexOutOfBoundsException( + "setSetting: Index value '" + index + "' not in range [0.." + + (this._settingList.size() - 1) + "]"); } this._settingList.set(index, vSetting); @@ -270,8 +270,8 @@ public class FeatureSettings implements java.io.Serializable throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { - return (jalview.binding.FeatureSettings) Unmarshaller.unmarshal( - jalview.binding.FeatureSettings.class, reader); + return (jalview.binding.FeatureSettings) Unmarshaller + .unmarshal(jalview.binding.FeatureSettings.class, reader); } /** diff --git a/src/jalview/binding/Features.java b/src/jalview/binding/Features.java index c730f4b..bf283df 100644 --- a/src/jalview/binding/Features.java +++ b/src/jalview/binding/Features.java @@ -105,8 +105,8 @@ public class Features extends Feature implements java.io.Serializable throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { - return (jalview.binding.Feature) Unmarshaller.unmarshal( - jalview.binding.Features.class, reader); + return (jalview.binding.Feature) Unmarshaller + .unmarshal(jalview.binding.Features.class, reader); } /** diff --git a/src/jalview/binding/JGroup.java b/src/jalview/binding/JGroup.java index 477cc30..555c2fd 100644 --- a/src/jalview/binding/JGroup.java +++ b/src/jalview/binding/JGroup.java @@ -737,12 +737,13 @@ public class JGroup implements java.io.Serializable * if this object is an invalid instance according to the schema * @return the unmarshaled jalview.binding.JGroup */ - public static jalview.binding.JGroup unmarshal(final java.io.Reader reader) + public static jalview.binding.JGroup unmarshal( + final java.io.Reader reader) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { - return (jalview.binding.JGroup) Unmarshaller.unmarshal( - jalview.binding.JGroup.class, reader); + return (jalview.binding.JGroup) Unmarshaller + .unmarshal(jalview.binding.JGroup.class, reader); } /** diff --git a/src/jalview/binding/JSeq.java b/src/jalview/binding/JSeq.java index 996a807..49334e1 100644 --- a/src/jalview/binding/JSeq.java +++ b/src/jalview/binding/JSeq.java @@ -229,9 +229,9 @@ public class JSeq implements java.io.Serializable // check bounds for index if (index < 0 || index >= this._featuresList.size()) { - throw new IndexOutOfBoundsException("getFeatures: Index value '" - + index + "' not in range [0.." - + (this._featuresList.size() - 1) + "]"); + throw new IndexOutOfBoundsException( + "getFeatures: Index value '" + index + "' not in range [0.." + + (this._featuresList.size() - 1) + "]"); } return (jalview.binding.Features) _featuresList.get(index); @@ -286,9 +286,9 @@ public class JSeq implements java.io.Serializable // check bounds for index if (index < 0 || index >= this._pdbidsList.size()) { - throw new IndexOutOfBoundsException("getPdbids: Index value '" - + index + "' not in range [0.." - + (this._pdbidsList.size() - 1) + "]"); + throw new IndexOutOfBoundsException( + "getPdbids: Index value '" + index + "' not in range [0.." + + (this._pdbidsList.size() - 1) + "]"); } return (jalview.binding.Pdbids) _pdbidsList.get(index); @@ -524,9 +524,9 @@ public class JSeq implements java.io.Serializable // check bounds for index if (index < 0 || index >= this._featuresList.size()) { - throw new IndexOutOfBoundsException("setFeatures: Index value '" - + index + "' not in range [0.." - + (this._featuresList.size() - 1) + "]"); + throw new IndexOutOfBoundsException( + "setFeatures: Index value '" + index + "' not in range [0.." + + (this._featuresList.size() - 1) + "]"); } this._featuresList.set(index, vFeatures); @@ -575,9 +575,9 @@ public class JSeq implements java.io.Serializable // check bounds for index if (index < 0 || index >= this._pdbidsList.size()) { - throw new IndexOutOfBoundsException("setPdbids: Index value '" - + index + "' not in range [0.." - + (this._pdbidsList.size() - 1) + "]"); + throw new IndexOutOfBoundsException( + "setPdbids: Index value '" + index + "' not in range [0.." + + (this._pdbidsList.size() - 1) + "]"); } this._pdbidsList.set(index, vPdbids); @@ -626,8 +626,8 @@ public class JSeq implements java.io.Serializable throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { - return (jalview.binding.JSeq) Unmarshaller.unmarshal( - jalview.binding.JSeq.class, reader); + return (jalview.binding.JSeq) Unmarshaller + .unmarshal(jalview.binding.JSeq.class, reader); } /** diff --git a/src/jalview/binding/JalviewModel.java b/src/jalview/binding/JalviewModel.java index 7141b27..28645e0 100644 --- a/src/jalview/binding/JalviewModel.java +++ b/src/jalview/binding/JalviewModel.java @@ -214,8 +214,8 @@ public class JalviewModel implements java.io.Serializable throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { - return (jalview.binding.JalviewModel) Unmarshaller.unmarshal( - jalview.binding.JalviewModel.class, reader); + return (jalview.binding.JalviewModel) Unmarshaller + .unmarshal(jalview.binding.JalviewModel.class, reader); } /** diff --git a/src/jalview/binding/JalviewModelSequence.java b/src/jalview/binding/JalviewModelSequence.java index eb0716d..9020ce2 100644 --- a/src/jalview/binding/JalviewModelSequence.java +++ b/src/jalview/binding/JalviewModelSequence.java @@ -286,9 +286,9 @@ public class JalviewModelSequence implements java.io.Serializable // check bounds for index if (index < 0 || index >= this._JGroupList.size()) { - throw new IndexOutOfBoundsException("getJGroup: Index value '" - + index + "' not in range [0.." - + (this._JGroupList.size() - 1) + "]"); + throw new IndexOutOfBoundsException( + "getJGroup: Index value '" + index + "' not in range [0.." + + (this._JGroupList.size() - 1) + "]"); } return (jalview.binding.JGroup) _JGroupList.get(index); @@ -473,9 +473,9 @@ public class JalviewModelSequence implements java.io.Serializable // check bounds for index if (index < 0 || index >= this._viewportList.size()) { - throw new IndexOutOfBoundsException("getViewport: Index value '" - + index + "' not in range [0.." - + (this._viewportList.size() - 1) + "]"); + throw new IndexOutOfBoundsException( + "getViewport: Index value '" + index + "' not in range [0.." + + (this._viewportList.size() - 1) + "]"); } return (jalview.binding.Viewport) _viewportList.get(index); @@ -743,9 +743,9 @@ public class JalviewModelSequence implements java.io.Serializable // check bounds for index if (index < 0 || index >= this._JGroupList.size()) { - throw new IndexOutOfBoundsException("setJGroup: Index value '" - + index + "' not in range [0.." - + (this._JGroupList.size() - 1) + "]"); + throw new IndexOutOfBoundsException( + "setJGroup: Index value '" + index + "' not in range [0.." + + (this._JGroupList.size() - 1) + "]"); } this._JGroupList.set(index, vJGroup); @@ -896,9 +896,9 @@ public class JalviewModelSequence implements java.io.Serializable // check bounds for index if (index < 0 || index >= this._viewportList.size()) { - throw new IndexOutOfBoundsException("setViewport: Index value '" - + index + "' not in range [0.." - + (this._viewportList.size() - 1) + "]"); + throw new IndexOutOfBoundsException( + "setViewport: Index value '" + index + "' not in range [0.." + + (this._viewportList.size() - 1) + "]"); } this._viewportList.set(index, vViewport); @@ -936,8 +936,8 @@ public class JalviewModelSequence implements java.io.Serializable throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { - return (jalview.binding.JalviewModelSequence) Unmarshaller.unmarshal( - jalview.binding.JalviewModelSequence.class, reader); + return (jalview.binding.JalviewModelSequence) Unmarshaller + .unmarshal(jalview.binding.JalviewModelSequence.class, reader); } /** diff --git a/src/jalview/binding/JalviewUserColours.java b/src/jalview/binding/JalviewUserColours.java index 02bb12e..6709487 100644 --- a/src/jalview/binding/JalviewUserColours.java +++ b/src/jalview/binding/JalviewUserColours.java @@ -107,9 +107,9 @@ public class JalviewUserColours implements java.io.Serializable // check bounds for index if (index < 0 || index >= this._colourList.size()) { - throw new IndexOutOfBoundsException("getColour: Index value '" - + index + "' not in range [0.." - + (this._colourList.size() - 1) + "]"); + throw new IndexOutOfBoundsException( + "getColour: Index value '" + index + "' not in range [0.." + + (this._colourList.size() - 1) + "]"); } return (Colour) _colourList.get(index); @@ -261,9 +261,9 @@ public class JalviewUserColours implements java.io.Serializable // check bounds for index if (index < 0 || index >= this._colourList.size()) { - throw new IndexOutOfBoundsException("setColour: Index value '" - + index + "' not in range [0.." - + (this._colourList.size() - 1) + "]"); + throw new IndexOutOfBoundsException( + "setColour: Index value '" + index + "' not in range [0.." + + (this._colourList.size() - 1) + "]"); } this._colourList.set(index, vColour); @@ -325,8 +325,8 @@ public class JalviewUserColours implements java.io.Serializable throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { - return (jalview.binding.JalviewUserColours) Unmarshaller.unmarshal( - jalview.binding.JalviewUserColours.class, reader); + return (jalview.binding.JalviewUserColours) Unmarshaller + .unmarshal(jalview.binding.JalviewUserColours.class, reader); } /** diff --git a/src/jalview/binding/Pdbentry.java b/src/jalview/binding/Pdbentry.java index 6c0e745..77bb446 100644 --- a/src/jalview/binding/Pdbentry.java +++ b/src/jalview/binding/Pdbentry.java @@ -325,8 +325,8 @@ public class Pdbentry implements java.io.Serializable throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { - return (jalview.binding.Pdbentry) Unmarshaller.unmarshal( - jalview.binding.Pdbentry.class, reader); + return (jalview.binding.Pdbentry) Unmarshaller + .unmarshal(jalview.binding.Pdbentry.class, reader); } /** diff --git a/src/jalview/binding/PdbentryItem.java b/src/jalview/binding/PdbentryItem.java index 93c46e0..30a0512 100644 --- a/src/jalview/binding/PdbentryItem.java +++ b/src/jalview/binding/PdbentryItem.java @@ -90,9 +90,9 @@ public class PdbentryItem implements java.io.Serializable // check bounds for index if (index < 0 || index >= this._propertyList.size()) { - throw new IndexOutOfBoundsException("getProperty: Index value '" - + index + "' not in range [0.." - + (this._propertyList.size() - 1) + "]"); + throw new IndexOutOfBoundsException( + "getProperty: Index value '" + index + "' not in range [0.." + + (this._propertyList.size() - 1) + "]"); } return (jalview.binding.Property) _propertyList.get(index); @@ -169,9 +169,9 @@ public class PdbentryItem implements java.io.Serializable // check bounds for index if (index < 0 || index >= this._propertyList.size()) { - throw new IndexOutOfBoundsException("setProperty: Index value '" - + index + "' not in range [0.." - + (this._propertyList.size() - 1) + "]"); + throw new IndexOutOfBoundsException( + "setProperty: Index value '" + index + "' not in range [0.." + + (this._propertyList.size() - 1) + "]"); } this._propertyList.set(index, vProperty); diff --git a/src/jalview/binding/Pdbids.java b/src/jalview/binding/Pdbids.java index d821a6a..79cae6c 100644 --- a/src/jalview/binding/Pdbids.java +++ b/src/jalview/binding/Pdbids.java @@ -105,8 +105,8 @@ public class Pdbids extends Pdbentry implements java.io.Serializable throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { - return (jalview.binding.Pdbentry) Unmarshaller.unmarshal( - jalview.binding.Pdbids.class, reader); + return (jalview.binding.Pdbentry) Unmarshaller + .unmarshal(jalview.binding.Pdbids.class, reader); } /** diff --git a/src/jalview/binding/Property.java b/src/jalview/binding/Property.java index df3decf..5823fed 100644 --- a/src/jalview/binding/Property.java +++ b/src/jalview/binding/Property.java @@ -161,8 +161,8 @@ public class Property implements java.io.Serializable throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { - return (jalview.binding.Property) Unmarshaller.unmarshal( - jalview.binding.Property.class, reader); + return (jalview.binding.Property) Unmarshaller + .unmarshal(jalview.binding.Property.class, reader); } /** diff --git a/src/jalview/binding/Sequence.java b/src/jalview/binding/Sequence.java index 5ab8a37..845f224 100644 --- a/src/jalview/binding/Sequence.java +++ b/src/jalview/binding/Sequence.java @@ -105,8 +105,8 @@ public class Sequence extends SequenceType implements java.io.Serializable throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { - return (jalview.binding.SequenceType) Unmarshaller.unmarshal( - jalview.binding.Sequence.class, reader); + return (jalview.binding.SequenceType) Unmarshaller + .unmarshal(jalview.binding.Sequence.class, reader); } /** diff --git a/src/jalview/binding/SequenceSet.java b/src/jalview/binding/SequenceSet.java index c12934d..3d81bae 100644 --- a/src/jalview/binding/SequenceSet.java +++ b/src/jalview/binding/SequenceSet.java @@ -173,9 +173,9 @@ public class SequenceSet implements java.io.Serializable // check bounds for index if (index < 0 || index >= this._annotationList.size()) { - throw new IndexOutOfBoundsException("getAnnotation: Index value '" - + index + "' not in range [0.." - + (this._annotationList.size() - 1) + "]"); + throw new IndexOutOfBoundsException( + "getAnnotation: Index value '" + index + "' not in range [0.." + + (this._annotationList.size() - 1) + "]"); } return (jalview.binding.Annotation) _annotationList.get(index); @@ -231,9 +231,9 @@ public class SequenceSet implements java.io.Serializable // check bounds for index if (index < 0 || index >= this._sequenceList.size()) { - throw new IndexOutOfBoundsException("getSequence: Index value '" - + index + "' not in range [0.." - + (this._sequenceList.size() - 1) + "]"); + throw new IndexOutOfBoundsException( + "getSequence: Index value '" + index + "' not in range [0.." + + (this._sequenceList.size() - 1) + "]"); } return (jalview.binding.Sequence) _sequenceList.get(index); @@ -428,9 +428,9 @@ public class SequenceSet implements java.io.Serializable // check bounds for index if (index < 0 || index >= this._annotationList.size()) { - throw new IndexOutOfBoundsException("setAnnotation: Index value '" - + index + "' not in range [0.." - + (this._annotationList.size() - 1) + "]"); + throw new IndexOutOfBoundsException( + "setAnnotation: Index value '" + index + "' not in range [0.." + + (this._annotationList.size() - 1) + "]"); } this._annotationList.set(index, vAnnotation); @@ -479,9 +479,9 @@ public class SequenceSet implements java.io.Serializable // check bounds for index if (index < 0 || index >= this._sequenceList.size()) { - throw new IndexOutOfBoundsException("setSequence: Index value '" - + index + "' not in range [0.." - + (this._sequenceList.size() - 1) + "]"); + throw new IndexOutOfBoundsException( + "setSequence: Index value '" + index + "' not in range [0.." + + (this._sequenceList.size() - 1) + "]"); } this._sequenceList.set(index, vSequence); @@ -519,8 +519,8 @@ public class SequenceSet implements java.io.Serializable throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { - return (jalview.binding.SequenceSet) Unmarshaller.unmarshal( - jalview.binding.SequenceSet.class, reader); + return (jalview.binding.SequenceSet) Unmarshaller + .unmarshal(jalview.binding.SequenceSet.class, reader); } /** diff --git a/src/jalview/binding/SequenceType.java b/src/jalview/binding/SequenceType.java index d725405..7f10bca 100644 --- a/src/jalview/binding/SequenceType.java +++ b/src/jalview/binding/SequenceType.java @@ -187,8 +187,8 @@ public class SequenceType implements java.io.Serializable throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { - return (jalview.binding.SequenceType) Unmarshaller.unmarshal( - jalview.binding.SequenceType.class, reader); + return (jalview.binding.SequenceType) Unmarshaller + .unmarshal(jalview.binding.SequenceType.class, reader); } /** diff --git a/src/jalview/binding/Setting.java b/src/jalview/binding/Setting.java index 6641429..d098303 100644 --- a/src/jalview/binding/Setting.java +++ b/src/jalview/binding/Setting.java @@ -243,8 +243,8 @@ public class Setting implements java.io.Serializable throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { - return (jalview.binding.Setting) Unmarshaller.unmarshal( - jalview.binding.Setting.class, reader); + return (jalview.binding.Setting) Unmarshaller + .unmarshal(jalview.binding.Setting.class, reader); } /** diff --git a/src/jalview/binding/Tree.java b/src/jalview/binding/Tree.java index 04ea0a4..7005c93 100644 --- a/src/jalview/binding/Tree.java +++ b/src/jalview/binding/Tree.java @@ -824,8 +824,8 @@ public class Tree implements java.io.Serializable throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { - return (jalview.binding.Tree) Unmarshaller.unmarshal( - jalview.binding.Tree.class, reader); + return (jalview.binding.Tree) Unmarshaller + .unmarshal(jalview.binding.Tree.class, reader); } /** diff --git a/src/jalview/binding/UserColourScheme.java b/src/jalview/binding/UserColourScheme.java index 555693c..e1a1a2f 100644 --- a/src/jalview/binding/UserColourScheme.java +++ b/src/jalview/binding/UserColourScheme.java @@ -19,8 +19,8 @@ import org.exolab.castor.xml.Unmarshaller; * * @version $Revision$ $Date$ */ -public class UserColourScheme extends JalviewUserColours implements - java.io.Serializable +public class UserColourScheme extends JalviewUserColours + implements java.io.Serializable { // ----------------/ @@ -106,8 +106,8 @@ public class UserColourScheme extends JalviewUserColours implements throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { - return (jalview.binding.JalviewUserColours) Unmarshaller.unmarshal( - jalview.binding.UserColourScheme.class, reader); + return (jalview.binding.JalviewUserColours) Unmarshaller + .unmarshal(jalview.binding.UserColourScheme.class, reader); } /** diff --git a/src/jalview/binding/UserColours.java b/src/jalview/binding/UserColours.java index 6a8d73c..9dbcc9e 100644 --- a/src/jalview/binding/UserColours.java +++ b/src/jalview/binding/UserColours.java @@ -162,8 +162,8 @@ public class UserColours implements java.io.Serializable throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { - return (jalview.binding.UserColours) Unmarshaller.unmarshal( - jalview.binding.UserColours.class, reader); + return (jalview.binding.UserColours) Unmarshaller + .unmarshal(jalview.binding.UserColours.class, reader); } /** diff --git a/src/jalview/binding/VAMSAS.java b/src/jalview/binding/VAMSAS.java index c06de29..b5a32da 100644 --- a/src/jalview/binding/VAMSAS.java +++ b/src/jalview/binding/VAMSAS.java @@ -105,7 +105,8 @@ public class VAMSAS implements java.io.Serializable * @throws java.lang.IndexOutOfBoundsException * if the index given is outside the bounds of the collection */ - public void addSequenceSet(final int index, final SequenceSet vSequenceSet) + public void addSequenceSet(final int index, + final SequenceSet vSequenceSet) throws java.lang.IndexOutOfBoundsException { this._sequenceSetList.add(index, vSequenceSet); @@ -182,9 +183,9 @@ public class VAMSAS implements java.io.Serializable // check bounds for index if (index < 0 || index >= this._alignmentList.size()) { - throw new IndexOutOfBoundsException("getAlignment: Index value '" - + index + "' not in range [0.." - + (this._alignmentList.size() - 1) + "]"); + throw new IndexOutOfBoundsException( + "getAlignment: Index value '" + index + "' not in range [0.." + + (this._alignmentList.size() - 1) + "]"); } return (Alignment) _alignmentList.get(index); @@ -469,9 +470,9 @@ public class VAMSAS implements java.io.Serializable // check bounds for index if (index < 0 || index >= this._alignmentList.size()) { - throw new IndexOutOfBoundsException("setAlignment: Index value '" - + index + "' not in range [0.." - + (this._alignmentList.size() - 1) + "]"); + throw new IndexOutOfBoundsException( + "setAlignment: Index value '" + index + "' not in range [0.." + + (this._alignmentList.size() - 1) + "]"); } this._alignmentList.set(index, vAlignment); @@ -501,7 +502,8 @@ public class VAMSAS implements java.io.Serializable * @throws java.lang.IndexOutOfBoundsException * if the index given is outside the bounds of the collection */ - public void setSequenceSet(final int index, final SequenceSet vSequenceSet) + public void setSequenceSet(final int index, + final SequenceSet vSequenceSet) throws java.lang.IndexOutOfBoundsException { // check bounds for index @@ -579,12 +581,13 @@ public class VAMSAS implements java.io.Serializable * if this object is an invalid instance according to the schema * @return the unmarshaled jalview.binding.VAMSAS */ - public static jalview.binding.VAMSAS unmarshal(final java.io.Reader reader) + public static jalview.binding.VAMSAS unmarshal( + final java.io.Reader reader) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { - return (jalview.binding.VAMSAS) Unmarshaller.unmarshal( - jalview.binding.VAMSAS.class, reader); + return (jalview.binding.VAMSAS) Unmarshaller + .unmarshal(jalview.binding.VAMSAS.class, reader); } /** diff --git a/src/jalview/binding/VamsasModel.java b/src/jalview/binding/VamsasModel.java index e4c5e0d..d3c90cf 100644 --- a/src/jalview/binding/VamsasModel.java +++ b/src/jalview/binding/VamsasModel.java @@ -100,12 +100,13 @@ public class VamsasModel extends VAMSAS implements java.io.Serializable * if this object is an invalid instance according to the schema * @return the unmarshaled jalview.binding.VAMSAS */ - public static jalview.binding.VAMSAS unmarshal(final java.io.Reader reader) + public static jalview.binding.VAMSAS unmarshal( + final java.io.Reader reader) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { - return (jalview.binding.VAMSAS) Unmarshaller.unmarshal( - jalview.binding.VamsasModel.class, reader); + return (jalview.binding.VAMSAS) Unmarshaller + .unmarshal(jalview.binding.VamsasModel.class, reader); } /** diff --git a/src/jalview/binding/Viewport.java b/src/jalview/binding/Viewport.java index d144378..183e048 100644 --- a/src/jalview/binding/Viewport.java +++ b/src/jalview/binding/Viewport.java @@ -1444,8 +1444,8 @@ public class Viewport implements java.io.Serializable throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { - return (jalview.binding.Viewport) Unmarshaller.unmarshal( - jalview.binding.Viewport.class, reader); + return (jalview.binding.Viewport) Unmarshaller + .unmarshal(jalview.binding.Viewport.class, reader); } /** diff --git a/src/jalview/commands/EditCommand.java b/src/jalview/commands/EditCommand.java index 21ff841..d319249 100644 --- a/src/jalview/commands/EditCommand.java +++ b/src/jalview/commands/EditCommand.java @@ -222,14 +222,16 @@ public class EditCommand implements CommandI /** * Check a contiguous edit; either *
      - *
    • a new Insert positions to the right of the last , or
    • + *
    • a new Insert positions to the right of the last , + * or
    • *
    • a new Delete gaps which is positions to the left of the last * delete.
    • *
    */ - boolean contiguous = (action == Action.INSERT_GAP && e.position == lastEdit.position - + lastEdit.number) - || (action == Action.DELETE_GAP && e.position + e.number == lastEdit.position); + boolean contiguous = (action == Action.INSERT_GAP + && e.position == lastEdit.position + lastEdit.number) + || (action == Action.DELETE_GAP + && e.position + e.number == lastEdit.position); if (contiguous) { /* @@ -475,7 +477,8 @@ public class EditCommand implements CommandI { command.seqs[s].insertCharAt(command.position, command.number, command.gapChar); - // System.out.println("pos: "+command.position+" number: "+command.number); + // System.out.println("pos: "+command.position+" number: + // "+command.number); } adjustAnnotations(command, true, false, null); @@ -504,8 +507,8 @@ public class EditCommand implements CommandI { for (int s = 0; s < command.seqs.length; s++) { - command.seqs[s].deleteChars(command.position, command.position - + command.number); + command.seqs[s].deleteChars(command.position, + command.position + command.number); } adjustAnnotations(command, false, false, null); @@ -536,8 +539,8 @@ public class EditCommand implements CommandI // we are redoing an undone cut. sequence.setDatasetSequence(null); } - sequence.deleteChars(command.position, command.position - + command.number); + sequence.deleteChars(command.position, + command.position + command.number); if (command.oldds != null && command.oldds[i] != null) { // oldds entry contains the cut dataset sequence. @@ -555,11 +558,10 @@ public class EditCommand implements CommandI command.oldds = new SequenceI[command.seqs.length]; } command.oldds[i] = oldds; - adjustFeatures( - command, - i, + adjustFeatures(command, i, sequence.findPosition(command.position), - sequence.findPosition(command.position + command.number), + sequence.findPosition( + command.position + command.number), false); } } @@ -646,8 +648,8 @@ public class EditCommand implements CommandI { newDSNeeded = true; start = command.seqs[i].findPosition(command.position); - end = command.seqs[i].findPosition(command.position - + command.number); + end = command.seqs[i] + .findPosition(command.position + command.number); } if (command.seqs[i].getStart() == start) { @@ -731,16 +733,16 @@ public class EditCommand implements CommandI tmp = new StringBuffer(oldstring.substring(0, start)); tmp.append(command.string[i]); String nogaprep = jalview.analysis.AlignSeq.extractGaps( - jalview.util.Comparison.GapChars, new String( - command.string[i])); + jalview.util.Comparison.GapChars, + new String(command.string[i])); int ipos = command.seqs[i].findPosition(start) - command.seqs[i].getStart(); tmp.append(oldstring.substring(end)); command.seqs[i].setSequence(tmp.toString()); command.string[i] = oldstring.substring(start, end).toCharArray(); String nogapold = jalview.analysis.AlignSeq.extractGaps( - jalview.util.Comparison.GapChars, new String( - command.string[i])); + jalview.util.Comparison.GapChars, + new String(command.string[i])); if (!nogaprep.toLowerCase().equals(nogapold.toLowerCase())) { if (newDSWasNeeded) @@ -833,7 +835,8 @@ public class EditCommand implements CommandI tmp = saved; command.deletedAnnotationRows.put(command.seqs[s], saved); // and then remove any annotation in the other views - for (int alview = 0; views != null && alview < views.length; alview++) + for (int alview = 0; views != null + && alview < views.length; alview++) { if (views[alview] != command.al) { @@ -885,7 +888,8 @@ public class EditCommand implements CommandI } // and then duplicate added annotation on every other alignment // view - for (int vnum = 0; views != null && vnum < views.length; vnum++) + for (int vnum = 0; views != null + && vnum < views.length; vnum++) { if (views[vnum] != command.al) { @@ -1012,8 +1016,8 @@ public class EditCommand implements CommandI } System.arraycopy(annotations[a].annotations, command.position, - temp, command.position + command.number, aSize - - command.position); + temp, command.position + command.number, + aSize - command.position); } else { @@ -1056,8 +1060,8 @@ public class EditCommand implements CommandI annotations[a].annotations.length - command.position); if (copylen > 0) { - System.arraycopy(annotations[a].annotations, - command.position, deleted, 0, copylen); // command.number); + System.arraycopy(annotations[a].annotations, command.position, + deleted, 0, copylen); // command.number); } } @@ -1066,10 +1070,10 @@ public class EditCommand implements CommandI if (annotations[a].annotations.length > command.position + command.number) { - System.arraycopy(annotations[a].annotations, command.position - + command.number, temp, command.position, - annotations[a].annotations.length - command.position - - command.number); // aSize + System.arraycopy(annotations[a].annotations, + command.position + command.number, temp, + command.position, annotations[a].annotations.length + - command.position - command.number); // aSize } } else diff --git a/src/jalview/commands/RemoveGapsCommand.java b/src/jalview/commands/RemoveGapsCommand.java index c8dadfa..c5c35f1 100644 --- a/src/jalview/commands/RemoveGapsCommand.java +++ b/src/jalview/commands/RemoveGapsCommand.java @@ -109,9 +109,10 @@ public class RemoveGapsCommand extends EditCommand if (!delete && startCol > -1) { - this.appendEdit(Action.DELETE_GAP, new SequenceI[] { seqs[s] }, - start + startCol - deletedCols, endCol - startCol, al, - false, null); + this.appendEdit( + Action.DELETE_GAP, new SequenceI[] + { seqs[s] }, start + startCol - deletedCols, + endCol - startCol, al, false, null); deletedCols += (endCol - startCol); startCol = -1; @@ -120,9 +121,10 @@ public class RemoveGapsCommand extends EditCommand } if (delete && startCol > -1) { - this.appendEdit(Action.DELETE_GAP, new SequenceI[] { seqs[s] }, - start + startCol - deletedCols, jSize - startCol, al, - false, null); + this.appendEdit( + Action.DELETE_GAP, new SequenceI[] + { seqs[s] }, start + startCol - deletedCols, + jSize - startCol, al, false, null); } } diff --git a/src/jalview/controller/AlignViewController.java b/src/jalview/controller/AlignViewController.java index bc7f212..24fc181 100644 --- a/src/jalview/controller/AlignViewController.java +++ b/src/jalview/controller/AlignViewController.java @@ -85,10 +85,11 @@ public class AlignViewController implements AlignViewControllerI SequenceGroup[] gps = null; if (sg != null && (cs == null || cs.isEmpty())) { - gps = jalview.analysis.Grouping.makeGroupsFrom(viewport - .getSequenceSelection(), viewport.getAlignmentView(true) - .getSequenceStrings(viewport.getGapCharacter()), viewport - .getAlignment().getGroups()); + gps = jalview.analysis.Grouping.makeGroupsFrom( + viewport.getSequenceSelection(), + viewport.getAlignmentView(true) + .getSequenceStrings(viewport.getGapCharacter()), + viewport.getAlignment().getGroups()); } else { @@ -96,8 +97,8 @@ public class AlignViewController implements AlignViewControllerI { gps = jalview.analysis.Grouping.makeGroupsFromCols( (sg == null) ? viewport.getAlignment().getSequencesArray() - : sg.getSequences().toArray(new SequenceI[0]), cs, - viewport.getAlignment().getGroups()); + : sg.getSequences().toArray(new SequenceI[0]), + cs, viewport.getAlignment().getGroups()); } } if (gps != null) @@ -170,8 +171,9 @@ public class AlignViewController implements AlignViewControllerI // JBPNote this routine could also mark rows, not just columns. // need a decent query structure to allow all types of feature searches BitSet bs = new BitSet(); - SequenceCollectionI sqcol = (viewport.getSelectionGroup() == null || extendCurrent) ? viewport - .getAlignment() : viewport.getSelectionGroup(); + SequenceCollectionI sqcol = (viewport.getSelectionGroup() == null + || extendCurrent) ? viewport.getAlignment() + : viewport.getSelectionGroup(); int nseq = findColumnsWithFeature(featureType, sqcol, bs); @@ -189,14 +191,14 @@ public class AlignViewController implements AlignViewControllerI { viewport.setColumnSelection(cs); alignPanel.paintAlignment(true); - int columnCount = invert ? (sqcol.getEndRes() - sqcol.getStartRes() + 1) - - bs.cardinality() + int columnCount = invert + ? (sqcol.getEndRes() - sqcol.getStartRes() + 1) + - bs.cardinality() : bs.cardinality(); avcg.setStatus(MessageManager.formatMessage( - "label.view_controller_toggled_marked", - new String[] { - toggle ? MessageManager.getString("label.toggled") - : MessageManager.getString("label.marked"), + "label.view_controller_toggled_marked", new String[] + { toggle ? MessageManager.getString("label.toggled") + : MessageManager.getString("label.marked"), String.valueOf(columnCount), invert ? MessageManager .getString("label.not_containing") @@ -207,9 +209,9 @@ public class AlignViewController implements AlignViewControllerI } else { - avcg.setStatus(MessageManager.formatMessage( - "label.no_feature_of_type_found", - new String[] { featureType })); + avcg.setStatus(MessageManager + .formatMessage("label.no_feature_of_type_found", new String[] + { featureType })); if (!extendCurrent) { cs.clear(); @@ -358,8 +360,8 @@ public class AlignViewController implements AlignViewControllerI } SequenceI[] oldOrder = al.getSequencesArray(); AlignmentSorter.sortByFeature(typ, gps, start, stop, al, method); - avcg.addHistoryItem(new OrderCommand(methodText, oldOrder, viewport - .getAlignment())); + avcg.addHistoryItem(new OrderCommand(methodText, oldOrder, + viewport.getAlignment())); alignPanel.paintAlignment(true); } @@ -377,9 +379,10 @@ public class AlignViewController implements AlignViewControllerI boolean featuresFile = false; try { - featuresFile = new FeaturesFile(false, file, protocol).parse(viewport - .getAlignment().getDataset(), alignPanel.getFeatureRenderer() - .getFeatureColours(), false, relaxedIdMatching); + featuresFile = new FeaturesFile(false, file, protocol).parse( + viewport.getAlignment().getDataset(), + alignPanel.getFeatureRenderer().getFeatureColours(), false, + relaxedIdMatching); } catch (Exception ex) { ex.printStackTrace(); @@ -415,8 +418,9 @@ public class AlignViewController implements AlignViewControllerI } // JBPNote this routine could also mark rows, not just columns. BitSet bs = new BitSet(); - SequenceCollectionI sqcol = (viewport.getSelectionGroup() == null || extendCurrent) ? viewport - .getAlignment() : viewport.getSelectionGroup(); + SequenceCollectionI sqcol = (viewport.getSelectionGroup() == null + || extendCurrent) ? viewport.getAlignment() + : viewport.getSelectionGroup(); // this could be a lambda... - the remains of the method is boilerplate, // except for the different messages for reporting selection. @@ -436,14 +440,14 @@ public class AlignViewController implements AlignViewControllerI { viewport.setColumnSelection(cs); alignPanel.paintAlignment(true); - int columnCount = invert ? (sqcol.getEndRes() - sqcol.getStartRes() + 1) - - bs.cardinality() + int columnCount = invert + ? (sqcol.getEndRes() - sqcol.getStartRes() + 1) + - bs.cardinality() : bs.cardinality(); avcg.setStatus(MessageManager.formatMessage( - "label.view_controller_toggled_marked", - new String[] { - toggle ? MessageManager.getString("label.toggled") - : MessageManager.getString("label.marked"), + "label.view_controller_toggled_marked", new String[] + { toggle ? MessageManager.getString("label.toggled") + : MessageManager.getString("label.marked"), String.valueOf(columnCount), invert ? MessageManager .getString("label.not_containing") diff --git a/src/jalview/datamodel/AlignedCodonFrame.java b/src/jalview/datamodel/AlignedCodonFrame.java index 4fbfd62..83eeb3d 100644 --- a/src/jalview/datamodel/AlignedCodonFrame.java +++ b/src/jalview/datamodel/AlignedCodonFrame.java @@ -90,10 +90,11 @@ public class AlignedCodonFrame return that.mapping == null; } // TODO: can simplify by asserting fromSeq is a dataset sequence - return (this.fromSeq == that.fromSeq || (this.fromSeq != null - && that.fromSeq != null - && this.fromSeq.getDatasetSequence() != null && this.fromSeq - .getDatasetSequence() == that.fromSeq.getDatasetSequence())) + return (this.fromSeq == that.fromSeq + || (this.fromSeq != null && that.fromSeq != null + && this.fromSeq.getDatasetSequence() != null + && this.fromSeq.getDatasetSequence() == that.fromSeq + .getDatasetSequence())) && this.mapping.equals(that.mapping); } @@ -149,8 +150,8 @@ public class AlignedCodonFrame SequenceI fromSeq = (dnaseq.getDatasetSequence() == null) ? dnaseq : dnaseq.getDatasetSequence(); - SequenceI toSeq = (aaseq.getDatasetSequence() == null) ? aaseq : aaseq - .getDatasetSequence(); + SequenceI toSeq = (aaseq.getDatasetSequence() == null) ? aaseq + : aaseq.getDatasetSequence(); /* * if we already hold a mapping between these sequences, just add to it @@ -434,8 +435,8 @@ public class AlignedCodonFrame { SequenceI targetDs = target.getDatasetSequence() == null ? target : target.getDatasetSequence(); - SequenceI queryDs = query.getDatasetSequence() == null ? query : query - .getDatasetSequence(); + SequenceI queryDs = query.getDatasetSequence() == null ? query + : query.getDatasetSequence(); if (targetDs == null || queryDs == null /*|| dnaToProt == null*/) { return null; @@ -506,8 +507,10 @@ public class AlignedCodonFrame codonPos = MappingUtils.flattenRanges(codonPos); char[] dna = dnaSeq.getSequence(); int start = dnaSeq.getStart(); - result.add(new char[] { dna[codonPos[0] - start], - dna[codonPos[1] - start], dna[codonPos[2] - start] }); + result.add( + new char[] + { dna[codonPos[0] - start], dna[codonPos[1] - start], + dna[codonPos[2] - start] }); } } return result.isEmpty() ? null : result; @@ -579,8 +582,9 @@ public class AlignedCodonFrame */ protected int realiseWith(SequenceI seq, boolean doUpdate) { - SequenceI ds = seq.getDatasetSequence() != null ? seq - .getDatasetSequence() : seq; + SequenceI ds = seq.getDatasetSequence() != null + ? seq.getDatasetSequence() + : seq; int count = 0; /* @@ -654,8 +658,8 @@ public class AlignedCodonFrame { int start = replacement.getStart(); int end = replacement.getEnd(); - boolean mappingOverlapsSequence = (mapStart >= start && mapStart <= end) - || (mapEnd >= start && mapEnd <= end); + boolean mappingOverlapsSequence = (mapStart >= start + && mapStart <= end) || (mapEnd >= start && mapEnd <= end); if (mappingOverlapsSequence) { return true; @@ -732,8 +736,8 @@ public class AlignedCodonFrame { SequenceI dssFrom = fromSeq.getDatasetSequence() == null ? fromSeq : fromSeq.getDatasetSequence(); - SequenceI dssTo = toSeq.getDatasetSequence() == null ? toSeq : toSeq - .getDatasetSequence(); + SequenceI dssTo = toSeq.getDatasetSequence() == null ? toSeq + : toSeq.getDatasetSequence(); for (SequenceToSequenceMapping mapping : mappings) { diff --git a/src/jalview/datamodel/Alignment.java b/src/jalview/datamodel/Alignment.java index 098222f..5733719 100755 --- a/src/jalview/datamodel/Alignment.java +++ b/src/jalview/datamodel/Alignment.java @@ -143,9 +143,8 @@ public class Alignment implements AlignmentI */ public static AlignmentI createAlignment(CigarArray compactAlignment) { - throw new Error( - MessageManager - .getString("error.alignment_cigararray_not_implemented")); + throw new Error(MessageManager + .getString("error.alignment_cigararray_not_implemented")); // this(compactAlignment.refCigars); } @@ -188,7 +187,6 @@ public class Alignment implements AlignmentI return AlignmentUtils.getSequencesByName(this); } - @Override public SequenceI getSequenceAt(int i) { @@ -475,7 +473,9 @@ public class Alignment implements AlignmentI return; } // remove annotation very quickly - AlignmentAnnotation[] t, todelete = new AlignmentAnnotation[annotations.length], tokeep = new AlignmentAnnotation[annotations.length]; + AlignmentAnnotation[] t, + todelete = new AlignmentAnnotation[annotations.length], + tokeep = new AlignmentAnnotation[annotations.length]; int i, p, k; if (gp == null) { @@ -608,7 +608,7 @@ public class Alignment implements AlignmentI sqname = sq.getName(); if (sqname.equals(token) // exact match || (b && // allow imperfect matches - case varies - (sqname.equalsIgnoreCase(token)))) + (sqname.equalsIgnoreCase(token)))) { return getSequenceAt(i); } @@ -689,7 +689,6 @@ public class Alignment implements AlignmentI return -1; } - @Override public int getHeight() { @@ -1096,10 +1095,9 @@ public class Alignment implements AlignmentI } if (dbr.getMap().getTo().getDatasetSequence() != null) { - throw new Error( - "Implementation error: Map.getTo() for dbref " + dbr - + " from " + curDs.getName() - + " is not a dataset sequence."); + throw new Error("Implementation error: Map.getTo() for dbref " + + dbr + " from " + curDs.getName() + + " is not a dataset sequence."); } // we recurse to add all forward references to dataset sequences via // DBRefs/etc @@ -1236,8 +1234,8 @@ public class Alignment implements AlignmentI current = getSequenceAt(i); // This should really be a sequence method ends[i * 2] = current.findIndex(current.getStart()); - ends[i * 2 + 1] = current.findIndex(current.getStart() - + current.getLength()); + ends[i * 2 + 1] = current + .findIndex(current.getStart() + current.getLength()); boolean hitres = false; for (int j = 0, rs = 0, ssiz = current.getLength(); j < ssiz; j++) { @@ -1478,8 +1476,10 @@ public class Alignment implements AlignmentI boolean hashidden = toappend.getHiddenSequences() != null && toappend.getHiddenSequences().hiddenSequences != null; // get all sequences including any hidden ones - List sqs = (hashidden) ? toappend.getHiddenSequences() - .getFullAlignment().getSequences() : toappend.getSequences(); + List sqs = (hashidden) + ? toappend.getHiddenSequences().getFullAlignment() + .getSequences() + : toappend.getSequences(); if (sqs != null) { // avoid self append deadlock by @@ -1561,8 +1561,8 @@ public class Alignment implements AlignmentI if (ourval instanceof String) { // append strings - this.setProperty(k, ((String) ourval) + "; " - + ((String) toapprop)); + this.setProperty(k, + ((String) ourval) + "; " + ((String) toapprop)); } else { @@ -1630,9 +1630,8 @@ public class Alignment implements AlignmentI { for (AlignmentAnnotation a : alignmentAnnotation) { - if (a.getCalcId() == calcId - || (a.getCalcId() != null && calcId != null && a - .getCalcId().equals(calcId))) + if (a.getCalcId() == calcId || (a.getCalcId() != null + && calcId != null && a.getCalcId().equals(calcId))) { aa.add(a); } @@ -1648,11 +1647,12 @@ public class Alignment implements AlignmentI ArrayList aa = new ArrayList<>(); for (AlignmentAnnotation ann : getAlignmentAnnotation()) { - if ((calcId == null || (ann.getCalcId() != null && ann.getCalcId() - .equals(calcId))) - && (seq == null || (ann.sequenceRef != null && ann.sequenceRef == seq)) - && (label == null || (ann.label != null && ann.label - .equals(label)))) + if ((calcId == null || (ann.getCalcId() != null + && ann.getCalcId().equals(calcId))) + && (seq == null || (ann.sequenceRef != null + && ann.sequenceRef == seq)) + && (label == null + || (ann.label != null && ann.label.equals(label)))) { aa.add(ann); } diff --git a/src/jalview/datamodel/AlignmentAnnotation.java b/src/jalview/datamodel/AlignmentAnnotation.java index 1594f2b..6bbd566 100755 --- a/src/jalview/datamodel/AlignmentAnnotation.java +++ b/src/jalview/datamodel/AlignmentAnnotation.java @@ -379,49 +379,25 @@ public class AlignmentAnnotation firstChar = annotations[i].displayCharacter.charAt(0); // check to see if it looks like a sequence or is secondary structure // labelling. - if (annotations[i].secondaryStructure != ' ' - && !hasIcons - && - // Uncomment to only catch case where - // displayCharacter==secondary - // Structure - // to correctly redisplay SS annotation imported from Stockholm, - // exported to JalviewXML and read back in again. - // && - // annotations[i].displayCharacter.charAt(0)==annotations[i].secondaryStructure - firstChar != ' ' - && firstChar != '$' - && firstChar != 0xCE - && firstChar != '(' - && firstChar != '[' - && firstChar != '>' - && firstChar != '{' - && firstChar != 'A' - && firstChar != 'B' - && firstChar != 'C' - && firstChar != 'D' - && firstChar != 'E' - && firstChar != 'F' - && firstChar != 'G' - && firstChar != 'H' - && firstChar != 'I' - && firstChar != 'J' - && firstChar != 'K' - && firstChar != 'L' - && firstChar != 'M' - && firstChar != 'N' - && firstChar != 'O' - && firstChar != 'P' - && firstChar != 'Q' - && firstChar != 'R' - && firstChar != 'S' - && firstChar != 'T' - && firstChar != 'U' - && firstChar != 'V' - && firstChar != 'W' - && firstChar != 'X' - && firstChar != 'Y' - && firstChar != 'Z' + if (annotations[i].secondaryStructure != ' ' && !hasIcons && + // Uncomment to only catch case where + // displayCharacter==secondary + // Structure + // to correctly redisplay SS annotation imported from Stockholm, + // exported to JalviewXML and read back in again. + // && + // annotations[i].displayCharacter.charAt(0)==annotations[i].secondaryStructure + firstChar != ' ' && firstChar != '$' && firstChar != 0xCE + && firstChar != '(' && firstChar != '[' && firstChar != '>' + && firstChar != '{' && firstChar != 'A' && firstChar != 'B' + && firstChar != 'C' && firstChar != 'D' && firstChar != 'E' + && firstChar != 'F' && firstChar != 'G' && firstChar != 'H' + && firstChar != 'I' && firstChar != 'J' && firstChar != 'K' + && firstChar != 'L' && firstChar != 'M' && firstChar != 'N' + && firstChar != 'O' && firstChar != 'P' && firstChar != 'Q' + && firstChar != 'R' && firstChar != 'S' && firstChar != 'T' + && firstChar != 'U' && firstChar != 'V' && firstChar != 'W' + && firstChar != 'X' && firstChar != 'Y' && firstChar != 'Z' && firstChar != '-' && firstChar < jalview.schemes.ResidueProperties.aaIndex.length) { @@ -512,12 +488,17 @@ public class AlignmentAnnotation { return ((index + offset < 0) || (index + offset) >= max || annotations[index + offset] == null - || (annotations[index + offset].secondaryStructure <= ' ') ? ' ' - : annotations[index + offset].displayCharacter == null - || annotations[index + offset].displayCharacter - .length() == 0 ? annotations[index + offset].secondaryStructure - : annotations[index + offset].displayCharacter - .charAt(0)); + || (annotations[index + offset].secondaryStructure <= ' ') + ? ' ' + : annotations[index + offset].displayCharacter == null + || annotations[index + + offset].displayCharacter + .length() == 0 + ? annotations[index + + offset].secondaryStructure + : annotations[index + + offset].displayCharacter + .charAt(0)); } @Override @@ -528,10 +509,15 @@ public class AlignmentAnnotation for (int i = offset; i < mx; i++) { - string[i] = (annotations[i] == null || (annotations[i].secondaryStructure <= 32)) ? ' ' - : (annotations[i].displayCharacter == null - || annotations[i].displayCharacter.length() == 0 ? annotations[i].secondaryStructure - : annotations[i].displayCharacter.charAt(0)); + string[i] = (annotations[i] == null + || (annotations[i].secondaryStructure <= 32)) + ? ' ' + : (annotations[i].displayCharacter == null + || annotations[i].displayCharacter + .length() == 0 + ? annotations[i].secondaryStructure + : annotations[i].displayCharacter + .charAt(0)); } return new String(string); } @@ -807,8 +793,8 @@ public class AlignmentAnnotation Annotation[] temp = new Annotation[endRes - startRes + 1]; if (startRes < annotations.length) { - System.arraycopy(annotations, startRes, temp, 0, endRes - startRes - + 1); + System.arraycopy(annotations, startRes, temp, 0, + endRes - startRes + 1); } if (sequenceRef != null) { @@ -1028,8 +1014,8 @@ public class AlignmentAnnotation { if (i + 1 < iSize) { - System.arraycopy(annotations, i + 1, annotations, i, iSize - i - - 1); + System.arraycopy(annotations, i + 1, annotations, i, + iSize - i - 1); } iSize--; } @@ -1061,14 +1047,16 @@ public class AlignmentAnnotation { if (sequenceRef != null) { - boolean rIsDs = sequenceRef.getDatasetSequence() == null, tIsDs = sequenceI - .getDatasetSequence() == null; + boolean rIsDs = sequenceRef.getDatasetSequence() == null, + tIsDs = sequenceI.getDatasetSequence() == null; if (sequenceRef != sequenceI - && (rIsDs && !tIsDs && sequenceRef != sequenceI - .getDatasetSequence()) - && (!rIsDs && tIsDs && sequenceRef.getDatasetSequence() != sequenceI) - && (!rIsDs && !tIsDs && sequenceRef.getDatasetSequence() != sequenceI - .getDatasetSequence()) + && (rIsDs && !tIsDs + && sequenceRef != sequenceI.getDatasetSequence()) + && (!rIsDs && tIsDs + && sequenceRef.getDatasetSequence() != sequenceI) + && (!rIsDs && !tIsDs + && sequenceRef.getDatasetSequence() != sequenceI + .getDatasetSequence()) && !sequenceRef.equals(sequenceI)) { // if sequenceRef isn't intersecting with sequenceI @@ -1263,8 +1251,10 @@ public class AlignmentAnnotation throw new Error( "liftOver currently not implemented for transfer of annotation between different types of seqeunce"); } - boolean mapIsTo = (sp2sq != null) ? (sp2sq.getTo() == sq || sp2sq - .getTo() == sq.getDatasetSequence()) : false; + boolean mapIsTo = (sp2sq != null) + ? (sp2sq.getTo() == sq + || sp2sq.getTo() == sq.getDatasetSequence()) + : false; // TODO build a better annotation element map and get rid of annotations[] Map mapForsq = new HashMap(); @@ -1274,9 +1264,9 @@ public class AlignmentAnnotation { for (Entry ie : sequenceMapping.entrySet()) { - Integer mpos = Integer.valueOf(mapIsTo ? sp2sq - .getMappedPosition(ie.getKey()) : sp2sq.getPosition(ie - .getKey())); + Integer mpos = Integer + .valueOf(mapIsTo ? sp2sq.getMappedPosition(ie.getKey()) + : sp2sq.getPosition(ie.getKey())); if (mpos >= sq.getStart() && mpos <= sq.getEnd()) { mapForsq.put(mpos, ie.getValue()); @@ -1463,8 +1453,8 @@ public class AlignmentAnnotation * up to and excluding the target column; if the count is less * than 1, the opening bracket is unmatched, so return its match */ - String closer = String.valueOf(Rna - .getMatchingClosingParenthesis(symbol)); + String closer = String + .valueOf(Rna.getMatchingClosingParenthesis(symbol)); String opener = String.valueOf(symbol); int count = 0; for (int j = col + 1; j < column; j++) diff --git a/src/jalview/datamodel/AlignmentOrder.java b/src/jalview/datamodel/AlignmentOrder.java index ccc9bfa..6d09145 100755 --- a/src/jalview/datamodel/AlignmentOrder.java +++ b/src/jalview/datamodel/AlignmentOrder.java @@ -218,7 +218,8 @@ public class AlignmentOrder { if (!identity) { - throw new Error("Weak sequenceI equivalence not yet implemented."); + throw new Error( + "Weak sequenceI equivalence not yet implemented."); } else { @@ -285,7 +286,8 @@ public class AlignmentOrder } if (!identity) { - throw new Error("Weak sequenceI equivalence not yet implemented."); + throw new Error( + "Weak sequenceI equivalence not yet implemented."); } else { diff --git a/src/jalview/datamodel/AlignmentView.java b/src/jalview/datamodel/AlignmentView.java index 9ca70f2..d3d1b2b 100644 --- a/src/jalview/datamodel/AlignmentView.java +++ b/src/jalview/datamodel/AlignmentView.java @@ -140,18 +140,17 @@ public class AlignmentView * - when set, any groups on the given alignment will be marked on * the view */ - public AlignmentView(AlignmentI alignment, - HiddenColumns hidden, - SequenceGroup selection, - boolean hasHiddenColumns, boolean selectedRegionOnly, - boolean recordGroups) + public AlignmentView(AlignmentI alignment, HiddenColumns hidden, + SequenceGroup selection, boolean hasHiddenColumns, + boolean selectedRegionOnly, boolean recordGroups) { // refactored from AlignViewport.getAlignmentView(selectedOnly); this(new jalview.datamodel.CigarArray(alignment, (hasHiddenColumns ? hidden : null), (selectedRegionOnly ? selection : null)), - (selectedRegionOnly && selection != null) ? selection - .getStartRes() : 0); + (selectedRegionOnly && selection != null) + ? selection.getStartRes() + : 0); isNa = alignment.isNucleotide(); // walk down SeqCigar array and Alignment Array - optionally restricted by // selected region. @@ -163,8 +162,8 @@ public class AlignmentView { List sel = selection.getSequences(null); this.selected = new ScGroup(); - selseqs = selection - .getSequencesInOrder(alignment, selectedRegionOnly); + selseqs = selection.getSequencesInOrder(alignment, + selectedRegionOnly); } else { @@ -335,9 +334,9 @@ public class AlignmentView { HiddenColumns hidden = new HiddenColumns(); - return new Object[] { - SeqCigar.createAlignmentSequences(sequences, gapCharacter, hidden, - contigs), hidden }; + return new Object[] { SeqCigar.createAlignmentSequences(sequences, + gapCharacter, hidden, contigs), + hidden }; } /** @@ -370,8 +369,8 @@ public class AlignmentView * - true if vcal is alignment of the visible regions of the view * (e.g. as returned from getVisibleAlignment) */ - private void addPrunedGroupsInOrder(AlignmentI vcal, int gstart, - int gend, boolean viscontigs) + private void addPrunedGroupsInOrder(AlignmentI vcal, int gstart, int gend, + boolean viscontigs) { boolean r = false; if (gstart > -1 && gstart <= gend) @@ -441,8 +440,8 @@ public class AlignmentView for (int h = 0; h < contigs.length; h += 3) { { - prune.addShift(p + contigs[h + 1], contigs[h + 2] - - contigs[h + 1]); + prune.addShift(p + contigs[h + 1], + contigs[h + 2] - contigs[h + 1]); } p = contigs[h + 1] + contigs[h + 2]; } @@ -652,8 +651,8 @@ public class AlignmentView SequenceI mseq[] = new SequenceI[sequences.length]; for (int s = 0; s < mseq.length; s++) { - mseq[s] = sequences[s].getSeq(gapCharacter).getSubSequence( - start, contigs[contig + 1]); + mseq[s] = sequences[s].getSeq(gapCharacter) + .getSubSequence(start, contigs[contig + 1]); } smsa[j] = mseq; j++; @@ -699,9 +698,8 @@ public class AlignmentView { if (sequences == null || width <= 0) { - throw new Error( - MessageManager - .getString("error.empty_view_cannot_be_updated")); + throw new Error(MessageManager + .getString("error.empty_view_cannot_be_updated")); } if (nvismsa == null) { @@ -732,17 +730,13 @@ public class AlignmentView j++; if (mseq.length != sequences.length) { - throw new Error( - MessageManager - .formatMessage( - "error.mismatch_between_number_of_sequences_in_block", - new String[] { - Integer.valueOf(j).toString(), - Integer.valueOf(mseq.length) - .toString(), - Integer.valueOf( - sequences.length) - .toString() })); + throw new Error(MessageManager.formatMessage( + "error.mismatch_between_number_of_sequences_in_block", + new String[] + { Integer.valueOf(j).toString(), + Integer.valueOf(mseq.length).toString(), + Integer.valueOf(sequences.length) + .toString() })); } swidth = mseq[0].getLength(); // JBPNote: could ensure padded // here. @@ -754,9 +748,9 @@ public class AlignmentView } else { - alignment[s].setSequence(alignment[s] - .getSequenceAsString() - + mseq[s].getSequenceAsString()); + alignment[s] + .setSequence(alignment[s].getSequenceAsString() + + mseq[s].getSequenceAsString()); if (mseq[s].getStart() <= mseq[s].getEnd()) { alignment[s].setEnd(mseq[s].getEnd()); @@ -788,9 +782,9 @@ public class AlignmentView } else { - alignment[s].setSequence(alignment[s] - .getSequenceAsString() - + oseq.getSequenceAsString()); + alignment[s] + .setSequence(alignment[s].getSequenceAsString() + + oseq.getSequenceAsString()); if (oseq.getEnd() >= oseq.getStart()) { alignment[s].setEnd(oseq.getEnd()); @@ -825,8 +819,7 @@ public class AlignmentView } } // mark hidden segment as hidden in the new alignment - hidden.hideColumns(nwidth, nwidth + contigs[contig + 2] - - 1); + hidden.hideColumns(nwidth, nwidth + contigs[contig + 2] - 1); nwidth += contigs[contig + 2]; } // Do final segment - if it exists @@ -881,9 +874,9 @@ public class AlignmentView } else { - alignment[s].setSequence(alignment[s] - .getSequenceAsString() - + oseq.getSequenceAsString()); + alignment[s] + .setSequence(alignment[s].getSequenceAsString() + + oseq.getSequenceAsString()); if (oseq.getEnd() >= oseq.getStart()) { alignment[s].setEnd(oseq.getEnd()); @@ -895,9 +888,8 @@ public class AlignmentView else { // place gaps. - throw new Error( - MessageManager - .getString("error.padding_not_yet_implemented")); + throw new Error(MessageManager + .getString("error.padding_not_yet_implemented")); } } } @@ -909,12 +901,10 @@ public class AlignmentView { if (nvismsa.length != 1) { - throw new Error( - MessageManager - .formatMessage( - "error.mismatch_between_visible_blocks_to_update_and_number_of_contigs_in_view", - new String[] { Integer.valueOf( - nvismsa.length).toString() })); + throw new Error(MessageManager.formatMessage( + "error.mismatch_between_visible_blocks_to_update_and_number_of_contigs_in_view", + new String[] + { Integer.valueOf(nvismsa.length).toString() })); } if (nvismsa[0] != null) { @@ -1143,8 +1133,8 @@ public class AlignmentView AlignmentView view = null; try { - System.out - .println("View with no hidden columns, no limit to selection, no groups to be collected:"); + System.out.println( + "View with no hidden columns, no limit to selection, no groups to be collected:"); view = new AlignmentView(alignment, hidden, selection, false, false, false); summariseAlignmentView(view, System.out); @@ -1152,99 +1142,99 @@ public class AlignmentView } catch (Exception e) { e.printStackTrace(); - System.err - .println("Failed to generate alignment with selection but no groups marked."); + System.err.println( + "Failed to generate alignment with selection but no groups marked."); } try { - System.out - .println("View with no hidden columns, no limit to selection, and all groups to be collected:"); + System.out.println( + "View with no hidden columns, no limit to selection, and all groups to be collected:"); view = new AlignmentView(alignment, hidden, selection, false, false, true); summariseAlignmentView(view, System.out); } catch (Exception e) { e.printStackTrace(); - System.err - .println("Failed to generate alignment with selection marked but no groups marked."); + System.err.println( + "Failed to generate alignment with selection marked but no groups marked."); } try { - System.out - .println("View with no hidden columns, limited to selection and no groups to be collected:"); + System.out.println( + "View with no hidden columns, limited to selection and no groups to be collected:"); view = new AlignmentView(alignment, hidden, selection, false, true, false); summariseAlignmentView(view, System.out); } catch (Exception e) { e.printStackTrace(); - System.err - .println("Failed to generate alignment with selection restricted but no groups marked."); + System.err.println( + "Failed to generate alignment with selection restricted but no groups marked."); } try { - System.out - .println("View with no hidden columns, limited to selection, and all groups to be collected:"); + System.out.println( + "View with no hidden columns, limited to selection, and all groups to be collected:"); view = new AlignmentView(alignment, hidden, selection, false, true, true); summariseAlignmentView(view, System.out); } catch (Exception e) { e.printStackTrace(); - System.err - .println("Failed to generate alignment with selection restricted and groups marked."); + System.err.println( + "Failed to generate alignment with selection restricted and groups marked."); } try { - System.out - .println("View *with* hidden columns, no limit to selection, no groups to be collected:"); + System.out.println( + "View *with* hidden columns, no limit to selection, no groups to be collected:"); view = new AlignmentView(alignment, hidden, selection, true, false, false); summariseAlignmentView(view, System.out); } catch (Exception e) { e.printStackTrace(); - System.err - .println("Failed to generate alignment with selection but no groups marked."); + System.err.println( + "Failed to generate alignment with selection but no groups marked."); } try { - System.out - .println("View *with* hidden columns, no limit to selection, and all groups to be collected:"); + System.out.println( + "View *with* hidden columns, no limit to selection, and all groups to be collected:"); view = new AlignmentView(alignment, hidden, selection, true, false, true); summariseAlignmentView(view, System.out); } catch (Exception e) { e.printStackTrace(); - System.err - .println("Failed to generate alignment with selection marked but no groups marked."); + System.err.println( + "Failed to generate alignment with selection marked but no groups marked."); } try { - System.out - .println("View *with* hidden columns, limited to selection and no groups to be collected:"); + System.out.println( + "View *with* hidden columns, limited to selection and no groups to be collected:"); view = new AlignmentView(alignment, hidden, selection, true, true, false); summariseAlignmentView(view, System.out); } catch (Exception e) { e.printStackTrace(); - System.err - .println("Failed to generate alignment with selection restricted but no groups marked."); + System.err.println( + "Failed to generate alignment with selection restricted but no groups marked."); } try { - System.out - .println("View *with* hidden columns, limited to selection, and all groups to be collected:"); + System.out.println( + "View *with* hidden columns, limited to selection, and all groups to be collected:"); view = new AlignmentView(alignment, hidden, selection, true, true, true); summariseAlignmentView(view, System.out); } catch (Exception e) { e.printStackTrace(); - System.err - .println("Failed to generate alignment with selection restricted and groups marked."); + System.err.println( + "Failed to generate alignment with selection restricted and groups marked."); } } diff --git a/src/jalview/datamodel/AllColsCollection.java b/src/jalview/datamodel/AllColsCollection.java index f84ba95..4ac4f83 100644 --- a/src/jalview/datamodel/AllColsCollection.java +++ b/src/jalview/datamodel/AllColsCollection.java @@ -27,21 +27,22 @@ import java.util.Iterator; public class AllColsCollection implements AlignmentColsCollectionI { int start; + int end; HiddenColumns hidden; - + public AllColsCollection(int s, int e, AlignmentI al) { start = s; end = e; hidden = al.getHiddenColumns(); } - + @Override public Iterator iterator() { - return new AllColsIterator(start,end,hidden); + return new AllColsIterator(start, end, hidden); } @Override diff --git a/src/jalview/datamodel/AllColsIterator.java b/src/jalview/datamodel/AllColsIterator.java index c1296d5..1ff6a66 100644 --- a/src/jalview/datamodel/AllColsIterator.java +++ b/src/jalview/datamodel/AllColsIterator.java @@ -38,7 +38,8 @@ public class AllColsIterator implements Iterator private int current; - public AllColsIterator(int firstcol, int lastcol, HiddenColumns hiddenCols) + public AllColsIterator(int firstcol, int lastcol, + HiddenColumns hiddenCols) { last = lastcol; next = firstcol; @@ -70,4 +71,3 @@ public class AllColsIterator implements Iterator throw new UnsupportedOperationException(); } } - diff --git a/src/jalview/datamodel/AllRowsCollection.java b/src/jalview/datamodel/AllRowsCollection.java index 502ace4..9a33094 100644 --- a/src/jalview/datamodel/AllRowsCollection.java +++ b/src/jalview/datamodel/AllRowsCollection.java @@ -60,4 +60,3 @@ public class AllRowsCollection implements AlignmentRowsCollectionI return alignment.getSequenceAtAbsoluteIndex(seq); } } - diff --git a/src/jalview/datamodel/AllRowsIterator.java b/src/jalview/datamodel/AllRowsIterator.java index b6d45f8..ae397af 100644 --- a/src/jalview/datamodel/AllRowsIterator.java +++ b/src/jalview/datamodel/AllRowsIterator.java @@ -73,5 +73,3 @@ public class AllRowsIterator implements Iterator throw new UnsupportedOperationException(); } } - - diff --git a/src/jalview/datamodel/Annotation.java b/src/jalview/datamodel/Annotation.java index 8de8eb2..ae29417 100755 --- a/src/jalview/datamodel/Annotation.java +++ b/src/jalview/datamodel/Annotation.java @@ -51,7 +51,9 @@ public class Annotation */ public char secondaryStructure = ' '; - /** Score for the position - used in histograms, line graphs and for shading */ + /** + * Score for the position - used in histograms, line graphs and for shading + */ public float value; /** Colour for position */ @@ -206,10 +208,10 @@ public class Annotation public boolean isWhitespace() { return ((value == 0f) - && ((description == null) || (description.trim() - .length() == 0)) - && ((displayCharacter == null) || (displayCharacter - .trim().length() == 0)) - && (secondaryStructure == '\0' || (secondaryStructure == ' ')) && colour == null); + && ((description == null) || (description.trim().length() == 0)) + && ((displayCharacter == null) + || (displayCharacter.trim().length() == 0)) + && (secondaryStructure == '\0' || (secondaryStructure == ' ')) + && colour == null); } } diff --git a/src/jalview/datamodel/BinaryNode.java b/src/jalview/datamodel/BinaryNode.java index a13b492..c0ff0e4 100755 --- a/src/jalview/datamodel/BinaryNode.java +++ b/src/jalview/datamodel/BinaryNode.java @@ -263,7 +263,8 @@ public class BinaryNode * * set the display name * - * @param new name + * @param new + * name */ public void setName(String name) { diff --git a/src/jalview/datamodel/BinarySequence.java b/src/jalview/datamodel/BinarySequence.java index b7e15a6..53bffa9 100755 --- a/src/jalview/datamodel/BinarySequence.java +++ b/src/jalview/datamodel/BinarySequence.java @@ -119,10 +119,10 @@ public class BinarySequence extends Sequence { if (isNa != smtrx.isDNA()) { - throw new InvalidSequenceTypeException("matrix " - + smtrx.getClass().getCanonicalName() - + " is not a valid matrix for " - + (isNa ? "nucleotide" : "protein") + "sequences"); + throw new InvalidSequenceTypeException( + "matrix " + smtrx.getClass().getCanonicalName() + + " is not a valid matrix for " + + (isNa ? "nucleotide" : "protein") + "sequences"); } matrixEncode(smtrx.isDNA() ? ResidueProperties.nucleotideIndex : ResidueProperties.aaIndex, smtrx.getMatrix()); diff --git a/src/jalview/datamodel/CigarArray.java b/src/jalview/datamodel/CigarArray.java index febf6b4..b6224c2 100644 --- a/src/jalview/datamodel/CigarArray.java +++ b/src/jalview/datamodel/CigarArray.java @@ -68,7 +68,8 @@ public class CigarArray extends CigarBase for (int c = 0; c < cigars.length; c++) { refCigars[c] = cigars[c]; - if (!((cigars[c] instanceof SeqCigar) || cigars[c] instanceof CigarCigar)) + if (!((cigars[c] instanceof SeqCigar) + || cigars[c] instanceof CigarCigar)) { seqcigararray = false; } @@ -90,8 +91,8 @@ public class CigarArray extends CigarBase { this(constructSeqCigarArray(alignment, selectionGroup)); constructFromAlignment(alignment, - hidden != null ? hidden.getHiddenColumnsCopy() - : null, selectionGroup); + hidden != null ? hidden.getHiddenColumnsCopy() : null, + selectionGroup); } private static int[] _calcStartEndBounds(AlignmentI alignment, diff --git a/src/jalview/datamodel/CigarBase.java b/src/jalview/datamodel/CigarBase.java index 5fb507a..4e7e03f 100644 --- a/src/jalview/datamodel/CigarBase.java +++ b/src/jalview/datamodel/CigarBase.java @@ -83,7 +83,8 @@ public abstract class CigarBase int[][] deletions = new int[length][]; int[][] trunc_deletions = null; StringBuffer sq = new StringBuffer(); - int cursor = 0, alcursor = 0, start = 0, startpos = 0, end = 0, endpos = 0, delcount = -1; + int cursor = 0, alcursor = 0, start = 0, startpos = 0, end = 0, + endpos = 0, delcount = -1; boolean consecutive_del = false; if (length == 0) { @@ -146,8 +147,8 @@ public abstract class CigarBase break; default: throw new Error(MessageManager.formatMessage( - "error.unknown_seq_cigar_operation", - new String[] { new StringBuffer(operation[i]).toString() })); + "error.unknown_seq_cigar_operation", new String[] + { new StringBuffer(operation[i]).toString() })); } } if (++delcount > 0) @@ -157,7 +158,8 @@ public abstract class CigarBase } deletions = null; return new Object[] { ((reference != null) ? sq.toString() : null), - new int[] { start, startpos, end, endpos }, trunc_deletions }; + new int[] + { start, startpos, end, endpos }, trunc_deletions }; } protected void compact_operations() @@ -225,9 +227,8 @@ public abstract class CigarBase } while (c >= '0' && c <= '9' && j < l); if (j >= l && c >= '0' && c <= '9') { - throw new Exception( - MessageManager - .getString("exception.unterminated_cigar_string")); + throw new Exception(MessageManager + .getString("exception.unterminated_cigar_string")); } try { @@ -236,9 +237,8 @@ public abstract class CigarBase i = j; } catch (Exception e) { - throw new Error( - MessageManager - .getString("error.implementation_bug_parse_cigar_string")); + throw new Error(MessageManager + .getString("error.implementation_bug_parse_cigar_string")); } if (c >= 'a' && c <= 'z') { @@ -252,7 +252,8 @@ public abstract class CigarBase { throw new Exception(MessageManager.formatMessage( "exception.unexpected_operation_cigar_string_pos", - new String[] { new StringBuffer(c).toString(), + new String[] + { new StringBuffer(c).toString(), Integer.valueOf(i).toString(), cigarString })); } } @@ -275,9 +276,8 @@ public abstract class CigarBase } if (op != M && op != D && op != I) { - throw new Error( - MessageManager - .getString("error.implementation_error_invalid_operation_string")); + throw new Error(MessageManager.getString( + "error.implementation_error_invalid_operation_string")); } if (range == 0) { @@ -345,14 +345,14 @@ public abstract class CigarBase * int public void addOperationAt(int pos, char op, int range) { int * cursor = -1; // mark the position for the current operation being * edited. int o = 0; boolean last_d = false; // previous op was a - * deletion. if (pos < -1) throw new - * Error("pos<-1 is not supported."); while (o0) addInsertion(pos-cursor); - * // then just add the new operation. Regardless of what it is. - * addOperation(op, range); } else { int diff = pos - cursor; + * deletion. if (pos < -1) throw new Error("pos<-1 is not + * supported."); while (o0) addInsertion(pos-cursor); // then just add the new + * operation. Regardless of what it is. addOperation(op, range); } + * else { int diff = pos - cursor; * * int e_length = length-o; // new edit operation array length. // * diff<0 - can only happen before first insertion or match. - @@ -398,9 +398,8 @@ public abstract class CigarBase } if (start < 0 || start > end) { - throw new Error( - MessageManager - .getString("error.implementation_error_delete_range_out_of_bounds")); + throw new Error(MessageManager.getString( + "error.implementation_error_delete_range_out_of_bounds")); } // find beginning int cursor = 0; // mark the position for the current operation being edited. @@ -478,7 +477,8 @@ public abstract class CigarBase default: throw new Error(MessageManager.formatMessage( "error.implementation_error_unknown_operation", - new String[] { new StringBuffer(oldops[o]).toString() })); + new String[] + { new StringBuffer(oldops[o]).toString() })); } rlength -= remain; remain = oldrange[++o]; // number of op characters left to edit diff --git a/src/jalview/datamodel/CigarCigar.java b/src/jalview/datamodel/CigarCigar.java index e2da220..9643d9d 100644 --- a/src/jalview/datamodel/CigarCigar.java +++ b/src/jalview/datamodel/CigarCigar.java @@ -52,8 +52,8 @@ public class CigarCigar extends CigarSimple String refString = refCigar.getSequenceString(GapChar); if (refString != null) { - return (length == 0) ? "" : (String) getSequenceAndDeletions( - refString, GapChar)[0]; + return (length == 0) ? "" + : (String) getSequenceAndDeletions(refString, GapChar)[0]; } else { diff --git a/src/jalview/datamodel/ColumnSelection.java b/src/jalview/datamodel/ColumnSelection.java index 4cdd7af..6d620b4 100644 --- a/src/jalview/datamodel/ColumnSelection.java +++ b/src/jalview/datamodel/ColumnSelection.java @@ -401,7 +401,6 @@ public class ColumnSelection } - /** * Hides the specified column and any adjacent selected columns * @@ -444,10 +443,6 @@ public class ColumnSelection hidden.hideColumns(min, max); } - - - - /** * Copy constructor * @@ -468,11 +463,6 @@ public class ColumnSelection { } - - - - - /** * Invert the column selection from first to end-1. leaves hiddenColumns * untouched (and unselected) @@ -534,7 +524,6 @@ public class ColumnSelection } } - /** * * @return true if there are columns marked @@ -544,8 +533,6 @@ public class ColumnSelection return (selection != null && selection.size() > 0); } - - public boolean filterAnnotations(Annotation[] annotations, AnnotationFilterParameter filterParams) { @@ -560,13 +547,15 @@ public class ColumnSelection boolean itemMatched = false; - if (filterParams.getThresholdType() == AnnotationFilterParameter.ThresholdType.ABOVE_THRESHOLD + if (filterParams + .getThresholdType() == AnnotationFilterParameter.ThresholdType.ABOVE_THRESHOLD && annotations[count].value >= filterParams .getThresholdValue()) { itemMatched = true; } - if (filterParams.getThresholdType() == AnnotationFilterParameter.ThresholdType.BELOW_THRESHOLD + if (filterParams + .getThresholdType() == AnnotationFilterParameter.ThresholdType.BELOW_THRESHOLD && annotations[count].value <= filterParams .getThresholdValue()) { @@ -691,8 +680,8 @@ public class ColumnSelection * * @return */ - public boolean markColumns(BitSet markedColumns, int startCol, - int endCol, boolean invert, boolean extendCurrent, boolean toggle) + public boolean markColumns(BitSet markedColumns, int startCol, int endCol, + boolean invert, boolean extendCurrent, boolean toggle) { boolean changed = false; if (!extendCurrent && !toggle) diff --git a/src/jalview/datamodel/DBRefEntry.java b/src/jalview/datamodel/DBRefEntry.java index ec6dcf8..f7837f7 100755 --- a/src/jalview/datamodel/DBRefEntry.java +++ b/src/jalview/datamodel/DBRefEntry.java @@ -68,10 +68,10 @@ public class DBRefEntry implements DBRefEntryI public DBRefEntry(DBRefEntryI entry) { this((entry.getSource() == null ? "" : new String(entry.getSource())), - (entry.getVersion() == null ? "" : new String( - entry.getVersion())), - (entry.getAccessionId() == null ? "" : new String( - entry.getAccessionId())), + (entry.getVersion() == null ? "" + : new String(entry.getVersion())), + (entry.getAccessionId() == null ? "" + : new String(entry.getAccessionId())), (entry.getMap() == null ? null : new Mapping(entry.getMap()))); } @@ -89,9 +89,8 @@ public class DBRefEntry implements DBRefEntryI { return true; } - if (equalRef(entry) - && ((map == null && entry.map == null) || (map != null - && entry.map != null && map.equals(entry.map)))) + if (equalRef(entry) && ((map == null && entry.map == null) + || (map != null && entry.map != null && map.equals(entry.map)))) { return true; } @@ -104,7 +103,8 @@ public class DBRefEntry implements DBRefEntryI *
      *
    • source and accession are identical (ignoring case)
    • *
    • version is identical (ignoring case), or this version is of the format - * "someSource:0", in which case the version for the other entry replaces it
    • + * "someSource:0", in which case the version for the other entry replaces + * it *
    • mappings are not compared but if this entry has no mapping, replace * with that for the other entry
    • *
    @@ -141,8 +141,8 @@ public class DBRefEntry implements DBRefEntryI String otherAccession = other.getAccessionId(); if ((accessionId == null && otherAccession != null) || (accessionId != null && otherAccession == null) - || (accessionId != null && !accessionId - .equalsIgnoreCase(otherAccession))) + || (accessionId != null + && !accessionId.equalsIgnoreCase(otherAccession))) { return false; } @@ -160,9 +160,8 @@ public class DBRefEntry implements DBRefEntryI } else { - if (version != null - && (otherVersion == null || !version - .equalsIgnoreCase(otherVersion))) + if (version != null && (otherVersion == null + || !version.equalsIgnoreCase(otherVersion))) { return false; } @@ -197,12 +196,12 @@ public class DBRefEntry implements DBRefEntryI return true; } if (entry != null - && (source != null && entry.getSource() != null && source - .equalsIgnoreCase(entry.getSource())) - && (accessionId != null && entry.getAccessionId() != null && accessionId - .equalsIgnoreCase(entry.getAccessionId())) - && (version != null && entry.getVersion() != null && version - .equalsIgnoreCase(entry.getVersion()))) + && (source != null && entry.getSource() != null + && source.equalsIgnoreCase(entry.getSource())) + && (accessionId != null && entry.getAccessionId() != null + && accessionId.equalsIgnoreCase(entry.getAccessionId())) + && (version != null && entry.getVersion() != null + && version.equalsIgnoreCase(entry.getVersion()))) { return true; } diff --git a/src/jalview/datamodel/FeatureProperties.java b/src/jalview/datamodel/FeatureProperties.java index 2306bec..f495624 100644 --- a/src/jalview/datamodel/FeatureProperties.java +++ b/src/jalview/datamodel/FeatureProperties.java @@ -47,8 +47,8 @@ public class FeatureProperties if (type.equalsIgnoreCase(EMBL_CODING_FEATURE)) { return (dbrefsource == null - || dbrefsource.equalsIgnoreCase(DBRefSource.EMBL) || dbrefsource - .equalsIgnoreCase(DBRefSource.EMBLCDS)); + || dbrefsource.equalsIgnoreCase(DBRefSource.EMBL) + || dbrefsource.equalsIgnoreCase(DBRefSource.EMBLCDS)); } return false; } diff --git a/src/jalview/datamodel/GraphLine.java b/src/jalview/datamodel/GraphLine.java index df2f866..38a5061 100755 --- a/src/jalview/datamodel/GraphLine.java +++ b/src/jalview/datamodel/GraphLine.java @@ -61,12 +61,14 @@ public class GraphLine if (obj != null && obj instanceof GraphLine) { GraphLine other = (GraphLine) obj; - return displayed == other.displayed - && value == other.value - && (colour != null ? (other.colour != null && other.colour - .equals(colour)) : other.colour == null) - && (label != null ? (other.label != null && other.label - .equals(label)) : other.label == null); + return displayed == other.displayed && value == other.value + && (colour != null + ? (other.colour != null + && other.colour.equals(colour)) + : other.colour == null) + && (label != null + ? (other.label != null && other.label.equals(label)) + : other.label == null); } return false; } diff --git a/src/jalview/datamodel/HiddenColumns.java b/src/jalview/datamodel/HiddenColumns.java index 169b0a4..c0a43ee 100644 --- a/src/jalview/datamodel/HiddenColumns.java +++ b/src/jalview/datamodel/HiddenColumns.java @@ -33,7 +33,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock; public class HiddenColumns { private static final ReentrantReadWriteLock LOCK = new ReentrantReadWriteLock(); - + /* * list of hidden column [start, end] ranges; the list is maintained in * ascending start column order @@ -135,8 +135,7 @@ public class HiddenColumns } } return size; - } - finally + } finally { LOCK.readLock().unlock(); } @@ -290,47 +289,47 @@ public class HiddenColumns { LOCK.readLock().lock(); - int distance = visibleDistance; + int distance = visibleDistance; - // in case startColumn is in a hidden region, move it to the left - int start = adjustForHiddenColumns(findColumnPosition(startColumn)); + // in case startColumn is in a hidden region, move it to the left + int start = adjustForHiddenColumns(findColumnPosition(startColumn)); - // get index of hidden region to left of start - int index = getHiddenIndexLeft(start); - if (index == -1) - { - // no hidden regions to left of startColumn - return start - distance; - } + // get index of hidden region to left of start + int index = getHiddenIndexLeft(start); + if (index == -1) + { + // no hidden regions to left of startColumn + return start - distance; + } - // walk backwards through the alignment subtracting the counts of visible - // columns from distance - int[] region; - int gap = 0; - int nextstart = start; + // walk backwards through the alignment subtracting the counts of visible + // columns from distance + int[] region; + int gap = 0; + int nextstart = start; - while ((index > -1) && (distance - gap > 0)) - { - // subtract the gap to right of region from distance - distance -= gap; - start = nextstart; + while ((index > -1) && (distance - gap > 0)) + { + // subtract the gap to right of region from distance + distance -= gap; + start = nextstart; - // calculate the next gap - region = hiddenColumns.get(index); - gap = start - region[1]; + // calculate the next gap + region = hiddenColumns.get(index); + gap = start - region[1]; - // set start to just to left of current region - nextstart = region[0] - 1; - index--; - } + // set start to just to left of current region + nextstart = region[0] - 1; + index--; + } - if (distance - gap > 0) - { - // fell out of loop because there are no more hidden regions - distance -= gap; - return nextstart - distance; - } - return start - distance; + if (distance - gap > 0) + { + // fell out of loop because there are no more hidden regions + distance -= gap; + return nextstart - distance; + } + return start - distance; } finally { LOCK.readLock().unlock(); @@ -382,8 +381,7 @@ public class HiddenColumns } return positions; - } - finally + } finally { LOCK.readLock().unlock(); } @@ -437,22 +435,22 @@ public class HiddenColumns { LOCK.readLock().lock(); - if (hiddenColumns != null) - { - int index = hiddenColumns.size() - 1; - do + if (hiddenColumns != null) { - int[] region = hiddenColumns.get(index); - if (alPos > region[1]) + int index = hiddenColumns.size() - 1; + do { - return region[1]; - } + int[] region = hiddenColumns.get(index); + if (alPos > region[1]) + { + return region[1]; + } - index--; - } while (index > -1); - } + index--; + } while (index > -1); + } - return alPos; + return alPos; } finally { LOCK.readLock().unlock(); @@ -473,22 +471,22 @@ public class HiddenColumns { LOCK.readLock().lock(); - if (hiddenColumns != null) - { - int index = hiddenColumns.size() - 1; - do + if (hiddenColumns != null) { - int[] region = hiddenColumns.get(index); - if (pos > region[1]) + int index = hiddenColumns.size() - 1; + do { - return index; - } + int[] region = hiddenColumns.get(index); + if (pos > region[1]) + { + return index; + } - index--; - } while (index > -1); - } + index--; + } while (index > -1); + } - return -1; + return -1; } finally { LOCK.readLock().unlock(); @@ -578,11 +576,11 @@ public class HiddenColumns } return; } - } + } - /* - * remaining case is that the new range follows everything else - */ + /* + * remaining case is that the new range follows everything else + */ hiddenColumns.add(new int[] { start, end }); } finally { @@ -599,18 +597,18 @@ public class HiddenColumns { LOCK.readLock().lock(); - if (hiddenColumns != null) - { - for (int[] region : hiddenColumns) + if (hiddenColumns != null) { - if (column >= region[0] && column <= region[1]) + for (int[] region : hiddenColumns) { - return false; + if (column >= region[0] && column <= region[1]) + { + return false; + } } } - } - return true; + return true; } finally { LOCK.readLock().unlock(); @@ -641,7 +639,7 @@ public class HiddenColumns return copy; } - + /** * Returns a copy of the vector of hidden regions, as an ArrayList. Before * using this method please consider if you really need access to the hidden @@ -760,8 +758,7 @@ public class HiddenColumns } } } - } - finally + } finally { LOCK.writeLock().unlock(); } @@ -828,8 +825,7 @@ public class HiddenColumns { return new int[] { start, end - 1 }; } - } - finally + } finally { LOCK.readLock().unlock(); } @@ -898,8 +894,7 @@ public class HiddenColumns } return selections; - } - finally + } finally { LOCK.readLock().unlock(); } @@ -992,8 +987,7 @@ public class HiddenColumns } // otherwise, sequence was completely hidden return new int[] { visPrev, visNext, 0, 0, firstP, lastP }; - } - finally + } finally { LOCK.readLock().unlock(); } @@ -1114,8 +1108,7 @@ public class HiddenColumns { alignmentAnnotation.restrict(start, end); } - } - finally + } finally { LOCK.readLock().unlock(); } @@ -1196,8 +1189,7 @@ public class HiddenColumns } hiddenColumns = null; - } - finally + } finally { LOCK.writeLock().unlock(); } @@ -1232,8 +1224,7 @@ public class HiddenColumns { hiddenColumns = null; } - } - finally + } finally { LOCK.writeLock().unlock(); } @@ -1357,8 +1348,7 @@ public class HiddenColumns hiddenColumns = null; } } - } - finally + } finally { LOCK.writeLock().unlock(); } @@ -1456,9 +1446,8 @@ public class HiddenColumns } else { - al.getSequenceAt(s).setSequence( - sq.substring(0, spos + offset) + sb.toString() - + sq.substring(spos + offset)); + al.getSequenceAt(s).setSequence(sq.substring(0, spos + offset) + + sb.toString() + sq.substring(spos + offset)); } } } @@ -1470,7 +1459,8 @@ public class HiddenColumns { // pad the final region with gaps. StringBuffer sb = new StringBuffer(); - for (int s = 0, ns = profileseq.getLength() - spos - offset; s < ns; s++) + for (int s = 0, ns = profileseq.getLength() - spos + - offset; s < ns; s++) { sb.append(gc); } @@ -1572,8 +1562,7 @@ public class HiddenColumns } } return hashCode; - } - finally + } finally { LOCK.readLock().unlock(); } @@ -1621,8 +1610,7 @@ public class HiddenColumns { inserts.set(range[0], range[1] + 1); } - } - finally + } finally { LOCK.readLock().unlock(); } diff --git a/src/jalview/datamodel/HiddenSequences.java b/src/jalview/datamodel/HiddenSequences.java index 32443d8..c9dce08 100755 --- a/src/jalview/datamodel/HiddenSequences.java +++ b/src/jalview/datamodel/HiddenSequences.java @@ -239,8 +239,8 @@ public class HiddenSequences } else { - System.out.println(seq.getName() - + " has been deleted whilst hidden"); + System.out.println( + seq.getName() + " has been deleted whilst hidden"); } } } diff --git a/src/jalview/datamodel/Mapping.java b/src/jalview/datamodel/Mapping.java index 1c196be..fe396ce 100644 --- a/src/jalview/datamodel/Mapping.java +++ b/src/jalview/datamodel/Mapping.java @@ -182,8 +182,8 @@ public class Mapping } if (!toRanges.hasNext()) { - throw new NoSuchElementException("Ran out of peptide at position " - + toPosition); + throw new NoSuchElementException( + "Ran out of peptide at position " + toPosition); } currentToRange = toRanges.next(); toPosition = currentToRange[0]; @@ -687,8 +687,8 @@ public class Mapping to[f * 2] = r[0]; to[f * 2 + 1] = r[1]; } - copy.setMap(new MapList(from, to, map.getFromRatio(), map - .getToRatio())); + copy.setMap( + new MapList(from, to, map.getFromRatio(), map.getToRatio())); } return copy; } @@ -735,7 +735,8 @@ public class Mapping * @param gapChar * @return */ - public Iterator getCodonIterator(SequenceI seq, char gapChar) + public Iterator getCodonIterator(SequenceI seq, + char gapChar) { return new AlignedCodonIterator(seq, gapChar); } @@ -746,8 +747,8 @@ public class Mapping @Override public String toString() { - return String.format("%s %s", this.map.toString(), this.to == null ? "" - : this.to.getName()); + return String.format("%s %s", this.map.toString(), + this.to == null ? "" : this.to.getName()); } /** diff --git a/src/jalview/datamodel/PDBEntry.java b/src/jalview/datamodel/PDBEntry.java index 8debacf..c1dc77c 100755 --- a/src/jalview/datamodel/PDBEntry.java +++ b/src/jalview/datamodel/PDBEntry.java @@ -73,6 +73,7 @@ public class PDBEntry { return format; } + public String getExtension() { return ext; @@ -151,7 +152,6 @@ public class PDBEntry { } - public PDBEntry(String pdbId, String chain, PDBEntry.Type type, String filePath) { @@ -164,7 +164,8 @@ public class PDBEntry * @param entryType * @param filePath */ - void init(String pdbId, String chain, PDBEntry.Type entryType, String filePath) + void init(String pdbId, String chain, PDBEntry.Type entryType, + String filePath) { this.id = pdbId; this.type = entryType == null ? null : entryType.toString(); @@ -199,8 +200,8 @@ public class PDBEntry { if (!DBRefSource.PDB.equals(dbr.getSource())) { - throw new IllegalArgumentException("Invalid source: " - + dbr.getSource()); + throw new IllegalArgumentException( + "Invalid source: " + dbr.getSource()); } String pdbId = dbr.getAccessionId(); diff --git a/src/jalview/datamodel/Profile.java b/src/jalview/datamodel/Profile.java index 1501808..8638896 100644 --- a/src/jalview/datamodel/Profile.java +++ b/src/jalview/datamodel/Profile.java @@ -20,7 +20,6 @@ */ package jalview.datamodel; - /** * A profile for one column of an alignment * diff --git a/src/jalview/datamodel/Profiles.java b/src/jalview/datamodel/Profiles.java index f65830a..14eae51 100644 --- a/src/jalview/datamodel/Profiles.java +++ b/src/jalview/datamodel/Profiles.java @@ -38,7 +38,8 @@ public class Profiles implements ProfilesI @Override public ProfileI get(int col) { - return profiles != null && col >= 0 && col < profiles.length ? profiles[col] + return profiles != null && col >= 0 && col < profiles.length + ? profiles[col] : null; } diff --git a/src/jalview/datamodel/ResidueCount.java b/src/jalview/datamodel/ResidueCount.java index 3e3a966..74eb887 100644 --- a/src/jalview/datamodel/ResidueCount.java +++ b/src/jalview/datamodel/ResidueCount.java @@ -28,6 +28,7 @@ import jalview.util.SparseCount; /** * A class to count occurrences of residues in a profile, optimised for speed * and memory footprint. + * * @author gmcarstairs * */ @@ -447,8 +448,8 @@ public class ResidueCount { if (intCounts[i] == count) { - modal.append(isNucleotide ? NUCS.charAt(i - 1) : AAS - .charAt(i - 1)); + modal.append( + isNucleotide ? NUCS.charAt(i - 1) : AAS.charAt(i - 1)); } } } @@ -458,8 +459,8 @@ public class ResidueCount { if (counts[i] == count) { - modal.append(isNucleotide ? NUCS.charAt(i - 1) : AAS - .charAt(i - 1)); + modal.append( + isNucleotide ? NUCS.charAt(i - 1) : AAS.charAt(i - 1)); } } } @@ -492,7 +493,8 @@ public class ResidueCount * * @return */ - public int size() { + public int size() + { int size = 0; if (useIntCounts) { @@ -546,8 +548,8 @@ public class ResidueCount { if (intCounts[i] > 0) { - char symbol = isNucleotide ? NUCS.charAt(i - 1) : AAS - .charAt(i - 1); + char symbol = isNucleotide ? NUCS.charAt(i - 1) + : AAS.charAt(i - 1); symbols[j] = symbol; values[j] = intCounts[i]; j++; @@ -560,8 +562,8 @@ public class ResidueCount { if (counts[i] > 0) { - char symbol = isNucleotide ? NUCS.charAt(i - 1) : AAS - .charAt(i - 1); + char symbol = isNucleotide ? NUCS.charAt(i - 1) + : AAS.charAt(i - 1); symbols[j] = symbol; values[j] = counts[i]; j++; diff --git a/src/jalview/datamodel/SearchResults.java b/src/jalview/datamodel/SearchResults.java index 1bf5475..a270e37 100755 --- a/src/jalview/datamodel/SearchResults.java +++ b/src/jalview/datamodel/SearchResults.java @@ -164,8 +164,8 @@ public class SearchResults implements SearchResultsI return false; } SearchResultMatchI m = (SearchResultMatchI) obj; - return (sequence == m.getSequence() && start == m.getStart() && end == m - .getEnd()); + return (sequence == m.getSequence() && start == m.getStart() + && end == m.getEnd()); } } @@ -264,7 +264,7 @@ public class SearchResults implements SearchResultsI else { // debug - // System.err.println("Outwith bounds!" + matchStart+">"+end +" or " + // System.err.println("Outwith bounds!" + matchStart+">"+end +" or " // + matchEnd+"<"+start); } } diff --git a/src/jalview/datamodel/SeqCigar.java b/src/jalview/datamodel/SeqCigar.java index 9cc7b4a..c2a6a9c 100644 --- a/src/jalview/datamodel/SeqCigar.java +++ b/src/jalview/datamodel/SeqCigar.java @@ -113,8 +113,9 @@ public class SeqCigar extends CigarSimple @Override public String getSequenceString(char GapChar) { - return (length == 0) ? "" : (String) getSequenceAndDeletions( - refseq.getSequenceAsString(start, end), GapChar)[0]; + return (length == 0) ? "" + : (String) getSequenceAndDeletions( + refseq.getSequenceAsString(start, end), GapChar)[0]; } /** @@ -134,14 +135,13 @@ public class SeqCigar extends CigarSimple refseq.getSequenceAsString(start, end), GapChar); if (edit_result == null) { - throw new Error( - MessageManager - .getString("error.implementation_error_unexpected_null_from_get_sequence_and_deletions")); + throw new Error(MessageManager.getString( + "error.implementation_error_unexpected_null_from_get_sequence_and_deletions")); } int bounds[] = (int[]) edit_result[1]; seq = new Sequence(refseq.getName(), (String) edit_result[0], - refseq.getStart() + start + bounds[0], refseq.getStart() - + start + ((bounds[2] == 0) ? -1 : bounds[2])); + refseq.getStart() + start + bounds[0], refseq.getStart() + start + + ((bounds[2] == 0) ? -1 : bounds[2])); seq.setDescription(refseq.getDescription()); int sstart = seq.getStart(), send = seq.getEnd(); // seq.checkValidRange(); probably not needed @@ -184,15 +184,14 @@ public class SeqCigar extends CigarSimple boolean hasgaps = false; if (seq == null) { - throw new Error( - MessageManager - .getString("error.implementation_error_set_seq_null")); + throw new Error(MessageManager + .getString("error.implementation_error_set_seq_null")); } if (_s < 0) { - throw new Error(MessageManager.formatMessage( - "error.implementation_error_s", new String[] { Integer - .valueOf(_s).toString() })); + throw new Error(MessageManager + .formatMessage("error.implementation_error_s", new String[] + { Integer.valueOf(_s).toString() })); } String seq_string = seq.getSequenceAsString(); if (_e == 0 || _e < _s || _e > seq_string.length()) @@ -258,9 +257,8 @@ public class SeqCigar extends CigarSimple // Check offsets if (end > ds.getLength()) { - throw new Error( - MessageManager - .getString("error.implementation_error_seqcigar_possible")); + throw new Error(MessageManager + .getString("error.implementation_error_seqcigar_possible")); // end = ds.getLength(); } @@ -289,9 +287,8 @@ public class SeqCigar extends CigarSimple } if (operation.length != range.length) { - throw new Error( - MessageManager - .getString("error.implementation_bug_cigar_operation_list_range_list")); + throw new Error(MessageManager.getString( + "error.implementation_bug_cigar_operation_list_range_list")); } if (operation != null) @@ -301,9 +298,8 @@ public class SeqCigar extends CigarSimple if (_setSeq(seq, false, 0, 0)) { - throw new Error( - MessageManager - .getString("error.not_yet_implemented_cigar_object_from_cigar_string")); + throw new Error(MessageManager.getString( + "error.not_yet_implemented_cigar_object_from_cigar_string")); } for (int i = this.length, j = 0; j < operation.length; i++, j++) { @@ -311,8 +307,8 @@ public class SeqCigar extends CigarSimple if (op != M && op != I && op != D) { throw new Error(MessageManager.formatMessage( - "error.implementation_bug_cigar_operation", new String[] { - Integer.valueOf(j).toString(), + "error.implementation_bug_cigar_operation", new String[] + { Integer.valueOf(j).toString(), Integer.valueOf(op).toString(), Integer.valueOf(M).toString(), Integer.valueOf(I).toString(), @@ -330,9 +326,8 @@ public class SeqCigar extends CigarSimple this.length = 0; if (_setSeq(seq, false, 0, 0)) { - throw new Error( - MessageManager - .getString("error.not_yet_implemented_cigar_object_from_cigar_string")); + throw new Error(MessageManager.getString( + "error.not_yet_implemented_cigar_object_from_cigar_string")); } } } @@ -378,8 +373,9 @@ public class SeqCigar extends CigarSimple while (p <= endpos) { - boolean isGap = (p < res) ? jalview.util.Comparison.isGap(seq - .getCharAt(p)) : true; + boolean isGap = (p < res) + ? jalview.util.Comparison.isGap(seq.getCharAt(p)) + : true; if ((startpos <= p) && (p <= endpos)) { if (isGap) @@ -439,9 +435,8 @@ public class SeqCigar extends CigarSimple super(); if (seq == null) { - throw new Error( - MessageManager - .getString("error.implementation_error_for_new_cigar")); + throw new Error(MessageManager + .getString("error.implementation_error_for_new_cigar")); } _setSeq(seq, false, 0, 0); // there is still work to do @@ -463,9 +458,8 @@ public class SeqCigar extends CigarSimple super(); if (seq == null) { - throw new Error( - MessageManager - .getString("error.implementation_error_for_new_cigar")); + throw new Error(MessageManager + .getString("error.implementation_error_for_new_cigar")); } _setSeq(seq, false, start, end + 1); // there is still work to do @@ -513,8 +507,8 @@ public class SeqCigar extends CigarSimple Object[] gs_regions = new Object[alseqs.length]; for (int i = 0; i < alseqs.length; i++) { - alseqs_string[i] = alseqs[i].getRefSeq().getSequenceAsString( - alseqs[i].start, alseqs[i].end); + alseqs_string[i] = alseqs[i].getRefSeq() + .getSequenceAsString(alseqs[i].start, alseqs[i].end); gs_regions[i] = alseqs[i].getSequenceAndDeletions(alseqs_string[i], gapCharacter); // gapped sequence, {start, start col, end. // endcol}, hidden regions {{start, end, col}}) @@ -522,7 +516,8 @@ public class SeqCigar extends CigarSimple { throw new Error(MessageManager.formatMessage( "error.implementation_error_cigar_seq_no_operations", - new String[] { Integer.valueOf(i).toString() })); + new String[] + { Integer.valueOf(i).toString() })); } g_seqs[i] = new StringBuffer((String) ((Object[]) gs_regions[i])[0]); // the // visible @@ -587,8 +582,9 @@ public class SeqCigar extends CigarSimple int[] bounds = ((int[]) ((Object[]) gs_regions[i])[1]); SequenceI ref = alseqs[i].getRefSeq(); seqs[i] = new Sequence(ref.getName(), g_seqs[i].toString(), - ref.getStart() + alseqs[i].start + bounds[0], ref.getStart() - + alseqs[i].start + (bounds[2] == 0 ? -1 : bounds[2])); + ref.getStart() + alseqs[i].start + bounds[0], + ref.getStart() + alseqs[i].start + + (bounds[2] == 0 ? -1 : bounds[2])); seqs[i].setDatasetSequence(ref); seqs[i].setDescription(ref.getDescription()); } @@ -598,8 +594,8 @@ public class SeqCigar extends CigarSimple { // int start=shifts.shift(segments[i]-1)+1; // int end=shifts.shift(segments[i]+segments[i+1]-1)-1; - hidden.hideColumns(segments[i + 1], segments[i + 1] - + segments[i + 2] - 1); + hidden.hideColumns(segments[i + 1], + segments[i + 1] + segments[i + 2] - 1); } } return seqs; diff --git a/src/jalview/datamodel/Sequence.java b/src/jalview/datamodel/Sequence.java index 8176221..0103237 100755 --- a/src/jalview/datamodel/Sequence.java +++ b/src/jalview/datamodel/Sequence.java @@ -79,7 +79,9 @@ public class Sequence extends ASequence implements SequenceI */ int index = -1; - /** array of sequence features - may not be null for a valid sequence object */ + /** + * array of sequence features - may not be null for a valid sequence object + */ public SequenceFeature[] sequenceFeatures; /** @@ -134,8 +136,8 @@ public class Sequence extends ASequence implements SequenceI { if (name == null) { - System.err - .println("POSSIBLE IMPLEMENTATION ERROR: null sequence name passed to constructor."); + System.err.println( + "POSSIBLE IMPLEMENTATION ERROR: null sequence name passed to constructor."); name = ""; } // Does sequence have the /start-end signature? @@ -308,7 +310,7 @@ public class Sequence extends ASequence implements SequenceI { new Exception( "Warning: JAL-2046 side effect ? Possible implementation error: overwriting dataset sequence features by setting sequence features on alignment") - .printStackTrace(); + .printStackTrace(); } datasetSequence.setSequenceFeatures(features); } @@ -334,7 +336,8 @@ public class Sequence extends ASequence implements SequenceI } } - SequenceFeature[] temp = new SequenceFeature[sequenceFeatures.length + 1]; + SequenceFeature[] temp = new SequenceFeature[sequenceFeatures.length + + 1]; System.arraycopy(sequenceFeatures, 0, temp, 0, sequenceFeatures.length); temp[sequenceFeatures.length] = sf; @@ -1068,8 +1071,9 @@ public class Sequence extends ASequence implements SequenceI @Override public AlignmentAnnotation[] getAnnotation() { - return annotation == null ? null : annotation - .toArray(new AlignmentAnnotation[annotation.size()]); + return annotation == null ? null + : annotation + .toArray(new AlignmentAnnotation[annotation.size()]); } @Override @@ -1181,8 +1185,9 @@ public class Sequence extends ASequence implements SequenceI { if (datasetSequence == null) { - Sequence dsseq = new Sequence(getName(), AlignSeq.extractGaps( - jalview.util.Comparison.GapChars, getSequenceAsString()), + Sequence dsseq = new Sequence(getName(), + AlignSeq.extractGaps(jalview.util.Comparison.GapChars, + getSequenceAsString()), getStart(), getEnd()); datasetSequence = dsseq; @@ -1325,7 +1330,8 @@ public class Sequence extends ASequence implements SequenceI for (int si = 0; si < sfs.length; si++) { SequenceFeature sf[] = (mp != null) ? mp.locateFeature(sfs[si]) - : new SequenceFeature[] { new SequenceFeature(sfs[si]) }; + : new SequenceFeature[] + { new SequenceFeature(sfs[si]) }; if (sf != null && sf.length > 0) { for (int sfi = 0; sfi < sf.length; sfi++) @@ -1481,8 +1487,8 @@ public class Sequence extends ASequence implements SequenceI } } // whilst it looks like it is a primary ref, we also sanity check type - if (DBRefUtils.getCanonicalName(DBRefSource.PDB).equals( - DBRefUtils.getCanonicalName(ref.getSource()))) + if (DBRefUtils.getCanonicalName(DBRefSource.PDB) + .equals(DBRefUtils.getCanonicalName(ref.getSource()))) { // PDB dbrefs imply there should be a PDBEntry associated // TODO: tighten PDB dbrefs diff --git a/src/jalview/datamodel/SequenceFeature.java b/src/jalview/datamodel/SequenceFeature.java index 15f54b9..71732aa 100755 --- a/src/jalview/datamodel/SequenceFeature.java +++ b/src/jalview/datamodel/SequenceFeature.java @@ -132,8 +132,8 @@ public class SequenceFeature * @param end * @param featureGroup */ - public SequenceFeature(String type, String desc, String status, - int begin, int end, String featureGroup) + public SequenceFeature(String type, String desc, String status, int begin, + int end, String featureGroup) { this(type, desc, begin, end, featureGroup); setStatus(status); @@ -220,8 +220,8 @@ public class SequenceFeature return false; } - if (!(type + description + featureGroup + getPhase()).equals(sf.type - + sf.description + sf.featureGroup + sf.getPhase())) + if (!(type + description + featureGroup + getPhase()).equals( + sf.type + sf.description + sf.featureGroup + sf.getPhase())) { return false; } diff --git a/src/jalview/datamodel/SequenceGroup.java b/src/jalview/datamodel/SequenceGroup.java index 46c802f..6964b53 100755 --- a/src/jalview/datamodel/SequenceGroup.java +++ b/src/jalview/datamodel/SequenceGroup.java @@ -620,8 +620,10 @@ public class SequenceGroup implements AnnotatedCollectionI conservation.description = "Conservation for group " + getName() + " less than " + consPercGaps + "% gaps"; // preserve width if already set - int aWidth = (conservation.annotations != null) ? (endRes < conservation.annotations.length ? conservation.annotations.length - : endRes + 1) + int aWidth = (conservation.annotations != null) + ? (endRes < conservation.annotations.length + ? conservation.annotations.length + : endRes + 1) : endRes + 1; conservation.annotations = null; conservation.annotations = new Annotation[aWidth]; // should be alignment @@ -641,8 +643,10 @@ public class SequenceGroup implements AnnotatedCollectionI consensus.description = "Percent Identity"; consensusData = cnsns; // preserve width if already set - int aWidth = (consensus.annotations != null) ? (endRes < consensus.annotations.length ? consensus.annotations.length - : endRes + 1) + int aWidth = (consensus.annotations != null) + ? (endRes < consensus.annotations.length + ? consensus.annotations.length + : endRes + 1) : endRes + 1; consensus.annotations = null; consensus.annotations = new Annotation[aWidth]; // should be alignment width @@ -1304,11 +1308,12 @@ public class SequenceGroup implements AnnotatedCollectionI ArrayList aa = new ArrayList<>(); for (AlignmentAnnotation ann : getAlignmentAnnotation()) { - if ((calcId == null || (ann.getCalcId() != null && ann.getCalcId() - .equals(calcId))) - && (seq == null || (ann.sequenceRef != null && ann.sequenceRef == seq)) - && (label == null || (ann.label != null && ann.label - .equals(label)))) + if ((calcId == null || (ann.getCalcId() != null + && ann.getCalcId().equals(calcId))) + && (seq == null || (ann.sequenceRef != null + && ann.sequenceRef == seq)) + && (label == null + || (ann.label != null && ann.label.equals(label)))) { aa.add(ann); } @@ -1432,7 +1437,8 @@ public class SequenceGroup implements AnnotatedCollectionI @Override public boolean isNucleotide() { - if (context != null) { + if (context != null) + { return context.isNucleotide(); } return false; diff --git a/src/jalview/datamodel/VisibleColsCollection.java b/src/jalview/datamodel/VisibleColsCollection.java index 86233ab..bc32fac 100644 --- a/src/jalview/datamodel/VisibleColsCollection.java +++ b/src/jalview/datamodel/VisibleColsCollection.java @@ -27,6 +27,7 @@ import java.util.Iterator; public class VisibleColsCollection implements AlignmentColsCollectionI { int start; + int end; HiddenColumns hidden; diff --git a/src/jalview/datamodel/VisibleColsIterator.java b/src/jalview/datamodel/VisibleColsIterator.java index a82de93..9de468d 100644 --- a/src/jalview/datamodel/VisibleColsIterator.java +++ b/src/jalview/datamodel/VisibleColsIterator.java @@ -128,4 +128,3 @@ public class VisibleColsIterator implements Iterator throw new UnsupportedOperationException(); } } - diff --git a/src/jalview/datamodel/VisibleRowsCollection.java b/src/jalview/datamodel/VisibleRowsCollection.java index ce8e8da..ee0557f 100644 --- a/src/jalview/datamodel/VisibleRowsCollection.java +++ b/src/jalview/datamodel/VisibleRowsCollection.java @@ -57,4 +57,3 @@ public class VisibleRowsCollection implements AlignmentRowsCollectionI return alignment.getSequenceAtAbsoluteIndex(seq); } } - diff --git a/src/jalview/datamodel/VisibleRowsIterator.java b/src/jalview/datamodel/VisibleRowsIterator.java index a9c782d..e2fdff6 100644 --- a/src/jalview/datamodel/VisibleRowsIterator.java +++ b/src/jalview/datamodel/VisibleRowsIterator.java @@ -51,7 +51,8 @@ public class VisibleRowsIterator implements Iterator * @param alignment * alignment to work with */ - public VisibleRowsIterator(int firstrow, int lastrow, AlignmentI alignment) + public VisibleRowsIterator(int firstrow, int lastrow, + AlignmentI alignment) { al = alignment; current = firstrow; @@ -96,4 +97,3 @@ public class VisibleRowsIterator implements Iterator throw new UnsupportedOperationException(); } } - diff --git a/src/jalview/datamodel/xdb/embl/EmblEntry.java b/src/jalview/datamodel/xdb/embl/EmblEntry.java index 4d09bdc..fe3f6ef 100644 --- a/src/jalview/datamodel/xdb/embl/EmblEntry.java +++ b/src/jalview/datamodel/xdb/embl/EmblEntry.java @@ -191,13 +191,15 @@ public class EmblEntry return null; } dna.setDescription(description); - DBRefEntry retrievedref = new DBRefEntry(sourceDb, - getSequenceVersion(), accession); + DBRefEntry retrievedref = new DBRefEntry(sourceDb, getSequenceVersion(), + accession); dna.addDBRef(retrievedref); // add map to indicate the sequence is a valid coordinate frame for the // dbref - retrievedref.setMap(new Mapping(null, new int[] { 1, dna.getLength() }, - new int[] { 1, dna.getLength() }, 1, 1)); + retrievedref + .setMap(new Mapping(null, new int[] + { 1, dna.getLength() }, new int[] { 1, dna.getLength() }, 1, + 1)); /* * transform EMBL Database refs to canonical form @@ -242,8 +244,8 @@ public class EmblEntry { if (sequence == null) { - System.err.println("No sequence was returned for ENA accession " - + accession); + System.err.println( + "No sequence was returned for ENA accession " + accession); return null; } SequenceI dna = new Sequence(sourceDb + "|" + accession, @@ -267,7 +269,8 @@ public class EmblEntry * helper to match xrefs in already retrieved sequences */ void parseCodingFeature(EmblFeature feature, String sourceDb, - SequenceI dna, List peptides, SequenceIdMatcher matcher) + SequenceI dna, List peptides, + SequenceIdMatcher matcher) { boolean isEmblCdna = sourceDb.equals(DBRefSource.EMBLCDS); @@ -296,8 +299,8 @@ public class EmblEntry if (qname.equals("translation")) { // remove all spaces (precompiled String.replaceAll(" ", "")) - translation = SPACE_PATTERN.matcher(q.getValues()[0]).replaceAll( - ""); + translation = SPACE_PATTERN.matcher(q.getValues()[0]) + .replaceAll(""); } else if (qname.equals("protein_id")) { @@ -310,8 +313,8 @@ public class EmblEntry codonStart = Integer.parseInt(q.getValues()[0].trim()); } catch (NumberFormatException e) { - System.err.println("Invalid codon_start in XML for " - + accession + ": " + e.getMessage()); + System.err.println("Invalid codon_start in XML for " + accession + + ": " + e.getMessage()); } } else if (qname.equals("product")) @@ -348,9 +351,10 @@ public class EmblEntry product = matcher.findIdMatch(proteinId); if (product == null) { - product = new Sequence(proteinId, translation, 1, translationLength); - product.setDescription(((proteinName.length() == 0) ? "Protein Product from " - + sourceDb + product = new Sequence(proteinId, translation, 1, + translationLength); + product.setDescription(((proteinName.length() == 0) + ? "Protein Product from " + sourceDb : proteinName)); peptides.add(product); matcher.add(product); @@ -364,28 +368,31 @@ public class EmblEntry * workaround until we handle dna location for CDS sequence * e.g. location="X53828.1:60..1058" correctly */ - System.err - .println("Implementation Notice: EMBLCDS records not properly supported yet - Making up the CDNA region of this sequence... may be incorrect (" + System.err.println( + "Implementation Notice: EMBLCDS records not properly supported yet - Making up the CDNA region of this sequence... may be incorrect (" + sourceDb + ":" + getAccession() + ")"); - if (translationLength * 3 == (1 - codonStart + dna.getSequence().length)) + if (translationLength + * 3 == (1 - codonStart + dna.getSequence().length)) { - System.err - .println("Not allowing for additional stop codon at end of cDNA fragment... !"); + System.err.println( + "Not allowing for additional stop codon at end of cDNA fragment... !"); // this might occur for CDS sequences where no features are marked exons = new int[] { dna.getStart() + (codonStart - 1), dna.getEnd() }; - dnaToProteinMapping = new Mapping(product, exons, new int[] { 1, - translationLength }, 3, 1); + dnaToProteinMapping = new Mapping(product, exons, + new int[] + { 1, translationLength }, 3, 1); } - if ((translationLength + 1) * 3 == (1 - codonStart + dna - .getSequence().length)) + if ((translationLength + 1) + * 3 == (1 - codonStart + dna.getSequence().length)) { - System.err - .println("Allowing for additional stop codon at end of cDNA fragment... will probably cause an error in VAMSAs!"); + System.err.println( + "Allowing for additional stop codon at end of cDNA fragment... will probably cause an error in VAMSAs!"); exons = new int[] { dna.getStart() + (codonStart - 1), dna.getEnd() - 3 }; - dnaToProteinMapping = new Mapping(product, exons, new int[] { 1, - translationLength }, 3, 1); + dnaToProteinMapping = new Mapping(product, exons, + new int[] + { 1, translationLength }, 3, 1); } } else @@ -404,26 +411,32 @@ public class EmblEntry else { // final product length truncation check - int[] cdsRanges = adjustForProteinLength(translationLength, exons); - dnaToProteinMapping = new Mapping(product, cdsRanges, new int[] { - 1, translationLength }, 3, 1); + int[] cdsRanges = adjustForProteinLength(translationLength, + exons); + dnaToProteinMapping = new Mapping(product, cdsRanges, + new int[] + { 1, translationLength }, 3, 1); if (product != null) { /* * make xref with mapping from protein to EMBL dna */ DBRefEntry proteinToEmblRef = new DBRefEntry(DBRefSource.EMBL, - getSequenceVersion(), proteinId, new Mapping( - dnaToProteinMapping.getMap().getInverse())); + getSequenceVersion(), proteinId, + new Mapping(dnaToProteinMapping.getMap().getInverse())); product.addDBRef(proteinToEmblRef); /* * make xref from protein to EMBLCDS; we assume here that the * CDS sequence version is same as dna sequence (?!) */ - MapList proteinToCdsMapList = new MapList(new int[] { 1, - translationLength }, new int[] { 1 + (codonStart - 1), - (codonStart - 1) + 3 * translationLength }, 1, 3); + MapList proteinToCdsMapList = new MapList( + new int[] + { 1, translationLength }, + new int[] + { 1 + (codonStart - 1), + (codonStart - 1) + 3 * translationLength }, + 1, 3); DBRefEntry proteinToEmblCdsRef = new DBRefEntry( DBRefSource.EMBLCDS, getSequenceVersion(), proteinId, new Mapping(proteinToCdsMapList)); @@ -518,8 +531,8 @@ public class EmblEntry // Add converse mapping reference if (dnaToProteinMapping != null) { - Mapping pmap = new Mapping(dna, dnaToProteinMapping.getMap() - .getInverse()); + Mapping pmap = new Mapping(dna, + dnaToProteinMapping.getMap().getInverse()); pref = new DBRefEntry(sourceDb, getSequenceVersion(), this.getAccession()); pref.setMap(pmap); @@ -543,8 +556,8 @@ public class EmblEntry if (proteinToEmblProteinRef == null) { // assuming CDSPROTEIN sequence version = dna version (?!) - proteinToEmblProteinRef = new DBRefEntry( - DBRefSource.EMBLCDSProduct, getSequenceVersion(), proteinId); + proteinToEmblProteinRef = new DBRefEntry(DBRefSource.EMBLCDSProduct, + getSequenceVersion(), proteinId); } product.addDBRef(proteinToEmblProteinRef); @@ -552,7 +565,8 @@ public class EmblEntry && dnaToProteinMapping.getTo() != null) { DBRefEntry dnaToEmblProteinRef = new DBRefEntry( - DBRefSource.EMBLCDSProduct, getSequenceVersion(), proteinId); + DBRefSource.EMBLCDSProduct, getSequenceVersion(), + proteinId); dnaToEmblProteinRef.setMap(dnaToProteinMapping); dnaToProteinMapping.setMappedFromId(proteinId); dna.addDBRef(dnaToEmblProteinRef); @@ -586,8 +600,8 @@ public class EmblEntry sf.setDescription(String.format("Exon %d for protein '%s' EMBLCDS:%s", exonNumber, proteinName, proteinAccessionId)); sf.setPhase(String.valueOf(codonStart - 1)); - sf.setStrand(exons[exonStartIndex] <= exons[exonStartIndex + 1] ? "+" - : "-"); + sf.setStrand( + exons[exonStartIndex] <= exons[exonStartIndex + 1] ? "+" : "-"); sf.setValue(FeatureProperties.EXONPOS, exonNumber); sf.setValue(FeatureProperties.EXONPRODUCT, proteinName); if (!vals.isEmpty()) @@ -629,9 +643,9 @@ public class EmblEntry return listToArray(ranges); } catch (ParseException e) { - Cache.log.warn(String.format( - "Not parsing inexact CDS location %s in ENA %s", - feature.location, this.accession)); + Cache.log.warn( + String.format("Not parsing inexact CDS location %s in ENA %s", + feature.location, this.accession)); return new int[] {}; } } diff --git a/src/jalview/datamodel/xdb/embl/EmblFile.java b/src/jalview/datamodel/xdb/embl/EmblFile.java index 1dd854a..8a32c13 100644 --- a/src/jalview/datamodel/xdb/embl/EmblFile.java +++ b/src/jalview/datamodel/xdb/embl/EmblFile.java @@ -121,8 +121,9 @@ public class EmblFile try { // uncomment to DEBUG EMBLFile reading - if (jalview.bin.Cache.getDefault(jalview.bin.Cache.CASTORLOGLEVEL, - "debug").equalsIgnoreCase("DEBUG")) + if (jalview.bin.Cache + .getDefault(jalview.bin.Cache.CASTORLOGLEVEL, "debug") + .equalsIgnoreCase("DEBUG")) { unmar.setDebug(jalview.bin.Cache.log.isDebugEnabled()); } diff --git a/src/jalview/ext/ensembl/EnsemblGene.java b/src/jalview/ext/ensembl/EnsemblGene.java index 37c787b..edeeedd 100644 --- a/src/jalview/ext/ensembl/EnsemblGene.java +++ b/src/jalview/ext/ensembl/EnsemblGene.java @@ -109,7 +109,8 @@ public class EnsemblGene extends EnsemblSeqProxy *
  • resolves an external identifier by looking up xref-ed gene ids
  • *
  • fetches the gene sequence
  • *
  • fetches features on the sequence
  • - *
  • identifies "transcript" features whose Parent is the requested gene
  • + *
  • identifies "transcript" features whose Parent is the requested + * gene
  • *
  • fetches the transcript sequence for each transcript
  • *
  • makes a mapping from the gene to each transcript
  • *
  • copies features from gene to transcript sequences
  • @@ -296,8 +297,8 @@ public class EnsemblGene extends EnsemblSeqProxy filtered.add(sf); } } - gene.setSequenceFeatures(filtered - .toArray(new SequenceFeature[filtered.size()])); + gene.setSequenceFeatures( + filtered.toArray(new SequenceFeature[filtered.size()])); } } @@ -314,8 +315,8 @@ public class EnsemblGene extends EnsemblSeqProxy * the parent gene sequence, with features * @return */ - SequenceI makeTranscript(SequenceFeature transcriptFeature, - AlignmentI al, SequenceI gene) + SequenceI makeTranscript(SequenceFeature transcriptFeature, AlignmentI al, + SequenceI gene) { String accId = getTranscriptId(transcriptFeature); if (accId == null) @@ -363,7 +364,8 @@ public class EnsemblGene extends EnsemblSeqProxy mappedFrom.add(new int[] { sf.getBegin(), sf.getEnd() }); } - Sequence transcript = new Sequence(accId, seqChars, 1, transcriptLength); + Sequence transcript = new Sequence(accId, seqChars, 1, + transcriptLength); /* * Ensembl has gene name as transcript Name @@ -567,8 +569,8 @@ public class EnsemblGene extends EnsemblSeqProxy @Override public boolean isFeatureDisplayed(String type) { - return (so.isA(type, SequenceOntologyI.EXON) || so.isA(type, - SequenceOntologyI.SEQUENCE_VARIANT)); + return (so.isA(type, SequenceOntologyI.EXON) + || so.isA(type, SequenceOntologyI.SEQUENCE_VARIANT)); } @Override diff --git a/src/jalview/ext/ensembl/EnsemblRestClient.java b/src/jalview/ext/ensembl/EnsemblRestClient.java index 2437588..ad6c70c 100644 --- a/src/jalview/ext/ensembl/EnsemblRestClient.java +++ b/src/jalview/ext/ensembl/EnsemblRestClient.java @@ -88,8 +88,8 @@ abstract class EnsemblRestClient extends EnsemblSequenceFetcher static { domainData = new HashMap(); - domainData.put(ENSEMBL_REST, new EnsemblInfo(ENSEMBL_REST, - LATEST_ENSEMBL_REST_VERSION)); + domainData.put(ENSEMBL_REST, + new EnsemblInfo(ENSEMBL_REST, LATEST_ENSEMBL_REST_VERSION)); domainData.put(ENSEMBL_GENOMES_REST, new EnsemblInfo( ENSEMBL_GENOMES_REST, LATEST_ENSEMBLGENOMES_REST_VERSION)); } @@ -211,8 +211,8 @@ abstract class EnsemblRestClient extends EnsemblSequenceFetcher { // note this format works for both ensembl and ensemblgenomes // info/ping.json works for ensembl only (March 2016) - URL ping = new URL(getDomain() - + "/info/ping?content-type=application/json"); + URL ping = new URL( + getDomain() + "/info/ping?content-type=application/json"); /* * expect {"ping":1} if ok @@ -225,8 +225,8 @@ abstract class EnsemblRestClient extends EnsemblSequenceFetcher return pingString != null; } catch (Throwable t) { - System.err.println("Error connecting to " + PING_URL + ": " - + t.getMessage()); + System.err.println( + "Error connecting to " + PING_URL + ": " + t.getMessage()); } finally { if (br != null) @@ -250,8 +250,7 @@ abstract class EnsemblRestClient extends EnsemblSequenceFetcher * @return * @throws IOException */ - protected FileParse getSequenceReader(List ids) - throws IOException + protected FileParse getSequenceReader(List ids) throws IOException { URL url = getUrl(ids); @@ -261,7 +260,8 @@ abstract class EnsemblRestClient extends EnsemblSequenceFetcher // request failed return null; } - FileParse fp = new FileParse(reader, url.toString(), DataSourceType.URL); + FileParse fp = new FileParse(reader, url.toString(), + DataSourceType.URL); return fp; } @@ -303,8 +303,8 @@ abstract class EnsemblRestClient extends EnsemblSequenceFetcher * sequence queries, but not for overlap */ boolean multipleIds = ids != null && ids.size() > 1; - connection.setRequestMethod(multipleIds ? HttpMethod.POST - : HttpMethod.GET); + connection.setRequestMethod( + multipleIds ? HttpMethod.POST : HttpMethod.GET); connection.setRequestProperty("Content-Type", getRequestMimeType(multipleIds)); connection.setRequestProperty("Accept", getResponseMimeType()); @@ -379,8 +379,8 @@ abstract class EnsemblRestClient extends EnsemblSequenceFetcher + (1000 * Integer.valueOf(retryDelay)); } catch (NumberFormatException e) { - System.err.println("Unexpected value for Retry-After: " - + retryDelay); + System.err + .println("Unexpected value for Retry-After: " + retryDelay); } } else @@ -424,7 +424,8 @@ abstract class EnsemblRestClient extends EnsemblSequenceFetcher /* * recheck if Ensembl is up if it was down, or the recheck period has elapsed */ - boolean retestAvailability = (now - info.lastAvailableCheckTime) > AVAILABILITY_RETEST_INTERVAL; + boolean retestAvailability = (now + - info.lastAvailableCheckTime) > AVAILABILITY_RETEST_INTERVAL; if (!info.restAvailable || retestAvailability) { info.restAvailable = checkEnsembl(); @@ -434,7 +435,8 @@ abstract class EnsemblRestClient extends EnsemblSequenceFetcher /* * refetch Ensembl versions if the recheck period has elapsed */ - boolean refetchVersion = (now - info.lastVersionCheckTime) > VERSION_RETEST_INTERVAL; + boolean refetchVersion = (now + - info.lastVersionCheckTime) > VERSION_RETEST_INTERVAL; if (refetchVersion) { checkEnsemblRestVersion(); @@ -475,7 +477,8 @@ abstract class EnsemblRestClient extends EnsemblSequenceFetcher byte[] thepostbody = postBody.toString().getBytes(); connection.setRequestProperty("Content-Length", Integer.toString(thepostbody.length)); - DataOutputStream wr = new DataOutputStream(connection.getOutputStream()); + DataOutputStream wr = new DataOutputStream( + connection.getOutputStream()); wr.write(thepostbody); wr.flush(); wr.close(); @@ -494,8 +497,8 @@ abstract class EnsemblRestClient extends EnsemblSequenceFetcher URL url = null; try { - url = new URL(getDomain() - + "/info/rest?content-type=application/json"); + url = new URL( + getDomain() + "/info/rest?content-type=application/json"); BufferedReader br = getHttpResponse(url, null); JSONObject val = (JSONObject) jp.parse(br); String version = val.get("release").toString(); @@ -525,20 +528,19 @@ abstract class EnsemblRestClient extends EnsemblSequenceFetcher * if so warn; we don't worry if it is earlier (this indicates Jalview has * been tested in advance against the next pending REST version) */ - boolean laterVersion = StringUtils.compareVersions(version, expected) == 1; + boolean laterVersion = StringUtils.compareVersions(version, + expected) == 1; if (laterVersion) { - System.err - .println(String - .format("EnsemblRestClient expected %s REST version %s but found %s, see %s", - getDbSource(), expected, version, - REST_CHANGE_LOG)); + System.err.println(String.format( + "EnsemblRestClient expected %s REST version %s but found %s, see %s", + getDbSource(), expected, version, REST_CHANGE_LOG)); } info.restVersion = version; } catch (Throwable t) { - System.err.println("Error checking Ensembl REST version: " - + t.getMessage()); + System.err.println( + "Error checking Ensembl REST version: " + t.getMessage()); } } @@ -558,16 +560,16 @@ abstract class EnsemblRestClient extends EnsemblSequenceFetcher URL url = null; try { - url = new URL(getDomain() - + "/info/data?content-type=application/json"); + url = new URL( + getDomain() + "/info/data?content-type=application/json"); BufferedReader br = getHttpResponse(url, null); JSONObject val = (JSONObject) jp.parse(br); JSONArray versions = (JSONArray) val.get("releases"); domainData.get(getDomain()).dataVersion = versions.get(0).toString(); } catch (Throwable t) { - System.err.println("Error checking Ensembl data version: " - + t.getMessage()); + System.err.println( + "Error checking Ensembl data version: " + t.getMessage()); } } diff --git a/src/jalview/ext/ensembl/EnsemblSeqProxy.java b/src/jalview/ext/ensembl/EnsemblSeqProxy.java index 233707b..16b858a 100644 --- a/src/jalview/ext/ensembl/EnsemblSeqProxy.java +++ b/src/jalview/ext/ensembl/EnsemblSeqProxy.java @@ -137,8 +137,8 @@ public abstract class EnsemblSeqProxy extends EnsemblRestClient // danger: accession separator used as a regex here, a string elsewhere // in this case it is ok (it is just a space), but (e.g.) '\' would not be - List allIds = Arrays.asList(query - .split(getAccessionSeparator())); + List allIds = Arrays + .asList(query.split(getAccessionSeparator())); AlignmentI alignment = null; inProgress = true; @@ -236,8 +236,8 @@ public abstract class EnsemblSeqProxy extends EnsemblRestClient } } catch (IOException e) { - System.err.println("Error transferring Ensembl features: " - + e.getMessage()); + System.err.println( + "Error transferring Ensembl features: " + e.getMessage()); } } @@ -275,8 +275,8 @@ public abstract class EnsemblSeqProxy extends EnsemblRestClient proteinSeq.createDatasetSequence(); querySeq.createDatasetSequence(); - MapList mapList = AlignmentUtils - .mapCdsToProtein(querySeq, proteinSeq); + MapList mapList = AlignmentUtils.mapCdsToProtein(querySeq, + proteinSeq); if (mapList != null) { // clunky: ensure Uniprot xref if we have one is on mapped sequence @@ -287,9 +287,11 @@ public abstract class EnsemblSeqProxy extends EnsemblRestClient getEnsemblDataVersion(), proteinSeq.getName(), map); querySeq.getDatasetSequence().addDBRef(dbr); DBRefEntry[] uprots = DBRefUtils.selectRefs(ds.getDBRefs(), - new String[] { DBRefSource.UNIPROT }); + new String[] + { DBRefSource.UNIPROT }); DBRefEntry[] upxrefs = DBRefUtils.selectRefs(querySeq.getDBRefs(), - new String[] { DBRefSource.UNIPROT }); + new String[] + { DBRefSource.UNIPROT }); if (uprots != null) { for (DBRefEntry up : uprots) @@ -304,8 +306,8 @@ public abstract class EnsemblSeqProxy extends EnsemblRestClient if (upx.size() > 1) { - Cache.log - .warn("Implementation issue - multiple uniprot acc on product sequence."); + Cache.log.warn( + "Implementation issue - multiple uniprot acc on product sequence."); } } else @@ -330,8 +332,8 @@ public abstract class EnsemblSeqProxy extends EnsemblRestClient * copy exon features to protein, compute peptide variants from dna * variants and add as features on the protein sequence ta-da */ - AlignmentUtils - .computeProteinFeatures(querySeq, proteinSeq, mapList); + AlignmentUtils.computeProteinFeatures(querySeq, proteinSeq, + mapList); } } catch (Exception e) { @@ -364,8 +366,8 @@ public abstract class EnsemblSeqProxy extends EnsemblRestClient /* * and add a reference to itself */ - DBRefEntry self = new DBRefEntry(getDbSource(), - getEnsemblDataVersion(), seq.getName()); + DBRefEntry self = new DBRefEntry(getDbSource(), getEnsemblDataVersion(), + seq.getName()); seq.addDBRef(self); } @@ -379,8 +381,8 @@ public abstract class EnsemblSeqProxy extends EnsemblRestClient * @throws JalviewException * @throws IOException */ - protected AlignmentI fetchSequences(List ids, AlignmentI alignment) - throws JalviewException, IOException + protected AlignmentI fetchSequences(List ids, + AlignmentI alignment) throws JalviewException, IOException { if (!isEnsemblAvailable()) { @@ -396,15 +398,15 @@ public abstract class EnsemblSeqProxy extends EnsemblRestClient FastaFile fr = new FastaFile(fp); if (fr.hasWarningMessage()) { - System.out.println(String.format( - "Warning when retrieving %d ids %s\n%s", ids.size(), - ids.toString(), fr.getWarningMessage())); + System.out.println( + String.format("Warning when retrieving %d ids %s\n%s", + ids.size(), ids.toString(), fr.getWarningMessage())); } else if (fr.getSeqs().size() != ids.size()) { System.out.println(String.format( - "Only retrieved %d sequences for %d query strings", fr - .getSeqs().size(), ids.size())); + "Only retrieved %d sequences for %d query strings", + fr.getSeqs().size(), ids.size())); } if (fr.getSeqs().size() == 1 && fr.getSeqs().get(0).getLength() == 0) @@ -565,8 +567,8 @@ public abstract class EnsemblSeqProxy extends EnsemblRestClient if (directionSet && strand != direction) { // abort - mix of forward and backward - System.err.println("Error: forward and backward strand for " - + accId); + System.err.println( + "Error: forward and backward strand for " + accId); return null; } direction = strand; @@ -609,8 +611,9 @@ public abstract class EnsemblSeqProxy extends EnsemblRestClient */ Collections.sort(regions, new RangeComparator(direction == 1)); - List to = Arrays.asList(new int[] { start, - start + mappedLength - 1 }); + List to = Arrays + .asList(new int[] + { start, start + mappedLength - 1 }); return new MapList(regions, to, 1, 1); } @@ -671,9 +674,8 @@ public abstract class EnsemblSeqProxy extends EnsemblRestClient * for sequence_variant on reverse strand, have to convert the allele * values to their complements */ - if (!forwardStrand - && SequenceOntologyFactory.getInstance().isA(sf.getType(), - SequenceOntologyI.SEQUENCE_VARIANT)) + if (!forwardStrand && SequenceOntologyFactory.getInstance() + .isA(sf.getType(), SequenceOntologyI.SEQUENCE_VARIANT)) { reverseComplementAlleles(copy); } diff --git a/src/jalview/ext/ensembl/EnsemblSequenceFetcher.java b/src/jalview/ext/ensembl/EnsemblSequenceFetcher.java index bd6335a..598dba1 100644 --- a/src/jalview/ext/ensembl/EnsemblSequenceFetcher.java +++ b/src/jalview/ext/ensembl/EnsemblSequenceFetcher.java @@ -38,7 +38,8 @@ abstract class EnsemblSequenceFetcher extends DbSourceProxyImpl * or CCDSnnnnn.nn with at least 3 digits */ private static final Regex ACCESSION_REGEX = new Regex( - "(ENS([A-Z]{3}|)[GTEP]{1}[0-9]{11}$)" + "|" + "(CCDS[0-9.]{3,}$)"); + "(ENS([A-Z]{3}|)[GTEP]{1}[0-9]{11}$)" + "|" + + "(CCDS[0-9.]{3,}$)"); protected static final String ENSEMBL_GENOMES_REST = "http://rest.ensemblgenomes.org"; diff --git a/src/jalview/ext/ensembl/EnsemblSymbol.java b/src/jalview/ext/ensembl/EnsemblSymbol.java index 0d79864..9f86731 100644 --- a/src/jalview/ext/ensembl/EnsemblSymbol.java +++ b/src/jalview/ext/ensembl/EnsemblSymbol.java @@ -62,8 +62,7 @@ public class EnsemblSymbol extends EnsemblXref * @return * @throws IOException */ - protected String parseSymbolResponse(BufferedReader br) - throws IOException + protected String parseSymbolResponse(BufferedReader br) throws IOException { JSONParser jp = new JSONParser(); String result = null; diff --git a/src/jalview/ext/ensembl/Species.java b/src/jalview/ext/ensembl/Species.java index 350d0d5..af01225 100644 --- a/src/jalview/ext/ensembl/Species.java +++ b/src/jalview/ext/ensembl/Species.java @@ -34,9 +34,9 @@ enum Species */ human(true), mouse(true), s_cerevisiae(true), cow(false), pig(false), rat(true), celegans(true), sheep(false), horse(false), gorilla(false), - rabbit(false), gibbon(false), dog(false), orangutan(false), - xenopus(true), chimpanzee(false), cat(false), zebrafish(true), chicken( - true), dmelanogaster(true); + rabbit(false), gibbon(false), dog(false), orangutan(false), xenopus(true), + chimpanzee(false), cat(false), zebrafish(true), chicken(true), + dmelanogaster(true); boolean modelOrganism; diff --git a/src/jalview/ext/htsjdk/HtsContigDb.java b/src/jalview/ext/htsjdk/HtsContigDb.java index 4357abd..37ce625 100644 --- a/src/jalview/ext/htsjdk/HtsContigDb.java +++ b/src/jalview/ext/htsjdk/HtsContigDb.java @@ -70,8 +70,8 @@ public class HtsContigDb return; } - refFile = ReferenceSequenceFileFactory.getReferenceSequenceFile( - dbLocation, true); + refFile = ReferenceSequenceFileFactory + .getReferenceSequenceFile(dbLocation, true); if (refFile == null || refFile.getSequenceDictionary() == null) { // refFile = initSequenceDictionaryFor(dbLocation); @@ -144,7 +144,8 @@ public class HtsContigDb ReferenceSequence refSeq; List ret = new ArrayList(); Set sequenceNames = new HashSet(); - for (int numSequences = 0; (refSeq = refSeqFile.nextSequence()) != null; ++numSequences) + for (int numSequences = 0; (refSeq = refSeqFile + .nextSequence()) != null; ++numSequences) { if (sequenceNames.contains(refSeq.getName())) { diff --git a/src/jalview/ext/jmol/JalviewJmolBinding.java b/src/jalview/ext/jmol/JalviewJmolBinding.java index 5de554b..96dfcfe 100644 --- a/src/jalview/ext/jmol/JalviewJmolBinding.java +++ b/src/jalview/ext/jmol/JalviewJmolBinding.java @@ -225,8 +225,8 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel HiddenColumns hiddenCols) { superposeStructures(new AlignmentI[] { alignment }, - new int[] { refStructure }, - new HiddenColumns[] { hiddenCols }); + new int[] + { refStructure }, new HiddenColumns[] { hiddenCols }); } /** @@ -279,18 +279,16 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel int refStructure = _refStructure[a]; AlignmentI alignment = _alignment[a]; HiddenColumns hiddenCols = _hiddenCols[a]; - if (a > 0 - && selectioncom.length() > 0 - && !selectioncom.substring(selectioncom.length() - 1).equals( - "|")) + if (a > 0 && selectioncom.length() > 0 && !selectioncom + .substring(selectioncom.length() - 1).equals("|")) { selectioncom.append("|"); } // process this alignment if (refStructure >= files.length) { - System.err.println("Invalid reference structure value " - + refStructure); + System.err.println( + "Invalid reference structure value " + refStructure); refStructure = -1; } @@ -332,8 +330,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel int nmatched = matched.cardinality(); if (nmatched < 4) { - return (MessageManager.formatMessage( -"label.insufficient_residues", + return (MessageManager.formatMessage("label.insufficient_residues", nmatched)); } @@ -429,7 +426,8 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel command.append(".1} {"); command.append(Integer.toString(1 + refStructure)); // conformation=1 excludes alternate locations for CA (JAL-1757) - command.append(".1} SUBSET {(*.CA | *.P) and conformation=1} ATOMS "); + command.append( + ".1} SUBSET {(*.CA | *.P) and conformation=1} ATOMS "); // for (int s = 0; s < 2; s++) // { @@ -461,7 +459,8 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel // System.out.println("Select regions:\n" + selectioncom.toString()); evalStateCommand("select *; cartoons off; backbone; select (" + selectioncom.toString() + "); cartoons; "); - // evalStateCommand("select *; backbone; select "+selcom.toString()+"; cartoons; center "+selcom.toString()); + // evalStateCommand("select *; backbone; select "+selcom.toString()+"; + // cartoons; center "+selcom.toString()); } return null; @@ -549,7 +548,8 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel } @Override - public float[][][] functionXYZ(String functionName, int nx, int ny, int nz) + public float[][][] functionXYZ(String functionName, int nx, int ny, + int nz) { // TODO Auto-generated method stub return null; @@ -622,9 +622,8 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel } catch (AccessControlException x) { // usually not allowed to do this in applet - System.err - .println("jmolBinding: Using local file string from Jmol: " - + m); + System.err.println( + "jmolBinding: Using local file string from Jmol: " + m); } if (filePath.indexOf("/file:") != -1) { @@ -647,7 +646,8 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel } catch (AccessControlException x) { // usually not allowed to do this in applet, so keep raw handle - // System.err.println("jmolBinding: Using local file string from Jmol: "+m); + // System.err.println("jmolBinding: Using local file string from + // Jmol: "+m); } } @@ -693,6 +693,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel return modelFileNames; } + /** * map from string to applet */ @@ -703,8 +704,6 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel return null; } - - // /////////////////////////////// // JmolStatusListener @@ -827,14 +826,14 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel // handle insertion codes if (alocsep != -1) { - pdbResNum = Integer.parseInt(strInfo.substring( - strInfo.indexOf("]") + 1, alocsep)); + pdbResNum = Integer.parseInt( + strInfo.substring(strInfo.indexOf("]") + 1, alocsep)); } else { - pdbResNum = Integer.parseInt(strInfo.substring( - strInfo.indexOf("]") + 1, chainSeparator)); + pdbResNum = Integer.parseInt( + strInfo.substring(strInfo.indexOf("]") + 1, chainSeparator)); } String chainId; @@ -856,13 +855,14 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel { chainSeparator1 = strInfo.indexOf(".", mdlSep); } - String mdlId = (chainSeparator1 > -1) ? strInfo.substring(mdlSep + 1, - chainSeparator1) : strInfo.substring(mdlSep + 1); + String mdlId = (chainSeparator1 > -1) + ? strInfo.substring(mdlSep + 1, chainSeparator1) + : strInfo.substring(mdlSep + 1); try { // recover PDB filename for the model hovered over. - int _mp = _modelFileNameMap.length - 1, mnumber = new Integer(mdlId) - .intValue() - 1; + int _mp = _modelFileNameMap.length - 1, + mnumber = new Integer(mdlId).intValue() - 1; while (mnumber < _modelFileNameMap[_mp]) { _mp--; @@ -903,7 +903,8 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel * } } */ - public void notifyAtomPicked(int atomIndex, String strInfo, String strData) + public void notifyAtomPicked(int atomIndex, String strInfo, + String strData) { /** * this implements the toggle label behaviour copied from the original @@ -986,8 +987,8 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel sendConsoleEcho((String) data[1]); break; case MESSAGE: - sendConsoleMessage((data == null) ? ((String) null) - : (String) data[1]); + sendConsoleMessage( + (data == null) ? ((String) null) : (String) data[1]); break; case ERROR: // System.err.println("Ignoring error callback."); @@ -1000,8 +1001,8 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel case CLICK: default: - System.err.println("Unhandled callback " + type + " " - + data[1].toString()); + System.err.println( + "Unhandled callback " + type + " " + data[1].toString()); break; } } catch (Exception e) @@ -1110,8 +1111,8 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel // calculate essential attributes for the pdb data imported inline. // prolly need to resolve modelnumber properly - for now just use our // 'best guess' - pdbfile = viewer.getData("" + (1 + _modelFileNameMap[modelnum]) - + ".0", "PDB"); + pdbfile = viewer.getData( + "" + (1 + _modelFileNameMap[modelnum]) + ".0", "PDB"); } // search pdbentries and sequences to find correct pdbentry for this // model @@ -1167,8 +1168,8 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel // add an entry for every chain in the model for (int i = 0; i < pdb.getChains().size(); i++) { - String chid = new String(pdb.getId() + ":" - + pdb.getChains().elementAt(i).id); + String chid = new String( + pdb.getId() + ":" + pdb.getChains().elementAt(i).id); chainFile.put(chid, fileName); chainNames.add(chid); } @@ -1200,7 +1201,8 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel // } if (!isLoadingFromArchive()) { - viewer.evalStringQuiet("model *; select backbone;restrict;cartoon;wireframe off;spacefill off"); + viewer.evalStringQuiet( + "model *; select backbone;restrict;cartoon;wireframe off;spacefill off"); } // register ourselves as a listener and notify the gui that it needs to // update itself. @@ -1280,8 +1282,9 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel false); for (String resName : residueSet) { - char res = resName.length() == 3 ? ResidueProperties - .getSingleCharacterCode(resName) : resName.charAt(0); + char res = resName.length() == 3 + ? ResidueProperties.getSingleCharacterCode(resName) + : resName.charAt(0); Color col = cs.findColour(res, 0, null, null, 0f); command.append("select " + resName + ";color[" + col.getRed() + "," + col.getGreen() + "," + col.getBlue() + "];"); @@ -1360,8 +1363,8 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel commandOptions = ""; } viewer = (Viewer) JmolViewer.allocateViewer(renderPanel, - (jmolfileio ? new SmarterJmolAdapter() : null), htmlName - + ((Object) this).toString(), documentBase, codeBase, + (jmolfileio ? new SmarterJmolAdapter() : null), + htmlName + ((Object) this).toString(), documentBase, codeBase, commandOptions, this); viewer.setJmolStatusListener(this); // extends JmolCallbackListener diff --git a/src/jalview/ext/jmol/JmolCommands.java b/src/jalview/ext/jmol/JmolCommands.java index 3e7ca59..6bf7010 100644 --- a/src/jalview/ext/jmol/JmolCommands.java +++ b/src/jalview/ext/jmol/JmolCommands.java @@ -113,21 +113,14 @@ public class JmolCommands col = Color.GRAY; } - String newSelcom = (mapping[m].getChain() != " " ? ":" - + mapping[m].getChain() : "") - + "/" - + (pdbfnum + 1) - + ".1" - + ";color[" - + col.getRed() - + "," - + col.getGreen() - + "," + String newSelcom = (mapping[m].getChain() != " " + ? ":" + mapping[m].getChain() + : "") + "/" + (pdbfnum + 1) + ".1" + ";color[" + + col.getRed() + "," + col.getGreen() + "," + col.getBlue() + "]"; - if (command.length() > newSelcom.length() - && command.substring( - command.length() - newSelcom.length()) - .equals(newSelcom)) + if (command.length() > newSelcom.length() && command + .substring(command.length() - newSelcom.length()) + .equals(newSelcom)) { command = JmolCommands.condenseCommand(command, pos); continue; diff --git a/src/jalview/ext/jmol/JmolParser.java b/src/jalview/ext/jmol/JmolParser.java index f08e40e..ddf3b1a 100644 --- a/src/jalview/ext/jmol/JmolParser.java +++ b/src/jalview/ext/jmol/JmolParser.java @@ -105,8 +105,9 @@ public class JmolParser extends StructureFile implements JmolStatusListener // } // ; // instead, we distinguish .cif from non-.cif by filename - setStructureFileType(getDataName().toLowerCase().endsWith(".cif") ? PDBEntry.Type.MMCIF - .toString() : "PDB"); + setStructureFileType(getDataName().toLowerCase().endsWith(".cif") + ? PDBEntry.Type.MMCIF.toString() + : "PDB"); transformJmolModelToJalview(jmolModel.ms); } @@ -135,7 +136,8 @@ public class JmolParser extends StructureFile implements JmolStatusListener { throw new Error(MessageManager.formatMessage( "error.jmol_version_not_compatible_with_jalview_version", - new String[] { JmolViewer.getJmolVersion() }), x); + new String[] + { JmolViewer.getJmolVersion() }), x); } } return viewer; @@ -205,11 +207,10 @@ public class JmolParser extends StructureFile implements JmolStatusListener } } catch (OutOfMemoryError er) { - System.out - .println("OUT OF MEMORY LOADING TRANSFORMING JMOL MODEL TO JALVIEW MODEL"); - throw new IOException( - MessageManager - .getString("exception.outofmemory_loading_mmcif_file")); + System.out.println( + "OUT OF MEMORY LOADING TRANSFORMING JMOL MODEL TO JALVIEW MODEL"); + throw new IOException(MessageManager + .getString("exception.outofmemory_loading_mmcif_file")); } } @@ -236,8 +237,9 @@ public class JmolParser extends StructureFile implements JmolStatusListener curAtom.number = atom.getAtomNumber(); curAtom.resName = atom.getGroup3(true); curAtom.resNumber = atom.getResno(); - curAtom.occupancy = ms.occupancies != null ? ms.occupancies[atom - .getIndex()] : Float.valueOf(atom.getOccupancy100()); + curAtom.occupancy = ms.occupancies != null + ? ms.occupancies[atom.getIndex()] + : Float.valueOf(atom.getOccupancy100()); String fmt = new Format("%4i").form(curAtom.resNumber); curAtom.resNumIns = (fmt + curAtom.insCode); curAtom.tfactor = atom.getBfactor100() / 100f; @@ -259,7 +261,7 @@ public class JmolParser extends StructureFile implements JmolStatusListener HashMap chainTerMap) { // System.out.println("Atom: " + curAtom.getAtomNumber() - // + " Last atom index " + curAtom.group.lastAtomIndex); + // + " Last atom index " + curAtom.group.lastAtomIndex); if (chainTerMap == null || prevAtom == null) { return true; @@ -282,7 +284,8 @@ public class JmolParser extends StructureFile implements JmolStatusListener { return false; } - if ((curAtom.getResno() - chainTerMap.get(curAtomChId).getResno()) < 5) + if ((curAtom.getResno() + - chainTerMap.get(curAtomChId).getResno()) < 5) { chainTerMap.put(curAtomChId, curAtom); return true; @@ -297,7 +300,8 @@ public class JmolParser extends StructureFile implements JmolStatusListener { return false; } - if ((curAtom.getResno() - chainTerMap.get(curAtomChId).getResno()) < 5) + if ((curAtom.getResno() + - chainTerMap.get(curAtomChId).getResno()) < 5) { chainTerMap.put(curAtomChId, curAtom); return true; @@ -305,8 +309,8 @@ public class JmolParser extends StructureFile implements JmolStatusListener return false; } // HETATM with resNum jump > 2 - return !(curAtom.isHetero() && ((curAtom.getResno() - prevAtom - .getResno()) > 2)); + return !(curAtom.isHetero() + && ((curAtom.getResno() - prevAtom.getResno()) > 2)); } private void createAnnotation(SequenceI sequence, PDBChain chain, @@ -411,8 +415,8 @@ public class JmolParser extends StructureFile implements JmolStatusListener * @param secstr * @param secstrcode */ - protected void setSecondaryStructure(STR proteinStructureSubType, - int pos, char[] secstr, char[] secstrcode) + protected void setSecondaryStructure(STR proteinStructureSubType, int pos, + char[] secstr, char[] secstrcode) { switch (proteinStructureSubType) { @@ -489,8 +493,8 @@ public class JmolParser extends StructureFile implements JmolStatusListener @Override public void notifyCallback(CBK cbType, Object[] data) { - String strInfo = (data == null || data[1] == null ? null : data[1] - .toString()); + String strInfo = (data == null || data[1] == null ? null + : data[1].toString()); switch (cbType) { case ECHO: @@ -590,7 +594,8 @@ public class JmolParser extends StructureFile implements JmolStatusListener * Not implemented - returns null */ @Override - public float[][][] functionXYZ(String functionName, int nx, int ny, int nz) + public float[][][] functionXYZ(String functionName, int nx, int ny, + int nz) { return null; } @@ -642,7 +647,8 @@ public class JmolParser extends StructureFile implements JmolStatusListener return predictSecondaryStructure; } - public void setPredictSecondaryStructure(boolean predictSecondaryStructure) + public void setPredictSecondaryStructure( + boolean predictSecondaryStructure) { this.predictSecondaryStructure = predictSecondaryStructure; } diff --git a/src/jalview/ext/paradise/Annotate3D.java b/src/jalview/ext/paradise/Annotate3D.java index 5b75206..d50ad87 100644 --- a/src/jalview/ext/paradise/Annotate3D.java +++ b/src/jalview/ext/paradise/Annotate3D.java @@ -94,8 +94,8 @@ public class Annotate3D } @Override - public boolean startObjectEntry(String key) throws ParseException, - IOException + public boolean startObjectEntry(String key) + throws ParseException, IOException { // TODO Auto-generated method stub return false; @@ -123,8 +123,8 @@ public class Annotate3D } @Override - public boolean primitive(Object value) throws ParseException, - IOException + public boolean primitive(Object value) + throws ParseException, IOException { // TODO Auto-generated method stub return false; @@ -144,8 +144,8 @@ public class Annotate3D // return processJsonResponseFor(HttpClientUtils.doHttpUrlPost(twoDtoolsURL, // vals)); ArrayList readers = new ArrayList(); - final BufferedReader postResponse = HttpClientUtils.doHttpUrlPost( - twoDtoolsURL, vals, 0, 0); + final BufferedReader postResponse = HttpClientUtils + .doHttpUrlPost(twoDtoolsURL, vals, 0, 0); readers.add(postResponse); return readers.iterator(); @@ -183,15 +183,15 @@ public class Annotate3D ; if (sval == null) { - System.err - .println("DEVELOPER WARNING: Annotate3d didn't return a '2D' tag in its response. Consider checking output of server. Response was :" + System.err.println( + "DEVELOPER WARNING: Annotate3d didn't return a '2D' tag in its response. Consider checking output of server. Response was :" + val.toString()); sval = ""; } - return new StringReader( - (sval instanceof JSONObject) ? ((JSONObject) sval) - .toString() : sval.toString()); + return new StringReader((sval instanceof JSONObject) + ? ((JSONObject) sval).toString() + : sval.toString()); } @@ -228,9 +228,8 @@ public class Annotate3D }; } catch (Exception foo) { - throw new Exception( - MessageManager - .getString("exception.couldnt_parse_responde_from_annotated3d_server"), + throw new Exception(MessageManager.getString( + "exception.couldnt_parse_responde_from_annotated3d_server"), foo); } diff --git a/src/jalview/ext/rbvi/chimera/AtomSpecModel.java b/src/jalview/ext/rbvi/chimera/AtomSpecModel.java index d62cc3c..9d45e5e 100644 --- a/src/jalview/ext/rbvi/chimera/AtomSpecModel.java +++ b/src/jalview/ext/rbvi/chimera/AtomSpecModel.java @@ -26,7 +26,7 @@ import java.util.TreeMap; *
* *
- * @see http://www.cgl.ucsf.edu/chimera/current/docs/UsersGuide/midas/frameatom_spec.html
+ * @see http://www.cgl.ucsf.edu/chimera/current/docs/UsersGuide/midas/frameatom_spec.html
  * 
*/ public class AtomSpecModel diff --git a/src/jalview/ext/rbvi/chimera/ChimeraCommands.java b/src/jalview/ext/rbvi/chimera/ChimeraCommands.java index 62aaa1c..dd91087 100644 --- a/src/jalview/ext/rbvi/chimera/ChimeraCommands.java +++ b/src/jalview/ext/rbvi/chimera/ChimeraCommands.java @@ -269,8 +269,8 @@ public class ChimeraCommands // final colour range if (lastColour != null) { - addColourRange(colourMap, lastColour, pdbfnum, startPos, lastPos, - lastChain); + addColourRange(colourMap, lastColour, pdbfnum, startPos, + lastPos, lastChain); } // break; } @@ -318,8 +318,8 @@ public class ChimeraCommands * @return */ public static StructureMappingcommandSet getSetAttributeCommandsForFeatures( - StructureSelectionManager ssm, String[] files, - SequenceI[][] seqs, AlignmentViewPanel viewPanel) + StructureSelectionManager ssm, String[] files, SequenceI[][] seqs, + AlignmentViewPanel viewPanel) { Map> featureMap = buildFeaturesMap( ssm, files, seqs, viewPanel); @@ -346,8 +346,8 @@ public class ChimeraCommands * @return */ protected static Map> buildFeaturesMap( - StructureSelectionManager ssm, String[] files, - SequenceI[][] seqs, AlignmentViewPanel viewPanel) + StructureSelectionManager ssm, String[] files, SequenceI[][] seqs, + AlignmentViewPanel viewPanel) { Map> theMap = new LinkedHashMap>(); @@ -454,8 +454,8 @@ public class ChimeraCommands } for (int[] range : mappedRanges) { - addColourRange(featureValues, value, modelNumber, range[0], range[1], - mapping.getChain()); + addColourRange(featureValues, value, modelNumber, range[0], + range[1], mapping.getChain()); } } } @@ -517,9 +517,11 @@ public class ChimeraCommands * to an underscore. * * @param featureType - * @return
-   * @see https://www.cgl.ucsf.edu/chimera/current/docs/UsersGuide/midas/setattr.html
-   * 
+ * @return + * + *
+   * @see https://www.cgl.ucsf.edu/chimera/current/docs/UsersGuide/midas/setattr.html
+   *         
*/ protected static String makeAttributeName(String featureType) { diff --git a/src/jalview/ext/rbvi/chimera/ChimeraListener.java b/src/jalview/ext/rbvi/chimera/ChimeraListener.java index 507ddbc..a0d74bc 100644 --- a/src/jalview/ext/rbvi/chimera/ChimeraListener.java +++ b/src/jalview/ext/rbvi/chimera/ChimeraListener.java @@ -39,7 +39,8 @@ import javax.servlet.http.HttpServletResponse; *
  • Start the ChimeraListener, get the URL it is listening on
  • *
  • The first listener started will start the singleton HttpServer
  • *
  • Send a 'listen' command to Chimera with the URL of the listener
  • - *
  • When Jalview's Chimera window is closed, shut down the ChimeraListener
  • + *
  • When Jalview's Chimera window is closed, shut down the + * ChimeraListener
  • *
  • Multiple linked Chimera instances will each have a separate listener (but * share one Http server)
  • * @@ -47,8 +48,8 @@ import javax.servlet.http.HttpServletResponse; * @author gmcarstairs * */ -public class ChimeraListener extends AbstractRequestHandler implements - SelectionSource +public class ChimeraListener extends AbstractRequestHandler + implements SelectionSource { /* * Chimera notification parameter name @@ -96,8 +97,7 @@ public class ChimeraListener extends AbstractRequestHandler implements * @throws BindException * if no free port can be assigned */ - public ChimeraListener(JalviewChimeraBinding binding) - throws BindException + public ChimeraListener(JalviewChimeraBinding binding) throws BindException { myChimeraId = chimeraId++; this.chimeraBinding = binding; diff --git a/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java b/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java index b954677..00446f2 100644 --- a/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java +++ b/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java @@ -79,7 +79,7 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel private List chainNames = new ArrayList(); private Hashtable chainFile = new Hashtable(); - + /* * Object through which we talk to Chimera */ @@ -192,7 +192,8 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel * @param protocol */ public JalviewChimeraBinding(StructureSelectionManager ssm, - PDBEntry[] pdbentry, SequenceI[][] sequenceIs, DataSourceType protocol) + PDBEntry[] pdbentry, SequenceI[][] sequenceIs, + DataSourceType protocol) { super(ssm, pdbentry, sequenceIs, protocol); viewer = new ChimeraManager(new StructureManager(true)); @@ -241,8 +242,8 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel viewer.startListening(chimeraListener.getUri()); } catch (BindException e) { - System.err.println("Failed to start Chimera listener: " - + e.getMessage()); + System.err.println( + "Failed to start Chimera listener: " + e.getMessage()); } } @@ -263,8 +264,8 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel for (String chain : toshow) { int modelNumber = getModelNoForChain(chain); - String showChainCmd = modelNumber == -1 ? "" : modelNumber + ":." - + chain.split(":")[1]; + String showChainCmd = modelNumber == -1 ? "" + : modelNumber + ":." + chain.split(":")[1]; if (!first) { cmd.append(","); @@ -515,8 +516,8 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel if (debug) { System.out.println("Select regions:\n" + selectioncom.toString()); - System.out.println("Superimpose command(s):\n" - + command.toString()); + System.out.println( + "Superimpose command(s):\n" + command.toString()); } allComs.append("~display all; chain @CA|P; ribbon ") .append(selectioncom.toString()) @@ -596,8 +597,8 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel return true; } - boolean launched = viewer.launchChimera(StructureManager - .getChimeraPaths()); + boolean launched = viewer + .launchChimera(StructureManager.getChimeraPaths()); if (launched) { startChimeraProcessMonitor(); @@ -741,7 +742,6 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel */ private int _modelFileNameMap[]; - // //////////////////////////////// // /StructureListener @Override @@ -752,8 +752,8 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel return new String[0]; } - return chimeraMaps.keySet().toArray( - modelFileNames = new String[chimeraMaps.size()]); + return chimeraMaps.keySet() + .toArray(modelFileNames = new String[chimeraMaps.size()]); } /** @@ -837,7 +837,8 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel * Parse model number, residue and chain for each selected position, * formatted as #0:123.A or #1.2:87.B (#model.submodel:residue.chain) */ - List atomSpecs = convertStructureResiduesToAlignment(selection); + List atomSpecs = convertStructureResiduesToAlignment( + selection); /* * Broadcast the selection (which may be empty, if the user just cleared all @@ -932,12 +933,13 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel false); for (String resName : residueSet) { - char res = resName.length() == 3 ? ResidueProperties - .getSingleCharacterCode(resName) : resName.charAt(0); + char res = resName.length() == 3 + ? ResidueProperties.getSingleCharacterCode(resName) + : resName.charAt(0); Color col = cs.findColour(res, 0, null, null, 0f); command.append("color " + col.getRed() / normalise + "," - + col.getGreen() / normalise + "," + col.getBlue() - / normalise + " ::" + resName + ";"); + + col.getGreen() / normalise + "," + col.getBlue() / normalise + + " ::" + resName + ";"); } sendAsynchronousCommand(command.toString(), COLOURING_CHIMERA); @@ -983,7 +985,7 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel /** * Send the Chimera 'background solid " command. * - * @see https + * @see https * ://www.cgl.ucsf.edu/chimera/current/docs/UsersGuide/midas/background * .html * @param col @@ -994,8 +996,8 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel viewerCommandHistory(false); double normalise = 255D; final String command = "background solid " + col.getRed() / normalise - + "," + col.getGreen() / normalise + "," + col.getBlue() - / normalise + ";"; + + "," + col.getGreen() / normalise + "," + + col.getBlue() / normalise + ";"; viewer.sendChimeraCommand(command, false); viewerCommandHistory(true); } @@ -1148,9 +1150,8 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel sendAsynchronousCommand("open cmd:" + path, null); } catch (IOException e) { - System.err - .println("Sending commands to Chimera via file failed with " - + e.getMessage()); + System.err.println("Sending commands to Chimera via file failed with " + + e.getMessage()); } } @@ -1288,7 +1289,6 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel return CHIMERA_FEATURE_GROUP; } - public Hashtable getChainFile() { return chainFile; diff --git a/src/jalview/ext/so/SequenceOntology.java b/src/jalview/ext/so/SequenceOntology.java index a4c195f..0d631e6 100644 --- a/src/jalview/ext/so/SequenceOntology.java +++ b/src/jalview/ext/so/SequenceOntology.java @@ -102,8 +102,8 @@ public class SequenceOntology implements SequenceOntologyI try { String zipFile = ontologyFile + ".zip"; - InputStream inStream = this.getClass().getResourceAsStream( - "/" + zipFile); + InputStream inStream = this.getClass() + .getResourceAsStream("/" + zipFile); zipStream = new ZipInputStream(new BufferedInputStream(inStream)); ZipEntry entry; while ((entry = zipStream.getNextEntry()) != null) @@ -151,8 +151,8 @@ public class SequenceOntology implements SequenceOntologyI * @throws ParseException * @throws IOException */ - protected void loadOboFile(InputStream is) throws ParseException, - IOException + protected void loadOboFile(InputStream is) + throws ParseException, IOException { BufferedReader oboFile = new BufferedReader(new InputStreamReader(is)); OboParser parser = new OboParser(); diff --git a/src/jalview/ext/varna/JalviewVarnaBinding.java b/src/jalview/ext/varna/JalviewVarnaBinding.java index ab479c2..6dd5a86 100644 --- a/src/jalview/ext/varna/JalviewVarnaBinding.java +++ b/src/jalview/ext/varna/JalviewVarnaBinding.java @@ -26,8 +26,8 @@ import jalview.structures.models.SequenceStructureBindingModel; import java.awt.event.ComponentListener; -public abstract class JalviewVarnaBinding extends - SequenceStructureBindingModel implements StructureListener, +public abstract class JalviewVarnaBinding + extends SequenceStructureBindingModel implements StructureListener, ComponentListener, StructureSelectionManagerProvider { diff --git a/src/jalview/ext/varna/VarnaCommands.java b/src/jalview/ext/varna/VarnaCommands.java index d65f1d5..4dd0648 100644 --- a/src/jalview/ext/varna/VarnaCommands.java +++ b/src/jalview/ext/varna/VarnaCommands.java @@ -48,8 +48,7 @@ public class VarnaCommands public static String[] getColourBySequenceCommand( StructureSelectionManager ssm, String[] files, SequenceI[][] sequence, SequenceRenderer sr, - FeatureColourFinder finder, - AlignmentI alignment) + FeatureColourFinder finder, AlignmentI alignment) { ArrayList str = new ArrayList(); StringBuffer command = new StringBuffer(); @@ -91,21 +90,14 @@ public class VarnaCommands Color col = sr.getResidueColour(sequence[pdbfnum][s], r, finder); - String newSelcom = (mapping[m].getChain() != " " ? ":" - + mapping[m].getChain() : "") - + "/" - + (pdbfnum + 1) - + ".1" - + ";color[" - + col.getRed() - + "," - + col.getGreen() - + "," + String newSelcom = (mapping[m].getChain() != " " + ? ":" + mapping[m].getChain() + : "") + "/" + (pdbfnum + 1) + ".1" + ";color[" + + col.getRed() + "," + col.getGreen() + "," + col.getBlue() + "]"; - if (command.length() > newSelcom.length() - && command.substring( - command.length() - newSelcom.length()) - .equals(newSelcom)) + if (command.length() > newSelcom.length() && command + .substring(command.length() - newSelcom.length()) + .equals(newSelcom)) { command = VarnaCommands.condenseCommand(command, pos); continue; diff --git a/src/jalview/fts/core/DecimalFormatTableCellRenderer.java b/src/jalview/fts/core/DecimalFormatTableCellRenderer.java index a9e303c..8a8e7ab 100644 --- a/src/jalview/fts/core/DecimalFormatTableCellRenderer.java +++ b/src/jalview/fts/core/DecimalFormatTableCellRenderer.java @@ -30,8 +30,7 @@ import javax.swing.table.DefaultTableCellRenderer; /** * The class to handle the formatting of the double values for JTable cells. */ -public class DecimalFormatTableCellRenderer extends - DefaultTableCellRenderer +public class DecimalFormatTableCellRenderer extends DefaultTableCellRenderer { private DecimalFormat formatter; @@ -47,8 +46,8 @@ public class DecimalFormatTableCellRenderer extends { significantFigureBuilder.append("0"); } - formatter = new DecimalFormat(fractionFormater - + significantFigureBuilder.toString()); + formatter = new DecimalFormat( + fractionFormater + significantFigureBuilder.toString()); } else { @@ -63,9 +62,8 @@ public class DecimalFormatTableCellRenderer extends } @Override - public Component getTableCellRendererComponent(JTable table, - Object value, boolean isSelected, boolean hasFocus, int row, - int column) + public Component getTableCellRendererComponent(JTable table, Object value, + boolean isSelected, boolean hasFocus, int row, int column) { if (value == null) { diff --git a/src/jalview/fts/core/FTSDataColumnPreferences.java b/src/jalview/fts/core/FTSDataColumnPreferences.java index 1a8f398..cb6249e 100644 --- a/src/jalview/fts/core/FTSDataColumnPreferences.java +++ b/src/jalview/fts/core/FTSDataColumnPreferences.java @@ -109,9 +109,9 @@ public class FTSDataColumnPreferences extends JScrollPane switch (source) { case SEARCH_SUMMARY: - data[x++] = new Object[] { - ftsRestClient.getAllDefaultDisplayedFTSDataColumns().contains( - field), field.getName(), field.getGroup() }; + data[x++] = new Object[] { ftsRestClient + .getAllDefaultDisplayedFTSDataColumns().contains(field), + field.getName(), field.getGroup() }; break; case STRUCTURE_CHOOSER: data[x++] = new Object[] { structSummaryColumns.contains(field), @@ -119,9 +119,9 @@ public class FTSDataColumnPreferences extends JScrollPane break; case PREFERENCES: data[x++] = new Object[] { - field.getName(), - ftsRestClient.getAllDefaultDisplayedFTSDataColumns().contains( - field), structSummaryColumns.contains(field) }; + field.getName(), ftsRestClient + .getAllDefaultDisplayedFTSDataColumns().contains(field), + structSummaryColumns.contains(field) }; break; default: break; diff --git a/src/jalview/fts/core/FTSRestClient.java b/src/jalview/fts/core/FTSRestClient.java index 4899e38..076e212 100644 --- a/src/jalview/fts/core/FTSRestClient.java +++ b/src/jalview/fts/core/FTSRestClient.java @@ -82,8 +82,8 @@ public abstract class FTSRestClient implements FTSRestClientI { primaryKeyColumnCode = lineData[1]; } - if (lineData[0] - .equalsIgnoreCase("_data_column.default_response_page_size")) + if (lineData[0].equalsIgnoreCase( + "_data_column.default_response_page_size")) { defaultResponsePageSize = Integer.valueOf(lineData[1]); } @@ -158,8 +158,9 @@ public abstract class FTSRestClient implements FTSRestClientI @Override public String getAltCode() { - return lineData[1].split("\\|").length > 1 ? lineData[1] - .split("\\|")[1] : getCode(); + return lineData[1].split("\\|").length > 1 + ? lineData[1].split("\\|")[1] + : getCode(); } @Override @@ -313,7 +314,8 @@ public abstract class FTSRestClient implements FTSRestClientI } try { - this.primaryKeyColumn = getDataColumnByNameOrCode(primaryKeyColumnCode); + this.primaryKeyColumn = getDataColumnByNameOrCode( + primaryKeyColumnCode); } catch (Exception e) { e.printStackTrace(); @@ -421,8 +423,8 @@ public abstract class FTSRestClient implements FTSRestClientI return column; } } - throw new Exception("Couldn't find data column with name : " - + nameOrCode); + throw new Exception( + "Couldn't find data column with name : " + nameOrCode); } @Override diff --git a/src/jalview/fts/core/FTSRestRequest.java b/src/jalview/fts/core/FTSRestRequest.java index 2e1c632..2d9eeb6 100644 --- a/src/jalview/fts/core/FTSRestRequest.java +++ b/src/jalview/fts/core/FTSRestRequest.java @@ -45,8 +45,8 @@ public class FTSRestRequest private boolean allowEmptySequence; - private boolean allowUnpublishedEntries = Cache.getDefault( - "ALLOW_UNPUBLISHED_PDB_QUERYING", false); + private boolean allowUnpublishedEntries = Cache + .getDefault("ALLOW_UNPUBLISHED_PDB_QUERYING", false); private boolean facet; @@ -117,7 +117,8 @@ public class FTSRestRequest return fieldToSortBy; } - public void setFieldToSortBy(String fieldToSortBy, boolean isSortAscending) + public void setFieldToSortBy(String fieldToSortBy, + boolean isSortAscending) { this.fieldToSortBy = fieldToSortBy; this.isSortAscending = isSortAscending; diff --git a/src/jalview/fts/core/FTSRestResponse.java b/src/jalview/fts/core/FTSRestResponse.java index 5d8fb96..d9658e4 100644 --- a/src/jalview/fts/core/FTSRestResponse.java +++ b/src/jalview/fts/core/FTSRestResponse.java @@ -90,8 +90,8 @@ public class FTSRestResponse public static DefaultTableModel getTableModel(FTSRestRequest request, Collection summariesList) { - final FTSDataColumnI[] cols = request.getWantedFields().toArray( - new FTSDataColumnI[0]); + final FTSDataColumnI[] cols = request.getWantedFields() + .toArray(new FTSDataColumnI[0]); final int colOffset = request.getAssociatedSequence() == null ? 0 : 1; DefaultTableModel tableModel = new DefaultTableModel() { @@ -141,15 +141,15 @@ public class FTSRestResponse { try { - tbl_summary.getColumn(wantedField.getName()).setMinWidth( - wantedField.getMinWidth()); - tbl_summary.getColumn(wantedField.getName()).setMaxWidth( - wantedField.getMaxWidth()); - int prefedWidth = columnPrefs.get(wantedField.getName()) == null ? wantedField - .getPreferredWidth() : columnPrefs.get(wantedField - .getName()); - tbl_summary.getColumn(wantedField.getName()).setPreferredWidth( - prefedWidth); + tbl_summary.getColumn(wantedField.getName()) + .setMinWidth(wantedField.getMinWidth()); + tbl_summary.getColumn(wantedField.getName()) + .setMaxWidth(wantedField.getMaxWidth()); + int prefedWidth = columnPrefs.get(wantedField.getName()) == null + ? wantedField.getPreferredWidth() + : columnPrefs.get(wantedField.getName()); + tbl_summary.getColumn(wantedField.getName()) + .setPreferredWidth(prefedWidth); } catch (Exception e) { e.printStackTrace(); @@ -157,15 +157,16 @@ public class FTSRestResponse if (wantedField.getDataType().getDataTypeClass() == Double.class) { DecimalFormatTableCellRenderer dfr = new DecimalFormatTableCellRenderer( - wantedField.getDataType().isFormtted(), wantedField - .getDataType().getSignificantFigures()); + wantedField.getDataType().isFormtted(), + wantedField.getDataType().getSignificantFigures()); tbl_summary.getColumn(wantedField.getName()).setCellRenderer(dfr); } - else if (wantedField.getDataType().getDataTypeClass() == Integer.class) + else if (wantedField.getDataType() + .getDataTypeClass() == Integer.class) { DecimalFormatTableCellRenderer dfr = new DecimalFormatTableCellRenderer( - wantedField.getDataType().isFormtted(), wantedField - .getDataType().getSignificantFigures()); + wantedField.getDataType().isFormtted(), + wantedField.getDataType().getSignificantFigures()); tbl_summary.getColumn(wantedField.getName()).setCellRenderer(dfr); } } diff --git a/src/jalview/fts/core/GFTSPanel.java b/src/jalview/fts/core/GFTSPanel.java index f1db383..c0d005f 100644 --- a/src/jalview/fts/core/GFTSPanel.java +++ b/src/jalview/fts/core/GFTSPanel.java @@ -112,14 +112,14 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI protected StringBuilder errorWarning = new StringBuilder(); - protected ImageIcon warningImage = new ImageIcon(getClass().getResource( - "/images/warning.gif")); + protected ImageIcon warningImage = new ImageIcon( + getClass().getResource("/images/warning.gif")); - protected ImageIcon loadingImage = new ImageIcon(getClass().getResource( - "/images/loading.gif")); + protected ImageIcon loadingImage = new ImageIcon( + getClass().getResource("/images/loading.gif")); - protected ImageIcon balnkPlaceholderImage = new ImageIcon(getClass() - .getResource("/images/blank_16x16_placeholder.png")); + protected ImageIcon balnkPlaceholderImage = new ImageIcon( + getClass().getResource("/images/blank_16x16_placeholder.png")); protected JLabel lbl_warning = new JLabel(warningImage); @@ -226,8 +226,9 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI e.printStackTrace(); } toolTipText = (toolTipText == null ? null - : (toolTipText.length() > 500 ? JvSwingUtils.wrapTooltip( - true, toolTipText.subSequence(0, 500) + "...") + : (toolTipText.length() > 500 + ? JvSwingUtils.wrapTooltip(true, + toolTipText.subSequence(0, 500) + "...") : JvSwingUtils.wrapTooltip(true, toolTipText))); return toolTipText; @@ -375,8 +376,8 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI } }); btn_next_page.setEnabled(false); - btn_next_page.setToolTipText(MessageManager - .getString("label.next_page_tooltip")); + btn_next_page.setToolTipText( + MessageManager.getString("label.next_page_tooltip")); btn_next_page.setFont(new java.awt.Font("Verdana", 0, 12)); btn_next_page.setText(MessageManager.getString("action.next_page")); btn_next_page.addActionListener(new java.awt.event.ActionListener() @@ -400,8 +401,8 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI }); btn_prev_page.setEnabled(false); - btn_prev_page.setToolTipText(MessageManager - .getString("label.prev_page_tooltip")); + btn_prev_page.setToolTipText( + MessageManager.getString("label.prev_page_tooltip")); btn_prev_page.setFont(new java.awt.Font("Verdana", 0, 12)); btn_prev_page.setText(MessageManager.getString("action.prev_page")); btn_prev_page.addActionListener(new java.awt.event.ActionListener() @@ -467,13 +468,13 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI if (e.getStateChange() == ItemEvent.SELECTED) { String tooltipText; - if ("all".equalsIgnoreCase(getCmbSearchTarget().getSelectedItem() - .toString())) + if ("all".equalsIgnoreCase( + getCmbSearchTarget().getSelectedItem().toString())) { tooltipText = MessageManager.getString("label.search_all"); } - else if ("pdb id".equalsIgnoreCase(getCmbSearchTarget() - .getSelectedItem().toString())) + else if ("pdb id".equalsIgnoreCase( + getCmbSearchTarget().getSelectedItem().toString())) { tooltipText = MessageManager .getString("label.separate_multiple_accession_ids"); @@ -481,42 +482,40 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI else { tooltipText = MessageManager.formatMessage( - "label.separate_multiple_query_values", - new Object[] { getCmbSearchTarget().getSelectedItem() - .toString() }); + "label.separate_multiple_query_values", new Object[] + { getCmbSearchTarget().getSelectedItem().toString() }); } - txt_search.setToolTipText(JvSwingUtils.wrapTooltip(true, - tooltipText)); + txt_search.setToolTipText( + JvSwingUtils.wrapTooltip(true, tooltipText)); searchAction(true); } } }); - txt_search.setFont(new java.awt.Font("Verdana", 0, 12)); txt_search.getEditor().getEditorComponent() .addKeyListener(new KeyAdapter() - { - @Override - public void keyPressed(KeyEvent e) - { - if (e.getKeyCode() == KeyEvent.VK_ENTER) - { - if (getTypedText() == null || getTypedText().isEmpty()) - { - return; - } - String primaryKeyName = getFTSRestClient().getPrimaryKeyColumn() - .getName(); - if (primaryKeyName.equalsIgnoreCase(getCmbSearchTarget() - .getSelectedItem().toString())) - { - transferToSequenceFetcher(getTypedText()); - } - } - } - }); + { + @Override + public void keyPressed(KeyEvent e) + { + if (e.getKeyCode() == KeyEvent.VK_ENTER) + { + if (getTypedText() == null || getTypedText().isEmpty()) + { + return; + } + String primaryKeyName = getFTSRestClient() + .getPrimaryKeyColumn().getName(); + if (primaryKeyName.equalsIgnoreCase(getCmbSearchTarget() + .getSelectedItem().toString())) + { + transferToSequenceFetcher(getTypedText()); + } + } + } + }); final DeferredTextInputListener listener = new DeferredTextInputListener( 1500, new ActionListener() { @@ -579,8 +578,8 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI txt_search.setEnabled(false); cmb_searchTarget.setEnabled(false); previousWantedFields = getFTSRestClient() - .getAllDefaultDisplayedFTSDataColumns().toArray( - new Object[0]); + .getAllDefaultDisplayedFTSDataColumns() + .toArray(new Object[0]); } if (sourceTabbedPane.getTitleAt(index).equals(searchTabTitle)) { @@ -627,8 +626,8 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI mainFrame.setVisible(true); mainFrame.setContentPane(this); mainFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); - mainFrame - .addInternalFrameListener(new javax.swing.event.InternalFrameAdapter() + mainFrame.addInternalFrameListener( + new javax.swing.event.InternalFrameAdapter() { @Override public void internalFrameClosing(InternalFrameEvent e) @@ -769,8 +768,8 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI { lbl_loading.setVisible(false); lbl_blank.setVisible(false); - lbl_warning.setToolTipText(JvSwingUtils.wrapTooltip(true, - errorWarning.toString())); + lbl_warning.setToolTipText( + JvSwingUtils.wrapTooltip(true, errorWarning.toString())); lbl_warning.setVisible(true); } } @@ -918,8 +917,8 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI int totalRows = resultTable.getRowCount(); try { - primaryKeyColIndex = getFTSRestClient().getPrimaryKeyColumIndex( - wantedFields, false); + primaryKeyColIndex = getFTSRestClient() + .getPrimaryKeyColumIndex(wantedFields, false); } catch (Exception e) { e.printStackTrace(); @@ -952,8 +951,8 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI int primaryKeyColIndex = 0; try { - primaryKeyColIndex = getFTSRestClient().getPrimaryKeyColumIndex( - wantedFields, false); + primaryKeyColIndex = getFTSRestClient() + .getPrimaryKeyColumIndex(wantedFields, false); } catch (Exception e) { e.printStackTrace(); @@ -993,5 +992,4 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI mainFrame.setTitle(getFTSFrameTitle()); } - } diff --git a/src/jalview/fts/service/pdb/PDBFTSPanel.java b/src/jalview/fts/service/pdb/PDBFTSPanel.java index b944b9b..2a53ab9 100644 --- a/src/jalview/fts/service/pdb/PDBFTSPanel.java +++ b/src/jalview/fts/service/pdb/PDBFTSPanel.java @@ -39,7 +39,6 @@ public class PDBFTSPanel extends GFTSPanel private static String defaultFTSFrameTitle = MessageManager .getString("label.pdb_sequence_fetcher"); - private static Map tempUserPrefs = new HashMap(); private static final String PDB_FTS_CACHE_KEY = "CACHE.PDB_FTS"; @@ -49,8 +48,8 @@ public class PDBFTSPanel extends GFTSPanel super(); pageLimit = PDBFTSRestClient.getInstance().getDefaultResponsePageSize(); this.seqFetcher = seqFetcher; - this.progressIndicator = (seqFetcher == null) ? null : seqFetcher - .getProgressIndicator(); + this.progressIndicator = (seqFetcher == null) ? null + : seqFetcher.getProgressIndicator(); } @Override @@ -102,9 +101,8 @@ public class PDBFTSPanel extends GFTSPanel if (resultList.getSearchSummary() != null && resultList.getSearchSummary().size() > 0) { - getResultTable().setModel( - FTSRestResponse.getTableModel(request, - resultList.getSearchSummary())); + getResultTable().setModel(FTSRestResponse.getTableModel(request, + resultList.getSearchSummary())); FTSRestResponse.configureTableColumn(getResultTable(), wantedFields, tempUserPrefs); getResultTable().setVisible(true); @@ -114,15 +112,13 @@ public class PDBFTSPanel extends GFTSPanel totalResultSetCount = resultList.getNumberOfItemsFound(); resultSetCount = resultList.getSearchSummary() == null ? 0 : resultList.getSearchSummary().size(); - String result = (resultSetCount > 0) ? MessageManager - .getString("label.results") : MessageManager - .getString("label.result"); + String result = (resultSetCount > 0) + ? MessageManager.getString("label.results") + : MessageManager.getString("label.result"); if (isPaginationEnabled() && resultSetCount > 0) { - updateSearchFrameTitle(defaultFTSFrameTitle - + " - " - + result + updateSearchFrameTitle(defaultFTSFrameTitle + " - " + result + " " + totalNumberformatter.format((Number) (offSet + 1)) + " to " @@ -130,8 +126,8 @@ public class PDBFTSPanel extends GFTSPanel .format((Number) (offSet + resultSetCount)) + " of " + totalNumberformatter - .format((Number) totalResultSetCount) + " " - + " (" + (endTime - startTime) + " milli secs)"); + .format((Number) totalResultSetCount) + + " " + " (" + (endTime - startTime) + " milli secs)"); } else { @@ -174,8 +170,8 @@ public class PDBFTSPanel extends GFTSPanel foundSearchTerms = foundSearchTermsBuilder.toString(); if (foundSearchTerms.contains(" OR ")) { - foundSearchTerms = foundSearchTerms.substring( - targetField.length() + 1, endIndex); + foundSearchTerms = foundSearchTerms + .substring(targetField.length() + 1, endIndex); } } else if (enteredText.contains(":")) @@ -195,8 +191,8 @@ public class PDBFTSPanel extends GFTSPanel int primaryKeyColIndex = 0; try { - primaryKeyColIndex = getFTSRestClient().getPrimaryKeyColumIndex( - wantedFields, false); + primaryKeyColIndex = getFTSRestClient() + .getPrimaryKeyColumIndex(wantedFields, false); } catch (Exception e) { e.printStackTrace(); @@ -205,8 +201,8 @@ public class PDBFTSPanel extends GFTSPanel String searchTerm = getTypedText(); for (int summaryRow : selectedRows) { - String idStr = getResultTable().getValueAt(summaryRow, - primaryKeyColIndex).toString(); + String idStr = getResultTable() + .getValueAt(summaryRow, primaryKeyColIndex).toString(); selectedIdsSet.add(getPDBIdwithSpecifiedChain(idStr, searchTerm)); } @@ -278,12 +274,10 @@ public class PDBFTSPanel extends GFTSPanel return tempUserPrefs; } - @Override public String getCacheKey() { return PDB_FTS_CACHE_KEY; } - } diff --git a/src/jalview/fts/service/pdb/PDBFTSRestClient.java b/src/jalview/fts/service/pdb/PDBFTSRestClient.java index 06bf55b..a483f44 100644 --- a/src/jalview/fts/service/pdb/PDBFTSRestClient.java +++ b/src/jalview/fts/service/pdb/PDBFTSRestClient.java @@ -82,9 +82,10 @@ public class PDBFTSRestClient extends FTSRestClient ClientConfig clientConfig = new DefaultClientConfig(); Client client = Client.create(clientConfig); - String wantedFields = getDataColumnsFieldsAsCommaDelimitedString(pdbRestRequest - .getWantedFields()); - int responseSize = (pdbRestRequest.getResponseSize() == 0) ? getDefaultResponsePageSize() + String wantedFields = getDataColumnsFieldsAsCommaDelimitedString( + pdbRestRequest.getWantedFields()); + int responseSize = (pdbRestRequest.getResponseSize() == 0) + ? getDefaultResponsePageSize() : pdbRestRequest.getResponseSize(); int offSet = pdbRestRequest.getOffSet(); String sortParam = null; @@ -108,11 +109,11 @@ public class PDBFTSRestClient extends FTSRestClient } } - String facetPivot = (pdbRestRequest.getFacetPivot() == null || pdbRestRequest - .getFacetPivot().isEmpty()) ? "" : pdbRestRequest - .getFacetPivot(); - String facetPivotMinCount = String.valueOf(pdbRestRequest - .getFacetPivotMinCount()); + String facetPivot = (pdbRestRequest.getFacetPivot() == null + || pdbRestRequest.getFacetPivot().isEmpty()) ? "" + : pdbRestRequest.getFacetPivot(); + String facetPivotMinCount = String + .valueOf(pdbRestRequest.getFacetPivotMinCount()); String query = pdbRestRequest.getFieldToSearchBy() + pdbRestRequest.getSearchTerm() @@ -143,8 +144,8 @@ public class PDBFTSRestClient extends FTSRestClient .queryParam("q", query).queryParam("sort", sortParam); } // Execute the REST request - ClientResponse clientResponse = webResource.accept( - MediaType.APPLICATION_JSON).get(ClientResponse.class); + ClientResponse clientResponse = webResource + .accept(MediaType.APPLICATION_JSON).get(ClientResponse.class); // Get the JSON string from the response object String responseString = clientResponse.getEntity(String.class); @@ -180,9 +181,8 @@ public class PDBFTSRestClient extends FTSRestClient if (exceptionMsg.contains("SocketException")) { // No internet connection - throw new Exception( - MessageManager - .getString("exception.unable_to_detect_internet_connection")); + throw new Exception(MessageManager.getString( + "exception.unable_to_detect_internet_connection")); } else if (exceptionMsg.contains("UnknownHostException")) { @@ -260,8 +260,8 @@ public class PDBFTSRestClient extends FTSRestClient .parse(pdbJsonResponseString); JSONObject pdbResponse = (JSONObject) jsonObj.get("response"); - String queryTime = ((JSONObject) jsonObj.get("responseHeader")).get( - "QTime").toString(); + String queryTime = ((JSONObject) jsonObj.get("responseHeader")) + .get("QTime").toString(); int numFound = Integer .valueOf(pdbResponse.get("numFound").toString()); if (numFound > 0) @@ -298,8 +298,9 @@ public class PDBFTSRestClient extends FTSRestClient Collection diplayFields = request.getWantedFields(); SequenceI associatedSeq = request.getAssociatedSequence(); int colCounter = 0; - summaryRowData = new Object[(associatedSeq != null) ? diplayFields - .size() + 1 : diplayFields.size()]; + summaryRowData = new Object[(associatedSeq != null) + ? diplayFields.size() + 1 + : diplayFields.size()]; if (associatedSeq != null) { associatedSequence = associatedSeq; @@ -325,10 +326,12 @@ public class PDBFTSRestClient extends FTSRestClient try { summaryRowData[colCounter++] = (field.getDataType() - .getDataTypeClass() == Integer.class) ? Integer - .valueOf(fieldData) : (field.getDataType() - .getDataTypeClass() == Double.class) ? Double - .valueOf(fieldData) : sanitiseData(fieldData); + .getDataTypeClass() == Integer.class) + ? Integer.valueOf(fieldData) + : (field.getDataType() + .getDataTypeClass() == Double.class) + ? Double.valueOf(fieldData) + : sanitiseData(fieldData); } catch (Exception e) { e.printStackTrace(); @@ -418,8 +421,8 @@ public class PDBFTSRestClient extends FTSRestClient || allDefaultDisplayedStructureDataColumns.isEmpty()) { allDefaultDisplayedStructureDataColumns = new ArrayList(); - allDefaultDisplayedStructureDataColumns.addAll(super - .getAllDefaultDisplayedFTSDataColumns()); + allDefaultDisplayedStructureDataColumns + .addAll(super.getAllDefaultDisplayedFTSDataColumns()); } return allDefaultDisplayedStructureDataColumns; } diff --git a/src/jalview/fts/service/uniprot/UniProtFTSRestClient.java b/src/jalview/fts/service/uniprot/UniProtFTSRestClient.java index a23df4c..250fba0 100644 --- a/src/jalview/fts/service/uniprot/UniProtFTSRestClient.java +++ b/src/jalview/fts/service/uniprot/UniProtFTSRestClient.java @@ -57,9 +57,10 @@ public class UniProtFTSRestClient extends FTSRestClient ClientConfig clientConfig = new DefaultClientConfig(); Client client = Client.create(clientConfig); - String wantedFields = getDataColumnsFieldsAsCommaDelimitedString(uniportRestRequest - .getWantedFields()); - int responseSize = (uniportRestRequest.getResponseSize() == 0) ? getDefaultResponsePageSize() + String wantedFields = getDataColumnsFieldsAsCommaDelimitedString( + uniportRestRequest.getWantedFields()); + int responseSize = (uniportRestRequest.getResponseSize() == 0) + ? getDefaultResponsePageSize() : uniportRestRequest.getResponseSize(); int offSet = uniportRestRequest.getOffSet(); @@ -70,11 +71,13 @@ public class UniProtFTSRestClient extends FTSRestClient } else { - query = uniportRestRequest.getFieldToSearchBy().equalsIgnoreCase( - "Search All") ? uniportRestRequest.getSearchTerm() - + " or mnemonic:" + uniportRestRequest.getSearchTerm() - : uniportRestRequest.getFieldToSearchBy() + ":" - + uniportRestRequest.getSearchTerm(); + query = uniportRestRequest.getFieldToSearchBy() + .equalsIgnoreCase("Search All") + ? uniportRestRequest.getSearchTerm() + + " or mnemonic:" + + uniportRestRequest.getSearchTerm() + : uniportRestRequest.getFieldToSearchBy() + ":" + + uniportRestRequest.getSearchTerm(); } WebResource webResource = null; @@ -85,8 +88,8 @@ public class UniProtFTSRestClient extends FTSRestClient .queryParam("offset", String.valueOf(offSet)) .queryParam("sort", "score").queryParam("query", query); // Execute the REST request - ClientResponse clientResponse = webResource.accept( - MediaType.TEXT_PLAIN).get(ClientResponse.class); + ClientResponse clientResponse = webResource + .accept(MediaType.TEXT_PLAIN).get(ClientResponse.class); String uniProtTabDelimittedResponseString = clientResponse .getEntity(String.class); // Make redundant objects eligible for garbage collection to conserve @@ -100,8 +103,8 @@ public class UniProtFTSRestClient extends FTSRestClient throw new Exception(errorMessage); } - int xTotalResults = Integer.valueOf(clientResponse.getHeaders() - .get("X-Total-Results").get(0)); + int xTotalResults = Integer.valueOf( + clientResponse.getHeaders().get("X-Total-Results").get(0)); clientResponse = null; client = null; return parseUniprotResponse(uniProtTabDelimittedResponseString, @@ -112,9 +115,8 @@ public class UniProtFTSRestClient extends FTSRestClient if (exceptionMsg.contains("SocketException")) { // No internet connection - throw new Exception( - MessageManager - .getString("exception.unable_to_detect_internet_connection")); + throw new Exception(MessageManager.getString( + "exception.unable_to_detect_internet_connection")); } else if (exceptionMsg.contains("UnknownHostException")) { @@ -239,10 +241,12 @@ public class UniProtFTSRestClient extends FTSRestClient try { summaryRowData[colCounter++] = (field.getDataType() - .getDataTypeClass() == Integer.class) ? Integer - .valueOf(fieldData.replace(",", "")) - : (field.getDataType().getDataTypeClass() == Double.class) ? Double - .valueOf(fieldData) : fieldData; + .getDataTypeClass() == Integer.class) + ? Integer.valueOf(fieldData.replace(",", "")) + : (field.getDataType() + .getDataTypeClass() == Double.class) + ? Double.valueOf(fieldData) + : fieldData; } catch (Exception e) { e.printStackTrace(); diff --git a/src/jalview/fts/service/uniprot/UniprotFTSPanel.java b/src/jalview/fts/service/uniprot/UniprotFTSPanel.java index ace3600..2dad2f7 100644 --- a/src/jalview/fts/service/uniprot/UniprotFTSPanel.java +++ b/src/jalview/fts/service/uniprot/UniprotFTSPanel.java @@ -40,7 +40,6 @@ public class UniprotFTSPanel extends GFTSPanel private static String defaultFTSFrameTitle = MessageManager .getString("label.uniprot_sequence_fetcher"); - private static Map tempUserPrefs = new HashMap(); private static final String UNIPROT_FTS_CACHE_KEY = "CACHE.UNIPROT_FTS"; @@ -51,8 +50,8 @@ public class UniprotFTSPanel extends GFTSPanel pageLimit = UniProtFTSRestClient.getInstance() .getDefaultResponsePageSize(); this.seqFetcher = seqFetcher; - this.progressIndicator = (seqFetcher == null) ? null : seqFetcher - .getProgressIndicator(); + this.progressIndicator = (seqFetcher == null) ? null + : seqFetcher.getProgressIndicator(); } @Override @@ -103,9 +102,8 @@ public class UniprotFTSPanel extends GFTSPanel if (resultList.getSearchSummary() != null && resultList.getSearchSummary().size() > 0) { - getResultTable().setModel( - FTSRestResponse.getTableModel(request, - resultList.getSearchSummary())); + getResultTable().setModel(FTSRestResponse.getTableModel(request, + resultList.getSearchSummary())); FTSRestResponse.configureTableColumn(getResultTable(), wantedFields, tempUserPrefs); getResultTable().setVisible(true); @@ -115,14 +113,12 @@ public class UniprotFTSPanel extends GFTSPanel totalResultSetCount = resultList.getNumberOfItemsFound(); resultSetCount = resultList.getSearchSummary() == null ? 0 : resultList.getSearchSummary().size(); - String result = (resultSetCount > 0) ? MessageManager - .getString("label.results") : MessageManager - .getString("label.result"); + String result = (resultSetCount > 0) + ? MessageManager.getString("label.results") + : MessageManager.getString("label.result"); if (isPaginationEnabled() && resultSetCount > 0) { - updateSearchFrameTitle(defaultFTSFrameTitle - + " - " - + result + updateSearchFrameTitle(defaultFTSFrameTitle + " - " + result + " " + totalNumberformatter.format((Number) (offSet + 1)) + " to " @@ -130,8 +126,8 @@ public class UniprotFTSPanel extends GFTSPanel .format((Number) (offSet + resultSetCount)) + " of " + totalNumberformatter - .format((Number) totalResultSetCount) + " " - + " (" + (endTime - startTime) + " milli secs)"); + .format((Number) totalResultSetCount) + + " " + " (" + (endTime - startTime) + " milli secs)"); } else { @@ -191,8 +187,8 @@ public class UniprotFTSPanel extends GFTSPanel int primaryKeyColIndex = 0; try { - primaryKeyColIndex = getFTSRestClient().getPrimaryKeyColumIndex( - wantedFields, false); + primaryKeyColIndex = getFTSRestClient() + .getPrimaryKeyColumIndex(wantedFields, false); } catch (Exception e) { e.printStackTrace(); @@ -200,8 +196,8 @@ public class UniprotFTSPanel extends GFTSPanel int[] selectedRows = getResultTable().getSelectedRows(); for (int summaryRow : selectedRows) { - String idStr = getResultTable().getValueAt(summaryRow, - primaryKeyColIndex).toString(); + String idStr = getResultTable() + .getValueAt(summaryRow, primaryKeyColIndex).toString(); selectedIdsSet.add(idStr); } selectedIdsSet.addAll(paginatorCart); diff --git a/src/jalview/gui/AlignExportSettings.java b/src/jalview/gui/AlignExportSettings.java index b9845a4..201570e 100644 --- a/src/jalview/gui/AlignExportSettings.java +++ b/src/jalview/gui/AlignExportSettings.java @@ -34,8 +34,8 @@ import javax.swing.JDialog; import javax.swing.JOptionPane; @SuppressWarnings("serial") -public class AlignExportSettings extends GAlignExportSettings implements - AlignExportSettingI +public class AlignExportSettings extends GAlignExportSettings + implements AlignExportSettingI { boolean cancelled = false; @@ -49,7 +49,8 @@ public class AlignExportSettings extends GAlignExportSettings implements { JOptionPane pane = new JOptionPane(null, JOptionPane.DEFAULT_OPTION, - JvOptionPane.DEFAULT_OPTION, null, new Object[] { this }); + JvOptionPane.DEFAULT_OPTION, null, new Object[] + { this }); dialog = pane.createDialog(Desktop.desktop, MessageManager.getString("label.export_settings")); dialog.addWindowListener(new WindowAdapter() diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index f4dd851..c78abdc 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -234,8 +234,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, * @param height * height of frame. */ - public AlignFrame(AlignmentI al, HiddenColumns hiddenColumns, - int width, int height) + public AlignFrame(AlignmentI al, HiddenColumns hiddenColumns, int width, + int height) { this(al, hiddenColumns, width, height, null); } @@ -251,8 +251,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, * @param sequenceSetId * (may be null) */ - public AlignFrame(AlignmentI al, HiddenColumns hiddenColumns, - int width, int height, String sequenceSetId) + public AlignFrame(AlignmentI al, HiddenColumns hiddenColumns, int width, + int height, String sequenceSetId) { this(al, hiddenColumns, width, height, sequenceSetId, null); } @@ -270,8 +270,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, * @param viewId * (may be null) */ - public AlignFrame(AlignmentI al, HiddenColumns hiddenColumns, - int width, int height, String sequenceSetId, String viewId) + public AlignFrame(AlignmentI al, HiddenColumns hiddenColumns, int width, + int height, String sequenceSetId, String viewId) { setSize(width, height); @@ -510,9 +510,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, public void keyPressed(KeyEvent evt) { if (viewport.cursorMode - && ((evt.getKeyCode() >= KeyEvent.VK_0 && evt.getKeyCode() <= KeyEvent.VK_9) || (evt - .getKeyCode() >= KeyEvent.VK_NUMPAD0 && evt - .getKeyCode() <= KeyEvent.VK_NUMPAD9)) + && ((evt.getKeyCode() >= KeyEvent.VK_0 + && evt.getKeyCode() <= KeyEvent.VK_9) + || (evt.getKeyCode() >= KeyEvent.VK_NUMPAD0 + && evt.getKeyCode() <= KeyEvent.VK_NUMPAD9)) && Character.isDigit(evt.getKeyChar())) { alignPanel.getSeqPanel().numberPressed(evt.getKeyChar()); @@ -552,7 +553,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, case KeyEvent.VK_LEFT: if (evt.isAltDown() || !viewport.cursorMode) { - slideSequences(false, alignPanel.getSeqPanel().getKeyboardNo1()); + slideSequences(false, + alignPanel.getSeqPanel().getKeyboardNo1()); } else { @@ -575,9 +577,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, case KeyEvent.VK_SPACE: if (viewport.cursorMode) { - alignPanel.getSeqPanel().insertGapAtCursor( - evt.isControlDown() || evt.isShiftDown() - || evt.isAltDown()); + alignPanel.getSeqPanel().insertGapAtCursor(evt.isControlDown() + || evt.isShiftDown() || evt.isAltDown()); } break; @@ -600,9 +601,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } else { - alignPanel.getSeqPanel().deleteGapAtCursor( - evt.isControlDown() || evt.isShiftDown() - || evt.isAltDown()); + alignPanel.getSeqPanel().deleteGapAtCursor(evt.isControlDown() + || evt.isShiftDown() || evt.isAltDown()); } break; @@ -649,9 +649,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, case KeyEvent.VK_F2: viewport.cursorMode = !viewport.cursorMode; - statusBar.setText(MessageManager.formatMessage( - "label.keyboard_editing_mode", - new String[] { (viewport.cursorMode ? "on" : "off") })); + statusBar.setText(MessageManager + .formatMessage("label.keyboard_editing_mode", new String[] + { (viewport.cursorMode ? "on" : "off") })); if (viewport.cursorMode) { alignPanel.getSeqPanel().seqCanvas.cursorX = vpRanges @@ -705,16 +705,16 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, case KeyEvent.VK_LEFT: if (evt.isAltDown() || !viewport.cursorMode) { - viewport.firePropertyChange("alignment", null, viewport - .getAlignment().getSequences()); + viewport.firePropertyChange("alignment", null, + viewport.getAlignment().getSequences()); } break; case KeyEvent.VK_RIGHT: if (evt.isAltDown() || !viewport.cursorMode) { - viewport.firePropertyChange("alignment", null, viewport - .getAlignment().getSequences()); + viewport.firePropertyChange("alignment", null, + viewport.getAlignment().getSequences()); } break; } @@ -800,8 +800,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, @Override public void run() { - System.err - .println("Rebuild WS Menu for service change"); + System.err.println( + "Rebuild WS Menu for service change"); BuildWebServiceMenu(); } @@ -845,13 +845,13 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, showReverse.setVisible(nucleotide); showReverseComplement.setVisible(nucleotide); conservationMenuItem.setEnabled(!nucleotide); - modifyConservation.setEnabled(!nucleotide - && conservationMenuItem.isSelected()); + modifyConservation + .setEnabled(!nucleotide && conservationMenuItem.isSelected()); showGroupConservation.setEnabled(!nucleotide); - showComplementMenuItem.setText(nucleotide ? MessageManager - .getString("label.protein") : MessageManager - .getString("label.nucleotide")); + showComplementMenuItem + .setText(nucleotide ? MessageManager.getString("label.protein") + : MessageManager.getString("label.nucleotide")); } /** @@ -1025,7 +1025,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, Desktop.instance.closeAssociatedWindows(); FileLoader loader = new FileLoader(); - DataSourceType protocol = fileName.startsWith("http:") ? DataSourceType.URL + DataSourceType protocol = fileName.startsWith("http:") + ? DataSourceType.URL : DataSourceType.FILE; loader.LoadFile(viewport, fileName, protocol, currentFileFormat); } @@ -1034,7 +1035,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, Rectangle bounds = this.getBounds(); FileLoader loader = new FileLoader(); - DataSourceType protocol = fileName.startsWith("http:") ? DataSourceType.URL + DataSourceType protocol = fileName.startsWith("http:") + ? DataSourceType.URL : DataSourceType.FILE; AlignFrame newframe = loader.LoadFileWaitTillLoaded(fileName, protocol, currentFileFormat); @@ -1066,8 +1068,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, @Override public void addFromText_actionPerformed(ActionEvent e) { - Desktop.instance.inputTextboxMenuItem_actionPerformed(viewport - .getAlignPanel()); + Desktop.instance + .inputTextboxMenuItem_actionPerformed(viewport.getAlignPanel()); } @Override @@ -1099,14 +1101,14 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, @Override public void saveAs_actionPerformed(ActionEvent e) { - String format = currentFileFormat == null ? null : currentFileFormat - .getName(); - JalviewFileChooser chooser = JalviewFileChooser.forWrite( - Cache.getProperty("LAST_DIRECTORY"), format); + String format = currentFileFormat == null ? null + : currentFileFormat.getName(); + JalviewFileChooser chooser = JalviewFileChooser + .forWrite(Cache.getProperty("LAST_DIRECTORY"), format); chooser.setFileView(new JalviewFileView()); - chooser.setDialogTitle(MessageManager - .getString("label.save_alignment_to_file")); + chooser.setDialogTitle( + MessageManager.getString("label.save_alignment_to_file")); chooser.setToolTipText(MessageManager.getString("action.save")); int value = chooser.showSaveDialog(this); @@ -1116,14 +1118,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, currentFileFormat = chooser.getSelectedFormat(); while (currentFileFormat == null) { - JvOptionPane - .showInternalMessageDialog( - Desktop.desktop, - MessageManager - .getString("label.select_file_format_before_saving"), - MessageManager - .getString("label.file_format_not_specified"), - JvOptionPane.WARNING_MESSAGE); + JvOptionPane.showInternalMessageDialog(Desktop.desktop, + MessageManager.getString( + "label.select_file_format_before_saving"), + MessageManager.getString("label.file_format_not_specified"), + JvOptionPane.WARNING_MESSAGE); currentFileFormat = chooser.getSelectedFormat(); value = chooser.showSaveDialog(this); if (value != JalviewFileChooser.APPROVE_OPTION) @@ -1151,15 +1150,15 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, if (shortName.indexOf(java.io.File.separatorChar) > -1) { - shortName = shortName.substring(shortName - .lastIndexOf(java.io.File.separatorChar) + 1); + shortName = shortName.substring( + shortName.lastIndexOf(java.io.File.separatorChar) + 1); } success = new Jalview2XML().saveAlignment(this, file, shortName); statusBar.setText(MessageManager.formatMessage( - "label.successfully_saved_to_file_in_format", new Object[] { - fileName, format })); + "label.successfully_saved_to_file_in_format", new Object[] + { fileName, format })); } else @@ -1172,13 +1171,14 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } FormatAdapter f = new FormatAdapter(alignPanel, exportData.getSettings()); - String output = f.formatSequences( - format, - exportData.getAlignment(), // class cast exceptions will + String output = f.formatSequences(format, exportData.getAlignment(), // class + // cast + // exceptions + // will // occur in the distant future exportData.getOmitHidden(), exportData.getStartEndPostions(), - f.getCacheSuffixDefault(format), viewport.getAlignment() - .getHiddenColumns()); + f.getCacheSuffixDefault(format), + viewport.getAlignment().getHiddenColumns()); if (output == null) { @@ -1194,8 +1194,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, out.close(); this.setTitle(file); statusBar.setText(MessageManager.formatMessage( - "label.successfully_saved_to_file_in_format", - new Object[] { fileName, format.getName() })); + "label.successfully_saved_to_file_in_format", new Object[] + { fileName, format.getName() })); } catch (Exception ex) { success = false; @@ -1207,9 +1207,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, if (!success) { JvOptionPane.showInternalMessageDialog(this, MessageManager - .formatMessage("label.couldnt_save_file", - new Object[] { fileName }), MessageManager - .getString("label.error_saving_file"), + .formatMessage("label.couldnt_save_file", new Object[] + { fileName }), + MessageManager.getString("label.error_saving_file"), JvOptionPane.WARNING_MESSAGE); } @@ -1240,8 +1240,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, @Override protected void outputText_actionPerformed(ActionEvent e) { - FileFormatI fileFormat = FileFormats.getInstance().forName( - e.getActionCommand()); + FileFormatI fileFormat = FileFormats.getInstance() + .forName(e.getActionCommand()); AlignmentExportData exportData = getAlignmentForExport(fileFormat, viewport, null); if (exportData.getSettings().isCancelled()) @@ -1256,15 +1256,15 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, cap.setText(new FormatAdapter(alignPanel, exportData.getSettings()) .formatSequences(format, exportData.getAlignment(), exportData.getOmitHidden(), - exportData - .getStartEndPostions(), viewport - .getAlignment().getHiddenColumns())); - Desktop.addInternalFrame(cap, MessageManager.formatMessage( - "label.alignment_output_command", - new Object[] { e.getActionCommand() }), 600, 500); + exportData.getStartEndPostions(), + viewport.getAlignment().getHiddenColumns())); + Desktop.addInternalFrame(cap, MessageManager + .formatMessage("label.alignment_output_command", new Object[] + { e.getActionCommand() }), 600, 500); } catch (OutOfMemoryError oom) { - new OOMWarning("Outputting alignment as " + e.getActionCommand(), oom); + new OOMWarning("Outputting alignment as " + e.getActionCommand(), + oom); cap.dispose(); } @@ -1408,10 +1408,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, JalviewFileChooser chooser = new JalviewFileChooser( jalview.bin.Cache.getProperty("LAST_DIRECTORY")); chooser.setFileView(new JalviewFileView()); - chooser.setDialogTitle(MessageManager - .getString("label.load_jalview_annotations")); - chooser.setToolTipText(MessageManager - .getString("label.load_jalview_annotations")); + chooser.setDialogTitle( + MessageManager.getString("label.load_jalview_annotations")); + chooser.setToolTipText( + MessageManager.getString("label.load_jalview_annotations")); int value = chooser.showOpenDialog(null); @@ -1510,9 +1510,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { undoMenuItem.setEnabled(true); CommandI command = viewport.getHistoryList().peek(); - undoMenuItem.setText(MessageManager.formatMessage( - "label.undo_command", - new Object[] { command.getDescription() })); + undoMenuItem.setText(MessageManager + .formatMessage("label.undo_command", new Object[] + { command.getDescription() })); } else { @@ -1525,9 +1525,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, redoMenuItem.setEnabled(true); CommandI command = viewport.getRedoList().peek(); - redoMenuItem.setText(MessageManager.formatMessage( - "label.redo_command", - new Object[] { command.getDescription() })); + redoMenuItem.setText(MessageManager + .formatMessage("label.redo_command", new Object[] + { command.getDescription() })); } else { @@ -1599,8 +1599,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { if (originalSource != viewport) { - Cache.log - .warn("Implementation worry: mismatch of viewport origin for undo"); + Cache.log.warn( + "Implementation worry: mismatch of viewport origin for undo"); } originalSource.updateHiddenColumns(); // originalSource.hasHiddenColumns = (viewport.getColumnSelection() != @@ -1608,8 +1608,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, // && viewport.getColumnSelection().getHiddenColumns() != null && // viewport.getColumnSelection() // .getHiddenColumns().size() > 0); - originalSource.firePropertyChange("alignment", null, originalSource - .getAlignment().getSequences()); + originalSource.firePropertyChange("alignment", null, + originalSource.getAlignment().getSequences()); } } @@ -1639,8 +1639,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, if (originalSource != viewport) { - Cache.log - .warn("Implementation worry: mismatch of viewport origin for redo"); + Cache.log.warn( + "Implementation worry: mismatch of viewport origin for redo"); } originalSource.updateHiddenColumns(); // originalSource.hasHiddenColumns = (viewport.getColumnSelection() != @@ -1648,8 +1648,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, // && viewport.getColumnSelection().getHiddenColumns() != null && // viewport.getColumnSelection() // .getHiddenColumns().size() > 0); - originalSource.firePropertyChange("alignment", null, originalSource - .getAlignment().getSequences()); + originalSource.firePropertyChange("alignment", null, + originalSource.getAlignment().getSequences()); } } @@ -1664,8 +1664,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { EditCommand editCommand = (EditCommand) command; al = editCommand.getAlignment(); - List comps = PaintRefresher.components.get(viewport - .getSequenceSetId()); + List comps = PaintRefresher.components + .get(viewport.getSequenceSetId()); for (Component comp : comps) { @@ -1719,15 +1719,15 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, List sg = new ArrayList<>(); if (viewport.cursorMode) { - sg.add(viewport.getAlignment().getSequenceAt( - alignPanel.getSeqPanel().seqCanvas.cursorY)); + sg.add(viewport.getAlignment() + .getSequenceAt(alignPanel.getSeqPanel().seqCanvas.cursorY)); } else if (viewport.getSelectionGroup() != null && viewport.getSelectionGroup().getSize() != viewport .getAlignment().getHeight()) { - sg = viewport.getSelectionGroup().getSequences( - viewport.getHiddenRepSequences()); + sg = viewport.getSelectionGroup() + .getSequences(viewport.getHiddenRepSequences()); } if (sg.size() < 1) @@ -1756,13 +1756,13 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, SlideSequencesCommand ssc; if (right) { - ssc = new SlideSequencesCommand("Slide Sequences", seqs2, seqs1, - size, viewport.getGapCharacter()); + ssc = new SlideSequencesCommand("Slide Sequences", seqs2, seqs1, size, + viewport.getGapCharacter()); } else { - ssc = new SlideSequencesCommand("Slide Sequences", seqs1, seqs2, - size, viewport.getGapCharacter()); + ssc = new SlideSequencesCommand("Slide Sequences", seqs1, seqs2, size, + viewport.getGapCharacter()); } int groupAdjustment = 0; @@ -1807,9 +1807,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, if (!inSplitFrame && historyList != null && historyList.size() > 0 && historyList.peek() instanceof SlideSequencesCommand) { - appendHistoryItem = ssc - .appendSlideCommand((SlideSequencesCommand) historyList - .peek()); + appendHistoryItem = ssc.appendSlideCommand( + (SlideSequencesCommand) historyList.peek()); } if (!appendHistoryItem) @@ -1857,8 +1856,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, Toolkit.getDefaultToolkit().getSystemClipboard() .setContents(new StringSelection(""), null); - Toolkit.getDefaultToolkit().getSystemClipboard() - .setContents(ss, Desktop.instance); + Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss, + Desktop.instance); } catch (OutOfMemoryError er) { new OOMWarning("copying region", er); @@ -1877,8 +1876,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { if (region[0] >= hiddenOffset && region[1] <= hiddenCutoff) { - hiddenColumns.add(new int[] { region[0] - hiddenOffset, - region[1] - hiddenOffset }); + hiddenColumns + .add(new int[] + { region[0] - hiddenOffset, region[1] - hiddenOffset }); } } } @@ -1886,8 +1886,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, Desktop.jalviewClipboard = new Object[] { seqs, viewport.getAlignment().getDataset(), hiddenColumns }; statusBar.setText(MessageManager.formatMessage( - "label.copied_sequences_to_clipboard", new Object[] { Integer - .valueOf(seqs.length).toString() })); + "label.copied_sequences_to_clipboard", new Object[] + { Integer.valueOf(seqs.length).toString() })); } /** @@ -2037,8 +2037,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { // copy and derive new dataset sequence sequences[i] = sequences[i].deriveSequence(); - alignment.getDataset().addSequence( - sequences[i].getDatasetSequence()); + alignment.getDataset() + .addSequence(sequences[i].getDatasetSequence()); // TODO: avoid creation of duplicate dataset sequences with a // 'contains' method using SequenceI.equals()/SequenceI.contains() } @@ -2068,18 +2068,20 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, annotationAdded = true; if (alann[i].sequenceRef == null && !alann[i].autoCalculated) { - AlignmentAnnotation newann = new AlignmentAnnotation(alann[i]); + AlignmentAnnotation newann = new AlignmentAnnotation( + alann[i]); if (newann.graphGroup > -1) { if (newGraphGroups.size() <= newann.graphGroup || newGraphGroups.get(newann.graphGroup) == null) { - for (int q = newGraphGroups.size(); q <= newann.graphGroup; q++) + for (int q = newGraphGroups + .size(); q <= newann.graphGroup; q++) { newGraphGroups.add(q, null); } - newGraphGroups.set(newann.graphGroup, new Integer( - ++fgroup)); + newGraphGroups.set(newann.graphGroup, + new Integer(++fgroup)); } newann.graphGroup = newGraphGroups.get(newann.graphGroup) .intValue(); @@ -2098,7 +2100,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, // addHistoryItem(new EditCommand( MessageManager.getString("label.add_sequences"), - Action.PASTE, sequences, 0, alignment.getWidth(), alignment)); + Action.PASTE, sequences, 0, alignment.getWidth(), + alignment)); } // Add any annotations attached to sequences for (int i = 0; i < sequences.length; i++) @@ -2119,12 +2122,13 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, if (newGraphGroups.size() <= newann.graphGroup || newGraphGroups.get(newann.graphGroup) == null) { - for (int q = newGraphGroups.size(); q <= newann.graphGroup; q++) + for (int q = newGraphGroups + .size(); q <= newann.graphGroup; q++) { newGraphGroups.add(q, null); } - newGraphGroups.set(newann.graphGroup, new Integer( - ++fgroup)); + newGraphGroups.set(newann.graphGroup, + new Integer(++fgroup)); } newann.graphGroup = newGraphGroups.get(newann.graphGroup) .intValue(); @@ -2134,8 +2138,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, // was // duplicated // earlier - alignment - .setAnnotationIndex(sequences[i].getAnnotation()[a], a); + alignment.setAnnotationIndex(sequences[i].getAnnotation()[a], + a); } } } @@ -2215,9 +2219,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, // >>>This is a fix for the moment, until a better solution is // found!!<<< af.alignPanel.getSeqPanel().seqCanvas.getFeatureRenderer() - .transferSettings( - alignPanel.getSeqPanel().seqCanvas - .getFeatureRenderer()); + .transferSettings(alignPanel.getSeqPanel().seqCanvas + .getFeatureRenderer()); // TODO: maintain provenance of an alignment, rather than just make the // title a concatenation of operations. @@ -2256,8 +2259,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { try { - AlignmentI alignment = AlignmentUtils.expandContext(getViewport() - .getAlignment(), -1); + AlignmentI alignment = AlignmentUtils + .expandContext(getViewport().getAlignment(), -1); AlignFrame af = new AlignFrame(alignment, DEFAULT_WIDTH, DEFAULT_HEIGHT); String newtitle = new String("Flanking alignment"); @@ -2275,9 +2278,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, // >>>This is a fix for the moment, until a better solution is // found!!<<< af.alignPanel.getSeqPanel().seqCanvas.getFeatureRenderer() - .transferSettings( - alignPanel.getSeqPanel().seqCanvas - .getFeatureRenderer()); + .transferSettings(alignPanel.getSeqPanel().seqCanvas + .getFeatureRenderer()); // TODO: maintain provenance of an alignment, rather than just make the // title a concatenation of operations. @@ -2339,8 +2341,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, */ if (sg.getSize() == viewport.getAlignment().getHeight()) { - boolean isEntireAlignWidth = (((sg.getEndRes() - sg.getStartRes()) + 1) == viewport - .getAlignment().getWidth()) ? true : false; + boolean isEntireAlignWidth = (((sg.getEndRes() - sg.getStartRes()) + + 1) == viewport.getAlignment().getWidth()) ? true : false; if (isEntireAlignWidth) { int confirm = JvOptionPane.showConfirmDialog(this, @@ -2369,8 +2371,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, viewport.sendSelection(); viewport.getAlignment().deleteGroup(sg); - viewport.firePropertyChange("alignment", null, viewport.getAlignment() - .getSequences()); + viewport.firePropertyChange("alignment", null, + viewport.getAlignment().getSequences()); if (viewport.getAlignment().getHeight() < 1) { try @@ -2534,8 +2536,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, SequenceI[] seqs; if (viewport.getSelectionGroup() != null) { - seqs = viewport.getSelectionGroup().getSequencesAsArray( - viewport.getHiddenRepSequences()); + seqs = viewport.getSelectionGroup() + .getSequencesAsArray(viewport.getHiddenRepSequences()); } else { @@ -2555,10 +2557,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, column, viewport.getAlignment()); } - statusBar.setText(MessageManager.formatMessage( - "label.removed_columns", - new String[] { Integer.valueOf(trimRegion.getSize()) - .toString() })); + statusBar.setText(MessageManager + .formatMessage("label.removed_columns", new String[] + { Integer.valueOf(trimRegion.getSize()).toString() })); addHistoryItem(trimRegion); @@ -2571,8 +2572,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } } - viewport.firePropertyChange("alignment", null, viewport - .getAlignment().getSequences()); + viewport.firePropertyChange("alignment", null, + viewport.getAlignment().getSequences()); } } @@ -2590,8 +2591,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, SequenceI[] seqs; if (viewport.getSelectionGroup() != null) { - seqs = viewport.getSelectionGroup().getSequencesAsArray( - viewport.getHiddenRepSequences()); + seqs = viewport.getSelectionGroup() + .getSequencesAsArray(viewport.getHiddenRepSequences()); start = viewport.getSelectionGroup().getStartRes(); end = viewport.getSelectionGroup().getEndRes(); } @@ -2606,10 +2607,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, addHistoryItem(removeGapCols); - statusBar.setText(MessageManager.formatMessage( - "label.removed_empty_columns", - new Object[] { Integer.valueOf(removeGapCols.getSize()) - .toString() })); + statusBar.setText(MessageManager + .formatMessage("label.removed_empty_columns", new Object[] + { Integer.valueOf(removeGapCols.getSize()).toString() })); // This is to maintain viewport position on first residue // of first sequence @@ -2621,8 +2621,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, // if (viewport.hasHiddenColumns) // viewport.getColumnSelection().compensateForEdits(shifts); vpRanges.setStartRes(seq.findIndex(startRes) - 1); - viewport.firePropertyChange("alignment", null, viewport.getAlignment() - .getSequences()); + viewport.firePropertyChange("alignment", null, + viewport.getAlignment().getSequences()); } @@ -2640,8 +2640,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, SequenceI[] seqs; if (viewport.getSelectionGroup() != null) { - seqs = viewport.getSelectionGroup().getSequencesAsArray( - viewport.getHiddenRepSequences()); + seqs = viewport.getSelectionGroup() + .getSequencesAsArray(viewport.getHiddenRepSequences()); start = viewport.getSelectionGroup().getStartRes(); end = viewport.getSelectionGroup().getEndRes(); } @@ -2660,8 +2660,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, vpRanges.setStartRes(seq.findIndex(startRes) - 1); - viewport.firePropertyChange("alignment", null, viewport.getAlignment() - .getSequences()); + viewport.firePropertyChange("alignment", null, + viewport.getAlignment().getSequences()); } @@ -2675,8 +2675,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, public void padGapsMenuitem_actionPerformed(ActionEvent e) { viewport.setPadGaps(padGapsMenuitem.isSelected()); - viewport.firePropertyChange("alignment", null, viewport.getAlignment() - .getSequences()); + viewport.firePropertyChange("alignment", null, + viewport.getAlignment().getSequences()); } /** @@ -2790,8 +2790,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } String newViewName = viewTitle + ((addFirstIndex) ? " " + index : ""); - List comps = PaintRefresher.components.get(viewport - .getSequenceSetId()); + List comps = PaintRefresher.components + .get(viewport.getSequenceSetId()); List existingNames = getExistingViewNames(comps); @@ -2971,9 +2971,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, // Hide everything by the current selection - this is a hack - we do the // invert and then hide // first check that there will be visible columns after the invert. - if (viewport.hasSelectedColumns() - || (sg != null && sg.getSize() > 0 && sg.getStartRes() <= sg - .getEndRes())) + if (viewport.hasSelectedColumns() || (sg != null && sg.getSize() > 0 + && sg.getStartRes() <= sg.getEndRes())) { // now invert the sequence set, if required - empty selection implies // that no hiding is required. @@ -3229,14 +3228,15 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, editPane.setEditable(false); StringBuffer contents = new AlignmentProperties(viewport.getAlignment()) .formatAsHtml(); - editPane.setText(MessageManager.formatMessage("label.html_content", - new Object[] { contents.toString() })); + editPane.setText( + MessageManager.formatMessage("label.html_content", new Object[] + { contents.toString() })); JInternalFrame frame = new JInternalFrame(); frame.getContentPane().add(new JScrollPane(editPane)); - Desktop.addInternalFrame(frame, MessageManager.formatMessage( - "label.alignment_properties", new Object[] { getTitle() }), - 500, 400); + Desktop.addInternalFrame(frame, MessageManager + .formatMessage("label.alignment_properties", new Object[] + { getTitle() }), 500, 400); } /** @@ -3256,21 +3256,23 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, JInternalFrame frame = new JInternalFrame(); final OverviewPanel overview = new OverviewPanel(alignPanel); frame.setContentPane(overview); - Desktop.addInternalFrame(frame, MessageManager.formatMessage( - "label.overview_params", new Object[] { this.getTitle() }), - true, frame.getWidth(), frame.getHeight(), true, true); + Desktop.addInternalFrame(frame, MessageManager + .formatMessage("label.overview_params", new Object[] + { this.getTitle() }), true, frame.getWidth(), frame.getHeight(), + true, true); frame.pack(); frame.setLayer(JLayeredPane.PALETTE_LAYER); - frame.addInternalFrameListener(new javax.swing.event.InternalFrameAdapter() - { - @Override - public void internalFrameClosed( - javax.swing.event.InternalFrameEvent evt) - { - overview.dispose(); - alignPanel.setOverviewPanel(null); - }; - }); + frame.addInternalFrameListener( + new javax.swing.event.InternalFrameAdapter() + { + @Override + public void internalFrameClosed( + javax.swing.event.InternalFrameEvent evt) + { + overview.dispose(); + alignPanel.setOverviewPanel(null); + }; + }); alignPanel.setOverviewPanel(overview); } @@ -3361,8 +3363,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, @Override protected void modifyPID_actionPerformed() { - SliderPanel.setPIDSliderSource(alignPanel, - viewport.getResidueShading(), alignPanel.getViewName()); + SliderPanel.setPIDSliderSource(alignPanel, viewport.getResidueShading(), + alignPanel.getViewName()); SliderPanel.showPIDSlider(); } @@ -3433,8 +3435,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, public void sortPairwiseMenuItem_actionPerformed(ActionEvent e) { SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray(); - AlignmentSorter.sortByPID(viewport.getAlignment(), viewport - .getAlignment().getSequenceAt(0)); + AlignmentSorter.sortByPID(viewport.getAlignment(), + viewport.getAlignment().getSequenceAt(0)); addHistoryItem(new OrderCommand("Pairwise Sort", oldOrder, viewport.getAlignment())); alignPanel.paintAlignment(true); @@ -3451,8 +3453,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray(); AlignmentSorter.sortByID(viewport.getAlignment()); - addHistoryItem(new OrderCommand("ID Sort", oldOrder, - viewport.getAlignment())); + addHistoryItem( + new OrderCommand("ID Sort", oldOrder, viewport.getAlignment())); alignPanel.paintAlignment(true); } @@ -3513,8 +3515,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, if ((viewport.getSelectionGroup() == null) || (viewport.getSelectionGroup().getSize() < 2)) { - JvOptionPane.showInternalMessageDialog(this, MessageManager - .getString("label.you_must_select_least_two_sequences"), + JvOptionPane.showInternalMessageDialog(this, + MessageManager.getString( + "label.you_must_select_least_two_sequences"), MessageManager.getString("label.invalid_selection"), JvOptionPane.WARNING_MESSAGE); } @@ -3534,8 +3537,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, viewport.autoCalculateConsensus = autoCalculate.isSelected(); if (viewport.autoCalculateConsensus) { - viewport.firePropertyChange("alignment", null, viewport - .getAlignment().getSequences()); + viewport.firePropertyChange("alignment", null, + viewport.getAlignment().getSequences()); } } @@ -3561,7 +3564,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, * @param options * parameters for the distance or similarity calculation */ - void newTreePanel(String type, String modelName, SimilarityParamsI options) + void newTreePanel(String type, String modelName, + SimilarityParamsI options) { String frameTitle = ""; TreePanel tp; @@ -3577,14 +3581,12 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { if (_s.getLength() < sg.getEndRes()) { - JvOptionPane - .showMessageDialog( - Desktop.desktop, - MessageManager - .getString("label.selected_region_to_tree_may_only_contain_residues_or_gaps"), - MessageManager - .getString("label.sequences_selection_not_aligned"), - JvOptionPane.WARNING_MESSAGE); + JvOptionPane.showMessageDialog(Desktop.desktop, + MessageManager.getString( + "label.selected_region_to_tree_may_only_contain_residues_or_gaps"), + MessageManager.getString( + "label.sequences_selection_not_aligned"), + JvOptionPane.WARNING_MESSAGE); return; } @@ -3625,8 +3627,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, public void addSortByOrderMenuItem(String title, final AlignmentOrder order) { - final JMenuItem item = new JMenuItem(MessageManager.formatMessage( - "action.by_title_param", new Object[] { title })); + final JMenuItem item = new JMenuItem(MessageManager + .formatMessage("action.by_title_param", new Object[] + { title })); sort.add(item); item.addActionListener(new java.awt.event.ActionListener() { @@ -3639,8 +3642,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, // pointers AlignmentSorter.sortBy(viewport.getAlignment(), order); - addHistoryItem(new OrderCommand(order.getName(), oldOrder, viewport - .getAlignment())); + addHistoryItem(new OrderCommand(order.getName(), oldOrder, + viewport.getAlignment())); alignPanel.paintAlignment(true); } @@ -3696,7 +3699,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, return; } - if (viewport.getAlignment().getAlignmentAnnotation().hashCode() != _annotationScoreVectorHash) + if (viewport.getAlignment().getAlignmentAnnotation() + .hashCode() != _annotationScoreVectorHash) { sortByAnnotScore.removeAll(); // almost certainly a quicker way to do this - but we keep it simple @@ -3739,8 +3743,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { sortByTreeMenu.removeAll(); - List comps = PaintRefresher.components.get(viewport - .getSequenceSetId()); + List comps = PaintRefresher.components + .get(viewport.getSequenceSetId()); List treePanels = new ArrayList<>(); for (Component comp : comps) { @@ -3879,9 +3883,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, JalviewFileChooser chooser = new JalviewFileChooser( jalview.bin.Cache.getProperty("LAST_DIRECTORY")); chooser.setFileView(new JalviewFileView()); - chooser.setDialogTitle(MessageManager - .getString("label.select_newick_like_tree_file")); - chooser.setToolTipText(MessageManager.getString("label.load_tree_file")); + chooser.setDialogTitle( + MessageManager.getString("label.select_newick_like_tree_file")); + chooser.setToolTipText( + MessageManager.getString("label.load_tree_file")); int value = chooser.showOpenDialog(null); @@ -3896,20 +3901,17 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, viewport.setCurrentTree(showNewickTree(fin, filePath).getTree()); } catch (Exception ex) { - JvOptionPane - .showMessageDialog( - Desktop.desktop, - ex.getMessage(), - MessageManager - .getString("label.problem_reading_tree_file"), - JvOptionPane.WARNING_MESSAGE); + JvOptionPane.showMessageDialog(Desktop.desktop, ex.getMessage(), + MessageManager.getString("label.problem_reading_tree_file"), + JvOptionPane.WARNING_MESSAGE); ex.printStackTrace(); } if (fin != null && fin.hasWarningMessage()) { - JvOptionPane.showMessageDialog(Desktop.desktop, fin - .getWarningMessage(), MessageManager - .getString("label.possible_problem_with_tree_file"), + JvOptionPane.showMessageDialog(Desktop.desktop, + fin.getWarningMessage(), + MessageManager + .getString("label.possible_problem_with_tree_file"), JvOptionPane.WARNING_MESSAGE); } } @@ -4139,9 +4141,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } } catch (Exception e) { - Cache.log - .debug("Exception during web service menu building process.", - e); + Cache.log.debug( + "Exception during web service menu building process.", + e); } } }); @@ -4226,7 +4228,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, @Override public void actionPerformed(ActionEvent e) { - showProductsFor(af.viewport.getSequenceSelection(), dna, source); + showProductsFor(af.viewport.getSequenceSelection(), dna, + source); } }); showProducts.add(xtype); @@ -4235,9 +4238,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, showProducts.setEnabled(showp); } catch (Exception e) { - Cache.log - .warn("canShowProducts threw an exception - please report to help@jalview.org", - e); + Cache.log.warn( + "canShowProducts threw an exception - please report to help@jalview.org", + e); return false; } return showp; @@ -4254,8 +4257,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, * @param source * the database to show cross-references for */ - protected void showProductsFor(final SequenceI[] sel, - final boolean _odna, final String source) + protected void showProductsFor(final SequenceI[] sel, final boolean _odna, + final String source) { new Thread(CrossRefAction.showProductsFor(sel, _odna, source, this)) .start(); @@ -4278,8 +4281,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { jalview.bin.Cache.log.error( "Exception during translation. Please report this !", ex); - final String msg = MessageManager - .getString("label.error_when_translating_sequences_submit_bug_report"); + final String msg = MessageManager.getString( + "label.error_when_translating_sequences_submit_bug_report"); final String errorTitle = MessageManager .getString("label.implementation_error") + MessageManager.getString("label.translation_failed"); @@ -4289,8 +4292,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } if (al == null || al.getHeight() == 0) { - final String msg = MessageManager - .getString("label.select_at_least_three_bases_in_at_least_one_sequence_to_cDNA_translation"); + final String msg = MessageManager.getString( + "label.select_at_least_three_bases_in_at_least_one_sequence_to_cDNA_translation"); final String errorTitle = MessageManager .getString("label.translation_failed"); JvOptionPane.showMessageDialog(Desktop.desktop, msg, errorTitle, @@ -4300,9 +4303,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { AlignFrame af = new AlignFrame(al, DEFAULT_WIDTH, DEFAULT_HEIGHT); af.setFileFormat(this.currentFileFormat); - final String newTitle = MessageManager.formatMessage( - "label.translation_of_params", - new Object[] { this.getTitle() }); + final String newTitle = MessageManager + .formatMessage("label.translation_of_params", new Object[] + { this.getTitle() }); af.setTitle(newTitle); if (Cache.getDefault(Preferences.ENABLE_SPLIT_FRAME, true)) { @@ -4400,8 +4403,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { // check to see if any of these files have names matching sequences in // the alignment - SequenceIdMatcher idm = new SequenceIdMatcher(viewport - .getAlignment().getSequencesArray()); + SequenceIdMatcher idm = new SequenceIdMatcher( + viewport.getAlignment().getSequencesArray()); /** * Object[] { String,SequenceI} */ @@ -4463,20 +4466,15 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, if (filesmatched.size() > 0) { if (Cache.getDefault("AUTOASSOCIATE_PDBANDSEQS", false) - || JvOptionPane - .showConfirmDialog( - this, - MessageManager - .formatMessage( - "label.automatically_associate_structure_files_with_sequences_same_name", - new Object[] { Integer - .valueOf( - filesmatched - .size()) - .toString() }), - MessageManager - .getString("label.automatically_associate_structure_files_by_name"), - JvOptionPane.YES_NO_OPTION) == JvOptionPane.YES_OPTION) + || JvOptionPane.showConfirmDialog(this, + MessageManager.formatMessage( + "label.automatically_associate_structure_files_with_sequences_same_name", + new Object[] + { Integer.valueOf(filesmatched.size()) + .toString() }), + MessageManager.getString( + "label.automatically_associate_structure_files_by_name"), + JvOptionPane.YES_NO_OPTION) == JvOptionPane.YES_OPTION) { for (Object[] fm : filesmatched) @@ -4492,9 +4490,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, Desktop.instance); if (pe != null) { - System.err.println("Associated file : " - + ((String) fm[0]) + " with " - + toassoc.getDisplayId(true)); + System.err.println("Associated file : " + ((String) fm[0]) + + " with " + toassoc.getDisplayId(true)); assocfiles++; } } @@ -4504,24 +4501,18 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } if (filesnotmatched.size() > 0) { - if (assocfiles > 0 - && (Cache.getDefault( - "AUTOASSOCIATE_PDBANDSEQS_IGNOREOTHERS", false) || JvOptionPane - .showConfirmDialog( - this, - "" - + MessageManager - .formatMessage( - "label.ignore_unmatched_dropped_files_info", - new Object[] { Integer - .valueOf( - filesnotmatched - .size()) - .toString() }) - + "", - MessageManager - .getString("label.ignore_unmatched_dropped_files"), - JvOptionPane.YES_NO_OPTION) == JvOptionPane.YES_OPTION)) + if (assocfiles > 0 && (Cache.getDefault( + "AUTOASSOCIATE_PDBANDSEQS_IGNOREOTHERS", false) + || JvOptionPane.showConfirmDialog(this, + "" + MessageManager.formatMessage( + "label.ignore_unmatched_dropped_files_info", + new Object[] + { Integer.valueOf(filesnotmatched.size()) + .toString() }) + + "", + MessageManager.getString( + "label.ignore_unmatched_dropped_files"), + JvOptionPane.YES_NO_OPTION) == JvOptionPane.YES_OPTION)) { return; } @@ -4562,9 +4553,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, // if the file isn't identified, or not positively identified as some // other filetype (PFAM is default unidentified alignment file type) then // try to parse as annotation. - boolean isAnnotation = (format == null || FileFormat.Pfam - .equals(format)) ? new AnnotationFile() - .annotateAlignmentView(viewport, file, sourceType) : false; + boolean isAnnotation = (format == null + || FileFormat.Pfam.equals(format)) + ? new AnnotationFile().annotateAlignmentView(viewport, + file, sourceType) + : false; if (!isAnnotation) { @@ -4578,25 +4571,24 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, if (tcf.annotateAlignment(viewport.getAlignment(), true)) { buildColourMenu(); - changeColour(new TCoffeeColourScheme(viewport.getAlignment())); + changeColour( + new TCoffeeColourScheme(viewport.getAlignment())); isAnnotation = true; - statusBar - .setText(MessageManager - .getString("label.successfully_pasted_tcoffee_scores_to_alignment")); + statusBar.setText(MessageManager.getString( + "label.successfully_pasted_tcoffee_scores_to_alignment")); } else { // some problem - if no warning its probable that the ID matching // process didn't work - JvOptionPane - .showMessageDialog( - Desktop.desktop, - tcf.getWarningMessage() == null ? MessageManager - .getString("label.check_file_matches_sequence_ids_alignment") - : tcf.getWarningMessage(), - MessageManager - .getString("label.problem_reading_tcoffee_score_file"), - JvOptionPane.WARNING_MESSAGE); + JvOptionPane.showMessageDialog(Desktop.desktop, + tcf.getWarningMessage() == null + ? MessageManager.getString( + "label.check_file_matches_sequence_ids_alignment") + : tcf.getWarningMessage(), + MessageManager.getString( + "label.problem_reading_tcoffee_score_file"), + JvOptionPane.WARNING_MESSAGE); } } else @@ -4605,9 +4597,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } } catch (Exception x) { - Cache.log - .debug("Exception when processing data source as T-COFFEE score file", - x); + Cache.log.debug( + "Exception when processing data source as T-COFFEE score file", + x); tcf = null; } if (tcf == null) @@ -4621,14 +4613,13 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } if (FileFormat.ScoreMatrix == format) { - ScoreMatrixFile sm = new ScoreMatrixFile(new FileParse(file, - sourceType)); + ScoreMatrixFile sm = new ScoreMatrixFile( + new FileParse(file, sourceType)); sm.parse(); // todo: i18n this message - statusBar - .setText(MessageManager.formatMessage( - "label.successfully_loaded_matrix", - sm.getMatrixName())); + statusBar.setText(MessageManager.formatMessage( + "label.successfully_loaded_matrix", + sm.getMatrixName())); } else if (FileFormat.Jnet.equals(format)) { @@ -4678,11 +4669,16 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } new OOMWarning( "loading data " - + (sourceType != null ? (sourceType == DataSourceType.PASTE ? "from clipboard." - : "using " + sourceType + " from " + file) + + (sourceType != null + ? (sourceType == DataSourceType.PASTE + ? "from clipboard." + : "using " + sourceType + " from " + + file) : ".") - + (format != null ? "(parsing as '" + format - + "' file)" : ""), oom, Desktop.desktop); + + (format != null + ? "(parsing as '" + format + "' file)" + : ""), + oom, Desktop.desktop); } } @@ -4733,7 +4729,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, final AlignViewportI peer = viewport.getCodingComplement(); if (peer != null) { - AlignFrame linkedAlignFrame = ((AlignViewport) peer).getAlignPanel().alignFrame; + AlignFrame linkedAlignFrame = ((AlignViewport) peer) + .getAlignPanel().alignFrame; if (linkedAlignFrame.tabbedPane.getTabCount() > index) { linkedAlignFrame.tabbedPane.setSelectedIndex(index); @@ -4848,14 +4845,14 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, // here final JMenu rfetch = new JMenu( MessageManager.getString("action.fetch_db_references")); - rfetch.setToolTipText(MessageManager - .getString("label.retrieve_parse_sequence_database_records_alignment_or_selected_sequences")); + rfetch.setToolTipText(MessageManager.getString( + "label.retrieve_parse_sequence_database_records_alignment_or_selected_sequences")); webService.add(rfetch); final JCheckBoxMenuItem trimrs = new JCheckBoxMenuItem( MessageManager.getString("option.trim_retrieved_seqs")); - trimrs.setToolTipText(MessageManager - .getString("label.trim_retrieved_sequences")); + trimrs.setToolTipText( + MessageManager.getString("label.trim_retrieved_sequences")); trimrs.setSelected(Cache.getDefault("TRIM_FETCHED_DATASET_SEQS", true)); trimrs.addActionListener(new ActionListener() { @@ -4870,8 +4867,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, rfetch.add(trimrs); JMenuItem fetchr = new JMenuItem( MessageManager.getString("label.standard_databases")); - fetchr.setToolTipText(MessageManager - .getString("label.fetch_embl_uniprot")); + fetchr.setToolTipText( + MessageManager.getString("label.fetch_embl_uniprot")); fetchr.addActionListener(new ActionListener() { @@ -4885,8 +4882,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { boolean isNucleotide = alignPanel.alignFrame.getViewport() .getAlignment().isNucleotide(); - DBRefFetcher dbRefFetcher = new DBRefFetcher(alignPanel.av - .getSequenceSelection(), alignPanel.alignFrame, null, + DBRefFetcher dbRefFetcher = new DBRefFetcher( + alignPanel.av.getSequenceSelection(), + alignPanel.alignFrame, null, alignPanel.alignFrame.featureSettings, isNucleotide); dbRefFetcher.addListener(new FetchFinishedListenerI() { @@ -4989,8 +4987,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, }); fetchr.setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager.formatMessage( - "label.fetch_retrieve_from", - new Object[] { src.getDbName() }))); + "label.fetch_retrieve_from", new Object[] + { src.getDbName() }))); dfetch.add(fetchr); comp++; } @@ -5000,9 +4998,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, .toArray(new DbSourceProxy[0]); // fetch all entry DbSourceProxy src = otherdb.get(0); - fetchr = new JMenuItem(MessageManager.formatMessage( - "label.fetch_all_param", - new Object[] { src.getDbSource() })); + fetchr = new JMenuItem(MessageManager + .formatMessage("label.fetch_all_param", new Object[] + { src.getDbSource() })); fetchr.addActionListener(new ActionListener() { @Override @@ -5040,30 +5038,33 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, fetchr.setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager.formatMessage( "label.fetch_retrieve_from_all_sources", - new Object[] { - Integer.valueOf(otherdb.size()) - .toString(), src.getDbSource(), - src.getDbName() }))); + new Object[] + { Integer.valueOf(otherdb.size()) + .toString(), + src.getDbSource(), src.getDbName() }))); dfetch.add(fetchr); comp++; // and then build the rest of the individual menus ifetch = new JMenu(MessageManager.formatMessage( - "label.source_from_db_source", - new Object[] { src.getDbSource() })); + "label.source_from_db_source", new Object[] + { src.getDbSource() })); icomp = 0; String imname = null; int i = 0; for (DbSourceProxy sproxy : otherdb) { String dbname = sproxy.getDbName(); - String sname = dbname.length() > 5 ? dbname.substring(0, - 5) + "..." : dbname; - String msname = dbname.length() > 10 ? dbname.substring( - 0, 10) + "..." : dbname; + String sname = dbname.length() > 5 + ? dbname.substring(0, 5) + "..." + : dbname; + String msname = dbname.length() > 10 + ? dbname.substring(0, 10) + "..." + : dbname; if (imname == null) { - imname = MessageManager.formatMessage( - "label.from_msname", new Object[] { sname }); + imname = MessageManager + .formatMessage("label.from_msname", new Object[] + { sname }); } fetchr = new JMenuItem(msname); final DbSourceProxy[] dassrc = { sproxy }; @@ -5102,8 +5103,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } }); - fetchr.setToolTipText("" - + MessageManager.formatMessage( + fetchr.setToolTipText( + "" + MessageManager.formatMessage( "label.fetch_retrieve_from", new Object[] { dbname })); ifetch.add(fetchr); @@ -5308,17 +5309,14 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, */ public void setDisplayedView(AlignmentPanel alignmentPanel) { - if (!viewport.getSequenceSetId().equals( - alignmentPanel.av.getSequenceSetId())) + if (!viewport.getSequenceSetId() + .equals(alignmentPanel.av.getSequenceSetId())) { - throw new Error( - MessageManager - .getString("error.implementation_error_cannot_show_view_alignment_frame")); + throw new Error(MessageManager.getString( + "error.implementation_error_cannot_show_view_alignment_frame")); } - if (tabbedPane != null - && tabbedPane.getTabCount() > 0 - && alignPanels.indexOf(alignmentPanel) != tabbedPane - .getSelectedIndex()) + if (tabbedPane != null && tabbedPane.getTabCount() > 0 && alignPanels + .indexOf(alignmentPanel) != tabbedPane.getSelectedIndex()) { tabbedPane.setSelectedIndex(alignPanels.indexOf(alignmentPanel)); } @@ -5421,15 +5419,15 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, // show a warning dialog no mapped cDNA return; } - AlignmentI cdna = new Alignment(cdnaSeqs.toArray(new SequenceI[cdnaSeqs - .size()])); + AlignmentI cdna = new Alignment( + cdnaSeqs.toArray(new SequenceI[cdnaSeqs.size()])); GAlignFrame alignFrame = new AlignFrame(cdna, AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT); cdna.alignAs(alignment); String newtitle = "cDNA " + MessageManager.getString("label.for") + " " + this.title; - Desktop.addInternalFrame(alignFrame, newtitle, - AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT); + Desktop.addInternalFrame(alignFrame, newtitle, AlignFrame.DEFAULT_WIDTH, + AlignFrame.DEFAULT_HEIGHT); } /** @@ -5462,8 +5460,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, al = dna.reverseCdna(complement); viewport.addAlignment(al, ""); addHistoryItem(new EditCommand( - MessageManager.getString("label.add_sequences"), - Action.PASTE, al.getSequencesArray(), 0, al.getWidth(), + MessageManager.getString("label.add_sequences"), Action.PASTE, + al.getSequencesArray(), 0, al.getWidth(), viewport.getAlignment())); } catch (Exception ex) { @@ -5490,12 +5488,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } catch (Exception ex) { System.err.println((ex.toString())); - JvOptionPane - .showInternalMessageDialog(Desktop.desktop, MessageManager - .getString("label.couldnt_run_groovy_script"), - MessageManager - .getString("label.groovy_support_failed"), - JvOptionPane.ERROR_MESSAGE); + JvOptionPane.showInternalMessageDialog(Desktop.desktop, + MessageManager.getString("label.couldnt_run_groovy_script"), + MessageManager.getString("label.groovy_support_failed"), + JvOptionPane.ERROR_MESSAGE); } } else @@ -5535,9 +5531,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { // include key modifier check in case user selects from menu avc.markHighlightedColumns( - (actionEvent.getModifiers() & ActionEvent.ALT_MASK) != 0, - true, - (actionEvent.getModifiers() & (ActionEvent.META_MASK | ActionEvent.CTRL_MASK)) != 0); + (actionEvent.getModifiers() & ActionEvent.ALT_MASK) != 0, true, + (actionEvent.getModifiers() & (ActionEvent.META_MASK + | ActionEvent.CTRL_MASK)) != 0); } /** @@ -5552,8 +5548,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, colourMenu.add(textColour); colourMenu.addSeparator(); - ColourMenuHelper.addMenuItems(colourMenu, this, - viewport.getAlignment(), false); + ColourMenuHelper.addMenuItems(colourMenu, this, viewport.getAlignment(), + false); colourMenu.addSeparator(); colourMenu.add(conservationMenuItem); diff --git a/src/jalview/gui/AlignViewport.java b/src/jalview/gui/AlignViewport.java index 835371f..c22a37d 100644 --- a/src/jalview/gui/AlignViewport.java +++ b/src/jalview/gui/AlignViewport.java @@ -71,8 +71,8 @@ import javax.swing.JInternalFrame; * @author $author$ * @version $Revision: 1.141 $ */ -public class AlignViewport extends AlignmentViewport implements - SelectionSource +public class AlignViewport extends AlignmentViewport + implements SelectionSource { Font font; @@ -129,8 +129,8 @@ public class AlignViewport extends AlignmentViewport implements // TODO remove these once 2.4.VAMSAS release finished if (Cache.log != null && Cache.log.isDebugEnabled() && seqsetid != null) { - Cache.log.debug("Setting viewport's sequence set id : " - + sequenceSetID); + Cache.log.debug( + "Setting viewport's sequence set id : " + sequenceSetID); } if (Cache.log != null && Cache.log.isDebugEnabled() && viewId != null) { @@ -191,8 +191,8 @@ public class AlignViewport extends AlignmentViewport implements // TODO remove these once 2.4.VAMSAS release finished if (Cache.log != null && Cache.log.isDebugEnabled() && seqsetid != null) { - Cache.log.debug("Setting viewport's sequence set id : " - + sequenceSetID); + Cache.log.debug( + "Setting viewport's sequence set id : " + sequenceSetID); } if (Cache.log != null && Cache.log.isDebugEnabled() && viewId != null) { @@ -225,17 +225,17 @@ public class AlignViewport extends AlignmentViewport implements setShowDBRefs(Cache.getDefault("SHOW_DBREFS_TOOLTIP", true)); viewStyle.setSeqNameItalics(Cache.getDefault("ID_ITALICS", true)); viewStyle.setWrapAlignment(Cache.getDefault("WRAP_ALIGNMENT", false)); - viewStyle.setShowUnconserved(Cache - .getDefault("SHOW_UNCONSERVED", false)); + viewStyle.setShowUnconserved( + Cache.getDefault("SHOW_UNCONSERVED", false)); sortByTree = Cache.getDefault("SORT_BY_TREE", false); followSelection = Cache.getDefault("FOLLOW_SELECTIONS", true); - sortAnnotationsBy = SequenceAnnotationOrder.valueOf(Cache.getDefault( - Preferences.SORT_ANNOTATIONS, - SequenceAnnotationOrder.NONE.name())); - showAutocalculatedAbove = Cache.getDefault( - Preferences.SHOW_AUTOCALC_ABOVE, false); - viewStyle.setScaleProteinAsCdna(Cache.getDefault( - Preferences.SCALE_PROTEIN_TO_CDNA, true)); + sortAnnotationsBy = SequenceAnnotationOrder + .valueOf(Cache.getDefault(Preferences.SORT_ANNOTATIONS, + SequenceAnnotationOrder.NONE.name())); + showAutocalculatedAbove = Cache + .getDefault(Preferences.SHOW_AUTOCALC_ABOVE, false); + viewStyle.setScaleProteinAsCdna( + Cache.getDefault(Preferences.SCALE_PROTEIN_TO_CDNA, true)); } void init() @@ -284,7 +284,8 @@ public class AlignViewport extends AlignmentViewport implements showOccupancy = Cache.getDefault(Preferences.SHOW_OCCUPANCY, true); } initAutoAnnotation(); - String colourProperty = alignment.isNucleotide() ? Preferences.DEFAULT_COLOUR_NUC + String colourProperty = alignment.isNucleotide() + ? Preferences.DEFAULT_COLOUR_NUC : Preferences.DEFAULT_COLOUR_PROT; String schemeName = Cache.getProperty(colourProperty); if (schemeName == null) @@ -293,8 +294,8 @@ public class AlignViewport extends AlignmentViewport implements schemeName = Cache.getDefault(Preferences.DEFAULT_COLOUR, ResidueColourScheme.NONE); } - ColourSchemeI colourScheme = ColourSchemeProperty.getColourScheme( - alignment, schemeName); + ColourSchemeI colourScheme = ColourSchemeProperty + .getColourScheme(alignment, schemeName); residueShading = new ResidueShader(colourScheme); if (colourScheme instanceof UserColourScheme) @@ -556,8 +557,8 @@ public class AlignViewport extends AlignmentViewport implements public void sendSelection() { jalview.structure.StructureSelectionManager - .getStructureSelectionManager(Desktop.instance).sendSelection( - new SequenceGroup(getSelectionGroup()), + .getStructureSelectionManager(Desktop.instance) + .sendSelection(new SequenceGroup(getSelectionGroup()), new ColumnSelection(getColumnSelection()), new HiddenColumns(getAlignment().getHiddenColumns()), this); @@ -573,8 +574,8 @@ public class AlignViewport extends AlignmentViewport implements */ public AlignmentPanel getAlignPanel() { - AlignmentPanel[] aps = PaintRefresher.getAssociatedPanels(this - .getSequenceSetId()); + AlignmentPanel[] aps = PaintRefresher + .getAssociatedPanels(this.getSequenceSetId()); for (int p = 0; aps != null && p < aps.length; p++) { if (aps[p].av == this) @@ -633,8 +634,7 @@ public class AlignViewport extends AlignmentViewport implements && pdb.getChainCode() != null) { if (pdbRefEntry.getChainCode().equalsIgnoreCase( - pdb.getChainCode()) - && !choosenSeqs.contains(sq)) + pdb.getChainCode()) && !choosenSeqs.contains(sq)) { choosenSeqs.add(sq); continue; @@ -709,7 +709,8 @@ public class AlignViewport extends AlignmentViewport implements *
      *
    • compute the equivalent edit on the mapped sequences
    • *
    • apply the mapped edit
    • - *
    • 'apply' the source edit to the working copy of the source sequences
    • + *
    • 'apply' the source edit to the working copy of the source + * sequences
    • *
    * * @param command @@ -830,8 +831,7 @@ public class AlignViewport extends AlignmentViewport implements */ protected boolean openLinkedAlignment(AlignmentI al, String title) { - String[] options = new String[] { - MessageManager.getString("action.no"), + String[] options = new String[] { MessageManager.getString("action.no"), MessageManager.getString("label.split_window"), MessageManager.getString("label.new_window"), }; final String question = JvSwingUtils.wrapTooltip(true, @@ -873,8 +873,9 @@ public class AlignViewport extends AlignmentViewport implements AlignFrame newAlignFrame = new AlignFrame(al, AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT); newAlignFrame.setTitle(title); - newAlignFrame.statusBar.setText(MessageManager.formatMessage( - "label.successfully_loaded_file", new Object[] { title })); + newAlignFrame.statusBar.setText(MessageManager + .formatMessage("label.successfully_loaded_file", new Object[] + { title })); // TODO if we want this (e.g. to enable reload of the alignment from file), // we will need to add parameters to the stack. @@ -891,8 +892,8 @@ public class AlignViewport extends AlignmentViewport implements try { - newAlignFrame.setMaximum(jalview.bin.Cache.getDefault( - "SHOW_FULLSCREEN", false)); + newAlignFrame.setMaximum( + jalview.bin.Cache.getDefault("SHOW_FULLSCREEN", false)); } catch (java.beans.PropertyVetoException ex) { } @@ -924,8 +925,8 @@ public class AlignViewport extends AlignmentViewport implements * is protein, the mappings to cDNA will be registered with * StructureSelectionManager as a side-effect. */ - AlignFrame copyMe = new AlignFrame(complement, - AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT); + AlignFrame copyMe = new AlignFrame(complement, AlignFrame.DEFAULT_WIDTH, + AlignFrame.DEFAULT_HEIGHT); copyMe.setTitle(getAlignPanel().alignFrame.getTitle()); AlignmentI al = newAlignFrame.viewport.getAlignment(); diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index e62707f..922e481 100644 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -70,8 +70,7 @@ import javax.swing.SwingUtilities; * @version $Revision: 1.161 $ */ public class AlignmentPanel extends GAlignmentPanel implements - AdjustmentListener, Printable, AlignmentViewPanel, - ViewportListenerI + AdjustmentListener, Printable, AlignmentViewPanel, ViewportListenerI { public AlignViewport av; @@ -157,8 +156,8 @@ public class AlignmentPanel extends GAlignmentPanel implements // is initialised if (av.getWrapAlignment()) { - int widthInRes = getSeqPanel().seqCanvas - .getWrappedCanvasWidth(getSeqPanel().seqCanvas.getWidth()); + int widthInRes = getSeqPanel().seqCanvas.getWrappedCanvasWidth( + getSeqPanel().seqCanvas.getWidth()); vpRanges.setViewportWidth(widthInRes); } else @@ -167,7 +166,7 @@ public class AlignmentPanel extends GAlignmentPanel implements / av.getCharWidth(); int heightInSeq = getSeqPanel().seqCanvas.getHeight() / av.getCharHeight(); - + vpRanges.setViewportWidth(widthInRes); vpRanges.setViewportHeight(heightInSeq); } @@ -226,10 +225,10 @@ public class AlignmentPanel extends GAlignmentPanel implements // to prevent drawing old image FontMetrics fm = getFontMetrics(av.getFont()); - scalePanelHolder.setPreferredSize(new Dimension(10, av.getCharHeight() - + fm.getDescent())); - idSpaceFillerPanel1.setPreferredSize(new Dimension(10, av - .getCharHeight() + fm.getDescent())); + scalePanelHolder.setPreferredSize( + new Dimension(10, av.getCharHeight() + fm.getDescent())); + idSpaceFillerPanel1.setPreferredSize( + new Dimension(10, av.getCharHeight() + fm.getDescent())); getIdPanel().getIdCanvas().gg = null; getSeqPanel().seqCanvas.img = null; @@ -289,8 +288,8 @@ public class AlignmentPanel extends GAlignmentPanel implements { Container c = new Container(); - FontMetrics fm = c.getFontMetrics(new Font(av.font.getName(), - Font.ITALIC, av.font.getSize())); + FontMetrics fm = c.getFontMetrics( + new Font(av.font.getName(), Font.ITALIC, av.font.getSize())); AlignmentI al = av.getAlignment(); int i = 0; @@ -331,8 +330,8 @@ public class AlignmentPanel extends GAlignmentPanel implements } } - return new Dimension(maxwidth < 0 ? idWidth : Math.min(maxwidth, - idWidth), 12); + return new Dimension( + maxwidth < 0 ? idWidth : Math.min(maxwidth, idWidth), 12); } /** @@ -477,8 +476,8 @@ public class AlignmentPanel extends GAlignmentPanel implements /* * Scroll down to make end of search results visible */ - setScrollValues(vpRanges.getStartRes(), starts + seqIndex - ends - + 1); + setScrollValues(vpRanges.getStartRes(), + starts + seqIndex - ends + 1); } /* * Else results are already visible - no need to scroll @@ -579,8 +578,8 @@ public class AlignmentPanel extends GAlignmentPanel implements */ if (annotationHeight + alignmentHeight > availableHeight) { - annotationHeight = Math.min(annotationHeight, availableHeight - 2 - * rowHeight); + annotationHeight = Math.min(annotationHeight, + availableHeight - 2 * rowHeight); } } else @@ -590,8 +589,8 @@ public class AlignmentPanel extends GAlignmentPanel implements } hscroll.addNotify(); - annotationScroller.setPreferredSize(new Dimension(annotationScroller - .getWidth(), annotationHeight)); + annotationScroller.setPreferredSize( + new Dimension(annotationScroller.getWidth(), annotationHeight)); Dimension e = idPanel.getSize(); alabels.setSize(new Dimension(e.width, annotationHeight)); @@ -641,8 +640,8 @@ public class AlignmentPanel extends GAlignmentPanel implements else { int widthInRes = (canvasWidth / av.getCharWidth()) - 1; - int heightInSeq = (getSeqPanel().seqCanvas.getHeight() / av - .getCharHeight()) - 1; + int heightInSeq = (getSeqPanel().seqCanvas.getHeight() + / av.getCharHeight()) - 1; vpRanges.setViewportWidth(widthInRes); vpRanges.setViewportHeight(heightInSeq); @@ -654,7 +653,6 @@ public class AlignmentPanel extends GAlignmentPanel implements repaint(); } - /** * Adjust row/column scrollers to show a visible position in the alignment. * @@ -686,7 +684,8 @@ public class AlignmentPanel extends GAlignmentPanel implements if (av.hasHiddenColumns()) { // reset the width to exclude hidden columns - width = av.getAlignment().getHiddenColumns().findColumnPosition(width); + width = av.getAlignment().getHiddenColumns() + .findColumnPosition(width); } hextent = getSeqPanel().seqCanvas.getWidth() / av.getCharWidth(); @@ -828,13 +827,13 @@ public class AlignmentPanel extends GAlignmentPanel implements { @Override public void run() - { + { // When updating scrolling to use ViewportChange events, this code // could not be validated and it is not clear if it is now being // called. Log warning here in case it is called and unforeseen // problems occur - Cache.log - .warn("Unexpected path through code: Wrapped jar file opened with wrap alignment set in preferences"); + Cache.log.warn( + "Unexpected path through code: Wrapped jar file opened with wrap alignment set in preferences"); // scroll to start of panel vpRanges.setStartRes(0); @@ -989,7 +988,8 @@ public class AlignmentPanel extends GAlignmentPanel implements * Get the horizontal offset to where we draw the sequences. * This is idWidth if using a single Graphics context, else zero. */ - final int alignmentGraphicsOffset = idGraphics != alignmentGraphics ? 0 : idWidth; + final int alignmentGraphicsOffset = idGraphics != alignmentGraphics ? 0 + : idWidth; FontMetrics fm = getFontMetrics(av.getFont()); int charHeight = av.getCharHeight(); @@ -1026,8 +1026,7 @@ public class AlignmentPanel extends GAlignmentPanel implements endSeq = alignmentHeight; } - int pagesHigh = ((alignmentHeight / totalSeq) + 1) - * pageHeight; + int pagesHigh = ((alignmentHeight / totalSeq) + 1) * pageHeight; if (av.isShowAnnotation()) { @@ -1040,8 +1039,7 @@ public class AlignmentPanel extends GAlignmentPanel implements { return Printable.NO_SUCH_PAGE; } - final int alignmentDrawnHeight = (endSeq - startSeq) * charHeight - + 3; + final int alignmentDrawnHeight = (endSeq - startSeq) * charHeight + 3; /* * draw the Scale at horizontal offset, then reset to top left (0, 0) @@ -1090,9 +1088,7 @@ public class AlignmentPanel extends GAlignmentPanel implements if (av.isRightAlignIds()) { fm = idGraphics.getFontMetrics(); - xPos = idWidth - - fm.stringWidth(displayId) - - 4; + xPos = idWidth - fm.stringWidth(displayId) - 4; } idGraphics.drawString(displayId, xPos, @@ -1128,7 +1124,8 @@ public class AlignmentPanel extends GAlignmentPanel implements * draw the annotations starting at * (idOffset, alignmentHeight) from (0, scaleHeight) */ - alignmentGraphics.translate(alignmentGraphicsOffset, alignmentDrawnHeight); + alignmentGraphics.translate(alignmentGraphicsOffset, + alignmentDrawnHeight); getAnnotationPanel().renderer.drawComponent(getAnnotationPanel(), av, alignmentGraphics, -1, startRes, endRes + 1); } @@ -1182,8 +1179,8 @@ public class AlignmentPanel extends GAlignmentPanel implements .findColumnPosition(maxwidth) - 1; } - int resWidth = getSeqPanel().seqCanvas.getWrappedCanvasWidth(pwidth - - idWidth); + int resWidth = getSeqPanel().seqCanvas + .getWrappedCanvasWidth(pwidth - idWidth); int totalHeight = cHeight * (maxwidth / resWidth + 1); @@ -1220,16 +1217,13 @@ public class AlignmentPanel extends GAlignmentPanel implements } if (labels != null) { - pg.translate(-3, - ypos + (av.getAlignment().getHeight() * av.getCharHeight())); + pg.translate(-3, ypos + + (av.getAlignment().getHeight() * av.getCharHeight())); pg.setFont(av.getFont()); labels.drawComponent(pg, idWidth); - pg.translate( - +3, - -ypos - - (av.getAlignment().getHeight() * av - .getCharHeight())); + pg.translate(+3, -ypos + - (av.getAlignment().getHeight() * av.getCharHeight())); } ypos += cHeight; @@ -1279,8 +1273,8 @@ public class AlignmentPanel extends GAlignmentPanel implements return calculateIdWidth(-1).width + 4; } Integer idwidth = null; - if (onscreen - || (idwidth = Cache.getIntegerProperty("FIGURE_FIXEDIDWIDTH")) == null) + if (onscreen || (idwidth = Cache + .getIntegerProperty("FIGURE_FIXEDIDWIDTH")) == null) { int w = getIdPanel().getWidth(); return (w > 0 ? w : calculateIdWidth().width + 4); @@ -1292,15 +1286,15 @@ public class AlignmentPanel extends GAlignmentPanel implements { int boarderBottomOffset = 5; long pSessionId = System.currentTimeMillis(); - headless = (System.getProperty("java.awt.headless") != null && System - .getProperty("java.awt.headless").equals("true")); + headless = (System.getProperty("java.awt.headless") != null + && System.getProperty("java.awt.headless").equals("true")); if (alignFrame != null && !headless) { if (file != null) { - alignFrame.setProgressBar(MessageManager.formatMessage( - "status.saving_file", new Object[] { type.getLabel() }), - pSessionId); + alignFrame.setProgressBar(MessageManager + .formatMessage("status.saving_file", new Object[] + { type.getLabel() }), pSessionId); } } try @@ -1327,9 +1321,9 @@ public class AlignmentPanel extends GAlignmentPanel implements } im = new jalview.util.ImageMaker(this, type, imageAction, - aDimension.getWidth(), aDimension.getHeight() - + boarderBottomOffset, file, imageTitle, - alignFrame, pSessionId, headless); + aDimension.getWidth(), + aDimension.getHeight() + boarderBottomOffset, file, + imageTitle, alignFrame, pSessionId, headless); Graphics graphics = im.getGraphics(); if (av.getWrapAlignment()) { @@ -1345,8 +1339,8 @@ public class AlignmentPanel extends GAlignmentPanel implements { if (graphics != null) { - printUnwrapped(aDimension.getWidth(), aDimension.getHeight(), - 0, graphics, graphics); + printUnwrapped(aDimension.getWidth(), aDimension.getHeight(), 0, + graphics, graphics); im.writeImage(); } } @@ -1391,9 +1385,8 @@ public class AlignmentPanel extends GAlignmentPanel implements // this duplicates the calculation in getWrappedHeight but adjusts for // offscreen idWith width = alignFrame.getWidth() - vscroll.getPreferredSize().width - - alignFrame.getInsets().left - - alignFrame.getInsets().right - getVisibleIdWidth() - + getVisibleIdWidth(false); + - alignFrame.getInsets().left - alignFrame.getInsets().right + - getVisibleIdWidth() + getVisibleIdWidth(false); } else { @@ -1444,8 +1437,9 @@ public class AlignmentPanel extends GAlignmentPanel implements { try { - int s, sSize = av.getAlignment().getHeight(), res, alwidth = av - .getAlignment().getWidth(), g, gSize, f, fSize, sy; + int s, sSize = av.getAlignment().getHeight(), res, + alwidth = av.getAlignment().getWidth(), g, gSize, f, fSize, + sy; PrintWriter out = new PrintWriter(new FileWriter(imgMapFile)); out.println(jalview.io.HTMLOutput.getImageMapHTML()); out.println(""); text.append(features[f].getType()); - if (features[f].getDescription() != null - && !features[f].getType().equals( - features[f].getDescription())) + if (features[f].getDescription() != null && !features[f] + .getType().equals(features[f].getDescription())) { text.append(" ").append(features[f].getDescription()); } if (features[f].getValue("status") != null) { - text.append(" (").append(features[f].getValue("status")) + text.append(" (") + .append(features[f].getValue("status")) .append(")"); } } @@ -1903,7 +1897,7 @@ public class AlignmentPanel extends GAlignmentPanel implements @Override /** - * Property change event fired when a change is made to the viewport ranges + * Property change event fired when a change is made to the viewport ranges * object associated with this alignment panel's viewport */ public void propertyChange(PropertyChangeEvent evt) diff --git a/src/jalview/gui/AnnotationChooser.java b/src/jalview/gui/AnnotationChooser.java index f20d0e6..26796de 100644 --- a/src/jalview/gui/AnnotationChooser.java +++ b/src/jalview/gui/AnnotationChooser.java @@ -56,7 +56,8 @@ import javax.swing.JPanel; public class AnnotationChooser extends JPanel { - private static final Font CHECKBOX_FONT = new Font("Serif", Font.BOLD, 12); + private static final Font CHECKBOX_FONT = new Font("Serif", Font.BOLD, + 12); private static final int MY_FRAME_WIDTH = 600; diff --git a/src/jalview/gui/AnnotationColourChooser.java b/src/jalview/gui/AnnotationColourChooser.java index 253a7ec..f088791 100644 --- a/src/jalview/gui/AnnotationColourChooser.java +++ b/src/jalview/gui/AnnotationColourChooser.java @@ -110,8 +110,8 @@ public class AnnotationColourChooser extends AnnotationRowFilter if (oldcs instanceof AnnotationColourGradient) { AnnotationColourGradient acg = (AnnotationColourGradient) oldcs; - useOriginalColours.setSelected(acg.isPredefinedColours() - || acg.getBaseColour() != null); + useOriginalColours.setSelected( + acg.isPredefinedColours() || acg.getBaseColour() != null); if (!acg.isPredefinedColours() && acg.getBaseColour() == null) { minColour.setBackground(acg.getMinColour()); @@ -120,8 +120,8 @@ public class AnnotationColourChooser extends AnnotationRowFilter seqAssociated.setSelected(acg.isSeqAssociated()); } - Vector annotItems = getAnnotationItems(seqAssociated - .isSelected()); + Vector annotItems = getAnnotationItems( + seqAssociated.isSelected()); annotations = new JComboBox(annotItems); populateThresholdComboBox(threshold); @@ -143,9 +143,8 @@ public class AnnotationColourChooser extends AnnotationRowFilter getThreshold().setSelectedIndex(2); break; default: - throw new Error( - MessageManager - .getString("error.implementation_error_dont_know_about_threshold_setting")); + throw new Error(MessageManager.getString( + "error.implementation_error_dont_know_about_threshold_setting")); } thresholdIsMin.setSelected(acg.isThresholdIsMinMax()); thresholdValue.setText("" + acg.getAnnotationThreshold()); @@ -212,8 +211,8 @@ public class AnnotationColourChooser extends AnnotationRowFilter useOriginalColours.setFont(JvSwingUtils.getLabelFont()); useOriginalColours.setOpaque(false); - useOriginalColours.setText(MessageManager - .getString("label.use_original_colours")); + useOriginalColours.setText( + MessageManager.getString("label.use_original_colours")); useOriginalColours.addActionListener(new ActionListener() { @Override @@ -224,8 +223,8 @@ public class AnnotationColourChooser extends AnnotationRowFilter }); thresholdIsMin.setBackground(Color.white); thresholdIsMin.setFont(JvSwingUtils.getLabelFont()); - thresholdIsMin.setText(MessageManager - .getString("label.threshold_minmax")); + thresholdIsMin + .setText(MessageManager.getString("label.threshold_minmax")); thresholdIsMin.addActionListener(new ActionListener() { @Override @@ -236,8 +235,8 @@ public class AnnotationColourChooser extends AnnotationRowFilter }); seqAssociated.setBackground(Color.white); seqAssociated.setFont(JvSwingUtils.getLabelFont()); - seqAssociated.setText(MessageManager - .getString("label.per_sequence_only")); + seqAssociated + .setText(MessageManager.getString("label.per_sequence_only")); seqAssociated.addActionListener(new ActionListener() { @@ -283,10 +282,10 @@ public class AnnotationColourChooser extends AnnotationRowFilter private void setDefaultMinMax() { - minColour.setBackground(Cache.getDefaultColour("ANNOTATIONCOLOUR_MIN", - Color.orange)); - maxColour.setBackground(Cache.getDefaultColour("ANNOTATIONCOLOUR_MAX", - Color.red)); + minColour.setBackground( + Cache.getDefaultColour("ANNOTATIONCOLOUR_MIN", Color.orange)); + maxColour.setBackground( + Cache.getDefaultColour("ANNOTATIONCOLOUR_MAX", Color.red)); } public void minColour_actionPerformed() @@ -334,8 +333,8 @@ public class AnnotationColourChooser extends AnnotationRowFilter { if (slider.isEnabled()) { - if (useOriginalColours.isSelected() - && !(av.getGlobalColourScheme() instanceof AnnotationColourGradient)) + if (useOriginalColours.isSelected() && !(av + .getGlobalColourScheme() instanceof AnnotationColourGradient)) { updateView(); } @@ -368,11 +367,12 @@ public class AnnotationColourChooser extends AnnotationRowFilter return; } - setCurrentAnnotation(av.getAlignment().getAlignmentAnnotation()[annmap[annotations - .getSelectedIndex()]]); + setCurrentAnnotation( + av.getAlignment().getAlignmentAnnotation()[annmap[annotations + .getSelectedIndex()]]); - int selectedThresholdItem = getSelectedThresholdItem(getThreshold() - .getSelectedIndex()); + int selectedThresholdItem = getSelectedThresholdItem( + getThreshold().getSelectedIndex()); slider.setEnabled(true); thresholdValue.setEnabled(true); @@ -388,11 +388,10 @@ public class AnnotationColourChooser extends AnnotationRowFilter else if (selectedThresholdItem != AnnotationColourGradient.NO_THRESHOLD && getCurrentAnnotation().threshold == null) { - getCurrentAnnotation() - .setThreshold( - new GraphLine( - (getCurrentAnnotation().graphMax - getCurrentAnnotation().graphMin) / 2f, - "Threshold", Color.black)); + getCurrentAnnotation().setThreshold(new GraphLine( + (getCurrentAnnotation().graphMax + - getCurrentAnnotation().graphMin) / 2f, + "Threshold", Color.black)); } if (selectedThresholdItem != AnnotationColourGradient.NO_THRESHOLD) @@ -401,9 +400,12 @@ public class AnnotationColourChooser extends AnnotationRowFilter float range = getCurrentAnnotation().graphMax * ONETHOUSAND - getCurrentAnnotation().graphMin * ONETHOUSAND; - slider.setMinimum((int) (getCurrentAnnotation().graphMin * ONETHOUSAND)); - slider.setMaximum((int) (getCurrentAnnotation().graphMax * ONETHOUSAND)); - slider.setValue((int) (getCurrentAnnotation().threshold.value * ONETHOUSAND)); + slider.setMinimum( + (int) (getCurrentAnnotation().graphMin * ONETHOUSAND)); + slider.setMaximum( + (int) (getCurrentAnnotation().graphMax * ONETHOUSAND)); + slider.setValue( + (int) (getCurrentAnnotation().threshold.value * ONETHOUSAND)); thresholdValue.setText(getCurrentAnnotation().threshold.value + ""); slider.setMajorTickSpacing((int) (range / 10f)); slider.setEnabled(true); @@ -418,9 +420,10 @@ public class AnnotationColourChooser extends AnnotationRowFilter ap.paintAlignment(true); } - protected boolean colorAlignmentContaining(AlignmentAnnotation currentAnn, int selectedThresholdOption) + protected boolean colorAlignmentContaining(AlignmentAnnotation currentAnn, + int selectedThresholdOption) { - + AnnotationColourGradient acg = null; if (useOriginalColours.isSelected()) { @@ -434,40 +437,40 @@ public class AnnotationColourChooser extends AnnotationRowFilter selectedThresholdOption); } acg.setSeqAssociated(seqAssociated.isSelected()); - + if (currentAnn.graphMin == 0f && currentAnn.graphMax == 0f) { acg.setPredefinedColours(true); } - + acg.setThresholdIsMinMax(thresholdIsMin.isSelected()); - + av.setGlobalColourScheme(acg); - + if (av.getAlignment().getGroups() != null) { - + for (SequenceGroup sg : ap.av.getAlignment().getGroups()) { if (sg.cs == null) { continue; } - + if (useOriginalColours.isSelected()) { - sg.setColourScheme(new AnnotationColourGradient(currentAnn, sg - .getColourScheme(), selectedThresholdOption)); - ((AnnotationColourGradient) sg.cs).setSeqAssociated(seqAssociated - .isSelected()); + sg.setColourScheme(new AnnotationColourGradient(currentAnn, + sg.getColourScheme(), selectedThresholdOption)); + ((AnnotationColourGradient) sg.cs) + .setSeqAssociated(seqAssociated.isSelected()); } else { sg.setColourScheme(new AnnotationColourGradient(currentAnn, minColour.getBackground(), maxColour.getBackground(), selectedThresholdOption)); - ((AnnotationColourGradient) sg.cs).setSeqAssociated(seqAssociated - .isSelected()); + ((AnnotationColourGradient) sg.cs) + .setSeqAssociated(seqAssociated.isSelected()); } } } diff --git a/src/jalview/gui/AnnotationColumnChooser.java b/src/jalview/gui/AnnotationColumnChooser.java index 6fc5fad..84b2c6f 100644 --- a/src/jalview/gui/AnnotationColumnChooser.java +++ b/src/jalview/gui/AnnotationColumnChooser.java @@ -50,8 +50,8 @@ import javax.swing.border.TitledBorder; import net.miginfocom.swing.MigLayout; @SuppressWarnings("serial") -public class AnnotationColumnChooser extends AnnotationRowFilter implements - ItemListener +public class AnnotationColumnChooser extends AnnotationRowFilter + implements ItemListener { private JPanel switchableViewsPanel = new JPanel(new CardLayout()); @@ -119,18 +119,16 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements // restore Object state from the previous session if one exists if (lastChooser != null) { - currentSearchPanel = lastChooser - .getCurrentSearchPanel(); + currentSearchPanel = lastChooser.getCurrentSearchPanel(); currentStructureFilterPanel = lastChooser .getCurrentStructureFilterPanel(); - annotations.setSelectedIndex(lastChooser - .getAnnotations().getSelectedIndex()); - threshold.setSelectedIndex(lastChooser - .getThreshold().getSelectedIndex()); - actionOption = lastChooser - .getActionOption(); - percentThreshold.setSelected(lastChooser.percentThreshold - .isSelected()); + annotations.setSelectedIndex( + lastChooser.getAnnotations().getSelectedIndex()); + threshold.setSelectedIndex( + lastChooser.getThreshold().getSelectedIndex()); + actionOption = lastChooser.getActionOption(); + percentThreshold + .setSelected(lastChooser.percentThreshold.isSelected()); } try @@ -152,8 +150,8 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements super.jbInit(); JPanel thresholdPanel = new JPanel(); - thresholdPanel.setBorder(new TitledBorder(MessageManager - .getString("label.threshold_filter"))); + thresholdPanel.setBorder(new TitledBorder( + MessageManager.getString("label.threshold_filter"))); thresholdPanel.setBackground(Color.white); thresholdPanel.setFont(JvSwingUtils.getLabelFont()); thresholdPanel.setLayout(new MigLayout("", "[left][right]", "[][]")); @@ -241,8 +239,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements if (av.getAnnotationColumnSelectionState() != null) { - HiddenColumns oldHidden = av - .getAnnotationColumnSelectionState() + HiddenColumns oldHidden = av.getAnnotationColumnSelectionState() .getOldHiddenColumns(); if (oldHidden != null) { @@ -285,11 +282,12 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements AnnotationFilterParameter filterParams = new AnnotationFilterParameter(); - setCurrentAnnotation(av.getAlignment().getAlignmentAnnotation()[annmap[getAnnotations() - .getSelectedIndex()]]); + setCurrentAnnotation(av.getAlignment() + .getAlignmentAnnotation()[annmap[getAnnotations() + .getSelectedIndex()]]); - int selectedThresholdItem = getSelectedThresholdItem(getThreshold() - .getSelectedIndex()); + int selectedThresholdItem = getSelectedThresholdItem( + getThreshold().getSelectedIndex()); slider.setEnabled(true); thresholdValue.setEnabled(true); @@ -307,11 +305,10 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements { if (getCurrentAnnotation().threshold == null) { - getCurrentAnnotation() - .setThreshold( - new jalview.datamodel.GraphLine( - (getCurrentAnnotation().graphMax - getCurrentAnnotation().graphMin) / 2f, - "Threshold", Color.black)); + getCurrentAnnotation().setThreshold(new jalview.datamodel.GraphLine( + (getCurrentAnnotation().graphMax + - getCurrentAnnotation().graphMin) / 2f, + "Threshold", Color.black)); } adjusting = true; @@ -320,8 +317,9 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements slider.setMinimum((int) (getCurrentAnnotation().graphMin * 1000)); slider.setMaximum((int) (getCurrentAnnotation().graphMax * 1000)); - slider.setValue((int) (getCurrentAnnotation().threshold.value * 1000)); - + slider.setValue( + (int) (getCurrentAnnotation().threshold.value * 1000)); + setThresholdValueText(); slider.setMajorTickSpacing((int) (range / 10f)); @@ -330,8 +328,8 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements adjusting = false; // build filter params - filterParams - .setThresholdType(AnnotationFilterParameter.ThresholdType.NO_THRESHOLD); + filterParams.setThresholdType( + AnnotationFilterParameter.ThresholdType.NO_THRESHOLD); if (getCurrentAnnotation().isQuantitative()) { filterParams @@ -339,13 +337,13 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements if (selectedThresholdItem == AnnotationColourGradient.ABOVE_THRESHOLD) { - filterParams - .setThresholdType(AnnotationFilterParameter.ThresholdType.ABOVE_THRESHOLD); + filterParams.setThresholdType( + AnnotationFilterParameter.ThresholdType.ABOVE_THRESHOLD); } else if (selectedThresholdItem == AnnotationColourGradient.BELOW_THRESHOLD) { - filterParams - .setThresholdType(AnnotationFilterParameter.ThresholdType.BELOW_THRESHOLD); + filterParams.setThresholdType( + AnnotationFilterParameter.ThresholdType.BELOW_THRESHOLD); } } } @@ -371,17 +369,17 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements { if (!currentSearchPanel.searchBox.getUserInput().isEmpty()) { - filterParams.setRegexString(currentSearchPanel.searchBox - .getUserInput()); + filterParams.setRegexString( + currentSearchPanel.searchBox.getUserInput()); if (currentSearchPanel.displayName.isSelected()) { - filterParams - .addRegexSearchField(AnnotationFilterParameter.SearchableAnnotationField.DISPLAY_STRING); + filterParams.addRegexSearchField( + AnnotationFilterParameter.SearchableAnnotationField.DISPLAY_STRING); } if (currentSearchPanel.description.isSelected()) { - filterParams - .addRegexSearchField(AnnotationFilterParameter.SearchableAnnotationField.DESCRIPTION); + filterParams.addRegexSearchField( + AnnotationFilterParameter.SearchableAnnotationField.DESCRIPTION); } } } @@ -489,8 +487,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements public void selectedAnnotationChanged() { String currentView = AnnotationColumnChooser.NO_GRAPH_VIEW; - if (av.getAlignment() - .getAlignmentAnnotation()[annmap[getAnnotations() + if (av.getAlignment().getAlignmentAnnotation()[annmap[getAnnotations() .getSelectedIndex()]].isQuantitative()) { currentView = AnnotationColumnChooser.GRAPH_VIEW; @@ -568,7 +565,8 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements public void syncState() { - if (aColChooser.getActionOption() == AnnotationColumnChooser.ACTION_OPTION_HIDE) + if (aColChooser + .getActionOption() == AnnotationColumnChooser.ACTION_OPTION_HIDE) { this.optionsGroup.setSelected(this.hideOption.getModel(), true); } @@ -635,8 +633,8 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements } }); - this.setBorder(new TitledBorder(MessageManager - .getString("label.structures_filter"))); + this.setBorder(new TitledBorder( + MessageManager.getString("label.structures_filter"))); JvSwingUtils.jvInitComponent(this); this.add(all); @@ -736,12 +734,12 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements this.aColChooser = aColChooser; JvSwingUtils.jvInitComponent(this); - this.setBorder(new TitledBorder(MessageManager - .getString("label.search_filter"))); + this.setBorder(new TitledBorder( + MessageManager.getString("label.search_filter"))); searchBox.setPrototypeDisplayValue("XXXXXXXXXXXXXXXXXXXXXXX"); - searchBox.setToolTipText(MessageManager - .getString("info.enter_search_text_here")); + searchBox.setToolTipText( + MessageManager.getString("info.enter_search_text_here")); searchBox.getEditor().getEditorComponent() .addKeyListener(new java.awt.event.KeyAdapter() { @@ -756,8 +754,6 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements } }); - - JvSwingUtils.jvInitComponent(displayName, "label.label"); displayName.addActionListener(new ActionListener() { @@ -825,15 +821,15 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements String defaultTtip = MessageManager .getString("info.enter_search_text_to_enable"); String labelTtip = MessageManager.formatMessage( - "info.search_in_annotation_label", annotations - .getSelectedItem().toString()); + "info.search_in_annotation_label", + annotations.getSelectedItem().toString()); String descTtip = MessageManager.formatMessage( - "info.search_in_annotation_description", annotations - .getSelectedItem().toString()); - displayName.setToolTipText(displayName.isEnabled() ? labelTtip - : defaultTtip); - description.setToolTipText(description.isEnabled() ? descTtip - : defaultTtip); + "info.search_in_annotation_description", + annotations.getSelectedItem().toString()); + displayName.setToolTipText( + displayName.isEnabled() ? labelTtip : defaultTtip); + description.setToolTipText( + description.isEnabled() ? descTtip : defaultTtip); } } diff --git a/src/jalview/gui/AnnotationExporter.java b/src/jalview/gui/AnnotationExporter.java index 0d47e36..beb77ca 100644 --- a/src/jalview/gui/AnnotationExporter.java +++ b/src/jalview/gui/AnnotationExporter.java @@ -94,8 +94,8 @@ public class AnnotationExporter extends JPanel public void exportAnnotations(AlignmentPanel ap) { this.ap = ap; - annotations = ap.av.isShowAnnotation() ? null : ap.av.getAlignment() - .getAlignmentAnnotation(); + annotations = ap.av.isShowAnnotation() ? null + : ap.av.getAlignment().getAlignmentAnnotation(); wholeView = true; startExportAnnotation(); } @@ -123,9 +123,9 @@ public class AnnotationExporter extends JPanel jalview.bin.Cache.getProperty("LAST_DIRECTORY")); chooser.setFileView(new JalviewFileView()); - chooser.setDialogTitle(features ? MessageManager - .getString("label.save_features_to_file") : MessageManager - .getString("label.save_annotation_to_file")); + chooser.setDialogTitle(features + ? MessageManager.getString("label.save_features_to_file") + : MessageManager.getString("label.save_annotation_to_file")); chooser.setToolTipText(MessageManager.getString("action.save")); int value = chooser.showSaveDialog(this); @@ -165,19 +165,19 @@ public class AnnotationExporter extends JPanel boolean includeNonPositional = ap.av.isShowNPFeats(); if (GFFFormat.isSelected()) { - text = new FeaturesFile().printGffFormat(ap.av.getAlignment() - .getDataset().getSequencesArray(), displayedFeatureColours, - true, ap.av.isShowNPFeats()); + text = new FeaturesFile().printGffFormat( + ap.av.getAlignment().getDataset().getSequencesArray(), + displayedFeatureColours, true, ap.av.isShowNPFeats()); text = formatter.printGffFormat(sequences, featureColours, true, includeNonPositional); } else { - text = new FeaturesFile().printJalviewFormat(ap.av.getAlignment() - .getDataset().getSequencesArray(), displayedFeatureColours, - true, ap.av.isShowNPFeats()); // ap.av.featuresDisplayed); - text = formatter.printJalviewFormat(sequences, featureColours, - true, includeNonPositional); + text = new FeaturesFile().printJalviewFormat( + ap.av.getAlignment().getDataset().getSequencesArray(), + displayedFeatureColours, true, ap.av.isShowNPFeats()); // ap.av.featuresDisplayed); + text = formatter.printJalviewFormat(sequences, featureColours, true, + includeNonPositional); } } else @@ -210,23 +210,23 @@ public class AnnotationExporter extends JPanel { String text = getFileContents(); cap.setText(text); - Desktop.addInternalFrame( - cap, - (features ? MessageManager.formatMessage( - "label.features_for_params", - new String[] { ap.alignFrame.getTitle() }) - : MessageManager.formatMessage( - "label.annotations_for_params", - new String[] { ap.alignFrame.getTitle() })), + Desktop.addInternalFrame(cap, (features ? MessageManager + .formatMessage("label.features_for_params", new String[] + { ap.alignFrame.getTitle() }) + : MessageManager.formatMessage("label.annotations_for_params", + new String[] + { ap.alignFrame.getTitle() })), 600, 500); } catch (OutOfMemoryError oom) { new OOMWarning((features ? MessageManager.formatMessage( - "label.generating_features_for_params", - new String[] { ap.alignFrame.getTitle() }) + "label.generating_features_for_params", new String[] + { ap.alignFrame.getTitle() }) : MessageManager.formatMessage( "label.generating_annotations_for_params", - new String[] { ap.alignFrame.getTitle() })), oom); + new String[] + { ap.alignFrame.getTitle() })), + oom); cap.dispose(); } diff --git a/src/jalview/gui/AnnotationLabels.java b/src/jalview/gui/AnnotationLabels.java index e16867a..d07cae2 100755 --- a/src/jalview/gui/AnnotationLabels.java +++ b/src/jalview/gui/AnnotationLabels.java @@ -67,8 +67,8 @@ import javax.swing.ToolTipManager; * @author $author$ * @version $Revision$ */ -public class AnnotationLabels extends JPanel implements MouseListener, - MouseMotionListener, ActionListener +public class AnnotationLabels extends JPanel + implements MouseListener, MouseMotionListener, ActionListener { private static final Pattern LEFT_ANGLE_BRACKET_PATTERN = Pattern .compile("<"); @@ -267,7 +267,8 @@ public class AnnotationLabels extends JPanel implements MouseListener, else if (evt.getActionCommand().equals(OUTPUT_TEXT)) { new AnnotationExporter().exportAnnotations(ap, - new AlignmentAnnotation[] { aa[selectedRow] }); + new AlignmentAnnotation[] + { aa[selectedRow] }); } else if (evt.getActionCommand().equals(COPYCONS_SEQ)) { @@ -439,9 +440,9 @@ public class AnnotationLabels extends JPanel implements MouseListener, // av and sequencegroup need to implement same interface for final JCheckBoxMenuItem cbmi = new JCheckBoxMenuItem( MessageManager.getString("label.ignore_gaps_consensus"), - (aa[selectedRow].groupRef != null) ? aa[selectedRow].groupRef - .getIgnoreGapsConsensus() : ap.av - .isIgnoreGapsConsensus()); + (aa[selectedRow].groupRef != null) + ? aa[selectedRow].groupRef.getIgnoreGapsConsensus() + : ap.av.isIgnoreGapsConsensus()); final AlignmentAnnotation aaa = aa[selectedRow]; cbmi.addActionListener(new ActionListener() { @@ -452,8 +453,8 @@ public class AnnotationLabels extends JPanel implements MouseListener, { // TODO: pass on reference to ap so the view can be updated. aaa.groupRef.setIgnoreGapsConsensus(cbmi.getState()); - ap.getAnnotationPanel().paint( - ap.getAnnotationPanel().getGraphics()); + ap.getAnnotationPanel() + .paint(ap.getAnnotationPanel().getGraphics()); } else { @@ -699,11 +700,11 @@ public class AnnotationLabels extends JPanel implements MouseListener, if ((d.height - dif) > 20) { - ap.annotationScroller.setPreferredSize(new Dimension(d.width, - d.height - dif)); + 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.annotationSpaceFillerHolder + .setPreferredSize(new Dimension(d.width, d.height - dif)); ap.paintAlignment(true); } @@ -728,8 +729,8 @@ public class AnnotationLabels extends JPanel implements MouseListener, getSelectedRow(evt.getY() - getScrollOffset()); - if (selectedRow > -1 - && ap.av.getAlignment().getAlignmentAnnotation().length > selectedRow) + if (selectedRow > -1 && ap.av.getAlignment() + .getAlignmentAnnotation().length > selectedRow) { AlignmentAnnotation aa = ap.av.getAlignment() .getAlignmentAnnotation()[selectedRow]; @@ -743,8 +744,8 @@ public class AnnotationLabels extends JPanel implements MouseListener, // tooltips desc.append(aa.getDescription(true).trim()); // check to see if the description is an html fragment. - if (desc.length() < 6 - || (desc.substring(0, 6).toLowerCase().indexOf("") < 0)) + if (desc.length() < 6 || (desc.substring(0, 6).toLowerCase() + .indexOf("") < 0)) { // clean the description ready for embedding in html desc = new StringBuffer(LEFT_ANGLE_BRACKET_PATTERN.matcher(desc) @@ -818,17 +819,16 @@ public class AnnotationLabels extends JPanel implements MouseListener, ap.getSeqPanel().ap.getIdPanel().highlightSearchResults(null); // process modifiers SequenceGroup sg = ap.av.getSelectionGroup(); - if (sg == null - || sg == aa[selectedRow].groupRef - || !(jalview.util.Platform.isControlDown(evt) || evt - .isShiftDown())) + if (sg == null || sg == aa[selectedRow].groupRef + || !(jalview.util.Platform.isControlDown(evt) + || evt.isShiftDown())) { if (jalview.util.Platform.isControlDown(evt) || evt.isShiftDown()) { // clone a new selection group from the associated group - ap.av.setSelectionGroup(new SequenceGroup( - aa[selectedRow].groupRef)); + ap.av.setSelectionGroup( + new SequenceGroup(aa[selectedRow].groupRef)); } else { @@ -870,10 +870,9 @@ public class AnnotationLabels extends JPanel implements MouseListener, { if (evt.getClickCount() == 1) { - ap.getSeqPanel().ap - .getIdPanel() - .highlightSearchResults( - Arrays.asList(new SequenceI[] { aa[selectedRow].sequenceRef })); + ap.getSeqPanel().ap.getIdPanel() + .highlightSearchResults(Arrays.asList(new SequenceI[] + { aa[selectedRow].sequenceRef })); } else if (evt.getClickCount() >= 2) { @@ -884,8 +883,8 @@ public class AnnotationLabels extends JPanel implements MouseListener, // we make a copy rather than edit the current selection if no // modifiers pressed // see Enhancement JAL-1557 - if (!(jalview.util.Platform.isControlDown(evt) || evt - .isShiftDown())) + if (!(jalview.util.Platform.isControlDown(evt) + || evt.isShiftDown())) { sg = new SequenceGroup(sg); sg.clear(); @@ -947,15 +946,14 @@ public class AnnotationLabels extends JPanel implements MouseListener, if (av.hasHiddenColumns()) { omitHidden = av.getAlignment().getHiddenColumns() - .getVisibleSequenceStrings(0, - sq.getLength(), seqs); + .getVisibleSequenceStrings(0, sq.getLength(), seqs); } int[] alignmentStartEnd = new int[] { 0, ds.getWidth() - 1 }; if (av.hasHiddenColumns()) { alignmentStartEnd = av.getAlignment().getHiddenColumns() - .getVisibleStartAndEndIndex(av.getAlignment().getWidth()); + .getVisibleStartAndEndIndex(av.getAlignment().getWidth()); } String output = new FormatAdapter().formatSequences(FileFormat.Fasta, @@ -1065,8 +1063,9 @@ public class AnnotationLabels extends JPanel implements MouseListener, int ofontH = fontHeight; int sOffset = 0; int visHeight = 0; - int[] visr = (ap != null && ap.getAnnotationPanel() != null) ? ap - .getAnnotationPanel().getVisibleVRange() : null; + int[] visr = (ap != null && ap.getAnnotationPanel() != null) + ? ap.getAnnotationPanel().getVisibleVRange() + : null; if (clip && visr != null) { sOffset = visr[0]; @@ -1109,8 +1108,8 @@ public class AnnotationLabels extends JPanel implements MouseListener, { if (debugRedraw) { - System.out.println("Scroll offset: " + sOffset - + " after vis: " + i); + System.out.println( + "Scroll offset: " + sOffset + " after vis: " + i); } after = true; } @@ -1148,7 +1147,8 @@ public class AnnotationLabels extends JPanel implements MouseListener, } if (groupSize * (fontHeight + 8) < aa[i].height) { - graphExtras = (aa[i].height - (groupSize * (fontHeight + 8))) / 2; + graphExtras = (aa[i].height - (groupSize * (fontHeight + 8))) + / 2; } else { @@ -1162,11 +1162,12 @@ public class AnnotationLabels extends JPanel implements MouseListener, { fontHeight = -8 + (int) h; s = ((float) fontHeight) / (float) ofontH; - Font f = baseFont.deriveFont(AffineTransform - .getScaleInstance(s, s)); + Font f = baseFont + .deriveFont(AffineTransform.getScaleInstance(s, s)); g.setFont(f); fm = g.getFontMetrics(); - graphExtras = (aa[i].height - (groupSize * (fontHeight + 8))) / 2; + graphExtras = (aa[i].height - (groupSize * (fontHeight + 8))) + / 2; } } if (visible) @@ -1183,8 +1184,8 @@ public class AnnotationLabels extends JPanel implements MouseListener, g.setColor(aa[gg]._linecolour); g.drawLine(x, y - graphExtras + 3, - x + fm.stringWidth(aa[gg].label), y - graphExtras - + 3); + x + fm.stringWidth(aa[gg].label), + y - graphExtras + 3); } g.setColor(Color.black); diff --git a/src/jalview/gui/AnnotationPanel.java b/src/jalview/gui/AnnotationPanel.java index 61099c3..be8f5f6 100755 --- a/src/jalview/gui/AnnotationPanel.java +++ b/src/jalview/gui/AnnotationPanel.java @@ -285,7 +285,8 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, if (anot.length < av.getColumnSelection().getMax()) { - Annotation[] temp = new Annotation[av.getColumnSelection().getMax() + 2]; + Annotation[] temp = new Annotation[av.getColumnSelection().getMax() + + 2]; System.arraycopy(anot, 0, temp, 0, anot.length); anot = temp; aa[activeRow].annotations = anot; @@ -413,8 +414,8 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, anot[index] = new Annotation(label, "", type, 0); } - anot[index].secondaryStructure = type != 'S' ? type : label - .length() == 0 ? ' ' : label.charAt(0); + anot[index].secondaryStructure = type != 'S' ? type + : label.length() == 0 ? ' ' : label.charAt(0); anot[index].displayCharacter = label; } @@ -658,11 +659,14 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, { if (graphStretch > -1) { - av.getAlignment().getAlignmentAnnotation()[graphStretch].graphHeight += graphStretchY - - evt.getY(); - if (av.getAlignment().getAlignmentAnnotation()[graphStretch].graphHeight < 0) + av.getAlignment() + .getAlignmentAnnotation()[graphStretch].graphHeight += graphStretchY + - evt.getY(); + if (av.getAlignment() + .getAlignmentAnnotation()[graphStretch].graphHeight < 0) { - av.getAlignment().getAlignmentAnnotation()[graphStretch].graphHeight = 0; + av.getAlignment() + .getAlignmentAnnotation()[graphStretch].graphHeight = 0; } graphStretchY = evt.getY(); adjustPanelHeight(); @@ -820,8 +824,7 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, int seqIndex = av.getAlignment().findIndex(seqref); if (seqIndex != -1) { - text.append(", ") - .append(MessageManager.getString("label.sequence")) + text.append(", ").append(MessageManager.getString("label.sequence")) .append(" ").append(seqIndex + 1); char residue = seqref.getCharAt(column); if (!Comparison.isGap(residue)) @@ -830,16 +833,17 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, String name; if (av.getAlignment().isNucleotide()) { - name = ResidueProperties.nucleotideName.get(String - .valueOf(residue)); - text.append(" Nucleotide: ").append( - name != null ? name : residue); + name = ResidueProperties.nucleotideName + .get(String.valueOf(residue)); + text.append(" Nucleotide: ") + .append(name != null ? name : residue); } else { - name = 'X' == residue ? "X" : ('*' == residue ? "STOP" - : ResidueProperties.aa2Triplet.get(String - .valueOf(residue))); + name = 'X' == residue ? "X" + : ('*' == residue ? "STOP" + : ResidueProperties.aa2Triplet + .get(String.valueOf(residue))); text.append(" Residue: ").append(name != null ? name : residue); } int residuePos = seqref.findPosition(column); @@ -913,8 +917,8 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, return; } } - imgWidth = (av.getRanges().getEndRes() - av.getRanges().getStartRes() + 1) - * av.getCharWidth(); + imgWidth = (av.getRanges().getEndRes() - av.getRanges().getStartRes() + + 1) * av.getCharWidth(); if (imgWidth < 1) { return; @@ -924,8 +928,9 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, { try { - image = new BufferedImage(imgWidth, ap.getAnnotationPanel() - .getHeight(), BufferedImage.TYPE_INT_RGB); + image = new BufferedImage(imgWidth, + ap.getAnnotationPanel().getHeight(), + BufferedImage.TYPE_INT_RGB); } catch (OutOfMemoryError oom) { try @@ -955,8 +960,8 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, imageFresh = true; } - drawComponent(gg, av.getRanges().getStartRes(), av.getRanges() - .getEndRes() + 1); + drawComponent(gg, av.getRanges().getStartRes(), + av.getRanges().getEndRes() + 1); imageFresh = false; g.drawImage(image, 0, 0, this); } @@ -1046,8 +1051,8 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, // and draw a faded image until the calculation // has completed if (lastImageGood - && (fadedImage == null || fadedImage.getWidth() != imgWidth || fadedImage - .getHeight() != image.getHeight())) + && (fadedImage == null || fadedImage.getWidth() != imgWidth + || fadedImage.getHeight() != image.getHeight())) { // System.err.println("redraw faded image ("+(fadedImage==null ? // "null image" : "") + " lastGood="+lastImageGood+")"); @@ -1059,8 +1064,8 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, fadedG.setColor(Color.white); fadedG.fillRect(0, 0, imgWidth, image.getHeight()); - fadedG.setComposite(AlphaComposite.getInstance( - AlphaComposite.SRC_OVER, .3f)); + fadedG.setComposite( + AlphaComposite.getInstance(AlphaComposite.SRC_OVER, .3f)); fadedG.drawImage(image, 0, 0, this); } @@ -1101,8 +1106,8 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, return; } - lastImageGood = renderer.drawComponent(this, av, g, activeRow, - startRes, endRes); + lastImageGood = renderer.drawComponent(this, av, g, activeRow, startRes, + endRes); if (!lastImageGood && fadedImage == null) { fadedImage = oldFaded; diff --git a/src/jalview/gui/AnnotationRowFilter.java b/src/jalview/gui/AnnotationRowFilter.java index a3ce528..8b2486f 100644 --- a/src/jalview/gui/AnnotationRowFilter.java +++ b/src/jalview/gui/AnnotationRowFilter.java @@ -98,7 +98,8 @@ public abstract class AnnotationRowFilter extends JPanel * @param viewport * @param alignPanel */ - public AnnotationRowFilter(AlignViewport viewport, final AlignmentPanel alignPanel) + public AnnotationRowFilter(AlignViewport viewport, + final AlignmentPanel alignPanel) { this.av = viewport; this.ap = alignPanel; @@ -148,6 +149,7 @@ public abstract class AnnotationRowFilter extends JPanel } adjusting = oldadj; } + protected void addSliderMouseListeners() { @@ -180,23 +182,25 @@ public abstract class AnnotationRowFilter extends JPanel }); } -/** - * Builds and returns a list of menu items (display text) for choice of - * annotation. Also builds maps between annotations, their positions in the - * list, and their display labels in the list. - * - * @param isSeqAssociated - * @return - */ + /** + * Builds and returns a list of menu items (display text) for choice of + * annotation. Also builds maps between annotations, their positions in the + * list, and their display labels in the list. + * + * @param isSeqAssociated + * @return + */ public Vector getAnnotationItems(boolean isSeqAssociated) { annotationLabels = new HashMap(); Vector list = new Vector(); int index = 1; - int[] anmap = new int[av.getAlignment().getAlignmentAnnotation().length]; + int[] anmap = new int[av.getAlignment() + .getAlignmentAnnotation().length]; seqAssociated.setEnabled(false); - for (int i = 0; i < av.getAlignment().getAlignmentAnnotation().length; i++) + for (int i = 0; i < av.getAlignment() + .getAlignmentAnnotation().length; i++) { AlignmentAnnotation annotation = av.getAlignment() .getAlignmentAnnotation()[i]; @@ -298,9 +302,8 @@ public abstract class AnnotationRowFilter extends JPanel float f = Float.parseFloat(thresholdValue.getText()); if (percentThreshold.isSelected()) { - slider.setValue(slider.getMinimum() - + ((int) ((f / 100f) * (slider.getMaximum() - slider - .getMinimum())))); + slider.setValue(slider.getMinimum() + ((int) ((f / 100f) + * (slider.getMaximum() - slider.getMinimum())))); } else { @@ -379,9 +382,11 @@ public abstract class AnnotationRowFilter extends JPanel } float thr = annotation.threshold.value; - for (int i = 0; i < av.getAlignment().getAlignmentAnnotation().length; i++) + for (int i = 0; i < av.getAlignment() + .getAlignmentAnnotation().length; i++) { - AlignmentAnnotation aa = av.getAlignment().getAlignmentAnnotation()[i]; + AlignmentAnnotation aa = av.getAlignment() + .getAlignmentAnnotation()[i]; if (aa.label.equals(annotation.label) && (annotation.getCalcId() == null ? aa.getCalcId() == null : annotation.getCalcId().equals(aa.getCalcId()))) @@ -451,8 +456,8 @@ public abstract class AnnotationRowFilter extends JPanel selectedAnnotationChanged(); } }); - annotations.setToolTipText(MessageManager - .getString("info.select_annotation_row")); + annotations.setToolTipText( + MessageManager.getString("info.select_annotation_row")); threshold.addActionListener(new ActionListener() { @@ -474,7 +479,8 @@ public abstract class AnnotationRowFilter extends JPanel } }); - percentThreshold.setText(MessageManager.getString("label.as_percentage")); + percentThreshold + .setText(MessageManager.getString("label.as_percentage")); percentThreshold.addActionListener(new ActionListener() { @Override diff --git a/src/jalview/gui/AppJmol.java b/src/jalview/gui/AppJmol.java index 68a847e..a4597d3 100644 --- a/src/jalview/gui/AppJmol.java +++ b/src/jalview/gui/AppJmol.java @@ -89,8 +89,8 @@ public class AppJmol extends StructureViewerBase */ public AppJmol(String[] files, String[] ids, SequenceI[][] seqs, AlignmentPanel ap, boolean usetoColour, boolean useToAlign, - boolean leaveColouringToJmol, String loadStatus, - Rectangle bounds, String viewid) + boolean leaveColouringToJmol, String loadStatus, Rectangle bounds, + String viewid) { PDBEntry[] pdbentrys = new PDBEntry[files.length]; for (int i = 0; i < pdbentrys.length; i++) @@ -133,7 +133,8 @@ public class AppJmol extends StructureViewerBase this.addInternalFrameListener(new InternalFrameAdapter() { @Override - public void internalFrameClosing(InternalFrameEvent internalFrameEvent) + public void internalFrameClosing( + InternalFrameEvent internalFrameEvent) { closeViewer(false); } @@ -218,7 +219,8 @@ public class AppJmol extends StructureViewerBase this.addInternalFrameListener(new InternalFrameAdapter() { @Override - public void internalFrameClosing(InternalFrameEvent internalFrameEvent) + public void internalFrameClosing( + InternalFrameEvent internalFrameEvent) { closeViewer(false); } @@ -281,8 +283,8 @@ public class AppJmol extends StructureViewerBase scriptWindow.setVisible(false); } - jmb.allocateViewer(renderPanel, true, "", null, null, "", - scriptWindow, null); + jmb.allocateViewer(renderPanel, true, "", null, null, "", scriptWindow, + null); // jmb.newJmolPopup("Jmol"); if (command == null) { @@ -293,8 +295,6 @@ public class AppJmol extends StructureViewerBase jmb.setFinishedInit(true); } - - boolean allChainsSelected = false; @Override @@ -410,8 +410,8 @@ public class AppJmol extends StructureViewerBase int waitFor = 35; int waitTotal = 0; while (addingStructures ? lastnotify >= jmb.getLoadNotifiesHandled() - : !(jmb.isFinishedInit() && jmb.getStructureFiles() != null && jmb - .getStructureFiles().length == files.size())) + : !(jmb.isFinishedInit() && jmb.getStructureFiles() != null + && jmb.getStructureFiles().length == files.size())) { try { @@ -423,12 +423,11 @@ public class AppJmol extends StructureViewerBase } if (waitTotal > waitMax) { - System.err - .println("Timed out waiting for Jmol to load files after " - + waitTotal + "ms"); -// System.err.println("finished: " + jmb.isFinishedInit() -// + "; loaded: " + Arrays.toString(jmb.getPdbFile()) -// + "; files: " + files.toString()); + System.err.println("Timed out waiting for Jmol to load files after " + + waitTotal + "ms"); + // System.err.println("finished: " + jmb.isFinishedInit() + // + "; loaded: " + Arrays.toString(jmb.getPdbFile()) + // + "; files: " + files.toString()); jmb.getStructureFiles(); break; } @@ -509,8 +508,9 @@ public class AppJmol extends StructureViewerBase long hdl = pdbid.hashCode() - System.currentTimeMillis(); if (progressBar != null) { - progressBar.setProgressBar(MessageManager.formatMessage( - "status.fetching_pdb", new String[] { pdbid }), hdl); + progressBar.setProgressBar(MessageManager + .formatMessage("status.fetching_pdb", new String[] + { pdbid }), hdl); } try { @@ -576,9 +576,10 @@ public class AppJmol extends StructureViewerBase } if (errormsgs.length() > 0) { - JvOptionPane.showInternalMessageDialog(Desktop.desktop, MessageManager - .formatMessage("label.pdb_entries_couldnt_be_retrieved", - new String[] { errormsgs.toString() }), + JvOptionPane.showInternalMessageDialog(Desktop.desktop, + MessageManager.formatMessage( + "label.pdb_entries_couldnt_be_retrieved", new String[] + { errormsgs.toString() }), MessageManager.getString("label.couldnt_load_file"), JvOptionPane.ERROR_MESSAGE); } @@ -706,8 +707,8 @@ public class AppJmol extends StructureViewerBase if (e == jmb.getPdbCount() - 1 || sb.length() > 20) { lines++; - g.drawString(sb.toString(), 20, currentSize.height / 2 - lines - * g.getFontMetrics().getHeight()); + g.drawString(sb.toString(), 20, currentSize.height / 2 + - lines * g.getFontMetrics().getHeight()); } } } diff --git a/src/jalview/gui/AppJmolBinding.java b/src/jalview/gui/AppJmolBinding.java index f822358..9325172 100644 --- a/src/jalview/gui/AppJmolBinding.java +++ b/src/jalview/gui/AppJmolBinding.java @@ -41,7 +41,8 @@ public class AppJmolBinding extends JalviewJmolBinding private AppJmol appJmolWindow; public AppJmolBinding(AppJmol appJmol, StructureSelectionManager sSm, - PDBEntry[] pdbentry, SequenceI[][] sequenceIs, DataSourceType protocol) + PDBEntry[] pdbentry, SequenceI[][] sequenceIs, + DataSourceType protocol) { super(sSm, pdbentry, sequenceIs, protocol); appJmolWindow = appJmol; @@ -198,8 +199,9 @@ public class AppJmolBinding extends JalviewJmolBinding public jalview.api.FeatureRenderer getFeatureRenderer( AlignmentViewPanel alignment) { - AlignmentPanel ap = (alignment == null) ? appJmolWindow - .getAlignmentPanel() : (AlignmentPanel) alignment; + AlignmentPanel ap = (alignment == null) + ? appJmolWindow.getAlignmentPanel() + : (AlignmentPanel) alignment; if (ap.av.isShowSequenceFeatures()) { return ap.av.getAlignPanel().getSeqPanel().seqCanvas.fr; diff --git a/src/jalview/gui/AppVarna.java b/src/jalview/gui/AppVarna.java index a50de77..1bbe8d8 100644 --- a/src/jalview/gui/AppVarna.java +++ b/src/jalview/gui/AppVarna.java @@ -61,9 +61,9 @@ import fr.orsay.lri.varna.models.annotations.HighlightRegionAnnotation; import fr.orsay.lri.varna.models.rna.ModeleBase; import fr.orsay.lri.varna.models.rna.RNA; -public class AppVarna extends JInternalFrame implements SelectionListener, - SecondaryStructureListener, InterfaceVARNASelectionListener, - VamsasSource +public class AppVarna extends JInternalFrame + implements SelectionListener, SecondaryStructureListener, + InterfaceVARNASelectionListener, VamsasSource { private static final byte[] PAIRS = new byte[] { '(', ')', '[', ']', '{', '}', '<', '>' }; @@ -177,12 +177,15 @@ public class AppVarna extends JInternalFrame implements SelectionListener, { this(ap); - String sname = aa.sequenceRef == null ? "secondary structure (alignment)" + String sname = aa.sequenceRef == null + ? "secondary structure (alignment)" : seq.getName() + " structure"; String theTitle = sname - + (aa.sequenceRef == null ? " trimmed to " + seq.getName() : ""); + + (aa.sequenceRef == null ? " trimmed to " + seq.getName() + : ""); theTitle = MessageManager.formatMessage("label.varna_params", - new String[] { theTitle }); + new String[] + { theTitle }); setTitle(theTitle); String gappedTitle = sname + " (with gaps)"; @@ -190,7 +193,8 @@ public class AppVarna extends JInternalFrame implements SelectionListener, addModel(gappedModel, gappedTitle); String trimmedTitle = "trimmed " + sname; - RnaModel trimmedModel = new RnaModel(trimmedTitle, aa, seq, null, false); + RnaModel trimmedModel = new RnaModel(trimmedTitle, aa, seq, null, + false); addModel(trimmedModel, trimmedTitle); vab.setSelectedIndex(0); } @@ -424,8 +428,8 @@ public class AppVarna extends JInternalFrame implements SelectionListener, end = shift.shift(end); } selectionHighlighter.highlightRegion(rna, start, end); - selectionHighlighter.getLastHighlight().setOutlineColor( - seqsel.getOutlineColour()); + selectionHighlighter.getLastHighlight() + .setOutlineColor(seqsel.getOutlineColour()); // TODO - translate column markings to positions on structure if present. vab.updateSelectedRNA(rna); } @@ -460,7 +464,8 @@ public class AppVarna extends JInternalFrame implements SelectionListener, } @Override - public void onSelectionChanged(BaseList arg0, BaseList arg1, BaseList arg2) + public void onSelectionChanged(BaseList arg0, BaseList arg1, + BaseList arg2) { // TODO translate selected regions in VARNA to a selection on the // alignpanel. @@ -577,7 +582,8 @@ public class AppVarna extends JInternalFrame implements SelectionListener, { if (!model.ann.isValidStruc()) { - throw new IllegalArgumentException("Invalid RNA structure annotation"); + throw new IllegalArgumentException( + "Invalid RNA structure annotation"); } /* @@ -687,7 +693,8 @@ public class AppVarna extends JInternalFrame implements SelectionListener, { if (!model.ann.isValidStruc()) { - throw new IllegalArgumentException("Invalid RNA structure annotation"); + throw new IllegalArgumentException( + "Invalid RNA structure annotation"); } try diff --git a/src/jalview/gui/AppVarnaBinding.java b/src/jalview/gui/AppVarnaBinding.java index 829fc3e..ee4ef79 100644 --- a/src/jalview/gui/AppVarnaBinding.java +++ b/src/jalview/gui/AppVarnaBinding.java @@ -281,8 +281,8 @@ public class AppVarnaBinding extends JalviewVarnaBinding String name = r.getName(); if (name.equals("")) { - name = path.substring(path - .lastIndexOf(File.separatorChar) + 1); + name = path.substring( + path.lastIndexOf(File.separatorChar) + 1); } if (mdls.size() > 1) { diff --git a/src/jalview/gui/AssociatePdbFileWithSeq.java b/src/jalview/gui/AssociatePdbFileWithSeq.java index ddf38c6..fe0aedf 100644 --- a/src/jalview/gui/AssociatePdbFileWithSeq.java +++ b/src/jalview/gui/AssociatePdbFileWithSeq.java @@ -52,8 +52,8 @@ public class AssociatePdbFileWithSeq PDBEntry entry = new PDBEntry(); StructureFile pdbfile = null; pdbfile = StructureSelectionManager.getStructureSelectionManager(ssmp) - .setMapping(false, new SequenceI[] { sequence }, null, choice, - file); + .setMapping(false, new SequenceI[] + { sequence }, null, choice, file); if (pdbfile == null) { // stacktrace already thrown so just return diff --git a/src/jalview/gui/BlogReader.java b/src/jalview/gui/BlogReader.java index ab9aad7..9d68af1 100644 --- a/src/jalview/gui/BlogReader.java +++ b/src/jalview/gui/BlogReader.java @@ -253,10 +253,11 @@ public class BlogReader extends JPanel _channelModel = new ChannelListModel(); // Construct our jalview news channel Channel chan = new Channel(); - chan.setURL(jalview.bin.Cache.getDefault( - "JALVIEW_NEWS_RSS", - jalview.bin.Cache.getDefault("www.jalview.org", - "http://www.jalview.org") + "/feeds/desktop/rss")); + chan.setURL( + jalview.bin.Cache.getDefault("JALVIEW_NEWS_RSS", + jalview.bin.Cache.getDefault("www.jalview.org", + "http://www.jalview.org") + + "/feeds/desktop/rss")); loadLastM(); _channelModel.addChannel(chan); updating = true; @@ -318,8 +319,8 @@ public class BlogReader extends JPanel public void windowClosing(WindowEvent e) { ActionEvent actionEvent = new ActionEvent(this, - ActionEvent.ACTION_FIRST, (String) exitAction - .getValue(Action.NAME)); + ActionEvent.ACTION_FIRST, + (String) exitAction.getValue(Action.NAME)); exitAction.actionPerformed(actionEvent); } @@ -359,8 +360,8 @@ public class BlogReader extends JPanel java.util.Date earliest = null; try { - earliest = new SimpleDateFormat("YYYY-MM-DD").parse(chan - .getHTTPLastModified()); + earliest = new SimpleDateFormat("YYYY-MM-DD") + .parse(chan.getHTTPLastModified()); } catch (Exception x) { } @@ -424,8 +425,8 @@ public class BlogReader extends JPanel } if (lastDate != null) { - String formatted = Cache.setDateProperty( - "JALVIEW_NEWS_RSS_LASTMODIFIED", lastDate); + String formatted = Cache + .setDateProperty("JALVIEW_NEWS_RSS_LASTMODIFIED", lastDate); Cache.log.debug("Saved last read date as " + formatted); } } @@ -529,8 +530,8 @@ public class BlogReader extends JPanel _itemsValueChanged(listItems); } - public class LaunchJvBrowserOnItem extends AbstractAction implements - UpdatableAction + public class LaunchJvBrowserOnItem extends AbstractAction + implements UpdatableAction { JList _listItems = null; @@ -585,7 +586,8 @@ public class BlogReader extends JPanel private JPopupMenu _buildChannelsPopupMenu() { JPopupMenu popup = new JPopupMenu(); - popup.add(new JMenuItem(new MarkChannelAsRead(listChannels, listItems))); + popup.add( + new JMenuItem(new MarkChannelAsRead(listChannels, listItems))); popup.add(new JMenuItem( new MarkChannelAsUnread(listChannels, listItems))); return popup; @@ -609,8 +611,9 @@ public class BlogReader extends JPanel } DefaultListModel itemsModel = (DefaultListModel) listItems.getModel(); itemsModel.clear(); - Iterator iter = (channel.getItems() != null) ? channel.getItems() - .iterator() : Collections.EMPTY_LIST.iterator(); + Iterator iter = (channel.getItems() != null) + ? channel.getItems().iterator() + : Collections.EMPTY_LIST.iterator(); while (iter.hasNext()) { itemsModel.addElement(iter.next()); @@ -706,8 +709,8 @@ public class BlogReader extends JPanel button.setVerticalTextPosition(AbstractButton.BOTTOM); button.setHorizontalTextPosition(AbstractButton.CENTER); } - else if (Boolean.toString(true).equals( - general.get("radioTextRight"))) + else if (Boolean.toString(true) + .equals(general.get("radioTextRight"))) { button.setVerticalTextPosition(AbstractButton.CENTER); button.setHorizontalTextPosition(AbstractButton.RIGHT); @@ -756,8 +759,8 @@ public class BlogReader extends JPanel jalview.bin.Cache.loadProperties(null); jalview.bin.Cache.initLogger(); // test will advance read date each time - Calendar today = Calendar.getInstance(), lastread = Calendar - .getInstance(); + Calendar today = Calendar.getInstance(), + lastread = Calendar.getInstance(); lastread.set(1983, 01, 01); while (lastread.before(today)) { @@ -826,13 +829,10 @@ class ChannelsRenderer extends DefaultListCellRenderer if (value instanceof Channel) { Channel channel = (Channel) value; - component - .setText(MessageManager.formatMessage( - "label.channel_title_item_count", - new String[] { - channel.getTitle(), - Integer.valueOf(channel.getUnreadItemCount()) - .toString() })); + component.setText(MessageManager + .formatMessage("label.channel_title_item_count", new String[] + { channel.getTitle(), Integer + .valueOf(channel.getUnreadItemCount()).toString() })); component.setToolTipText(channel.getURL()); } return component; @@ -857,12 +857,11 @@ class ItemsRenderer extends DefaultListCellRenderer if (item.getPublishDate() != null) { component.setText(MessageManager.formatMessage( - "label.blog_item_published_on_date", - new String[] { - DateFormat - .getDateInstance(DateFormat.LONG, - MessageManager.getLocale()) - .format(item.getPublishDate()).toString(), + "label.blog_item_published_on_date", new String[] + { DateFormat + .getDateInstance(DateFormat.LONG, + MessageManager.getLocale()) + .format(item.getPublishDate()).toString(), item.getTitle() })); } component.setToolTipText(item.getLink()); diff --git a/src/jalview/gui/CalculationChooser.java b/src/jalview/gui/CalculationChooser.java index 8a95594..a9f3966 100644 --- a/src/jalview/gui/CalculationChooser.java +++ b/src/jalview/gui/CalculationChooser.java @@ -164,14 +164,14 @@ public class CalculationChooser extends JPanel JPanel treePanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); treePanel.setOpaque(false); - treePanel.setBorder(BorderFactory.createTitledBorder(MessageManager - .getString("label.tree"))); + treePanel.setBorder(BorderFactory + .createTitledBorder(MessageManager.getString("label.tree"))); // then copy the inset dimensions for the border-less PCA panel JPanel pcaBorderless = new JPanel(new FlowLayout(FlowLayout.LEFT)); Insets b = treePanel.getBorder().getBorderInsets(treePanel); - pcaBorderless.setBorder(BorderFactory.createEmptyBorder(2, b.left, 2, - b.right)); + pcaBorderless.setBorder( + BorderFactory.createEmptyBorder(2, b.left, 2, b.right)); pcaBorderless.setOpaque(false); pcaBorderless.add(pca, FlowLayout.LEFT); @@ -186,7 +186,7 @@ public class CalculationChooser extends JPanel calcTypes.add(pca); calcTypes.add(neighbourJoining); calcTypes.add(averageDistance); - + ActionListener calcChanged = new ActionListener() { @Override @@ -335,8 +335,8 @@ public class CalculationChooser extends JPanel */ private boolean checkEnabled(JRadioButton calc, int size, int minsize) { - String ttip = MessageManager.formatMessage( - "label.you_need_at_least_n_sequences", minsize); + String ttip = MessageManager + .formatMessage("label.you_need_at_least_n_sequences", minsize); calc.setEnabled(size >= minsize); if (!calc.isEnabled()) @@ -383,7 +383,8 @@ public class CalculationChooser extends JPanel @Override public void mouseEntered(MouseEvent e) { - scoreModelsCombo.setToolTipText(tips.get(scoreModelsCombo.getSelectedIndex())); + scoreModelsCombo.setToolTipText( + tips.get(scoreModelsCombo.getSelectedIndex())); } @Override @@ -490,19 +491,17 @@ public class CalculationChooser extends JPanel SequenceGroup sg = viewport.getSelectionGroup(); if (sg != null && sg.getSize() < MIN_TREE_SELECTION) { - JvOptionPane - .showMessageDialog( - Desktop.desktop, - MessageManager - .formatMessage("label.you_need_at_least_n_sequences", + JvOptionPane.showMessageDialog(Desktop.desktop, + MessageManager.formatMessage( + "label.you_need_at_least_n_sequences", MIN_TREE_SELECTION), - MessageManager - .getString("label.not_enough_sequences"), - JvOptionPane.WARNING_MESSAGE); + MessageManager.getString("label.not_enough_sequences"), + JvOptionPane.WARNING_MESSAGE); return; } - String treeType = neighbourJoining.isSelected() ? TreeBuilder.NEIGHBOUR_JOINING + String treeType = neighbourJoining.isSelected() + ? TreeBuilder.NEIGHBOUR_JOINING : TreeBuilder.AVERAGE_DISTANCE; af.newTreePanel(treeType, modelName, params); } @@ -522,14 +521,16 @@ public class CalculationChooser extends JPanel * this check in in case this method gets exposed programmatically in future */ if (((viewport.getSelectionGroup() != null) - && (viewport.getSelectionGroup().getSize() < MIN_PCA_SELECTION) && (viewport - .getSelectionGroup().getSize() > 0)) + && (viewport.getSelectionGroup().getSize() < MIN_PCA_SELECTION) + && (viewport.getSelectionGroup().getSize() > 0)) || (viewport.getAlignment().getHeight() < MIN_PCA_SELECTION)) { - JvOptionPane.showInternalMessageDialog(this, MessageManager - .formatMessage("label.you_need_at_least_n_sequences", - MIN_PCA_SELECTION), MessageManager - .getString("label.sequence_selection_insufficient"), + JvOptionPane.showInternalMessageDialog(this, + MessageManager.formatMessage( + "label.you_need_at_least_n_sequences", + MIN_PCA_SELECTION), + MessageManager + .getString("label.sequence_selection_insufficient"), JvOptionPane.WARNING_MESSAGE); return; } @@ -575,7 +576,8 @@ public class CalculationChooser extends JPanel */ boolean matchGap = doPCA ? false : treeMatchGaps; - return new SimilarityParams(includeGapGap, matchGap, includeGapResidue, matchOnShortestLength); + return new SimilarityParams(includeGapGap, matchGap, includeGapResidue, + matchOnShortestLength); } /** diff --git a/src/jalview/gui/ChimeraViewFrame.java b/src/jalview/gui/ChimeraViewFrame.java index eadc2ad..ba360af 100644 --- a/src/jalview/gui/ChimeraViewFrame.java +++ b/src/jalview/gui/ChimeraViewFrame.java @@ -91,8 +91,8 @@ public class ChimeraViewFrame extends StructureViewerBase viewerActionMenu.setText(MessageManager.getString("label.chimera")); - viewerColour.setText(MessageManager - .getString("label.colour_with_chimera")); + viewerColour + .setText(MessageManager.getString("label.colour_with_chimera")); viewerColour.setToolTipText(MessageManager .getString("label.let_chimera_manage_structure_colours")); @@ -197,8 +197,8 @@ public class ChimeraViewFrame extends StructureViewerBase protected void sendFeaturesToChimera() { int count = jmb.sendFeaturesToViewer(getAlignmentPanel()); - statusBar.setText(MessageManager.formatMessage("label.attributes_set", - count)); + statusBar.setText( + MessageManager.formatMessage("label.attributes_set", count)); } /** @@ -238,7 +238,8 @@ public class ChimeraViewFrame extends StructureViewerBase * a new viewer */ openNewChimera(ap, new PDBEntry[] { pdbentry }, - new SequenceI[][] { seq }); + new SequenceI[][] + { seq }); } /** @@ -277,7 +278,8 @@ public class ChimeraViewFrame extends StructureViewerBase this.addInternalFrameListener(new InternalFrameAdapter() { @Override - public void internalFrameClosing(InternalFrameEvent internalFrameEvent) + public void internalFrameClosing( + InternalFrameEvent internalFrameEvent) { closeViewer(false); } @@ -398,9 +400,8 @@ public class ChimeraViewFrame extends StructureViewerBase boolean opened = jmb.openSession(chimeraSessionFile); if (!opened) { - System.err - .println("An error occurred opening Chimera session file " - + chimeraSessionFile); + System.err.println("An error occurred opening Chimera session file " + + chimeraSessionFile); } } @@ -443,10 +444,9 @@ public class ChimeraViewFrame extends StructureViewerBase { if (!closeChimera) { - String prompt = MessageManager.formatMessage( - "label.confirm_close_chimera", - new Object[] { jmb.getViewerTitle(getViewerName(), - false) }); + String prompt = MessageManager + .formatMessage("label.confirm_close_chimera", new Object[] + { jmb.getViewerTitle(getViewerName(), false) }); prompt = JvSwingUtils.wrapTooltip(true, prompt); int confirm = JvOptionPane.showConfirmDialog(this, prompt, MessageManager.getString("label.close_viewer"), @@ -542,15 +542,16 @@ public class ChimeraViewFrame extends StructureViewerBase } catch (Exception ex) { ex.printStackTrace(); - errormsgs.append("When retrieving pdbfiles for '" - + thePdbEntry.getId() + "'"); + errormsgs.append( + "When retrieving pdbfiles for '" + thePdbEntry.getId() + "'"); } if (errormsgs.length() > 0) { - JvOptionPane.showInternalMessageDialog(Desktop.desktop, MessageManager - .formatMessage("label.pdb_entries_couldnt_be_retrieved", - new Object[] { errormsgs.toString() }), + JvOptionPane.showInternalMessageDialog(Desktop.desktop, + MessageManager.formatMessage( + "label.pdb_entries_couldnt_be_retrieved", new Object[] + { errormsgs.toString() }), MessageManager.getString("label.couldnt_load_file"), JvOptionPane.ERROR_MESSAGE); } @@ -607,8 +608,9 @@ public class ChimeraViewFrame extends StructureViewerBase oomerror); } catch (Exception ex) { - Cache.log.error("Couldn't open " + pe.getFile() - + " in Chimera viewer!", ex); + Cache.log.error( + "Couldn't open " + pe.getFile() + " in Chimera viewer!", + ex); } finally { Cache.log.debug("File locations are " + files); @@ -667,12 +669,13 @@ public class ChimeraViewFrame extends StructureViewerBase { for (int i = 0; i < pdb.getChains().size(); i++) { - String chid = new String(pdb.getId() + ":" - + pdb.getChains().elementAt(i).id); + String chid = new String( + pdb.getId() + ":" + pdb.getChains().elementAt(i).id); jmb.getChainNames().add(chid); jmb.getChainFile().put(chid, file); } } + private String fetchPdbFile(PDBEntry processingEntry) throws Exception { // FIXME: this is duplicated code with Jmol frame ? @@ -687,7 +690,8 @@ public class ChimeraViewFrame extends StructureViewerBase * Write 'fetching PDB' progress on AlignFrame as we are not yet visible */ String msg = MessageManager.formatMessage("status.fetching_pdb", - new Object[] { pdbid }); + new Object[] + { pdbid }); getAlignmentPanel().alignFrame.setProgressBar(msg, handle); // long hdl = startProgressBar(MessageManager.formatMessage( // "status.fetching_pdb", new Object[] @@ -755,17 +759,15 @@ public class ChimeraViewFrame extends StructureViewerBase @Override public void eps_actionPerformed(ActionEvent e) { - throw new Error( - MessageManager - .getString("error.eps_generation_not_implemented")); + throw new Error(MessageManager + .getString("error.eps_generation_not_implemented")); } @Override public void png_actionPerformed(ActionEvent e) { - throw new Error( - MessageManager - .getString("error.png_generation_not_implemented")); + throw new Error(MessageManager + .getString("error.png_generation_not_implemented")); } @Override diff --git a/src/jalview/gui/ColourMenuHelper.java b/src/jalview/gui/ColourMenuHelper.java index 8ffc070..7c3107e 100644 --- a/src/jalview/gui/ColourMenuHelper.java +++ b/src/jalview/gui/ColourMenuHelper.java @@ -100,9 +100,11 @@ public class ColourMenuHelper * the colour scheme (inspected in setColourSelected()) */ final String name = scheme.getSchemeName(); - String label = MessageManager.getStringOrReturn("label.colourScheme_" - + name.toLowerCase().replace(" ", "_"), name); - final JRadioButtonMenuItem radioItem = new JRadioButtonMenuItem(label); + String label = MessageManager.getStringOrReturn( + "label.colourScheme_" + name.toLowerCase().replace(" ", "_"), + name); + final JRadioButtonMenuItem radioItem = new JRadioButtonMenuItem( + label); radioItem.setName(name); radioItem.setEnabled(scheme.isApplicableTo(coll)); if (scheme instanceof UserColourScheme) @@ -137,15 +139,16 @@ public class ColourMenuHelper ActionListener al = radioItem.getActionListeners()[0]; radioItem.removeActionListener(al); int option = JvOptionPane.showInternalConfirmDialog( - Desktop.desktop, MessageManager + Desktop.desktop, + MessageManager .getString("label.remove_from_default_list"), MessageManager .getString("label.remove_user_defined_colour"), JvOptionPane.YES_NO_OPTION); if (option == JvOptionPane.YES_OPTION) { - ColourSchemes.getInstance().removeColourScheme( - radioItem.getName()); + ColourSchemes.getInstance() + .removeColourScheme(radioItem.getName()); colourMenu.remove(radioItem); updatePreferences(); } @@ -183,7 +186,8 @@ public class ColourMenuHelper @Override public void actionPerformed(ActionEvent e) { - client.changeColour_actionPerformed(ResidueColourScheme.USER_DEFINED_MENU); + client.changeColour_actionPerformed( + ResidueColourScheme.USER_DEFINED_MENU); } }); colourMenu.add(userDefinedColour); @@ -197,16 +201,16 @@ public class ColourMenuHelper * Marks as selected the colour menu item matching the given colour scheme, or * the first item ('None') if no match is found. If the colour scheme is a * user defined scheme, but not in the menu (this arises if a new scheme is - * defined and applied but not saved to file), then menu option - * "User Defined.." is selected. + * defined and applied but not saved to file), then menu option "User + * Defined.." is selected. * * @param colourMenu * @param cs */ public static void setColourSelected(JMenu colourMenu, ColourSchemeI cs) { - String colourName = cs == null ? ResidueColourScheme.NONE : cs - .getSchemeName(); + String colourName = cs == null ? ResidueColourScheme.NONE + : cs.getSchemeName(); JRadioButtonMenuItem none = null; JRadioButtonMenuItem userDefined = null; diff --git a/src/jalview/gui/Console.java b/src/jalview/gui/Console.java index de7574c..4c019a6 100644 --- a/src/jalview/gui/Console.java +++ b/src/jalview/gui/Console.java @@ -53,8 +53,8 @@ import org.apache.log4j.SimpleLayout; * own applications RJHM van den Bergh , rvdb@comweb.nl */ -public class Console extends WindowAdapter implements WindowListener, - ActionListener, Runnable +public class Console extends WindowAdapter + implements WindowListener, ActionListener, Runnable { private JFrame frame; @@ -305,8 +305,8 @@ public class Console extends WindowAdapter implements WindowListener, } else { - frame = initFrame("Jalview Java Console", bounds.width, - bounds.height, bounds.x, bounds.y); + frame = initFrame("Jalview Java Console", bounds.width, bounds.height, + bounds.x, bounds.y); } frame.setMinimumSize(new Dimension(MIN_WIDTH, MIN_HEIGHT)); // desktop.add(frame); @@ -522,8 +522,8 @@ public class Console extends WindowAdapter implements WindowListener, textArea.append("The error is: " + e.getMessage()); // Need to uncomment this to ensure that line tally is synched. // lines += 2; - stderr.println("Console reports an Internal error.\nThe error is: " - + e); + stderr.println( + "Console reports an Internal error.\nThe error is: " + e); } // just for testing (Throw a Nullpointer after 1 second) diff --git a/src/jalview/gui/CrossRefAction.java b/src/jalview/gui/CrossRefAction.java index 7768b22..01ee1ff 100644 --- a/src/jalview/gui/CrossRefAction.java +++ b/src/jalview/gui/CrossRefAction.java @@ -67,10 +67,9 @@ public class CrossRefAction implements Runnable public void run() { final long sttime = System.currentTimeMillis(); - alignFrame.setProgressBar( - MessageManager.formatMessage( - "status.searching_for_sequences_from", - new Object[] { source }), sttime); + alignFrame.setProgressBar(MessageManager.formatMessage( + "status.searching_for_sequences_from", new Object[] + { source }), sttime); try { AlignmentI alignment = alignFrame.getViewport().getAlignment(); @@ -85,8 +84,8 @@ public class CrossRefAction implements Runnable + " now searching for " + (dna ? "DNA" : "Protein") + " Context."); } - AlignmentI xrefs = new CrossRef(sel, dataset).findXrefSequences( - source, dna); + AlignmentI xrefs = new CrossRef(sel, dataset) + .findXrefSequences(source, dna); if (xrefs == null) { return; @@ -159,8 +158,8 @@ public class CrossRefAction implements Runnable if (copyAlignment.getHeight() <= 0) { - System.err.println("No Sequences generated for xRef type " - + source); + System.err.println( + "No Sequences generated for xRef type " + source); return; } /* @@ -258,8 +257,8 @@ public class CrossRefAction implements Runnable } finally { alignFrame.setProgressBar(MessageManager.formatMessage( - "status.finished_searching_for_sequences_from", - new Object[] { source }), sttime); + "status.finished_searching_for_sequences_from", new Object[] + { source }), sttime); } } @@ -280,9 +279,8 @@ public class CrossRefAction implements Runnable for (int s = 0; s < sprods.length; s++) { sprods[s] = (seqs.getSequenceAt(s)).deriveSequence(); - if (dataset.getSequences() == null - || !dataset.getSequences().contains( - sprods[s].getDatasetSequence())) + if (dataset.getSequences() == null || !dataset.getSequences() + .contains(sprods[s].getDatasetSequence())) { dataset.addSequence(sprods[s].getDatasetSequence()); } diff --git a/src/jalview/gui/CutAndPasteHtmlTransfer.java b/src/jalview/gui/CutAndPasteHtmlTransfer.java index dae83d1..71a1520 100644 --- a/src/jalview/gui/CutAndPasteHtmlTransfer.java +++ b/src/jalview/gui/CutAndPasteHtmlTransfer.java @@ -152,8 +152,8 @@ public class CutAndPasteHtmlTransfer extends GCutAndPasteHtmlTransfer chooser.setAcceptAllFileFilterUsed(false); chooser.setFileView(new JalviewFileView()); - chooser.setDialogTitle(MessageManager - .getString("label.save_text_to_file")); + chooser.setDialogTitle( + MessageManager.getString("label.save_text_to_file")); chooser.setToolTipText(MessageManager.getString("action.save")); int value = chooser.showSaveDialog(this); @@ -179,8 +179,8 @@ public class CutAndPasteHtmlTransfer extends GCutAndPasteHtmlTransfer public void toggleHtml_actionPerformed(ActionEvent e) { String txt = textarea.getText(); - textarea.setContentType(displaySource.isSelected() ? "text/text" - : "text/html"); + textarea.setContentType( + displaySource.isSelected() ? "text/text" : "text/html"); textarea.setText(txt); } diff --git a/src/jalview/gui/CutAndPasteTransfer.java b/src/jalview/gui/CutAndPasteTransfer.java index a5aa9eb..7b8ade6 100644 --- a/src/jalview/gui/CutAndPasteTransfer.java +++ b/src/jalview/gui/CutAndPasteTransfer.java @@ -140,8 +140,8 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer chooser.setAcceptAllFileFilterUsed(false); chooser.setFileView(new JalviewFileView()); - chooser.setDialogTitle(MessageManager - .getString("label.save_text_to_file")); + chooser.setDialogTitle( + MessageManager.getString("label.save_text_to_file")); chooser.setToolTipText(MessageManager.getString("action.save")); int value = chooser.showSaveDialog(this); @@ -150,8 +150,8 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer { try { - PrintWriter out = new PrintWriter(new FileWriter( - chooser.getSelectedFile())); + PrintWriter out = new PrintWriter( + new FileWriter(chooser.getSelectedFile())); out.print(getText()); out.close(); @@ -196,8 +196,8 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer try { - textarea.append((String) contents - .getTransferData(DataFlavor.stringFlavor)); + textarea.append( + (String) contents.getTransferData(DataFlavor.stringFlavor)); } catch (Exception ex) { } @@ -228,8 +228,8 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer } if (format == null) { - System.err.println(MessageManager - .getString("label.couldnt_read_data")); + System.err + .println(MessageManager.getString("label.couldnt_read_data")); if (!Jalview.isHeadlessMode()) { JvOptionPane.showInternalMessageDialog(Desktop.desktop, @@ -253,16 +253,16 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer { JvOptionPane.showInternalMessageDialog(Desktop.desktop, MessageManager .formatMessage("label.couldnt_read_pasted_text", new String[] - { ex.toString() }), MessageManager - .getString("label.error_parsing_text"), + { ex.toString() }), + MessageManager.getString("label.error_parsing_text"), JvOptionPane.WARNING_MESSAGE); } if (al != null && al.hasValidSequence()) { - String title = MessageManager.formatMessage( - "label.input_cut_paste_params", - new String[] { format.getName() }); + String title = MessageManager + .formatMessage("label.input_cut_paste_params", new String[] + { format.getName() }); FeatureSettingsModelI proxyColourScheme = source .getFeatureColourScheme(); @@ -298,8 +298,8 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT); af.getViewport().setShowSequenceFeatures(showSeqFeatures); af.getViewport().setFeaturesDisplayed(fd); - ColourSchemeI cs = ColourSchemeMapper.getJalviewColourScheme( - colourSchemeName, al); + ColourSchemeI cs = ColourSchemeMapper + .getJalviewColourScheme(colourSchemeName, al); if (cs != null) { af.changeColour(cs); @@ -326,8 +326,8 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer try { - af.setMaximum(jalview.bin.Cache.getDefault("SHOW_FULLSCREEN", - false)); + af.setMaximum( + jalview.bin.Cache.getDefault("SHOW_FULLSCREEN", false)); } catch (Exception ex) { } @@ -335,8 +335,8 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer } else { - System.err.println(MessageManager - .getString("label.couldnt_read_data")); + System.err + .println(MessageManager.getString("label.couldnt_read_data")); if (!Jalview.isHeadlessMode()) { JvOptionPane.showInternalMessageDialog(Desktop.desktop, diff --git a/src/jalview/gui/DasSourceBrowser.java b/src/jalview/gui/DasSourceBrowser.java index c5ec067..8570ac3 100644 --- a/src/jalview/gui/DasSourceBrowser.java +++ b/src/jalview/gui/DasSourceBrowser.java @@ -52,8 +52,8 @@ import org.biodas.jdas.schema.sources.COORDINATES; import org.biodas.jdas.schema.sources.PROP; import org.biodas.jdas.schema.sources.VERSION; -public class DasSourceBrowser extends GDasSourceBrowser implements - Runnable, ListSelectionListener +public class DasSourceBrowser extends GDasSourceBrowser + implements Runnable, ListSelectionListener { DasSourceRegistryI sourceRegistry = null; @@ -138,8 +138,8 @@ public class DasSourceBrowser extends GDasSourceBrowser implements for (int i = 0; i < dSize; i++) { data[i][0] = sources.get(i).getTitle(); // what's equivalent of nickname - data[i][1] = new Boolean(selectedSources.contains(sources.get(i) - .getTitle())); + data[i][1] = new Boolean( + selectedSources.contains(sources.get(i).getTitle())); } refreshTableData(data); @@ -177,9 +177,8 @@ public class DasSourceBrowser extends GDasSourceBrowser implements if (nickName == null) { - fullDetails.setText(text - + MessageManager - .getString("label.select_das_service_from_table")); + fullDetails.setText(text + MessageManager + .getString("label.select_das_service_from_table")); return; } @@ -192,8 +191,8 @@ public class DasSourceBrowser extends GDasSourceBrowser implements } VERSION latest = ds.getVersion(); - text.append("Id: " + ds.getUri() - + "
    "); + text.append( + "Id: " + ds.getUri() + "
    "); text.append("Nickname: " + ds.getTitle() + "
    "); @@ -212,8 +211,10 @@ public class DasSourceBrowser extends GDasSourceBrowser implements text.append("Description: " + ds.getDescription() + "
    "); - text.append("Admin Email: " + ds.getEmail() + "" + "
    "); + text.append( + "Admin Email: " + ds.getEmail() + "" + + "
    "); text.append("Registered at: " + latest.getCreated() + "
    "); @@ -460,8 +461,7 @@ public class DasSourceBrowser extends GDasSourceBrowser implements panel.add(pane12, BorderLayout.SOUTH); int reply = JvOptionPane.showInternalConfirmDialog(Desktop.desktop, - panel, - MessageManager.getString("label.enter_local_das_source"), + panel, MessageManager.getString("label.enter_local_das_source"), JvOptionPane.OK_CANCEL_OPTION); if (reply != JvOptionPane.OK_OPTION) @@ -474,19 +474,21 @@ public class DasSourceBrowser extends GDasSourceBrowser implements urltf.setText(urltf.getText() + "/"); } - jalviewSourceI local = sourceRegistry.createLocalSource( - urltf.getText(), nametf.getText(), seqs.isSelected(), true); + jalviewSourceI local = sourceRegistry.createLocalSource(urltf.getText(), + nametf.getText(), seqs.isSelected(), true); List sources = sourceRegistry.getSources(); int osize = sources.size(); int size = osize + (newSource ? 1 : 0); Object[][] data = new Object[size][2]; - DASTableModel dtm = (table != null) ? (DASTableModel) ((TableSorter) table - .getModel()).getTableModel() : null; + DASTableModel dtm = (table != null) + ? (DASTableModel) ((TableSorter) table.getModel()) + .getTableModel() + : null; for (int i = 0; i < osize; i++) { - String osrc = (dtm == null || i >= osize) ? null : (String) dtm - .getValueAt(i, 0); + String osrc = (dtm == null || i >= osize) ? null + : (String) dtm.getValueAt(i, 0); if (!newSource && osrc != null && dtm.getValueAt(i, 0).equals(nickname)) { @@ -514,8 +516,8 @@ public class DasSourceBrowser extends GDasSourceBrowser implements @Override public void run() { - scrollPane.getVerticalScrollBar().setValue( - scrollPane.getVerticalScrollBar().getMaximum()); + scrollPane.getVerticalScrollBar() + .setValue(scrollPane.getVerticalScrollBar().getMaximum()); } }); @@ -534,13 +536,11 @@ public class DasSourceBrowser extends GDasSourceBrowser implements if (!sourceRegistry.getSource(nickname).isLocal()) { - JvOptionPane - .showInternalMessageDialog( - Desktop.desktop, - MessageManager - .getString("label.you_can_only_edit_or_remove_local_das_sources"), - MessageManager.getString("label.public_das_source"), - JvOptionPane.WARNING_MESSAGE); + JvOptionPane.showInternalMessageDialog(Desktop.desktop, + MessageManager.getString( + "label.you_can_only_edit_or_remove_local_das_sources"), + MessageManager.getString("label.public_das_source"), + JvOptionPane.WARNING_MESSAGE); return; } @@ -548,8 +548,8 @@ public class DasSourceBrowser extends GDasSourceBrowser implements int choice = JvOptionPane.showInternalOptionDialog(Desktop.desktop, "Do you want to edit or remove " + nickname + "?", "Edit / Remove Local DAS Source", - JvOptionPane.YES_NO_CANCEL_OPTION, JvOptionPane.QUESTION_MESSAGE, - null, options, options[2]); + JvOptionPane.YES_NO_CANCEL_OPTION, + JvOptionPane.QUESTION_MESSAGE, null, options, options[2]); switch (choice) { @@ -560,8 +560,7 @@ public class DasSourceBrowser extends GDasSourceBrowser implements sourceRegistry.removeLocalSource(sourceRegistry.getSource(nickname)); selectedSources.remove(nickname); Object[][] data = new Object[sourceRegistry.getSources().size()][2]; - int index = 0, - l = table.getRowCount(); + int index = 0, l = table.getRowCount(); for (int i = 0; i < l; i++) { @@ -583,8 +582,8 @@ public class DasSourceBrowser extends GDasSourceBrowser implements @Override public void run() { - scrollPane.getVerticalScrollBar().setValue( - scrollPane.getVerticalScrollBar().getMaximum()); + scrollPane.getVerticalScrollBar() + .setValue(scrollPane.getVerticalScrollBar().getMaximum()); } }); @@ -618,11 +617,10 @@ public class DasSourceBrowser extends GDasSourceBrowser implements VERSION v = ds.getVersion(); List coords = v.getCOORDINATES(); - if (ds.isLocal() - || ((coords == null || coords.size() == 0) - && filter1.getSelectedIndex() == 0 - && filter2.getSelectedIndex() == 0 && filter3 - .getSelectedIndex() == 0)) + if (ds.isLocal() || ((coords == null || coords.size() == 0) + && filter1.getSelectedIndex() == 0 + && filter2.getSelectedIndex() == 0 + && filter3.getSelectedIndex() == 0)) { // THIS IS A FIX FOR LOCAL SOURCES WHICH DO NOT // HAVE COORDINATE SYSTEMS, INFO WHICH AT PRESENT @@ -642,12 +640,14 @@ public class DasSourceBrowser extends GDasSourceBrowser implements for (int j = 0; j < coords.size(); j++) { if (selectedInList(filter1.getSelectedValues(), - new String[] { coords.get(j).getAuthority() }) + new String[] + { coords.get(j).getAuthority() }) && selectedInList(filter2.getSelectedValues(), new String[] { coords.get(j).getSource() })) { names.add(ds.getTitle()); - selected.add(new Boolean(selectedSources.contains(ds.getTitle()))); + selected.add( + new Boolean(selectedSources.contains(ds.getTitle()))); break; } } diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index d076ba0..c8d900d 100644 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -125,8 +125,8 @@ import javax.swing.event.MenuListener; * @author $author$ * @version $Revision: 1.155 $ */ -public class Desktop extends jalview.jbgui.GDesktop implements - DropTargetListener, ClipboardOwner, IProgressIndicator, +public class Desktop extends jalview.jbgui.GDesktop + implements DropTargetListener, ClipboardOwner, IProgressIndicator, jalview.api.StructureSelectionManagerProvider { private static int DEFAULT_MIN_WIDTH = 300; @@ -341,8 +341,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); boolean selmemusage = jalview.bin.Cache.getDefault("SHOW_MEMUSAGE", false); - boolean showjconsole = jalview.bin.Cache.getDefault( - "SHOW_JAVA_CONSOLE", false); + boolean showjconsole = jalview.bin.Cache.getDefault("SHOW_JAVA_CONSOLE", + false); desktop = new MyDesktopPane(selmemusage); if (Platform.isAMac()) { @@ -360,8 +360,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements // This line prevents Windows Look&Feel resizing all new windows to maximum // if previous window was maximised - desktop.setDesktopManager(new MyDesktopManager( - new DefaultDesktopManager())); + desktop.setDesktopManager( + new MyDesktopManager(new DefaultDesktopManager())); Rectangle dims = getLastKnownDimensions(""); if (dims != null) @@ -371,26 +371,28 @@ public class Desktop extends jalview.jbgui.GDesktop implements else { Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); - setBounds((screenSize.width - 900) / 2, - (screenSize.height - 650) / 2, 900, 650); + setBounds((screenSize.width - 900) / 2, (screenSize.height - 650) / 2, + 900, 650); } jconsole = new Console(this, showjconsole); // add essential build information - jconsole.setHeader("Jalview Version: " - + jalview.bin.Cache.getProperty("VERSION") + "\n" - + "Jalview Installation: " - + jalview.bin.Cache.getDefault("INSTALLATION", "unknown") - + "\n" + "Build Date: " - + jalview.bin.Cache.getDefault("BUILD_DATE", "unknown") + "\n" - + "Java version: " + System.getProperty("java.version") + "\n" - + System.getProperty("os.arch") + " " - + System.getProperty("os.name") + " " - + System.getProperty("os.version")); + jconsole.setHeader( + "Jalview Version: " + jalview.bin.Cache.getProperty("VERSION") + + "\n" + "Jalview Installation: " + + jalview.bin.Cache.getDefault("INSTALLATION", + "unknown") + + "\n" + "Build Date: " + + jalview.bin.Cache.getDefault("BUILD_DATE", "unknown") + + "\n" + "Java version: " + + System.getProperty("java.version") + "\n" + + System.getProperty("os.arch") + " " + + System.getProperty("os.name") + " " + + System.getProperty("os.version")); showConsole(showjconsole); showNews.setVisible(false); - + experimentalFeatures.setSelected(showExperimental()); getIdentifiersOrgData(); @@ -508,12 +510,12 @@ public class Desktop extends jalview.jbgui.GDesktop implements .getStructureSelectionManager(this); if (jalview.bin.Cache.getDefault(Preferences.ADD_SS_ANN, true)) { - ssm.setAddTempFacAnnot(jalview.bin.Cache.getDefault( - Preferences.ADD_TEMPFACT_ANN, true)); - ssm.setProcessSecondaryStructure(jalview.bin.Cache.getDefault( - Preferences.STRUCT_FROM_PDB, true)); - ssm.setSecStructServices(jalview.bin.Cache.getDefault( - Preferences.USE_RNAVIEW, true)); + ssm.setAddTempFacAnnot(jalview.bin.Cache + .getDefault(Preferences.ADD_TEMPFACT_ANN, true)); + ssm.setProcessSecondaryStructure(jalview.bin.Cache + .getDefault(Preferences.STRUCT_FROM_PDB, true)); + ssm.setSecStructServices( + jalview.bin.Cache.getDefault(Preferences.USE_RNAVIEW, true)); } else { @@ -584,7 +586,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements { long now = System.currentTimeMillis(); Desktop.instance.setProgressBar( - MessageManager.getString("status.refreshing_news"), now); + MessageManager.getString("status.refreshing_news"), + now); jvnews.refreshNews(); Desktop.instance.setProgressBar(null, now); jvnews.showNews(); @@ -608,25 +611,23 @@ public class Desktop extends jalview.jbgui.GDesktop implements Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); String x = jalview.bin.Cache.getProperty(windowName + "SCREEN_X"); String y = jalview.bin.Cache.getProperty(windowName + "SCREEN_Y"); - String width = jalview.bin.Cache.getProperty(windowName - + "SCREEN_WIDTH"); - String height = jalview.bin.Cache.getProperty(windowName - + "SCREEN_HEIGHT"); + String width = jalview.bin.Cache + .getProperty(windowName + "SCREEN_WIDTH"); + String height = jalview.bin.Cache + .getProperty(windowName + "SCREEN_HEIGHT"); if ((x != null) && (y != null) && (width != null) && (height != null)) { - int ix = Integer.parseInt(x), iy = Integer.parseInt(y), iw = Integer - .parseInt(width), ih = Integer.parseInt(height); + int ix = Integer.parseInt(x), iy = Integer.parseInt(y), + iw = Integer.parseInt(width), ih = Integer.parseInt(height); if (jalview.bin.Cache.getProperty("SCREENGEOMETRY_WIDTH") != null) { // attempt #1 - try to cope with change in screen geometry - this // version doesn't preserve original jv aspect ratio. // take ratio of current screen size vs original screen size. - double sw = ((1f * screenSize.width) / (1f * Integer - .parseInt(jalview.bin.Cache - .getProperty("SCREENGEOMETRY_WIDTH")))); - double sh = ((1f * screenSize.height) / (1f * Integer - .parseInt(jalview.bin.Cache - .getProperty("SCREENGEOMETRY_HEIGHT")))); + double sw = ((1f * screenSize.width) / (1f * Integer.parseInt( + jalview.bin.Cache.getProperty("SCREENGEOMETRY_WIDTH")))); + double sh = ((1f * screenSize.height) / (1f * Integer.parseInt( + jalview.bin.Cache.getProperty("SCREENGEOMETRY_HEIGHT")))); // rescale the bounds depending upon the current screen geometry. ix = (int) (ix * sw); iw = (int) (iw * sw); @@ -634,19 +635,19 @@ public class Desktop extends jalview.jbgui.GDesktop implements ih = (int) (ih * sh); while (ix >= screenSize.width) { - jalview.bin.Cache.log - .debug("Window geometry location recall error: shifting horizontal to within screenbounds."); + jalview.bin.Cache.log.debug( + "Window geometry location recall error: shifting horizontal to within screenbounds."); ix -= screenSize.width; } while (iy >= screenSize.height) { - jalview.bin.Cache.log - .debug("Window geometry location recall error: shifting vertical to within screenbounds."); + jalview.bin.Cache.log.debug( + "Window geometry location recall error: shifting vertical to within screenbounds."); iy -= screenSize.height; } - jalview.bin.Cache.log.debug("Got last known dimensions for " - + windowName + ": x:" + ix + " y:" + iy + " width:" + iw - + " height:" + ih); + jalview.bin.Cache.log.debug( + "Got last known dimensions for " + windowName + ": x:" + ix + + " y:" + iy + " width:" + iw + " height:" + ih); } // return dimensions for new instance return new Rectangle(ix, iy, iw, ih); @@ -732,9 +733,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements } } catch (Exception ex) { - System.out - .println("Unable to paste alignment from system clipboard:\n" - + ex); + System.out.println( + "Unable to paste alignment from system clipboard:\n" + ex); } } @@ -837,9 +837,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements // A HEADLESS STATE WHEN NO DESKTOP EXISTS. MUST RETURN // IF JALVIEW IS RUNNING HEADLESS // /////////////////////////////////////////////// - if (instance == null - || (System.getProperty("java.awt.headless") != null && System - .getProperty("java.awt.headless").equals("true"))) + if (instance == null || (System.getProperty("java.awt.headless") != null + && System.getProperty("java.awt.headless").equals("true"))) { return; } @@ -848,8 +847,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements if (!ignoreMinSize) { - frame.setMinimumSize(new Dimension(DEFAULT_MIN_WIDTH, - DEFAULT_MIN_HEIGHT)); + frame.setMinimumSize( + new Dimension(DEFAULT_MIN_WIDTH, DEFAULT_MIN_HEIGHT)); // Set default dimension for Alignment Frame window. // The Alignment Frame window could be added from a number of places, @@ -862,7 +861,6 @@ public class Desktop extends jalview.jbgui.GDesktop implements } } - frame.setVisible(makeVisible); frame.setClosable(true); frame.setResizable(resizable); @@ -877,8 +875,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements } if (frame.getX() < 1 && frame.getY() < 1) { - frame.setLocation(xOffset * openFrameCount, yOffset - * ((openFrameCount - 1) % 10) + yOffset); + frame.setLocation(xOffset * openFrameCount, + yOffset * ((openFrameCount - 1) % 10) + yOffset); } /* @@ -962,9 +960,9 @@ public class Desktop extends jalview.jbgui.GDesktop implements { } catch (java.lang.ClassCastException cex) { - Cache.log - .warn("Squashed a possible GUI implementation error. If you can recreate this, please look at http://issues.jalview.org/browse/JAL-869", - cex); + Cache.log.warn( + "Squashed a possible GUI implementation error. If you can recreate this, please look at http://issues.jalview.org/browse/JAL-869", + cex); } } @@ -1032,7 +1030,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements for (int i = 0; i < files.size(); i++) { String file = files.get(i).toString(); - DataSourceType protocol = (protocols == null) ? DataSourceType.FILE + DataSourceType protocol = (protocols == null) + ? DataSourceType.FILE : protocols.get(i); FileFormatI format = null; @@ -1068,12 +1067,12 @@ public class Desktop extends jalview.jbgui.GDesktop implements public void inputLocalFileMenuItem_actionPerformed(AlignViewport viewport) { String fileFormat = Cache.getProperty("DEFAULT_FILE_FORMAT"); - JalviewFileChooser chooser = JalviewFileChooser.forRead( - Cache.getProperty("LAST_DIRECTORY"), fileFormat); + JalviewFileChooser chooser = JalviewFileChooser + .forRead(Cache.getProperty("LAST_DIRECTORY"), fileFormat); chooser.setFileView(new JalviewFileView()); - chooser.setDialogTitle(MessageManager - .getString("label.open_local_file")); + chooser.setDialogTitle( + MessageManager.getString("label.open_local_file")); chooser.setToolTipText(MessageManager.getString("action.open")); int value = chooser.showOpenDialog(this); @@ -1081,8 +1080,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements if (value == JalviewFileChooser.APPROVE_OPTION) { String choice = chooser.getSelectedFile().getPath(); - Cache.setProperty("LAST_DIRECTORY", chooser - .getSelectedFile().getParent()); + Cache.setProperty("LAST_DIRECTORY", + chooser.getSelectedFile().getParent()); FileFormatI format = chooser.getSelectedFormat(); @@ -1190,8 +1189,9 @@ public class Desktop extends jalview.jbgui.GDesktop implements { JvOptionPane.showInternalMessageDialog(Desktop.desktop, MessageManager.formatMessage("label.couldnt_locate", - new Object[] { url }), MessageManager - .getString("label.url_not_found"), + new Object[] + { url }), + MessageManager.getString("label.url_not_found"), JvOptionPane.WARNING_MESSAGE); return; @@ -1199,8 +1199,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements if (viewport != null) { - new FileLoader() - .LoadFile(viewport, url, DataSourceType.URL, format); + new FileLoader().LoadFile(viewport, url, DataSourceType.URL, + format); } else { @@ -1223,8 +1223,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements CutAndPasteTransfer cap = new CutAndPasteTransfer(); cap.setForInput(viewPanel); Desktop.addInternalFrame(cap, - MessageManager.getString("label.cut_paste_alignmen_file"), - true, 600, 500); + MessageManager.getString("label.cut_paste_alignmen_file"), true, + 600, 500); } /* @@ -1234,12 +1234,12 @@ public class Desktop extends jalview.jbgui.GDesktop implements public void quit() { Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); - jalview.bin.Cache - .setProperty("SCREENGEOMETRY_WIDTH", screen.width + ""); - jalview.bin.Cache.setProperty("SCREENGEOMETRY_HEIGHT", screen.height - + ""); - storeLastKnownDimensions("", new Rectangle(getBounds().x, - getBounds().y, getWidth(), getHeight())); + jalview.bin.Cache.setProperty("SCREENGEOMETRY_WIDTH", + screen.width + ""); + jalview.bin.Cache.setProperty("SCREENGEOMETRY_HEIGHT", + screen.height + ""); + storeLastKnownDimensions("", new Rectangle(getBounds().x, getBounds().y, + getWidth(), getHeight())); if (jconsole != null) { @@ -1308,7 +1308,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements if (shortv) { message.append("

    Version: " - + jalview.bin.Cache.getProperty("VERSION") + "

    "); + + jalview.bin.Cache.getProperty("VERSION") + + ""); message.append("Last Updated: " + jalview.bin.Cache.getDefault("BUILD_DATE", "unknown") + ""); @@ -1323,8 +1324,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements + jalview.bin.Cache.getDefault("BUILD_DATE", "unknown")); } - if (jalview.bin.Cache.getDefault("LATEST_VERSION", "Checking").equals( - "Checking")) + if (jalview.bin.Cache.getDefault("LATEST_VERSION", "Checking") + .equals("Checking")) { message.append("
    ...Checking latest version...
    "); } @@ -1346,16 +1347,16 @@ public class Desktop extends jalview.jbgui.GDesktop implements "..Checking..") + " is available for download from " + jalview.bin.Cache.getDefault("www.jalview.org", - "http://www.jalview.org") + " !!"); + "http://www.jalview.org") + + " !!"); if (red) { message.append(""); } } - message.append("
    Authors: " - + jalview.bin.Cache - .getDefault("AUTHORFNAMES", - "The Jalview Authors (See AUTHORS file for current list)") + message.append("
    Authors: " + jalview.bin.Cache.getDefault( + "AUTHORFNAMES", + "The Jalview Authors (See AUTHORS file for current list)") + "

    Development managed by The Barton Group, University of Dundee, Scotland, UK.
    " + "

    For help, see the FAQ at www.jalview.org/faq and/or join the jalview-discuss@jalview.org mailing list" + "

    If you use Jalview, please cite:" @@ -1486,8 +1487,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements { showConsole.setSelected(selected); // TODO: decide if we should update properties file - Cache.setProperty("SHOW_JAVA_CONSOLE", Boolean.valueOf(selected) - .toString()); + Cache.setProperty("SHOW_JAVA_CONSOLE", + Boolean.valueOf(selected).toString()); jconsole.setVisible(selected); } @@ -1610,8 +1611,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements { // TODO: refactor to Jalview desktop session controller action. setProgressBar(MessageManager.formatMessage( - "label.saving_jalview_project", - new Object[] { choice.getName() }), choice.hashCode()); + "label.saving_jalview_project", new Object[] + { choice.getName() }), choice.hashCode()); jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice.getParent()); // TODO catch and handle errors for savestate @@ -1621,17 +1622,20 @@ public class Desktop extends jalview.jbgui.GDesktop implements new Jalview2XML().saveState(choice); } catch (OutOfMemoryError oom) { - new OOMWarning("Whilst saving current state to " - + choice.getName(), oom); + new OOMWarning( + "Whilst saving current state to " + choice.getName(), + oom); } catch (Exception ex) { Cache.log.error( "Problems whilst trying to save to " + choice.getName(), ex); - JvOptionPane.showMessageDialog(me, MessageManager.formatMessage( - "label.error_whilst_saving_current_state_to", - new Object[] { choice.getName() }), MessageManager - .getString("label.couldnt_save_project"), + JvOptionPane.showMessageDialog(me, + MessageManager.formatMessage( + "label.error_whilst_saving_current_state_to", + new Object[] + { choice.getName() }), + MessageManager.getString("label.couldnt_save_project"), JvOptionPane.WARNING_MESSAGE); } setProgressBar(null, choice.hashCode()); @@ -1660,9 +1664,11 @@ public class Desktop extends jalview.jbgui.GDesktop implements public void loadState_actionPerformed(ActionEvent e) { JalviewFileChooser chooser = new JalviewFileChooser( - Cache.getProperty("LAST_DIRECTORY"), new String[] { - "jvp", "jar" }, new String[] { "Jalview Project", - "Jalview Project (old)" }, "Jalview Project"); + Cache.getProperty("LAST_DIRECTORY"), new String[] + { "jvp", "jar" }, + new String[] + { "Jalview Project", "Jalview Project (old)" }, + "Jalview Project"); chooser.setFileView(new JalviewFileView()); chooser.setDialogTitle(MessageManager.getString("label.restore_state")); @@ -1673,17 +1679,15 @@ public class Desktop extends jalview.jbgui.GDesktop implements final File selectedFile = chooser.getSelectedFile(); setProjectFile(selectedFile); final String choice = selectedFile.getAbsolutePath(); - Cache.setProperty("LAST_DIRECTORY", - selectedFile.getParent()); + Cache.setProperty("LAST_DIRECTORY", selectedFile.getParent()); new Thread(new Runnable() { @Override public void run() { - setProgressBar( - MessageManager.formatMessage( - "label.loading_jalview_project", - new Object[] { choice }), choice.hashCode()); + setProgressBar(MessageManager.formatMessage( + "label.loading_jalview_project", new Object[] + { choice }), choice.hashCode()); try { new Jalview2XML().loadJalviewAlign(choice); @@ -1692,13 +1696,14 @@ public class Desktop extends jalview.jbgui.GDesktop implements new OOMWarning("Whilst loading project from " + choice, oom); } catch (Exception ex) { - Cache.log.error("Problems whilst loading project from " - + choice, ex); - JvOptionPane.showMessageDialog(Desktop.desktop, MessageManager - .formatMessage( + Cache.log.error( + "Problems whilst loading project from " + choice, ex); + JvOptionPane.showMessageDialog(Desktop.desktop, + MessageManager.formatMessage( "label.error_whilst_loading_project_from", - new Object[] { choice }), MessageManager - .getString("label.couldnt_load_project"), + new Object[] + { choice }), + MessageManager.getString("label.couldnt_load_project"), JvOptionPane.WARNING_MESSAGE); } setProgressBar(null, choice.hashCode()); @@ -1721,8 +1726,9 @@ public class Desktop extends jalview.jbgui.GDesktop implements { if (fileLoadingCount == 0) { - fileLoadingPanels.add(addProgressPanel(MessageManager.formatMessage( - "label.loading_file", new Object[] { fileName }))); + fileLoadingPanels.add(addProgressPanel(MessageManager + .formatMessage("label.loading_file", new Object[] + { fileName }))); } fileLoadingCount++; } @@ -1743,8 +1749,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements thisprogress.add(progressBar, BorderLayout.CENTER); progressPanel.add(thisprogress); - ((GridLayout) progressPanel.getLayout()) - .setRows(((GridLayout) progressPanel.getLayout()).getRows() + 1); + ((GridLayout) progressPanel.getLayout()).setRows( + ((GridLayout) progressPanel.getLayout()).getRows() + 1); ++totalProgressCount; instance.validate(); return thisprogress; @@ -1848,9 +1854,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements for (AlignFrame afr : frames) { - if (sequenceSetId == null - || afr.getViewport().getSequenceSetId() - .equals(sequenceSetId)) + if (sequenceSetId == null || afr.getViewport().getSequenceSetId() + .equals(sequenceSetId)) { if (afr.alignPanels != null) { @@ -1972,10 +1977,10 @@ public class Desktop extends jalview.jbgui.GDesktop implements jalview.bin.Cache.getProperty("LAST_DIRECTORY")); chooser.setFileView(new JalviewFileView()); - chooser.setDialogTitle(MessageManager - .getString("label.open_saved_vamsas_session")); - chooser.setToolTipText(MessageManager - .getString("label.select_vamsas_session_opened_as_new_vamsas_session")); + chooser.setDialogTitle( + MessageManager.getString("label.open_saved_vamsas_session")); + chooser.setToolTipText(MessageManager.getString( + "label.select_vamsas_session_opened_as_new_vamsas_session")); int value = chooser.showOpenDialog(this); @@ -1984,22 +1989,21 @@ public class Desktop extends jalview.jbgui.GDesktop implements String fle = chooser.getSelectedFile().toString(); if (!vamsasImport(chooser.getSelectedFile())) { - JvOptionPane - .showInternalMessageDialog( - Desktop.desktop, - MessageManager.formatMessage( - "label.couldnt_import_as_vamsas_session", - new Object[] { fle }), - MessageManager - .getString("label.vamsas_document_import_failed"), - JvOptionPane.ERROR_MESSAGE); + JvOptionPane.showInternalMessageDialog(Desktop.desktop, + MessageManager.formatMessage( + "label.couldnt_import_as_vamsas_session", + new Object[] + { fle }), + MessageManager + .getString("label.vamsas_document_import_failed"), + JvOptionPane.ERROR_MESSAGE); } } } else { - jalview.bin.Cache.log - .error("Implementation error - load session from a running session is not supported."); + jalview.bin.Cache.log.error( + "Implementation error - load session from a running session is not supported."); } } @@ -2015,8 +2019,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements if (v_client != null) { - jalview.bin.Cache.log - .error("Implementation error - load session from a running session is not supported."); + jalview.bin.Cache.log.error( + "Implementation error - load session from a running session is not supported."); return false; } @@ -2041,7 +2045,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements { jalview.bin.Cache.log.error( "Failed to create new vamsas session from contents of URL " - + url, ex); + + url, + ex); return false; } setupVamsasConnectedGui(); @@ -2060,22 +2065,22 @@ public class Desktop extends jalview.jbgui.GDesktop implements if (v_client != null) { - jalview.bin.Cache.log - .error("Implementation error - load session from a running session is not supported."); + jalview.bin.Cache.log.error( + "Implementation error - load session from a running session is not supported."); return false; } setProgressBar(MessageManager.formatMessage( - "status.importing_vamsas_session_from", - new Object[] { file.getName() }), file.hashCode()); + "status.importing_vamsas_session_from", new Object[] + { file.getName() }), file.hashCode()); try { v_client = new jalview.gui.VamsasApplication(this, file, null); } catch (Exception ex) { setProgressBar(MessageManager.formatMessage( - "status.importing_vamsas_session_from", - new Object[] { file.getName() }), file.hashCode()); + "status.importing_vamsas_session_from", new Object[] + { file.getName() }), file.hashCode()); jalview.bin.Cache.log.error( "New vamsas session from existing session file failed:", ex); return false; @@ -2083,8 +2088,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements setupVamsasConnectedGui(); v_client.initial_update(); // TODO: thread ? setProgressBar(MessageManager.formatMessage( - "status.importing_vamsas_session_from", - new Object[] { file.getName() }), file.hashCode()); + "status.importing_vamsas_session_from", new Object[] + { file.getName() }), file.hashCode()); return v_client.inSession(); } @@ -2092,9 +2097,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements { if (v_client != null) { - throw new Error( - MessageManager - .getString("error.try_join_vamsas_session_another")); + throw new Error(MessageManager + .getString("error.try_join_vamsas_session_another")); } if (mysesid == null) { @@ -2152,8 +2156,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements vamsasSave.setVisible(false); vamsasStop.setVisible(false); vamsasImport.setVisible(true); - vamsasStart.setText(MessageManager - .getString("label.new_vamsas_session")); + vamsasStart + .setText(MessageManager.getString("label.new_vamsas_session")); } @Override @@ -2177,21 +2181,22 @@ public class Desktop extends jalview.jbgui.GDesktop implements sess = VamsasApplication.getSessionList(); } catch (Exception e) { - jalview.bin.Cache.log.warn( - "Problem getting current sessions list.", e); + jalview.bin.Cache.log.warn("Problem getting current sessions list.", + e); sess = null; } if (sess != null) { - jalview.bin.Cache.log.debug("Got current sessions list: " - + sess.length + " entries."); + jalview.bin.Cache.log.debug( + "Got current sessions list: " + sess.length + " entries."); VamsasStMenu.removeAll(); for (int i = 0; i < sess.length; i++) { JMenuItem sessit = new JMenuItem(); sessit.setText(sess[i]); - sessit.setToolTipText(MessageManager.formatMessage( - "label.connect_to_session", new Object[] { sess[i] })); + sessit.setToolTipText(MessageManager + .formatMessage("label.connect_to_session", new Object[] + { sess[i] })); final Desktop dsktp = this; final String mysesid = sess[i]; sessit.addActionListener(new ActionListener() @@ -2243,7 +2248,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements { if (v_client != null) { - // TODO: VAMSAS DOCUMENT EXTENSION is VDJ + // TODO: VAMSAS DOCUMENT EXTENSION is VDJ JalviewFileChooser chooser = new JalviewFileChooser("vdj", "Vamsas Document"); @@ -2256,9 +2261,9 @@ public class Desktop extends jalview.jbgui.GDesktop implements if (value == JalviewFileChooser.APPROVE_OPTION) { java.io.File choice = chooser.getSelectedFile(); - JPanel progpanel = addProgressPanel(MessageManager.formatMessage( - "label.saving_vamsas_doc", - new Object[] { choice.getName() })); + JPanel progpanel = addProgressPanel(MessageManager + .formatMessage("label.saving_vamsas_doc", new Object[] + { choice.getName() })); Cache.setProperty("LAST_DIRECTORY", choice.getParent()); String warnmsg = null; String warnttl = null; @@ -2269,15 +2274,15 @@ public class Desktop extends jalview.jbgui.GDesktop implements { warnttl = "Serious Problem saving Vamsas Document"; warnmsg = ex.toString(); - jalview.bin.Cache.log.error("Error Whilst saving document to " - + choice, ex); + jalview.bin.Cache.log + .error("Error Whilst saving document to " + choice, ex); } catch (Exception ex) { warnttl = "Problem saving Vamsas Document."; warnmsg = ex.toString(); - jalview.bin.Cache.log.warn("Exception Whilst saving document to " - + choice, ex); + jalview.bin.Cache.log.warn( + "Exception Whilst saving document to " + choice, ex); } removeProgressPanel(progpanel); @@ -2285,7 +2290,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements { JvOptionPane.showInternalMessageDialog(Desktop.desktop, - warnmsg, warnttl, JvOptionPane.ERROR_MESSAGE); + warnmsg, warnttl, JvOptionPane.ERROR_MESSAGE); } } } @@ -2310,8 +2315,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements } if (b) { - vamUpdate = this.addProgressPanel(MessageManager - .getString("label.updating_vamsas_session")); + vamUpdate = this.addProgressPanel( + MessageManager.getString("label.updating_vamsas_session")); } vamsasStart.setVisible(!b); vamsasStop.setVisible(!b); @@ -2364,8 +2369,9 @@ public class Desktop extends jalview.jbgui.GDesktop implements { check = true; int barPos = link.indexOf("|"); - String urlMsg = barPos == -1 ? link : link.substring(0, - barPos) + ": " + link.substring(barPos + 1); + String urlMsg = barPos == -1 ? link + : link.substring(0, barPos) + ": " + + link.substring(barPos + 1); urls.add(new JLabel(urlMsg)); } } @@ -2379,12 +2385,10 @@ public class Desktop extends jalview.jbgui.GDesktop implements JPanel msgPanel = new JPanel(); msgPanel.setLayout(new BoxLayout(msgPanel, BoxLayout.PAGE_AXIS)); msgPanel.add(Box.createVerticalGlue()); - JLabel msg = new JLabel( - MessageManager - .getString("label.SEQUENCE_ID_for_DB_ACCESSION1")); - JLabel msg2 = new JLabel( - MessageManager - .getString("label.SEQUENCE_ID_for_DB_ACCESSION2")); + JLabel msg = new JLabel(MessageManager + .getString("label.SEQUENCE_ID_for_DB_ACCESSION1")); + JLabel msg2 = new JLabel(MessageManager + .getString("label.SEQUENCE_ID_for_DB_ACCESSION2")); msgPanel.add(msg); for (JLabel url : urls) { @@ -2414,7 +2418,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements } } }); - } + } /** * Proxy class for JDesktopPane which optionally displays the current memory @@ -2503,11 +2507,11 @@ public class Desktop extends jalview.jbgui.GDesktop implements FontMetrics fm = g.getFontMetrics(); if (fm != null) { - g.drawString(MessageManager.formatMessage( - "label.memory_stats", - new Object[] { df.format(totalFreeMemory), - df.format(maxMemory), df.format(percentUsage) }), 10, - getHeight() - fm.getHeight()); + g.drawString(MessageManager.formatMessage("label.memory_stats", + new Object[] + { df.format(totalFreeMemory), df.format(maxMemory), + df.format(percentUsage) }), + 10, getHeight() - fm.getHeight()); } } } @@ -2618,7 +2622,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements jalview.bin.Cache.log.error("Groovy Shell Creation failed.", ex); JvOptionPane.showInternalMessageDialog(Desktop.desktop, - MessageManager.getString("label.couldnt_create_groovy_shell"), + MessageManager.getString("label.couldnt_create_groovy_shell"), MessageManager.getString("label.groovy_support_failed"), JvOptionPane.ERROR_MESSAGE); } @@ -2674,9 +2678,10 @@ public class Desktop extends jalview.jbgui.GDesktop implements */ protected void addQuitHandler() { - getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put( - KeyStroke.getKeyStroke(KeyEvent.VK_Q, Toolkit - .getDefaultToolkit().getMenuShortcutKeyMask()), "Quit"); + getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW) + .put(KeyStroke.getKeyStroke(KeyEvent.VK_Q, + Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), + "Quit"); getRootPane().getActionMap().put("Quit", new AbstractAction() { @Override @@ -2760,9 +2765,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements if (progressBarHandlers == null || !progressBars.containsKey(new Long(id))) { - throw new Error( - MessageManager - .getString("error.call_setprogressbar_before_registering_handler")); + throw new Error(MessageManager.getString( + "error.call_setprogressbar_before_registering_handler")); } progressBarHandlers.put(new Long(id), handler); final JPanel progressPanel = progressBars.get(new Long(id)); @@ -2778,10 +2782,10 @@ public class Desktop extends jalview.jbgui.GDesktop implements public void actionPerformed(ActionEvent e) { handler.cancelActivity(id); - us.setProgressBar(MessageManager.formatMessage( - "label.cancelled_params", - new Object[] { ((JLabel) progressPanel.getComponent(0)) - .getText() }), id); + us.setProgressBar(MessageManager + .formatMessage("label.cancelled_params", new Object[] + { ((JLabel) progressPanel.getComponent(0)).getText() }), + id); } }); progressPanel.add(cancel, BorderLayout.EAST); @@ -2814,7 +2818,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements { if (desktop != null) { - AlignmentPanel[] aps = getAlignmentPanels(viewport.getSequenceSetId()); + AlignmentPanel[] aps = getAlignmentPanels( + viewport.getSequenceSetId()); for (int panel = 0; aps != null && panel < aps.length; panel++) { if (aps[panel] != null && aps[panel].av == viewport) @@ -2883,8 +2888,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements if (Cache.getDefault("SHOW_JWS2_SERVICES", true)) { - t2 = jalview.ws.jws2.Jws2Discoverer.getDiscoverer().startDiscoverer( - changeSupport); + t2 = jalview.ws.jws2.Jws2Discoverer.getDiscoverer() + .startDiscoverer(changeSupport); } Thread t3 = null; { @@ -2900,8 +2905,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements } catch (Exception e) { } - alive = (t1 != null && t1.isAlive()) - || (t2 != null && t2.isAlive()) + alive = (t1 != null && t1.isAlive()) || (t2 != null && t2.isAlive()) || (t3 != null && t3.isAlive()) || (t0 != null && t0.isAlive()); } @@ -2956,20 +2960,16 @@ public class Desktop extends jalview.jbgui.GDesktop implements * * jd.waitForInput(); */ - JvOptionPane - .showConfirmDialog( - Desktop.desktop, - new JLabel( - "
    " - + ermsg - + "
    " - + "

    It may be that you have invalid JABA URLs
    in your web service preferences," - + "
    or as a command-line argument, or mis-configured HTTP proxy settings.

    " - + "

    Check the Connections and Web services tab
    of the" - + " Tools->Preferences dialog box to change them.

    "), - "Web Service Configuration Problem", - JvOptionPane.DEFAULT_OPTION, - JvOptionPane.ERROR_MESSAGE); + JvOptionPane.showConfirmDialog(Desktop.desktop, + new JLabel("
    " + + ermsg + "
    " + + "

    It may be that you have invalid JABA URLs
    in your web service preferences," + + "
    or as a command-line argument, or mis-configured HTTP proxy settings.

    " + + "

    Check the Connections and Web services tab
    of the" + + " Tools->Preferences dialog box to change them.

    "), + "Web Service Configuration Problem", + JvOptionPane.DEFAULT_OPTION, + JvOptionPane.ERROR_MESSAGE); serviceChangedDialog = null; } @@ -2978,8 +2978,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements } else { - Cache.log - .error("Errors reported by JABA discovery service. Check web services preferences.\n" + Cache.log.error( + "Errors reported by JABA discovery service. Check web services preferences.\n" + ermsg); } } @@ -3019,9 +3019,9 @@ public class Desktop extends jalview.jbgui.GDesktop implements { if (progress != null) { - progress.setProgressBar(MessageManager.formatMessage( - "status.opening_params", new Object[] { url }), this - .hashCode()); + progress.setProgressBar(MessageManager + .formatMessage("status.opening_params", new Object[] + { url }), this.hashCode()); } jalview.util.BrowserLauncher.openURL(url); } catch (Exception ex) @@ -3077,8 +3077,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements } else { - System.err.println("Couldn't handle string " + url - + " as a URL."); + System.err.println( + "Couldn't handle string " + url + " as a URL."); } } // ignore any exceptions due to dud links. @@ -3154,10 +3154,11 @@ public class Desktop extends jalview.jbgui.GDesktop implements { invalidate(); File of; - ImageMaker im = new jalview.util.ImageMaker(this, ImageMaker.TYPE.EPS, - "View of Desktop", getWidth(), getHeight(), of = new File( - "Jalview_snapshot" + System.currentTimeMillis() - + ".eps"), "View of desktop", null, 0, false); + ImageMaker im = new jalview.util.ImageMaker( + this, ImageMaker.TYPE.EPS, "View of Desktop", getWidth(), + getHeight(), of = new File("Jalview_snapshot" + + System.currentTimeMillis() + ".eps"), + "View of desktop", null, 0, false); try { paintAll(im.getGraphics()); @@ -3270,9 +3271,9 @@ public class Desktop extends jalview.jbgui.GDesktop implements AlignFrame myBottomFrame = (AlignFrame) source.getBottomFrame(); myTopFrame.viewport.setExplodedGeometry(new Rectangle(source.getX(), source.getY(), myTopFrame.getWidth(), myTopFrame.getHeight())); - myBottomFrame.viewport.setExplodedGeometry(new Rectangle(source.getX(), - source.getY(), myBottomFrame.getWidth(), myBottomFrame - .getHeight())); + myBottomFrame.viewport + .setExplodedGeometry(new Rectangle(source.getX(), source.getY(), + myBottomFrame.getWidth(), myBottomFrame.getHeight())); myTopFrame.viewport.setGatherViewsHere(true); myBottomFrame.viewport.setGatherViewsHere(true); String topViewId = myTopFrame.viewport.getSequenceSetId(); @@ -3297,10 +3298,10 @@ public class Desktop extends jalview.jbgui.GDesktop implements gatherThis = true; topPanel.av.setGatherViewsHere(false); bottomPanel.av.setGatherViewsHere(false); - topPanel.av.setExplodedGeometry(new Rectangle(sf.getLocation(), - topFrame.getSize())); - bottomPanel.av.setExplodedGeometry(new Rectangle(sf - .getLocation(), bottomFrame.getSize())); + topPanel.av.setExplodedGeometry( + new Rectangle(sf.getLocation(), topFrame.getSize())); + bottomPanel.av.setExplodedGeometry( + new Rectangle(sf.getLocation(), bottomFrame.getSize())); myTopFrame.addAlignmentPanel(topPanel, false); myBottomFrame.addAlignmentPanel(bottomPanel, false); } @@ -3328,8 +3329,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements public static void transferFromDropTarget(List files, List protocols, DropTargetDropEvent evt, - Transferable t) - throws Exception + Transferable t) throws Exception { DataFlavor uriListFlavor = new DataFlavor( @@ -3361,8 +3361,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements // fallback to text: workaround - on OSX where there's a JVM bug Cache.log.debug("standard URIListFlavor failed. Trying text"); // try text fallback - data = (String) t.getTransferData(new DataFlavor( - "text/plain;class=java.lang.String")); + data = (String) t.getTransferData( + new DataFlavor("text/plain;class=java.lang.String")); if (Cache.log.isDebugEnabled()) { Cache.log.debug("fallback returned " + data); @@ -3402,12 +3402,12 @@ public class Desktop extends jalview.jbgui.GDesktop implements { if (data == null || !added) { - Cache.log - .debug("Couldn't resolve drop data. Here are the supported flavors:"); + Cache.log.debug( + "Couldn't resolve drop data. Here are the supported flavors:"); for (DataFlavor fl : t.getTransferDataFlavors()) { - Cache.log.debug("Supported transfer dataflavor: " - + fl.toString()); + Cache.log.debug( + "Supported transfer dataflavor: " + fl.toString()); Object df = t.getTransferData(fl); if (df != null) { diff --git a/src/jalview/gui/EPSOptions.java b/src/jalview/gui/EPSOptions.java index fa67999..d8f0d9a 100644 --- a/src/jalview/gui/EPSOptions.java +++ b/src/jalview/gui/EPSOptions.java @@ -59,7 +59,8 @@ public class EPSOptions extends JPanel bg.add(text); JOptionPane pane = new JOptionPane(null, JvOptionPane.DEFAULT_OPTION, - JvOptionPane.DEFAULT_OPTION, null, new Object[] { this }); + JvOptionPane.DEFAULT_OPTION, null, new Object[] + { this }); dialog = pane.createDialog(Desktop.desktop, "EPS Rendering options"); dialog.setVisible(true); diff --git a/src/jalview/gui/FeatureColourChooser.java b/src/jalview/gui/FeatureColourChooser.java index 4172819..396df04 100644 --- a/src/jalview/gui/FeatureColourChooser.java +++ b/src/jalview/gui/FeatureColourChooser.java @@ -117,8 +117,9 @@ public class FeatureColourChooser extends JalviewDialog this.fr = frender; this.type = theType; ap = fr.ap; - String title = MessageManager.formatMessage( - "label.graduated_color_for_params", new String[] { theType }); + String title = MessageManager + .formatMessage("label.graduated_color_for_params", new String[] + { theType }); initDialogFrame(this, true, blocking, title, 480, 185); slider.addChangeListener(new ChangeListener() @@ -205,7 +206,8 @@ public class FeatureColourChooser extends JalviewDialog slider.setEnabled(true); slider.setValue((int) (cs.getThreshold() * scaleFactor)); thresholdValue.setEnabled(true); - threshline = new GraphLine((max - min) / 2f, "Threshold", Color.black); + threshline = new GraphLine((max - min) / 2f, "Threshold", + Color.black); threshline.value = cs.getThreshold(); } @@ -292,14 +294,14 @@ public class FeatureColourChooser extends JalviewDialog slider.setEnabled(false); slider.setOpaque(false); slider.setPreferredSize(new Dimension(100, 32)); - slider.setToolTipText(MessageManager - .getString("label.adjust_threshold")); + slider.setToolTipText( + MessageManager.getString("label.adjust_threshold")); thresholdValue.setEnabled(false); thresholdValue.setColumns(7); jPanel3.setBackground(Color.white); thresholdIsMin.setBackground(Color.white); - thresholdIsMin.setText(MessageManager - .getString("label.threshold_minmax")); + thresholdIsMin + .setText(MessageManager.getString("label.threshold_minmax")); thresholdIsMin.setToolTipText(MessageManager .getString("label.toggle_absolute_relative_display_threshold")); thresholdIsMin.addActionListener(new ActionListener() @@ -313,9 +315,8 @@ public class FeatureColourChooser extends JalviewDialog colourByLabel.setBackground(Color.white); colourByLabel .setText(MessageManager.getString("label.colour_by_label")); - colourByLabel - .setToolTipText(MessageManager - .getString("label.display_features_same_type_different_label_using_different_colour")); + colourByLabel.setToolTipText(MessageManager.getString( + "label.display_features_same_type_different_label_using_different_colour")); colourByLabel.addActionListener(new ActionListener() { @Override @@ -433,7 +434,8 @@ public class FeatureColourChooser extends JalviewDialog /* * todo not yet implemented: visual indication of feature threshold */ - threshline = new GraphLine((max - min) / 2f, "Threshold", Color.black); + threshline = new GraphLine((max - min) / 2f, "Threshold", + Color.black); } if (hasThreshold) @@ -596,8 +598,8 @@ public class FeatureColourChooser extends JalviewDialog { if (colourEditor != null) { - System.err - .println("IMPLEMENTATION ISSUE: overwriting action listener for FeatureColourChooser"); + System.err.println( + "IMPLEMENTATION ISSUE: overwriting action listener for FeatureColourChooser"); } colourEditor = graduatedColorEditor; } diff --git a/src/jalview/gui/FeatureRenderer.java b/src/jalview/gui/FeatureRenderer.java index 55c4323..358798d 100644 --- a/src/jalview/gui/FeatureRenderer.java +++ b/src/jalview/gui/FeatureRenderer.java @@ -63,8 +63,8 @@ import javax.swing.event.DocumentListener; * @author $author$ * @version $Revision$ */ -public class FeatureRenderer extends - jalview.renderer.seqfeatures.FeatureRenderer +public class FeatureRenderer + extends jalview.renderer.seqfeatures.FeatureRenderer { /* * defaults for creating a new feature are the last created @@ -239,14 +239,13 @@ public class FeatureRenderer extends */ gridPanel = new JPanel(new GridLayout(4, 1)); JPanel choosePanel = new JPanel(); - choosePanel.add(new JLabel(MessageManager - .getString("label.select_feature") - + ":")); + choosePanel.add(new JLabel( + MessageManager.getString("label.select_feature") + ":")); final JComboBox overlaps = new JComboBox(); for (SequenceFeature sf : features) { - String text = sf.getType() + "/" + sf.getBegin() + "-" - + sf.getEnd() + " (" + sf.getFeatureGroup() + ")"; + String text = sf.getType() + "/" + sf.getBegin() + "-" + sf.getEnd() + + " (" + sf.getFeatureGroup() + ")"; overlaps.addItem(text); } choosePanel.add(overlaps); @@ -271,14 +270,15 @@ public class FeatureRenderer extends highlight.addResult(sequences.get(0), sf.getBegin(), sf.getEnd()); - alignPanel.getSeqPanel().seqCanvas.highlightSearchResults(highlight); + alignPanel.getSeqPanel().seqCanvas + .highlightSearchResults(highlight); } FeatureColourI col = getFeatureStyle(name.getText()); if (col == null) { - col = new FeatureColour(ColorUtils - .createColourFromName(name.getText())); + col = new FeatureColour( + ColorUtils.createColourFromName(name.getText())); } oldcol = fcol = col; updateColourButton(mainPanel, colour, col); @@ -315,9 +315,8 @@ public class FeatureRenderer extends mainPanel.add(gridPanel, BorderLayout.NORTH); JPanel descriptionPanel = new JPanel(); - descriptionPanel.add(new JLabel(MessageManager - .getString("label.description:"), - JLabel.RIGHT)); + descriptionPanel.add(new JLabel( + MessageManager.getString("label.description:"), JLabel.RIGHT)); description.setFont(JvSwingUtils.getTextAreaFont()); description.setLineWrap(true); descriptionPanel.add(new JScrollPane(description)); @@ -371,10 +370,11 @@ public class FeatureRenderer extends MessageManager.getString("action.cancel") }; } - String title = create ? MessageManager - .getString("label.create_new_sequence_features") + String title = create + ? MessageManager.getString("label.create_new_sequence_features") : MessageManager.formatMessage("label.amend_delete_features", - new String[] { sequences.get(0).getName() }); + new String[] + { sequences.get(0).getName() }); /* * show the dialog @@ -426,8 +426,8 @@ public class FeatureRenderer extends sf.type = enteredType; sf.featureGroup = group.getText().trim(); sf.description = description.getText().replaceAll("\n", " "); - boolean refreshSettings = (!featureType.equals(sf.type) || !featureGroup - .equals(sf.featureGroup)); + boolean refreshSettings = (!featureType.equals(sf.type) + || !featureGroup.equals(sf.featureGroup)); refreshSettings |= (fcol != oldcol); setColour(sf.type, fcol); @@ -514,7 +514,8 @@ public class FeatureRenderer extends { String msg = MessageManager.formatMessage("label.warning_hidden", MessageManager.getString("label.group"), group); - JvOptionPane.showMessageDialog(panel, msg, "", JvOptionPane.OK_OPTION); + JvOptionPane.showMessageDialog(panel, msg, "", + JvOptionPane.OK_OPTION); } } diff --git a/src/jalview/gui/FeatureSettings.java b/src/jalview/gui/FeatureSettings.java index 34f0b4a..109d0b6 100644 --- a/src/jalview/gui/FeatureSettings.java +++ b/src/jalview/gui/FeatureSettings.java @@ -97,8 +97,8 @@ import javax.swing.table.AbstractTableModel; import javax.swing.table.TableCellEditor; import javax.swing.table.TableCellRenderer; -public class FeatureSettings extends JPanel implements - FeatureSettingsControllerI +public class FeatureSettings extends JPanel + implements FeatureSettingsControllerI { DasSourceBrowser dassourceBrowser; @@ -142,8 +142,8 @@ public class FeatureSettings extends JPanel implements this.af = af; fr = af.getFeatureRenderer(); // allow transparency to be recovered - transparency.setMaximum(100 - (int) ((originalTransparency = fr - .getTransparency()) * 100)); + transparency.setMaximum(100 + - (int) ((originalTransparency = fr.getTransparency()) * 100)); try { @@ -291,16 +291,17 @@ public class FeatureSettings extends JPanel implements } frame.setMinimumSize(new Dimension(MIN_WIDTH, MIN_HEIGHT)); - frame.addInternalFrameListener(new javax.swing.event.InternalFrameAdapter() - { - @Override - public void internalFrameClosed( - javax.swing.event.InternalFrameEvent evt) - { - fr.removePropertyChangeListener(change); - dassourceBrowser.fs = null; - }; - }); + frame.addInternalFrameListener( + new javax.swing.event.InternalFrameAdapter() + { + @Override + public void internalFrameClosed( + javax.swing.event.InternalFrameEvent evt) + { + fr.removePropertyChangeListener(change); + dassourceBrowser.fs = null; + }; + }); frame.setLayer(JLayeredPane.PALETTE_LAYER); } @@ -310,8 +311,9 @@ public class FeatureSettings extends JPanel implements { final FeatureColourI featureColour = (FeatureColourI) typeCol; - JPopupMenu men = new JPopupMenu(MessageManager.formatMessage( - "label.settings_for_param", new String[] { type })); + JPopupMenu men = new JPopupMenu(MessageManager + .formatMessage("label.settings_for_param", new String[] + { type })); JMenuItem scr = new JMenuItem( MessageManager.getString("label.sort_by_score")); men.add(scr); @@ -322,8 +324,9 @@ public class FeatureSettings extends JPanel implements @Override public void actionPerformed(ActionEvent e) { - me.af.avc.sortAlignmentByFeatureScore(Arrays - .asList(new String[] { type })); + me.af.avc + .sortAlignmentByFeatureScore(Arrays.asList(new String[] + { type })); } }); @@ -335,8 +338,9 @@ public class FeatureSettings extends JPanel implements @Override public void actionPerformed(ActionEvent e) { - me.af.avc.sortAlignmentByFeatureDensity(Arrays - .asList(new String[] { type })); + me.af.avc + .sortAlignmentByFeatureDensity(Arrays.asList(new String[] + { type })); } }); @@ -406,8 +410,7 @@ public class FeatureSettings extends JPanel implements else { // probably the color chooser! - table.setValueAt( - new FeatureColour(colorChooser.getColor()), + table.setValueAt(new FeatureColour(colorChooser.getColor()), selectedRow, 1); table.validate(); me.updateFeatureRenderer( @@ -431,8 +434,8 @@ public class FeatureSettings extends JPanel implements false, type); } }); - JMenuItem clearCols = new JMenuItem( - MessageManager.getString("label.select_columns_not_containing")); + JMenuItem clearCols = new JMenuItem(MessageManager + .getString("label.select_columns_not_containing")); clearCols.addActionListener(new ActionListener() { @Override @@ -669,8 +672,8 @@ public class FeatureSettings extends JPanel implements data[dataIndex][0] = type; data[dataIndex][1] = fr.getFeatureStyle(type); - data[dataIndex][2] = new Boolean(af.getViewport() - .getFeaturesDisplayed().isVisible(type)); + data[dataIndex][2] = new Boolean( + af.getViewport().getFeaturesDisplayed().isVisible(type)); dataIndex++; visibleChecks.removeElement(type); } @@ -712,8 +715,8 @@ public class FeatureSettings extends JPanel implements table.setModel(new FeatureTableModel(data)); table.getColumnModel().getColumn(0).setPreferredWidth(200); - groupPanel.setLayout(new GridLayout(fr.getFeatureGroupsSize() / 4 + 1, - 4)); + groupPanel.setLayout( + new GridLayout(fr.getFeatureGroupsSize() / 4 + 1, 4)); pruneGroups(foundGroups); groupPanel.validate(); @@ -834,8 +837,8 @@ public class FeatureSettings extends JPanel implements JalviewFileChooser chooser = new JalviewFileChooser("fc", "Sequence Feature Colours"); chooser.setFileView(new JalviewFileView()); - chooser.setDialogTitle(MessageManager - .getString("label.load_feature_colours")); + chooser.setDialogTitle( + MessageManager.getString("label.load_feature_colours")); chooser.setToolTipText(MessageManager.getString("action.load")); int value = chooser.showOpenDialog(this); @@ -846,8 +849,8 @@ public class FeatureSettings extends JPanel implements try { - InputStreamReader in = new InputStreamReader(new FileInputStream( - file), "UTF-8"); + InputStreamReader in = new InputStreamReader( + new FileInputStream(file), "UTF-8"); JalviewUserColours jucs = JalviewUserColours.unmarshal(in); @@ -926,8 +929,8 @@ public class FeatureSettings extends JPanel implements JalviewFileChooser chooser = new JalviewFileChooser("fc", "Sequence Feature Colours"); chooser.setFileView(new JalviewFileView()); - chooser.setDialogTitle(MessageManager - .getString("label.save_feature_colours")); + chooser.setDialogTitle( + MessageManager.getString("label.save_feature_colours")); chooser.setToolTipText(MessageManager.getString("action.save")); int value = chooser.showSaveDialog(this); @@ -969,13 +972,13 @@ public class FeatureSettings extends JPanel implements col.setRGB(Format.getHexString(fcol.getMaxColour())); col.setMin(fcol.getMin()); col.setMax(fcol.getMax()); - col.setMinRGB(jalview.util.Format.getHexString(fcol - .getMinColour())); + col.setMinRGB( + jalview.util.Format.getHexString(fcol.getMinColour())); col.setAutoScale(fcol.isAutoScaled()); col.setThreshold(fcol.getThreshold()); col.setColourByLabel(fcol.isColourByLabel()); - col.setThreshType(fcol.isAboveThreshold() ? "ABOVE" : (fcol - .isBelowThreshold() ? "BELOW" : "NONE")); + col.setThreshType(fcol.isAboveThreshold() ? "ABOVE" + : (fcol.isBelowThreshold() ? "BELOW" : "NONE")); } ucs.addColour(col); } @@ -1178,8 +1181,8 @@ public class FeatureSettings extends JPanel implements } }); sortByDens.setFont(JvSwingUtils.getLabelFont()); - sortByDens.setText(MessageManager - .getString("label.sequence_sort_by_density")); + sortByDens.setText( + MessageManager.getString("label.sequence_sort_by_density")); sortByDens.addActionListener(new ActionListener() { @Override @@ -1273,8 +1276,8 @@ public class FeatureSettings extends JPanel implements }); transparency.setMaximum(70); - transparency.setToolTipText(MessageManager - .getString("label.transparency_tip")); + transparency.setToolTipText( + MessageManager.getString("label.transparency_tip")); fetchDAS.setText(MessageManager.getString("label.fetch_das_features")); fetchDAS.addActionListener(new ActionListener() { @@ -1484,15 +1487,10 @@ public class FeatureSettings extends JPanel implements public void noDasSourceActive() { complete(); - JvOptionPane - .showInternalConfirmDialog( - Desktop.desktop, - MessageManager - .getString("label.no_das_sources_selected_warn"), - MessageManager - .getString("label.no_das_sources_selected_title"), - JvOptionPane.DEFAULT_OPTION, - JvOptionPane.INFORMATION_MESSAGE); + JvOptionPane.showInternalConfirmDialog(Desktop.desktop, + MessageManager.getString("label.no_das_sources_selected_warn"), + MessageManager.getString("label.no_das_sources_selected_title"), + JvOptionPane.DEFAULT_OPTION, JvOptionPane.INFORMATION_MESSAGE); } // /////////////////////////////////////////////////////////////////////// @@ -1589,9 +1587,8 @@ public class FeatureSettings extends JPanel implements } @Override - public Component getTableCellRendererComponent(JTable tbl, - Object color, boolean isSelected, boolean hasFocus, int row, - int column) + public Component getTableCellRendererComponent(JTable tbl, Object color, + boolean isSelected, boolean hasFocus, int row, int column) { FeatureColourI cellColour = (FeatureColourI) color; // JLabel comp = new JLabel(); @@ -1799,8 +1796,8 @@ class FeatureIcon implements Icon } } -class ColorEditor extends AbstractCellEditor implements TableCellEditor, - ActionListener +class ColorEditor extends AbstractCellEditor + implements TableCellEditor, ActionListener { FeatureSettings me; diff --git a/src/jalview/gui/Finder.java b/src/jalview/gui/Finder.java index 457d871..f526592 100755 --- a/src/jalview/gui/Finder.java +++ b/src/jalview/gui/Finder.java @@ -101,14 +101,15 @@ public class Finder extends GFinder frame = new JInternalFrame(); frame.setContentPane(this); frame.setLayer(JLayeredPane.PALETTE_LAYER); - frame.addInternalFrameListener(new javax.swing.event.InternalFrameAdapter() - { - @Override - public void internalFrameClosing(InternalFrameEvent e) - { - closeAction(); - } - }); + frame.addInternalFrameListener( + new javax.swing.event.InternalFrameAdapter() + { + @Override + public void internalFrameClosing(InternalFrameEvent e) + { + closeAction(); + } + }); addEscapeHandler(); Desktop.addInternalFrame(frame, MessageManager.getString("label.find"), MY_WIDTH, MY_HEIGHT); @@ -121,8 +122,8 @@ public class Finder extends GFinder */ private void addEscapeHandler() { - getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put( - KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "Cancel"); + getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW) + .put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "Cancel"); getRootPane().getActionMap().put("Cancel", new AbstractAction() { @Override @@ -133,7 +134,6 @@ public class Finder extends GFinder }); } - /** * Performs the 'Find Next' action. * @@ -223,8 +223,8 @@ public class Finder extends GFinder for (SearchResultMatchI match : searchResults.getResults()) { seqs.add(match.getSequence().getDatasetSequence()); - features.add(new SequenceFeature(searchString, desc, null, match - .getStart(), match.getEnd(), desc)); + features.add(new SequenceFeature(searchString, desc, null, + match.getStart(), match.getEnd(), desc)); } if (ap.getSeqPanel().seqCanvas.getFeatureRenderer().amendFeatures(seqs, @@ -315,8 +315,8 @@ public class Finder extends GFinder if (doFindAll) { // then we report the matches that were found - String message = (idMatch.size() > 0) ? "" + idMatch.size() - + " IDs" : ""; + String message = (idMatch.size() > 0) ? "" + idMatch.size() + " IDs" + : ""; if (searchResults != null) { if (idMatch.size() > 0 && searchResults.getSize() > 0) diff --git a/src/jalview/gui/FontChooser.java b/src/jalview/gui/FontChooser.java index 06f29e9..5271e4f 100755 --- a/src/jalview/gui/FontChooser.java +++ b/src/jalview/gui/FontChooser.java @@ -126,7 +126,8 @@ public class FontChooser extends GFontChooser { oldComplementFont = ((AlignViewport) ap.av.getCodingComplement()) .getFont(); - oldComplementSmooth = ((AlignViewport) ap.av.getCodingComplement()).antiAlias; + oldComplementSmooth = ((AlignViewport) ap.av + .getCodingComplement()).antiAlias; scaleAsCdna.setVisible(true); scaleAsCdna.setSelected(ap.av.isScaleProteinAsCdna()); fontAsCdna.setVisible(true); @@ -170,9 +171,9 @@ public class FontChooser extends GFontChooser fontStyle.setSelectedIndex(oldFont.getStyle()); FontMetrics fm = getGraphics().getFontMetrics(oldFont); - monospaced.setSelected(fm.getStringBounds("M", getGraphics()) - .getWidth() == fm.getStringBounds("|", getGraphics()) - .getWidth()); + monospaced.setSelected( + fm.getStringBounds("M", getGraphics()).getWidth() == fm + .getStringBounds("|", getGraphics()).getWidth()); init = false; } @@ -185,7 +186,8 @@ public class FontChooser extends GFontChooser ap.paintAlignment(true); if (ap.av.getCodingComplement() != null && ap.av.isProteinFontAsCdna()) { - ((AlignViewport) ap.av.getCodingComplement()).antiAlias = ap.av.antiAlias; + ((AlignViewport) ap.av + .getCodingComplement()).antiAlias = ap.av.antiAlias; SplitFrame sv = (SplitFrame) ap.alignFrame.getSplitViewContainer(); sv.adjustLayout(); sv.repaint(); @@ -239,7 +241,8 @@ public class FontChooser extends GFontChooser { ap.av.getCodingComplement().setScaleProteinAsCdna(oldProteinScale); ap.av.getCodingComplement().setProteinFontAsCdna(oldMirrorFont); - ((AlignViewport) ap.av.getCodingComplement()).antiAlias = oldComplementSmooth; + ((AlignViewport) ap.av + .getCodingComplement()).antiAlias = oldComplementSmooth; ap.av.getCodingComplement().setFont(oldComplementFont, true); SplitFrame splitFrame = (SplitFrame) ap.alignFrame .getSplitViewContainer(); @@ -284,8 +287,9 @@ public class FontChooser extends GFontChooser double iw = iBounds.getWidth(); if (mw < 1 || iw < 1) { - String message = iBounds.getHeight() < 1 ? MessageManager - .getString("label.font_doesnt_have_letters_defined") + String message = iBounds.getHeight() < 1 + ? MessageManager + .getString("label.font_doesnt_have_letters_defined") : MessageManager.getString("label.font_too_small"); JvOptionPane.showInternalMessageDialog(this, message, MessageManager.getString("label.invalid_font"), @@ -298,8 +302,8 @@ public class FontChooser extends GFontChooser { fontSize.setSelectedItem(lastSelected.getSize()); } - if (!lastSelected.getName().equals( - fontName.getSelectedItem().toString())) + if (!lastSelected.getName() + .equals(fontName.getSelectedItem().toString())) { fontName.setSelectedItem(lastSelected.getName()); } @@ -421,8 +425,8 @@ public class FontChooser extends GFontChooser protected void scaleAsCdna_actionPerformed() { ap.av.setScaleProteinAsCdna(scaleAsCdna.isSelected()); - ap.av.getCodingComplement().setScaleProteinAsCdna( - scaleAsCdna.isSelected()); + ap.av.getCodingComplement() + .setScaleProteinAsCdna(scaleAsCdna.isSelected()); final SplitFrame splitFrame = (SplitFrame) ap.alignFrame .getSplitViewContainer(); splitFrame.adjustLayout(); diff --git a/src/jalview/gui/HTMLOptions.java b/src/jalview/gui/HTMLOptions.java index 12af734..9e0f712 100644 --- a/src/jalview/gui/HTMLOptions.java +++ b/src/jalview/gui/HTMLOptions.java @@ -59,7 +59,8 @@ public class HTMLOptions extends JPanel bg.add(text); JOptionPane pane = new JOptionPane(null, JvOptionPane.DEFAULT_OPTION, - JvOptionPane.DEFAULT_OPTION, null, new Object[] { this }); + JvOptionPane.DEFAULT_OPTION, null, new Object[] + { this }); dialog = pane.createDialog(Desktop.desktop, "HTML Rendering options"); dialog.setVisible(true); diff --git a/src/jalview/gui/IdCanvas.java b/src/jalview/gui/IdCanvas.java index 052c527..a7dff86 100755 --- a/src/jalview/gui/IdCanvas.java +++ b/src/jalview/gui/IdCanvas.java @@ -266,8 +266,8 @@ public class IdCanvas extends JPanel implements ViewportListenerI { if (av.isSeqNameItalics()) { - setIdfont(new Font(av.getFont().getName(), Font.ITALIC, av.getFont() - .getSize())); + setIdfont(new Font(av.getFont().getName(), Font.ITALIC, + av.getFont().getSize())); } else { @@ -323,9 +323,8 @@ public class IdCanvas extends JPanel implements ViewportListenerI currentColor = Color.black; currentTextColor = Color.white; } - else if ((av.getSelectionGroup() != null) - && av.getSelectionGroup().getSequences(null) - .contains(sequence)) + else if ((av.getSelectionGroup() != null) && av.getSelectionGroup() + .getSequences(null).contains(sequence)) { currentColor = Color.lightGray; currentTextColor = Color.black; @@ -444,7 +443,8 @@ public class IdCanvas extends JPanel implements ViewportListenerI void drawMarker(int i, int starty, int yoffset) { - SequenceI[] hseqs = av.getAlignment().getHiddenSequences().hiddenSequences; + SequenceI[] hseqs = av.getAlignment() + .getHiddenSequences().hiddenSequences; // Use this method here instead of calling hiddenSeq adjust // 3 times. int hSize = hseqs.length; @@ -479,32 +479,36 @@ public class IdCanvas extends JPanel implements ViewportListenerI if (below) { gg.fillPolygon( - new int[] { getWidth() - av.getCharHeight(), + new int[] + { getWidth() - av.getCharHeight(), getWidth() - av.getCharHeight(), getWidth() }, - new int[] { - (i - starty) * av.getCharHeight() + yoffset, + new int[] + { (i - starty) * av.getCharHeight() + yoffset, (i - starty) * av.getCharHeight() + yoffset + av.getCharHeight() / 4, - (i - starty) * av.getCharHeight() + yoffset }, 3); + (i - starty) * av.getCharHeight() + yoffset }, + 3); } if (above) { gg.fillPolygon( - new int[] { getWidth() - av.getCharHeight(), + new int[] + { getWidth() - av.getCharHeight(), getWidth() - av.getCharHeight(), getWidth() }, - new int[] { - (i - starty + 1) * av.getCharHeight() + yoffset, + new int[] + { (i - starty + 1) * av.getCharHeight() + yoffset, (i - starty + 1) * av.getCharHeight() + yoffset - av.getCharHeight() / 4, - (i - starty + 1) * av.getCharHeight() + yoffset }, 3); + (i - starty + 1) * av.getCharHeight() + yoffset }, + 3); } } void setHiddenFont(SequenceI seq) { - Font bold = new Font(av.getFont().getName(), Font.BOLD, av.getFont() - .getSize()); + Font bold = new Font(av.getFont().getName(), Font.BOLD, + av.getFont().getSize()); if (av.isReferenceSeq(seq) || av.isHiddenRepSequence(seq)) { @@ -555,8 +559,8 @@ public class IdCanvas extends JPanel implements ViewportListenerI { String propertyName = evt.getPropertyName(); if (propertyName.equals(ViewportRanges.STARTSEQ) - || (av.getWrapAlignment() && propertyName - .equals(ViewportRanges.STARTRES))) + || (av.getWrapAlignment() + && propertyName.equals(ViewportRanges.STARTRES))) { fastPaint((int) evt.getNewValue() - (int) evt.getOldValue()); } diff --git a/src/jalview/gui/IdPanel.java b/src/jalview/gui/IdPanel.java index 2d24512..4ccfb2f 100755 --- a/src/jalview/gui/IdPanel.java +++ b/src/jalview/gui/IdPanel.java @@ -48,8 +48,8 @@ import javax.swing.ToolTipManager; * @author $author$ * @version $Revision$ */ -public class IdPanel extends JPanel implements MouseListener, - MouseMotionListener, MouseWheelListener +public class IdPanel extends JPanel + implements MouseListener, MouseMotionListener, MouseWheelListener { private IdCanvas idCanvas; @@ -293,8 +293,8 @@ public class IdPanel extends JPanel implements MouseListener, } if ((av.getSelectionGroup() == null) - || (!jalview.util.Platform.isControlDown(e) && !e.isShiftDown() && av - .getSelectionGroup() != null)) + || (!jalview.util.Platform.isControlDown(e) && !e.isShiftDown() + && av.getSelectionGroup() != null)) { av.setSelectionGroup(new SequenceGroup()); av.getSelectionGroup().setStartRes(0); @@ -395,8 +395,8 @@ public class IdPanel extends JPanel implements MouseListener, for (int i = start; i <= end; i++) { - av.getSelectionGroup().addSequence( - av.getAlignment().getSequenceAt(i), i == end); + av.getSelectionGroup().addSequence(av.getAlignment().getSequenceAt(i), + i == end); } } diff --git a/src/jalview/gui/IdwidthAdjuster.java b/src/jalview/gui/IdwidthAdjuster.java index 0c03db1..3c4107f 100755 --- a/src/jalview/gui/IdwidthAdjuster.java +++ b/src/jalview/gui/IdwidthAdjuster.java @@ -37,8 +37,8 @@ import javax.swing.JPanel; * @author $author$ * @version $Revision$ */ -public class IdwidthAdjuster extends JPanel implements MouseListener, - MouseMotionListener +public class IdwidthAdjuster extends JPanel + implements MouseListener, MouseMotionListener { boolean active = false; diff --git a/src/jalview/gui/JDatabaseTree.java b/src/jalview/gui/JDatabaseTree.java index d92f6c0..0a6b9d6 100644 --- a/src/jalview/gui/JDatabaseTree.java +++ b/src/jalview/gui/JDatabaseTree.java @@ -93,10 +93,8 @@ public class JDatabaseTree extends JalviewDialog implements KeyListener public JDatabaseTree(jalview.ws.SequenceFetcher sfetch) { mainPanel.add(this); - initDialogFrame(mainPanel, true, false, - MessageManager - .getString("label.select_database_retrieval_source"), - 650, 490); + initDialogFrame(mainPanel, true, false, MessageManager + .getString("label.select_database_retrieval_source"), 650, 490); /* * Dynamically generated database list will need a translation function from * internal source to externally distinct names. UNIPROT and UP_NAME are @@ -154,8 +152,8 @@ public class JDatabaseTree extends JalviewDialog implements KeyListener dbviews = new JTree(new DefaultTreeModel(root, false)); dbviews.setCellRenderer(new DbTreeRenderer(this)); - dbviews.getSelectionModel().setSelectionMode( - TreeSelectionModel.SINGLE_TREE_SELECTION); + dbviews.getSelectionModel() + .setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); svp = new JScrollPane(dbviews); svp.setMinimumSize(new Dimension(100, 200)); svp.setPreferredSize(new Dimension(200, 400)); @@ -186,8 +184,8 @@ public class JDatabaseTree extends JalviewDialog implements KeyListener } } }); - JPanel jc = new JPanel(new BorderLayout()), j = new JPanel( - new FlowLayout()); + JPanel jc = new JPanel(new BorderLayout()), + j = new JPanel(new FlowLayout()); jc.add(svp, BorderLayout.CENTER); java.awt.Font f; @@ -241,9 +239,8 @@ public class JDatabaseTree extends JalviewDialog implements KeyListener } else { - throw new Error( - MessageManager - .getString("error.implementation_error_cant_reorder_tree")); + throw new Error(MessageManager + .getString("error.implementation_error_cant_reorder_tree")); } } jalview.util.QuickSort.sort(names, nodes); @@ -254,8 +251,8 @@ public class JDatabaseTree extends JalviewDialog implements KeyListener } } - private class DbTreeRenderer extends DefaultTreeCellRenderer implements - TreeCellRenderer + private class DbTreeRenderer extends DefaultTreeCellRenderer + implements TreeCellRenderer { JDatabaseTree us; @@ -378,8 +375,8 @@ public class JDatabaseTree extends JalviewDialog implements KeyListener { for (TreePath tp : tsel) { - DefaultMutableTreeNode admt, dmt = (DefaultMutableTreeNode) tp - .getLastPathComponent(); + DefaultMutableTreeNode admt, + dmt = (DefaultMutableTreeNode) tp.getLastPathComponent(); if (dmt.getUserObject() != null) { /* @@ -394,13 +391,13 @@ public class JDatabaseTree extends JalviewDialog implements KeyListener { if (allowMultiSelections) { - srcs.addAll(sfetcher.getSourceProxy((String) dmt - .getUserObject())); + srcs.addAll(sfetcher + .getSourceProxy((String) dmt.getUserObject())); } else { - srcs.add(sfetcher - .getSourceProxy((String) dmt.getUserObject()).get(0)); + srcs.add(sfetcher.getSourceProxy((String) dmt.getUserObject()) + .get(0)); forcedFirstChild = true; } } @@ -445,22 +442,26 @@ public class JDatabaseTree extends JalviewDialog implements KeyListener if (allowMultiSelections) { dbstatus.setText(MessageManager.formatMessage( - "label.selected_database_to_fetch_from", new String[] { - Integer.valueOf(srcs.size()).toString(), + "label.selected_database_to_fetch_from", new String[] + { Integer.valueOf(srcs.size()).toString(), (srcs.size() == 1 ? "" : "s"), - (srcs.size() > 0 ? " with " + x + " test quer" - + (x == 1 ? "y" : "ies") : ".") })); + (srcs.size() > 0 + ? " with " + x + " test quer" + + (x == 1 ? "y" : "ies") + : ".") })); } else { if (nm.length() > 0) { - dbstatus.setText(MessageManager.formatMessage( - "label.database_param", new String[] { nm })); + dbstatus.setText(MessageManager + .formatMessage("label.database_param", new String[] + { nm })); if (qr.length() > 0) { - dbstatex.setText(MessageManager.formatMessage( - "label.example_param", new String[] { qr })); + dbstatex.setText(MessageManager + .formatMessage("label.example_param", new String[] + { qr })); } } else diff --git a/src/jalview/gui/Jalview2XML.java b/src/jalview/gui/Jalview2XML.java index ffbe6a1..4c2b8b6 100644 --- a/src/jalview/gui/Jalview2XML.java +++ b/src/jalview/gui/Jalview2XML.java @@ -360,7 +360,8 @@ public class Jalview2XML } public SeqFref newAlcodMapRef(final String sref, - final AlignedCodonFrame _cf, final jalview.datamodel.Mapping _jmap) + final AlignedCodonFrame _cf, + final jalview.datamodel.Mapping _jmap) { SeqFref fref = new SeqFref(sref, "Codon Frame") @@ -412,8 +413,8 @@ public class Jalview2XML } } catch (Exception x) { - System.err - .println("IMPLEMENTATION ERROR: Failed to resolve forward reference for sequence " + System.err.println( + "IMPLEMENTATION ERROR: Failed to resolve forward reference for sequence " + ref.getSref()); x.printStackTrace(); failedtoresolve++; @@ -436,9 +437,9 @@ public class Jalview2XML } if (incompleteSeqs != null && incompleteSeqs.size() > 0) { - System.err.println("Jalview Project Import: There are " - + incompleteSeqs.size() - + " sequences which may have incomplete metadata."); + System.err.println( + "Jalview Project Import: There are " + incompleteSeqs.size() + + " sequences which may have incomplete metadata."); if (incompleteSeqs.size() < 10) { for (SequenceI s : incompleteSeqs.values()) @@ -448,8 +449,8 @@ public class Jalview2XML } else { - System.err - .println("Too many to report. Skipping output of incomplete sequences."); + System.err.println( + "Too many to report. Skipping output of incomplete sequences."); } } } @@ -559,9 +560,8 @@ public class Jalview2XML { AlignFrame af = frames.get(i); // skip ? - if (skipList != null - && skipList - .containsKey(af.getViewport().getSequenceSetId())) + if (skipList != null && skipList + .containsKey(af.getViewport().getSequenceSetId())) { continue; } @@ -581,8 +581,8 @@ public class Jalview2XML saveState(apanel, fileName, jout, viewIds); - String dssid = getDatasetIdRef(af.getViewport().getAlignment() - .getDataset()); + String dssid = getDatasetIdRef( + af.getViewport().getAlignment().getDataset()); if (!dsses.containsKey(dssid)) { dsses.put(dssid, af); @@ -628,8 +628,8 @@ public class Jalview2XML if (shortName.indexOf(File.separatorChar) > -1) { - shortName = shortName.substring(shortName - .lastIndexOf(File.separatorChar) + 1); + shortName = shortName + .substring(shortName.lastIndexOf(File.separatorChar) + 1); } int count = 1; @@ -762,8 +762,8 @@ public class Jalview2XML object.setVamsasModel(new jalview.schemabinding.version2.VamsasModel()); object.setCreationDate(new java.util.Date(System.currentTimeMillis())); - object.setVersion(jalview.bin.Cache.getDefault("VERSION", - "Development Build")); + object.setVersion( + jalview.bin.Cache.getDefault("VERSION", "Development Build")); /** * rjal is full height alignment, jal is actual alignment with full metadata @@ -856,8 +856,8 @@ public class Jalview2XML if (av.hasHiddenRows()) { // use rjal, contains the full height alignment - jseq.setHidden(av.getAlignment().getHiddenSequences() - .isHidden(jds)); + jseq.setHidden( + av.getAlignment().getHiddenSequences().isHidden(jds)); if (av.isHiddenRepSequence(jds)) { @@ -952,8 +952,8 @@ public class Jalview2XML if (frames[f] instanceof StructureViewerBase) { StructureViewerBase viewFrame = (StructureViewerBase) frames[f]; - matchedFile = saveStructureState(ap, jds, pdb, entry, - viewIds, matchedFile, viewFrame); + matchedFile = saveStructureState(ap, jds, pdb, entry, viewIds, + matchedFile, viewFrame); /* * Only store each structure viewer's state once in the project * jar. First time through only (storeDS==false) @@ -969,8 +969,8 @@ public class Jalview2XML viewerState.getBytes()); } catch (IOException e) { - System.err.println("Error saving viewer state: " - + e.getMessage()); + System.err.println( + "Error saving viewer state: " + e.getMessage()); } } } @@ -1042,8 +1042,8 @@ public class Jalview2XML { AlcodMap alcmap = new AlcodMap(); alcmap.setDnasq(seqHash(dnas[m])); - alcmap.setMapping(createVamsasMapping(pmaps[m], dnas[m], null, - false)); + alcmap.setMapping( + createVamsasMapping(pmaps[m], dnas[m], null, false)); alc.addAlcodMap(alcmap); hasMap = true; } @@ -1180,16 +1180,15 @@ public class Jalview2XML ColourSchemeI colourScheme = sg.getColourScheme(); if (colourScheme != null) { - ResidueShaderI groupColourScheme = sg - .getGroupColourScheme(); + ResidueShaderI groupColourScheme = sg.getGroupColourScheme(); if (groupColourScheme.conservationApplied()) { jGroup.setConsThreshold(groupColourScheme.getConservationInc()); if (colourScheme instanceof jalview.schemes.UserColourScheme) { - jGroup.setColour(setUserColourScheme(colourScheme, - userColours, jms)); + jGroup.setColour( + setUserColourScheme(colourScheme, userColours, jms)); } else { @@ -1205,8 +1204,8 @@ public class Jalview2XML } else if (colourScheme instanceof jalview.schemes.UserColourScheme) { - jGroup.setColour(setUserColourScheme(colourScheme, - userColours, jms)); + jGroup.setColour( + setUserColourScheme(colourScheme, userColours, jms)); } else { @@ -1241,8 +1240,8 @@ public class Jalview2XML // /////////SAVE VIEWPORT Viewport view = new Viewport(); view.setTitle(ap.alignFrame.getTitle()); - view.setSequenceSetId(makeHashCode(av.getSequenceSetId(), - av.getSequenceSetId())); + view.setSequenceSetId( + makeHashCode(av.getSequenceSetId(), av.getSequenceSetId())); view.setId(av.getViewId()); if (av.getCodingComplement() != null) { @@ -1280,7 +1279,8 @@ public class Jalview2XML view.setBgColour(setUserColourScheme(av.getGlobalColourScheme(), userColours, jms)); } - else if (av.getGlobalColourScheme() instanceof jalview.schemes.AnnotationColourGradient) + else if (av + .getGlobalColourScheme() instanceof jalview.schemes.AnnotationColourGradient) { AnnotationColours ac = constructAnnotationColours( (jalview.schemes.AnnotationColourGradient) av @@ -1292,8 +1292,8 @@ public class Jalview2XML } else { - view.setBgColour(ColourSchemeProperty.getColourName(av - .getGlobalColourScheme())); + view.setBgColour(ColourSchemeProperty + .getColourName(av.getGlobalColourScheme())); } ResidueShaderI vcs = av.getResidueShading(); @@ -1368,16 +1368,16 @@ public class Jalview2XML setting.setAutoScale(fcol.isAutoScaled()); setting.setThreshold(fcol.getThreshold()); // -1 = No threshold, 0 = Below, 1 = Above - setting.setThreshstate(fcol.isAboveThreshold() ? 1 : (fcol - .isBelowThreshold() ? 0 : -1)); + setting.setThreshstate(fcol.isAboveThreshold() ? 1 + : (fcol.isBelowThreshold() ? 0 : -1)); } else { setting.setColour(fcol.getColour().getRGB()); } - setting.setDisplay(av.getFeaturesDisplayed().isVisible( - featureType)); + setting.setDisplay( + av.getFeaturesDisplayed().isVisible(featureType)); float rorder = ap.getSeqPanel().seqCanvas.getFeatureRenderer() .getOrder(featureType); if (rorder > -1) @@ -1404,7 +1404,7 @@ public class Jalview2XML g.setName(grp); g.setDisplay(((Boolean) ap.getSeqPanel().seqCanvas .getFeatureRenderer().checkGroupVisibility(grp, false)) - .booleanValue()); + .booleanValue()); fs.addGroup(g); groupsAdded.addElement(grp); } @@ -1421,8 +1421,7 @@ public class Jalview2XML } else { - ArrayList hiddenRegions = hidden - .getHiddenColumnsCopy(); + ArrayList hiddenRegions = hidden.getHiddenColumnsCopy(); for (int[] region : hiddenRegions) { HiddenColumns hc = new HiddenColumns(); @@ -1463,8 +1462,8 @@ public class Jalview2XML System.out.println("Writing jar entry " + fileName); JarEntry entry = new JarEntry(fileName); jout.putNextEntry(entry); - PrintWriter pout = new PrintWriter(new OutputStreamWriter(jout, - UTF_8)); + PrintWriter pout = new PrintWriter( + new OutputStreamWriter(jout, UTF_8)); Marshaller marshaller = new Marshaller(pout); marshaller.marshal(object); pout.flush(); @@ -1665,8 +1664,8 @@ public class Jalview2XML final PDBEntry pdbentry = bindingModel.getPdbEntry(peid); final String pdbId = pdbentry.getId(); if (!pdbId.equals(entry.getId()) - && !(entry.getId().length() > 4 && entry.getId() - .toLowerCase().startsWith(pdbId.toLowerCase()))) + && !(entry.getId().length() > 4 && entry.getId().toLowerCase() + .startsWith(pdbId.toLowerCase()))) { /* * not interested in a binding to a different PDB entry here @@ -1679,8 +1678,8 @@ public class Jalview2XML } else if (!matchedFile.equals(pdbentry.getFile())) { - Cache.log - .warn("Probably lost some PDB-Sequence mappings for this structure file (which apparently has same PDB Entry code): " + Cache.log.warn( + "Probably lost some PDB-Sequence mappings for this structure file (which apparently has same PDB Entry code): " + pdbentry.getFile()); } // record the @@ -1689,7 +1688,8 @@ public class Jalview2XML // match is ambiguous (e.g. // 1QIP==1qipA) - for (int smap = 0; smap < viewFrame.getBinding().getSequence()[peid].length; smap++) + for (int smap = 0; smap < viewFrame.getBinding() + .getSequence()[peid].length; smap++) { // if (jal.findIndex(jmol.jmb.sequence[peid][smap]) > -1) if (jds == viewFrame.getBinding().getSequence()[peid][smap]) @@ -1733,12 +1733,13 @@ public class Jalview2XML ac.setAnnotation(acg.getAnnotation().annotationId); if (acg.getBaseColour() instanceof UserColourScheme) { - ac.setColourScheme(setUserColourScheme(acg.getBaseColour(), - userColours, jms)); + ac.setColourScheme( + setUserColourScheme(acg.getBaseColour(), userColours, jms)); } else { - ac.setColourScheme(ColourSchemeProperty.getColourName(acg.getBaseColour())); + ac.setColourScheme( + ColourSchemeProperty.getColourName(acg.getBaseColour())); } ac.setMaxColour(acg.getMaxColour().getRGB()); @@ -1781,11 +1782,10 @@ public class Jalview2XML if (groupIdr == null) { // make a locally unique String - groupRefs.put( - annotation.groupRef, + groupRefs.put(annotation.groupRef, groupIdr = ("" + System.currentTimeMillis() - + annotation.groupRef.getName() + groupRefs - .size())); + + annotation.groupRef.getName() + + groupRefs.size())); } an.setGroupRef(groupIdr.toString()); } @@ -1865,7 +1865,8 @@ public class Jalview2XML } if (annotation.annotations[a].displayCharacter != null) { - ae.setDisplayCharacter(annotation.annotations[a].displayCharacter); + ae.setDisplayCharacter( + annotation.annotations[a].displayCharacter); } if (!Float.isNaN(annotation.annotations[a].value)) @@ -1876,8 +1877,8 @@ public class Jalview2XML ae.setPosition(a); if (annotation.annotations[a].secondaryStructure > ' ') { - ae.setSecondaryStructure(annotation.annotations[a].secondaryStructure - + ""); + ae.setSecondaryStructure( + annotation.annotations[a].secondaryStructure + ""); } if (annotation.annotations[a].colour != null @@ -1939,8 +1940,8 @@ public class Jalview2XML // need to be able to recover 1) settings 2) user-defined presets or // recreate settings from preset 3) predefined settings provided by // service - or settings that can be transferred (or discarded) - vCalcIdParam.setParameters(settings.getWsParamFile().replace("\n", - "|\\n|")); + vCalcIdParam.setParameters( + settings.getWsParamFile().replace("\n", "|\\n|")); vCalcIdParam.setAutoUpdate(settings.isAutoUpdate()); // todo - decide if updateImmediately is needed for any projects. @@ -2000,8 +2001,8 @@ public class Jalview2XML } } throw new Error(MessageManager.formatMessage( - "error.unsupported_version_calcIdparam", - new Object[] { calcIdParam.toString() })); + "error.unsupported_version_calcIdparam", new Object[] + { calcIdParam.toString() })); } /** @@ -2243,8 +2244,8 @@ public class Jalview2XML for (int i = 0; i < 24; i++) { - newColours[i] = new java.awt.Color(Integer.parseInt(colours - .getUserColourScheme().getColour(i).getRGB(), 16)); + newColours[i] = new java.awt.Color(Integer.parseInt( + colours.getUserColourScheme().getColour(i).getRGB(), 16)); } jalview.schemes.UserColourScheme ucs = new jalview.schemes.UserColourScheme( @@ -2255,8 +2256,9 @@ public class Jalview2XML newColours = new java.awt.Color[23]; for (int i = 0; i < 23; i++) { - newColours[i] = new java.awt.Color(Integer.parseInt(colours - .getUserColourScheme().getColour(i + 24).getRGB(), 16)); + newColours[i] = new java.awt.Color(Integer.parseInt( + colours.getUserColourScheme().getColour(i + 24).getRGB(), + 16)); } ucs.setLowerCaseColours(newColours); } @@ -2410,8 +2412,8 @@ public class Jalview2XML if (true) // !skipViewport(object)) { _af = loadFromObject(object, file, true, jprovider); - if (_af != null - && object.getJalviewModelSequence().getViewportCount() > 0) + if (_af != null && object.getJalviewModelSequence() + .getViewportCount() > 0) { if (af == null) { @@ -2443,8 +2445,8 @@ public class Jalview2XML { ex.printStackTrace(); errorMessage = "Couldn't locate Jalview XML file : " + file; - System.err.println("Exception whilst loading jalview XML file : " - + ex + "\n"); + System.err.println( + "Exception whilst loading jalview XML file : " + ex + "\n"); } catch (Exception ex) { System.err.println("Parsing as Jalview Version 2 file failed."); @@ -2473,8 +2475,8 @@ public class Jalview2XML } ex.printStackTrace(); - System.err.println("Exception whilst loading jalview XML file : " - + ex + "\n"); + System.err.println( + "Exception whilst loading jalview XML file : " + ex + "\n"); } catch (OutOfMemoryError e) { // Don't use the OOM Window here @@ -2500,8 +2502,9 @@ public class Jalview2XML { if (ds.getCodonFrames() != null) { - StructureSelectionManager.getStructureSelectionManager( - Desktop.instance).registerMappings(ds.getCodonFrames()); + StructureSelectionManager + .getStructureSelectionManager(Desktop.instance) + .registerMappings(ds.getCodonFrames()); } } if (errorMessage != null) @@ -2651,12 +2654,11 @@ public class Jalview2XML @Override public void run() { - JvOptionPane - .showInternalMessageDialog(Desktop.desktop, - finalErrorMessage, "Error " - + (saving ? "saving" : "loading") - + " Jalview file", - JvOptionPane.WARNING_MESSAGE); + JvOptionPane.showInternalMessageDialog(Desktop.desktop, + finalErrorMessage, + "Error " + (saving ? "saving" : "loading") + + " Jalview file", + JvOptionPane.WARNING_MESSAGE); } }); } @@ -2858,8 +2860,8 @@ public class Jalview2XML if (tmpSeq.getStart() != jseqs[i].getStart() || tmpSeq.getEnd() != jseqs[i].getEnd()) { - System.err - .println("Warning JAL-2154 regression: updating start/end for sequence " + System.err.println( + "Warning JAL-2154 regression: updating start/end for sequence " + tmpSeq.toString() + " to " + jseqs[i]); } } @@ -2932,7 +2934,8 @@ public class Jalview2XML } else { - boolean isdsal = object.getJalviewModelSequence().getViewportCount() == 0; + boolean isdsal = object.getJalviewModelSequence() + .getViewportCount() == 0; if (isdsal) { // we are importing a dataset record, so @@ -3012,7 +3015,8 @@ public class Jalview2XML { // adds dbrefs to datasequence's set (since Jalview 2.10) addDBRefs( - al.getSequenceAt(i).getDatasetSequence() == null ? al.getSequenceAt(i) + al.getSequenceAt(i).getDatasetSequence() == null + ? al.getSequenceAt(i) : al.getSequenceAt(i).getDatasetSequence(), vamsasSeq[i]); } @@ -3057,8 +3061,9 @@ public class Jalview2XML } } } - StructureSelectionManager.getStructureSelectionManager( - Desktop.instance).registerPDBEntry(entry); + StructureSelectionManager + .getStructureSelectionManager(Desktop.instance) + .registerPDBEntry(entry); // adds PDBEntry to datasequence's set (since Jalview 2.10) if (al.getSequenceAt(i).getDatasetSequence() != null) { @@ -3103,8 +3108,8 @@ public class Jalview2XML else { // defer to later - frefedSequence.add(newAlcodMapRef(maps[m].getDnasq(), cf, - mapping)); + frefedSequence.add( + newAlcodMapRef(maps[m].getDnasq(), cf, mapping)); } } } @@ -3145,9 +3150,8 @@ public class Jalview2XML annotation.setAutoCalculated(true); } } - if (autoForView - || (annotation.hasAutoCalculated() && annotation - .isAutoCalculated())) + if (autoForView || (annotation.hasAutoCalculated() + && annotation.isAutoCalculated())) { // remove ID - we don't recover annotation from other views for // view-specific annotation @@ -3189,10 +3193,12 @@ public class Jalview2XML anot[anpos] = new jalview.datamodel.Annotation( - ae[aa].getDisplayCharacter(), ae[aa].getDescription(), - (ae[aa].getSecondaryStructure() == null || ae[aa] - .getSecondaryStructure().length() == 0) ? ' ' - : ae[aa].getSecondaryStructure().charAt(0), + ae[aa].getDisplayCharacter(), ae[aa].getDescription(), + (ae[aa].getSecondaryStructure() == null + || ae[aa].getSecondaryStructure().length() == 0) + ? ' ' + : ae[aa].getSecondaryStructure() + .charAt(0), ae[aa].getValue() ); @@ -3226,10 +3232,11 @@ public class Jalview2XML jaa._linecolour = firstColour; if (annotation.getThresholdLine() != null) { - jaa.setThreshold(new jalview.datamodel.GraphLine(annotation - .getThresholdLine().getValue(), annotation - .getThresholdLine().getLabel(), new java.awt.Color( - annotation.getThresholdLine().getColour()))); + jaa.setThreshold(new jalview.datamodel.GraphLine( + annotation.getThresholdLine().getValue(), + annotation.getThresholdLine().getLabel(), + new java.awt.Color( + annotation.getThresholdLine().getColour()))); } if (autoForView || annotation.isAutoCalculated()) @@ -3360,7 +3367,8 @@ public class Jalview2XML } else { - cs = ColourSchemeProperty.getColourScheme(al, jGroup.getColour()); + cs = ColourSchemeProperty.getColourScheme(al, + jGroup.getColour()); } } int pidThreshold = jGroup.getPidThreshold(); @@ -3387,13 +3395,15 @@ public class Jalview2XML jGroup.getDisplayBoxes(), jGroup.getDisplayText(), jGroup.getColourText(), jGroup.getStart(), jGroup.getEnd()); sg.getGroupColourScheme().setThreshold(pidThreshold, true); - sg.getGroupColourScheme().setConservationInc(jGroup.getConsThreshold()); + sg.getGroupColourScheme() + .setConservationInc(jGroup.getConsThreshold()); sg.setOutlineColour(new java.awt.Color(jGroup.getOutlineColour())); sg.textColour = new java.awt.Color(jGroup.getTextCol1()); sg.textColour2 = new java.awt.Color(jGroup.getTextCol2()); - sg.setShowNonconserved(jGroup.hasShowUnconserved() ? jGroup - .isShowUnconserved() : false); + sg.setShowNonconserved( + jGroup.hasShowUnconserved() ? jGroup.isShowUnconserved() + : false); sg.thresholdTextColour = jGroup.getTextColThreshold(); if (jGroup.hasShowConsensusHistogram()) { @@ -3414,8 +3424,8 @@ public class Jalview2XML } if (jGroup.getConsThreshold() != 0) { - Conservation c = new Conservation("All", sg.getSequences(null), - 0, sg.getWidth() - 1); + Conservation c = new Conservation("All", sg.getSequences(null), 0, + sg.getWidth() - 1); c.calculate(); c.verdict(false, 25); sg.cs.setConservation(c); @@ -3424,8 +3434,8 @@ public class Jalview2XML if (jGroup.getId() != null && groupAnnotRefs.size() > 0) { // re-instate unique group/annotation row reference - List jaal = groupAnnotRefs.get(jGroup - .getId()); + List jaal = groupAnnotRefs + .get(jGroup.getId()); if (jaal != null) { for (AlignmentAnnotation jaa : jaal) @@ -3471,8 +3481,8 @@ public class Jalview2XML // to the same sequenceSet. We must modify this id on load // so that each load of the file gives a unique id String uniqueSeqSetId = view.getSequenceSetId() + uniqueSetSuffix; - String viewId = (view.getId() == null ? null : view.getId() - + uniqueSetSuffix); + String viewId = (view.getId() == null ? null + : view.getId() + uniqueSetSuffix); AlignFrame af = null; AlignViewport av = null; // now check to see if we really need to create a new viewport. @@ -3485,8 +3495,8 @@ public class Jalview2XML // XML. // and then recover its containing af to allow the settings to be applied. // TODO: fix for vamsas demo - System.err - .println("About to recover a viewport for existing alignment: Sequence set ID is " + System.err.println( + "About to recover a viewport for existing alignment: Sequence set ID is " + uniqueSeqSetId); Object seqsetobj = retrieveExistingObj(uniqueSeqSetId); if (seqsetobj != null) @@ -3494,14 +3504,14 @@ public class Jalview2XML if (seqsetobj instanceof String) { uniqueSeqSetId = (String) seqsetobj; - System.err - .println("Recovered extant sequence set ID mapping for ID : New Sequence set ID is " + System.err.println( + "Recovered extant sequence set ID mapping for ID : New Sequence set ID is " + uniqueSeqSetId); } else { - System.err - .println("Warning : Collision between sequence set ID string and existing jalview object mapping."); + System.err.println( + "Warning : Collision between sequence set ID string and existing jalview object mapping."); } } @@ -3510,8 +3520,8 @@ public class Jalview2XML * indicate that annotation colours are applied across all groups (pre * Jalview 2.8.1 behaviour) */ - boolean doGroupAnnColour = Jalview2XML.isVersionStringLaterThan( - "2.8.1", object.getVersion()); + boolean doGroupAnnColour = Jalview2XML.isVersionStringLaterThan("2.8.1", + object.getVersion()); AlignmentPanel ap = null; boolean isnewview = true; @@ -3586,15 +3596,15 @@ public class Jalview2XML for (int i = 0; i < jseq.getRnaViewerCount(); i++) { RnaViewer viewer = jseq.getRnaViewer(i); - AppVarna appVarna = findOrCreateVarnaViewer(viewer, - uniqueSetSuffix, ap); + AppVarna appVarna = findOrCreateVarnaViewer(viewer, uniqueSetSuffix, + ap); for (int j = 0; j < viewer.getSecondaryStructureCount(); j++) { SecondaryStructure ss = viewer.getSecondaryStructure(j); SequenceI seq = seqRefIds.get(jseq.getId()); - AlignmentAnnotation ann = this.annotationIds.get(ss - .getAnnotationId()); + AlignmentAnnotation ann = this.annotationIds + .get(ss.getAnnotationId()); /* * add the structure to the Varna display (with session state copied @@ -3648,10 +3658,9 @@ public class Jalview2XML /* * viewer not found - make it */ - RnaViewerModel model = new RnaViewerModel(postLoadId, - viewer.getTitle(), viewer.getXpos(), viewer.getYpos(), - viewer.getWidth(), viewer.getHeight(), - viewer.getDividerLocation()); + RnaViewerModel model = new RnaViewerModel(postLoadId, viewer.getTitle(), + viewer.getXpos(), viewer.getYpos(), viewer.getWidth(), + viewer.getHeight(), viewer.getDividerLocation()); AppVarna varna = new AppVarna(model, ap); return varna; @@ -3695,8 +3704,8 @@ public class Jalview2XML // TODO: should check if tp has been manipulated by user - if so its // settings shouldn't be modified tp.setTitle(tree.getTitle()); - tp.setBounds(new Rectangle(tree.getXpos(), tree.getYpos(), tree - .getWidth(), tree.getHeight())); + tp.setBounds(new Rectangle(tree.getXpos(), tree.getYpos(), + tree.getWidth(), tree.getHeight())); tp.av = av; // af.viewport; // TODO: verify 'associate with all // views' // works still @@ -3716,13 +3725,13 @@ public class Jalview2XML if (tree.getFontName() != null) { - tp.setTreeFont(new java.awt.Font(tree.getFontName(), tree - .getFontStyle(), tree.getFontSize())); + tp.setTreeFont(new java.awt.Font(tree.getFontName(), + tree.getFontStyle(), tree.getFontSize())); } else { - tp.setTreeFont(new java.awt.Font(view.getFontName(), view - .getFontStyle(), tree.getFontSize())); + tp.setTreeFont(new java.awt.Font(view.getFontName(), + view.getFontStyle(), tree.getFontSize())); } tp.showPlaceholders(tree.getMarkUnlinked()); @@ -3793,12 +3802,12 @@ public class Jalview2XML // TODO: NOW: check that this recovers the PDB file correctly. String pdbFile = loadPDBFile(jprovider, ids[p].getId(), ids[p].getFile()); - jalview.datamodel.SequenceI seq = seqRefIds.get(jseqs[i] - .getId() + ""); + jalview.datamodel.SequenceI seq = seqRefIds + .get(jseqs[i].getId() + ""); if (sviewid == null) { - sviewid = "_jalview_pre2_4_" + x + "," + y + "," + width - + "," + height; + sviewid = "_jalview_pre2_4_" + x + "," + y + "," + width + "," + + height; } if (!structureViewers.containsKey(sviewid)) { @@ -3817,8 +3826,9 @@ public class Jalview2XML // linkAlignPanel,superposeWithAlignpanel}} from hash StructureViewerModel jmoldat = structureViewers.get(sviewid); jmoldat.setAlignWithPanel(jmoldat.isAlignWithPanel() - | (structureState.hasAlignwithAlignPanel() ? structureState - .getAlignwithAlignPanel() : false)); + | (structureState.hasAlignwithAlignPanel() + ? structureState.getAlignwithAlignPanel() + : false)); /* * Default colour by linked panel to false if not specified (e.g. @@ -3826,8 +3836,9 @@ public class Jalview2XML */ boolean colourWithAlignPanel = jmoldat.isColourWithAlignPanel(); colourWithAlignPanel |= (structureState - .hasColourwithAlignPanel() ? structureState - .getColourwithAlignPanel() : false); + .hasColourwithAlignPanel() + ? structureState.getColourwithAlignPanel() + : false); jmoldat.setColourWithAlignPanel(colourWithAlignPanel); /* @@ -3835,8 +3846,9 @@ public class Jalview2XML * pre-2.7 projects) */ boolean colourByViewer = jmoldat.isColourByViewer(); - colourByViewer &= structureState.hasColourByJmol() ? structureState - .getColourByJmol() : true; + colourByViewer &= structureState.hasColourByJmol() + ? structureState.getColourByJmol() + : true; jmoldat.setColourByViewer(colourByViewer); if (jmoldat.getStateData().length() < structureState @@ -3852,8 +3864,7 @@ public class Jalview2XML StructureData seqstrmaps = jmoldat.getFileData().get(mapkey); if (seqstrmaps == null) { - jmoldat.getFileData().put( - mapkey, + jmoldat.getFileData().put(mapkey, seqstrmaps = jmoldat.new StructureData(pdbFile, ids[p].getId())); } @@ -3881,8 +3892,8 @@ public class Jalview2XML createOrLinkStructureViewer(entry, af, ap, jprovider); } catch (Exception e) { - System.err.println("Error loading structure viewer: " - + e.getMessage()); + System.err.println( + "Error loading structure viewer: " + e.getMessage()); // failed - try the next one } } @@ -3974,8 +3985,8 @@ public class Jalview2XML // TODO use StructureViewer as a factory here, see JAL-1761 final PDBEntry[] pdbArray = pdbs.toArray(new PDBEntry[pdbs.size()]); - final SequenceI[][] seqsArray = allseqs.toArray(new SequenceI[allseqs - .size()][]); + final SequenceI[][] seqsArray = allseqs + .toArray(new SequenceI[allseqs.size()][]); String newViewId = viewerData.getKey(); ChimeraViewFrame cvf = new ChimeraViewFrame(chimeraSessionFile, @@ -4086,8 +4097,8 @@ public class Jalview2XML */ histbug += 10; int diff = histbug == -1 ? -1 : newFileLoc.indexOf(";", histbug); - String val = (diff == -1) ? null : newFileLoc - .substring(histbug, diff); + String val = (diff == -1) ? null + : newFileLoc.substring(histbug, diff); if (val != null && val.length() >= 4) { if (val.contains("e")) // eh? what can it be? @@ -4105,8 +4116,8 @@ public class Jalview2XML } } - final String[] pdbf = pdbfilenames.toArray(new String[pdbfilenames - .size()]); + final String[] pdbf = pdbfilenames + .toArray(new String[pdbfilenames.size()]); final String[] id = pdbids.toArray(new String[pdbids.size()]); final SequenceI[][] sq = seqmaps .toArray(new SequenceI[seqmaps.size()][]); @@ -4125,10 +4136,11 @@ public class Jalview2XML JalviewStructureDisplayI sview = null; try { - sview = new StructureViewer(alf.alignPanel - .getStructureSelectionManager()).createView( - StructureViewer.ViewerType.JMOL, pdbf, id, sq, - alf.alignPanel, svattrib, fileloc, rect, sviewid); + sview = new StructureViewer( + alf.alignPanel.getStructureSelectionManager()) + .createView(StructureViewer.ViewerType.JMOL, + pdbf, id, sq, alf.alignPanel, svattrib, + fileloc, rect, sviewid); addNewStructureViewer(sview); } catch (OutOfMemoryError ex) { @@ -4188,9 +4200,8 @@ public class Jalview2XML /* * Post jalview 2.4 schema includes structure view id */ - if (sviewid != null - && ((StructureViewerBase) frame).getViewId() - .equals(sviewid)) + if (sviewid != null && ((StructureViewerBase) frame).getViewId() + .equals(sviewid)) { comp = (StructureViewerBase) frame; break; // break added in 2.9 @@ -4362,8 +4373,9 @@ public class Jalview2XML for (int i = 0; i < JSEQ.length; i++) { - af.viewport.setSequenceColour(af.viewport.getAlignment() - .getSequenceAt(i), new java.awt.Color(JSEQ[i].getColour())); + af.viewport.setSequenceColour( + af.viewport.getAlignment().getSequenceAt(i), + new java.awt.Color(JSEQ[i].getColour())); } if (al.hasSeqrep()) @@ -4403,8 +4415,8 @@ public class Jalview2XML for (int r = 0; r < JSEQ[s].getHiddenSequencesCount(); r++) { isRepresentative = true; - SequenceI sequenceToHide = al.getSequenceAt(JSEQ[s] - .getHiddenSequences(r)); + SequenceI sequenceToHide = al + .getSequenceAt(JSEQ[s].getHiddenSequences(r)); hidden.addSequence(sequenceToHide, false); // remove from hiddenSeqs list so we don't try to hide it twice hiddenSeqs.remove(sequenceToHide); @@ -4417,8 +4429,8 @@ public class Jalview2XML } } - SequenceI[] hseqs = hiddenSeqs.toArray(new SequenceI[hiddenSeqs - .size()]); + SequenceI[] hseqs = hiddenSeqs + .toArray(new SequenceI[hiddenSeqs.size()]); af.viewport.hideSequence(hseqs); } @@ -4434,9 +4446,8 @@ public class Jalview2XML af.viewport.setIncrement(view.getConsThreshold()); af.viewport.setShowJVSuffix(view.getShowFullId()); af.viewport.setRightAlignIds(view.getRightAlignIds()); - af.viewport.setFont( - new java.awt.Font(view.getFontName(), view.getFontStyle(), view - .getFontSize()), true); + af.viewport.setFont(new java.awt.Font(view.getFontName(), + view.getFontStyle(), view.getFontSize()), true); ViewStyleI vs = af.viewport.getViewStyle(); vs.setScaleProteinAsCdna(view.isScaleProteinAsCdna()); af.viewport.setViewStyle(vs); @@ -4453,8 +4464,8 @@ public class Jalview2XML af.viewport.setTextColour(new java.awt.Color(view.getTextCol1())); af.viewport.setTextColour2(new java.awt.Color(view.getTextCol2())); af.viewport.setThresholdTextColour(view.getTextColThreshold()); - af.viewport.setShowUnconserved(view.hasShowUnconserved() ? view - .isShowUnconserved() : false); + af.viewport.setShowUnconserved( + view.hasShowUnconserved() ? view.isShowUnconserved() : false); af.viewport.getRanges().setStartRes(view.getStartRes()); if (view.getViewName() != null) @@ -4491,14 +4502,14 @@ public class Jalview2XML af.viewport.setGlobalColourScheme(cs); af.viewport.getResidueShading().setThreshold(view.getPidThreshold(), view.getIgnoreGapsinConsensus()); - af.viewport.getResidueShading().setConsensus( - af.viewport.getSequenceConsensusHash()); + af.viewport.getResidueShading() + .setConsensus(af.viewport.getSequenceConsensusHash()); af.viewport.setColourAppliesToAllGroups(false); if (view.getConservationSelected() && cs != null) { - af.viewport.getResidueShading().setConservationInc( - view.getConsThreshold()); + af.viewport.getResidueShading() + .setConservationInc(view.getConsThreshold()); } af.changeColour(cs); @@ -4526,8 +4537,8 @@ public class Jalview2XML } if (view.hasShowConsensusHistogram()) { - af.viewport.setShowConsensusHistogram(view - .getShowConsensusHistogram()); + af.viewport + .setShowConsensusHistogram(view.getShowConsensusHistogram()); } else { @@ -4580,17 +4591,18 @@ public class Jalview2XML Map featureColours = new Hashtable<>(); Map featureOrder = new Hashtable<>(); - for (int fs = 0; fs < jms.getFeatureSettings().getSettingCount(); fs++) + for (int fs = 0; fs < jms.getFeatureSettings() + .getSettingCount(); fs++) { Setting setting = jms.getFeatureSettings().getSetting(fs); if (setting.hasMincolour()) { - FeatureColourI gc = setting.hasMin() ? new FeatureColour( - new Color(setting.getMincolour()), new Color( - setting.getColour()), setting.getMin(), - setting.getMax()) : new FeatureColour(new Color( - setting.getMincolour()), new Color(setting.getColour()), - 0, 1); + FeatureColourI gc = setting.hasMin() + ? new FeatureColour(new Color(setting.getMincolour()), + new Color(setting.getColour()), setting.getMin(), + setting.getMax()) + : new FeatureColour(new Color(setting.getMincolour()), + new Color(setting.getColour()), 0, 1); if (setting.hasThreshold()) { gc.setThreshold(setting.getThreshold()); @@ -4619,8 +4631,8 @@ public class Jalview2XML } else { - featureColours.put(setting.getType(), new FeatureColour( - new Color(setting.getColour()))); + featureColours.put(setting.getType(), + new FeatureColour(new Color(setting.getColour()))); } renderOrder[fs] = setting.getType(); if (setting.hasOrder()) @@ -4629,8 +4641,8 @@ public class Jalview2XML } else { - featureOrder.put(setting.getType(), new Float(fs - / jms.getFeatureSettings().getSettingCount())); + featureOrder.put(setting.getType(), new Float( + fs / jms.getFeatureSettings().getSettingCount())); } if (setting.getDisplay()) { @@ -4646,8 +4658,8 @@ public class Jalview2XML // FeatureRendererSettings frs = new FeatureRendererSettings(renderOrder, // fgtable, featureColours, jms.getFeatureSettings().hasTransparency() ? // jms.getFeatureSettings().getTransparency() : 0.0, featureOrder); - FeatureRendererSettings frs = new FeatureRendererSettings( - renderOrder, fgtable, featureColours, 1.0f, featureOrder); + FeatureRendererSettings frs = new FeatureRendererSettings(renderOrder, + fgtable, featureColours, 1.0f, featureOrder); af.alignPanel.getSeqPanel().seqCanvas.getFeatureRenderer() .transferSettings(frs); @@ -4657,9 +4669,9 @@ public class Jalview2XML { for (int c = 0; c < view.getHiddenColumnsCount(); c++) { - af.viewport.hideColumns(view.getHiddenColumns(c).getStart(), view - .getHiddenColumns(c).getEnd() // +1 - ); + af.viewport.hideColumns(view.getHiddenColumns(c).getStart(), + view.getHiddenColumns(c).getEnd() // +1 + ); } } if (view.getCalcIdParam() != null) @@ -4744,7 +4756,8 @@ public class Jalview2XML /* * pre 2.10.2: saved annotationId is AlignmentAnnotation.label */ - if (matchedAnnotation == null && annAlignment.getAlignmentAnnotation() != null) + if (matchedAnnotation == null + && annAlignment.getAlignmentAnnotation() != null) { for (int i = 0; i < annAlignment.getAlignmentAnnotation().length; i++) { @@ -4764,22 +4777,22 @@ public class Jalview2XML } if (matchedAnnotation.getThreshold() == null) { - matchedAnnotation.setThreshold(new GraphLine(viewAnnColour.getThreshold(), - "Threshold", Color.black)); + matchedAnnotation.setThreshold(new GraphLine( + viewAnnColour.getThreshold(), "Threshold", Color.black)); } AnnotationColourGradient cs = null; if (viewAnnColour.getColourScheme().equals("None")) { - cs = new AnnotationColourGradient(matchedAnnotation, new Color( - viewAnnColour.getMinColour()), new Color( - viewAnnColour.getMaxColour()), + cs = new AnnotationColourGradient(matchedAnnotation, + new Color(viewAnnColour.getMinColour()), + new Color(viewAnnColour.getMaxColour()), viewAnnColour.getAboveThreshold()); } else if (viewAnnColour.getColourScheme().startsWith("ucs")) { - cs = new AnnotationColourGradient(matchedAnnotation, getUserColourScheme( - jms, viewAnnColour.getColourScheme()), + cs = new AnnotationColourGradient(matchedAnnotation, + getUserColourScheme(jms, viewAnnColour.getColourScheme()), viewAnnColour.getAboveThreshold()); } else @@ -4838,8 +4851,9 @@ public class Jalview2XML for (JvAnnotRow auan : autoAlan) { visan.put(auan.template.label - + (auan.template.getCalcId() == null ? "" : "\t" - + auan.template.getCalcId()), auan); + + (auan.template.getCalcId() == null ? "" + : "\t" + auan.template.getCalcId()), + auan); } int hSize = al.getAlignmentAnnotation().length; List reorder = new ArrayList<>(); @@ -4942,8 +4956,9 @@ public class Jalview2XML return false; } String id; - if (skipList.containsKey(id = object.getJalviewModelSequence() - .getViewport()[0].getSequenceSetId())) + if (skipList.containsKey( + id = object.getJalviewModelSequence().getViewport()[0] + .getSequenceSetId())) { if (Cache.log != null && Cache.log.isDebugEnabled()) { @@ -4975,8 +4990,8 @@ public class Jalview2XML private void recoverDatasetFor(SequenceSet vamsasSet, AlignmentI al, boolean ignoreUnrefed) { - jalview.datamodel.AlignmentI ds = getDatasetFor(vamsasSet - .getDatasetId()); + jalview.datamodel.AlignmentI ds = getDatasetFor( + vamsasSet.getDatasetId()); Vector dseqs = null; if (ds == null) { @@ -5125,8 +5140,8 @@ public class Jalview2XML } // TODO: merges will never happen if we 'know' we have the real dataset // sequence - this should be detected when id==dssid - System.err - .println("DEBUG Notice: Merged dataset sequence (if you see this often, post at http://issues.jalview.org/browse/JAL-1474)"); // (" + System.err.println( + "DEBUG Notice: Merged dataset sequence (if you see this often, post at http://issues.jalview.org/browse/JAL-1474)"); // (" // + (pre ? "prepended" : "") + " " // + (post ? "appended" : "")); } @@ -5232,8 +5247,9 @@ public class Jalview2XML { DBRef dr = sequence.getDBRef(d); jalview.datamodel.DBRefEntry entry = new jalview.datamodel.DBRefEntry( - sequence.getDBRef(d).getSource(), sequence.getDBRef(d) - .getVersion(), sequence.getDBRef(d).getAccessionId()); + sequence.getDBRef(d).getSource(), + sequence.getDBRef(d).getVersion(), + sequence.getDBRef(d).getAccessionId()); if (dr.getMapping() != null) { entry.setMap(addMapping(dr.getMapping())); @@ -5262,8 +5278,8 @@ public class Jalview2XML fto[_i] = mf.getStart(); fto[_i + 1] = mf.getEnd(); } - jalview.datamodel.Mapping jmap = new jalview.datamodel.Mapping(dsto, - fr, fto, (int) m.getMapFromUnit(), (int) m.getMapToUnit()); + jalview.datamodel.Mapping jmap = new jalview.datamodel.Mapping(dsto, fr, + fto, (int) m.getMapFromUnit(), (int) m.getMapToUnit()); if (m.getMappingChoice() != null) { MappingChoice mc = m.getMappingChoice(); @@ -5299,8 +5315,8 @@ public class Jalview2XML } else { - System.err - .println("Warning - making up dataset sequence id for DbRef sequence map reference"); + System.err.println( + "Warning - making up dataset sequence id for DbRef sequence map reference"); sqid = ((Object) ms).toString(); // make up a new hascode for // undefined dataset sequence hash // (unlikely to happen) diff --git a/src/jalview/gui/Jalview2XML_V1.java b/src/jalview/gui/Jalview2XML_V1.java index 8d71ccf..e94ee0e 100755 --- a/src/jalview/gui/Jalview2XML_V1.java +++ b/src/jalview/gui/Jalview2XML_V1.java @@ -93,8 +93,8 @@ public class Jalview2XML_V1 for (int i = 0; i < csize; i++) { - newColours[i] = new java.awt.Color(Integer.parseInt(colours - .getUserColourScheme().getColour(i).getRGB(), 16)); + newColours[i] = new java.awt.Color(Integer.parseInt( + colours.getUserColourScheme().getColour(i).getRGB(), 16)); } return new jalview.schemes.UserColourScheme(newColours); @@ -152,12 +152,13 @@ public class Jalview2XML_V1 public void run() { - System.err.println("Couldn't locate Jalview XML file : " + ex - + "\n"); + System.err.println( + "Couldn't locate Jalview XML file : " + ex + "\n"); JvOptionPane.showInternalMessageDialog(Desktop.desktop, MessageManager.formatMessage("label.couldnt_locate", - new String[] { file }), MessageManager - .getString("label.url_not_found"), + new String[] + { file }), + MessageManager.getString("label.url_not_found"), JvOptionPane.WARNING_MESSAGE); } }); @@ -178,7 +179,8 @@ public class Jalview2XML_V1 JvOptionPane.showInternalMessageDialog(Desktop.desktop, MessageManager.formatMessage( "label.error_loading_file_params", new String[] - { file }), MessageManager + { file }), + MessageManager .getString("label.error_loading_jalview_file"), JvOptionPane.WARNING_MESSAGE); } @@ -251,8 +253,9 @@ public class Jalview2XML_V1 } } al.getSequenceAt(i).getDatasetSequence().addPDBId(entry); - StructureSelectionManager.getStructureSelectionManager( - Desktop.instance).registerPDBEntry(entry); + StructureSelectionManager + .getStructureSelectionManager(Desktop.instance) + .registerPDBEntry(entry); } } @@ -308,8 +311,9 @@ public class Jalview2XML_V1 for (int i = 0; i < JSEQ.length; i++) { - af.viewport.setSequenceColour(af.viewport.getAlignment() - .getSequenceAt(i), new java.awt.Color(JSEQ[i].getColour())); + af.viewport.setSequenceColour( + af.viewport.getAlignment().getSequenceAt(i), + new java.awt.Color(JSEQ[i].getColour())); } // af.changeColour() ); @@ -331,7 +335,8 @@ public class Jalview2XML_V1 } else { - cs = ColourSchemeProperty.getColourScheme(al, groups[i].getColour()); + cs = ColourSchemeProperty.getColourScheme(al, + groups[i].getColour()); } } int pidThreshold = groups[i].getPidThreshold(); @@ -350,12 +355,13 @@ public class Jalview2XML_V1 groups[i].getStart(), groups[i].getEnd()); sg.getGroupColourScheme().setThreshold(pidThreshold, true); - sg.setOutlineColour(new java.awt.Color(groups[i].getOutlineColour())); + sg.setOutlineColour( + new java.awt.Color(groups[i].getOutlineColour())); if (groups[i].getConsThreshold() != 0) { - Conservation c = new Conservation("All", sg.getSequences(null), - 0, sg.getWidth() - 1); + Conservation c = new Conservation("All", sg.getSequences(null), 0, + sg.getWidth() - 1); c.calculate(); c.verdict(false, 25); sg.cs.setConservation(c); @@ -374,9 +380,8 @@ public class Jalview2XML_V1 af.viewport.setColourText(view.getShowColourText()); af.viewport.setConservationSelected(view.getConservationSelected()); af.viewport.setShowJVSuffix(view.getShowFullId()); - af.viewport.setFont( - new java.awt.Font(view.getFontName(), view.getFontStyle(), view - .getFontSize()), true); + af.viewport.setFont(new java.awt.Font(view.getFontName(), + view.getFontStyle(), view.getFontSize()), true); af.viewport.setRenderGaps(view.getRenderGaps()); af.viewport.setWrapAlignment(view.getWrapAlignment()); @@ -405,17 +410,17 @@ public class Jalview2XML_V1 // } } - af.viewport.getResidueShading().setThreshold( - view.getPidThreshold(), true); - af.viewport.getResidueShading().setConsensus( - af.viewport.getSequenceConsensusHash()); + af.viewport.getResidueShading().setThreshold(view.getPidThreshold(), + true); + af.viewport.getResidueShading() + .setConsensus(af.viewport.getSequenceConsensusHash()); af.viewport.setColourAppliesToAllGroups(false); af.alignPanel.updateLayout(); af.changeColour(cs); if (view.getConservationSelected() && cs != null) { - af.viewport.getResidueShading().setConservationInc( - view.getConsThreshold()); + af.viewport.getResidueShading() + .setConservationInc(view.getConsThreshold()); } af.viewport.setColourAppliesToAllGroups(true); @@ -427,7 +432,8 @@ public class Jalview2XML_V1 Hashtable featureColours = new Hashtable(); String[] renderOrder = new String[jms.getFeatureSettings() .getSettingCount()]; - for (int fs = 0; fs < jms.getFeatureSettings().getSettingCount(); fs++) + for (int fs = 0; fs < jms.getFeatureSettings() + .getSettingCount(); fs++) { Setting setting = jms.getFeatureSettings().getSetting(fs); @@ -442,8 +448,8 @@ public class Jalview2XML_V1 new Integer(setting.getColour())); } } - FeatureRendererSettings frs = new FeatureRendererSettings( - renderOrder, new Hashtable(), featureColours, 1.0f, null); + FeatureRendererSettings frs = new FeatureRendererSettings(renderOrder, + new Hashtable(), featureColours, 1.0f, null); af.alignPanel.getSeqPanel().seqCanvas.getFeatureRenderer() .transferSettings(frs); } @@ -474,13 +480,13 @@ public class Jalview2XML_V1 if (tree.getFontName() != null) { - tp.setTreeFont(new java.awt.Font(tree.getFontName(), tree - .getFontStyle(), tree.getFontSize())); + tp.setTreeFont(new java.awt.Font(tree.getFontName(), + tree.getFontStyle(), tree.getFontSize())); } else { - tp.setTreeFont(new java.awt.Font(view.getFontName(), view - .getFontStyle(), tree.getFontSize())); + tp.setTreeFont(new java.awt.Font(view.getFontName(), + view.getFontStyle(), tree.getFontSize())); } tp.showPlaceholders(tree.getMarkUnlinked()); diff --git a/src/jalview/gui/JalviewChimeraBindingModel.java b/src/jalview/gui/JalviewChimeraBindingModel.java index c9b35d8..2f11c30 100644 --- a/src/jalview/gui/JalviewChimeraBindingModel.java +++ b/src/jalview/gui/JalviewChimeraBindingModel.java @@ -114,8 +114,8 @@ public class JalviewChimeraBindingModel extends JalviewChimeraBinding protected void sendAsynchronousCommand(final String command, final String progressMsg) { - final long handle = progressMsg == null ? 0 : cvf - .startProgressBar(progressMsg); + final long handle = progressMsg == null ? 0 + : cvf.startProgressBar(progressMsg); SwingUtilities.invokeLater(new Runnable() { @Override diff --git a/src/jalview/gui/JvOptionPane.java b/src/jalview/gui/JvOptionPane.java index 539f3c2..7b2e430 100644 --- a/src/jalview/gui/JvOptionPane.java +++ b/src/jalview/gui/JvOptionPane.java @@ -41,16 +41,18 @@ public class JvOptionPane extends JOptionPane public static int showConfirmDialog(Component parentComponent, Object message) throws HeadlessException { - return isInteractiveMode() ? JOptionPane.showConfirmDialog( - parentComponent, message) : (int) getMockResponse(); + return isInteractiveMode() + ? JOptionPane.showConfirmDialog(parentComponent, message) + : (int) getMockResponse(); } public static int showConfirmDialog(Component parentComponent, Object message, String title, int optionType) throws HeadlessException { - return isInteractiveMode() ? JOptionPane.showConfirmDialog( - parentComponent, message, title, optionType) + return isInteractiveMode() + ? JOptionPane.showConfirmDialog(parentComponent, message, title, + optionType) : (int) getMockResponse(); } @@ -58,8 +60,9 @@ public class JvOptionPane extends JOptionPane Object message, String title, int optionType, int messageType) throws HeadlessException { - return isInteractiveMode() ? JOptionPane.showConfirmDialog( - parentComponent, message, title, optionType, messageType) + return isInteractiveMode() + ? JOptionPane.showConfirmDialog(parentComponent, message, title, + optionType, messageType) : (int) getMockResponse(); } @@ -67,31 +70,36 @@ public class JvOptionPane extends JOptionPane Object message, String title, int optionType, int messageType, Icon icon) throws HeadlessException { - return isInteractiveMode() ? JOptionPane.showConfirmDialog( - parentComponent, message, title, optionType, messageType, icon) + return isInteractiveMode() + ? JOptionPane.showConfirmDialog(parentComponent, message, title, + optionType, messageType, icon) : (int) getMockResponse(); } public static int showInternalConfirmDialog(Component parentComponent, Object message) { - return isInteractiveMode() ? JOptionPane.showInternalConfirmDialog( - parentComponent, message) : (int) getMockResponse(); + return isInteractiveMode() + ? JOptionPane.showInternalConfirmDialog(parentComponent, + message) + : (int) getMockResponse(); } public static int showInternalConfirmDialog(Component parentComponent, Object message, String title, int optionType) { - return isInteractiveMode() ? JOptionPane.showConfirmDialog( - parentComponent, message, title, optionType) + return isInteractiveMode() + ? JOptionPane.showConfirmDialog(parentComponent, message, title, + optionType) : (int) getMockResponse(); } public static int showInternalConfirmDialog(Component parentComponent, Object message, String title, int optionType, int messageType) { - return isInteractiveMode() ? JOptionPane.showConfirmDialog( - parentComponent, message, title, optionType, messageType) + return isInteractiveMode() + ? JOptionPane.showConfirmDialog(parentComponent, message, title, + optionType, messageType) : (int) getMockResponse(); } @@ -99,8 +107,9 @@ public class JvOptionPane extends JOptionPane Object message, String title, int optionType, int messageType, Icon icon) { - return isInteractiveMode() ? JOptionPane.showInternalConfirmDialog( - parentComponent, message, title, optionType, messageType, icon) + return isInteractiveMode() + ? JOptionPane.showInternalConfirmDialog(parentComponent, + message, title, optionType, messageType, icon) : (int) getMockResponse(); } @@ -109,9 +118,10 @@ public class JvOptionPane extends JOptionPane Icon icon, Object[] options, Object initialValue) throws HeadlessException { - return isInteractiveMode() ? JOptionPane.showOptionDialog( - parentComponent, message, title, optionType, messageType, icon, - options, initialValue) : (int) getMockResponse(); + return isInteractiveMode() + ? JOptionPane.showOptionDialog(parentComponent, message, title, + optionType, messageType, icon, options, initialValue) + : (int) getMockResponse(); } public static void showMessageDialog(Component parentComponent, @@ -208,22 +218,25 @@ public class JvOptionPane extends JOptionPane public static String showInputDialog(Object message, Object initialSelectionValue) { - return isInteractiveMode() ? JOptionPane.showInputDialog(message, - initialSelectionValue) : getMockResponse().toString(); + return isInteractiveMode() + ? JOptionPane.showInputDialog(message, initialSelectionValue) + : getMockResponse().toString(); } public static String showInputDialog(Component parentComponent, Object message) throws HeadlessException { - return isInteractiveMode() ? JOptionPane.showInputDialog( - parentComponent, message) : getMockResponse().toString(); + return isInteractiveMode() + ? JOptionPane.showInputDialog(parentComponent, message) + : getMockResponse().toString(); } public static String showInputDialog(Component parentComponent, Object message, Object initialSelectionValue) { - return isInteractiveMode() ? JOptionPane.showInputDialog( - parentComponent, message, initialSelectionValue) + return isInteractiveMode() + ? JOptionPane.showInputDialog(parentComponent, message, + initialSelectionValue) : getMockResponse().toString(); } @@ -231,8 +244,9 @@ public class JvOptionPane extends JOptionPane Object message, String title, int messageType) throws HeadlessException { - return isInteractiveMode() ? JOptionPane.showInputDialog( - parentComponent, message, title, messageType) + return isInteractiveMode() + ? JOptionPane.showInputDialog(parentComponent, message, title, + messageType) : getMockResponse().toString(); } @@ -241,24 +255,27 @@ public class JvOptionPane extends JOptionPane Object[] selectionValues, Object initialSelectionValue) throws HeadlessException { - return isInteractiveMode() ? JOptionPane.showInputDialog( - parentComponent, message, title, messageType, icon, - selectionValues, initialSelectionValue) : getMockResponse() - .toString(); + return isInteractiveMode() + ? JOptionPane.showInputDialog(parentComponent, message, title, + messageType, icon, selectionValues, + initialSelectionValue) + : getMockResponse().toString(); } public static String showInternalInputDialog(Component parentComponent, Object message) { - return isInteractiveMode() ? JOptionPane.showInternalInputDialog( - parentComponent, message) : getMockResponse().toString(); + return isInteractiveMode() + ? JOptionPane.showInternalInputDialog(parentComponent, message) + : getMockResponse().toString(); } public static String showInternalInputDialog(Component parentComponent, Object message, String title, int messageType) { - return isInteractiveMode() ? JOptionPane.showInternalInputDialog( - parentComponent, message, title, messageType) + return isInteractiveMode() + ? JOptionPane.showInternalInputDialog(parentComponent, message, + title, messageType) : getMockResponse().toString(); } @@ -266,10 +283,11 @@ public class JvOptionPane extends JOptionPane Object message, String title, int messageType, Icon icon, Object[] selectionValues, Object initialSelectionValue) { - return isInteractiveMode() ? JOptionPane.showInternalInputDialog( - parentComponent, message, title, messageType, icon, - selectionValues, initialSelectionValue) : getMockResponse() - .toString(); + return isInteractiveMode() + ? JOptionPane.showInternalInputDialog(parentComponent, message, + title, messageType, icon, selectionValues, + initialSelectionValue) + : getMockResponse().toString(); } private static void outputMessage(Object message) diff --git a/src/jalview/gui/JvSwingUtils.java b/src/jalview/gui/JvSwingUtils.java index 052c314..0a765cb 100644 --- a/src/jalview/gui/JvSwingUtils.java +++ b/src/jalview/gui/JvSwingUtils.java @@ -60,7 +60,8 @@ public final class JvSwingUtils */ public static String wrapTooltip(boolean enclose, String ttext) { - Objects.requireNonNull(ttext, "Tootip text to format must not be null!"); + Objects.requireNonNull(ttext, + "Tootip text to format must not be null!"); ttext = ttext.trim(); boolean maxLengthExceeded = false; @@ -119,8 +120,8 @@ public final class JvSwingUtils for (int i = 0, iSize = menu.getMenuComponentCount(); i < iSize; i++) { if (menu.getMenuComponent(i) instanceof JMenu - && ((JMenu) menu.getMenuComponent(i)).getText().equals( - submenu)) + && ((JMenu) menu.getMenuComponent(i)).getText() + .equals(submenu)) { submenuinstance = (JMenu) menu.getMenuComponent(i); } @@ -198,8 +199,10 @@ public final class JvSwingUtils public static Font getLabelFont(boolean bold, boolean italic) { - return new java.awt.Font("Verdana", (!bold && !italic) ? Font.PLAIN - : (bold ? Font.BOLD : 0) + (italic ? Font.ITALIC : 0), 11); + return new java.awt.Font("Verdana", + (!bold && !italic) ? Font.PLAIN + : (bold ? Font.BOLD : 0) + (italic ? Font.ITALIC : 0), + 11); } /** @@ -275,8 +278,8 @@ public final class JvSwingUtils * of possible positions. */ float fraction = proportion - * (scrollbar.getMaximum() - scrollbar.getMinimum() - scrollbar - .getModel().getExtent()) + * (scrollbar.getMaximum() - scrollbar.getMinimum() + - scrollbar.getModel().getExtent()) + (scrollbar.getModel().getExtent() / 2f); return Math.min(Math.round(fraction), scrollbar.getMaximum()); } diff --git a/src/jalview/gui/OOMWarning.java b/src/jalview/gui/OOMWarning.java index f519b85..7b9da79 100644 --- a/src/jalview/gui/OOMWarning.java +++ b/src/jalview/gui/OOMWarning.java @@ -56,8 +56,8 @@ public class OOMWarning implements Runnable { if (jalview.bin.Cache.log != null) { - jalview.bin.Cache.log - .error("Out of Memory when " + action, oomex); + jalview.bin.Cache.log.error("Out of Memory when " + action, + oomex); } else { @@ -78,12 +78,10 @@ public class OOMWarning implements Runnable @Override public void run() { - JvOptionPane - .showInternalMessageDialog(desktop, - MessageManager.formatMessage("warn.out_of_memory_when_action", - new String[] { action }), MessageManager - .getString("label.out_of_memory"), - JvOptionPane.WARNING_MESSAGE); + JvOptionPane.showInternalMessageDialog(desktop, MessageManager + .formatMessage("warn.out_of_memory_when_action", new String[] + { action }), MessageManager.getString("label.out_of_memory"), + JvOptionPane.WARNING_MESSAGE); // hope that there's enough memory left that no more appear. oomInprogress = false; } diff --git a/src/jalview/gui/OptsAndParamsPage.java b/src/jalview/gui/OptsAndParamsPage.java index e584eb7..5342c90 100644 --- a/src/jalview/gui/OptsAndParamsPage.java +++ b/src/jalview/gui/OptsAndParamsPage.java @@ -76,8 +76,8 @@ public class OptsAndParamsPage */ boolean compact = false; - public class OptionBox extends JPanel implements MouseListener, - ActionListener + public class OptionBox extends JPanel + implements MouseListener, ActionListener { JCheckBox enabled = new JCheckBox(); @@ -110,21 +110,20 @@ public class OptsAndParamsPage { hasLink = true; - enabled.setToolTipText(JvSwingUtils - .wrapTooltip( - true, - ((desc == null || desc.trim().length() == 0) ? MessageManager - .getString("label.opt_and_params_further_details") - : desc) - + "
    ")); + enabled.setToolTipText(JvSwingUtils.wrapTooltip(true, + ((desc == null || desc.trim().length() == 0) + ? MessageManager.getString( + "label.opt_and_params_further_details") + : desc) + "
    ")); enabled.addMouseListener(this); } else { if (desc != null && desc.trim().length() > 0) { - enabled.setToolTipText(JvSwingUtils.wrapTooltip(true, - opt.getDescription())); + enabled.setToolTipText( + JvSwingUtils.wrapTooltip(true, opt.getDescription())); } } add(enabled, BorderLayout.NORTH); @@ -271,8 +270,8 @@ public class OptsAndParamsPage } - public class ParamBox extends JPanel implements ChangeListener, - ActionListener, MouseListener + public class ParamBox extends JPanel + implements ChangeListener, ActionListener, MouseListener { boolean adjusting = false; @@ -308,7 +307,8 @@ public class OptsAndParamsPage JTextField valueField = null; - public ParamBox(final OptsParametersContainerI pmlayout, ParameterI parm) + public ParamBox(final OptsParametersContainerI pmlayout, + ParameterI parm) { pmdialogbox = pmlayout; finfo = parm.getFurtherDetails(); @@ -349,20 +349,16 @@ public class OptsAndParamsPage && parm.getDescription().trim().length() > 0) { // Only create description boxes if there actually is a description. - ttipText = (JvSwingUtils - .wrapTooltip( - true, - parm.getDescription() - + (finfo != null ? "
    " - + MessageManager - .getString("label.opt_and_params_further_details") - : ""))); - } - - JvSwingUtils.mgAddtoLayout(this, ttipText, - new JLabel(parm.getName()), controlPanel, ""); + ttipText = (JvSwingUtils.wrapTooltip(true, + parm.getDescription() + (finfo != null ? "
    " + + MessageManager.getString( + "label.opt_and_params_further_details") + : ""))); + } + + JvSwingUtils.mgAddtoLayout(this, ttipText, new JLabel(parm.getName()), + controlPanel, ""); updateControls(parm); validate(); } @@ -399,21 +395,18 @@ public class OptsAndParamsPage // Only create description boxes if there actually is a description. if (finfo != null) { - showDesc.setToolTipText(JvSwingUtils.wrapTooltip( - true, - MessageManager - .formatMessage( - "label.opt_and_params_show_brief_desc_image_link", - new String[] { linkImageURL - .toExternalForm() }))); + showDesc.setToolTipText(JvSwingUtils.wrapTooltip(true, + MessageManager.formatMessage( + "label.opt_and_params_show_brief_desc_image_link", + new String[] + { linkImageURL.toExternalForm() }))); showDesc.addMouseListener(this); } else { - showDesc.setToolTipText(JvSwingUtils.wrapTooltip( - true, - MessageManager - .getString("label.opt_and_params_show_brief_desc"))); + showDesc.setToolTipText( + JvSwingUtils.wrapTooltip(true, MessageManager.getString( + "label.opt_and_params_show_brief_desc"))); } showDesc.addActionListener(new ActionListener() { @@ -578,9 +571,8 @@ public class OptsAndParamsPage { if (!adjusting) { - valueField.setText("" - + ((integ) ? ("" + slider.getValue()) : ("" + slider - .getValue() / 1000f))); + valueField.setText("" + ((integ) ? ("" + slider.getValue()) + : ("" + slider.getValue() / 1000f))); checkIfModified(); } @@ -790,8 +782,9 @@ public class OptsAndParamsPage { JPopupMenu mnu = new JPopupMenu(); - JMenuItem mitem = new JMenuItem(MessageManager.formatMessage( - "label.view_params", new String[] { finfo })); + JMenuItem mitem = new JMenuItem( + MessageManager.formatMessage("label.view_params", new String[] + { finfo })); mitem.addActionListener(new ActionListener() { @@ -878,8 +871,8 @@ public class OptsAndParamsPage else { throw new Error(MessageManager.formatMessage( - "error.invalid_value_for_option", new String[] { string, - option.getName() })); + "error.invalid_value_for_option", new String[] + { string, option.getName() })); } } diff --git a/src/jalview/gui/OverviewPanel.java b/src/jalview/gui/OverviewPanel.java index c81ac2f..28de801 100755 --- a/src/jalview/gui/OverviewPanel.java +++ b/src/jalview/gui/OverviewPanel.java @@ -51,8 +51,8 @@ import javax.swing.SwingUtilities; * @author $author$ * @version $Revision$ */ -public class OverviewPanel extends JPanel implements Runnable, - ViewportListenerI +public class OverviewPanel extends JPanel + implements Runnable, ViewportListenerI { private OverviewDimensions od; @@ -80,8 +80,8 @@ public class OverviewPanel extends JPanel implements Runnable, this.ap = alPanel; od = new OverviewDimensionsShowHidden(av.getRanges(), - (av.isShowAnnotation() && av - .getAlignmentConservationAnnotation() != null)); + (av.isShowAnnotation() + && av.getAlignmentConservationAnnotation() != null)); setSize(od.getWidth(), od.getHeight()); @@ -116,15 +116,15 @@ public class OverviewPanel extends JPanel implements Runnable, { // set the mouse position as a fixed point in the box // and drag relative to that position - od.adjustViewportFromMouse(evt.getX(), - evt.getY(), av.getAlignment().getHiddenSequences(), + od.adjustViewportFromMouse(evt.getX(), evt.getY(), + av.getAlignment().getHiddenSequences(), av.getAlignment().getHiddenColumns()); } else { - od.updateViewportFromMouse(evt.getX(), evt.getY(), av - .getAlignment().getHiddenSequences(), av.getAlignment() - .getHiddenColumns()); + od.updateViewportFromMouse(evt.getX(), evt.getY(), + av.getAlignment().getHiddenSequences(), + av.getAlignment().getHiddenColumns()); } } } @@ -235,15 +235,15 @@ public class OverviewPanel extends JPanel implements Runnable, { showHidden = false; od = new OverviewDimensionsHideHidden(av.getRanges(), - (av.isShowAnnotation() && av - .getAlignmentConservationAnnotation() != null)); + (av.isShowAnnotation() + && av.getAlignmentConservationAnnotation() != null)); } else { showHidden = true; od = new OverviewDimensionsShowHidden(av.getRanges(), - (av.isShowAnnotation() && av - .getAlignmentConservationAnnotation() != null)); + (av.isShowAnnotation() + && av.getAlignmentConservationAnnotation() != null)); } oviewCanvas.resetOviewDims(od); updateOverviewImage(); @@ -268,7 +268,7 @@ public class OverviewPanel extends JPanel implements Runnable, od.setWidth(getWidth()); od.setHeight(getHeight()); } - + setPreferredSize(new Dimension(od.getWidth(), od.getHeight())); if (oviewCanvas.restartDraw()) @@ -285,9 +285,9 @@ public class OverviewPanel extends JPanel implements Runnable, public void run() { oviewCanvas.draw(av.isShowSequenceFeatures(), - (av.isShowAnnotation() && av - .getAlignmentConservationAnnotation() != null), ap - .getSeqPanel().seqCanvas.getFeatureRenderer()); + (av.isShowAnnotation() + && av.getAlignmentConservationAnnotation() != null), + ap.getSeqPanel().seqCanvas.getFeatureRenderer()); setBoxPosition(); } @@ -298,8 +298,8 @@ public class OverviewPanel extends JPanel implements Runnable, */ private void setBoxPosition() { - od.setBoxPosition(av.getAlignment().getHiddenSequences(), av - .getAlignment().getHiddenColumns()); + od.setBoxPosition(av.getAlignment().getHiddenSequences(), + av.getAlignment().getHiddenColumns()); repaint(); } diff --git a/src/jalview/gui/PCAPanel.java b/src/jalview/gui/PCAPanel.java index d8e6b06..f861a7c 100644 --- a/src/jalview/gui/PCAPanel.java +++ b/src/jalview/gui/PCAPanel.java @@ -59,8 +59,8 @@ import javax.swing.event.InternalFrameEvent; * @author $author$ * @version $Revision$ */ -public class PCAPanel extends GPCAPanel implements Runnable, - IProgressIndicator +public class PCAPanel extends GPCAPanel + implements Runnable, IProgressIndicator { private IProgressIndicator progressBar; @@ -86,9 +86,12 @@ public class PCAPanel extends GPCAPanel implements Runnable, */ public PCAPanel(AlignmentPanel alignPanel) { - this(alignPanel, ScoreModels.getInstance() - .getDefaultModel(!alignPanel.av.getAlignment().isNucleotide()) - .getName(), SimilarityParams.SeqSpace); + this(alignPanel, + ScoreModels.getInstance() + .getDefaultModel( + !alignPanel.av.getAlignment().isNucleotide()) + .getName(), + SimilarityParams.SeqSpace); } /** @@ -131,8 +134,8 @@ public class PCAPanel extends GPCAPanel implements Runnable, seqs = av.getSelectionGroup().getSequencesInOrder(av.getAlignment()); } - ScoreModelI scoreModel = ScoreModels.getInstance().getScoreModel( - modelName, ap); + ScoreModelI scoreModel = ScoreModels.getInstance() + .getScoreModel(modelName, ap); pcaModel = new PCAModel(seqstrings, seqs, nucleotide, scoreModel, params); PaintRefresher.Register(this, av.getSequenceSetId()); @@ -189,8 +192,8 @@ public class PCAPanel extends GPCAPanel implements Runnable, { if (!pcaModel.getScoreModelName().equals(name)) { - ScoreModelI sm2 = ScoreModels.getInstance().getScoreModel( - name, ap); + ScoreModelI sm2 = ScoreModels.getInstance() + .getScoreModel(name, ap); pcaModel.setScoreModel(sm2); Thread worker = new Thread(PCAPanel.this); worker.start(); @@ -271,8 +274,8 @@ public class PCAPanel extends GPCAPanel implements Runnable, if (!pcaModel.isNucleotide()) { pcaModel.setNucleotide(true); - pcaModel.setScoreModel(ScoreModels.getInstance().getDefaultModel( - false)); + pcaModel.setScoreModel( + ScoreModels.getInstance().getDefaultModel(false)); Thread worker = new Thread(this); worker.start(); } @@ -286,8 +289,8 @@ public class PCAPanel extends GPCAPanel implements Runnable, if (pcaModel.isNucleotide()) { pcaModel.setNucleotide(false); - pcaModel.setScoreModel(ScoreModels.getInstance() - .getDefaultModel(true)); + pcaModel.setScoreModel( + ScoreModels.getInstance().getDefaultModel(true)); Thread worker = new Thread(this); worker.start(); } @@ -385,8 +388,8 @@ public class PCAPanel extends GPCAPanel implements Runnable, // make this an abstract function of all jalview analysis windows if (pcaModel.getSeqtrings() == null) { - jalview.bin.Cache.log - .info("Unexpected call to originalSeqData_actionPerformed - should have hidden this menu action."); + jalview.bin.Cache.log.info( + "Unexpected call to originalSeqData_actionPerformed - should have hidden this menu action."); return; } // decide if av alignment is sufficiently different to original data to @@ -413,8 +416,9 @@ public class PCAPanel extends GPCAPanel implements Runnable, // AlignmentOrder origorder = new AlignmentOrder(alAndColsel[0]); AlignmentI al = new Alignment((SequenceI[]) alAndColsel[0]); - AlignmentI dataset = (av != null && av.getAlignment() != null) ? av - .getAlignment().getDataset() : null; + AlignmentI dataset = (av != null && av.getAlignment() != null) + ? av.getAlignment().getDataset() + : null; if (dataset != null) { al.setDataset(dataset); @@ -424,8 +428,7 @@ public class PCAPanel extends GPCAPanel implements Runnable, { // make a new frame! AlignFrame af = new AlignFrame(al, (HiddenColumns) alAndColsel[1], - AlignFrame.DEFAULT_WIDTH, - AlignFrame.DEFAULT_HEIGHT); + AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT); // >>>This is a fix for the moment, until a better solution is // found!!<<< @@ -435,8 +438,8 @@ public class PCAPanel extends GPCAPanel implements Runnable, // msaorder); Desktop.addInternalFrame(af, MessageManager.formatMessage( - "label.original_data_for_params", - new String[] { this.title }), AlignFrame.DEFAULT_WIDTH, + "label.original_data_for_params", new String[] + { this.title }), AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT); } } @@ -567,8 +570,8 @@ public class PCAPanel extends GPCAPanel implements Runnable, void buildAssociatedViewMenu() { - AlignmentPanel[] aps = PaintRefresher.getAssociatedPanels(av - .getSequenceSetId()); + AlignmentPanel[] aps = PaintRefresher + .getAssociatedPanels(av.getSequenceSetId()); if (aps.length == 1 && rc.av == aps[0].av) { associateViewsMenu.setVisible(false); @@ -577,7 +580,8 @@ public class PCAPanel extends GPCAPanel implements Runnable, associateViewsMenu.setVisible(true); - if ((viewMenu.getItem(viewMenu.getItemCount() - 2) instanceof JMenuItem)) + if ((viewMenu + .getItem(viewMenu.getItemCount() - 2) instanceof JMenuItem)) { viewMenu.insertSeparator(viewMenu.getItemCount() - 1); } @@ -608,7 +612,8 @@ public class PCAPanel extends GPCAPanel implements Runnable, associateViewsMenu.add(item); } - final JRadioButtonMenuItem itemf = new JRadioButtonMenuItem("All Views"); + final JRadioButtonMenuItem itemf = new JRadioButtonMenuItem( + "All Views"); buttonGroup.add(itemf); @@ -641,9 +646,9 @@ public class PCAPanel extends GPCAPanel implements Runnable, cap.setText(pcaModel.getPointsasCsv(false, xCombobox.getSelectedIndex(), yCombobox.getSelectedIndex(), zCombobox.getSelectedIndex())); - Desktop.addInternalFrame(cap, MessageManager.formatMessage( - "label.points_for_params", new String[] { this.getTitle() }), - 500, 500); + Desktop.addInternalFrame(cap, MessageManager + .formatMessage("label.points_for_params", new String[] + { this.getTitle() }), 500, 500); } catch (OutOfMemoryError oom) { new OOMWarning("exporting PCA points", oom); @@ -668,8 +673,8 @@ public class PCAPanel extends GPCAPanel implements Runnable, xCombobox.getSelectedIndex(), yCombobox.getSelectedIndex(), zCombobox.getSelectedIndex())); Desktop.addInternalFrame(cap, MessageManager.formatMessage( - "label.transformed_points_for_params", - new String[] { this.getTitle() }), 500, 500); + "label.transformed_points_for_params", new String[] + { this.getTitle() }), 500, 500); } catch (OutOfMemoryError oom) { new OOMWarning("exporting transformed PCA points", oom); diff --git a/src/jalview/gui/PaintRefresher.java b/src/jalview/gui/PaintRefresher.java index b129971..d731e70 100755 --- a/src/jalview/gui/PaintRefresher.java +++ b/src/jalview/gui/PaintRefresher.java @@ -188,8 +188,8 @@ public class PaintRefresher { // raise an implementation warning here - not sure if this situation // will ever occur - System.err - .println("IMPLEMENTATION PROBLEM: DATASET out of sync due to an insert whilst calling PaintRefresher.validateSequences(AlignmentI, ALignmentI)"); + System.err.println( + "IMPLEMENTATION PROBLEM: DATASET out of sync due to an insert whilst calling PaintRefresher.validateSequences(AlignmentI, ALignmentI)"); } List alsq; synchronized (alsq = comp.getSequences()) diff --git a/src/jalview/gui/PairwiseAlignPanel.java b/src/jalview/gui/PairwiseAlignPanel.java index 22f1368..f75407c 100755 --- a/src/jalview/gui/PairwiseAlignPanel.java +++ b/src/jalview/gui/PairwiseAlignPanel.java @@ -107,13 +107,13 @@ public class PairwiseAlignPanel extends GPairwiseAlignPanel if (count > 2) { - System.out - .println("Pairwise alignment scaled similarity score matrix\n"); + System.out.println( + "Pairwise alignment scaled similarity score matrix\n"); for (int i = 0; i < count; i++) { - jalview.util.Format.print(System.out, "%s \n", ("" + i) + " " - + seqs[i].getName()); + jalview.util.Format.print(System.out, "%s \n", + ("" + i) + " " + seqs[i].getName()); } System.out.println("\n"); @@ -122,8 +122,8 @@ public class PairwiseAlignPanel extends GPairwiseAlignPanel { for (int j = 0; j < i; j++) { - jalview.util.Format.print(System.out, "%7.3f", scores[i][j] - / totscore); + jalview.util.Format.print(System.out, "%7.3f", + scores[i][j] / totscore); } } diff --git a/src/jalview/gui/PopupMenu.java b/src/jalview/gui/PopupMenu.java index 756b77b..3e2eba9 100644 --- a/src/jalview/gui/PopupMenu.java +++ b/src/jalview/gui/PopupMenu.java @@ -180,7 +180,8 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener * @param seq * DOCUMENT ME! */ - public PopupMenu(final AlignmentPanel ap, Sequence seq, List links) + public PopupMenu(final AlignmentPanel ap, Sequence seq, + List links) { this(ap, seq, links, null); } @@ -225,8 +226,9 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener * 'reference annotations' that may be added to the alignment. First for the * currently selected sequence (if there is one): */ - final List selectedSequence = (seq == null ? Collections - . emptyList() : Arrays.asList(seq)); + final List selectedSequence = (seq == null + ? Collections. emptyList() + : Arrays.asList(seq)); buildAnnotationTypesMenus(seqShowAnnotationsMenu, seqHideAnnotationsMenu, selectedSequence); configureReferenceAnnotationsMenu(seqAddReferenceAnnotations, @@ -235,9 +237,9 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener /* * And repeat for the current selection group (if there is one): */ - final List selectedGroup = (ap.av.getSelectionGroup() == null ? Collections - . emptyList() : ap.av.getSelectionGroup() - .getSequences()); + final List selectedGroup = (ap.av.getSelectionGroup() == null + ? Collections. emptyList() + : ap.av.getSelectionGroup().getSequences()); buildAnnotationTypesMenus(groupShowAnnotationsMenu, groupHideAnnotationsMenu, selectedGroup); configureReferenceAnnotationsMenu(groupAddReferenceAnnotations, @@ -257,13 +259,13 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener sequenceMenu.setText(sequence.getName()); if (seq == ap.av.getAlignment().getSeqrep()) { - makeReferenceSeq.setText(MessageManager - .getString("action.unmark_as_reference")); + makeReferenceSeq.setText( + MessageManager.getString("action.unmark_as_reference")); } else { - makeReferenceSeq.setText(MessageManager - .getString("action.set_as_reference")); + makeReferenceSeq.setText( + MessageManager.getString("action.set_as_reference")); } if (!ap.av.getAlignment().isNucleotide()) @@ -290,8 +292,8 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener */ menuItem = new JMenuItem(); menuItem.setText(MessageManager.formatMessage( - "label.2d_rna_structure_line", - new Object[] { aa.label })); + "label.2d_rna_structure_line", new Object[] + { aa.label })); menuItem.addActionListener(new ActionListener() { @Override @@ -318,8 +320,8 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener // TODO: make rnastrucF a bit more nice menuItem = new JMenuItem(); menuItem.setText(MessageManager.formatMessage( - "label.2d_rna_sequence_name", - new Object[] { seq.getName() })); + "label.2d_rna_sequence_name", new Object[] + { seq.getName() })); menuItem.addActionListener(new ActionListener() { @Override @@ -354,9 +356,9 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener if (ap.av.getSelectionGroup() != null && ap.av.getSelectionGroup().getSize() > 1) { - menuItem = new JMenuItem(MessageManager.formatMessage( - "label.represent_group_with", - new Object[] { seq.getName() })); + menuItem = new JMenuItem(MessageManager + .formatMessage("label.represent_group_with", new Object[] + { seq.getName() })); menuItem.addActionListener(new ActionListener() { @Override @@ -417,8 +419,9 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener } SequenceGroup sg = ap.av.getSelectionGroup(); - boolean isDefinedGroup = (sg != null) ? ap.av.getAlignment() - .getGroups().contains(sg) : false; + boolean isDefinedGroup = (sg != null) + ? ap.av.getAlignment().getGroups().contains(sg) + : false; if (sg != null && sg.getSize() > 0) { @@ -452,7 +455,8 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener buildGroupURLMenu(sg, groupLinks); } // Add a 'show all structures' for the current selection - Hashtable pdbe = new Hashtable(), reppdb = new Hashtable(); + Hashtable pdbe = new Hashtable(), + reppdb = new Hashtable(); SequenceI sqass = null; for (SequenceI sq : ap.av.getSequenceSelection()) { @@ -472,9 +476,9 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener } if (pdbe.size() > 0) { - final PDBEntry[] pe = pdbe.values().toArray( - new PDBEntry[pdbe.size()]), pr = reppdb.values().toArray( - new PDBEntry[reppdb.size()]); + final PDBEntry[] pe = pdbe.values() + .toArray(new PDBEntry[pdbe.size()]), + pr = reppdb.values().toArray(new PDBEntry[reppdb.size()]); final JMenuItem gpdbview, rpdbview; } } @@ -586,9 +590,11 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener showMenu.removeAll(); hideMenu.removeAll(); - final List all = Arrays.asList(new String[] { MessageManager - .getString("label.all") }); - addAnnotationTypeToShowHide(showMenu, forSequences, "", all, true, true); + final List all = Arrays + .asList(new String[] + { MessageManager.getString("label.all") }); + addAnnotationTypeToShowHide(showMenu, forSequences, "", all, true, + true); addAnnotationTypeToShowHide(hideMenu, forSequences, "", all, true, false); showMenu.addSeparator(); @@ -714,8 +720,8 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener for (int sq = 0; sq < seqs.length; sq++) { - int start = seqs[sq].findPosition(sg.getStartRes()), end = seqs[sq] - .findPosition(sg.getEndRes()); + int start = seqs[sq].findPosition(sg.getStartRes()), + end = seqs[sq].findPosition(sg.getEndRes()); // just collect ids from dataset sequence // TODO: check if IDs collected from selecton group intersects with the // current selection, too @@ -742,8 +748,8 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener if (((String[]) sarray[1])[sq] == null) { - if (!dbr[d].hasMap() - || (dbr[d].getMap().locateMappedRange(start, end) != null)) + if (!dbr[d].hasMap() || (dbr[d].getMap() + .locateMappedRange(start, end) != null)) { ((String[]) sarray[1])[sq] = dbr[d].getAccessionId(); ((int[]) sarray[0])[0]++; @@ -815,9 +821,10 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener int type = urlLink.getGroupURLType() & 3; // first two bits ofurlLink type bitfield are sequenceids and sequences // TODO: FUTURE: ensure the groupURL menu structure can be generalised - addshowLink(linkMenus[type], label - + (((type & 1) == 1) ? ("(" - + (usingNames ? "Names" : ltarget) + ")") : ""), + addshowLink(linkMenus[type], + label + (((type & 1) == 1) + ? ("(" + (usingNames ? "Names" : ltarget) + ")") + : ""), urlLink, urlset); addMenu = true; } @@ -839,7 +846,8 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener } } - private void addshowLinks(JMenu linkMenu, Collection> linkset) + private void addshowLinks(JMenu linkMenu, + Collection> linkset) { for (List linkstrset : linkset) { @@ -860,8 +868,9 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener private void addshowLink(JMenu linkMenu, String label, final String url) { JMenuItem item = new JMenuItem(label); - item.setToolTipText(MessageManager.formatMessage( - "label.open_url_param", new Object[] { url })); + item.setToolTipText(MessageManager.formatMessage("label.open_url_param", + new Object[] + { url })); item.addActionListener(new ActionListener() { @Override @@ -898,9 +907,9 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener final GroupUrlLink urlgenerator, final Object[] urlstub) { JMenuItem item = new JMenuItem(label); - item.setToolTipText(MessageManager.formatMessage( - "label.open_url_seqs_param", - new Object[] { urlgenerator.getUrl_prefix(), + item.setToolTipText(MessageManager + .formatMessage("label.open_url_seqs_param", new Object[] + { urlgenerator.getUrl_prefix(), urlgenerator.getNumberInvolved(urlstub) })); // TODO: put in info about what is being sent. item.addActionListener(new ActionListener() @@ -948,8 +957,8 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener } }); sequenceMenu.setText(MessageManager.getString("label.sequence")); - sequenceName.setText(MessageManager - .getString("label.edit_name_description")); + sequenceName.setText( + MessageManager.getString("label.edit_name_description")); sequenceName.addActionListener(new ActionListener() { @Override @@ -958,8 +967,8 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener sequenceName_actionPerformed(); } }); - chooseAnnotations.setText(MessageManager - .getString("action.choose_annotations")); + chooseAnnotations + .setText(MessageManager.getString("action.choose_annotations")); chooseAnnotations.addActionListener(new ActionListener() { @Override @@ -968,8 +977,8 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener chooseAnnotations_actionPerformed(e); } }); - sequenceDetails.setText(MessageManager - .getString("label.sequence_details")); + sequenceDetails + .setText(MessageManager.getString("label.sequence_details")); sequenceDetails.addActionListener(new ActionListener() { @Override @@ -978,8 +987,8 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener sequenceDetails_actionPerformed(); } }); - sequenceSelDetails.setText(MessageManager - .getString("label.sequence_details")); + sequenceSelDetails + .setText(MessageManager.getString("label.sequence_details")); sequenceSelDetails.addActionListener(new ActionListener() { @Override @@ -999,8 +1008,8 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener unGroupMenuItem_actionPerformed(); } }); - createGroupMenuItem.setText(MessageManager - .getString("action.create_group")); + createGroupMenuItem + .setText(MessageManager.getString("action.create_group")); createGroupMenuItem.addActionListener(new ActionListener() { @Override @@ -1048,8 +1057,8 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener showColourText_actionPerformed(); } }); - displayNonconserved.setText(MessageManager - .getString("label.show_non_conserved")); + displayNonconserved + .setText(MessageManager.getString("label.show_non_conserved")); displayNonconserved.setState(true); displayNonconserved.addActionListener(new ActionListener() { @@ -1105,18 +1114,18 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener changeCase(e); } }); - outputMenu.setText(MessageManager.getString("label.out_to_textbox") - + "..."); - seqShowAnnotationsMenu.setText(MessageManager - .getString("label.show_annotations")); - seqHideAnnotationsMenu.setText(MessageManager - .getString("label.hide_annotations")); - groupShowAnnotationsMenu.setText(MessageManager - .getString("label.show_annotations")); - groupHideAnnotationsMenu.setText(MessageManager - .getString("label.hide_annotations")); - sequenceFeature.setText(MessageManager - .getString("label.create_sequence_feature")); + outputMenu.setText( + MessageManager.getString("label.out_to_textbox") + "..."); + seqShowAnnotationsMenu + .setText(MessageManager.getString("label.show_annotations")); + seqHideAnnotationsMenu + .setText(MessageManager.getString("label.hide_annotations")); + groupShowAnnotationsMenu + .setText(MessageManager.getString("label.show_annotations")); + groupHideAnnotationsMenu + .setText(MessageManager.getString("label.hide_annotations")); + sequenceFeature.setText( + MessageManager.getString("label.create_sequence_feature")); sequenceFeature.addActionListener(new ActionListener() { @Override @@ -1126,8 +1135,8 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener } }); jMenu1.setText(MessageManager.getString("label.group")); - pdbStructureDialog.setText(MessageManager - .getString("label.show_pdbstruct_dialog")); + pdbStructureDialog.setText( + MessageManager.getString("label.show_pdbstruct_dialog")); pdbStructureDialog.addActionListener(new ActionListener() { @Override @@ -1142,12 +1151,12 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener } }); - rnaStructureMenu.setText(MessageManager - .getString("label.view_rna_structure")); + rnaStructureMenu + .setText(MessageManager.getString("label.view_rna_structure")); // colStructureMenu.setText("Colour By Structure"); - editSequence.setText(MessageManager.getString("label.edit_sequence") - + "..."); + editSequence.setText( + MessageManager.getString("label.edit_sequence") + "..."); editSequence.addActionListener(new ActionListener() { @Override @@ -1156,8 +1165,8 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener editSequence_actionPerformed(actionEvent); } }); - makeReferenceSeq.setText(MessageManager - .getString("label.mark_as_representative")); + makeReferenceSeq.setText( + MessageManager.getString("label.mark_as_representative")); makeReferenceSeq.addActionListener(new ActionListener() { @@ -1168,8 +1177,8 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener } }); - hideInsertions.setText(MessageManager - .getString("label.hide_insertions")); + hideInsertions + .setText(MessageManager.getString("label.hide_insertions")); hideInsertions.addActionListener(new ActionListener() { @@ -1233,7 +1242,7 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener jMenu1.add(outline); jMenu1.add(displayNonconserved); } - + /** * Constructs the entries for the colour menu */ @@ -1250,8 +1259,8 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener } }); - abovePIDColour.setText(MessageManager - .getString("label.above_identity_threshold")); + abovePIDColour.setText( + MessageManager.getString("label.above_identity_threshold")); abovePIDColour.addActionListener(new ActionListener() { @Override @@ -1261,8 +1270,8 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener } }); - modifyPID.setText(MessageManager - .getString("label.modify_identity_threshold")); + modifyPID.setText( + MessageManager.getString("label.modify_identity_threshold")); modifyPID.addActionListener(new ActionListener() { @Override @@ -1272,15 +1281,15 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener } }); - conservationMenuItem.setText(MessageManager - .getString("action.by_conservation")); + conservationMenuItem + .setText(MessageManager.getString("action.by_conservation")); conservationMenuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - conservationMenuItem_actionPerformed(conservationMenuItem - .isSelected()); + conservationMenuItem_actionPerformed( + conservationMenuItem.isSelected()); } }); @@ -1341,8 +1350,7 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener // int threshold = SliderPanel.setPIDSliderSource(ap, sg.cs, getGroup() // .getName()); // sg.cs.setThreshold(threshold, ap.av.isIgnoreGapsConsensus()); - SliderPanel.setPIDSliderSource(ap, sg.cs, getGroup() - .getName()); + SliderPanel.setPIDSliderSource(ap, sg.cs, getGroup().getName()); SliderPanel.showPIDSlider(); } } @@ -1372,8 +1380,8 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener SortedMap tipEntries = new TreeMap(); final Map> candidates = new LinkedHashMap>(); AlignmentI al = this.ap.av.getAlignment(); - AlignmentUtils.findAddableReferenceAnnotations(forSequences, - tipEntries, candidates, al); + AlignmentUtils.findAddableReferenceAnnotations(forSequences, tipEntries, + candidates, al); if (!candidates.isEmpty()) { StringBuilder tooltip = new StringBuilder(64); @@ -1460,8 +1468,8 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener if (ap.av.getSelectionGroup() != null) { // mark just the columns in the selection group to be hidden - inserts.set(ap.av.getSelectionGroup().getStartRes(), ap.av - .getSelectionGroup().getEndRes() + 1); + inserts.set(ap.av.getSelectionGroup().getStartRes(), + ap.av.getSelectionGroup().getEndRes() + 1); // and clear that part of the mask mask.andNot(inserts); @@ -1517,30 +1525,27 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener StringBuilder contents = new StringBuilder(128); for (SequenceI seq : sequences) { - contents.append("

    " - + MessageManager - .formatMessage( - "label.create_sequence_details_report_annotation_for", - new Object[] { seq.getDisplayId(true) }) - + "

    "); - new SequenceAnnotationReport(null) - .createSequenceAnnotationReport( - contents, - seq, - true, - true, - (ap.getSeqPanel().seqCanvas.fr != null) ? ap - .getSeqPanel().seqCanvas.fr.getMinMax() - : null); + contents.append("

    " + MessageManager.formatMessage( + "label.create_sequence_details_report_annotation_for", + new Object[] + { seq.getDisplayId(true) }) + "

    "); + new SequenceAnnotationReport(null).createSequenceAnnotationReport( + contents, seq, true, true, + (ap.getSeqPanel().seqCanvas.fr != null) + ? ap.getSeqPanel().seqCanvas.fr.getMinMax() + : null); contents.append("

    "); } cap.setText("" + contents.toString() + ""); - Desktop.addInternalFrame(cap, MessageManager.formatMessage( - "label.sequence_details_for", - (sequences.length == 1 ? new Object[] { sequences[0] - .getDisplayId(true) } : new Object[] { MessageManager - .getString("label.selection") })), 500, 400); + Desktop.addInternalFrame(cap, + MessageManager.formatMessage("label.sequence_details_for", + (sequences.length == 1 ? new Object[] + { sequences[0].getDisplayId(true) } + : new Object[] + { MessageManager + .getString("label.selection") })), + 500, 400); } @@ -1588,8 +1593,7 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener sg.getStartRes(), sg.getEndRes() + 1)); int threshold = SliderPanel.setPIDSliderSource(ap, - sg.getGroupColourScheme(), getGroup() - .getName()); + sg.getGroupColourScheme(), getGroup().getName()); sg.cs.setThreshold(threshold, ap.av.isIgnoreGapsConsensus()); @@ -1635,9 +1639,9 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener if (selected) { // JBPNote: Conservation name shouldn't be i18n translated - Conservation c = new Conservation("Group", sg.getSequences(ap.av - .getHiddenRepSequences()), sg.getStartRes(), - sg.getEndRes() + 1); + Conservation c = new Conservation("Group", + sg.getSequences(ap.av.getHiddenRepSequences()), + sg.getStartRes(), sg.getEndRes() + 1); c.calculate(); c.verdict(false, ap.av.getConsPercGaps()); @@ -1669,8 +1673,8 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener SequenceGroup sg = getGroup(); EditNameDialog dialog = new EditNameDialog(sg.getName(), - sg.getDescription(), " " - + MessageManager.getString("label.group_name") + " ", + sg.getDescription(), + " " + MessageManager.getString("label.group_name") + " ", MessageManager.getString("label.group_description") + " ", MessageManager.getString("label.edit_group_name_description"), ap.alignFrame); @@ -1715,8 +1719,8 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener " " + MessageManager.getString("label.sequence_name") + " ", MessageManager.getString("label.sequence_description") + " ", - MessageManager - .getString("label.edit_sequence_name_description"), + MessageManager.getString( + "label.edit_sequence_name_description"), ap.alignFrame); if (!dialog.accept) @@ -1728,14 +1732,12 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener { if (dialog.getName().indexOf(" ") > -1) { - JvOptionPane - .showMessageDialog( - ap, - MessageManager - .getString("label.spaces_converted_to_backslashes"), - MessageManager - .getString("label.no_spaces_allowed_sequence_name"), - JvOptionPane.WARNING_MESSAGE); + JvOptionPane.showMessageDialog(ap, + MessageManager + .getString("label.spaces_converted_to_backslashes"), + MessageManager + .getString("label.no_spaces_allowed_sequence_name"), + JvOptionPane.WARNING_MESSAGE); } sequence.setName(dialog.getName().replace(' ', '_')); @@ -1744,8 +1746,8 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener sequence.setDescription(dialog.getDescription()); - ap.av.firePropertyChange("alignment", null, ap.av.getAlignment() - .getSequences()); + ap.av.firePropertyChange("alignment", null, + ap.av.getAlignment().getSequences()); } @@ -1893,8 +1895,8 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener ap.alignFrame.addHistoryItem(caseCommand); - ap.av.firePropertyChange("alignment", null, ap.av.getAlignment() - .getSequences()); + ap.av.firePropertyChange("alignment", null, + ap.av.getAlignment().getSequences()); } } @@ -1903,9 +1905,9 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener { CutAndPasteTransfer cap = new CutAndPasteTransfer(); cap.setForInput(null); - Desktop.addInternalFrame(cap, MessageManager.formatMessage( - "label.alignment_output_command", - new Object[] { e.getActionCommand() }), 600, 500); + Desktop.addInternalFrame(cap, MessageManager + .formatMessage("label.alignment_output_command", new Object[] + { e.getActionCommand() }), 600, 500); String[] omitHidden = null; @@ -1913,8 +1915,10 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener // or we simply trust the user wants // wysiwig behaviour - FileFormatI fileFormat = FileFormats.getInstance().forName(e.getActionCommand()); - cap.setText(new FormatAdapter(ap).formatSequences(fileFormat, ap, true)); + FileFormatI fileFormat = FileFormats.getInstance() + .forName(e.getActionCommand()); + cap.setText( + new FormatAdapter(ap).formatSequences(fileFormat, ap, true)); } public void sequenceFeature_actionPerformed() @@ -1940,7 +1944,8 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener if (start <= end) { seqs.add(sg.getSequenceAt(i).getDatasetSequence()); - features.add(new SequenceFeature(null, null, null, start, end, null)); + features.add( + new SequenceFeature(null, null, null, start, end, null)); } } @@ -1949,8 +1954,8 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener */ if (!seqs.isEmpty()) { - if (ap.getSeqPanel().seqCanvas.getFeatureRenderer().amendFeatures( - seqs, features, true, ap)) + if (ap.getSeqPanel().seqCanvas.getFeatureRenderer() + .amendFeatures(seqs, features, true, ap)) { ap.alignFrame.setShowSeqFeatures(true); ap.highlightSearchResults(null); @@ -1999,8 +2004,8 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener EditNameDialog dialog = new EditNameDialog( sequence.getSequenceAsString(sg.getStartRes(), - sg.getEndRes() + 1), null, - MessageManager.getString("label.edit_sequence"), null, + sg.getEndRes() + 1), + null, MessageManager.getString("label.edit_sequence"), null, MessageManager.getString("label.edit_sequence"), ap.alignFrame); @@ -2008,15 +2013,15 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener { EditCommand editCommand = new EditCommand( MessageManager.getString("label.edit_sequences"), - Action.REPLACE, dialog.getName().replace(' ', - ap.av.getGapCharacter()), + Action.REPLACE, + dialog.getName().replace(' ', ap.av.getGapCharacter()), sg.getSequencesAsArray(ap.av.getHiddenRepSequences()), sg.getStartRes(), sg.getEndRes() + 1, ap.av.getAlignment()); ap.alignFrame.addHistoryItem(editCommand); - ap.av.firePropertyChange("alignment", null, ap.av.getAlignment() - .getSequences()); + ap.av.firePropertyChange("alignment", null, + ap.av.getAlignment().getSequences()); } } } diff --git a/src/jalview/gui/Preferences.java b/src/jalview/gui/Preferences.java index cccdd2e..c3c9239 100755 --- a/src/jalview/gui/Preferences.java +++ b/src/jalview/gui/Preferences.java @@ -213,18 +213,18 @@ public class Preferences extends GPreferences showUnconserved .setSelected(Cache.getDefault("SHOW_UNCONSERVED", false)); showOccupancy.setSelected(Cache.getDefault(SHOW_OCCUPANCY, false)); - showGroupConsensus.setSelected(Cache.getDefault("SHOW_GROUP_CONSENSUS", - false)); - showGroupConservation.setSelected(Cache.getDefault( - "SHOW_GROUP_CONSERVATION", false)); - showConsensHistogram.setSelected(Cache.getDefault( - "SHOW_CONSENSUS_HISTOGRAM", true)); - showConsensLogo.setSelected(Cache.getDefault("SHOW_CONSENSUS_LOGO", - false)); - showNpTooltip.setSelected(Cache - .getDefault("SHOW_NPFEATS_TOOLTIP", true)); - showDbRefTooltip.setSelected(Cache.getDefault("SHOW_DBREFS_TOOLTIP", - true)); + showGroupConsensus + .setSelected(Cache.getDefault("SHOW_GROUP_CONSENSUS", false)); + showGroupConservation.setSelected( + Cache.getDefault("SHOW_GROUP_CONSERVATION", false)); + showConsensHistogram.setSelected( + Cache.getDefault("SHOW_CONSENSUS_HISTOGRAM", true)); + showConsensLogo + .setSelected(Cache.getDefault("SHOW_CONSENSUS_LOGO", false)); + showNpTooltip + .setSelected(Cache.getDefault("SHOW_NPFEATS_TOOLTIP", true)); + showDbRefTooltip + .setSelected(Cache.getDefault("SHOW_DBREFS_TOOLTIP", true)); String[] fonts = java.awt.GraphicsEnvironment .getLocalGraphicsEnvironment().getAvailableFontFamilyNames(); @@ -244,12 +244,12 @@ public class Preferences extends GPreferences fontNameCB.setSelectedItem(Cache.getDefault("FONT_NAME", "SansSerif")); fontSizeCB.setSelectedItem(Cache.getDefault("FONT_SIZE", "10")); - fontStyleCB.setSelectedItem(Cache.getDefault("FONT_STYLE", Font.PLAIN - + "")); + fontStyleCB.setSelectedItem( + Cache.getDefault("FONT_STYLE", Font.PLAIN + "")); smoothFont.setSelected(Cache.getDefault("ANTI_ALIAS", false)); - scaleProteinToCdna.setSelected(Cache.getDefault(SCALE_PROTEIN_TO_CDNA, - false)); + scaleProteinToCdna + .setSelected(Cache.getDefault(SCALE_PROTEIN_TO_CDNA, false)); idItalics.setSelected(Cache.getDefault("ID_ITALICS", true)); @@ -303,10 +303,10 @@ public class Preferences extends GPreferences protColour.setSelectedItem(newProp != null ? newProp : oldProp); newProp = Cache.getDefault(DEFAULT_COLOUR_NUC, null); nucColour.setSelectedItem(newProp != null ? newProp : oldProp); - minColour.setBackground(Cache.getDefaultColour("ANNOTATIONCOLOUR_MIN", - Color.orange)); - maxColour.setBackground(Cache.getDefaultColour("ANNOTATIONCOLOUR_MAX", - Color.red)); + minColour.setBackground( + Cache.getDefaultColour("ANNOTATIONCOLOUR_MIN", Color.orange)); + maxColour.setBackground( + Cache.getDefaultColour("ANNOTATIONCOLOUR_MAX", Color.red)); /* * Set Structure tab defaults. @@ -319,8 +319,8 @@ public class Preferences extends GPreferences addSecondaryStructure.setEnabled(structSelected); addTempFactor.setSelected(Cache.getDefault(ADD_TEMPFACT_ANN, false)); addTempFactor.setEnabled(structSelected); - structViewer.setSelectedItem(Cache.getDefault(STRUCTURE_DISPLAY, - ViewerType.JMOL.name())); + structViewer.setSelectedItem( + Cache.getDefault(STRUCTURE_DISPLAY, ViewerType.JMOL.name())); chimeraPath.setText(Cache.getDefault(CHIMERA_PATH, "")); chimeraPath.addActionListener(new ActionListener() { @@ -359,12 +359,12 @@ public class Preferences extends GPreferences SortOrder.DESCENDING)); sortKeys.add(new RowSorter.SortKey(m.getSelectedColumn(), SortOrder.DESCENDING)); - sortKeys.add(new RowSorter.SortKey(m.getNameColumn(), - SortOrder.ASCENDING)); + sortKeys.add( + new RowSorter.SortKey(m.getNameColumn(), SortOrder.ASCENDING)); sorter.setSortKeys(sortKeys); sorter.sort(); - + // set up filtering ActionListener onReset; onReset = new ActionListener() @@ -413,35 +413,35 @@ public class Preferences extends GPreferences @Override public void changedUpdate(DocumentEvent e) { - sorter.setRowFilter(RowFilter.regexFilter(caseInsensitiveFlag - + filterTB.getText())); + sorter.setRowFilter(RowFilter + .regexFilter(caseInsensitiveFlag + filterTB.getText())); } @Override public void removeUpdate(DocumentEvent e) { - sorter.setRowFilter(RowFilter.regexFilter(caseInsensitiveFlag - + filterTB.getText())); + sorter.setRowFilter(RowFilter + .regexFilter(caseInsensitiveFlag + filterTB.getText())); } @Override public void insertUpdate(DocumentEvent e) { - sorter.setRowFilter(RowFilter.regexFilter(caseInsensitiveFlag - + filterTB.getText())); + sorter.setRowFilter(RowFilter + .regexFilter(caseInsensitiveFlag + filterTB.getText())); } }); // set up list selection functionality - linkUrlTable.getSelectionModel().addListSelectionListener( - new UrlListSelectionHandler()); + linkUrlTable.getSelectionModel() + .addListSelectionListener(new UrlListSelectionHandler()); // set up radio buttons int onClickCol = ((UrlLinkTableModel) linkUrlTable.getModel()) .getPrimaryColumn(); String onClickName = linkUrlTable.getColumnName(onClickCol); - linkUrlTable.getColumn(onClickName).setCellRenderer( - new RadioButtonRenderer()); + linkUrlTable.getColumn(onClickName) + .setCellRenderer(new RadioButtonRenderer()); linkUrlTable.getColumn(onClickName) .setCellEditor(new RadioButtonEditor()); @@ -451,8 +451,8 @@ public class Preferences extends GPreferences if (linkUrlTable.getModel().getColumnClass(column) .equals(Boolean.class)) { - TableColumn tableColumn = linkUrlTable.getColumnModel().getColumn( - column); + TableColumn tableColumn = linkUrlTable.getColumnModel() + .getColumn(column); int preferredWidth = tableColumn.getMinWidth(); TableCellRenderer cellRenderer = linkUrlTable.getCellRenderer(0, @@ -512,14 +512,14 @@ public class Preferences extends GPreferences pileupjv.setSelected(Cache.getDefault("PILEUP_JVSUFFIX", true)); pirjv.setSelected(Cache.getDefault("PIR_JVSUFFIX", true)); modellerOutput.setSelected(Cache.getDefault("PIR_MODELLER", false)); - embbedBioJSON.setSelected(Cache.getDefault("EXPORT_EMBBED_BIOJSON", - true)); + embbedBioJSON + .setSelected(Cache.getDefault("EXPORT_EMBBED_BIOJSON", true)); /* * Set Editing tab defaults */ - autoCalculateConsCheck.setSelected(Cache.getDefault( - "AUTO_CALC_CONSENSUS", true)); + autoCalculateConsCheck + .setSelected(Cache.getDefault("AUTO_CALC_CONSENSUS", true)); padGaps.setSelected(Cache.getDefault("PAD_GAPS", false)); sortByTree.setSelected(Cache.getDefault("SORT_BY_TREE", false)); @@ -561,15 +561,15 @@ public class Preferences extends GPreferences Cache.applicationProperties.setProperty("SHOW_IDENTITY", Boolean.toString(identity.isSelected())); - Cache.applicationProperties.setProperty("GAP_SYMBOL", gapSymbolCB - .getSelectedItem().toString()); + Cache.applicationProperties.setProperty("GAP_SYMBOL", + gapSymbolCB.getSelectedItem().toString()); - Cache.applicationProperties.setProperty("FONT_NAME", fontNameCB - .getSelectedItem().toString()); - Cache.applicationProperties.setProperty("FONT_STYLE", fontStyleCB - .getSelectedItem().toString()); - Cache.applicationProperties.setProperty("FONT_SIZE", fontSizeCB - .getSelectedItem().toString()); + Cache.applicationProperties.setProperty("FONT_NAME", + fontNameCB.getSelectedItem().toString()); + Cache.applicationProperties.setProperty("FONT_STYLE", + fontStyleCB.getSelectedItem().toString()); + Cache.applicationProperties.setProperty("FONT_SIZE", + fontSizeCB.getSelectedItem().toString()); Cache.applicationProperties.setProperty("ID_ITALICS", Boolean.toString(idItalics.isSelected())); @@ -602,8 +602,8 @@ public class Preferences extends GPreferences Cache.applicationProperties.setProperty("SHOW_STARTUP_FILE", Boolean.toString(startupCheckbox.isSelected())); - Cache.applicationProperties.setProperty("SORT_ALIGNMENT", sortby - .getSelectedItem().toString()); + Cache.applicationProperties.setProperty("SORT_ALIGNMENT", + sortby.getSelectedItem().toString()); // convert description of sort order to enum name for save SequenceAnnotationOrder annSortOrder = SequenceAnnotationOrder @@ -615,16 +615,16 @@ public class Preferences extends GPreferences } final boolean showAutocalcFirst = sortAutocalc.getSelectedIndex() == 0; - Cache.applicationProperties.setProperty(SHOW_AUTOCALC_ABOVE, Boolean - .valueOf(showAutocalcFirst).toString()); + Cache.applicationProperties.setProperty(SHOW_AUTOCALC_ABOVE, + Boolean.valueOf(showAutocalcFirst).toString()); /* * Save Colours settings */ - Cache.applicationProperties.setProperty(DEFAULT_COLOUR_PROT, protColour - .getSelectedItem().toString()); - Cache.applicationProperties.setProperty(DEFAULT_COLOUR_NUC, nucColour - .getSelectedItem().toString()); + Cache.applicationProperties.setProperty(DEFAULT_COLOUR_PROT, + protColour.getSelectedItem().toString()); + Cache.applicationProperties.setProperty(DEFAULT_COLOUR_NUC, + nucColour.getSelectedItem().toString()); Cache.setColourProperty("ANNOTATIONCOLOUR_MIN", minColour.getBackground()); Cache.setColourProperty("ANNOTATIONCOLOUR_MAX", @@ -641,8 +641,8 @@ public class Preferences extends GPreferences Boolean.toString(useRnaView.isSelected())); Cache.applicationProperties.setProperty(STRUCT_FROM_PDB, Boolean.toString(structFromPdb.isSelected())); - Cache.applicationProperties.setProperty(STRUCTURE_DISPLAY, structViewer - .getSelectedItem().toString()); + Cache.applicationProperties.setProperty(STRUCTURE_DISPLAY, + structViewer.getSelectedItem().toString()); Cache.setOrRemove(CHIMERA_PATH, chimeraPath.getText()); Cache.applicationProperties.setProperty("MAP_WITH_SIFTS", Boolean.toString(siftsMapping.isSelected())); @@ -804,11 +804,11 @@ public class Preferences extends GPreferences public void startupFileTextfield_mouseClicked() { String fileFormat = Cache.getProperty("DEFAULT_FILE_FORMAT"); - JalviewFileChooser chooser = JalviewFileChooser.forRead( - Cache.getProperty("LAST_DIRECTORY"), fileFormat); + JalviewFileChooser chooser = JalviewFileChooser + .forRead(Cache.getProperty("LAST_DIRECTORY"), fileFormat); chooser.setFileView(new JalviewFileView()); - chooser.setDialogTitle(MessageManager - .getString("label.select_startup_file")); + chooser.setDialogTitle( + MessageManager.getString("label.select_startup_file")); int value = chooser.showOpenDialog(this); @@ -820,8 +820,8 @@ public class Preferences extends GPreferences Cache.applicationProperties.setProperty("DEFAULT_FILE_FORMAT", format.getName()); } - startupFileTextfield.setText(chooser.getSelectedFile() - .getAbsolutePath()); + startupFileTextfield + .setText(chooser.getSelectedFile().getAbsolutePath()); } } @@ -874,15 +874,16 @@ public class Preferences extends GPreferences { if (JvOptionPane.showInternalConfirmDialog(Desktop.desktop, link, MessageManager.getString("label.new_sequence_url_link"), - JvOptionPane.OK_CANCEL_OPTION, -1, null) == JvOptionPane.OK_OPTION) + JvOptionPane.OK_CANCEL_OPTION, -1, + null) == JvOptionPane.OK_OPTION) { if (link.checkValid()) { if (((UrlLinkTableModel) linkUrlTable.getModel()) .isUniqueName(link.getName())) { - ((UrlLinkTableModel) linkUrlTable.getModel()).insertRow( - link.getName(), link.getURL()); + ((UrlLinkTableModel) linkUrlTable.getModel()) + .insertRow(link.getName(), link.getURL()); valid = true; } else @@ -925,7 +926,8 @@ public class Preferences extends GPreferences { if (JvOptionPane.showInternalConfirmDialog(Desktop.desktop, link, MessageManager.getString("label.edit_sequence_url_link"), - JvOptionPane.OK_CANCEL_OPTION, -1, null) == JvOptionPane.OK_OPTION) + JvOptionPane.OK_CANCEL_OPTION, -1, + null) == JvOptionPane.OK_OPTION) { if (link.checkValid()) { @@ -971,13 +973,12 @@ public class Preferences extends GPreferences ((UrlLinkTableModel) linkUrlTable.getModel()).removeRow(modelIndex); } - @Override public void defaultBrowser_mouseClicked(MouseEvent e) { JFileChooser chooser = new JFileChooser("."); - chooser.setDialogTitle(MessageManager - .getString("label.select_default_browser")); + chooser.setDialogTitle( + MessageManager.getString("label.select_default_browser")); int value = chooser.showOpenDialog(this); @@ -1050,8 +1051,9 @@ public class Preferences extends GPreferences } } catch (NumberFormatException x) { - JvOptionPane.showInternalMessageDialog(Desktop.desktop, MessageManager - .getString("warn.user_defined_width_requirements"), + JvOptionPane.showInternalMessageDialog(Desktop.desktop, + MessageManager + .getString("warn.user_defined_width_requirements"), MessageManager.getString("label.invalid_id_column_width"), JvOptionPane.WARNING_MESSAGE); userIdWidth.setText(""); @@ -1115,8 +1117,7 @@ public class Preferences extends GPreferences if (!found) { String[] options = { "OK", "Help" }; - int showHelp = JvOptionPane.showInternalOptionDialog( - Desktop.desktop, + int showHelp = JvOptionPane.showInternalOptionDialog(Desktop.desktop, JvSwingUtils.wrapTooltip(true, MessageManager.getString("label.chimera_missing")), "", JvOptionPane.YES_NO_OPTION, JvOptionPane.WARNING_MESSAGE, @@ -1188,7 +1189,7 @@ public class Preferences extends GPreferences return name.hashCode() + code.hashCode(); } } - + private class UrlListSelectionHandler implements ListSelectionListener { @@ -1228,5 +1229,5 @@ public class Preferences extends GPreferences editLink.setEnabled(false); } } -} + } } diff --git a/src/jalview/gui/ProgressBar.java b/src/jalview/gui/ProgressBar.java index c04754f..ea341e3 100644 --- a/src/jalview/gui/ProgressBar.java +++ b/src/jalview/gui/ProgressBar.java @@ -219,8 +219,8 @@ public class ProgressBar implements IProgressIndicator final JPanel progressPanel = progressBars.get(longId); if (progressPanel == null) { - System.err - .println("call setProgressBar before registering the progress bar's handler."); + System.err.println( + "call setProgressBar before registering the progress bar's handler."); return; } @@ -242,10 +242,10 @@ public class ProgressBar implements IProgressIndicator public void actionPerformed(ActionEvent e) { handler.cancelActivity(id); - us.setProgressBar(MessageManager.formatMessage( - "label.cancelled_params", - new Object[] { ((JLabel) progressPanel.getComponent(0)) - .getText() }), id); + us.setProgressBar(MessageManager + .formatMessage("label.cancelled_params", new Object[] + { ((JLabel) progressPanel.getComponent(0)).getText() }), + id); } }); progressPanel.add(cancel, BorderLayout.EAST); diff --git a/src/jalview/gui/PromptUserConfig.java b/src/jalview/gui/PromptUserConfig.java index fb90ce7..6261015 100644 --- a/src/jalview/gui/PromptUserConfig.java +++ b/src/jalview/gui/PromptUserConfig.java @@ -201,8 +201,7 @@ public class PromptUserConfig implements Runnable } try { - int reply = JvOptionPane.showConfirmDialog( - Desktop.desktop, // component, + int reply = JvOptionPane.showConfirmDialog(Desktop.desktop, // component, dialogText, dialogTitle, (allowCancel) ? JvOptionPane.YES_NO_CANCEL_OPTION : JvOptionPane.YES_NO_OPTION, @@ -245,7 +244,8 @@ public class PromptUserConfig implements Runnable { jalview.bin.Cache.log.warn( "Unexpected exception when prompting user for yes/no setting for property " - + property, e); + + property, + e); } } } diff --git a/src/jalview/gui/RedundancyPanel.java b/src/jalview/gui/RedundancyPanel.java index cbbcf70..8bf2fba 100755 --- a/src/jalview/gui/RedundancyPanel.java +++ b/src/jalview/gui/RedundancyPanel.java @@ -101,9 +101,10 @@ public class RedundancyPanel extends GSliderPanel implements Runnable frame = new JInternalFrame(); frame.setContentPane(this); - Desktop.addInternalFrame(frame, MessageManager - .getString("label.redundancy_threshold_selection"), 400, 100, - false); + Desktop.addInternalFrame(frame, + MessageManager + .getString("label.redundancy_threshold_selection"), + 400, 100, false); frame.addInternalFrameListener(new InternalFrameAdapter() { @Override @@ -174,8 +175,8 @@ public class RedundancyPanel extends GSliderPanel implements Runnable progress.setVisible(false); progress = null; - label.setText(MessageManager - .getString("label.enter_redundancy_threshold")); + label.setText( + MessageManager.getString("label.enter_redundancy_threshold")); slider.setVisible(true); applyButton.setEnabled(true); valueField.setVisible(true); @@ -263,8 +264,8 @@ public class RedundancyPanel extends GSliderPanel implements Runnable ap.alignFrame.addHistoryItem(cut); PaintRefresher.Refresh(this, ap.av.getSequenceSetId(), true, true); - ap.av.firePropertyChange("alignment", null, ap.av.getAlignment() - .getSequences()); + ap.av.firePropertyChange("alignment", null, + ap.av.getAlignment().getSequences()); } } @@ -289,8 +290,8 @@ public class RedundancyPanel extends GSliderPanel implements Runnable { command.undoCommand(af.getViewAlignments()); ap.av.getHistoryList().remove(command); - ap.av.firePropertyChange("alignment", null, ap.av.getAlignment() - .getSequences()); + ap.av.firePropertyChange("alignment", null, + ap.av.getAlignment().getSequences()); af.updateEditMenuBar(); } diff --git a/src/jalview/gui/RestInputParamEditDialog.java b/src/jalview/gui/RestInputParamEditDialog.java index 19a9b51..8ae5408 100644 --- a/src/jalview/gui/RestInputParamEditDialog.java +++ b/src/jalview/gui/RestInputParamEditDialog.java @@ -53,8 +53,8 @@ public class RestInputParamEditDialog extends GRestInputParamEditDialog .newInstance()); } catch (Throwable x) { - System.err - .println("Unexpected exception when instantiating rest input type."); + System.err.println( + "Unexpected exception when instantiating rest input type."); x.printStackTrace(); } return null; @@ -103,8 +103,9 @@ public class RestInputParamEditDialog extends GRestInputParamEditDialog { okcancel.add(frame.cancel); okcancel.add(frame.ok); - frame.initDialogFrame(dpane, true, true, "Edit parameter for service " - + currentservice.getName(), 600, 800); + frame.initDialogFrame(dpane, true, true, + "Edit parameter for service " + currentservice.getName(), 600, + 800); initTypeLists(); reply = JvOptionPane.CANCEL_OPTION; @@ -159,14 +160,14 @@ public class RestInputParamEditDialog extends GRestInputParamEditDialog newType.token = tok.getText().trim(); try { - newType.configureFromArgumentI(opanps.get( - newType.getURLtokenPrefix()).getCurrentSettings()); + newType.configureFromArgumentI(opanps + .get(newType.getURLtokenPrefix()).getCurrentSettings()); current = newType; updated = true; } catch (InvalidArgumentException ex) { - System.err - .println("IMPLEMENTATION ERROR: Invalid argument for type : " + System.err.println( + "IMPLEMENTATION ERROR: Invalid argument for type : " + typeList.getSelectedValue() + "\n"); ex.printStackTrace(); } @@ -186,7 +187,8 @@ public class RestInputParamEditDialog extends GRestInputParamEditDialog try { JPanel inopts = new JPanel(new MigLayout()); - ArrayList opts = new ArrayList(), prms = new ArrayList(); + ArrayList opts = new ArrayList(), + prms = new ArrayList(); jtype = (InputType) (type.getConstructor().newInstance()); typeclass.put(jtype.getURLtokenPrefix(), type); // and populate parameters from this type @@ -213,8 +215,8 @@ public class RestInputParamEditDialog extends GRestInputParamEditDialog types.add(jtype.getURLtokenPrefix()); } catch (Throwable x) { - System.err - .println("Unexpected exception when instantiating rest input type."); + System.err.println( + "Unexpected exception when instantiating rest input type."); x.printStackTrace(); } } diff --git a/src/jalview/gui/RestServiceEditorPane.java b/src/jalview/gui/RestServiceEditorPane.java index ec8e7f1..2e2593b 100644 --- a/src/jalview/gui/RestServiceEditorPane.java +++ b/src/jalview/gui/RestServiceEditorPane.java @@ -241,8 +241,8 @@ public class RestServiceEditorPane extends GRestServiceEditorPane protected void iprmsAdd_actionPerformed(ActionEvent e) { RestInputParamEditDialog dialog = new RestInputParamEditDialog(this, - currentservice, "param" - + (1 + currentservice.getInputParams().size())); + currentservice, + "param" + (1 + currentservice.getInputParams().size())); if (dialog.wasUpdated()) { currentservice.getInputParams().put(dialog.current.token, @@ -274,8 +274,8 @@ public class RestServiceEditorPane extends GRestServiceEditorPane MessageManager.getString("label.select_return_type")); for (final JvDataType type : JvDataType.values()) { - popup.add(new JMenuItem(type.name())).addActionListener( - new ActionListener() + popup.add(new JMenuItem(type.name())) + .addActionListener(new ActionListener() { @Override @@ -304,8 +304,9 @@ public class RestServiceEditorPane extends GRestServiceEditorPane currentservice.addResultDatatype(JvDataType.ANNOTATION); } initGuiWith(currentservice); - rdata.setSelectedIndex(p == -1 ? currentservice.getResultDataTypes() - .size() - 1 : p + 1); + rdata.setSelectedIndex( + p == -1 ? currentservice.getResultDataTypes().size() - 1 + : p + 1); } @Override @@ -354,26 +355,26 @@ public class RestServiceEditorPane extends GRestServiceEditorPane StringBuffer warnings = new StringBuffer(); for (String its : _iparam) { - Matcher mtch = Pattern.compile("(\\S+)\\s(\\S+):\\[(.+)]").matcher( - its); + Matcher mtch = Pattern.compile("(\\S+)\\s(\\S+):\\[(.+)]") + .matcher(its); if (mtch.find()) { - if (!RestServiceDescription.parseTypeString(mtch.group(2) + ":" - + mtch.group(3), mtch.group(1), mtch.group(2), - mtch.group(3), inputTypes, warnings)) + if (!RestServiceDescription.parseTypeString( + mtch.group(2) + ":" + mtch.group(3), mtch.group(1), + mtch.group(2), mtch.group(3), inputTypes, warnings)) { - System.err - .println("IMPLEMENTATION PROBLEM: Cannot parse RestService input parameter string '" + System.err.println( + "IMPLEMENTATION PROBLEM: Cannot parse RestService input parameter string '" + its + "'" + "\n" + warnings); } } } - char gc = gapChar.getSelectedItem() == null ? ' ' : ((String) gapChar - .getSelectedItem()).charAt(0); + char gc = gapChar.getSelectedItem() == null ? ' ' + : ((String) gapChar.getSelectedItem()).charAt(0); RestServiceDescription newService = new RestServiceDescription( - (String) action.getSelectedItem(), descr.getText().trim(), name - .getText().trim(), url.getText().trim(), urlsuff - .getText().trim(), inputTypes, hSeparable.isSelected(), + (String) action.getSelectedItem(), descr.getText().trim(), + name.getText().trim(), url.getText().trim(), + urlsuff.getText().trim(), inputTypes, hSeparable.isSelected(), vSeparable.isSelected(), gc); if (newService.isValid()) @@ -388,8 +389,8 @@ public class RestServiceEditorPane extends GRestServiceEditorPane } catch (Throwable x) { - System.err - .println("IMPLEMENTATION PROBLEM: Cannot parse RestService output parameter string '" + System.err.println( + "IMPLEMENTATION PROBLEM: Cannot parse RestService output parameter string '" + its + "'" + "\n" + warnings); } } @@ -398,8 +399,8 @@ public class RestServiceEditorPane extends GRestServiceEditorPane } else { - System.err - .println("IMPLEMENTATION PROBLEM: Restservice generated from GUI is invalid\n" + System.err.println( + "IMPLEMENTATION PROBLEM: Restservice generated from GUI is invalid\n" + warnings); } @@ -432,19 +433,19 @@ public class RestServiceEditorPane extends GRestServiceEditorPane } else { - parseRes.setText(MessageManager - .formatMessage( - "label.parsing_failed_syntax_errors_shown_below_param", - new String[] { rsd.getInvalidMessage() })); + parseRes.setText(MessageManager.formatMessage( + "label.parsing_failed_syntax_errors_shown_below_param", + new String[] + { rsd.getInvalidMessage() })); parseWarnings.setVisible(true); } } catch (Throwable e) { e.printStackTrace(); - parseRes.setText(MessageManager - .formatMessage( - "label.parsing_failed_unrecoverable_exception_thrown_param", - new String[] { e.toString() })); + parseRes.setText(MessageManager.formatMessage( + "label.parsing_failed_unrecoverable_exception_thrown_param", + new String[] + { e.toString() })); parseWarnings.setVisible(true); } } @@ -470,13 +471,10 @@ public class RestServiceEditorPane extends GRestServiceEditorPane final Thread runner = Thread.currentThread(); JFrame df = new JFrame(); df.getContentPane().setLayout(new BorderLayout()); - df.getContentPane().add( - (nulserv = !nulserv) ? new RestServiceEditorPane( - jalview.ws.rest.RestClient - .makeShmmrRestClient() - .getRestDescription()) - : new RestServiceEditorPane(), - BorderLayout.CENTER); + df.getContentPane().add((nulserv = !nulserv) + ? new RestServiceEditorPane(jalview.ws.rest.RestClient + .makeShmmrRestClient().getRestDescription()) + : new RestServiceEditorPane(), BorderLayout.CENTER); df.setBounds(100, 100, 600, 400); df.addComponentListener(new ComponentListener() { @@ -557,8 +555,8 @@ public class RestServiceEditorPane extends GRestServiceEditorPane } }; - JPanel pane = new JPanel(new BorderLayout()), okcancel = new JPanel( - new FlowLayout()); + JPanel pane = new JPanel(new BorderLayout()), + okcancel = new JPanel(new FlowLayout()); pane.add(this, BorderLayout.CENTER); okcancel.add(jvd.ok); okcancel.add(jvd.cancel); diff --git a/src/jalview/gui/RotatableCanvas.java b/src/jalview/gui/RotatableCanvas.java index 0719fa0..4ef18d4 100755 --- a/src/jalview/gui/RotatableCanvas.java +++ b/src/jalview/gui/RotatableCanvas.java @@ -390,8 +390,9 @@ public class RotatableCanvas extends JPanel implements MouseListener, if (points == null) { g.setFont(new Font("Verdana", Font.PLAIN, 18)); - g.drawString(MessageManager.getString("label.calculating_pca") - + "....", 20, getHeight() / 2); + g.drawString( + MessageManager.getString("label.calculating_pca") + "....", + 20, getHeight() / 2); } else { @@ -434,9 +435,9 @@ public class RotatableCanvas extends JPanel implements MouseListener, for (int i = 0; i < 3; i++) { - g.drawLine(getWidth() / 2, getHeight() / 2, (int) ((axes[i][0] - * scale * max[0]) + (getWidth() / 2)), (int) ((axes[i][1] - * scale * max[1]) + (getHeight() / 2))); + g.drawLine(getWidth() / 2, getHeight() / 2, + (int) ((axes[i][0] * scale * max[0]) + (getWidth() / 2)), + (int) ((axes[i][1] * scale * max[1]) + (getHeight() / 2))); } } @@ -673,8 +674,8 @@ public class RotatableCanvas extends JPanel implements MouseListener, { aps[a].av.setSelectionGroup(new SequenceGroup()); aps[a].av.getSelectionGroup().addOrRemove(found, true); - aps[a].av.getSelectionGroup().setEndRes( - aps[a].av.getAlignment().getWidth() - 1); + aps[a].av.getSelectionGroup() + .setEndRes(aps[a].av.getAlignment().getWidth() - 1); } } PaintRefresher.Refresh(this, av.getSequenceSetId()); @@ -772,8 +773,10 @@ public class RotatableCanvas extends JPanel implements MouseListener, for (int i = 0; i < npoint; i++) { SequencePoint sp = (SequencePoint) points.elementAt(i); - int tmp1 = (int) (((sp.coord[0] - centre[0]) * scale) + ((float) getWidth() / 2.0)); - int tmp2 = (int) (((sp.coord[1] - centre[1]) * scale) + ((float) getHeight() / 2.0)); + int tmp1 = (int) (((sp.coord[0] - centre[0]) * scale) + + ((float) getWidth() / 2.0)); + int tmp2 = (int) (((sp.coord[1] - centre[1]) * scale) + + ((float) getHeight() / 2.0)); if ((tmp1 > x1) && (tmp1 < x2) && (tmp2 > y1) && (tmp2 < y2)) { diff --git a/src/jalview/gui/SVGOptions.java b/src/jalview/gui/SVGOptions.java index ea8e360..e3d03a4 100644 --- a/src/jalview/gui/SVGOptions.java +++ b/src/jalview/gui/SVGOptions.java @@ -59,7 +59,8 @@ public class SVGOptions extends JPanel bg.add(text); JOptionPane pane = new JOptionPane(null, JvOptionPane.DEFAULT_OPTION, - JvOptionPane.DEFAULT_OPTION, null, new Object[] { this }); + JvOptionPane.DEFAULT_OPTION, null, new Object[] + { this }); dialog = pane.createDialog(Desktop.desktop, "SVG Rendering options"); dialog.setVisible(true); diff --git a/src/jalview/gui/ScalePanel.java b/src/jalview/gui/ScalePanel.java index 2302ebe..1db4051 100755 --- a/src/jalview/gui/ScalePanel.java +++ b/src/jalview/gui/ScalePanel.java @@ -54,8 +54,8 @@ import javax.swing.ToolTipManager; * The panel containing the sequence ruler (when not in wrapped mode), and * supports a range of mouse operations to select, hide or reveal columns. */ -public class ScalePanel extends JPanel implements MouseMotionListener, - MouseListener, ViewportListenerI +public class ScalePanel extends JPanel + implements MouseMotionListener, MouseListener, ViewportListenerI { protected int offy = 4; @@ -202,9 +202,8 @@ public class ScalePanel extends JPanel implements MouseMotionListener, public void actionPerformed(ActionEvent e) { av.hideColumns(res, res); - if (av.getSelectionGroup() != null - && av.getSelectionGroup().getSize() == av.getAlignment() - .getHeight()) + if (av.getSelectionGroup() != null && av.getSelectionGroup() + .getSize() == av.getAlignment().getHeight()) { av.setSelectionGroup(null); } @@ -416,8 +415,8 @@ public class ScalePanel extends JPanel implements MouseMotionListener, */ if (!av.getWrapAlignment()) { - drawScale(g, av.getRanges().getStartRes(), - av.getRanges().getEndRes(), getWidth(), getHeight()); + drawScale(g, av.getRanges().getStartRes(), av.getRanges().getEndRes(), + getWidth(), getHeight()); } } @@ -498,10 +497,13 @@ public class ScalePanel extends JPanel implements MouseMotionListener, continue; } - gg.fillPolygon(new int[] { - -1 + res * avCharWidth - avCharHeight / 4, - -1 + res * avCharWidth + avCharHeight / 4, - -1 + res * avCharWidth }, new int[] { y, y, y + 2 * yOf }, 3); + gg.fillPolygon( + new int[] + { -1 + res * avCharWidth - avCharHeight / 4, + -1 + res * avCharWidth + avCharHeight / 4, + -1 + res * avCharWidth }, + new int[] + { y, y, y + 2 * yOf }, 3); } } } diff --git a/src/jalview/gui/SeqCanvas.java b/src/jalview/gui/SeqCanvas.java index a134afa..a052ae3 100755 --- a/src/jalview/gui/SeqCanvas.java +++ b/src/jalview/gui/SeqCanvas.java @@ -144,9 +144,9 @@ public class SeqCanvas extends JComponent implements ViewportListenerI { g.drawString(mstring, mpos * charWidth, ypos - (charHeight / 2)); } - g.drawLine((mpos * charWidth) + (charWidth / 2), (ypos + 2) - - (charHeight / 2), (mpos * charWidth) + (charWidth / 2), - ypos - 2); + g.drawLine((mpos * charWidth) + (charWidth / 2), + (ypos + 2) - (charHeight / 2), + (mpos * charWidth) + (charWidth / 2), ypos - 2); } } } @@ -208,8 +208,8 @@ public class SeqCanvas extends JComponent implements ViewportListenerI { int x = LABEL_WEST - fm.stringWidth(String.valueOf(value)) - charWidth / 2; - g.drawString(value + "", x, (ypos + (i * charHeight)) - - (charHeight / 5)); + g.drawString(value + "", x, + (ypos + (i * charHeight)) - (charHeight / 5)); } } } @@ -260,8 +260,8 @@ public class SeqCanvas extends JComponent implements ViewportListenerI if (value != -1) { - g.drawString(String.valueOf(value), 0, (ypos + (i * charHeight)) - - (charHeight / 5)); + g.drawString(String.valueOf(value), 0, + (ypos + (i * charHeight)) - (charHeight / 5)); } } } @@ -356,10 +356,9 @@ public class SeqCanvas extends JComponent implements ViewportListenerI // img and call later. super.paintComponent(g); - if (lcimg != null - && (fastPaint - || (getVisibleRect().width != g.getClipBounds().width) || (getVisibleRect().height != g - .getClipBounds().height))) + if (lcimg != null && (fastPaint + || (getVisibleRect().width != g.getClipBounds().width) + || (getVisibleRect().height != g.getClipBounds().height))) { g.drawImage(lcimg, 0, 0, this); fastPaint = false; @@ -578,10 +577,12 @@ public class SeqCanvas extends JComponent implements ViewportListenerI } gg.fillPolygon( - new int[] { res * charWidth - charHeight / 4, + new int[] + { res * charWidth - charHeight / 4, res * charWidth + charHeight / 4, res * charWidth }, - new int[] { ypos - (charHeight / 2), - ypos - (charHeight / 2), ypos - (charHeight / 2) + 8 }, + new int[] + { ypos - (charHeight / 2), ypos - (charHeight / 2), + ypos - (charHeight / 2) + 8 }, 3); } @@ -611,8 +612,8 @@ public class SeqCanvas extends JComponent implements ViewportListenerI annotations = new AnnotationPanel(av); } - annotations.renderer.drawComponent(annotations, av, g, -1, - startRes, endx + 1); + annotations.renderer.drawComponent(annotations, av, g, -1, startRes, + endx + 1); g.translate(0, -cHeight - ypos - 3); } g.setClip(clip); @@ -657,8 +658,8 @@ public class SeqCanvas extends JComponent implements ViewportListenerI * @param offset * DOCUMENT ME! */ - public void drawPanel(Graphics g1, int startRes, int endRes, - int startSeq, int endSeq, int offset) + public void drawPanel(Graphics g1, int startRes, int endRes, int startSeq, + int endSeq, int offset) { updateViewport(); if (!av.hasHiddenColumns()) @@ -748,8 +749,8 @@ public class SeqCanvas extends JComponent implements ViewportListenerI if (av.isShowSequenceFeatures()) { - fr.drawSequence(g, nextSeq, startRes, endRes, offset - + ((i - startSeq) * charHeight), false); + fr.drawSequence(g, nextSeq, startRes, endRes, + offset + ((i - startSeq) * charHeight), false); } // / Highlight search Results once all sequences have been drawn @@ -763,9 +764,9 @@ public class SeqCanvas extends JComponent implements ViewportListenerI for (int r = 0; r < visibleResults.length; r += 2) { sr.drawHighlightedText(nextSeq, visibleResults[r], - visibleResults[r + 1], (visibleResults[r] - startRes) - * charWidth, offset - + ((i - startSeq) * charHeight)); + visibleResults[r + 1], + (visibleResults[r] - startRes) * charWidth, + offset + ((i - startSeq) * charHeight)); } } } @@ -822,7 +823,8 @@ public class SeqCanvas extends JComponent implements ViewportListenerI { sx = (group.getStartRes() - startRes) * charWidth; sy = offset + ((i - startSeq) * charHeight); - ex = (((group.getEndRes() + 1) - group.getStartRes()) * charWidth) - 1; + ex = (((group.getEndRes() + 1) - group.getStartRes()) * charWidth) + - 1; if (sx + ex < 0 || sx > visWidth) { @@ -830,21 +832,19 @@ public class SeqCanvas extends JComponent implements ViewportListenerI } if ((sx <= (endRes - startRes) * charWidth) - && group.getSequences(null).contains( - av.getAlignment().getSequenceAt(i))) + && group.getSequences(null) + .contains(av.getAlignment().getSequenceAt(i))) { - if ((bottom == -1) - && !group.getSequences(null).contains( - av.getAlignment().getSequenceAt(i + 1))) + if ((bottom == -1) && !group.getSequences(null) + .contains(av.getAlignment().getSequenceAt(i + 1))) { bottom = sy + charHeight; } if (!inGroup) { - if (((top == -1) && (i == 0)) - || !group.getSequences(null).contains( - av.getAlignment().getSequenceAt(i - 1))) + if (((top == -1) && (i == 0)) || !group.getSequences(null) + .contains(av.getAlignment().getSequenceAt(i - 1))) { top = sy; } @@ -855,8 +855,8 @@ public class SeqCanvas extends JComponent implements ViewportListenerI if (group == av.getSelectionGroup()) { g.setStroke(new BasicStroke(1, BasicStroke.CAP_BUTT, - BasicStroke.JOIN_ROUND, 3f, new float[] { 5f, 3f }, - 0f)); + BasicStroke.JOIN_ROUND, 3f, new float[] + { 5f, 3f }, 0f)); g.setColor(Color.RED); } else diff --git a/src/jalview/gui/SeqPanel.java b/src/jalview/gui/SeqPanel.java index 26096e6..056a602 100644 --- a/src/jalview/gui/SeqPanel.java +++ b/src/jalview/gui/SeqPanel.java @@ -74,9 +74,9 @@ import javax.swing.ToolTipManager; * @author $author$ * @version $Revision: 1.130 $ */ -public class SeqPanel extends JPanel implements MouseListener, - MouseMotionListener, MouseWheelListener, SequenceListener, - SelectionListener +public class SeqPanel extends JPanel + implements MouseListener, MouseMotionListener, MouseWheelListener, + SequenceListener, SelectionListener { /** DOCUMENT ME!! */ @@ -263,15 +263,14 @@ public class SeqPanel extends JPanel implements MouseListener, y -= hgap; - seq = Math.min((y % cHeight) / av.getCharHeight(), av.getAlignment() - .getHeight() - 1); + seq = Math.min((y % cHeight) / av.getCharHeight(), + av.getAlignment().getHeight() - 1); } else { - seq = Math.min((y / av.getCharHeight()) - + av.getRanges().getStartSeq(), - av - .getAlignment().getHeight() - 1); + seq = Math.min( + (y / av.getCharHeight()) + av.getRanges().getStartSeq(), + av.getAlignment().getHeight() - 1); } return seq; @@ -288,8 +287,8 @@ public class SeqPanel extends JPanel implements MouseListener, if (editCommand != null && editCommand.getSize() > 0) { ap.alignFrame.addHistoryItem(editCommand); - av.firePropertyChange("alignment", null, av.getAlignment() - .getSequences()); + av.firePropertyChange("alignment", null, + av.getAlignment().getSequences()); } } finally { @@ -347,8 +346,7 @@ public class SeqPanel extends JPanel implements MouseListener, HiddenColumns hidden = av.getAlignment().getHiddenColumns(); - if (av.hasHiddenColumns() - && !hidden.isVisible(seqCanvas.cursorX)) + if (av.hasHiddenColumns() && !hidden.isVisible(seqCanvas.cursorX)) { int original = seqCanvas.cursorX - dx; int maxWidth = av.getAlignment().getWidth(); @@ -847,8 +845,9 @@ public class SeqPanel extends JPanel implements MouseListener, Point p = lastp; if (!event.isShiftDown() || p == null) { - p = (tooltipText != null && tooltipText.length() > 6) ? new Point( - event.getX() + wdth, event.getY() - 20) : null; + p = (tooltipText != null && tooltipText.length() > 6) + ? new Point(event.getX() + wdth, event.getY() - 20) + : null; } /* * TODO: try to modify position region is not obcured by tooltip @@ -918,9 +917,9 @@ public class SeqPanel extends JPanel implements MouseListener, } else { - residue = "X".equalsIgnoreCase(displayChar) ? "X" : ("*" - .equals(displayChar) ? "STOP" - : ResidueProperties.aa2Triplet.get(displayChar)); + residue = "X".equalsIgnoreCase(displayChar) ? "X" + : ("*".equals(displayChar) ? "STOP" + : ResidueProperties.aa2Triplet.get(displayChar)); } text.append(" ").append(nucleotide ? "Nucleotide" : "Residue") .append(": ").append(residue == null ? displayChar : residue); @@ -982,8 +981,8 @@ public class SeqPanel extends JPanel implements MouseListener, int oldWidth = av.getCharWidth(); // Which is bigger, left-right or up-down? - if (Math.abs(evt.getY() - lastMousePress.getY()) > Math.abs(evt - .getX() - lastMousePress.getX())) + if (Math.abs(evt.getY() - lastMousePress.getY()) > Math + .abs(evt.getX() - lastMousePress.getX())) { /* * on drag up or down, decrement or increment font size @@ -1143,8 +1142,9 @@ public class SeqPanel extends JPanel implements MouseListener, } if (editCommand == null) { - editCommand = new EditCommand(MessageManager.formatMessage( - "label.edit_params", new String[] { label })); + editCommand = new EditCommand(MessageManager + .formatMessage("label.edit_params", new String[] + { label })); } } @@ -1161,9 +1161,8 @@ public class SeqPanel extends JPanel implements MouseListener, ap.alignFrame.statusBar.setText(message.toString()); // Are we editing within a selection group? - if (groupEditing - || (sg != null && sg.getSequences(av.getHiddenRepSequences()) - .contains(seq))) + if (groupEditing || (sg != null + && sg.getSequences(av.getHiddenRepSequences()).contains(seq))) { fixedColumns = true; @@ -1351,8 +1350,8 @@ public class SeqPanel extends JPanel implements MouseListener, } else { - appendEdit(Action.INSERT_GAP, groupSeqs, startres, startres - - lastres); + appendEdit(Action.INSERT_GAP, groupSeqs, startres, + startres - lastres); } } else @@ -1367,8 +1366,8 @@ public class SeqPanel extends JPanel implements MouseListener, } else { - appendEdit(Action.DELETE_GAP, groupSeqs, startres, lastres - - startres); + appendEdit(Action.DELETE_GAP, groupSeqs, startres, + lastres - startres); } } @@ -1589,8 +1588,8 @@ public class SeqPanel extends JPanel implements MouseListener, * highlight the first feature at the position on the alignment */ SearchResultsI highlight = new SearchResults(); - highlight.addResult(sequence, features.get(0).getBegin(), features - .get(0).getEnd()); + highlight.addResult(sequence, features.get(0).getBegin(), + features.get(0).getEnd()); seqCanvas.highlightSearchResults(highlight); /* @@ -1652,8 +1651,9 @@ public class SeqPanel extends JPanel implements MouseListener, if (av.getWrapAlignment() && seq > av.getAlignment().getHeight()) { - JvOptionPane.showInternalMessageDialog(Desktop.desktop, MessageManager - .getString("label.cannot_edit_annotations_in_wrapped_view"), + JvOptionPane.showInternalMessageDialog(Desktop.desktop, + MessageManager.getString( + "label.cannot_edit_annotations_in_wrapped_view"), MessageManager.getString("label.wrapped_view_no_edit"), JvOptionPane.WARNING_MESSAGE); return; @@ -1805,7 +1805,8 @@ public class SeqPanel extends JPanel implements MouseListener, stretchGroup.cs.alignmentChanged(stretchGroup, av.getHiddenRepSequences()); - ResidueShaderI groupColourScheme = stretchGroup.getGroupColourScheme(); + ResidueShaderI groupColourScheme = stretchGroup + .getGroupColourScheme(); String name = stretchGroup.getName(); if (stretchGroup.cs.conservationApplied()) { @@ -2004,9 +2005,8 @@ public class SeqPanel extends JPanel implements MouseListener, running = av.getRanges().scrollUp(true); } - if (mouseDragging && (evt.getY() >= getHeight()) - && (av.getAlignment().getHeight() > av.getRanges() - .getEndSeq())) + if (mouseDragging && (evt.getY() >= getHeight()) && (av + .getAlignment().getHeight() > av.getRanges().getEndSeq())) { running = av.getRanges().scrollUp(false); } @@ -2042,8 +2042,10 @@ public class SeqPanel extends JPanel implements MouseListener, // handles selection messages... // TODO: extend config options to allow user to control if selections may be // shared between viewports. - boolean iSentTheSelection = (av == source || (source instanceof AlignViewport && ((AlignmentViewport) source) - .getSequenceSetId().equals(av.getSequenceSetId()))); + boolean iSentTheSelection = (av == source + || (source instanceof AlignViewport + && ((AlignmentViewport) source).getSequenceSetId() + .equals(av.getSequenceSetId()))); if (iSentTheSelection) { @@ -2145,8 +2147,7 @@ public class SeqPanel extends JPanel implements MouseListener, repaint = true; } - if (copycolsel - && av.hasHiddenColumns() + if (copycolsel && av.hasHiddenColumns() && (av.getAlignment().getHiddenColumns() == null)) { System.err.println("Bad things"); diff --git a/src/jalview/gui/SequenceFetcher.java b/src/jalview/gui/SequenceFetcher.java index bf0ab70..804d1a5 100755 --- a/src/jalview/gui/SequenceFetcher.java +++ b/src/jalview/gui/SequenceFetcher.java @@ -136,11 +136,10 @@ public class SequenceFetcher extends JPanel implements Runnable { if (guiWindow != null) { - guiWindow - .setProgressBar( - MessageManager - .getString("status.waiting_sequence_database_fetchers_init"), - Thread.currentThread().hashCode()); + guiWindow.setProgressBar( + MessageManager.getString( + "status.waiting_sequence_database_fetchers_init"), + Thread.currentThread().hashCode()); } // initting happening on another thread - so wait around to see if it // finishes. @@ -157,18 +156,17 @@ public class SequenceFetcher extends JPanel implements Runnable } if (guiWindow != null) { - guiWindow - .setProgressBar( - MessageManager - .getString("status.waiting_sequence_database_fetchers_init"), - Thread.currentThread().hashCode()); + guiWindow.setProgressBar( + MessageManager.getString( + "status.waiting_sequence_database_fetchers_init"), + Thread.currentThread().hashCode()); } } - if (sfetch == null - || dasRegistry != Cache.getDasSourceRegistry() + if (sfetch == null || dasRegistry != Cache.getDasSourceRegistry() || lastDasSourceRegistry != (Cache.getDasSourceRegistry() - .getDasRegistryURL() + Cache.getDasSourceRegistry() - .getLocalSourceString()).hashCode()) + .getDasRegistryURL() + + Cache.getDasSourceRegistry().getLocalSourceString()) + .hashCode()) { _initingFetcher = true; initingThread = Thread.currentThread(); @@ -177,8 +175,9 @@ public class SequenceFetcher extends JPanel implements Runnable */ if (guiWindow != null) { - guiWindow.setProgressBar(MessageManager - .getString("status.init_sequence_database_fetchers"), + guiWindow.setProgressBar( + MessageManager.getString( + "status.init_sequence_database_fetchers"), Thread.currentThread().hashCode()); } dasRegistry = Cache.getDasSourceRegistry(); @@ -189,8 +188,8 @@ public class SequenceFetcher extends JPanel implements Runnable { guiWindow.setProgressBar(null, Thread.currentThread().hashCode()); } - lastDasSourceRegistry = (dasRegistry.getDasRegistryURL() + dasRegistry - .getLocalSourceString()).hashCode(); + lastDasSourceRegistry = (dasRegistry.getDasRegistryURL() + + dasRegistry.getLocalSourceString()).hashCode(); sfetch = sf; _initingFetcher = false; initingThread = null; @@ -234,14 +233,12 @@ public class SequenceFetcher extends JPanel implements Runnable @Override public void run() { - JvOptionPane - .showInternalMessageDialog( - Desktop.desktop, - MessageManager - .getString("warn.couldnt_create_sequence_fetcher_client"), - MessageManager - .getString("label.couldnt_create_sequence_fetcher"), - JvOptionPane.ERROR_MESSAGE); + JvOptionPane.showInternalMessageDialog(Desktop.desktop, + MessageManager.getString( + "warn.couldnt_create_sequence_fetcher_client"), + MessageManager.getString( + "label.couldnt_create_sequence_fetcher"), + JvOptionPane.ERROR_MESSAGE); } }); @@ -311,14 +308,15 @@ public class SequenceFetcher extends JPanel implements Runnable if (sourcep.getTier() == 0) { database.selection = Arrays - .asList(new DbSourceProxy[] { sourcep }); + .asList(new DbSourceProxy[] + { sourcep }); break; } } if (database.selection == null || database.selection.size() == 0) { - System.err.println("Ignoring fetch parameter db='" + selectedDb - + "'"); + System.err.println( + "Ignoring fetch parameter db='" + selectedDb + "'"); return false; } textArea.setText(queryString); @@ -379,9 +377,10 @@ public class SequenceFetcher extends JPanel implements Runnable private String getFrameTitle() { - return ((alignFrame == null) ? MessageManager - .getString("label.new_sequence_fetcher") : MessageManager - .getString("label.additional_sequence_fetcher")); + return ((alignFrame == null) + ? MessageManager.getString("label.new_sequence_fetcher") + : MessageManager + .getString("label.additional_sequence_fetcher")); } private void jbInit() throws Exception @@ -398,8 +397,8 @@ public class SequenceFetcher extends JPanel implements Runnable replacePunctuation.setHorizontalAlignment(SwingConstants.CENTER); replacePunctuation .setFont(new java.awt.Font("Verdana", Font.ITALIC, 11)); - replacePunctuation.setText(MessageManager - .getString("label.replace_commas_semicolons")); + replacePunctuation.setText( + MessageManager.getString("label.replace_commas_semicolons")); ok.setText(MessageManager.getString("action.ok")); ok.addActionListener(new ActionListener() { @@ -538,8 +537,9 @@ public class SequenceFetcher extends JPanel implements Runnable + database.getSelectedSources().size() + " others)" : "")); String eq = database.getExampleQueries(); - dbeg.setText(MessageManager.formatMessage( - "label.example_query_param", new String[] { eq })); + dbeg.setText(MessageManager.formatMessage("label.example_query_param", + new String[] + { eq })); boolean enablePunct = !(eq != null && eq.indexOf(",") > -1); for (DbSourceProxy dbs : database.getSelectedSources()) { @@ -621,7 +621,7 @@ public class SequenceFetcher extends JPanel implements Runnable if (replacePunctuation.isEnabled() && replacePunctuation.isSelected()) { empty = new com.stevesoft.pat.Regex( - // replace commas and spaces with a semicolon + // replace commas and spaces with a semicolon "(\\s|[,; ])+", ";"); } else @@ -631,8 +631,8 @@ public class SequenceFetcher extends JPanel implements Runnable } textArea.setText(empty.replaceAll(textArea.getText())); // see if there's anthing to search with - if (!new com.stevesoft.pat.Regex("[A-Za-z0-9_.]").search(textArea - .getText())) + if (!new com.stevesoft.pat.Regex("[A-Za-z0-9_.]") + .search(textArea.getText())) { error += "Please enter a (semi-colon separated list of) database id(s)"; } @@ -652,8 +652,8 @@ public class SequenceFetcher extends JPanel implements Runnable Iterator proxies = database.getSelectedSources() .iterator(); String[] qries; - List nextFetch = Arrays.asList(qries = textArea.getText() - .split(";")); + List nextFetch = Arrays + .asList(qries = textArea.getText().split(";")); Iterator en = Arrays.asList(new String[0]).iterator(); int nqueries = qries.length; @@ -673,13 +673,11 @@ public class SequenceFetcher extends JPanel implements Runnable try { // update status - guiWindow - .setProgressBar(MessageManager.formatMessage( - "status.fetching_sequence_queries_from", - new String[] { - Integer.valueOf(nqueries).toString(), - proxy.getDbName() }), Thread.currentThread() - .hashCode()); + guiWindow.setProgressBar(MessageManager.formatMessage( + "status.fetching_sequence_queries_from", new String[] + { Integer.valueOf(nqueries).toString(), + proxy.getDbName() }), + Thread.currentThread().hashCode()); if (proxy.getMaximumQueryCount() == 1) { /* @@ -703,8 +701,8 @@ public class SequenceFetcher extends JPanel implements Runnable } } catch (Exception e) { - showErrorMessage("Error retrieving " + textArea.getText() - + " from " + database.getSelectedItem()); + showErrorMessage("Error retrieving " + textArea.getText() + " from " + + database.getSelectedItem()); // error // +="Couldn't retrieve sequences from "+database.getSelectedItem(); System.err.println("Retrieval failed for source ='" @@ -714,9 +712,7 @@ public class SequenceFetcher extends JPanel implements Runnable } catch (OutOfMemoryError e) { showErrorMessage("Out of Memory when retrieving " - + textArea.getText() - + " from " - + database.getSelectedItem() + + textArea.getText() + " from " + database.getSelectedItem() + "\nPlease see the Jalview FAQ for instructions for increasing the memory available to Jalview.\n"); e.printStackTrace(); } catch (Error e) @@ -744,8 +740,8 @@ public class SequenceFetcher extends JPanel implements Runnable while (aresult.size() > 0) { presult.add(aresult.remove(0)); - presultTitle.add(aresultq.remove(0) + " " - + getDefaultRetrievalTitle()); + presultTitle.add( + aresultq.remove(0) + " " + getDefaultRetrievalTitle()); } } else @@ -773,15 +769,17 @@ public class SequenceFetcher extends JPanel implements Runnable presultTitle.add(titl); } } - guiWindow.setProgressBar(MessageManager - .getString("status.finshed_querying"), Thread.currentThread() - .hashCode()); + guiWindow.setProgressBar( + MessageManager.getString("status.finshed_querying"), + Thread.currentThread().hashCode()); } - guiWindow.setProgressBar( - (presult.size() > 0) ? MessageManager - .getString("status.parsing_results") : MessageManager - .getString("status.processing"), Thread.currentThread() - .hashCode()); + guiWindow + .setProgressBar( + (presult.size() > 0) + ? MessageManager + .getString("status.parsing_results") + : MessageManager.getString("status.processing"), + Thread.currentThread().hashCode()); // process results while (presult.size() > 0) { @@ -794,8 +792,9 @@ public class SequenceFetcher extends JPanel implements Runnable { StringBuffer sb = new StringBuffer(); sb.append("Didn't retrieve the following " - + (nextFetch.size() == 1 ? "query" : nextFetch.size() - + " queries") + ": \n"); + + (nextFetch.size() == 1 ? "query" + : nextFetch.size() + " queries") + + ": \n"); int l = sb.length(), lr = 0; for (String s : nextFetch) { @@ -830,8 +829,7 @@ public class SequenceFetcher extends JPanel implements Runnable */ void fetchMultipleAccessions(DbSourceProxy proxy, Iterator accessions, List aresultq, - List aresult, List nextFetch) - throws Exception + List aresult, List nextFetch) throws Exception { StringBuilder multiacc = new StringBuilder(); List tosend = new ArrayList(); @@ -906,8 +904,9 @@ public class SequenceFetcher extends JPanel implements Runnable indres = proxy.getSequenceRecords(accession); } catch (OutOfMemoryError oome) { - new OOMWarning("fetching " + accession + " from " - + proxy.getDbName(), oome, this); + new OOMWarning( + "fetching " + accession + " from " + proxy.getDbName(), + oome, this); } if (indres != null) { @@ -917,9 +916,8 @@ public class SequenceFetcher extends JPanel implements Runnable } } catch (Exception e) { - Cache.log.info( - "Error retrieving " + accession + " from " - + proxy.getDbName(), e); + Cache.log.info("Error retrieving " + accession + " from " + + proxy.getDbName(), e); } return success; } diff --git a/src/jalview/gui/SequenceRenderer.java b/src/jalview/gui/SequenceRenderer.java index 36825ea..4498f88 100755 --- a/src/jalview/gui/SequenceRenderer.java +++ b/src/jalview/gui/SequenceRenderer.java @@ -77,8 +77,8 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer // If EPS graphics, stringWidth will be a double, not an int double dwidth = fm.getStringBounds("M", g).getWidth(); - monospacedFont = (dwidth == fm.getStringBounds("|", g).getWidth() && av - .getCharWidth() == dwidth); + monospacedFont = (dwidth == fm.getStringBounds("|", g).getWidth() + && av.getCharWidth() == dwidth); this.renderGaps = renderGaps; } @@ -140,8 +140,7 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer { if (shader.getColourScheme() != null) { - resBoxColour = shader.findColour(seq.getCharAt(i), - i, seq); + resBoxColour = shader.findColour(seq.getCharAt(i), i, seq); } else if (forOverview && !Comparison.isGap(seq.getCharAt(i))) { @@ -217,8 +216,8 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer int length = seq.getLength(); int curStart = -1; - int curWidth = av.getCharWidth(), avWidth = av.getCharWidth(), avHeight = av - .getCharHeight(); + int curWidth = av.getCharWidth(), avWidth = av.getCharWidth(), + avHeight = av.getCharHeight(); Color tempColour = null; @@ -308,8 +307,9 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer else { char gap = av.getGapCharacter(); - graphics.drawString(seq.getSequenceAsString(start, end + 1) - .replace(gap, ' '), 0, y1); + graphics.drawString( + seq.getSequenceAsString(start, end + 1).replace(gap, ' '), + 0, y1); } } else @@ -317,8 +317,9 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer boolean srep = av.isDisplayReferenceSeq(); boolean getboxColour = false; boolean isarep = av.getAlignment().getSeqrep() == seq; - boolean isgrep = currentSequenceGroup != null ? currentSequenceGroup - .getSeqrep() == seq : false; + boolean isgrep = currentSequenceGroup != null + ? currentSequenceGroup.getSeqrep() == seq + : false; char sr_c; for (int i = start; i <= end; i++) { @@ -354,7 +355,8 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer if (currentSequenceGroup.thresholdTextColour > 0) { if (resBoxColour.getRed() + resBoxColour.getBlue() - + resBoxColour.getGreen() < currentSequenceGroup.thresholdTextColour) + + resBoxColour + .getGreen() < currentSequenceGroup.thresholdTextColour) { graphics.setColor(currentSequenceGroup.textColour2); } @@ -443,21 +445,25 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer // currentSequenceGroup.getConsensus() char conschar = (usesrep) ? (currentGroup == null || position < currentGroup.getStartRes() - || position > currentGroup.getEndRes() ? av.getAlignment() - .getSeqrep().getCharAt(position) - : (currentGroup.getSeqrep() != null ? currentGroup.getSeqrep() - .getCharAt(position) : av.getAlignment().getSeqrep() - .getCharAt(position))) + || position > currentGroup.getEndRes() + ? av.getAlignment().getSeqrep().getCharAt(position) + : (currentGroup.getSeqrep() != null + ? currentGroup.getSeqrep().getCharAt(position) + : av.getAlignment().getSeqrep() + .getCharAt(position))) : (currentGroup != null && currentGroup.getConsensus() != null && position >= currentGroup.getStartRes() - && position <= currentGroup.getEndRes() && currentGroup - .getConsensus().annotations.length > position) ? currentGroup - .getConsensus().annotations[position].displayCharacter - .charAt(0) - : av.getAlignmentConsensusAnnotation().annotations[position].displayCharacter - .charAt(0); + && position <= currentGroup.getEndRes() + && currentGroup + .getConsensus().annotations.length > position) + ? currentGroup + .getConsensus().annotations[position].displayCharacter + .charAt(0) + : av.getAlignmentConsensusAnnotation().annotations[position].displayCharacter + .charAt(0); if (!jalview.util.Comparison.isGap(conschar) - && (sequenceChar == conschar || sequenceChar + CHAR_TO_UPPER == conschar)) + && (sequenceChar == conschar + || sequenceChar + CHAR_TO_UPPER == conschar)) { sequenceChar = conservedChar; } @@ -511,8 +517,8 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer * @param height * DOCUMENT ME! */ - public void drawHighlightedText(SequenceI seq, int start, int end, - int x1, int y1) + public void drawHighlightedText(SequenceI seq, int start, int end, int x1, + int y1) { int pady = av.getCharHeight() / 5; int charOffset = 0; diff --git a/src/jalview/gui/SliderPanel.java b/src/jalview/gui/SliderPanel.java index 2176719..e6ec822 100755 --- a/src/jalview/gui/SliderPanel.java +++ b/src/jalview/gui/SliderPanel.java @@ -99,15 +99,15 @@ public class SliderPanel extends GSliderPanel if (forConservation) { - label.setText(MessageManager - .getString("label.enter_value_increase_conservation_visibility")); + label.setText(MessageManager.getString( + "label.enter_value_increase_conservation_visibility")); slider.setMinimum(0); slider.setMaximum(100); } else { - label.setText(MessageManager - .getString("label.enter_percentage_identity_above_which_colour_residues")); + label.setText(MessageManager.getString( + "label.enter_percentage_identity_above_which_colour_residues")); slider.setMinimum(0); slider.setMaximum(100); } @@ -162,15 +162,16 @@ public class SliderPanel extends GSliderPanel else { sliderPanel = (SliderPanel) conservationSlider.getContentPane(); - sliderPanel.valueField.setText(String.valueOf(rs.getConservationInc())); + sliderPanel.valueField + .setText(String.valueOf(rs.getConservationInc())); sliderPanel.cs = rs; sliderPanel.ap = ap; sliderPanel.slider.setValue(rs.getConservationInc()); } conservationSlider.setTitle(MessageManager.formatMessage( - "label.conservation_colour_increment", - new String[] { source == null ? BACKGROUND : source })); + "label.conservation_colour_increment", new String[] + { source == null ? BACKGROUND : source })); List groups = ap.av.getAlignment().getGroups(); if (groups != null && !groups.isEmpty()) @@ -230,15 +231,14 @@ public class SliderPanel extends GSliderPanel { Desktop.addInternalFrame(conservationSlider, conservationSlider.getTitle(), 420, 90, false); - conservationSlider - .addInternalFrameListener(new InternalFrameAdapter() - { - @Override - public void internalFrameClosed(InternalFrameEvent e) - { - conservationSlider = null; - } - }); + conservationSlider.addInternalFrameListener(new InternalFrameAdapter() + { + @Override + public void internalFrameClosed(InternalFrameEvent e) + { + conservationSlider = null; + } + }); conservationSlider.setLayer(JLayeredPane.PALETTE_LAYER); } } @@ -255,8 +255,8 @@ public class SliderPanel extends GSliderPanel * * @return */ - public static int setPIDSliderSource(AlignmentPanel ap, - ResidueShaderI rs, String source) + public static int setPIDSliderSource(AlignmentPanel ap, ResidueShaderI rs, + String source) { int threshold = rs.getThreshold(); @@ -279,8 +279,8 @@ public class SliderPanel extends GSliderPanel } PIDSlider.setTitle(MessageManager.formatMessage( - "label.percentage_identity_threshold", - new String[] { source == null ? BACKGROUND : source })); + "label.percentage_identity_threshold", new String[] + { source == null ? BACKGROUND : source })); if (ap.av.getAlignment().getGroups() != null) { @@ -455,8 +455,8 @@ public class SliderPanel extends GSliderPanel static int getValue(JInternalFrame slider) { - return slider == null ? 0 : ((SliderPanel) slider.getContentPane()) - .getValue(); + return slider == null ? 0 + : ((SliderPanel) slider.getContentPane()).getValue(); } public static int getPIDValue() diff --git a/src/jalview/gui/SplashScreen.java b/src/jalview/gui/SplashScreen.java index 16ec9d9..22b697e 100755 --- a/src/jalview/gui/SplashScreen.java +++ b/src/jalview/gui/SplashScreen.java @@ -43,8 +43,8 @@ import javax.swing.event.HyperlinkListener; * @author $author$ * @version $Revision$ */ -public class SplashScreen extends JPanel implements Runnable, - HyperlinkListener +public class SplashScreen extends JPanel + implements Runnable, HyperlinkListener { boolean visible = true; @@ -111,14 +111,14 @@ public class SplashScreen extends JPanel implements Runnable, try { java.net.URL url = getClass().getResource("/images/Jalview_Logo.png"); - java.net.URL urllogo = getClass().getResource( - "/images/Jalview_Logo_small.png"); + java.net.URL urllogo = getClass() + .getResource("/images/Jalview_Logo_small.png"); if (url != null) { image = java.awt.Toolkit.getDefaultToolkit().createImage(url); - Image logo = java.awt.Toolkit.getDefaultToolkit().createImage( - urllogo); + Image logo = java.awt.Toolkit.getDefaultToolkit() + .createImage(urllogo); MediaTracker mt = new MediaTracker(this); mt.addImage(image, 0); mt.addImage(logo, 1); diff --git a/src/jalview/gui/SplitFrame.java b/src/jalview/gui/SplitFrame.java index 1d929e6..beb2d62 100644 --- a/src/jalview/gui/SplitFrame.java +++ b/src/jalview/gui/SplitFrame.java @@ -131,8 +131,8 @@ public class SplitFrame extends GSplitFrame implements SplitContainerI { // allow about 65 pixels for Desktop decorators on Windows - int newHeight = Math.min(height, Desktop.instance.getHeight() - - DESKTOP_DECORATORS_HEIGHT); + int newHeight = Math.min(height, + Desktop.instance.getHeight() - DESKTOP_DECORATORS_HEIGHT); if (newHeight != height) { int oldDividerLocation = getDividerLocation(); @@ -373,8 +373,8 @@ public class SplitFrame extends GSplitFrame implements SplitContainerI /* * Ctrl-W / Cmd-W - close view or window */ - KeyStroke key_cmdW = KeyStroke.getKeyStroke(KeyEvent.VK_W, Toolkit - .getDefaultToolkit().getMenuShortcutKeyMask(), false); + KeyStroke key_cmdW = KeyStroke.getKeyStroke(KeyEvent.VK_W, + Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false); action = new AbstractAction() { @Override @@ -394,8 +394,8 @@ public class SplitFrame extends GSplitFrame implements SplitContainerI /* * Ctrl-T / Cmd-T open new view */ - KeyStroke key_cmdT = KeyStroke.getKeyStroke(KeyEvent.VK_T, Toolkit - .getDefaultToolkit().getMenuShortcutKeyMask(), false); + KeyStroke key_cmdT = KeyStroke.getKeyStroke(KeyEvent.VK_T, + Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false); AbstractAction action = new AbstractAction() { @Override @@ -448,8 +448,8 @@ public class SplitFrame extends GSplitFrame implements SplitContainerI Component c = getFrameAtMouse(); if (c != null && c instanceof AlignFrame) { - for (ActionListener a : ((AlignFrame) c).getAccelerators() - .get(ks).getActionListeners()) + for (ActionListener a : ((AlignFrame) c).getAccelerators().get(ks) + .getActionListeners()) { a.actionPerformed(null); } @@ -719,8 +719,9 @@ public class SplitFrame extends GSplitFrame implements SplitContainerI */ public List getAlignFrames() { - return Arrays.asList(new AlignFrame[] { (AlignFrame) getTopFrame(), - (AlignFrame) getBottomFrame() }); + return Arrays + .asList(new AlignFrame[] + { (AlignFrame) getTopFrame(), (AlignFrame) getBottomFrame() }); } /** @@ -733,8 +734,8 @@ public class SplitFrame extends GSplitFrame implements SplitContainerI /* * Ctrl-F / Cmd-F open Finder dialog, 'focused' on the right alignment */ - KeyStroke key_cmdF = KeyStroke.getKeyStroke(KeyEvent.VK_F, Toolkit - .getDefaultToolkit().getMenuShortcutKeyMask(), false); + KeyStroke key_cmdF = KeyStroke.getKeyStroke(KeyEvent.VK_F, + Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false); AbstractAction action = new AbstractAction() { @Override diff --git a/src/jalview/gui/StructureChooser.java b/src/jalview/gui/StructureChooser.java index 3e516a6..da10e3f 100644 --- a/src/jalview/gui/StructureChooser.java +++ b/src/jalview/gui/StructureChooser.java @@ -62,8 +62,8 @@ import javax.swing.table.AbstractTableModel; * */ @SuppressWarnings("serial") -public class StructureChooser extends GStructureChooser implements - IProgressIndicator +public class StructureChooser extends GStructureChooser + implements IProgressIndicator { private static int MAX_QLENGTH = 7820; @@ -117,9 +117,8 @@ public class StructureChooser extends GStructureChooser implements .getString("status.loading_cached_pdb_entries"), startTime); loadLocalCachedPDBEntries(); updateProgressIndicator(null, startTime); - updateProgressIndicator(MessageManager - .getString("status.searching_for_pdb_structures"), - startTime); + updateProgressIndicator(MessageManager.getString( + "status.searching_for_pdb_structures"), startTime); fetchStructuresMetaData(); // revise filter options if no results were found populateFilterComboBox(isStructuresDiscovered(), cachedPDBExists); @@ -197,9 +196,8 @@ public class StructureChooser extends GStructureChooser implements if (discoveredStructuresSet != null && !discoveredStructuresSet.isEmpty()) { - getResultTable().setModel( - FTSRestResponse.getTableModel(lastPdbRequest, - discoveredStructuresSet)); + getResultTable().setModel(FTSRestResponse + .getTableModel(lastPdbRequest, discoveredStructuresSet)); noOfStructuresFound = discoveredStructuresSet.size(); mainFrame.setTitle(MessageManager.formatMessage( "label.structure_chooser_no_of_structures", @@ -268,8 +266,8 @@ public class StructureChooser extends GStructureChooser implements { if (isValidSeqName(entry.getId())) { - queryBuilder.append("pdb_id:") - .append(entry.getId().toLowerCase()).append(" OR "); + queryBuilder.append("pdb_id:").append(entry.getId().toLowerCase()) + .append(" OR "); isPDBRefsFound = true; } } @@ -458,9 +456,8 @@ public class StructureChooser extends GStructureChooser implements Collection reorderedStructuresSet = new LinkedHashSet(); reorderedStructuresSet.addAll(filteredResponse); reorderedStructuresSet.addAll(discoveredStructuresSet); - getResultTable().setModel( - FTSRestResponse.getTableModel(lastPdbRequest, - reorderedStructuresSet)); + getResultTable().setModel(FTSRestResponse + .getTableModel(lastPdbRequest, reorderedStructuresSet)); FTSRestResponse.configureTableColumn(getResultTable(), wantedFields, tempUserPrefs); @@ -484,9 +481,7 @@ public class StructureChooser extends GStructureChooser implements { errorMsg.append(error).append("\n"); } - JvOptionPane.showMessageDialog( - null, - errorMsg.toString(), + JvOptionPane.showMessageDialog(null, errorMsg.toString(), MessageManager.getString("label.pdb_web-service_error"), JvOptionPane.ERROR_MESSAGE); } @@ -509,9 +504,9 @@ public class StructureChooser extends GStructureChooser implements jalview.io.JalviewFileChooser chooser = new jalview.io.JalviewFileChooser( jalview.bin.Cache.getProperty("LAST_DIRECTORY")); chooser.setFileView(new jalview.io.JalviewFileView()); - chooser.setDialogTitle(MessageManager.formatMessage( - "label.select_pdb_file_for", - selectedSequence.getDisplayId(false))); + chooser.setDialogTitle( + MessageManager.formatMessage("label.select_pdb_file_for", + selectedSequence.getDisplayId(false))); chooser.setToolTipText(MessageManager.formatMessage( "label.load_pdb_file_associate_with_sequence", selectedSequence.getDisplayId(false))); @@ -551,10 +546,10 @@ public class StructureChooser extends GStructureChooser implements cmb_filterOption.addItem(new FilterOption("Most Polymer Residues", "number_of_polymer_residues", VIEWS_FILTER, true)); } - cmb_filterOption.addItem(new FilterOption("Enter PDB Id", "-", - VIEWS_ENTER_ID, false)); - cmb_filterOption.addItem(new FilterOption("From File", "-", - VIEWS_FROM_FILE, false)); + cmb_filterOption.addItem( + new FilterOption("Enter PDB Id", "-", VIEWS_ENTER_ID, false)); + cmb_filterOption.addItem( + new FilterOption("From File", "-", VIEWS_FROM_FILE, false)); if (cachedPDBExists) { @@ -642,22 +637,20 @@ public class StructureChooser extends GStructureChooser implements lbl_pdbManualFetchStatus.setToolTipText(""); if (txt_search.getText().length() > 0) { - lbl_pdbManualFetchStatus - .setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager - .formatMessage("info.no_pdb_entry_found_for", - txt_search.getText()))); + lbl_pdbManualFetchStatus.setToolTipText(JvSwingUtils.wrapTooltip(true, + MessageManager.formatMessage("info.no_pdb_entry_found_for", + txt_search.getText()))); } if (errorWarning.length() > 0) { lbl_pdbManualFetchStatus.setIcon(warningImage); - lbl_pdbManualFetchStatus.setToolTipText(JvSwingUtils.wrapTooltip( - true, errorWarning.toString())); + lbl_pdbManualFetchStatus.setToolTipText( + JvSwingUtils.wrapTooltip(true, errorWarning.toString())); } - if (selectedSequences.length == 1 - || !assSeqOpt.getName().equalsIgnoreCase( - "-Select Associated Seq-")) + if (selectedSequences.length == 1 || !assSeqOpt.getName() + .equalsIgnoreCase("-Select Associated Seq-")) { txt_search.setEnabled(true); if (isValidPBDEntry) @@ -682,9 +675,8 @@ public class StructureChooser extends GStructureChooser implements AssociateSeqOptions assSeqOpt = (AssociateSeqOptions) fileChooserAssSeqPanel .getCmb_assSeq().getSelectedItem(); lbl_fromFileStatus.setIcon(errorImage); - if (selectedSequences.length == 1 - || (assSeqOpt != null && !assSeqOpt.getName().equalsIgnoreCase( - "-Select Associated Seq-"))) + if (selectedSequences.length == 1 || (assSeqOpt != null && !assSeqOpt + .getName().equalsIgnoreCase("-Select Associated Seq-"))) { btn_pdbFromFile.setEnabled(true); if (selectedPdbFileName != null && selectedPdbFileName.length() > 0) @@ -758,8 +750,8 @@ public class StructureChooser extends GStructureChooser implements List selectedSeqsToView = new ArrayList(); for (int row : selectedRows) { - String pdbIdStr = getResultTable().getValueAt(row, - pdbIdColIndex).toString(); + String pdbIdStr = getResultTable() + .getValueAt(row, pdbIdColIndex).toString(); SequenceI selectedSeq = (SequenceI) getResultTable() .getValueAt(row, refSeqColIndex); selectedSeqsToView.add(selectedSeq); @@ -797,8 +789,8 @@ public class StructureChooser extends GStructureChooser implements PDBEntry pdbEntry = (PDBEntry) tbl_local_pdb.getValueAt(row, pdbIdColIndex); pdbEntriesToView[count++] = pdbEntry; - SequenceI selectedSeq = (SequenceI) tbl_local_pdb.getValueAt( - row, refSeqColIndex); + SequenceI selectedSeq = (SequenceI) tbl_local_pdb + .getValueAt(row, refSeqColIndex); selectedSeqsToView.add(selectedSeq); } SequenceI[] selectedSeqs = selectedSeqsToView @@ -834,23 +826,25 @@ public class StructureChooser extends GStructureChooser implements PDBEntry[] pdbEntriesToView = new PDBEntry[] { pdbEntry }; launchStructureViewer(ssm, pdbEntriesToView, ap, - new SequenceI[] { selectedSequence }); - } - else if (currentView == VIEWS_FROM_FILE) - { - SequenceI userSelectedSeq = ((AssociateSeqOptions) fileChooserAssSeqPanel - .getCmb_assSeq().getSelectedItem()).getSequence(); - if (userSelectedSeq != null) - { - selectedSequence = userSelectedSeq; - } - PDBEntry fileEntry = new AssociatePdbFileWithSeq() - .associatePdbWithSeq(selectedPdbFileName, - DataSourceType.FILE, - selectedSequence, true, Desktop.instance); + new SequenceI[] + { selectedSequence }); + } + else if (currentView == VIEWS_FROM_FILE) + { + SequenceI userSelectedSeq = ((AssociateSeqOptions) fileChooserAssSeqPanel + .getCmb_assSeq().getSelectedItem()).getSequence(); + if (userSelectedSeq != null) + { + selectedSequence = userSelectedSeq; + } + PDBEntry fileEntry = new AssociatePdbFileWithSeq() + .associatePdbWithSeq(selectedPdbFileName, + DataSourceType.FILE, selectedSequence, true, + Desktop.instance); launchStructureViewer(ssm, new PDBEntry[] { fileEntry }, ap, - new SequenceI[] { selectedSequence }); + new SequenceI[] + { selectedSequence }); } closeAction(preferredHeight); } @@ -936,8 +930,8 @@ public class StructureChooser extends GStructureChooser implements } SequenceI[][] collatedSeqs = seqsMap.toArray(new SequenceI[0][0]); ssm.setProgressBar(null); - ssm.setProgressBar(MessageManager - .getString("status.fetching_3d_structures_for_selected_entries")); + ssm.setProgressBar(MessageManager.getString( + "status.fetching_3d_structures_for_selected_entries")); sViewer.viewStructures(pdbEntriesToView, collatedSeqs, alignPanel); } else @@ -956,11 +950,12 @@ public class StructureChooser extends GStructureChooser implements */ @Override public void populateCmbAssociateSeqOptions( - JComboBox cmb_assSeq, JLabel lbl_associateSeq) + JComboBox cmb_assSeq, + JLabel lbl_associateSeq) { cmb_assSeq.removeAllItems(); - cmb_assSeq.addItem(new AssociateSeqOptions("-Select Associated Seq-", - null)); + cmb_assSeq.addItem( + new AssociateSeqOptions("-Select Associated Seq-", null)); lbl_associateSeq.setVisible(false); if (selectedSequences.length > 1) { @@ -1049,8 +1044,9 @@ public class StructureChooser extends GStructureChooser implements public void run() { fetchStructuresMetaData(); - filterResultSet(((FilterOption) cmb_filterOption - .getSelectedItem()).getValue()); + filterResultSet( + ((FilterOption) cmb_filterOption.getSelectedItem()) + .getValue()); } }); refreshThread.start(); @@ -1059,7 +1055,8 @@ public class StructureChooser extends GStructureChooser implements public class PDBEntryTableModel extends AbstractTableModel { - String[] columns = { "Ref Sequence", "PDB Id", "Chain", "Type", "File" }; + String[] columns = { "Ref Sequence", "PDB Id", "Chain", "Type", + "File" }; private List pdbEntries; @@ -1106,8 +1103,8 @@ public class StructureChooser extends GStructureChooser implements value = entry.getPdbEntry(); break; case 2: - value = entry.getPdbEntry().getChainCode() == null ? "_" : entry - .getPdbEntry().getChainCode(); + value = entry.getPdbEntry().getChainCode() == null ? "_" + : entry.getPdbEntry().getChainCode(); break; case 3: value = entry.getPdbEntry().getType(); diff --git a/src/jalview/gui/StructureViewer.java b/src/jalview/gui/StructureViewer.java index 189d490..e58b378 100644 --- a/src/jalview/gui/StructureViewer.java +++ b/src/jalview/gui/StructureViewer.java @@ -61,7 +61,8 @@ public class StructureViewer Cache.setProperty(Preferences.STRUCTURE_DISPLAY, type.name()); } - public StructureViewer(StructureSelectionManager structureSelectionManager) + public StructureViewer( + StructureSelectionManager structureSelectionManager) { ssm = structureSelectionManager; } @@ -123,8 +124,8 @@ public class StructureViewer } } } - return viewStructures(pdbs[0], - seqs.toArray(new SequenceI[seqs.size()]), ap); + return viewStructures(pdbs[0], seqs.toArray(new SequenceI[seqs.size()]), + ap); } public JalviewStructureDisplayI viewStructures(PDBEntry pdb, @@ -140,7 +141,8 @@ public class StructureViewer JalviewStructureDisplayI sview = null; if (viewerType.equals(ViewerType.JMOL)) { - sview = new AppJmol(ap, pdbsForFile, ap.av.collateForPDB(pdbsForFile)); + sview = new AppJmol(ap, pdbsForFile, + ap.av.collateForPDB(pdbsForFile)); } else if (viewerType.equals(ViewerType.CHIMERA)) { @@ -219,10 +221,10 @@ public class StructureViewer * @param vid * @return */ - public JalviewStructureDisplayI createView(ViewerType type, - String[] pdbf, String[] id, SequenceI[][] sq, - AlignmentPanel alignPanel, StructureViewerModel viewerData, - String fileloc, Rectangle rect, String vid) + public JalviewStructureDisplayI createView(ViewerType type, String[] pdbf, + String[] id, SequenceI[][] sq, AlignmentPanel alignPanel, + StructureViewerModel viewerData, String fileloc, Rectangle rect, + String vid) { final boolean useinViewerSuperpos = viewerData.isAlignWithPanel(); final boolean usetoColourbyseq = viewerData.isColourWithAlignPanel(); @@ -236,8 +238,8 @@ public class StructureViewer useinViewerSuperpos, viewerColouring, fileloc, rect, vid); break; case CHIMERA: - Cache.log.error("Unsupported structure viewer type " - + type.toString()); + Cache.log.error( + "Unsupported structure viewer type " + type.toString()); break; default: Cache.log.error("Unknown structure viewer type " + type.toString()); diff --git a/src/jalview/gui/StructureViewerBase.java b/src/jalview/gui/StructureViewerBase.java index e73ce07..3ba9947 100644 --- a/src/jalview/gui/StructureViewerBase.java +++ b/src/jalview/gui/StructureViewerBase.java @@ -119,6 +119,7 @@ public abstract class StructureViewerBase extends GStructureViewer { super(); } + /** * * @param ap2 @@ -355,7 +356,8 @@ public abstract class StructureViewerBase extends GStructureViewer } // otherwise, start adding the structure. getBinding().addSequenceAndChain(new PDBEntry[] { pdbentry }, - new SequenceI[][] { seqs }, new String[][] { chains }); + new SequenceI[][] + { seqs }, new String[][] { chains }); addingStructures = true; _started = false; alignAddedStructures = align; @@ -377,7 +379,8 @@ public abstract class StructureViewerBase extends GStructureViewer { int option = JvOptionPane.showInternalConfirmDialog(Desktop.desktop, MessageManager.formatMessage("label.add_pdbentry_to_view", - new Object[] { pdbId, view.getTitle() }), + new Object[] + { pdbId, view.getTitle() }), MessageManager .getString("label.align_to_existing_structure_view"), JvOptionPane.YES_NO_CANCEL_OPTION); @@ -488,8 +491,8 @@ public abstract class StructureViewerBase extends GStructureViewer */ viewer.useAlignmentPanelForColourbyseq(apanel); viewer.buildActionMenu(); - apanel.getStructureSelectionManager().sequenceColoursChanged( - apanel); + apanel.getStructureSelectionManager() + .sequenceColoursChanged(apanel); break; } } @@ -520,11 +523,11 @@ public abstract class StructureViewerBase extends GStructureViewer */ int option = JvOptionPane.showInternalConfirmDialog(Desktop.desktop, MessageManager.formatMessage( - "label.pdb_entry_is_already_displayed", - new Object[] { pdbId }), MessageManager - .formatMessage( - "label.map_sequences_to_visible_window", - new Object[] { pdbId }), + "label.pdb_entry_is_already_displayed", new Object[] + { pdbId }), + MessageManager.formatMessage( + "label.map_sequences_to_visible_window", new Object[] + { pdbId }), JvOptionPane.YES_NO_CANCEL_OPTION); if (option == JvOptionPane.CANCEL_OPTION) { @@ -596,8 +599,8 @@ public abstract class StructureViewerBase extends GStructureViewer public void changeColour_actionPerformed(String colourSchemeName) { AlignmentI al = getAlignmentPanel().av.getAlignment(); - ColourSchemeI cs = ColourSchemes.getInstance().getColourScheme( - colourSchemeName, al, null); + ColourSchemeI cs = ColourSchemes.getInstance() + .getColourScheme(colourSchemeName, al, null); getBinding().setJalviewColourScheme(cs); } @@ -780,7 +783,8 @@ public abstract class StructureViewerBase extends GStructureViewer } @Override - public void setJalviewColourScheme(ColourSchemeI cs) { + public void setJalviewColourScheme(ColourSchemeI cs) + { getBinding().setJalviewColourScheme(cs); } @@ -790,8 +794,7 @@ public abstract class StructureViewerBase extends GStructureViewer * the operation. */ @Override - protected String alignStructs_actionPerformed( - ActionEvent actionEvent) + protected String alignStructs_actionPerformed(ActionEvent actionEvent) { return alignStructs_withAllAlignPanels(); } @@ -802,12 +805,12 @@ public abstract class StructureViewerBase extends GStructureViewer { return null; } - + if (_alignwith.size() == 0) { _alignwith.add(getAlignmentPanel()); } - + String reply = null; try { @@ -815,7 +818,7 @@ public abstract class StructureViewerBase extends GStructureViewer HiddenColumns[] alc = new HiddenColumns[_alignwith.size()]; int[] alm = new int[_alignwith.size()]; int a = 0; - + for (AlignmentPanel ap : _alignwith) { als[a] = ap.av.getAlignment(); @@ -825,8 +828,8 @@ public abstract class StructureViewerBase extends GStructureViewer reply = getBinding().superposeStructures(als, alm, alc); if (reply != null) { - String text = MessageManager.formatMessage( - "error.superposition_failed", reply); + String text = MessageManager + .formatMessage("error.superposition_failed", reply); statusBar.setText(text); } } catch (Exception e) @@ -853,6 +856,7 @@ public abstract class StructureViewerBase extends GStructureViewer getBinding().setBackgroundColour(col); } } + @Override public void viewerColour_actionPerformed(ActionEvent actionEvent) { @@ -862,18 +866,21 @@ public abstract class StructureViewerBase extends GStructureViewer getBinding().setColourBySequence(false); } } + @Override public void chainColour_actionPerformed(ActionEvent actionEvent) { chainColour.setSelected(true); getBinding().colourByChain(); } + @Override public void chargeColour_actionPerformed(ActionEvent actionEvent) { chargeColour.setSelected(true); getBinding().colourByCharge(); } + @Override public void seqColour_actionPerformed(ActionEvent actionEvent) { @@ -900,18 +907,19 @@ public abstract class StructureViewerBase extends GStructureViewer } } } + @Override public void pdbFile_actionPerformed(ActionEvent actionEvent) { JalviewFileChooser chooser = new JalviewFileChooser( Cache.getProperty("LAST_DIRECTORY")); - + chooser.setFileView(new JalviewFileView()); chooser.setDialogTitle(MessageManager.getString("label.save_pdb_file")); chooser.setToolTipText(MessageManager.getString("action.save")); - + int value = chooser.showSaveDialog(this); - + if (value == JalviewFileChooser.APPROVE_OPTION) { BufferedReader in = null; @@ -921,7 +929,7 @@ public abstract class StructureViewerBase extends GStructureViewer in = new BufferedReader( new FileReader(getBinding().getStructureFiles()[0])); File outFile = chooser.getSelectedFile(); - + PrintWriter out = new PrintWriter(new FileOutputStream(outFile)); String data; while ((data = in.readLine()) != null) @@ -950,6 +958,7 @@ public abstract class StructureViewerBase extends GStructureViewer } } } + @Override public void viewMapping_actionPerformed(ActionEvent actionEvent) { @@ -984,7 +993,7 @@ public abstract class StructureViewerBase extends GStructureViewer return; } setChainMenuItems(binding.getChainNames()); - + this.setTitle(binding.getViewerTitle(getViewerName(), true)); /* diff --git a/src/jalview/gui/TextColourChooser.java b/src/jalview/gui/TextColourChooser.java index 91e05c6..3986561 100644 --- a/src/jalview/gui/TextColourChooser.java +++ b/src/jalview/gui/TextColourChooser.java @@ -64,7 +64,8 @@ public class TextColourChooser * @param sequenceGroup * the SequenceGroup context (only for group pop-menu option) */ - public void chooseColour(AlignmentPanel alignPanel, SequenceGroup sequenceGroup) + public void chooseColour(AlignmentPanel alignPanel, + SequenceGroup sequenceGroup) { this.ap = alignPanel; this.sg = sequenceGroup; @@ -86,11 +87,11 @@ public class TextColourChooser JPanel panel = new JPanel(); bigpanel.add(panel, BorderLayout.CENTER); bigpanel.add( - new JLabel( - "" - + MessageManager - .getString("label.select_dark_light_set_threshold") - + ""), BorderLayout.NORTH); + new JLabel("" + + MessageManager.getString( + "label.select_dark_light_set_threshold") + + ""), + BorderLayout.NORTH); panel.add(col1); panel.add(slider); panel.add(col2); @@ -136,14 +137,11 @@ public class TextColourChooser } }); - int reply = JvOptionPane - .showInternalOptionDialog( - alignPanel, - bigpanel, - MessageManager - .getString("label.adjunst_foreground_text_colour_threshold"), - JvOptionPane.OK_CANCEL_OPTION, - JvOptionPane.QUESTION_MESSAGE, null, null, null); + int reply = JvOptionPane.showInternalOptionDialog(alignPanel, bigpanel, + MessageManager.getString( + "label.adjunst_foreground_text_colour_threshold"), + JvOptionPane.OK_CANCEL_OPTION, JvOptionPane.QUESTION_MESSAGE, + null, null, null); if (reply == JvOptionPane.CANCEL_OPTION) { diff --git a/src/jalview/gui/TreeCanvas.java b/src/jalview/gui/TreeCanvas.java index e60ac8e..7dc1a99 100755 --- a/src/jalview/gui/TreeCanvas.java +++ b/src/jalview/gui/TreeCanvas.java @@ -279,8 +279,9 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, g.drawString(nodeLabel, xstart + 2, ypos - 2); } - String name = (markPlaceholders && node.isPlaceholder()) ? (PLACEHOLDER + node - .getName()) : node.getName(); + String name = (markPlaceholders && node.isPlaceholder()) + ? (PLACEHOLDER + node.getName()) + : node.getName(); int charWidth = fm.stringWidth(name) + 3; int charHeight = font.getSize(); @@ -332,10 +333,10 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, g.fillRect(xend - 2, ypos - 2, 4, 4); } - int ystart = (node.left() == null ? 0 : (int) (((SequenceNode) node - .left()).ycount * chunk)) + offy; - int yend = (node.right() == null ? 0 : (int) (((SequenceNode) node - .right()).ycount * chunk)) + int ystart = (node.left() == null ? 0 + : (int) (((SequenceNode) node.left()).ycount * chunk)) + offy; + int yend = (node.right() == null ? 0 + : (int) (((SequenceNode) node.right()).ycount * chunk)) + offy; Rectangle pos = new Rectangle(xend - 2, ypos - 2, 5, 5); @@ -424,8 +425,7 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, SequenceNode top = tree.getTopNode(); - double wscale = ((width * .8) - (offx * 2)) - / tree.getMaxHeight(); + double wscale = ((width * .8) - (offx * 2)) / tree.getMaxHeight(); if (top.count == 0) { @@ -654,8 +654,9 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, if (tree == null) { - g.drawString(MessageManager.getString("label.calculating_tree") - + "....", 20, getHeight() / 2); + g.drawString( + MessageManager.getString("label.calculating_tree") + "....", + 20, getHeight() / 2); } else { @@ -666,9 +667,8 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, repaint(); } - if (fitToWindow - || (!fitToWindow && (scrollPane.getHeight() > ((fm - .getHeight() * nameHash.size()) + offy)))) + if (fitToWindow || (!fitToWindow && (scrollPane + .getHeight() > ((fm.getHeight() * nameHash.size()) + offy)))) { draw(g, scrollPane.getWidth(), scrollPane.getHeight()); setPreferredSize(null); @@ -752,7 +752,8 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, g2.setColor(Color.gray); } - int x = (int) ((threshold * (getWidth() - labelLength - (2 * offx))) + offx); + int x = (int) ((threshold * (getWidth() - labelLength - (2 * offx))) + + offx); g2.drawLine(x, 0, x, getHeight()); } @@ -861,8 +862,8 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, if (ob instanceof SequenceNode) { highlightNode = (SequenceNode) ob; - this.setToolTipText("" - + MessageManager.getString("label.highlightnode")); + this.setToolTipText( + "" + MessageManager.getString("label.highlightnode")); repaint(); } @@ -1007,9 +1008,8 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, } else { - cs = ColourSchemeProperty.getColourScheme(sg, - ColourSchemeProperty.getColourName(av - .getGlobalColourScheme())); + cs = ColourSchemeProperty.getColourScheme(sg, ColourSchemeProperty + .getColourName(av.getGlobalColourScheme())); } // cs is null if shading is an annotationColourGradient // if (cs != null) @@ -1029,8 +1029,7 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, for (int a = 0; a < aps.length; a++) { if (aps[a].av.getGlobalColourScheme() != null - && aps[a].av.getResidueShading() - .conservationApplied()) + && aps[a].av.getResidueShading().conservationApplied()) { Conservation c = new Conservation("Group", sg.getSequences(null), sg.getStartRes(), sg.getEndRes()); diff --git a/src/jalview/gui/TreePanel.java b/src/jalview/gui/TreePanel.java index 35998eb..80f0c73 100755 --- a/src/jalview/gui/TreePanel.java +++ b/src/jalview/gui/TreePanel.java @@ -158,8 +158,8 @@ public class TreePanel extends GTreePanel } if (evt.getNewValue() == null) { - System.out - .println("new alignment sequences vector value is null"); + System.out.println( + "new alignment sequences vector value is null"); } tree.updatePlaceHolders((List) evt.getNewValue()); @@ -183,8 +183,8 @@ public class TreePanel extends GTreePanel void buildAssociatedViewMenu() { - AlignmentPanel[] aps = PaintRefresher.getAssociatedPanels(av - .getSequenceSetId()); + AlignmentPanel[] aps = PaintRefresher + .getAssociatedPanels(av.getSequenceSetId()); if (aps.length == 1 && treeCanvas.ap == aps[0]) { associateLeavesMenu.setVisible(false); @@ -193,7 +193,8 @@ public class TreePanel extends GTreePanel associateLeavesMenu.setVisible(true); - if ((viewMenu.getItem(viewMenu.getItemCount() - 2) instanceof JMenuItem)) + if ((viewMenu + .getItem(viewMenu.getItemCount() - 2) instanceof JMenuItem)) { viewMenu.insertSeparator(viewMenu.getItemCount() - 1); } @@ -275,11 +276,11 @@ public class TreePanel extends GTreePanel } else { - ScoreModelI sm = ScoreModels.getInstance().getScoreModel( - scoreModelName, treeCanvas.ap); - TreeBuilder njtree = treeType.equals(TreeBuilder.NEIGHBOUR_JOINING) ? new NJTree( - av, sm, similarityParams) : new AverageDistanceTree(av, sm, - similarityParams); + ScoreModelI sm = ScoreModels.getInstance() + .getScoreModel(scoreModelName, treeCanvas.ap); + TreeBuilder njtree = treeType.equals(TreeBuilder.NEIGHBOUR_JOINING) + ? new NJTree(av, sm, similarityParams) + : new AverageDistanceTree(av, sm, similarityParams); tree = new TreeModel(njtree); showDistances(true); } @@ -363,8 +364,8 @@ public class TreePanel extends GTreePanel JalviewFileChooser chooser = new JalviewFileChooser( jalview.bin.Cache.getProperty("LAST_DIRECTORY")); chooser.setFileView(new JalviewFileView()); - chooser.setDialogTitle(MessageManager - .getString("label.save_tree_as_newick")); + chooser.setDialogTitle( + MessageManager.getString("label.save_tree_as_newick")); chooser.setToolTipText(MessageManager.getString("action.save")); int value = chooser.showSaveDialog(null); @@ -372,15 +373,15 @@ public class TreePanel extends GTreePanel if (value == JalviewFileChooser.APPROVE_OPTION) { String choice = chooser.getSelectedFile().getPath(); - jalview.bin.Cache.setProperty("LAST_DIRECTORY", chooser - .getSelectedFile().getParent()); + jalview.bin.Cache.setProperty("LAST_DIRECTORY", + chooser.getSelectedFile().getParent()); try { jalview.io.NewickFile fout = new jalview.io.NewickFile( tree.getTopNode()); - String output = fout.print(tree.hasBootstrap(), - tree.hasDistances(), tree.hasRootDistance()); + String output = fout.print(tree.hasBootstrap(), tree.hasDistances(), + tree.hasRootDistance()); java.io.PrintWriter out = new java.io.PrintWriter( new java.io.FileWriter(choice)); out.println(output); @@ -411,8 +412,8 @@ public class TreePanel extends GTreePanel AlignmentView originalData = tree.getOriginalData(); if (originalData == null) { - jalview.bin.Cache.log - .info("Unexpected call to originalSeqData_actionPerformed - should have hidden this menu action."); + jalview.bin.Cache.log.info( + "Unexpected call to originalSeqData_actionPerformed - should have hidden this menu action."); return; } // decide if av alignment is sufficiently different to original data to @@ -439,8 +440,9 @@ public class TreePanel extends GTreePanel // AlignmentOrder origorder = new AlignmentOrder(alAndColsel[0]); AlignmentI al = new Alignment((SequenceI[]) alAndColsel[0]); - AlignmentI dataset = (av != null && av.getAlignment() != null) ? av - .getAlignment().getDataset() : null; + AlignmentI dataset = (av != null && av.getAlignment() != null) + ? av.getAlignment().getDataset() + : null; if (dataset != null) { al.setDataset(dataset); @@ -450,8 +452,7 @@ public class TreePanel extends GTreePanel { // make a new frame! AlignFrame af = new AlignFrame(al, (HiddenColumns) alAndColsel[1], - AlignFrame.DEFAULT_WIDTH, - AlignFrame.DEFAULT_HEIGHT); + AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT); // >>>This is a fix for the moment, until a better solution is // found!!<<< @@ -461,8 +462,8 @@ public class TreePanel extends GTreePanel // msaorder); Desktop.addInternalFrame(af, MessageManager.formatMessage( - "label.original_data_for_params", - new Object[] { this.title }), AlignFrame.DEFAULT_WIDTH, + "label.original_data_for_params", new Object[] + { this.title }), AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT); } } @@ -493,8 +494,8 @@ public class TreePanel extends GTreePanel if (treeCanvas.applyToAllViews) { final ArrayList commands = new ArrayList(); - for (AlignmentPanel ap : PaintRefresher.getAssociatedPanels(av - .getSequenceSetId())) + for (AlignmentPanel ap : PaintRefresher + .getAssociatedPanels(av.getSequenceSetId())) { commands.add(sortAlignmentIn(ap.av.getAlignPanel())); } @@ -532,8 +533,8 @@ public class TreePanel extends GTreePanel } } }); - for (AlignmentPanel ap : PaintRefresher.getAssociatedPanels(av - .getSequenceSetId())) + for (AlignmentPanel ap : PaintRefresher + .getAssociatedPanels(av.getSequenceSetId())) { // ensure all the alignFrames refresh their GI after adding an undo item ap.alignFrame.updateEditMenuBar(); @@ -668,8 +669,8 @@ public class TreePanel extends GTreePanel JalviewFileChooser chooser = new JalviewFileChooser( ImageMaker.EPS_EXTENSION, ImageMaker.EPS_EXTENSION); chooser.setFileView(new JalviewFileView()); - chooser.setDialogTitle(MessageManager - .getString("label.create_eps_from_tree")); + chooser.setDialogTitle( + MessageManager.getString("label.create_eps_from_tree")); chooser.setToolTipText(MessageManager.getString("action.save")); int value = chooser.showSaveDialog(this); @@ -679,11 +680,13 @@ public class TreePanel extends GTreePanel return; } - Cache.setProperty("LAST_DIRECTORY", chooser.getSelectedFile() - .getParent()); + Cache.setProperty("LAST_DIRECTORY", + chooser.getSelectedFile().getParent()); - FileOutputStream out = new FileOutputStream(chooser.getSelectedFile()); - EpsGraphics2D pg = new EpsGraphics2D("Tree", out, 0, 0, width, height); + FileOutputStream out = new FileOutputStream( + chooser.getSelectedFile()); + EpsGraphics2D pg = new EpsGraphics2D("Tree", out, 0, 0, width, + height); pg.setAccurateTextMode(accurateText); @@ -715,8 +718,8 @@ public class TreePanel extends GTreePanel ImageMaker.PNG_EXTENSION, ImageMaker.PNG_DESCRIPTION); chooser.setFileView(new jalview.io.JalviewFileView()); - chooser.setDialogTitle(MessageManager - .getString("label.create_png_from_tree")); + chooser.setDialogTitle( + MessageManager.getString("label.create_png_from_tree")); chooser.setToolTipText(MessageManager.getString("action.save")); int value = chooser.showSaveDialog(this); @@ -726,10 +729,11 @@ public class TreePanel extends GTreePanel return; } - jalview.bin.Cache.setProperty("LAST_DIRECTORY", chooser - .getSelectedFile().getParent()); + jalview.bin.Cache.setProperty("LAST_DIRECTORY", + chooser.getSelectedFile().getParent()); - FileOutputStream out = new FileOutputStream(chooser.getSelectedFile()); + FileOutputStream out = new FileOutputStream( + chooser.getSelectedFile()); BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); @@ -770,9 +774,9 @@ public class TreePanel extends GTreePanel if (sq != null) { // search dbrefs, features and annotation - DBRefEntry[] refs = jalview.util.DBRefUtils.selectRefs( - sq.getDBRefs(), - new String[] { labelClass.toUpperCase() }); + DBRefEntry[] refs = jalview.util.DBRefUtils + .selectRefs(sq.getDBRefs(), new String[] + { labelClass.toUpperCase() }); if (refs != null) { for (int i = 0; i < refs.length; i++) @@ -823,6 +827,7 @@ public class TreePanel extends GTreePanel * Neighbour Joining Using BLOSUM62 *

    * For a tree loaded from file, just uses the file name + * * @return */ public String getPanelTitle() @@ -835,8 +840,8 @@ public class TreePanel extends GTreePanel /* * i18n description of Neighbour Joining or Average Distance method */ - String treecalcnm = MessageManager.getString("label.tree_calc_" - + treeType.toLowerCase()); + String treecalcnm = MessageManager + .getString("label.tree_calc_" + treeType.toLowerCase()); /* * short score model name (long description can be too long) diff --git a/src/jalview/gui/UserDefinedColours.java b/src/jalview/gui/UserDefinedColours.java index f75a0a3..8b45c40 100755 --- a/src/jalview/gui/UserDefinedColours.java +++ b/src/jalview/gui/UserDefinedColours.java @@ -59,11 +59,11 @@ import javax.swing.event.ChangeListener; * @author Andrew Waterhouse * @author Mungo Carstairs */ -public class UserDefinedColours extends GUserDefinedColours implements - ChangeListener +public class UserDefinedColours extends GUserDefinedColours + implements ChangeListener { - private static final Font VERDANA_BOLD_10 = new Font("Verdana", - Font.BOLD, 10); + private static final Font VERDANA_BOLD_10 = new Font("Verdana", Font.BOLD, + 10); public static final String USER_DEFINED_COLOURS = "USER_DEFINED_COLOURS"; @@ -113,7 +113,8 @@ public class UserDefinedColours extends GUserDefinedColours implements if (oldColourScheme instanceof UserColourScheme) { schemeName.setText(oldColourScheme.getSchemeName()); - if (((UserColourScheme) oldColourScheme).getLowerCaseColours() != null) + if (((UserColourScheme) oldColourScheme) + .getLowerCaseColours() != null) { caseSensitive.setSelected(true); lcaseColour.setEnabled(true); @@ -249,7 +250,8 @@ public class UserDefinedColours extends GUserDefinedColours implements { button = lowerCaseButtons.get(i); button.setBackground(newColour); - button.setForeground(ColorUtils.brighterThan(button.getBackground())); + button.setForeground( + ColorUtils.brighterThan(button.getBackground())); } } for (int i = 0; i < selectedButtons.size(); i++) @@ -321,8 +323,8 @@ public class UserDefinedColours extends GUserDefinedColours implements JButton button = (JButton) buttonPanel.getComponent(b); if (!selectedButtons.contains(button)) { - button.setForeground(ColorUtils.brighterThan(button - .getBackground())); + button.setForeground( + ColorUtils.brighterThan(button.getBackground())); selectedButtons.add(button); } } @@ -335,7 +337,8 @@ public class UserDefinedColours extends GUserDefinedColours implements button.setForeground(ColorUtils.darkerThan(button.getBackground())); } selectedButtons.clear(); - pressed.setForeground(ColorUtils.brighterThan(pressed.getBackground())); + pressed.setForeground( + ColorUtils.brighterThan(pressed.getBackground())); selectedButtons.add(pressed); } @@ -343,13 +346,14 @@ public class UserDefinedColours extends GUserDefinedColours implements { if (selectedButtons.contains(pressed)) { - pressed.setForeground(ColorUtils.darkerThan(pressed.getBackground())); + pressed.setForeground( + ColorUtils.darkerThan(pressed.getBackground())); selectedButtons.remove(pressed); } else { - pressed.setForeground(ColorUtils.brighterThan(pressed - .getBackground())); + pressed.setForeground( + ColorUtils.brighterThan(pressed.getBackground())); selectedButtons.add(pressed); } } @@ -440,8 +444,9 @@ public class UserDefinedColours extends GUserDefinedColours implements { if (isNoSelectionMade()) { - JvOptionPane.showMessageDialog(Desktop.desktop, MessageManager - .getString("label.no_colour_selection_in_scheme"), + JvOptionPane.showMessageDialog(Desktop.desktop, + MessageManager + .getString("label.no_colour_selection_in_scheme"), MessageManager.getString("label.no_colour_selection_warn"), JvOptionPane.WARNING_MESSAGE); } @@ -543,8 +548,9 @@ public class UserDefinedColours extends GUserDefinedColours implements { if (isNoSelectionMade()) { - JvOptionPane.showMessageDialog(Desktop.desktop, MessageManager - .getString("label.no_colour_selection_in_scheme"), + JvOptionPane.showMessageDialog(Desktop.desktop, + MessageManager + .getString("label.no_colour_selection_in_scheme"), MessageManager.getString("label.no_colour_selection_warn"), JvOptionPane.WARNING_MESSAGE); @@ -631,8 +637,8 @@ public class UserDefinedColours extends GUserDefinedColours implements JalviewFileChooser chooser = new JalviewFileChooser("jc", "Jalview User Colours"); chooser.setFileView(new JalviewFileView()); - chooser.setDialogTitle(MessageManager - .getString("label.load_colour_scheme")); + chooser.setDialogTitle( + MessageManager.getString("label.load_colour_scheme")); chooser.setToolTipText(MessageManager.getString("action.load")); int value = chooser.showOpenDialog(this); @@ -644,8 +650,8 @@ public class UserDefinedColours extends GUserDefinedColours implements File choice = chooser.getSelectedFile(); Cache.setProperty(LAST_DIRECTORY, choice.getParent()); - UserColourScheme ucs = ColourSchemeLoader.loadColourScheme(choice - .getAbsolutePath()); + UserColourScheme ucs = ColourSchemeLoader + .loadColourScheme(choice.getAbsolutePath()); Color[] colors = ucs.getColours(); schemeName.setText(ucs.getSchemeName()); @@ -712,7 +718,8 @@ public class UserDefinedColours extends GUserDefinedColours implements * name if overwriting *

  • Do the standard file chooser thing to write with extension .jc
  • *
  • If saving changes (possibly not yet applied) to the currently selected - * colour scheme, then apply the changes, as it is too late to back out now
  • + * colour scheme, then apply the changes, as it is too late to back out + * now *
  • Don't apply the changes if the currently selected scheme is different, * to allow a new scheme to be configured and saved but not applied
  • * @@ -726,8 +733,9 @@ public class UserDefinedColours extends GUserDefinedColours implements String name = schemeName.getText().trim(); if (name.length() < 1) { - JvOptionPane.showInternalMessageDialog(Desktop.desktop, MessageManager - .getString("label.user_colour_scheme_must_have_name"), + JvOptionPane.showInternalMessageDialog(Desktop.desktop, + MessageManager + .getString("label.user_colour_scheme_must_have_name"), MessageManager.getString("label.no_name_colour_scheme"), JvOptionPane.WARNING_MESSAGE); return false; @@ -737,8 +745,8 @@ public class UserDefinedColours extends GUserDefinedColours implements { int reply = JvOptionPane.showInternalConfirmDialog(Desktop.desktop, MessageManager.formatMessage( - "label.colour_scheme_exists_overwrite", new Object[] { - name, name }), + "label.colour_scheme_exists_overwrite", new Object[] + { name, name }), MessageManager.getString("label.duplicate_scheme_name"), JvOptionPane.YES_NO_OPTION); if (reply != JvOptionPane.YES_OPTION) @@ -751,8 +759,8 @@ public class UserDefinedColours extends GUserDefinedColours implements JalviewFileView fileView = new JalviewFileView(); chooser.setFileView(fileView); - chooser.setDialogTitle(MessageManager - .getString("label.save_colour_scheme")); + chooser.setDialogTitle( + MessageManager.getString("label.save_colour_scheme")); chooser.setToolTipText(MessageManager.getString("action.save")); int value = chooser.showSaveDialog(this); @@ -796,8 +804,8 @@ public class UserDefinedColours extends GUserDefinedColours implements * update the delimited list of user defined colour files in * Jalview property USER_DEFINED_COLOURS */ - String defaultColours = Cache - .getDefault(USER_DEFINED_COLOURS, filePath); + String defaultColours = Cache.getDefault(USER_DEFINED_COLOURS, + filePath); if (defaultColours.indexOf(filePath) == -1) { if (defaultColours.length() > 0) diff --git a/src/jalview/gui/UserQuestionnaireCheck.java b/src/jalview/gui/UserQuestionnaireCheck.java index 5e5d965..ef86756 100644 --- a/src/jalview/gui/UserQuestionnaireCheck.java +++ b/src/jalview/gui/UserQuestionnaireCheck.java @@ -42,11 +42,9 @@ public class UserQuestionnaireCheck implements Runnable { if (url.indexOf("questionnaire.pl") == -1) { - jalview.bin.Cache.log - .error("'" - + url - + "' is an Invalid URL for the checkForQuestionnaire() method.\n" - + "This argument is only for questionnaires derived from jalview's questionnaire.pl cgi interface."); + jalview.bin.Cache.log.error("'" + url + + "' is an Invalid URL for the checkForQuestionnaire() method.\n" + + "This argument is only for questionnaires derived from jalview's questionnaire.pl cgi interface."); } else { @@ -62,8 +60,8 @@ public class UserQuestionnaireCheck implements Runnable boolean prompt = false; // see if we have already responsed to this questionnaire or get a new // qid/rid pair - BufferedReader br = new BufferedReader(new InputStreamReader( - qurl.openStream())); + BufferedReader br = new BufferedReader( + new InputStreamReader(qurl.openStream())); String qresp; while ((qresp = br.readLine()) != null) { @@ -114,8 +112,9 @@ public class UserQuestionnaireCheck implements Runnable String qurl = url + (url.indexOf('?') > -1 ? "&" : "?") + "checkresponse=1"; // query the server with the old qid/id pair - String qqid = lastq.indexOf(':') > -1 ? lastq.substring(0, - lastq.indexOf(':')) : null; + String qqid = lastq.indexOf(':') > -1 + ? lastq.substring(0, lastq.indexOf(':')) + : null; if (qqid != null && qqid != "null" && qqid.length() > 0) { qurl += "&qid=" + qqid; @@ -140,15 +139,12 @@ public class UserQuestionnaireCheck implements Runnable { String qurl = url + (url.indexOf('?') > -1 ? "&" : "?") + "qid=" + qid + "&rid=" + rid; - jalview.bin.Cache.log.info("Prompting user for questionnaire at " - + qurl); - int reply = JvOptionPane - .showInternalConfirmDialog(Desktop.desktop, MessageManager - .getString("label.jalview_new_questionnaire"), - MessageManager - .getString("label.jalview_user_survey"), - JvOptionPane.YES_NO_OPTION, - JvOptionPane.QUESTION_MESSAGE); + jalview.bin.Cache.log + .info("Prompting user for questionnaire at " + qurl); + int reply = JvOptionPane.showInternalConfirmDialog(Desktop.desktop, + MessageManager.getString("label.jalview_new_questionnaire"), + MessageManager.getString("label.jalview_user_survey"), + JvOptionPane.YES_NO_OPTION, JvOptionPane.QUESTION_MESSAGE); if (reply == JvOptionPane.YES_OPTION) { @@ -158,8 +154,8 @@ public class UserQuestionnaireCheck implements Runnable } } catch (Exception e) { - jalview.bin.Cache.log.warn("When trying to access questionnaire URL " - + url, e); + jalview.bin.Cache.log + .warn("When trying to access questionnaire URL " + url, e); } } diff --git a/src/jalview/gui/VamsasApplication.java b/src/jalview/gui/VamsasApplication.java index d58cb5a..d2086e0 100644 --- a/src/jalview/gui/VamsasApplication.java +++ b/src/jalview/gui/VamsasApplication.java @@ -156,9 +156,8 @@ public class VamsasApplication implements SelectionSource, VamsasSource { if (sess != null) { - throw new Error( - MessageManager - .getString("error.implementation_error_cannot_import_vamsas_doc")); + throw new Error(MessageManager.getString( + "error.implementation_error_cannot_import_vamsas_doc")); } try { @@ -174,15 +173,13 @@ public class VamsasApplication implements SelectionSource, VamsasSource } } catch (InvalidSessionDocumentException e) { - JvOptionPane - .showInternalMessageDialog( - Desktop.desktop, + JvOptionPane.showInternalMessageDialog(Desktop.desktop, - MessageManager - .getString("label.vamsas_doc_couldnt_be_opened_as_new_session"), - MessageManager - .getString("label.vamsas_document_import_failed"), - JvOptionPane.ERROR_MESSAGE); + MessageManager.getString( + "label.vamsas_doc_couldnt_be_opened_as_new_session"), + MessageManager + .getString("label.vamsas_document_import_failed"), + JvOptionPane.ERROR_MESSAGE); } } @@ -204,8 +201,8 @@ public class VamsasApplication implements SelectionSource, VamsasSource } catch (Exception e) { - jalview.bin.Cache.log - .error("Couldn't instantiate vamsas client !", e); + jalview.bin.Cache.log.error("Couldn't instantiate vamsas client !", + e); return false; } return true; @@ -228,14 +225,14 @@ public class VamsasApplication implements SelectionSource, VamsasSource } } catch (Error e) { - Cache.log - .warn("Probable SERIOUS VAMSAS client incompatibility - carrying on regardless", - e); + Cache.log.warn( + "Probable SERIOUS VAMSAS client incompatibility - carrying on regardless", + e); } catch (Exception e) { - Cache.log - .warn("Probable VAMSAS client incompatibility - carrying on regardless", - e); + Cache.log.warn( + "Probable VAMSAS client incompatibility - carrying on regardless", + e); } } @@ -267,16 +264,15 @@ public class VamsasApplication implements SelectionSource, VamsasSource { if (!inSession()) { - throw new Error( - MessageManager - .getString("error.implementation_error_vamsas_operation_not_init")); + throw new Error(MessageManager.getString( + "error.implementation_error_vamsas_operation_not_init")); } addDocumentUpdateHandler(); addStoreDocumentHandler(); startSession(); inInitialUpdate = true; - Cache.log - .debug("Jalview loading the Vamsas Session for the first time."); + Cache.log.debug( + "Jalview loading the Vamsas Session for the first time."); dealWithDocumentUpdate(false); // we don't push an update out to the inInitialUpdate = false; // document yet. @@ -310,9 +306,9 @@ public class VamsasApplication implements SelectionSource, VamsasSource } } catch (Exception e) { - Cache.log - .warn("Exception whilst refreshing jalview windows after a vamsas document update.", - e); + Cache.log.warn( + "Exception whilst refreshing jalview windows after a vamsas document update.", + e); } } @@ -355,9 +351,8 @@ public class VamsasApplication implements SelectionSource, VamsasSource { if (!inSession()) { - throw new Error( - MessageManager - .getString("error.jalview_no_connected_vamsas_session")); + throw new Error(MessageManager + .getString("error.jalview_no_connected_vamsas_session")); } Cache.log.info("Jalview disconnecting from the Vamsas Session."); try @@ -372,8 +367,8 @@ public class VamsasApplication implements SelectionSource, VamsasSource } else { - Cache.log - .warn("JV Client leaving a session that's its not joined yet."); + Cache.log.warn( + "JV Client leaving a session that's its not joined yet."); } joinedSession = false; vclient = null; @@ -487,11 +482,10 @@ public class VamsasApplication implements SelectionSource, VamsasSource } catch (Exception e) { errorsDuringUpdate = true; - Cache.log.error("Exception synchronizing " - + af.getTitle() + Cache.log.error("Exception synchronizing " + af.getTitle() + " " - + (af.getViewport().viewName == null ? "" : " view " - + af.getViewport().viewName) + + (af.getViewport().viewName == null ? "" + : " view " + af.getViewport().viewName) + " to document.", e); stored = false; } @@ -588,8 +582,8 @@ public class VamsasApplication implements SelectionSource, VamsasSource storedviews += updateVamsasDocument(cdoc); if (Cache.log.isDebugEnabled()) { - Cache.log - .debug("Time taken to update Vamsas Document from jalview\t= " + Cache.log.debug( + "Time taken to update Vamsas Document from jalview\t= " + (System.currentTimeMillis() - time)); time = System.currentTimeMillis(); } @@ -606,8 +600,8 @@ public class VamsasApplication implements SelectionSource, VamsasSource updateJalview(cdoc); if (Cache.log.isDebugEnabled()) { - Cache.log - .debug("Time taken to update Jalview from vamsas document Roots\t= " + Cache.log.debug( + "Time taken to update Jalview from vamsas document Roots\t= " + (System.currentTimeMillis() - time)); time = System.currentTimeMillis(); } @@ -663,15 +657,14 @@ public class VamsasApplication implements SelectionSource, VamsasSource { if (client.promptUser) { - Cache.log - .debug("Asking user if the vamsas session should be stored."); - int reply = JvOptionPane - .showInternalConfirmDialog( - Desktop.desktop, - "The current VAMSAS session has unsaved data - do you want to save it ?", - "VAMSAS Session Shutdown", - JvOptionPane.YES_NO_OPTION, - JvOptionPane.QUESTION_MESSAGE); + Cache.log.debug( + "Asking user if the vamsas session should be stored."); + int reply = JvOptionPane.showInternalConfirmDialog( + Desktop.desktop, + "The current VAMSAS session has unsaved data - do you want to save it ?", + "VAMSAS Session Shutdown", + JvOptionPane.YES_NO_OPTION, + JvOptionPane.QUESTION_MESSAGE); if (reply == JvOptionPane.YES_OPTION) { @@ -680,13 +673,13 @@ public class VamsasApplication implements SelectionSource, VamsasSource Cache.log .debug("Finished attempt at storing document."); } - Cache.log - .debug("finished dealing with REQUESTTOCLOSE event."); + Cache.log.debug( + "finished dealing with REQUESTTOCLOSE event."); } else { - Cache.log - .debug("Ignoring store document request (promptUser==false)"); + Cache.log.debug( + "Ignoring store document request (promptUser==false)"); } } }); @@ -728,9 +721,8 @@ public class VamsasApplication implements SelectionSource, VamsasSource return; } - throw new Error( - MessageManager - .getString("error.implementation_error_cannot_recover_vamsas_object_mappings")); + throw new Error(MessageManager.getString( + "error.implementation_error_cannot_recover_vamsas_object_mappings")); } jv2vobj.clear(); Iterator el = _backup_jv2vobj.entrySet().iterator(); @@ -937,8 +929,8 @@ public class VamsasApplication implements SelectionSource, VamsasSource { jselection.setStartRes(prange[p + l] - 1); } - if (jselection.getEndRes() <= maxWidth - && prange[p + u] == (jselection.getEndRes() + 2)) + if (jselection.getEndRes() <= maxWidth && prange[p + + u] == (jselection.getEndRes() + 2)) { jselection.setEndRes(prange[p + u] - 1); } @@ -1009,8 +1001,8 @@ public class VamsasApplication implements SelectionSource, VamsasSource { if (vobj2jv == null) { - Cache.log - .warn("Selection listener still active for dead session."); + Cache.log.warn( + "Selection listener still active for dead session."); // not in a session. return; } @@ -1023,15 +1015,17 @@ public class VamsasApplication implements SelectionSource, VamsasSource } SelectionMessage sm = null; if ((seqsel == null || seqsel.getSize() == 0) - && (colsel == null || colsel.getSelected() == null || colsel - .getSelected().size() == 0)) + && (colsel == null || colsel.getSelected() == null + || colsel.getSelected().size() == 0)) { if (source instanceof AlignViewport) { // the empty selection. sm = new SelectionMessage("jalview", - new String[] { ((AlignmentViewport) source) - .getSequenceSetId() }, null, true); + new String[] + { ((AlignmentViewport) source) + .getSequenceSetId() }, + null, true); } else { diff --git a/src/jalview/gui/ViewSelectionMenu.java b/src/jalview/gui/ViewSelectionMenu.java index f1e2467..cdbb4fa 100644 --- a/src/jalview/gui/ViewSelectionMenu.java +++ b/src/jalview/gui/ViewSelectionMenu.java @@ -152,8 +152,8 @@ public class ViewSelectionMenu extends JMenu append = append || _selectedviews.size() > 1; toggleview = new JCheckBoxMenuItem( MessageManager.getString("label.select_many_views"), append); - toggleview.setToolTipText(MessageManager - .getString("label.toggle_enabled_views")); + toggleview.setToolTipText( + MessageManager.getString("label.toggle_enabled_views")); toggleview.addItemListener(new ItemListener() { @@ -219,8 +219,9 @@ public class ViewSelectionMenu extends JMenu } for (final AlignmentPanel ap : allviews) { - String nm = ((ap.getViewName() == null || ap.getViewName().length() == 0) ? "" - : ap.getViewName() + " for ") + String nm = ((ap.getViewName() == null + || ap.getViewName().length() == 0) ? "" + : ap.getViewName() + " for ") + ap.alignFrame.getTitle(); final JCheckBoxMenuItem checkBox = new JCheckBoxMenuItem(nm, _selectedviews.contains(ap)); diff --git a/src/jalview/gui/WebserviceInfo.java b/src/jalview/gui/WebserviceInfo.java index f650807..2fc08e1 100644 --- a/src/jalview/gui/WebserviceInfo.java +++ b/src/jalview/gui/WebserviceInfo.java @@ -56,8 +56,8 @@ import javax.swing.text.html.StyleSheet; * @author $author$ * @version $Revision$ */ -public class WebserviceInfo extends GWebserviceInfo implements - HyperlinkListener, IProgressIndicator +public class WebserviceInfo extends GWebserviceInfo + implements HyperlinkListener, IProgressIndicator { /** Job is Queued */ @@ -328,8 +328,8 @@ public class WebserviceInfo extends GWebserviceInfo implements this.title = title; setInfoText(info); - java.net.URL url = getClass().getResource( - "/images/Jalview_Logo_small.png"); + java.net.URL url = getClass() + .getResource("/images/Jalview_Logo_small.png"); image = java.awt.Toolkit.getDefaultToolkit().createImage(url); MediaTracker mt = new MediaTracker(this); @@ -348,19 +348,20 @@ public class WebserviceInfo extends GWebserviceInfo implements Thread thread = new Thread(ap); thread.start(); final WebserviceInfo thisinfo = this; - frame.addInternalFrameListener(new javax.swing.event.InternalFrameAdapter() - { - public void internalFrameClosed( - javax.swing.event.InternalFrameEvent evt) - { - // System.out.println("Shutting down webservice client"); - WSClientI service = thisinfo.getthisService(); - if (service != null && service.isCancellable()) - { - service.cancelJob(); - } - }; - }); + frame.addInternalFrameListener( + new javax.swing.event.InternalFrameAdapter() + { + public void internalFrameClosed( + javax.swing.event.InternalFrameEvent evt) + { + // System.out.println("Shutting down webservice client"); + WSClientI service = thisinfo.getthisService(); + if (service != null && service.isCancellable()) + { + service.cancelJob(); + } + }; + }); frame.validate(); } @@ -387,8 +388,8 @@ public class WebserviceInfo extends GWebserviceInfo implements if (jobpane < 0 || jobpane >= jobPanes.size()) { throw new Error(MessageManager.formatMessage( - "error.setstatus_called_non_existent_job_pane", - new String[] { Integer.valueOf(jobpane).toString() })); + "error.setstatus_called_non_existent_job_pane", new String[] + { Integer.valueOf(jobpane).toString() })); } switch (status) { @@ -515,8 +516,8 @@ public class WebserviceInfo extends GWebserviceInfo implements int htmlpos = leaveFirst ? -1 : lowertxt.indexOf("", htmlpos), htmlende = lowertxt - .indexOf(">", htmlend); + int htmlpose = lowertxt.indexOf(">", htmlpos), + htmlende = lowertxt.indexOf(">", htmlend); if (htmlend == -1 && htmlpos == -1) { return text; @@ -563,8 +564,8 @@ public class WebserviceInfo extends GWebserviceInfo implements } if (text.indexOf(" -1) { - System.err.println("HTML COntent: \n" + text - + "<< END HTML CONTENT\n"); + System.err + .println("HTML COntent: \n" + text + "<< END HTML CONTENT\n"); } return text; @@ -586,11 +587,12 @@ public class WebserviceInfo extends GWebserviceInfo implements { String txt = getHtmlFragment( ((JEditorPane) ((JScrollPane) jobPanes.get(which)) - .getViewport().getComponent(0)).getText(), true, - false); + .getViewport().getComponent(0)).getText(), + true, false); ((JEditorPane) ((JScrollPane) jobPanes.get(which)).getViewport() - .getComponent(0)).setText(ensureHtmlTagged(txt - + getHtmlFragment(text, false, true))); + .getComponent(0)) + .setText(ensureHtmlTagged( + txt + getHtmlFragment(text, false, true))); } else { @@ -683,8 +685,8 @@ public class WebserviceInfo extends GWebserviceInfo implements // JBPNote : TODO: Instead of a warning, we should have an optional 'Are // you sure?' prompt warnUser( - MessageManager - .getString("warn.job_cannot_be_cancelled_close_window"), + MessageManager.getString( + "warn.job_cannot_be_cancelled_close_window"), MessageManager.getString("action.cancel_job")); } else @@ -764,7 +766,8 @@ public class WebserviceInfo extends GWebserviceInfo implements { Thread.sleep(50); - int units = (int) ((System.currentTimeMillis() - startTime) / 10f); + int units = (int) ((System.currentTimeMillis() - startTime) + / 10f); angle += units; angle %= 360; startTime = System.currentTimeMillis(); @@ -828,8 +831,8 @@ public class WebserviceInfo extends GWebserviceInfo implements case STATE_CANCELLED_OK: g.drawString( - title.concat(" - ").concat( - MessageManager + title.concat(" - ") + .concat(MessageManager .getString("label.state_job_cancelled")), 60, 30); @@ -845,8 +848,8 @@ public class WebserviceInfo extends GWebserviceInfo implements case STATE_STOPPED_SERVERERROR: g.drawString( - title.concat(" - ").concat( - MessageManager + title.concat(" - ") + .concat(MessageManager .getString("label.server_error_try_later")), 60, 30); diff --git a/src/jalview/gui/WsJobParameters.java b/src/jalview/gui/WsJobParameters.java index 17c0760..10798f6 100644 --- a/src/jalview/gui/WsJobParameters.java +++ b/src/jalview/gui/WsJobParameters.java @@ -186,7 +186,8 @@ public class WsJobParameters extends JPanel implements ItemListener, * @param jobArgset */ public WsJobParameters(JFrame parent, ParamDatastoreI paramStorei, - Jws2Instance service, WsParamSetI preset, List jobArgset) + Jws2Instance service, WsParamSetI preset, + List jobArgset) { super(); jbInit(); @@ -218,13 +219,14 @@ public class WsJobParameters extends JPanel implements ItemListener, frame = new JDialog(Desktop.instance, true); frame.setTitle(MessageManager.formatMessage("label.edit_params_for", - new String[] { service.getActionText() })); + new String[] + { service.getActionText() })); Rectangle deskr = Desktop.instance.getBounds(); Dimension pref = this.getPreferredSize(); - frame.setBounds(new Rectangle( - (int) (deskr.getCenterX() - pref.width / 2), (int) (deskr - .getCenterY() - pref.height / 2), pref.width, - pref.height)); + frame.setBounds( + new Rectangle((int) (deskr.getCenterX() - pref.width / 2), + (int) (deskr.getCenterY() - pref.height / 2), + pref.width, pref.height)); frame.setContentPane(this); // should perhaps recover defaults from user prefs. @@ -302,9 +304,10 @@ public class WsJobParameters extends JPanel implements ItemListener, create_actionPerformed(e); } }); - revertpref = JvSwingUtils.makeButton(MessageManager - .getString("action.revert"), MessageManager - .getString("label.revert_changes_user_parameter_set"), + revertpref = JvSwingUtils.makeButton( + MessageManager.getString("action.revert"), + MessageManager + .getString("label.revert_changes_user_parameter_set"), new ActionListener() { @@ -337,8 +340,8 @@ public class WsJobParameters extends JPanel implements ItemListener, } }); - setDetails.setBorder(new TitledBorder(MessageManager - .getString("label.details"))); + setDetails.setBorder( + new TitledBorder(MessageManager.getString("label.details"))); setDetails.setLayout(new BorderLayout()); setDescr.setColumns(40); setDescr.setWrapStyleWord(true); @@ -346,8 +349,8 @@ public class WsJobParameters extends JPanel implements ItemListener, setDescr.setBackground(getBackground()); setDescr.setEditable(true); setDescr.getDocument().addDocumentListener(this); - setDescr.setToolTipText(MessageManager - .getString("label.edit_notes_parameter_set")); + setDescr.setToolTipText( + MessageManager.getString("label.edit_notes_parameter_set")); JScrollPane setDescrView = new JScrollPane(); setDescrView.getViewport().setView(setDescr); setName.setEditable(true); @@ -397,14 +400,14 @@ public class WsJobParameters extends JPanel implements ItemListener, // paramPane.setPreferredSize(new Dimension(360, 400)); // paramPane.setPreferredSize(null); - jobOptions.setBorder(new TitledBorder(MessageManager - .getString("label.options"))); + jobOptions.setBorder( + new TitledBorder(MessageManager.getString("label.options"))); jobOptions.setOpaque(true); - paramList.setBorder(new TitledBorder(MessageManager - .getString("label.parameters"))); + paramList.setBorder( + new TitledBorder(MessageManager.getString("label.parameters"))); paramList.setOpaque(true); - JPanel bjo = new JPanel(new BorderLayout()), bjp = new JPanel( - new BorderLayout()); + JPanel bjo = new JPanel(new BorderLayout()), + bjp = new JPanel(new BorderLayout()); bjo.add(jobOptions, BorderLayout.CENTER); bjp.add(paramList, BorderLayout.CENTER); bjp.setOpaque(true); @@ -532,8 +535,8 @@ public class WsJobParameters extends JPanel implements ItemListener, List jobArgset = null; settingDialog = true; { // instantiate the abstract proxy for Jaba objects - jobArgset = jabajobArgset == null ? null : JabaParamStore - .getJwsArgsfromJaba(jabajobArgset); + jobArgset = jabajobArgset == null ? null + : JabaParamStore.getJwsArgsfromJaba(jabajobArgset); p = jabap; // (jabap != null) ? paramStore.getPreset(jabap.getName()) : // null; } @@ -716,7 +719,8 @@ public class WsJobParameters extends JPanel implements ItemListener, private void updateButtonDisplay() { - boolean _update = false, _create = false, _delete = false, _revert = false; + boolean _update = false, _create = false, _delete = false, + _revert = false; if (modifiedElements.size() > 0) { // set modified @@ -787,8 +791,8 @@ public class WsJobParameters extends JPanel implements ItemListener, boolean stn = settingDialog; boolean renamed = false; settingDialog = true; - String nm = (curSetName != null ? curSetName : (String) setName - .getSelectedItem()); + String nm = (curSetName != null ? curSetName + : (String) setName.getSelectedItem()); // check if the name is reserved - if it is, rename it. if (isServicePreset(nm)) { @@ -841,10 +845,10 @@ public class WsJobParameters extends JPanel implements ItemListener, FlowLayout fl = new FlowLayout(FlowLayout.LEFT); int sep = fl.getVgap(); boolean fh = true; - int os = 0, s = jobOptions.getBorder().getBorderInsets(jobOptions).bottom - + jobOptions.getBorder().getBorderInsets(jobOptions).top - + 2 - * sep; + int os = 0, + s = jobOptions.getBorder().getBorderInsets(jobOptions).bottom + + jobOptions.getBorder().getBorderInsets(jobOptions).top + + 2 * sep; /** * final height for viewport */ @@ -853,8 +857,7 @@ public class WsJobParameters extends JPanel implements ItemListener, - jobOptions.getBorder().getBorderInsets(jobOptions).left + jobOptions.getBorder().getBorderInsets(jobOptions).right; - int w = 2 - * fl.getHgap() + int w = 2 * fl.getHgap() + (MAX_OPTWIDTH > OptsAndParamsPage.PARAM_WIDTH ? MAX_OPTWIDTH : OptsAndParamsPage.PARAM_WIDTH); int hgap = fl.getHgap(), cw = hgap; @@ -1021,8 +1024,8 @@ public class WsJobParameters extends JPanel implements ItemListener, } { System.out.println("Testing opts dupes for " - + lastserv.getUri() + " : " - + lastserv.getActionText() + ":" + pr.getName()); + + lastserv.getUri() + " : " + lastserv.getActionText() + + ":" + pr.getName()); List