From 49685e6426d5ac136dce4907196751680c667670 Mon Sep 17 00:00:00 2001 From: jprocter Date: Wed, 27 Aug 2008 14:20:59 +0000 Subject: [PATCH] applied copyright 2008 --- src/MCview/AppletPDBCanvas.java | 10 +- src/MCview/AppletPDBViewer.java | 10 +- src/MCview/Atom.java | 10 +- src/MCview/Bond.java | 160 +- src/MCview/MCMatrix.java | 342 ++-- src/MCview/PDBCanvas.java | 10 +- src/MCview/PDBChain.java | 10 +- src/MCview/PDBViewer.java | 10 +- src/MCview/PDBfile.java | 10 +- src/MCview/Residue.java | 98 +- src/MCview/Zsort.java | 150 +- src/ext/vamsas/IRegistry.java | 23 +- src/ext/vamsas/IRegistryService.java | 23 +- src/ext/vamsas/IRegistryServiceLocator.java | 23 +- src/ext/vamsas/Jpred.java | 23 +- src/ext/vamsas/JpredService.java | 23 +- src/ext/vamsas/JpredServiceLocator.java | 23 +- src/ext/vamsas/JpredSoapBindingStub.java | 23 +- src/ext/vamsas/MuscleWS.java | 97 +- src/ext/vamsas/MuscleWSService.java | 87 +- src/ext/vamsas/MuscleWSServiceLocator.java | 427 ++--- src/ext/vamsas/MuscleWSSoapBindingStub.java | 951 +++++----- src/ext/vamsas/RegistryServiceSoapBindingStub.java | 23 +- src/ext/vamsas/SeqSearchI.java | 23 +- src/ext/vamsas/SeqSearchServiceLocator.java | 23 +- src/ext/vamsas/SeqSearchServiceService.java | 23 +- .../vamsas/SeqSearchServiceSoapBindingStub.java | 25 +- src/ext/vamsas/ServiceHandle.java | 23 +- src/ext/vamsas/ServiceHandles.java | 23 +- src/jalview/analysis/AAFrequency.java | 312 ++-- src/jalview/analysis/AlignSeq.java | 10 +- src/jalview/analysis/AlignmentSorter.java | 10 +- src/jalview/analysis/Conservation.java | 10 +- src/jalview/analysis/CrossRef.java | 20 +- src/jalview/analysis/Dna.java | 18 + src/jalview/analysis/Finder.java | 18 + src/jalview/analysis/NJTree.java | 10 +- src/jalview/analysis/PCA.java | 478 ++--- src/jalview/analysis/ParseProperties.java | 18 + src/jalview/analysis/SeqsetUtils.java | 10 +- src/jalview/analysis/SequenceIdMatcher.java | 492 +++--- src/jalview/appletgui/APopupMenu.java | 11 +- src/jalview/appletgui/AlignFrame.java | 11 +- src/jalview/appletgui/AlignViewport.java | 11 +- src/jalview/appletgui/AlignmentPanel.java | 11 +- src/jalview/appletgui/AnnotationColourChooser.java | 10 +- src/jalview/appletgui/AnnotationLabels.java | 11 +- src/jalview/appletgui/AnnotationPanel.java | 11 +- src/jalview/appletgui/AppletJmol.java | 11 +- src/jalview/appletgui/CutAndPasteTransfer.java | 557 +++--- src/jalview/appletgui/EditNameDialog.java | 167 +- src/jalview/appletgui/EmbmenuFrame.java | 20 +- src/jalview/appletgui/FeatureRenderer.java | 10 +- src/jalview/appletgui/FeatureSettings.java | 10 +- src/jalview/appletgui/Finder.java | 11 +- src/jalview/appletgui/FontChooser.java | 535 +++--- src/jalview/appletgui/IdCanvas.java | 11 +- src/jalview/appletgui/IdPanel.java | 11 +- src/jalview/appletgui/IdwidthAdjuster.java | 207 ++- src/jalview/appletgui/JVDialog.java | 157 +- src/jalview/appletgui/OverviewPanel.java | 897 +++++----- src/jalview/appletgui/PCAPanel.java | 11 +- src/jalview/appletgui/PaintRefresher.java | 456 ++--- src/jalview/appletgui/PairwiseAlignPanel.java | 11 +- src/jalview/appletgui/RedundancyPanel.java | 11 +- src/jalview/appletgui/RotatableCanvas.java | 1243 +++++++------ src/jalview/appletgui/ScalePanel.java | 905 +++++----- src/jalview/appletgui/SeqCanvas.java | 1649 +++++++++-------- src/jalview/appletgui/SeqPanel.java | 11 +- src/jalview/appletgui/SequenceRenderer.java | 665 ++++--- src/jalview/appletgui/SliderPanel.java | 725 ++++---- src/jalview/appletgui/Tooltip.java | 11 +- src/jalview/appletgui/TreeCanvas.java | 11 +- src/jalview/appletgui/TreePanel.java | 11 +- src/jalview/appletgui/UserDefinedColours.java | 1177 +++++++------ src/jalview/bin/Cache.java | 10 +- src/jalview/bin/Jalview.java | 10 +- src/jalview/bin/JalviewLite.java | 10 +- src/jalview/binding/Alignment.java | 21 +- src/jalview/binding/Annotation.java | 21 +- src/jalview/binding/AnnotationElement.java | 21 +- src/jalview/binding/Colour.java | 21 +- src/jalview/binding/Feature.java | 21 +- src/jalview/binding/FeatureSettings.java | 21 +- src/jalview/binding/Features.java | 21 +- src/jalview/binding/JGroup.java | 21 +- src/jalview/binding/JSeq.java | 21 +- src/jalview/binding/JalviewModel.java | 21 +- src/jalview/binding/JalviewModelSequence.java | 21 +- src/jalview/binding/JalviewUserColours.java | 21 +- src/jalview/binding/Pdbentry.java | 21 +- src/jalview/binding/PdbentryItem.java | 21 +- src/jalview/binding/Pdbids.java | 21 +- src/jalview/binding/Property.java | 21 +- src/jalview/binding/Sequence.java | 21 +- src/jalview/binding/SequenceSet.java | 21 +- src/jalview/binding/SequenceType.java | 21 +- src/jalview/binding/Setting.java | 21 +- src/jalview/binding/Tree.java | 21 +- src/jalview/binding/UserColourScheme.java | 21 +- src/jalview/binding/UserColours.java | 21 +- src/jalview/binding/VAMSAS.java | 21 +- src/jalview/binding/VamsasModel.java | 21 +- src/jalview/binding/Viewport.java | 21 +- src/jalview/commands/ChangeCaseCommand.java | 10 +- src/jalview/commands/CommandI.java | 10 +- src/jalview/commands/EditCommand.java | 10 +- src/jalview/commands/OrderCommand.java | 10 +- src/jalview/commands/RemoveGapColCommand.java | 18 + src/jalview/commands/RemoveGapsCommand.java | 18 + src/jalview/commands/SlideSequencesCommand.java | 36 +- src/jalview/commands/TrimRegionCommand.java | 10 +- src/jalview/datamodel/AlignedCodonFrame.java | 18 + src/jalview/datamodel/Alignment.java | 10 +- src/jalview/datamodel/AlignmentAnnotation.java | 10 +- src/jalview/datamodel/AlignmentI.java | 10 +- src/jalview/datamodel/AlignmentOrder.java | 632 +++---- src/jalview/datamodel/AlignmentView.java | 1020 +++++------ src/jalview/datamodel/Annotation.java | 10 +- src/jalview/datamodel/BinaryNode.java | 568 +++--- src/jalview/datamodel/BinarySequence.java | 10 +- src/jalview/datamodel/CigarArray.java | 10 +- src/jalview/datamodel/CigarBase.java | 10 +- src/jalview/datamodel/CigarCigar.java | 118 +- src/jalview/datamodel/CigarSimple.java | 86 +- src/jalview/datamodel/ColumnSelection.java | 10 +- src/jalview/datamodel/DBRefEntry.java | 10 +- src/jalview/datamodel/DBRefSource.java | 204 +-- src/jalview/datamodel/FeatureProperties.java | 18 + src/jalview/datamodel/GraphLine.java | 10 +- src/jalview/datamodel/HiddenSequences.java | 11 +- src/jalview/datamodel/Mapping.java | 18 + src/jalview/datamodel/PDBEntry.java | 10 +- src/jalview/datamodel/Provenance.java | 94 +- src/jalview/datamodel/ProvenanceEntry.java | 104 +- src/jalview/datamodel/SearchResults.java | 10 +- src/jalview/datamodel/SeqCigar.java | 10 +- src/jalview/datamodel/Sequence.java | 10 +- src/jalview/datamodel/SequenceFeature.java | 10 +- src/jalview/datamodel/SequenceGroup.java | 10 +- src/jalview/datamodel/SequenceI.java | 10 +- src/jalview/datamodel/SequenceNode.java | 10 +- src/jalview/datamodel/SequencePoint.java | 10 +- src/jalview/datamodel/UniprotEntry.java | 186 +- src/jalview/datamodel/UniprotFile.java | 72 +- src/jalview/datamodel/UniprotProteinName.java | 10 +- src/jalview/datamodel/UniprotSequence.java | 92 +- src/jalview/datamodel/xdb/embl/BasePosition.java | 18 + src/jalview/datamodel/xdb/embl/EmblEntry.java | 18 + src/jalview/datamodel/xdb/embl/EmblError.java | 18 + src/jalview/datamodel/xdb/embl/EmblFeature.java | 18 + .../datamodel/xdb/embl/EmblFeatureLocElement.java | 18 + .../datamodel/xdb/embl/EmblFeatureLocations.java | 20 +- src/jalview/datamodel/xdb/embl/EmblFile.java | 18 + src/jalview/datamodel/xdb/embl/EmblSequence.java | 18 + src/jalview/datamodel/xdb/embl/Qualifier.java | 18 + src/jalview/gui/AlignFrame.java | 12 +- src/jalview/gui/AlignViewport.java | 18 + src/jalview/gui/AlignmentPanel.java | 10 +- src/jalview/gui/AnnotationColourChooser.java | 1034 +++++------ src/jalview/gui/AnnotationExporter.java | 11 +- src/jalview/gui/AnnotationLabels.java | 10 +- src/jalview/gui/AnnotationPanel.java | 10 +- src/jalview/gui/AppJmol.java | 10 +- src/jalview/gui/CutAndPasteTransfer.java | 530 +++--- src/jalview/gui/DasSourceBrowser.java | 10 +- src/jalview/gui/Desktop.java | 10 +- src/jalview/gui/EPSOptions.java | 286 +-- src/jalview/gui/EditNameDialog.java | 165 +- src/jalview/gui/FeatureRenderer.java | 10 +- src/jalview/gui/FeatureSettings.java | 10 +- src/jalview/gui/Finder.java | 10 +- src/jalview/gui/FontChooser.java | 518 +++--- src/jalview/gui/IProgressIndicator.java | 20 +- src/jalview/gui/IdCanvas.java | 954 +++++----- src/jalview/gui/IdPanel.java | 10 +- src/jalview/gui/IdwidthAdjuster.java | 322 ++-- src/jalview/gui/Jalview2XML.java | 10 +- src/jalview/gui/Jalview2XML_V1.java | 10 +- src/jalview/gui/OverviewPanel.java | 894 +++++----- src/jalview/gui/PCAPanel.java | 10 +- src/jalview/gui/PaintRefresher.java | 486 ++--- src/jalview/gui/PairwiseAlignPanel.java | 10 +- src/jalview/gui/PopupMenu.java | 10 +- src/jalview/gui/Preferences.java | 10 +- src/jalview/gui/RedundancyPanel.java | 10 +- src/jalview/gui/RotatableCanvas.java | 1538 ++++++++-------- src/jalview/gui/ScalePanel.java | 10 +- src/jalview/gui/ScriptWindow.java | 1222 +++++++------ src/jalview/gui/SeqCanvas.java | 10 +- src/jalview/gui/SeqPanel.java | 10 +- src/jalview/gui/SequenceFetcher.java | 10 +- src/jalview/gui/SequenceRenderer.java | 868 ++++----- src/jalview/gui/SliderPanel.java | 718 ++++---- src/jalview/gui/SplashScreen.java | 10 +- src/jalview/gui/TextColourChooser.java | 425 +++-- src/jalview/gui/TreeCanvas.java | 10 +- src/jalview/gui/TreePanel.java | 10 +- src/jalview/gui/UserDefinedColours.java | 10 +- src/jalview/gui/UserQuestionnaireCheck.java | 18 + src/jalview/gui/VamsasApplication.java | 19 +- src/jalview/gui/WebserviceInfo.java | 10 +- src/jalview/io/AMSAFile.java | 200 +-- src/jalview/io/AlignFile.java | 10 +- src/jalview/io/AnnotationFile.java | 11 +- src/jalview/io/AppletFormatAdapter.java | 10 +- src/jalview/io/BLCFile.java | 10 +- src/jalview/io/ClansFile.java | 18 + src/jalview/io/ClustalFile.java | 10 +- src/jalview/io/DBRefFile.java | 18 + src/jalview/io/FastaFile.java | 10 +- src/jalview/io/FeaturesFile.java | 10 +- src/jalview/io/FileLoader.java | 11 +- src/jalview/io/FileParse.java | 10 +- src/jalview/io/FormatAdapter.java | 10 +- src/jalview/io/HTMLOutput.java | 778 ++++---- src/jalview/io/IdentifyFile.java | 10 +- src/jalview/io/JPredFile.java | 11 +- src/jalview/io/JalviewFileChooser.java | 11 +- src/jalview/io/JalviewFileFilter.java | 344 ++-- src/jalview/io/JalviewFileView.java | 222 +-- src/jalview/io/JnetAnnotationMaker.java | 15 +- src/jalview/io/MSFfile.java | 10 +- src/jalview/io/MatrixFile.java | 18 + src/jalview/io/ModellerDescription.java | 782 ++++---- src/jalview/io/NewickFile.java | 11 +- src/jalview/io/PIRFile.java | 10 +- src/jalview/io/PfamFile.java | 10 +- src/jalview/io/PileUpfile.java | 10 +- src/jalview/io/StockholmFile.java | 10 +- src/jalview/io/VamsasAppDatastore.java | 11 +- src/jalview/io/WSWUBlastClient.java | 606 +++---- src/jalview/io/vamsas/DatastoreItem.java | 18 + src/jalview/io/vamsas/Dbref.java | 18 + src/jalview/io/vamsas/LocalDocSyncObject.java | 18 + src/jalview/io/vamsas/Rangetype.java | 20 +- src/jalview/io/vamsas/Sequencemapping.java | 20 +- src/jalview/io/vamsas/Tree.java | 18 + src/jalview/jbgui/GAlignFrame.java | 10 +- src/jalview/jbgui/GAlignmentPanel.java | 216 +-- src/jalview/jbgui/GCutAndPasteTransfer.java | 424 ++--- src/jalview/jbgui/GDasSourceBrowser.java | 10 +- src/jalview/jbgui/GDesktop.java | 10 +- src/jalview/jbgui/GFinder.java | 10 +- src/jalview/jbgui/GFontChooser.java | 504 +++--- src/jalview/jbgui/GPCAPanel.java | 510 +++--- src/jalview/jbgui/GPairwiseAlignPanel.java | 180 +- src/jalview/jbgui/GPreferences.java | 1130 ++++++------ src/jalview/jbgui/GSequenceLink.java | 10 +- src/jalview/jbgui/GSliderPanel.java | 388 ++-- src/jalview/jbgui/GStructureViewer.java | 643 ++++--- src/jalview/jbgui/GTreePanel.java | 496 +++--- src/jalview/jbgui/GUserDefinedColours.java | 506 +++--- src/jalview/jbgui/GWebserviceInfo.java | 230 +-- src/jalview/math/Matrix.java | 1702 +++++++++--------- src/jalview/math/RotatableMatrix.java | 662 +++---- src/jalview/schemabinding/version2/AlcodMap.java | 21 +- src/jalview/schemabinding/version2/Alcodon.java | 21 +- .../schemabinding/version2/AlcodonFrame.java | 21 +- src/jalview/schemabinding/version2/Annotation.java | 21 +- .../schemabinding/version2/AnnotationColours.java | 21 +- .../schemabinding/version2/AnnotationElement.java | 21 +- src/jalview/schemabinding/version2/Colour.java | 21 +- src/jalview/schemabinding/version2/DBRef.java | 21 +- src/jalview/schemabinding/version2/Feature.java | 21 +- .../schemabinding/version2/FeatureSettings.java | 21 +- src/jalview/schemabinding/version2/Features.java | 21 +- src/jalview/schemabinding/version2/Group.java | 21 +- .../schemabinding/version2/HiddenColumns.java | 21 +- src/jalview/schemabinding/version2/JGroup.java | 21 +- src/jalview/schemabinding/version2/JSeq.java | 21 +- .../schemabinding/version2/JalviewModel.java | 21 +- .../version2/JalviewModelSequence.java | 21 +- .../schemabinding/version2/JalviewUserColours.java | 21 +- .../schemabinding/version2/MapListFrom.java | 21 +- src/jalview/schemabinding/version2/MapListTo.java | 21 +- .../schemabinding/version2/MapListType.java | 21 +- src/jalview/schemabinding/version2/Mapping.java | 21 +- .../schemabinding/version2/MappingChoice.java | 21 +- src/jalview/schemabinding/version2/OtherData.java | 21 +- src/jalview/schemabinding/version2/Pdbentry.java | 21 +- .../schemabinding/version2/PdbentryItem.java | 21 +- src/jalview/schemabinding/version2/Pdbids.java | 21 +- src/jalview/schemabinding/version2/Property.java | 21 +- src/jalview/schemabinding/version2/Sequence.java | 21 +- .../schemabinding/version2/SequenceSet.java | 21 +- .../version2/SequenceSetProperties.java | 21 +- .../schemabinding/version2/SequenceType.java | 21 +- src/jalview/schemabinding/version2/Setting.java | 21 +- .../schemabinding/version2/StructureState.java | 21 +- .../schemabinding/version2/ThresholdLine.java | 21 +- src/jalview/schemabinding/version2/Tree.java | 21 +- .../schemabinding/version2/UserColourScheme.java | 21 +- .../schemabinding/version2/UserColours.java | 21 +- src/jalview/schemabinding/version2/VAMSAS.java | 21 +- .../schemabinding/version2/VamsasModel.java | 21 +- src/jalview/schemabinding/version2/Viewport.java | 21 +- .../version2/descriptors/AlcodMapDescriptor.java | 21 +- .../version2/descriptors/AlcodonDescriptor.java | 21 +- .../descriptors/AlcodonFrameDescriptor.java | 21 +- .../descriptors/AnnotationColoursDescriptor.java | 21 +- .../version2/descriptors/AnnotationDescriptor.java | 21 +- .../descriptors/AnnotationElementDescriptor.java | 21 +- .../version2/descriptors/ColourDescriptor.java | 21 +- .../version2/descriptors/DBRefDescriptor.java | 21 +- .../version2/descriptors/FeatureDescriptor.java | 21 +- .../descriptors/FeatureSettingsDescriptor.java | 21 +- .../version2/descriptors/FeaturesDescriptor.java | 21 +- .../version2/descriptors/GroupDescriptor.java | 21 +- .../descriptors/HiddenColumnsDescriptor.java | 21 +- .../version2/descriptors/JGroupDescriptor.java | 21 +- .../version2/descriptors/JSeqDescriptor.java | 21 +- .../descriptors/JalviewModelDescriptor.java | 21 +- .../JalviewModelSequenceDescriptor.java | 21 +- .../descriptors/JalviewUserColoursDescriptor.java | 21 +- .../descriptors/MapListFromDescriptor.java | 21 +- .../version2/descriptors/MapListToDescriptor.java | 21 +- .../descriptors/MapListTypeDescriptor.java | 21 +- .../descriptors/MappingChoiceDescriptor.java | 21 +- .../version2/descriptors/MappingDescriptor.java | 21 +- .../version2/descriptors/OtherDataDescriptor.java | 21 +- .../version2/descriptors/PdbentryDescriptor.java | 21 +- .../descriptors/PdbentryItemDescriptor.java | 21 +- .../version2/descriptors/PdbidsDescriptor.java | 21 +- .../version2/descriptors/PropertyDescriptor.java | 21 +- .../version2/descriptors/SequenceDescriptor.java | 21 +- .../descriptors/SequenceSetDescriptor.java | 21 +- .../SequenceSetPropertiesDescriptor.java | 21 +- .../descriptors/SequenceTypeDescriptor.java | 21 +- .../version2/descriptors/SettingDescriptor.java | 21 +- .../descriptors/StructureStateDescriptor.java | 21 +- .../descriptors/ThresholdLineDescriptor.java | 21 +- .../version2/descriptors/TreeDescriptor.java | 21 +- .../descriptors/UserColourSchemeDescriptor.java | 21 +- .../descriptors/UserColoursDescriptor.java | 21 +- .../version2/descriptors/VAMSASDescriptor.java | 21 +- .../descriptors/VamsasModelDescriptor.java | 21 +- .../version2/descriptors/ViewportDescriptor.java | 21 +- src/jalview/schemes/AnnotationColourGradient.java | 460 ++--- src/jalview/schemes/Blosum62ColourScheme.java | 188 +- src/jalview/schemes/BuriedColourScheme.java | 104 +- src/jalview/schemes/ClustalxColourScheme.java | 10 +- src/jalview/schemes/ColourSchemeI.java | 86 +- src/jalview/schemes/ColourSchemeProperty.java | 10 +- src/jalview/schemes/Consensus.java | 10 +- src/jalview/schemes/HelixColourScheme.java | 72 +- src/jalview/schemes/HydrophobicColourScheme.java | 104 +- src/jalview/schemes/NucleotideColourScheme.java | 174 +- src/jalview/schemes/PIDColourScheme.java | 188 +- src/jalview/schemes/ResidueColourScheme.java | 542 +++--- src/jalview/schemes/ResidueProperties.java | 10 +- src/jalview/schemes/ScoreColourScheme.java | 242 +-- src/jalview/schemes/ScoreMatrix.java | 18 + src/jalview/schemes/StrandColourScheme.java | 104 +- src/jalview/schemes/TaylorColourScheme.java | 56 +- src/jalview/schemes/TurnColourScheme.java | 104 +- src/jalview/schemes/UserColourScheme.java | 10 +- src/jalview/schemes/ZappoColourScheme.java | 10 +- src/jalview/structure/SequenceListener.java | 10 +- src/jalview/structure/StructureListener.java | 64 +- src/jalview/structure/StructureMapping.java | 199 ++- .../structure/StructureSelectionManager.java | 10 +- src/jalview/structure/VamsasListener.java | 18 + src/jalview/util/BrowserLauncher.java | 1862 ++++++++++---------- src/jalview/util/Comparison.java | 452 ++--- src/jalview/util/DBRefUtils.java | 10 +- src/jalview/util/Format.java | 1731 +++++++++--------- src/jalview/util/ImageMaker.java | 380 ++-- src/jalview/util/MapList.java | 10 +- src/jalview/util/Platform.java | 18 + src/jalview/util/QuickSort.java | 10 +- src/jalview/util/ShiftList.java | 10 +- src/jalview/util/TableSorter.java | 10 +- src/jalview/util/UrlLink.java | 18 + src/jalview/ws/DBRefFetcher.java | 10 +- src/jalview/ws/DasSequenceFeatureFetcher.java | 10 +- src/jalview/ws/Discoverer.java | 10 +- src/jalview/ws/JPredClient.java | 10 +- src/jalview/ws/JPredThread.java | 18 + src/jalview/ws/MsaWSClient.java | 10 +- src/jalview/ws/MsaWSThread.java | 1442 +++++++-------- src/jalview/ws/SeqSearchWSClient.java | 588 +++---- src/jalview/ws/SeqSearchWSThread.java | 1334 +++++++------- src/jalview/ws/SequenceFetcher.java | 18 + src/jalview/ws/WSClient.java | 10 +- src/jalview/ws/WSClientI.java | 10 +- src/jalview/ws/WSThread.java | 898 +++++----- src/jalview/ws/dbsources/DasSequenceSource.java | 18 + .../ws/dbsources/EbiFileRetrievedProxy.java | 18 + src/jalview/ws/dbsources/EmblCdsSouce.java | 18 + src/jalview/ws/dbsources/EmblSource.java | 17 +- src/jalview/ws/dbsources/EmblXmlSource.java | 20 +- src/jalview/ws/dbsources/GeneDbSource.java | 17 +- src/jalview/ws/dbsources/Pdb.java | 17 +- src/jalview/ws/dbsources/Pfam.java | 17 +- src/jalview/ws/dbsources/PfamFull.java | 17 +- src/jalview/ws/dbsources/PfamSeed.java | 17 +- src/jalview/ws/dbsources/Uniprot.java | 17 +- src/jalview/ws/dbsources/UnprotName.java | 18 + .../dbsources/das/DasSequenceSourceListener.java | 18 + src/jalview/ws/ebi/EBIFetchClient.java | 470 ++--- src/jalview/ws/seqfetcher/ASequenceFetcher.java | 20 +- src/jalview/ws/seqfetcher/DbSourceProxy.java | 18 + src/jalview/ws/seqfetcher/DbSourceProxyImpl.java | 18 + src/vamsas/IMsaWS.java | 11 +- src/vamsas/objects/simple/Alignment.java | 23 +- src/vamsas/objects/simple/Alignment_Helper.java | 23 +- src/vamsas/objects/simple/JpredResult.java | 23 +- src/vamsas/objects/simple/JpredResult_Helper.java | 23 +- src/vamsas/objects/simple/MsaResult.java | 249 +-- src/vamsas/objects/simple/MsaResult_Helper.java | 167 +- src/vamsas/objects/simple/Msfalignment.java | 23 +- src/vamsas/objects/simple/Msfalignment_Helper.java | 23 +- src/vamsas/objects/simple/Object.java | 23 +- src/vamsas/objects/simple/Object_Helper.java | 23 +- src/vamsas/objects/simple/Result.java | 23 +- src/vamsas/objects/simple/Result_Helper.java | 23 +- src/vamsas/objects/simple/Secstructpred.java | 23 +- .../objects/simple/Secstructpred_Helper.java | 23 +- src/vamsas/objects/simple/SeqSearchResult.java | 23 +- .../objects/simple/SeqSearchResult_Helper.java | 23 +- src/vamsas/objects/simple/Sequence.java | 23 +- src/vamsas/objects/simple/SequenceSet.java | 23 +- src/vamsas/objects/simple/SequenceSet_Helper.java | 23 +- src/vamsas/objects/simple/Sequence_Helper.java | 23 +- src/vamsas/objects/simple/WsJobId.java | 23 +- src/vamsas/objects/simple/WsJobId_Helper.java | 23 +- utils/help2Website.java | 208 ++- 428 files changed, 28531 insertions(+), 25993 deletions(-) diff --git a/src/MCview/AppletPDBCanvas.java b/src/MCview/AppletPDBCanvas.java index 73ed7a7..d0c7da8 100755 --- a/src/MCview/AppletPDBCanvas.java +++ b/src/MCview/AppletPDBCanvas.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/MCview/AppletPDBViewer.java b/src/MCview/AppletPDBViewer.java index fc8478d..9bcf5c7 100755 --- a/src/MCview/AppletPDBViewer.java +++ b/src/MCview/AppletPDBViewer.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/MCview/Atom.java b/src/MCview/Atom.java index e22b94e..e88c34a 100755 --- a/src/MCview/Atom.java +++ b/src/MCview/Atom.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/MCview/Bond.java b/src/MCview/Bond.java index 8e95c1b..8a67036 100755 --- a/src/MCview/Bond.java +++ b/src/MCview/Bond.java @@ -1,80 +1,80 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package MCview; - -import java.awt.*; - -public class Bond -{ - float[] start; - float[] end; - Color startCol = Color.lightGray; - Color endCol = Color.lightGray; - public Atom at1; - public Atom at2; - - public Bond(float[] start, float[] end, Atom at1, Atom at2) - { - this.start = start; - this.end = end; - this.startCol = at1.color; - this.endCol = at2.color; - this.at1 = at1; - this.at2 = at2; - } - - /* public Bond(Bond bond) { - this.start = new float[3]; - - this.start[0] = bond.start[0]; - this.start[1] = bond.start[1]; - this.start[2] = bond.start[2]; - - this.end = new float[3]; - - this.end[0] = bond.end[0]; - this.end[1] = bond.end[1]; - this.end[2] = bond.end[2]; - - this.startCol = bond.startCol; - this.endCol = bond.endCol; - } - - public float length() { - float len = ((end[0] - start[0]) * (end[0] - start[0])) + - ((end[1] - start[1]) * (end[1] - start[1])) + - ((end[2] - start[2]) * (end[2] - start[2])); - - len = (float) (Math.sqrt(len)); - - return len; - }*/ - - public void translate(float x, float y, float z) - { - start[0] = (start[0] + x); - end[0] = (end[0] + x); - - start[1] = (start[1] + y); - end[1] = (end[1] + y); - - start[2] = (start[2] + z); - end[2] = (end[2] + z); - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package MCview; + +import java.awt.*; + +public class Bond +{ + float[] start; + float[] end; + Color startCol = Color.lightGray; + Color endCol = Color.lightGray; + public Atom at1; + public Atom at2; + + public Bond(float[] start, float[] end, Atom at1, Atom at2) + { + this.start = start; + this.end = end; + this.startCol = at1.color; + this.endCol = at2.color; + this.at1 = at1; + this.at2 = at2; + } + + /* public Bond(Bond bond) { + this.start = new float[3]; + + this.start[0] = bond.start[0]; + this.start[1] = bond.start[1]; + this.start[2] = bond.start[2]; + + this.end = new float[3]; + + this.end[0] = bond.end[0]; + this.end[1] = bond.end[1]; + this.end[2] = bond.end[2]; + + this.startCol = bond.startCol; + this.endCol = bond.endCol; + } + + public float length() { + float len = ((end[0] - start[0]) * (end[0] - start[0])) + + ((end[1] - start[1]) * (end[1] - start[1])) + + ((end[2] - start[2]) * (end[2] - start[2])); + + len = (float) (Math.sqrt(len)); + + return len; + }*/ + + public void translate(float x, float y, float z) + { + start[0] = (start[0] + x); + end[0] = (end[0] + x); + + start[1] = (start[1] + y); + end[1] = (end[1] + y); + + start[2] = (start[2] + z); + end[2] = (end[2] + z); + } +} diff --git a/src/MCview/MCMatrix.java b/src/MCview/MCMatrix.java index 9eba886..64424ee 100755 --- a/src/MCview/MCMatrix.java +++ b/src/MCview/MCMatrix.java @@ -1,171 +1,171 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package MCview; - -public class MCMatrix -{ - float[][] matrix; - float[][] tmp; - float mycos; - float mysin; - float myconst = (float) (Math.PI / 180); - - public MCMatrix(int rows, int cols) - { - matrix = new float[rows][cols]; - tmp = new float[rows][cols]; - } - - public void addElement(int i, int j, float value) - { - matrix[i][j] = value; - } - - public void rotatex(float degrees) - { - mycos = (float) (Math.cos(degrees * myconst)); - mysin = (float) (Math.sin(degrees * myconst)); - - tmp[0][0] = 1; - tmp[0][1] = 0; - tmp[0][2] = 0; - tmp[1][0] = 0; - tmp[1][1] = mycos; - tmp[1][2] = mysin; - tmp[2][0] = 0; - tmp[2][1] = -mysin; - tmp[2][2] = mycos; - preMultiply(tmp); - } - - public void rotatez(float degrees) - { - mycos = (float) (Math.cos(degrees * myconst)); - mysin = (float) (Math.sin(degrees * myconst)); - - tmp[0][0] = mycos; - tmp[0][1] = -mysin; - tmp[0][2] = 0; - tmp[1][0] = mysin; - tmp[1][1] = mycos; - tmp[1][2] = 0; - tmp[2][0] = 0; - tmp[2][1] = 0; - tmp[2][2] = 1; - - preMultiply(tmp); - } - - public void rotatey(float degrees) - { - mycos = (float) (Math.cos(degrees * myconst)); - mysin = (float) (Math.sin(degrees * myconst)); - - tmp[0][0] = mycos; - tmp[0][1] = 0; - tmp[0][2] = -mysin; - tmp[1][0] = 0; - tmp[1][1] = 1; - tmp[1][2] = 0; - tmp[2][0] = mysin; - tmp[2][1] = 0; - tmp[2][2] = mycos; - - preMultiply(tmp); - } - - public float[] vectorMultiply(float[] vect) - { - float[] temp = new float[3]; - - temp[0] = vect[0]; - temp[1] = vect[1]; - temp[2] = vect[2]; - - for (int i = 0; i < 3; i++) - { - temp[i] = ( (float) matrix[i][0] * vect[0]) + - ( (float) matrix[i][1] * vect[1]) + - ( (float) matrix[i][2] * vect[2]); - } - - vect[0] = temp[0]; - vect[1] = temp[1]; - vect[2] = temp[2]; - - return vect; - } - - public void preMultiply(float[][] mat) - { - float[][] tmp = new float[3][3]; - - for (int i = 0; i < 3; i++) - { - for (int j = 0; j < 3; j++) - { - tmp[i][j] = (mat[i][0] * matrix[0][j]) + - (mat[i][1] * matrix[1][j]) + (mat[i][2] * matrix[2][j]); - } - } - - for (int i = 0; i < 3; i++) - { - for (int j = 0; j < 3; j++) - { - matrix[i][j] = tmp[i][j]; - } - } - } - - public void postMultiply(float[][] mat) - { - float[][] tmp = new float[3][3]; - - for (int i = 0; i < 3; i++) - { - for (int j = 0; j < 3; j++) - { - tmp[i][j] = (matrix[i][0] * mat[0][j]) + - (matrix[i][1] * mat[1][j]) + (matrix[i][2] * mat[2][j]); - } - } - - for (int i = 0; i < 3; i++) - { - for (int j = 0; j < 3; j++) - { - matrix[i][j] = tmp[i][j]; - } - } - } - - public void setIdentity() - { - matrix[0][0] = 1; - matrix[1][1] = 1; - matrix[2][2] = 1; - matrix[0][1] = 0; - matrix[0][2] = 0; - matrix[1][0] = 0; - matrix[1][2] = 0; - matrix[2][0] = 0; - matrix[2][1] = 0; - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package MCview; + +public class MCMatrix +{ + float[][] matrix; + float[][] tmp; + float mycos; + float mysin; + float myconst = (float) (Math.PI / 180); + + public MCMatrix(int rows, int cols) + { + matrix = new float[rows][cols]; + tmp = new float[rows][cols]; + } + + public void addElement(int i, int j, float value) + { + matrix[i][j] = value; + } + + public void rotatex(float degrees) + { + mycos = (float) (Math.cos(degrees * myconst)); + mysin = (float) (Math.sin(degrees * myconst)); + + tmp[0][0] = 1; + tmp[0][1] = 0; + tmp[0][2] = 0; + tmp[1][0] = 0; + tmp[1][1] = mycos; + tmp[1][2] = mysin; + tmp[2][0] = 0; + tmp[2][1] = -mysin; + tmp[2][2] = mycos; + preMultiply(tmp); + } + + public void rotatez(float degrees) + { + mycos = (float) (Math.cos(degrees * myconst)); + mysin = (float) (Math.sin(degrees * myconst)); + + tmp[0][0] = mycos; + tmp[0][1] = -mysin; + tmp[0][2] = 0; + tmp[1][0] = mysin; + tmp[1][1] = mycos; + tmp[1][2] = 0; + tmp[2][0] = 0; + tmp[2][1] = 0; + tmp[2][2] = 1; + + preMultiply(tmp); + } + + public void rotatey(float degrees) + { + mycos = (float) (Math.cos(degrees * myconst)); + mysin = (float) (Math.sin(degrees * myconst)); + + tmp[0][0] = mycos; + tmp[0][1] = 0; + tmp[0][2] = -mysin; + tmp[1][0] = 0; + tmp[1][1] = 1; + tmp[1][2] = 0; + tmp[2][0] = mysin; + tmp[2][1] = 0; + tmp[2][2] = mycos; + + preMultiply(tmp); + } + + public float[] vectorMultiply(float[] vect) + { + float[] temp = new float[3]; + + temp[0] = vect[0]; + temp[1] = vect[1]; + temp[2] = vect[2]; + + for (int i = 0; i < 3; i++) + { + temp[i] = ( (float) matrix[i][0] * vect[0]) + + ( (float) matrix[i][1] * vect[1]) + + ( (float) matrix[i][2] * vect[2]); + } + + vect[0] = temp[0]; + vect[1] = temp[1]; + vect[2] = temp[2]; + + return vect; + } + + public void preMultiply(float[][] mat) + { + float[][] tmp = new float[3][3]; + + for (int i = 0; i < 3; i++) + { + for (int j = 0; j < 3; j++) + { + tmp[i][j] = (mat[i][0] * matrix[0][j]) + + (mat[i][1] * matrix[1][j]) + (mat[i][2] * matrix[2][j]); + } + } + + for (int i = 0; i < 3; i++) + { + for (int j = 0; j < 3; j++) + { + matrix[i][j] = tmp[i][j]; + } + } + } + + public void postMultiply(float[][] mat) + { + float[][] tmp = new float[3][3]; + + for (int i = 0; i < 3; i++) + { + for (int j = 0; j < 3; j++) + { + tmp[i][j] = (matrix[i][0] * mat[0][j]) + + (matrix[i][1] * mat[1][j]) + (matrix[i][2] * mat[2][j]); + } + } + + for (int i = 0; i < 3; i++) + { + for (int j = 0; j < 3; j++) + { + matrix[i][j] = tmp[i][j]; + } + } + } + + public void setIdentity() + { + matrix[0][0] = 1; + matrix[1][1] = 1; + matrix[2][2] = 1; + matrix[0][1] = 0; + matrix[0][2] = 0; + matrix[1][0] = 0; + matrix[1][2] = 0; + matrix[2][0] = 0; + matrix[2][1] = 0; + } +} diff --git a/src/MCview/PDBCanvas.java b/src/MCview/PDBCanvas.java index 79871e8..0d807e3 100755 --- a/src/MCview/PDBCanvas.java +++ b/src/MCview/PDBCanvas.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/MCview/PDBChain.java b/src/MCview/PDBChain.java index 30712f2..8dea416 100755 --- a/src/MCview/PDBChain.java +++ b/src/MCview/PDBChain.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/MCview/PDBViewer.java b/src/MCview/PDBViewer.java index e586707..bbb5724 100755 --- a/src/MCview/PDBViewer.java +++ b/src/MCview/PDBViewer.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/MCview/PDBfile.java b/src/MCview/PDBfile.java index e5ad565..83c346e 100755 --- a/src/MCview/PDBfile.java +++ b/src/MCview/PDBfile.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/MCview/Residue.java b/src/MCview/Residue.java index e99c746..e951737 100755 --- a/src/MCview/Residue.java +++ b/src/MCview/Residue.java @@ -1,49 +1,49 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package MCview; - -import java.util.*; - -public class Residue -{ - Vector atoms = new Vector(); - int number; - int count; - int seqnumber; - - public Residue(Vector atoms, int number, int count) - { - this.atoms = atoms; - this.number = number; - this.count = count; - } - - public Atom findAtom(String name) - { - for (int i = 0; i < atoms.size(); i++) - { - if ( ( (Atom) atoms.elementAt(i)).name.equals(name)) - { - return (Atom) atoms.elementAt(i); - } - } - - return null; - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package MCview; + +import java.util.*; + +public class Residue +{ + Vector atoms = new Vector(); + int number; + int count; + int seqnumber; + + public Residue(Vector atoms, int number, int count) + { + this.atoms = atoms; + this.number = number; + this.count = count; + } + + public Atom findAtom(String name) + { + for (int i = 0; i < atoms.size(); i++) + { + if ( ( (Atom) atoms.elementAt(i)).name.equals(name)) + { + return (Atom) atoms.elementAt(i); + } + } + + return null; + } +} diff --git a/src/MCview/Zsort.java b/src/MCview/Zsort.java index f7f2c39..59f0bfc 100755 --- a/src/MCview/Zsort.java +++ b/src/MCview/Zsort.java @@ -1,75 +1,75 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package MCview; - -import java.util.*; - -public class Zsort -{ - public void Zsort(Vector bonds) - { - sort(bonds, 0, bonds.size() - 1); - } - - public void sort(Vector bonds, int p, int r) - { - int q; - - if (p < r) - { - q = partition(bonds, p, r); - sort(bonds, p, q); - sort(bonds, q + 1, r); - } - } - - private int partition(Vector bonds, int p, int r) - { - float x = ( (Bond) bonds.elementAt(p)).start[2]; - int i = p - 1; - int j = r + 1; - Bond tmp; - while (true) - { - do - { - j--; - } - while ( (j >= 0) && ( ( (Bond) bonds.elementAt(j)).start[2] > x)); - - do - { - i++; - } - while ( (i < bonds.size()) && - ( ( (Bond) bonds.elementAt(i)).start[2] < x)); - - if (i < j) - { - tmp = (Bond) bonds.elementAt(i); - bonds.setElementAt(bonds.elementAt(j), i); - bonds.setElementAt(tmp, j); - } - else - { - return j; - } - } - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package MCview; + +import java.util.*; + +public class Zsort +{ + public void Zsort(Vector bonds) + { + sort(bonds, 0, bonds.size() - 1); + } + + public void sort(Vector bonds, int p, int r) + { + int q; + + if (p < r) + { + q = partition(bonds, p, r); + sort(bonds, p, q); + sort(bonds, q + 1, r); + } + } + + private int partition(Vector bonds, int p, int r) + { + float x = ( (Bond) bonds.elementAt(p)).start[2]; + int i = p - 1; + int j = r + 1; + Bond tmp; + while (true) + { + do + { + j--; + } + while ( (j >= 0) && ( ( (Bond) bonds.elementAt(j)).start[2] > x)); + + do + { + i++; + } + while ( (i < bonds.size()) && + ( ( (Bond) bonds.elementAt(i)).start[2] < x)); + + if (i < j) + { + tmp = (Bond) bonds.elementAt(i); + bonds.setElementAt(bonds.elementAt(j), i); + bonds.setElementAt(tmp, j); + } + else + { + return j; + } + } + } +} diff --git a/src/ext/vamsas/IRegistry.java b/src/ext/vamsas/IRegistry.java index 9300f59..dbe55b5 100755 --- a/src/ext/vamsas/IRegistry.java +++ b/src/ext/vamsas/IRegistry.java @@ -1,10 +1,21 @@ -/** - * IRegistry.java - * - * This file was auto-generated from WSDL - * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter. +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package ext.vamsas; public interface IRegistry diff --git a/src/ext/vamsas/IRegistryService.java b/src/ext/vamsas/IRegistryService.java index 2590314..d68a1b4 100755 --- a/src/ext/vamsas/IRegistryService.java +++ b/src/ext/vamsas/IRegistryService.java @@ -1,10 +1,21 @@ -/** - * IRegistryService.java - * - * This file was auto-generated from WSDL - * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter. +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package ext.vamsas; public interface IRegistryService diff --git a/src/ext/vamsas/IRegistryServiceLocator.java b/src/ext/vamsas/IRegistryServiceLocator.java index 0d7c0da..cb477f3 100755 --- a/src/ext/vamsas/IRegistryServiceLocator.java +++ b/src/ext/vamsas/IRegistryServiceLocator.java @@ -1,10 +1,21 @@ -/** - * IRegistryServiceLocator.java - * - * This file was auto-generated from WSDL - * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter. +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package ext.vamsas; public class IRegistryServiceLocator diff --git a/src/ext/vamsas/Jpred.java b/src/ext/vamsas/Jpred.java index c3ab28b..674040c 100755 --- a/src/ext/vamsas/Jpred.java +++ b/src/ext/vamsas/Jpred.java @@ -1,10 +1,21 @@ -/** - * Jpred.java - * - * This file was auto-generated from WSDL - * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter. +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package ext.vamsas; public interface Jpred diff --git a/src/ext/vamsas/JpredService.java b/src/ext/vamsas/JpredService.java index 8917d77..c910a60 100755 --- a/src/ext/vamsas/JpredService.java +++ b/src/ext/vamsas/JpredService.java @@ -1,10 +1,21 @@ -/** - * JpredService.java - * - * This file was auto-generated from WSDL - * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter. +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package ext.vamsas; public interface JpredService diff --git a/src/ext/vamsas/JpredServiceLocator.java b/src/ext/vamsas/JpredServiceLocator.java index 433fa70..ae2511e 100755 --- a/src/ext/vamsas/JpredServiceLocator.java +++ b/src/ext/vamsas/JpredServiceLocator.java @@ -1,10 +1,21 @@ -/** - * JpredServiceLocator.java - * - * This file was auto-generated from WSDL - * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter. +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package ext.vamsas; public class JpredServiceLocator diff --git a/src/ext/vamsas/JpredSoapBindingStub.java b/src/ext/vamsas/JpredSoapBindingStub.java index 4c8fc7f..235166d 100755 --- a/src/ext/vamsas/JpredSoapBindingStub.java +++ b/src/ext/vamsas/JpredSoapBindingStub.java @@ -1,10 +1,21 @@ -/** - * JpredSoapBindingStub.java - * - * This file was auto-generated from WSDL - * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter. +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package ext.vamsas; public class JpredSoapBindingStub diff --git a/src/ext/vamsas/MuscleWS.java b/src/ext/vamsas/MuscleWS.java index db1416e..e53770f 100755 --- a/src/ext/vamsas/MuscleWS.java +++ b/src/ext/vamsas/MuscleWS.java @@ -1,43 +1,54 @@ -/** - * MuscleWS.java - * - * This file was auto-generated from WSDL - * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter. - */ - -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package ext.vamsas; - -public interface MuscleWS - extends java.rmi.Remote -{ - public vamsas.objects.simple.WsJobId align( - vamsas.objects.simple.SequenceSet seqSet) - throws java.rmi.RemoteException; - - public vamsas.objects.simple.Alignment getalign(java.lang.String job_id) - throws java.rmi.RemoteException; - - public vamsas.objects.simple.MsaResult getResult(java.lang.String job_id) - throws java.rmi.RemoteException; - - public vamsas.objects.simple.WsJobId cancel(java.lang.String jobId) - throws java.rmi.RemoteException; -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +/* + * Jalview - A Sequence Alignment Editor and Viewer + * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package ext.vamsas; + +public interface MuscleWS + extends java.rmi.Remote +{ + public vamsas.objects.simple.WsJobId align( + vamsas.objects.simple.SequenceSet seqSet) + throws java.rmi.RemoteException; + + public vamsas.objects.simple.Alignment getalign(java.lang.String job_id) + throws java.rmi.RemoteException; + + public vamsas.objects.simple.MsaResult getResult(java.lang.String job_id) + throws java.rmi.RemoteException; + + public vamsas.objects.simple.WsJobId cancel(java.lang.String jobId) + throws java.rmi.RemoteException; +} diff --git a/src/ext/vamsas/MuscleWSService.java b/src/ext/vamsas/MuscleWSService.java index a4dc674..9531cda 100755 --- a/src/ext/vamsas/MuscleWSService.java +++ b/src/ext/vamsas/MuscleWSService.java @@ -1,38 +1,49 @@ -/** - * MuscleWSService.java - * - * This file was auto-generated from WSDL - * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter. - */ - -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package ext.vamsas; - -public interface MuscleWSService - extends javax.xml.rpc.Service -{ - public java.lang.String getMuscleWSAddress(); - - public ext.vamsas.MuscleWS getMuscleWS() - throws javax.xml.rpc.ServiceException; - - public ext.vamsas.MuscleWS getMuscleWS(java.net.URL portAddress) - throws javax.xml.rpc.ServiceException; -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +/* + * Jalview - A Sequence Alignment Editor and Viewer + * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package ext.vamsas; + +public interface MuscleWSService + extends javax.xml.rpc.Service +{ + public java.lang.String getMuscleWSAddress(); + + public ext.vamsas.MuscleWS getMuscleWS() + throws javax.xml.rpc.ServiceException; + + public ext.vamsas.MuscleWS getMuscleWS(java.net.URL portAddress) + throws javax.xml.rpc.ServiceException; +} diff --git a/src/ext/vamsas/MuscleWSServiceLocator.java b/src/ext/vamsas/MuscleWSServiceLocator.java index a269029..c822d92 100755 --- a/src/ext/vamsas/MuscleWSServiceLocator.java +++ b/src/ext/vamsas/MuscleWSServiceLocator.java @@ -1,208 +1,219 @@ -/** - * MuscleWSServiceLocator.java - * - * This file was auto-generated from WSDL - * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter. - */ - -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package ext.vamsas; - -public class MuscleWSServiceLocator - extends org.apache.axis.client.Service implements ext.vamsas. - MuscleWSService -{ - // Use to get a proxy class for MuscleWS - private java.lang.String MuscleWS_address = - "http://anaplog.compbio.dundee.ac.uk:8080/axis/services/MuscleWS"; - - // The WSDD service name defaults to the port name. - private java.lang.String MuscleWSWSDDServiceName = "MuscleWS"; - private java.util.HashSet ports = null; - - public MuscleWSServiceLocator() - { - } - - public MuscleWSServiceLocator(org.apache.axis.EngineConfiguration config) - { - super(config); - } - - public java.lang.String getMuscleWSAddress() - { - return MuscleWS_address; - } - - public java.lang.String getMuscleWSWSDDServiceName() - { - return MuscleWSWSDDServiceName; - } - - public void setMuscleWSWSDDServiceName(java.lang.String name) - { - MuscleWSWSDDServiceName = name; - } - - public ext.vamsas.MuscleWS getMuscleWS() - throws javax.xml.rpc.ServiceException - { - java.net.URL endpoint; - - try - { - endpoint = new java.net.URL(MuscleWS_address); - } - catch (java.net.MalformedURLException e) - { - throw new javax.xml.rpc.ServiceException(e); - } - - return getMuscleWS(endpoint); - } - - public ext.vamsas.MuscleWS getMuscleWS(java.net.URL portAddress) - throws javax.xml.rpc.ServiceException - { - try - { - ext.vamsas.MuscleWSSoapBindingStub _stub = new ext.vamsas. - MuscleWSSoapBindingStub(portAddress, - this); - _stub.setPortName(getMuscleWSWSDDServiceName()); - - return _stub; - } - catch (org.apache.axis.AxisFault e) - { - return null; - } - } - - public void setMuscleWSEndpointAddress(java.lang.String address) - { - MuscleWS_address = address; - } - - /** - * For the given interface, get the stub implementation. - * If this service has no port for the given interface, - * then ServiceException is thrown. - */ - public java.rmi.Remote getPort(Class serviceEndpointInterface) - throws javax.xml.rpc.ServiceException - { - try - { - if (ext.vamsas.MuscleWS.class.isAssignableFrom( - serviceEndpointInterface)) - { - ext.vamsas.MuscleWSSoapBindingStub _stub = new ext.vamsas. - MuscleWSSoapBindingStub(new java.net.URL( - MuscleWS_address), this); - _stub.setPortName(getMuscleWSWSDDServiceName()); - - return _stub; - } - } - catch (java.lang.Throwable t) - { - throw new javax.xml.rpc.ServiceException(t); - } - - throw new javax.xml.rpc.ServiceException( - "There is no stub implementation for the interface: " + - ( (serviceEndpointInterface == null) ? "null" - : serviceEndpointInterface.getName())); - } - - /** - * For the given interface, get the stub implementation. - * If this service has no port for the given interface, - * then ServiceException is thrown. - */ - public java.rmi.Remote getPort(javax.xml.namespace.QName portName, - Class serviceEndpointInterface) - throws javax.xml.rpc.ServiceException - { - if (portName == null) - { - return getPort(serviceEndpointInterface); - } - - java.lang.String inputPortName = portName.getLocalPart(); - - if ("MuscleWS".equals(inputPortName)) - { - return getMuscleWS(); - } - else - { - java.rmi.Remote _stub = getPort(serviceEndpointInterface); - ( (org.apache.axis.client.Stub) _stub).setPortName(portName); - - return _stub; - } - } - - public javax.xml.namespace.QName getServiceName() - { - return new javax.xml.namespace.QName("vamsas", "MuscleWSService"); - } - - public java.util.Iterator getPorts() - { - if (ports == null) - { - ports = new java.util.HashSet(); - ports.add(new javax.xml.namespace.QName("vamsas", "MuscleWS")); - } - - return ports.iterator(); - } - - /** - * Set the endpoint address for the specified port name. - */ - public void setEndpointAddress(java.lang.String portName, - java.lang.String address) - throws javax.xml.rpc.ServiceException - { - if ("MuscleWS".equals(portName)) - { - setMuscleWSEndpointAddress(address); - } - else - { // Unknown Port Name - throw new javax.xml.rpc.ServiceException( - " Cannot set Endpoint Address for Unknown Port" + portName); - } - } - - /** - * Set the endpoint address for the specified port name. - */ - public void setEndpointAddress(javax.xml.namespace.QName portName, - java.lang.String address) - throws javax.xml.rpc.ServiceException - { - setEndpointAddress(portName.getLocalPart(), address); - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +/* + * Jalview - A Sequence Alignment Editor and Viewer + * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package ext.vamsas; + +public class MuscleWSServiceLocator + extends org.apache.axis.client.Service implements ext.vamsas. + MuscleWSService +{ + // Use to get a proxy class for MuscleWS + private java.lang.String MuscleWS_address = + "http://anaplog.compbio.dundee.ac.uk:8080/axis/services/MuscleWS"; + + // The WSDD service name defaults to the port name. + private java.lang.String MuscleWSWSDDServiceName = "MuscleWS"; + private java.util.HashSet ports = null; + + public MuscleWSServiceLocator() + { + } + + public MuscleWSServiceLocator(org.apache.axis.EngineConfiguration config) + { + super(config); + } + + public java.lang.String getMuscleWSAddress() + { + return MuscleWS_address; + } + + public java.lang.String getMuscleWSWSDDServiceName() + { + return MuscleWSWSDDServiceName; + } + + public void setMuscleWSWSDDServiceName(java.lang.String name) + { + MuscleWSWSDDServiceName = name; + } + + public ext.vamsas.MuscleWS getMuscleWS() + throws javax.xml.rpc.ServiceException + { + java.net.URL endpoint; + + try + { + endpoint = new java.net.URL(MuscleWS_address); + } + catch (java.net.MalformedURLException e) + { + throw new javax.xml.rpc.ServiceException(e); + } + + return getMuscleWS(endpoint); + } + + public ext.vamsas.MuscleWS getMuscleWS(java.net.URL portAddress) + throws javax.xml.rpc.ServiceException + { + try + { + ext.vamsas.MuscleWSSoapBindingStub _stub = new ext.vamsas. + MuscleWSSoapBindingStub(portAddress, + this); + _stub.setPortName(getMuscleWSWSDDServiceName()); + + return _stub; + } + catch (org.apache.axis.AxisFault e) + { + return null; + } + } + + public void setMuscleWSEndpointAddress(java.lang.String address) + { + MuscleWS_address = address; + } + + /** + * For the given interface, get the stub implementation. + * If this service has no port for the given interface, + * then ServiceException is thrown. + */ + public java.rmi.Remote getPort(Class serviceEndpointInterface) + throws javax.xml.rpc.ServiceException + { + try + { + if (ext.vamsas.MuscleWS.class.isAssignableFrom( + serviceEndpointInterface)) + { + ext.vamsas.MuscleWSSoapBindingStub _stub = new ext.vamsas. + MuscleWSSoapBindingStub(new java.net.URL( + MuscleWS_address), this); + _stub.setPortName(getMuscleWSWSDDServiceName()); + + return _stub; + } + } + catch (java.lang.Throwable t) + { + throw new javax.xml.rpc.ServiceException(t); + } + + throw new javax.xml.rpc.ServiceException( + "There is no stub implementation for the interface: " + + ( (serviceEndpointInterface == null) ? "null" + : serviceEndpointInterface.getName())); + } + + /** + * For the given interface, get the stub implementation. + * If this service has no port for the given interface, + * then ServiceException is thrown. + */ + public java.rmi.Remote getPort(javax.xml.namespace.QName portName, + Class serviceEndpointInterface) + throws javax.xml.rpc.ServiceException + { + if (portName == null) + { + return getPort(serviceEndpointInterface); + } + + java.lang.String inputPortName = portName.getLocalPart(); + + if ("MuscleWS".equals(inputPortName)) + { + return getMuscleWS(); + } + else + { + java.rmi.Remote _stub = getPort(serviceEndpointInterface); + ( (org.apache.axis.client.Stub) _stub).setPortName(portName); + + return _stub; + } + } + + public javax.xml.namespace.QName getServiceName() + { + return new javax.xml.namespace.QName("vamsas", "MuscleWSService"); + } + + public java.util.Iterator getPorts() + { + if (ports == null) + { + ports = new java.util.HashSet(); + ports.add(new javax.xml.namespace.QName("vamsas", "MuscleWS")); + } + + return ports.iterator(); + } + + /** + * Set the endpoint address for the specified port name. + */ + public void setEndpointAddress(java.lang.String portName, + java.lang.String address) + throws javax.xml.rpc.ServiceException + { + if ("MuscleWS".equals(portName)) + { + setMuscleWSEndpointAddress(address); + } + else + { // Unknown Port Name + throw new javax.xml.rpc.ServiceException( + " Cannot set Endpoint Address for Unknown Port" + portName); + } + } + + /** + * Set the endpoint address for the specified port name. + */ + public void setEndpointAddress(javax.xml.namespace.QName portName, + java.lang.String address) + throws javax.xml.rpc.ServiceException + { + setEndpointAddress(portName.getLocalPart(), address); + } +} diff --git a/src/ext/vamsas/MuscleWSSoapBindingStub.java b/src/ext/vamsas/MuscleWSSoapBindingStub.java index de80f9e..49e49cf 100755 --- a/src/ext/vamsas/MuscleWSSoapBindingStub.java +++ b/src/ext/vamsas/MuscleWSSoapBindingStub.java @@ -1,470 +1,481 @@ -/** - * MuscleWSSoapBindingStub.java - * - * This file was auto-generated from WSDL - * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter. - */ - -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package ext.vamsas; - -public class MuscleWSSoapBindingStub - extends org.apache.axis.client.Stub implements ext.vamsas.MuscleWS -{ - static org.apache.axis.description.OperationDesc[] _operations; - - static - { - _operations = new org.apache.axis.description.OperationDesc[4]; - _initOperationDesc1(); - } - - private java.util.Vector cachedSerClasses = new java.util.Vector(); - private java.util.Vector cachedSerQNames = new java.util.Vector(); - private java.util.Vector cachedSerFactories = new java.util.Vector(); - private java.util.Vector cachedDeserFactories = new java.util.Vector(); - - public MuscleWSSoapBindingStub() - throws org.apache.axis.AxisFault - { - this(null); - } - - public MuscleWSSoapBindingStub(java.net.URL endpointURL, - javax.xml.rpc.Service service) - throws org.apache.axis.AxisFault - { - this(service); - super.cachedEndpoint = endpointURL; - } - - public MuscleWSSoapBindingStub(javax.xml.rpc.Service service) - throws org.apache.axis.AxisFault - { - if (service == null) - { - super.service = new org.apache.axis.client.Service(); - } - else - { - super.service = service; - } - - java.lang.Class cls; - javax.xml.namespace.QName qName; - java.lang.Class beansf = org.apache.axis.encoding.ser.BeanSerializerFactory.class; - java.lang.Class beandf = org.apache.axis.encoding.ser. - BeanDeserializerFactory.class; - //java.lang.Class enumsf = org.apache.axis.encoding.ser.EnumSerializerFactory.class; - //java.lang.Class enumdf = org.apache.axis.encoding.ser.EnumDeserializerFactory.class; - java.lang.Class arraysf = org.apache.axis.encoding.ser. - ArraySerializerFactory.class; - java.lang.Class arraydf = org.apache.axis.encoding.ser. - ArrayDeserializerFactory.class; - //java.lang.Class simplesf = org.apache.axis.encoding.ser.SimpleSerializerFactory.class; - // java.lang.Class simpledf = org.apache.axis.encoding.ser.SimpleDeserializerFactory.class; - //java.lang.Class simplelistsf = org.apache.axis.encoding.ser.SimpleListSerializerFactory.class; - //java.lang.Class simplelistdf = org.apache.axis.encoding.ser.SimpleListDeserializerFactory.class; - qName = new javax.xml.namespace.QName("simple.objects.vamsas", - "Sequence"); - cachedSerQNames.add(qName); - cls = vamsas.objects.simple.Sequence.class; - cachedSerClasses.add(cls); - cachedSerFactories.add(beansf); - cachedDeserFactories.add(beandf); - - qName = new javax.xml.namespace.QName("vamsas", "ArrayOf_tns1_Sequence"); - cachedSerQNames.add(qName); - cls = vamsas.objects.simple.Sequence[].class; - cachedSerClasses.add(cls); - cachedSerFactories.add(arraysf); - cachedDeserFactories.add(arraydf); - - qName = new javax.xml.namespace.QName("simple.objects.vamsas", - "MsaResult"); - cachedSerQNames.add(qName); - cls = vamsas.objects.simple.MsaResult.class; - cachedSerClasses.add(cls); - cachedSerFactories.add(beansf); - cachedDeserFactories.add(beandf); - - qName = new javax.xml.namespace.QName("simple.objects.vamsas", - "SequenceSet"); - cachedSerQNames.add(qName); - cls = vamsas.objects.simple.SequenceSet.class; - cachedSerClasses.add(cls); - cachedSerFactories.add(beansf); - cachedDeserFactories.add(beandf); - - qName = new javax.xml.namespace.QName("http://simple.objects.vamsas", - "Object"); - cachedSerQNames.add(qName); - cls = vamsas.objects.simple.Object.class; - cachedSerClasses.add(cls); - cachedSerFactories.add(beansf); - cachedDeserFactories.add(beandf); - - qName = new javax.xml.namespace.QName("simple.objects.vamsas", - "Alignment"); - cachedSerQNames.add(qName); - cls = vamsas.objects.simple.Alignment.class; - cachedSerClasses.add(cls); - cachedSerFactories.add(beansf); - cachedDeserFactories.add(beandf); - - qName = new javax.xml.namespace.QName("simple.objects.vamsas", "WsJobId"); - cachedSerQNames.add(qName); - cls = vamsas.objects.simple.WsJobId.class; - cachedSerClasses.add(cls); - cachedSerFactories.add(beansf); - cachedDeserFactories.add(beandf); - - qName = new javax.xml.namespace.QName("vamsas", "ArrayOf_xsd_string"); - cachedSerQNames.add(qName); - cls = java.lang.String[].class; - cachedSerClasses.add(cls); - cachedSerFactories.add(arraysf); - cachedDeserFactories.add(arraydf); - - qName = new javax.xml.namespace.QName("simple.objects.vamsas", "Result"); - cachedSerQNames.add(qName); - cls = vamsas.objects.simple.Result.class; - cachedSerClasses.add(cls); - cachedSerFactories.add(beansf); - cachedDeserFactories.add(beandf); - } - - private static void _initOperationDesc1() - { - org.apache.axis.description.OperationDesc oper; - oper = new org.apache.axis.description.OperationDesc(); - oper.setName("align"); - oper.addParameter(new javax.xml.namespace.QName("", "seqSet"), - new javax.xml.namespace.QName("simple.objects.vamsas", - "SequenceSet"), - vamsas.objects.simple.SequenceSet.class, - org.apache.axis.description.ParameterDesc.IN, false, false); - oper.setReturnType(new javax.xml.namespace.QName( - "simple.objects.vamsas", "WsJobId")); - oper.setReturnClass(vamsas.objects.simple.WsJobId.class); - oper.setReturnQName(new javax.xml.namespace.QName("", "alignReturn")); - oper.setStyle(org.apache.axis.constants.Style.RPC); - oper.setUse(org.apache.axis.constants.Use.ENCODED); - _operations[0] = oper; - - oper = new org.apache.axis.description.OperationDesc(); - oper.setName("getalign"); - oper.addParameter(new javax.xml.namespace.QName("", "job_id"), - new javax.xml.namespace.QName( - "http://www.w3.org/2001/XMLSchema", - "string"), java.lang.String.class, - org.apache.axis.description.ParameterDesc.IN, false, false); - oper.setReturnType(new javax.xml.namespace.QName( - "simple.objects.vamsas", "Alignment")); - oper.setReturnClass(vamsas.objects.simple.Alignment.class); - oper.setReturnQName(new javax.xml.namespace.QName("", "getalignReturn")); - oper.setStyle(org.apache.axis.constants.Style.RPC); - oper.setUse(org.apache.axis.constants.Use.ENCODED); - _operations[1] = oper; - - oper = new org.apache.axis.description.OperationDesc(); - oper.setName("getResult"); - oper.addParameter(new javax.xml.namespace.QName("", "job_id"), - new javax.xml.namespace.QName( - "http://www.w3.org/2001/XMLSchema", - "string"), java.lang.String.class, - org.apache.axis.description.ParameterDesc.IN, false, false); - oper.setReturnType(new javax.xml.namespace.QName( - "simple.objects.vamsas", "MsaResult")); - oper.setReturnClass(vamsas.objects.simple.MsaResult.class); - oper.setReturnQName(new javax.xml.namespace.QName("", "getResultReturn")); - oper.setStyle(org.apache.axis.constants.Style.RPC); - oper.setUse(org.apache.axis.constants.Use.ENCODED); - _operations[2] = oper; - - oper = new org.apache.axis.description.OperationDesc(); - oper.setName("cancel"); - oper.addParameter(new javax.xml.namespace.QName("", "jobId"), - new javax.xml.namespace.QName( - "http://www.w3.org/2001/XMLSchema", - "string"), java.lang.String.class, - org.apache.axis.description.ParameterDesc.IN, false, false); - oper.setReturnType(new javax.xml.namespace.QName( - "simple.objects.vamsas", "WsJobId")); - oper.setReturnClass(vamsas.objects.simple.WsJobId.class); - oper.setReturnQName(new javax.xml.namespace.QName("", "cancelReturn")); - oper.setStyle(org.apache.axis.constants.Style.RPC); - oper.setUse(org.apache.axis.constants.Use.ENCODED); - _operations[3] = oper; - } - - protected org.apache.axis.client.Call createCall() - throws java.rmi.RemoteException - { - try - { - org.apache.axis.client.Call _call = (org.apache.axis.client.Call)super. - service.createCall(); - - if (super.maintainSessionSet) - { - _call.setMaintainSession(super.maintainSession); - } - - if (super.cachedUsername != null) - { - _call.setUsername(super.cachedUsername); - } - - if (super.cachedPassword != null) - { - _call.setPassword(super.cachedPassword); - } - - if (super.cachedEndpoint != null) - { - _call.setTargetEndpointAddress(super.cachedEndpoint); - } - - if (super.cachedTimeout != null) - { - _call.setTimeout(super.cachedTimeout); - } - - if (super.cachedPortName != null) - { - _call.setPortName(super.cachedPortName); - } - - java.util.Enumeration keys = super.cachedProperties.keys(); - - while (keys.hasMoreElements()) - { - java.lang.String key = (java.lang.String) keys.nextElement(); - _call.setProperty(key, super.cachedProperties.get(key)); - } - - // All the type mapping information is registered - // when the first call is made. - // The type mapping information is actually registered in - // the TypeMappingRegistry of the service, which - // is the reason why registration is only needed for the first call. - synchronized (this) - { - if (firstCall()) - { - // must set encoding style before registering serializers - _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants. - SOAP11_CONSTANTS); - _call.setEncodingStyle(org.apache.axis.Constants.URI_SOAP11_ENC); - - for (int i = 0; i < cachedSerFactories.size(); ++i) - { - java.lang.Class cls = (java.lang.Class) cachedSerClasses.get(i); - javax.xml.namespace.QName qName = (javax.xml.namespace.QName) - cachedSerQNames.get(i); - java.lang.Class sf = (java.lang.Class) cachedSerFactories.get(i); - java.lang.Class df = (java.lang.Class) cachedDeserFactories.get(i); - _call.registerTypeMapping(cls, qName, sf, df, false); - } - } - } - - return _call; - } - catch (java.lang.Throwable _t) - { - throw new org.apache.axis.AxisFault( - "Failure trying to get the Call object", - _t); - } - } - - public vamsas.objects.simple.WsJobId align( - vamsas.objects.simple.SequenceSet seqSet) - throws java.rmi.RemoteException - { - if (super.cachedEndpoint == null) - { - throw new org.apache.axis.NoEndPointException(); - } - - org.apache.axis.client.Call _call = createCall(); - _call.setOperation(_operations[0]); - _call.setUseSOAPAction(true); - _call.setSOAPActionURI(""); - _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS); - _call.setOperationName(new javax.xml.namespace.QName("vamsas", "align")); - - setRequestHeaders(_call); - setAttachments(_call); - - java.lang.Object _resp = _call.invoke(new java.lang.Object[] - {seqSet}); - - if (_resp instanceof java.rmi.RemoteException) - { - throw (java.rmi.RemoteException) _resp; - } - else - { - extractAttachments(_call); - - try - { - return (vamsas.objects.simple.WsJobId) _resp; - } - catch (java.lang.Exception _exception) - { - return (vamsas.objects.simple.WsJobId) org.apache.axis.utils.JavaUtils. - convert(_resp, - vamsas.objects.simple.WsJobId.class); - } - } - } - - public vamsas.objects.simple.Alignment getalign(java.lang.String job_id) - throws java.rmi.RemoteException - { - if (super.cachedEndpoint == null) - { - throw new org.apache.axis.NoEndPointException(); - } - - org.apache.axis.client.Call _call = createCall(); - _call.setOperation(_operations[1]); - _call.setUseSOAPAction(true); - _call.setSOAPActionURI(""); - _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS); - _call.setOperationName(new javax.xml.namespace.QName("vamsas", - "getalign")); - - setRequestHeaders(_call); - setAttachments(_call); - - java.lang.Object _resp = _call.invoke(new java.lang.Object[] - {job_id}); - - if (_resp instanceof java.rmi.RemoteException) - { - throw (java.rmi.RemoteException) _resp; - } - else - { - extractAttachments(_call); - - try - { - return (vamsas.objects.simple.Alignment) _resp; - } - catch (java.lang.Exception _exception) - { - return (vamsas.objects.simple.Alignment) org.apache.axis.utils. - JavaUtils.convert(_resp, - vamsas.objects.simple.Alignment.class); - } - } - } - - public vamsas.objects.simple.MsaResult getResult(java.lang.String job_id) - throws java.rmi.RemoteException - { - if (super.cachedEndpoint == null) - { - throw new org.apache.axis.NoEndPointException(); - } - - org.apache.axis.client.Call _call = createCall(); - _call.setOperation(_operations[2]); - _call.setUseSOAPAction(true); - _call.setSOAPActionURI(""); - _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS); - _call.setOperationName(new javax.xml.namespace.QName("vamsas", - "getResult")); - - setRequestHeaders(_call); - setAttachments(_call); - - java.lang.Object _resp = _call.invoke(new java.lang.Object[] - {job_id}); - - if (_resp instanceof java.rmi.RemoteException) - { - throw (java.rmi.RemoteException) _resp; - } - else - { - extractAttachments(_call); - - try - { - return (vamsas.objects.simple.MsaResult) _resp; - } - catch (java.lang.Exception _exception) - { - return (vamsas.objects.simple.MsaResult) org.apache.axis.utils. - JavaUtils.convert(_resp, - vamsas.objects.simple.MsaResult.class); - } - } - } - - public vamsas.objects.simple.WsJobId cancel(java.lang.String jobId) - throws java.rmi.RemoteException - { - if (super.cachedEndpoint == null) - { - throw new org.apache.axis.NoEndPointException(); - } - - org.apache.axis.client.Call _call = createCall(); - _call.setOperation(_operations[3]); - _call.setUseSOAPAction(true); - _call.setSOAPActionURI(""); - _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS); - _call.setOperationName(new javax.xml.namespace.QName("vamsas", "cancel")); - - setRequestHeaders(_call); - setAttachments(_call); - - java.lang.Object _resp = _call.invoke(new java.lang.Object[] - {jobId}); - - if (_resp instanceof java.rmi.RemoteException) - { - throw (java.rmi.RemoteException) _resp; - } - else - { - extractAttachments(_call); - - try - { - return (vamsas.objects.simple.WsJobId) _resp; - } - catch (java.lang.Exception _exception) - { - return (vamsas.objects.simple.WsJobId) org.apache.axis.utils.JavaUtils. - convert(_resp, - vamsas.objects.simple.WsJobId.class); - } - } - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +/* + * Jalview - A Sequence Alignment Editor and Viewer + * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package ext.vamsas; + +public class MuscleWSSoapBindingStub + extends org.apache.axis.client.Stub implements ext.vamsas.MuscleWS +{ + static org.apache.axis.description.OperationDesc[] _operations; + + static + { + _operations = new org.apache.axis.description.OperationDesc[4]; + _initOperationDesc1(); + } + + private java.util.Vector cachedSerClasses = new java.util.Vector(); + private java.util.Vector cachedSerQNames = new java.util.Vector(); + private java.util.Vector cachedSerFactories = new java.util.Vector(); + private java.util.Vector cachedDeserFactories = new java.util.Vector(); + + public MuscleWSSoapBindingStub() + throws org.apache.axis.AxisFault + { + this(null); + } + + public MuscleWSSoapBindingStub(java.net.URL endpointURL, + javax.xml.rpc.Service service) + throws org.apache.axis.AxisFault + { + this(service); + super.cachedEndpoint = endpointURL; + } + + public MuscleWSSoapBindingStub(javax.xml.rpc.Service service) + throws org.apache.axis.AxisFault + { + if (service == null) + { + super.service = new org.apache.axis.client.Service(); + } + else + { + super.service = service; + } + + java.lang.Class cls; + javax.xml.namespace.QName qName; + java.lang.Class beansf = org.apache.axis.encoding.ser.BeanSerializerFactory.class; + java.lang.Class beandf = org.apache.axis.encoding.ser. + BeanDeserializerFactory.class; + //java.lang.Class enumsf = org.apache.axis.encoding.ser.EnumSerializerFactory.class; + //java.lang.Class enumdf = org.apache.axis.encoding.ser.EnumDeserializerFactory.class; + java.lang.Class arraysf = org.apache.axis.encoding.ser. + ArraySerializerFactory.class; + java.lang.Class arraydf = org.apache.axis.encoding.ser. + ArrayDeserializerFactory.class; + //java.lang.Class simplesf = org.apache.axis.encoding.ser.SimpleSerializerFactory.class; + // java.lang.Class simpledf = org.apache.axis.encoding.ser.SimpleDeserializerFactory.class; + //java.lang.Class simplelistsf = org.apache.axis.encoding.ser.SimpleListSerializerFactory.class; + //java.lang.Class simplelistdf = org.apache.axis.encoding.ser.SimpleListDeserializerFactory.class; + qName = new javax.xml.namespace.QName("simple.objects.vamsas", + "Sequence"); + cachedSerQNames.add(qName); + cls = vamsas.objects.simple.Sequence.class; + cachedSerClasses.add(cls); + cachedSerFactories.add(beansf); + cachedDeserFactories.add(beandf); + + qName = new javax.xml.namespace.QName("vamsas", "ArrayOf_tns1_Sequence"); + cachedSerQNames.add(qName); + cls = vamsas.objects.simple.Sequence[].class; + cachedSerClasses.add(cls); + cachedSerFactories.add(arraysf); + cachedDeserFactories.add(arraydf); + + qName = new javax.xml.namespace.QName("simple.objects.vamsas", + "MsaResult"); + cachedSerQNames.add(qName); + cls = vamsas.objects.simple.MsaResult.class; + cachedSerClasses.add(cls); + cachedSerFactories.add(beansf); + cachedDeserFactories.add(beandf); + + qName = new javax.xml.namespace.QName("simple.objects.vamsas", + "SequenceSet"); + cachedSerQNames.add(qName); + cls = vamsas.objects.simple.SequenceSet.class; + cachedSerClasses.add(cls); + cachedSerFactories.add(beansf); + cachedDeserFactories.add(beandf); + + qName = new javax.xml.namespace.QName("http://simple.objects.vamsas", + "Object"); + cachedSerQNames.add(qName); + cls = vamsas.objects.simple.Object.class; + cachedSerClasses.add(cls); + cachedSerFactories.add(beansf); + cachedDeserFactories.add(beandf); + + qName = new javax.xml.namespace.QName("simple.objects.vamsas", + "Alignment"); + cachedSerQNames.add(qName); + cls = vamsas.objects.simple.Alignment.class; + cachedSerClasses.add(cls); + cachedSerFactories.add(beansf); + cachedDeserFactories.add(beandf); + + qName = new javax.xml.namespace.QName("simple.objects.vamsas", "WsJobId"); + cachedSerQNames.add(qName); + cls = vamsas.objects.simple.WsJobId.class; + cachedSerClasses.add(cls); + cachedSerFactories.add(beansf); + cachedDeserFactories.add(beandf); + + qName = new javax.xml.namespace.QName("vamsas", "ArrayOf_xsd_string"); + cachedSerQNames.add(qName); + cls = java.lang.String[].class; + cachedSerClasses.add(cls); + cachedSerFactories.add(arraysf); + cachedDeserFactories.add(arraydf); + + qName = new javax.xml.namespace.QName("simple.objects.vamsas", "Result"); + cachedSerQNames.add(qName); + cls = vamsas.objects.simple.Result.class; + cachedSerClasses.add(cls); + cachedSerFactories.add(beansf); + cachedDeserFactories.add(beandf); + } + + private static void _initOperationDesc1() + { + org.apache.axis.description.OperationDesc oper; + oper = new org.apache.axis.description.OperationDesc(); + oper.setName("align"); + oper.addParameter(new javax.xml.namespace.QName("", "seqSet"), + new javax.xml.namespace.QName("simple.objects.vamsas", + "SequenceSet"), + vamsas.objects.simple.SequenceSet.class, + org.apache.axis.description.ParameterDesc.IN, false, false); + oper.setReturnType(new javax.xml.namespace.QName( + "simple.objects.vamsas", "WsJobId")); + oper.setReturnClass(vamsas.objects.simple.WsJobId.class); + oper.setReturnQName(new javax.xml.namespace.QName("", "alignReturn")); + oper.setStyle(org.apache.axis.constants.Style.RPC); + oper.setUse(org.apache.axis.constants.Use.ENCODED); + _operations[0] = oper; + + oper = new org.apache.axis.description.OperationDesc(); + oper.setName("getalign"); + oper.addParameter(new javax.xml.namespace.QName("", "job_id"), + new javax.xml.namespace.QName( + "http://www.w3.org/2001/XMLSchema", + "string"), java.lang.String.class, + org.apache.axis.description.ParameterDesc.IN, false, false); + oper.setReturnType(new javax.xml.namespace.QName( + "simple.objects.vamsas", "Alignment")); + oper.setReturnClass(vamsas.objects.simple.Alignment.class); + oper.setReturnQName(new javax.xml.namespace.QName("", "getalignReturn")); + oper.setStyle(org.apache.axis.constants.Style.RPC); + oper.setUse(org.apache.axis.constants.Use.ENCODED); + _operations[1] = oper; + + oper = new org.apache.axis.description.OperationDesc(); + oper.setName("getResult"); + oper.addParameter(new javax.xml.namespace.QName("", "job_id"), + new javax.xml.namespace.QName( + "http://www.w3.org/2001/XMLSchema", + "string"), java.lang.String.class, + org.apache.axis.description.ParameterDesc.IN, false, false); + oper.setReturnType(new javax.xml.namespace.QName( + "simple.objects.vamsas", "MsaResult")); + oper.setReturnClass(vamsas.objects.simple.MsaResult.class); + oper.setReturnQName(new javax.xml.namespace.QName("", "getResultReturn")); + oper.setStyle(org.apache.axis.constants.Style.RPC); + oper.setUse(org.apache.axis.constants.Use.ENCODED); + _operations[2] = oper; + + oper = new org.apache.axis.description.OperationDesc(); + oper.setName("cancel"); + oper.addParameter(new javax.xml.namespace.QName("", "jobId"), + new javax.xml.namespace.QName( + "http://www.w3.org/2001/XMLSchema", + "string"), java.lang.String.class, + org.apache.axis.description.ParameterDesc.IN, false, false); + oper.setReturnType(new javax.xml.namespace.QName( + "simple.objects.vamsas", "WsJobId")); + oper.setReturnClass(vamsas.objects.simple.WsJobId.class); + oper.setReturnQName(new javax.xml.namespace.QName("", "cancelReturn")); + oper.setStyle(org.apache.axis.constants.Style.RPC); + oper.setUse(org.apache.axis.constants.Use.ENCODED); + _operations[3] = oper; + } + + protected org.apache.axis.client.Call createCall() + throws java.rmi.RemoteException + { + try + { + org.apache.axis.client.Call _call = (org.apache.axis.client.Call)super. + service.createCall(); + + if (super.maintainSessionSet) + { + _call.setMaintainSession(super.maintainSession); + } + + if (super.cachedUsername != null) + { + _call.setUsername(super.cachedUsername); + } + + if (super.cachedPassword != null) + { + _call.setPassword(super.cachedPassword); + } + + if (super.cachedEndpoint != null) + { + _call.setTargetEndpointAddress(super.cachedEndpoint); + } + + if (super.cachedTimeout != null) + { + _call.setTimeout(super.cachedTimeout); + } + + if (super.cachedPortName != null) + { + _call.setPortName(super.cachedPortName); + } + + java.util.Enumeration keys = super.cachedProperties.keys(); + + while (keys.hasMoreElements()) + { + java.lang.String key = (java.lang.String) keys.nextElement(); + _call.setProperty(key, super.cachedProperties.get(key)); + } + + // All the type mapping information is registered + // when the first call is made. + // The type mapping information is actually registered in + // the TypeMappingRegistry of the service, which + // is the reason why registration is only needed for the first call. + synchronized (this) + { + if (firstCall()) + { + // must set encoding style before registering serializers + _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants. + SOAP11_CONSTANTS); + _call.setEncodingStyle(org.apache.axis.Constants.URI_SOAP11_ENC); + + for (int i = 0; i < cachedSerFactories.size(); ++i) + { + java.lang.Class cls = (java.lang.Class) cachedSerClasses.get(i); + javax.xml.namespace.QName qName = (javax.xml.namespace.QName) + cachedSerQNames.get(i); + java.lang.Class sf = (java.lang.Class) cachedSerFactories.get(i); + java.lang.Class df = (java.lang.Class) cachedDeserFactories.get(i); + _call.registerTypeMapping(cls, qName, sf, df, false); + } + } + } + + return _call; + } + catch (java.lang.Throwable _t) + { + throw new org.apache.axis.AxisFault( + "Failure trying to get the Call object", + _t); + } + } + + public vamsas.objects.simple.WsJobId align( + vamsas.objects.simple.SequenceSet seqSet) + throws java.rmi.RemoteException + { + if (super.cachedEndpoint == null) + { + throw new org.apache.axis.NoEndPointException(); + } + + org.apache.axis.client.Call _call = createCall(); + _call.setOperation(_operations[0]); + _call.setUseSOAPAction(true); + _call.setSOAPActionURI(""); + _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS); + _call.setOperationName(new javax.xml.namespace.QName("vamsas", "align")); + + setRequestHeaders(_call); + setAttachments(_call); + + java.lang.Object _resp = _call.invoke(new java.lang.Object[] + {seqSet}); + + if (_resp instanceof java.rmi.RemoteException) + { + throw (java.rmi.RemoteException) _resp; + } + else + { + extractAttachments(_call); + + try + { + return (vamsas.objects.simple.WsJobId) _resp; + } + catch (java.lang.Exception _exception) + { + return (vamsas.objects.simple.WsJobId) org.apache.axis.utils.JavaUtils. + convert(_resp, + vamsas.objects.simple.WsJobId.class); + } + } + } + + public vamsas.objects.simple.Alignment getalign(java.lang.String job_id) + throws java.rmi.RemoteException + { + if (super.cachedEndpoint == null) + { + throw new org.apache.axis.NoEndPointException(); + } + + org.apache.axis.client.Call _call = createCall(); + _call.setOperation(_operations[1]); + _call.setUseSOAPAction(true); + _call.setSOAPActionURI(""); + _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS); + _call.setOperationName(new javax.xml.namespace.QName("vamsas", + "getalign")); + + setRequestHeaders(_call); + setAttachments(_call); + + java.lang.Object _resp = _call.invoke(new java.lang.Object[] + {job_id}); + + if (_resp instanceof java.rmi.RemoteException) + { + throw (java.rmi.RemoteException) _resp; + } + else + { + extractAttachments(_call); + + try + { + return (vamsas.objects.simple.Alignment) _resp; + } + catch (java.lang.Exception _exception) + { + return (vamsas.objects.simple.Alignment) org.apache.axis.utils. + JavaUtils.convert(_resp, + vamsas.objects.simple.Alignment.class); + } + } + } + + public vamsas.objects.simple.MsaResult getResult(java.lang.String job_id) + throws java.rmi.RemoteException + { + if (super.cachedEndpoint == null) + { + throw new org.apache.axis.NoEndPointException(); + } + + org.apache.axis.client.Call _call = createCall(); + _call.setOperation(_operations[2]); + _call.setUseSOAPAction(true); + _call.setSOAPActionURI(""); + _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS); + _call.setOperationName(new javax.xml.namespace.QName("vamsas", + "getResult")); + + setRequestHeaders(_call); + setAttachments(_call); + + java.lang.Object _resp = _call.invoke(new java.lang.Object[] + {job_id}); + + if (_resp instanceof java.rmi.RemoteException) + { + throw (java.rmi.RemoteException) _resp; + } + else + { + extractAttachments(_call); + + try + { + return (vamsas.objects.simple.MsaResult) _resp; + } + catch (java.lang.Exception _exception) + { + return (vamsas.objects.simple.MsaResult) org.apache.axis.utils. + JavaUtils.convert(_resp, + vamsas.objects.simple.MsaResult.class); + } + } + } + + public vamsas.objects.simple.WsJobId cancel(java.lang.String jobId) + throws java.rmi.RemoteException + { + if (super.cachedEndpoint == null) + { + throw new org.apache.axis.NoEndPointException(); + } + + org.apache.axis.client.Call _call = createCall(); + _call.setOperation(_operations[3]); + _call.setUseSOAPAction(true); + _call.setSOAPActionURI(""); + _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS); + _call.setOperationName(new javax.xml.namespace.QName("vamsas", "cancel")); + + setRequestHeaders(_call); + setAttachments(_call); + + java.lang.Object _resp = _call.invoke(new java.lang.Object[] + {jobId}); + + if (_resp instanceof java.rmi.RemoteException) + { + throw (java.rmi.RemoteException) _resp; + } + else + { + extractAttachments(_call); + + try + { + return (vamsas.objects.simple.WsJobId) _resp; + } + catch (java.lang.Exception _exception) + { + return (vamsas.objects.simple.WsJobId) org.apache.axis.utils.JavaUtils. + convert(_resp, + vamsas.objects.simple.WsJobId.class); + } + } + } +} diff --git a/src/ext/vamsas/RegistryServiceSoapBindingStub.java b/src/ext/vamsas/RegistryServiceSoapBindingStub.java index 22bd8ed..830a0cb 100755 --- a/src/ext/vamsas/RegistryServiceSoapBindingStub.java +++ b/src/ext/vamsas/RegistryServiceSoapBindingStub.java @@ -1,10 +1,21 @@ -/** - * RegistryServiceSoapBindingStub.java - * - * This file was auto-generated from WSDL - * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter. +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package ext.vamsas; public class RegistryServiceSoapBindingStub diff --git a/src/ext/vamsas/SeqSearchI.java b/src/ext/vamsas/SeqSearchI.java index 3c89161..4ac04b3 100644 --- a/src/ext/vamsas/SeqSearchI.java +++ b/src/ext/vamsas/SeqSearchI.java @@ -1,10 +1,21 @@ -/** - * ScanPSService.java - * - * This file was auto-generated from WSDL - * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter. +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package ext.vamsas; public interface SeqSearchI extends java.rmi.Remote { diff --git a/src/ext/vamsas/SeqSearchServiceLocator.java b/src/ext/vamsas/SeqSearchServiceLocator.java index 46b435b..90f6b81 100644 --- a/src/ext/vamsas/SeqSearchServiceLocator.java +++ b/src/ext/vamsas/SeqSearchServiceLocator.java @@ -1,10 +1,21 @@ -/** - * ScanPSServiceServiceLocator.java - * - * This file was auto-generated from WSDL - * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter. +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package ext.vamsas; public class SeqSearchServiceLocator extends org.apache.axis.client.Service implements ext.vamsas.SeqSearchServiceService { diff --git a/src/ext/vamsas/SeqSearchServiceService.java b/src/ext/vamsas/SeqSearchServiceService.java index 0dd4c14..867ab25 100644 --- a/src/ext/vamsas/SeqSearchServiceService.java +++ b/src/ext/vamsas/SeqSearchServiceService.java @@ -1,10 +1,21 @@ -/** - * ScanPSServiceService.java - * - * This file was auto-generated from WSDL - * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter. +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package ext.vamsas; public interface SeqSearchServiceService extends javax.xml.rpc.Service { diff --git a/src/ext/vamsas/SeqSearchServiceSoapBindingStub.java b/src/ext/vamsas/SeqSearchServiceSoapBindingStub.java index 614a85f..6a1a15e 100644 --- a/src/ext/vamsas/SeqSearchServiceSoapBindingStub.java +++ b/src/ext/vamsas/SeqSearchServiceSoapBindingStub.java @@ -1,10 +1,21 @@ -/** - * ScanPSServiceSoapBindingStub.java - * - * This file was auto-generated from WSDL - * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter. +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package ext.vamsas; public class SeqSearchServiceSoapBindingStub extends org.apache.axis.client.Stub implements ext.vamsas.SeqSearchI { @@ -18,7 +29,7 @@ public class SeqSearchServiceSoapBindingStub extends org.apache.axis.client.Stub static { _operations = new org.apache.axis.description.OperationDesc[5]; _initOperationDesc1(); - } + } private static void _initOperationDesc1(){ org.apache.axis.description.OperationDesc oper; diff --git a/src/ext/vamsas/ServiceHandle.java b/src/ext/vamsas/ServiceHandle.java index 994ea5c..7d95b1a 100755 --- a/src/ext/vamsas/ServiceHandle.java +++ b/src/ext/vamsas/ServiceHandle.java @@ -1,10 +1,21 @@ -/** - * ServiceHandle.java - * - * This file was auto-generated from WSDL - * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter. +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package ext.vamsas; public class ServiceHandle diff --git a/src/ext/vamsas/ServiceHandles.java b/src/ext/vamsas/ServiceHandles.java index 1de1345..05a386f 100755 --- a/src/ext/vamsas/ServiceHandles.java +++ b/src/ext/vamsas/ServiceHandles.java @@ -1,10 +1,21 @@ -/** - * ServiceHandles.java - * - * This file was auto-generated from WSDL - * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter. +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package ext.vamsas; public class ServiceHandles diff --git a/src/jalview/analysis/AAFrequency.java b/src/jalview/analysis/AAFrequency.java index 03cdc15..a4418a4 100755 --- a/src/jalview/analysis/AAFrequency.java +++ b/src/jalview/analysis/AAFrequency.java @@ -1,156 +1,156 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.analysis; - -import java.util.*; - -import jalview.datamodel.*; - -/** - * Takes in a vector or array of sequences and column start and column end - * and returns a new Hashtable[] of size maxSeqLength, if Hashtable not supplied. - * This class is used extensively in calculating alignment colourschemes - * that depend on the amount of conservation in each alignment column. - * @author $author$ - * @version $Revision$ - */ -public class AAFrequency -{ - //No need to store 1000s of strings which are not - //visible to the user. - public static final String MAXCOUNT = "C"; - public static final String MAXRESIDUE = "R"; - public static final String PID_GAPS = "G"; - public static final String PID_NOGAPS = "N"; - - public static final Hashtable[] calculate(Vector sequences, int start, - int end) - { - SequenceI[] seqs = new SequenceI[sequences.size()]; - int width = 0; - for (int i = 0; i < sequences.size(); i++) - { - seqs[i] = (SequenceI) sequences.elementAt(i); - if (seqs[i].getLength() > width) - { - width = seqs[i].getLength(); - } - } - - Hashtable[] reply = new Hashtable[width]; - - if (end >= width) - { - end = width; - } - - calculate(seqs, start, end, reply); - - return reply; - } - - public static final void calculate(SequenceI[] sequences, - int start, int end, - Hashtable[] result) - { - Hashtable residueHash; - int maxCount, nongap, i, j, v, jSize = sequences.length; - String maxResidue; - char c; - float percentage; - - int[] values = new int[255]; - - char[] seq; - - for (i = start; i < end; i++) - { - residueHash = new Hashtable(); - maxCount = 0; - maxResidue = ""; - nongap = 0; - values = new int[255]; - - for (j = 0; j < jSize; j++) - { - seq = sequences[j].getSequence(); - if (seq.length > i) - { - c = seq[i]; - - if (c == '.' || c == ' ') - { - c = '-'; - } - - if (c == '-') - { - values['-']++; - continue; - } - else if ('a' <= c && c <= 'z') - { - c -= 32; //('a' - 'A'); - } - - nongap++; - values[c]++; - - } - else - { - values['-']++; - } - } - - for (v = 'A'; v < 'Z'; v++) - { - if (values[v] < 2 || values[v] < maxCount) - { - continue; - } - - if (values[v] > maxCount) - { - maxResidue = String.valueOf( (char) v); - } - else if (values[v] == maxCount) - { - maxResidue += String.valueOf( (char) v); - } - maxCount = values[v]; - } - - if (maxResidue.length() == 0) - { - maxResidue = "-"; - } - - residueHash.put(MAXCOUNT, new Integer(maxCount)); - residueHash.put(MAXRESIDUE, maxResidue); - - percentage = ( (float) maxCount * 100) / (float) jSize; - residueHash.put(PID_GAPS, new Float(percentage)); - - percentage = ( (float) maxCount * 100) / (float) nongap; - residueHash.put(PID_NOGAPS, new Float(percentage)); - result[i] = residueHash; - } - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.analysis; + +import java.util.*; + +import jalview.datamodel.*; + +/** + * Takes in a vector or array of sequences and column start and column end + * and returns a new Hashtable[] of size maxSeqLength, if Hashtable not supplied. + * This class is used extensively in calculating alignment colourschemes + * that depend on the amount of conservation in each alignment column. + * @author $author$ + * @version $Revision$ + */ +public class AAFrequency +{ + //No need to store 1000s of strings which are not + //visible to the user. + public static final String MAXCOUNT = "C"; + public static final String MAXRESIDUE = "R"; + public static final String PID_GAPS = "G"; + public static final String PID_NOGAPS = "N"; + + public static final Hashtable[] calculate(Vector sequences, int start, + int end) + { + SequenceI[] seqs = new SequenceI[sequences.size()]; + int width = 0; + for (int i = 0; i < sequences.size(); i++) + { + seqs[i] = (SequenceI) sequences.elementAt(i); + if (seqs[i].getLength() > width) + { + width = seqs[i].getLength(); + } + } + + Hashtable[] reply = new Hashtable[width]; + + if (end >= width) + { + end = width; + } + + calculate(seqs, start, end, reply); + + return reply; + } + + public static final void calculate(SequenceI[] sequences, + int start, int end, + Hashtable[] result) + { + Hashtable residueHash; + int maxCount, nongap, i, j, v, jSize = sequences.length; + String maxResidue; + char c; + float percentage; + + int[] values = new int[255]; + + char[] seq; + + for (i = start; i < end; i++) + { + residueHash = new Hashtable(); + maxCount = 0; + maxResidue = ""; + nongap = 0; + values = new int[255]; + + for (j = 0; j < jSize; j++) + { + seq = sequences[j].getSequence(); + if (seq.length > i) + { + c = seq[i]; + + if (c == '.' || c == ' ') + { + c = '-'; + } + + if (c == '-') + { + values['-']++; + continue; + } + else if ('a' <= c && c <= 'z') + { + c -= 32; //('a' - 'A'); + } + + nongap++; + values[c]++; + + } + else + { + values['-']++; + } + } + + for (v = 'A'; v < 'Z'; v++) + { + if (values[v] < 2 || values[v] < maxCount) + { + continue; + } + + if (values[v] > maxCount) + { + maxResidue = String.valueOf( (char) v); + } + else if (values[v] == maxCount) + { + maxResidue += String.valueOf( (char) v); + } + maxCount = values[v]; + } + + if (maxResidue.length() == 0) + { + maxResidue = "-"; + } + + residueHash.put(MAXCOUNT, new Integer(maxCount)); + residueHash.put(MAXRESIDUE, maxResidue); + + percentage = ( (float) maxCount * 100) / (float) jSize; + residueHash.put(PID_GAPS, new Float(percentage)); + + percentage = ( (float) maxCount * 100) / (float) nongap; + residueHash.put(PID_NOGAPS, new Float(percentage)); + result[i] = residueHash; + } + } +} diff --git a/src/jalview/analysis/AlignSeq.java b/src/jalview/analysis/AlignSeq.java index 0de8167..1f1c6fa 100755 --- a/src/jalview/analysis/AlignSeq.java +++ b/src/jalview/analysis/AlignSeq.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/analysis/AlignmentSorter.java b/src/jalview/analysis/AlignmentSorter.java index a3493f7..ed29101 100755 --- a/src/jalview/analysis/AlignmentSorter.java +++ b/src/jalview/analysis/AlignmentSorter.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/analysis/Conservation.java b/src/jalview/analysis/Conservation.java index c216471..f276a55 100755 --- a/src/jalview/analysis/Conservation.java +++ b/src/jalview/analysis/Conservation.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/analysis/CrossRef.java b/src/jalview/analysis/CrossRef.java index 159d96a..2da8773 100644 --- a/src/jalview/analysis/CrossRef.java +++ b/src/jalview/analysis/CrossRef.java @@ -1,3 +1,21 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ package jalview.analysis; import java.util.Enumeration; @@ -562,4 +580,4 @@ public class CrossRef * System.out.println("Prod "+p+": "+prod[p].getDisplayId(true)); } } * } } */ -} \ No newline at end of file +} diff --git a/src/jalview/analysis/Dna.java b/src/jalview/analysis/Dna.java index c6bcfda..74166c8 100644 --- a/src/jalview/analysis/Dna.java +++ b/src/jalview/analysis/Dna.java @@ -1,3 +1,21 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ package jalview.analysis; import java.util.Enumeration; diff --git a/src/jalview/analysis/Finder.java b/src/jalview/analysis/Finder.java index 5280467..8bda592 100644 --- a/src/jalview/analysis/Finder.java +++ b/src/jalview/analysis/Finder.java @@ -1,3 +1,21 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ package jalview.analysis; import java.util.*; diff --git a/src/jalview/analysis/NJTree.java b/src/jalview/analysis/NJTree.java index 3569be1..dd2dbbf 100755 --- a/src/jalview/analysis/NJTree.java +++ b/src/jalview/analysis/NJTree.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/analysis/PCA.java b/src/jalview/analysis/PCA.java index c11610a..0cc2e76 100755 --- a/src/jalview/analysis/PCA.java +++ b/src/jalview/analysis/PCA.java @@ -1,239 +1,239 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.analysis; - -import java.io.*; - -import jalview.datamodel.*; -import jalview.math.*; - -/** - * Performs Principal Component Analysis on given sequences - * - * @author $author$ - * @version $Revision$ - */ -public class PCA - implements Runnable -{ - Matrix m; - Matrix symm; - Matrix m2; - double[] eigenvalue; - Matrix eigenvector; - StringBuffer details = new StringBuffer(); - - /** - * Creates a new PCA object. - * - * @param s Set of sequences to perform PCA on - */ - public PCA(String[] s) - { - - BinarySequence[] bs = new BinarySequence[s.length]; - int ii = 0; - - while ( (ii < s.length) && (s[ii] != null)) - { - bs[ii] = new BinarySequence(s[ii]); - bs[ii].encode(); - ii++; - } - - BinarySequence[] bs2 = new BinarySequence[s.length]; - ii = 0; - - while ( (ii < s.length) && (s[ii] != null)) - { - bs2[ii] = new BinarySequence(s[ii]); - bs2[ii].blosumEncode(); - ii++; - } - - //System.out.println("Created binary encoding"); - //printMemory(rt); - int count = 0; - - while ( (count < bs.length) && (bs[count] != null)) - { - count++; - } - - double[][] seqmat = new double[count][bs[0].getDBinary().length]; - double[][] seqmat2 = new double[count][bs2[0].getDBinary().length]; - int i = 0; - - while (i < count) - { - seqmat[i] = bs[i].getDBinary(); - seqmat2[i] = bs2[i].getDBinary(); - i++; - } - - //System.out.println("Created array"); - //printMemory(rt); - // System.out.println(" --- Original matrix ---- "); - m = new Matrix(seqmat, count, bs[0].getDBinary().length); - m2 = new Matrix(seqmat2, count, bs2[0].getDBinary().length); - - } - - /** - * Returns the matrix used in PCA calculation - * - * @return java.math.Matrix object - */ - - public Matrix getM() - { - return m; - } - - /** - * Returns Eigenvalue - * - * @param i Index of diagonal within matrix - * - * @return Returns value of diagonal from matrix - */ - public double getEigenvalue(int i) - { - return eigenvector.d[i]; - } - - /** - * DOCUMENT ME! - * - * @param l DOCUMENT ME! - * @param n DOCUMENT ME! - * @param mm DOCUMENT ME! - * @param factor DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public float[][] getComponents(int l, int n, int mm, float factor) - { - float[][] out = new float[m.rows][3]; - - for (int i = 0; i < m.rows; i++) - { - out[i][0] = (float) component(i, l) * factor; - out[i][1] = (float) component(i, n) * factor; - out[i][2] = (float) component(i, mm) * factor; - } - - return out; - } - - /** - * DOCUMENT ME! - * - * @param n DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public double[] component(int n) - { - // n = index of eigenvector - double[] out = new double[m.rows]; - - for (int i = 0; i < m.rows; i++) - { - out[i] = component(i, n); - } - - return out; - } - - /** - * DOCUMENT ME! - * - * @param row DOCUMENT ME! - * @param n DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - double component(int row, int n) - { - double out = 0.0; - - for (int i = 0; i < symm.cols; i++) - { - out += (symm.value[row][i] * eigenvector.value[i][n]); - } - - return out / eigenvector.d[n]; - } - - public String getDetails() - { - return details.toString(); - } - - /** - * DOCUMENT ME! - */ - public void run() - { - Matrix mt = m.transpose(); - - details.append(" --- OrigT * Orig ---- \n"); - eigenvector = mt.preMultiply(m2); - - PrintStream ps = new PrintStream(System.out) - { - public void print(String x) - { - details.append(x); - } - - public void println() - { - details.append("\n"); - } - }; - - eigenvector.print(ps); - - symm = eigenvector.copy(); - - eigenvector.tred(); - - details.append(" ---Tridiag transform matrix ---\n"); - details.append(" --- D vector ---\n"); - eigenvector.printD(ps); - ps.println(); - details.append("--- E vector ---\n"); - eigenvector.printE(ps); - ps.println(); - - // Now produce the diagonalization matrix - eigenvector.tqli(); - - details.append(" --- New diagonalization matrix ---\n"); - details.append(" --- Eigenvalues ---\n"); - eigenvector.printD(ps); - ps.println(); - // taps.println(); - // taps.println("Transformed sequences = "); - // Matrix trans = m.preMultiply(eigenvector); - // trans.print(System.out); - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.analysis; + +import java.io.*; + +import jalview.datamodel.*; +import jalview.math.*; + +/** + * Performs Principal Component Analysis on given sequences + * + * @author $author$ + * @version $Revision$ + */ +public class PCA + implements Runnable +{ + Matrix m; + Matrix symm; + Matrix m2; + double[] eigenvalue; + Matrix eigenvector; + StringBuffer details = new StringBuffer(); + + /** + * Creates a new PCA object. + * + * @param s Set of sequences to perform PCA on + */ + public PCA(String[] s) + { + + BinarySequence[] bs = new BinarySequence[s.length]; + int ii = 0; + + while ( (ii < s.length) && (s[ii] != null)) + { + bs[ii] = new BinarySequence(s[ii]); + bs[ii].encode(); + ii++; + } + + BinarySequence[] bs2 = new BinarySequence[s.length]; + ii = 0; + + while ( (ii < s.length) && (s[ii] != null)) + { + bs2[ii] = new BinarySequence(s[ii]); + bs2[ii].blosumEncode(); + ii++; + } + + //System.out.println("Created binary encoding"); + //printMemory(rt); + int count = 0; + + while ( (count < bs.length) && (bs[count] != null)) + { + count++; + } + + double[][] seqmat = new double[count][bs[0].getDBinary().length]; + double[][] seqmat2 = new double[count][bs2[0].getDBinary().length]; + int i = 0; + + while (i < count) + { + seqmat[i] = bs[i].getDBinary(); + seqmat2[i] = bs2[i].getDBinary(); + i++; + } + + //System.out.println("Created array"); + //printMemory(rt); + // System.out.println(" --- Original matrix ---- "); + m = new Matrix(seqmat, count, bs[0].getDBinary().length); + m2 = new Matrix(seqmat2, count, bs2[0].getDBinary().length); + + } + + /** + * Returns the matrix used in PCA calculation + * + * @return java.math.Matrix object + */ + + public Matrix getM() + { + return m; + } + + /** + * Returns Eigenvalue + * + * @param i Index of diagonal within matrix + * + * @return Returns value of diagonal from matrix + */ + public double getEigenvalue(int i) + { + return eigenvector.d[i]; + } + + /** + * DOCUMENT ME! + * + * @param l DOCUMENT ME! + * @param n DOCUMENT ME! + * @param mm DOCUMENT ME! + * @param factor DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public float[][] getComponents(int l, int n, int mm, float factor) + { + float[][] out = new float[m.rows][3]; + + for (int i = 0; i < m.rows; i++) + { + out[i][0] = (float) component(i, l) * factor; + out[i][1] = (float) component(i, n) * factor; + out[i][2] = (float) component(i, mm) * factor; + } + + return out; + } + + /** + * DOCUMENT ME! + * + * @param n DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public double[] component(int n) + { + // n = index of eigenvector + double[] out = new double[m.rows]; + + for (int i = 0; i < m.rows; i++) + { + out[i] = component(i, n); + } + + return out; + } + + /** + * DOCUMENT ME! + * + * @param row DOCUMENT ME! + * @param n DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + double component(int row, int n) + { + double out = 0.0; + + for (int i = 0; i < symm.cols; i++) + { + out += (symm.value[row][i] * eigenvector.value[i][n]); + } + + return out / eigenvector.d[n]; + } + + public String getDetails() + { + return details.toString(); + } + + /** + * DOCUMENT ME! + */ + public void run() + { + Matrix mt = m.transpose(); + + details.append(" --- OrigT * Orig ---- \n"); + eigenvector = mt.preMultiply(m2); + + PrintStream ps = new PrintStream(System.out) + { + public void print(String x) + { + details.append(x); + } + + public void println() + { + details.append("\n"); + } + }; + + eigenvector.print(ps); + + symm = eigenvector.copy(); + + eigenvector.tred(); + + details.append(" ---Tridiag transform matrix ---\n"); + details.append(" --- D vector ---\n"); + eigenvector.printD(ps); + ps.println(); + details.append("--- E vector ---\n"); + eigenvector.printE(ps); + ps.println(); + + // Now produce the diagonalization matrix + eigenvector.tqli(); + + details.append(" --- New diagonalization matrix ---\n"); + details.append(" --- Eigenvalues ---\n"); + eigenvector.printD(ps); + ps.println(); + // taps.println(); + // taps.println("Transformed sequences = "); + // Matrix trans = m.preMultiply(eigenvector); + // trans.print(System.out); + } +} diff --git a/src/jalview/analysis/ParseProperties.java b/src/jalview/analysis/ParseProperties.java index 79c1325..4435ae1 100644 --- a/src/jalview/analysis/ParseProperties.java +++ b/src/jalview/analysis/ParseProperties.java @@ -1,3 +1,21 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ package jalview.analysis; import com.stevesoft.pat.Regex; diff --git a/src/jalview/analysis/SeqsetUtils.java b/src/jalview/analysis/SeqsetUtils.java index 0aa2bd5..c81f673 100755 --- a/src/jalview/analysis/SeqsetUtils.java +++ b/src/jalview/analysis/SeqsetUtils.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/analysis/SequenceIdMatcher.java b/src/jalview/analysis/SequenceIdMatcher.java index 0744937..bb53814 100755 --- a/src/jalview/analysis/SequenceIdMatcher.java +++ b/src/jalview/analysis/SequenceIdMatcher.java @@ -1,246 +1,246 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.analysis; - -import java.util.*; - -import jalview.datamodel.*; - -/** - *

Title:

- * SequenceIdMatcher - *

Description:

- * Routine which does approximate Sequence Id resolution by name using - * string containment (on word boundaries) rather than equivalence. It also - * attempts to resolve ties where no exact match is available by picking the - * the id closest to the query. - *

Copyright: Copyright (c) 2004

- * - *

Company: Dundee University

- * - * @author not attributable - * @version 1.0 - */ -public class SequenceIdMatcher -{ - private Hashtable names; - - public SequenceIdMatcher(SequenceI[] seqs) - { - names = new Hashtable(); - for (int i = 0; i < seqs.length; i++) - { - names.put(new SeqIdName(seqs[i].getName()), seqs[i]); - } - } - - /** - * returns the closest SequenceI in matches to SeqIdName and returns all the matches - * to the names hash. - * @param candName SeqIdName - * @param matches Vector of SequenceI objects - * @return SequenceI closest SequenceI to SeqIdName - */ - private SequenceI pickbestMatch(SeqIdName candName, Vector matches) - { - SequenceI match = null; - if (candName == null || matches == null || matches.size() == 0) - { - return null; - } - match = (SequenceI) matches.elementAt(0); - matches.removeElementAt(0); - names.put(new SeqIdName(match.getName()), match); - int matchlen = match.getName().length(); - int namlen = candName.id.length(); - while (matches.size() > 0) - { - // look through for a better one. - SequenceI cand = (SequenceI) matches.elementAt(0); - names.put(new SeqIdName(cand.getName()), cand); - int candlen = cand.getName().length(); - // keep the one with an id 'closer' to the given seqnam string - if (Math.abs(matchlen - namlen) > Math.abs(candlen - namlen) && - candlen > matchlen) - { - match = cand; - matchlen = candlen; - } - } - return match; - } - - /** - * get SequenceI with closest SequenceI.getName() to seq.getName() - * @param seq SequenceI - * @return SequenceI - */ - SequenceI findIdMatch(SequenceI seq) - { - SeqIdName nam = new SeqIdName(seq.getName()); - return findIdMatch(nam); - } - - SequenceI findIdMatch(String seqnam) - { - SeqIdName nam = new SeqIdName(seqnam); - return findIdMatch(nam); - } - - /** - * findIdMatch - * - * Return pointers to sequences (or sequence object containers) - * which have same Id as a given set of different sequence objects - * - * @param seqs SequenceI[] - * @return SequenceI[] - */ - SequenceI[] findIdMatch(SequenceI[] seqs) - { - SequenceI[] namedseqs = null; - int i = 0; - SeqIdName nam; - - if (seqs.length > 0) - { - namedseqs = new SequenceI[seqs.length]; - do - { - nam = new SeqIdName(seqs[i].getName()); - - if (names.containsKey(nam)) - { - namedseqs[i] = findIdMatch(nam); - } - else - { - namedseqs[i] = null; - } - } - while (++i < seqs.length); - } - - return namedseqs; - } - - /** - * core findIdMatch search method - * @param nam SeqIdName - * @return SequenceI - */ - private SequenceI findIdMatch(jalview.analysis.SequenceIdMatcher.SeqIdName - nam) - { - Vector matches = new Vector(); - while (names.containsKey(nam)) - { - matches.addElement(names.remove(nam)); - } - return pickbestMatch(nam, matches); - } - - private class SeqIdName - { - String id; - - SeqIdName(String s) - { - if (s != null) - { - id = new String(s); - } - else - { - id = ""; - } - } - - public int hashCode() - { - return ( (id.length() >= 4) ? id.substring(0, 4).hashCode() : id.hashCode()); - } - - public boolean equals(Object s) - { - if (s instanceof SeqIdName) - { - return this.equals( (SeqIdName) s); - } - else - { - if (s instanceof String) - { - return this.equals( (String) s); - } - } - - return false; - } - - /** - * Characters that define the end of a unique sequence ID at - * the beginning of an arbitrary ID string - * JBPNote: This is a heuristic that will fail for arbritrarily extended sequence id's - * (like portions of an aligned set of repeats from one sequence) - */ - private String WORD_SEP = "~. |#\\/<>!\"£$%^*)}[@',?_"; - - /** - * matches if one ID properly contains another at a whitespace boundary. - * TODO: (JBPNote) These are not efficient. should use char[] for speed - * todo: (JBPNote) Set separator characters appropriately - * @param s SeqIdName - * @return boolean - */ - public boolean equals(SeqIdName s) - { - if (id.length() > s.id.length()) - { - return id.startsWith(s.id) ? - (WORD_SEP.indexOf(id.charAt(s.id.length())) > -1) - : false; - } - else - { - return s.id.startsWith(id) ? - (s.id.equals(id) ? true : - (WORD_SEP.indexOf(s.id.charAt(id.length())) > -1)) - : false; - } - } - - public boolean equals(String s) - { - if (id.length() > s.length()) - { - 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; - } - } - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.analysis; + +import java.util.*; + +import jalview.datamodel.*; + +/** + *

Title:

+ * SequenceIdMatcher + *

Description:

+ * Routine which does approximate Sequence Id resolution by name using + * string containment (on word boundaries) rather than equivalence. It also + * attempts to resolve ties where no exact match is available by picking the + * the id closest to the query. + *

Copyright: Copyright (c) 2004

+ * + *

Company: Dundee University

+ * + * @author not attributable + * @version 1.0 + */ +public class SequenceIdMatcher +{ + private Hashtable names; + + public SequenceIdMatcher(SequenceI[] seqs) + { + names = new Hashtable(); + for (int i = 0; i < seqs.length; i++) + { + names.put(new SeqIdName(seqs[i].getName()), seqs[i]); + } + } + + /** + * returns the closest SequenceI in matches to SeqIdName and returns all the matches + * to the names hash. + * @param candName SeqIdName + * @param matches Vector of SequenceI objects + * @return SequenceI closest SequenceI to SeqIdName + */ + private SequenceI pickbestMatch(SeqIdName candName, Vector matches) + { + SequenceI match = null; + if (candName == null || matches == null || matches.size() == 0) + { + return null; + } + match = (SequenceI) matches.elementAt(0); + matches.removeElementAt(0); + names.put(new SeqIdName(match.getName()), match); + int matchlen = match.getName().length(); + int namlen = candName.id.length(); + while (matches.size() > 0) + { + // look through for a better one. + SequenceI cand = (SequenceI) matches.elementAt(0); + names.put(new SeqIdName(cand.getName()), cand); + int candlen = cand.getName().length(); + // keep the one with an id 'closer' to the given seqnam string + if (Math.abs(matchlen - namlen) > Math.abs(candlen - namlen) && + candlen > matchlen) + { + match = cand; + matchlen = candlen; + } + } + return match; + } + + /** + * get SequenceI with closest SequenceI.getName() to seq.getName() + * @param seq SequenceI + * @return SequenceI + */ + SequenceI findIdMatch(SequenceI seq) + { + SeqIdName nam = new SeqIdName(seq.getName()); + return findIdMatch(nam); + } + + SequenceI findIdMatch(String seqnam) + { + SeqIdName nam = new SeqIdName(seqnam); + return findIdMatch(nam); + } + + /** + * findIdMatch + * + * Return pointers to sequences (or sequence object containers) + * which have same Id as a given set of different sequence objects + * + * @param seqs SequenceI[] + * @return SequenceI[] + */ + SequenceI[] findIdMatch(SequenceI[] seqs) + { + SequenceI[] namedseqs = null; + int i = 0; + SeqIdName nam; + + if (seqs.length > 0) + { + namedseqs = new SequenceI[seqs.length]; + do + { + nam = new SeqIdName(seqs[i].getName()); + + if (names.containsKey(nam)) + { + namedseqs[i] = findIdMatch(nam); + } + else + { + namedseqs[i] = null; + } + } + while (++i < seqs.length); + } + + return namedseqs; + } + + /** + * core findIdMatch search method + * @param nam SeqIdName + * @return SequenceI + */ + private SequenceI findIdMatch(jalview.analysis.SequenceIdMatcher.SeqIdName + nam) + { + Vector matches = new Vector(); + while (names.containsKey(nam)) + { + matches.addElement(names.remove(nam)); + } + return pickbestMatch(nam, matches); + } + + private class SeqIdName + { + String id; + + SeqIdName(String s) + { + if (s != null) + { + id = new String(s); + } + else + { + id = ""; + } + } + + public int hashCode() + { + return ( (id.length() >= 4) ? id.substring(0, 4).hashCode() : id.hashCode()); + } + + public boolean equals(Object s) + { + if (s instanceof SeqIdName) + { + return this.equals( (SeqIdName) s); + } + else + { + if (s instanceof String) + { + return this.equals( (String) s); + } + } + + return false; + } + + /** + * Characters that define the end of a unique sequence ID at + * the beginning of an arbitrary ID string + * JBPNote: This is a heuristic that will fail for arbritrarily extended sequence id's + * (like portions of an aligned set of repeats from one sequence) + */ + private String WORD_SEP = "~. |#\\/<>!\"£$%^*)}[@',?_"; + + /** + * matches if one ID properly contains another at a whitespace boundary. + * TODO: (JBPNote) These are not efficient. should use char[] for speed + * todo: (JBPNote) Set separator characters appropriately + * @param s SeqIdName + * @return boolean + */ + public boolean equals(SeqIdName s) + { + if (id.length() > s.id.length()) + { + return id.startsWith(s.id) ? + (WORD_SEP.indexOf(id.charAt(s.id.length())) > -1) + : false; + } + else + { + return s.id.startsWith(id) ? + (s.id.equals(id) ? true : + (WORD_SEP.indexOf(s.id.charAt(id.length())) > -1)) + : false; + } + } + + public boolean equals(String s) + { + if (id.length() > s.length()) + { + 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; + } + } + } +} diff --git a/src/jalview/appletgui/APopupMenu.java b/src/jalview/appletgui/APopupMenu.java index 7c1ea3f..fc42a74 100755 --- a/src/jalview/appletgui/APopupMenu.java +++ b/src/jalview/appletgui/APopupMenu.java @@ -1,22 +1,21 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.appletgui; import java.util.*; diff --git a/src/jalview/appletgui/AlignFrame.java b/src/jalview/appletgui/AlignFrame.java index d7c2b43..13045f9 100755 --- a/src/jalview/appletgui/AlignFrame.java +++ b/src/jalview/appletgui/AlignFrame.java @@ -1,22 +1,21 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.appletgui; import java.io.*; diff --git a/src/jalview/appletgui/AlignViewport.java b/src/jalview/appletgui/AlignViewport.java index 33a73d3..602d29b 100755 --- a/src/jalview/appletgui/AlignViewport.java +++ b/src/jalview/appletgui/AlignViewport.java @@ -1,22 +1,21 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.appletgui; import java.util.*; diff --git a/src/jalview/appletgui/AlignmentPanel.java b/src/jalview/appletgui/AlignmentPanel.java index 6b292e9..00388a0 100755 --- a/src/jalview/appletgui/AlignmentPanel.java +++ b/src/jalview/appletgui/AlignmentPanel.java @@ -1,22 +1,21 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.appletgui; import java.awt.*; diff --git a/src/jalview/appletgui/AnnotationColourChooser.java b/src/jalview/appletgui/AnnotationColourChooser.java index c932962..a4cc0e7 100755 --- a/src/jalview/appletgui/AnnotationColourChooser.java +++ b/src/jalview/appletgui/AnnotationColourChooser.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/appletgui/AnnotationLabels.java b/src/jalview/appletgui/AnnotationLabels.java index 2d2d748..198cb21 100755 --- a/src/jalview/appletgui/AnnotationLabels.java +++ b/src/jalview/appletgui/AnnotationLabels.java @@ -1,22 +1,21 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.appletgui; import java.util.*; diff --git a/src/jalview/appletgui/AnnotationPanel.java b/src/jalview/appletgui/AnnotationPanel.java index 909ce78..ef0dcbb 100755 --- a/src/jalview/appletgui/AnnotationPanel.java +++ b/src/jalview/appletgui/AnnotationPanel.java @@ -1,22 +1,21 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.appletgui; import java.util.*; diff --git a/src/jalview/appletgui/AppletJmol.java b/src/jalview/appletgui/AppletJmol.java index 82a5911..1533530 100644 --- a/src/jalview/appletgui/AppletJmol.java +++ b/src/jalview/appletgui/AppletJmol.java @@ -1,22 +1,21 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.appletgui; import java.util.*; diff --git a/src/jalview/appletgui/CutAndPasteTransfer.java b/src/jalview/appletgui/CutAndPasteTransfer.java index 78d7ba7..7c9d421 100755 --- a/src/jalview/appletgui/CutAndPasteTransfer.java +++ b/src/jalview/appletgui/CutAndPasteTransfer.java @@ -1,279 +1,278 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -package jalview.appletgui; - -import java.awt.*; -import java.awt.event.*; - -import jalview.datamodel.*; -import jalview.io.*; - -public class CutAndPasteTransfer - extends Panel implements ActionListener, MouseListener -{ - boolean pdbImport = false; - boolean treeImport = false; - boolean annotationImport = false; - Sequence seq; - AlignFrame alignFrame; - - public CutAndPasteTransfer(boolean forImport, AlignFrame alignFrame) - { - try - { - jbInit(); - } - catch (Exception e) - { - e.printStackTrace(); - } - - this.alignFrame = alignFrame; - - if (!forImport) - { - buttonPanel.setVisible(false); - } - } - - public String getText() - { - return textarea.getText(); - } - - public void setText(String text) - { - textarea.setText(text); - } - - public void setPDBImport(Sequence seq) - { - this.seq = seq; - accept.setLabel("Accept"); - addSequences.setVisible(false); - pdbImport = true; - } - - public void setTreeImport() - { - treeImport = true; - accept.setLabel("Accept"); - addSequences.setVisible(false); - } - - public void setAnnotationImport() - { - annotationImport = true; - accept.setLabel("Accept"); - addSequences.setVisible(false); - } - - public void actionPerformed(ActionEvent evt) - { - if (evt.getSource() == accept) - { - ok(true); - } - else if (evt.getSource() == addSequences) - { - ok(false); - } - else if (evt.getSource() == cancel) - { - cancel(); - } - } - - protected void ok(boolean newWindow) - { - String text = getText(); - int length = text.length(); - textarea.append("\n"); - if (textarea.getText().length() == length) - { - String warning = - "\n\n#################################################\n" - + "WARNING!! THIS IS THE MAXIMUM SIZE OF TEXTAREA!!\n" - + "\nCAN'T INPUT FULL ALIGNMENT" - + "\n\nYOU MUST DELETE THIS WARNING TO CONTINUE" - + "\n\nMAKE SURE LAST SEQUENCE PASTED IS COMPLETE" - + "\n#################################################\n"; - textarea.setText(text.substring(0, text.length() - warning.length()) - + warning); - - textarea.setCaretPosition(text.length()); - } - - if (pdbImport) - { - PDBEntry pdb = new PDBEntry(); - pdb.setFile(text); - - if ( alignFrame.alignPanel.av.applet.jmolAvailable ) - new jalview.appletgui.AppletJmol(pdb, - new Sequence[]{seq}, - null, - alignFrame.alignPanel, - AppletFormatAdapter.PASTE); - else - - new MCview.AppletPDBViewer(pdb, - new Sequence[]{seq}, - null, - alignFrame.alignPanel, - AppletFormatAdapter.PASTE); - - } - else if (treeImport) - { - try - { - jalview.io.NewickFile fin = new jalview.io.NewickFile(textarea.getText(), - "Paste"); - - fin.parse(); - if (fin.getTree() != null) - { - alignFrame.loadTree(fin, "Pasted tree file"); - } - - } - catch (Exception ex) - { - textarea.setText("Could not parse Newick file!\n" + ex); - return; - } - } - else if (annotationImport) - { - if (new AnnotationFile().readAnnotationFile( - alignFrame.viewport.alignment, textarea.getText(), - jalview.io.AppletFormatAdapter.PASTE)) - { - alignFrame.alignPanel.fontChanged(); - alignFrame.alignPanel.setScrollValues(0, 0); - - } - else - { - alignFrame.parseFeaturesFile(textarea.getText(), - jalview.io.AppletFormatAdapter.PASTE); - } - } - else if (alignFrame != null) - { - Alignment al = null; - - String format = new IdentifyFile().Identify(text, - AppletFormatAdapter.PASTE); - try - { - al = new AppletFormatAdapter().readFile(text, AppletFormatAdapter.PASTE, - format); - } - catch (java.io.IOException ex) - { - ex.printStackTrace(); - } - - if (al != null) - { - if (newWindow) - { - AlignFrame af = new AlignFrame(al, alignFrame.viewport.applet, - "Cut & Paste input - " + format, - false); - af.statusBar.setText("Successfully pasted alignment file"); - } - else - { - alignFrame.addSequences(al.getSequencesArray()); - } - } - } - - if (this.getParent() instanceof Frame) - { - ( (Frame)this.getParent()).setVisible(false); - } - else - { - ( (Dialog)this.getParent()).setVisible(false); - } - } - - protected void cancel() - { - textarea.setText(""); - if (this.getParent() instanceof Frame) - { - ( (Frame)this.getParent()).setVisible(false); - } - else - { - ( (Dialog)this.getParent()).setVisible(false); - } - } - - protected TextArea textarea = new TextArea(); - Button accept = new Button("New Window"); - Button addSequences = new Button("Add to Current Alignment"); - Button cancel = new Button("Close"); - - protected Panel buttonPanel = new Panel(); - BorderLayout borderLayout1 = new BorderLayout(); - - private void jbInit() - throws Exception - { - textarea.setFont(new java.awt.Font("Monospaced", Font.PLAIN, 10)); - textarea.setText("Paste your alignment file here"); - textarea.addMouseListener(this); - this.setLayout(borderLayout1); - accept.addActionListener(this); - addSequences.addActionListener(this); - cancel.addActionListener(this); - this.add(buttonPanel, BorderLayout.SOUTH); - buttonPanel.add(accept, null); - buttonPanel.add(addSequences); - buttonPanel.add(cancel, null); - this.add(textarea, java.awt.BorderLayout.CENTER); - } - - public void mousePressed(MouseEvent evt) - { - if (textarea.getText().startsWith("Paste your")) - { - textarea.setText(""); - } - } - - public void mouseReleased(MouseEvent evt) - {} - - public void mouseClicked(MouseEvent evt) - {} - - public void mouseEntered(MouseEvent evt) - {} - - public void mouseExited(MouseEvent evt) - {} -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.appletgui; + +import java.awt.*; +import java.awt.event.*; + +import jalview.datamodel.*; +import jalview.io.*; + +public class CutAndPasteTransfer + extends Panel implements ActionListener, MouseListener +{ + boolean pdbImport = false; + boolean treeImport = false; + boolean annotationImport = false; + Sequence seq; + AlignFrame alignFrame; + + public CutAndPasteTransfer(boolean forImport, AlignFrame alignFrame) + { + try + { + jbInit(); + } + catch (Exception e) + { + e.printStackTrace(); + } + + this.alignFrame = alignFrame; + + if (!forImport) + { + buttonPanel.setVisible(false); + } + } + + public String getText() + { + return textarea.getText(); + } + + public void setText(String text) + { + textarea.setText(text); + } + + public void setPDBImport(Sequence seq) + { + this.seq = seq; + accept.setLabel("Accept"); + addSequences.setVisible(false); + pdbImport = true; + } + + public void setTreeImport() + { + treeImport = true; + accept.setLabel("Accept"); + addSequences.setVisible(false); + } + + public void setAnnotationImport() + { + annotationImport = true; + accept.setLabel("Accept"); + addSequences.setVisible(false); + } + + public void actionPerformed(ActionEvent evt) + { + if (evt.getSource() == accept) + { + ok(true); + } + else if (evt.getSource() == addSequences) + { + ok(false); + } + else if (evt.getSource() == cancel) + { + cancel(); + } + } + + protected void ok(boolean newWindow) + { + String text = getText(); + int length = text.length(); + textarea.append("\n"); + if (textarea.getText().length() == length) + { + String warning = + "\n\n#################################################\n" + + "WARNING!! THIS IS THE MAXIMUM SIZE OF TEXTAREA!!\n" + + "\nCAN'T INPUT FULL ALIGNMENT" + + "\n\nYOU MUST DELETE THIS WARNING TO CONTINUE" + + "\n\nMAKE SURE LAST SEQUENCE PASTED IS COMPLETE" + + "\n#################################################\n"; + textarea.setText(text.substring(0, text.length() - warning.length()) + + warning); + + textarea.setCaretPosition(text.length()); + } + + if (pdbImport) + { + PDBEntry pdb = new PDBEntry(); + pdb.setFile(text); + + if ( alignFrame.alignPanel.av.applet.jmolAvailable ) + new jalview.appletgui.AppletJmol(pdb, + new Sequence[]{seq}, + null, + alignFrame.alignPanel, + AppletFormatAdapter.PASTE); + else + + new MCview.AppletPDBViewer(pdb, + new Sequence[]{seq}, + null, + alignFrame.alignPanel, + AppletFormatAdapter.PASTE); + + } + else if (treeImport) + { + try + { + jalview.io.NewickFile fin = new jalview.io.NewickFile(textarea.getText(), + "Paste"); + + fin.parse(); + if (fin.getTree() != null) + { + alignFrame.loadTree(fin, "Pasted tree file"); + } + + } + catch (Exception ex) + { + textarea.setText("Could not parse Newick file!\n" + ex); + return; + } + } + else if (annotationImport) + { + if (new AnnotationFile().readAnnotationFile( + alignFrame.viewport.alignment, textarea.getText(), + jalview.io.AppletFormatAdapter.PASTE)) + { + alignFrame.alignPanel.fontChanged(); + alignFrame.alignPanel.setScrollValues(0, 0); + + } + else + { + alignFrame.parseFeaturesFile(textarea.getText(), + jalview.io.AppletFormatAdapter.PASTE); + } + } + else if (alignFrame != null) + { + Alignment al = null; + + String format = new IdentifyFile().Identify(text, + AppletFormatAdapter.PASTE); + try + { + al = new AppletFormatAdapter().readFile(text, AppletFormatAdapter.PASTE, + format); + } + catch (java.io.IOException ex) + { + ex.printStackTrace(); + } + + if (al != null) + { + if (newWindow) + { + AlignFrame af = new AlignFrame(al, alignFrame.viewport.applet, + "Cut & Paste input - " + format, + false); + af.statusBar.setText("Successfully pasted alignment file"); + } + else + { + alignFrame.addSequences(al.getSequencesArray()); + } + } + } + + if (this.getParent() instanceof Frame) + { + ( (Frame)this.getParent()).setVisible(false); + } + else + { + ( (Dialog)this.getParent()).setVisible(false); + } + } + + protected void cancel() + { + textarea.setText(""); + if (this.getParent() instanceof Frame) + { + ( (Frame)this.getParent()).setVisible(false); + } + else + { + ( (Dialog)this.getParent()).setVisible(false); + } + } + + protected TextArea textarea = new TextArea(); + Button accept = new Button("New Window"); + Button addSequences = new Button("Add to Current Alignment"); + Button cancel = new Button("Close"); + + protected Panel buttonPanel = new Panel(); + BorderLayout borderLayout1 = new BorderLayout(); + + private void jbInit() + throws Exception + { + textarea.setFont(new java.awt.Font("Monospaced", Font.PLAIN, 10)); + textarea.setText("Paste your alignment file here"); + textarea.addMouseListener(this); + this.setLayout(borderLayout1); + accept.addActionListener(this); + addSequences.addActionListener(this); + cancel.addActionListener(this); + this.add(buttonPanel, BorderLayout.SOUTH); + buttonPanel.add(accept, null); + buttonPanel.add(addSequences); + buttonPanel.add(cancel, null); + this.add(textarea, java.awt.BorderLayout.CENTER); + } + + public void mousePressed(MouseEvent evt) + { + if (textarea.getText().startsWith("Paste your")) + { + textarea.setText(""); + } + } + + public void mouseReleased(MouseEvent evt) + {} + + public void mouseClicked(MouseEvent evt) + {} + + public void mouseEntered(MouseEvent evt) + {} + + public void mouseExited(MouseEvent evt) + {} +} diff --git a/src/jalview/appletgui/EditNameDialog.java b/src/jalview/appletgui/EditNameDialog.java index 46325d9..252ced6 100644 --- a/src/jalview/appletgui/EditNameDialog.java +++ b/src/jalview/appletgui/EditNameDialog.java @@ -1,84 +1,83 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -package jalview.appletgui; - -import java.awt.*; - - -public class EditNameDialog extends JVDialog -{ - TextField id, description; - - public String getName() - { - return id.getText(); - } - - public String getDescription() - { - if (description.getText().length() < 1) - { - return null; - } - else - { - return description.getText(); - } - } - - public EditNameDialog(String name, - String desc, - String label1, - String label2, - Frame owner, - String title, - int width, int height, boolean display) - { - super(owner, title, true, width, height); - - Font mono = new Font("Monospaced", Font.PLAIN, 12); - Panel panel = new Panel(new BorderLayout()); - Panel panel2 = new Panel(new BorderLayout()); - - id = new TextField(name, 40); - id.setFont(mono); - Label label = new Label(label1); - label.setFont(mono); - - panel2.add(label, BorderLayout.WEST); - panel2.add(id, BorderLayout.CENTER); - panel.add(panel2, BorderLayout.NORTH); - - - if(label2!=null) - { - panel2 = new Panel(new BorderLayout()); - description = new TextField(desc, 40); - description.setFont(mono); - label = new Label(label2); - label.setFont(mono); - panel2.add(label, BorderLayout.WEST); - panel2.add(description, BorderLayout.CENTER); - panel.add(panel2, BorderLayout.CENTER); - } - setMainPanel(panel); - setVisible(display); - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.appletgui; + +import java.awt.*; + + +public class EditNameDialog extends JVDialog +{ + TextField id, description; + + public String getName() + { + return id.getText(); + } + + public String getDescription() + { + if (description.getText().length() < 1) + { + return null; + } + else + { + return description.getText(); + } + } + + public EditNameDialog(String name, + String desc, + String label1, + String label2, + Frame owner, + String title, + int width, int height, boolean display) + { + super(owner, title, true, width, height); + + Font mono = new Font("Monospaced", Font.PLAIN, 12); + Panel panel = new Panel(new BorderLayout()); + Panel panel2 = new Panel(new BorderLayout()); + + id = new TextField(name, 40); + id.setFont(mono); + Label label = new Label(label1); + label.setFont(mono); + + panel2.add(label, BorderLayout.WEST); + panel2.add(id, BorderLayout.CENTER); + panel.add(panel2, BorderLayout.NORTH); + + + if(label2!=null) + { + panel2 = new Panel(new BorderLayout()); + description = new TextField(desc, 40); + description.setFont(mono); + label = new Label(label2); + label.setFont(mono); + panel2.add(label, BorderLayout.WEST); + panel2.add(description, BorderLayout.CENTER); + panel.add(panel2, BorderLayout.CENTER); + } + setMainPanel(panel); + setVisible(display); + } +} diff --git a/src/jalview/appletgui/EmbmenuFrame.java b/src/jalview/appletgui/EmbmenuFrame.java index 23f6aa2..a138aa7 100644 --- a/src/jalview/appletgui/EmbmenuFrame.java +++ b/src/jalview/appletgui/EmbmenuFrame.java @@ -1,3 +1,21 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ package jalview.appletgui; import java.awt.BorderLayout; @@ -258,4 +276,4 @@ public class EmbmenuFrame extends Frame implements MouseListener embeddedMenu=null; super.finalize(); } -} \ No newline at end of file +} diff --git a/src/jalview/appletgui/FeatureRenderer.java b/src/jalview/appletgui/FeatureRenderer.java index 5e65409..7e9003d 100755 --- a/src/jalview/appletgui/FeatureRenderer.java +++ b/src/jalview/appletgui/FeatureRenderer.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/appletgui/FeatureSettings.java b/src/jalview/appletgui/FeatureSettings.java index 6670d2f..fc7ee2b 100755 --- a/src/jalview/appletgui/FeatureSettings.java +++ b/src/jalview/appletgui/FeatureSettings.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/appletgui/Finder.java b/src/jalview/appletgui/Finder.java index 9e974e9..1c38a41 100755 --- a/src/jalview/appletgui/Finder.java +++ b/src/jalview/appletgui/Finder.java @@ -1,22 +1,21 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.appletgui; import java.util.*; diff --git a/src/jalview/appletgui/FontChooser.java b/src/jalview/appletgui/FontChooser.java index 87fa50f..a622ffd 100755 --- a/src/jalview/appletgui/FontChooser.java +++ b/src/jalview/appletgui/FontChooser.java @@ -1,268 +1,267 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -package jalview.appletgui; - -import java.awt.*; -import java.awt.event.*; - -public class FontChooser - extends Panel implements ActionListener, ItemListener -{ - AlignmentPanel ap; - TreePanel tp; - Font oldFont; - boolean init = true; - Frame frame; - - public FontChooser(TreePanel tp) - { - try - { - jbInit(); - } - catch (Exception e) - { - e.printStackTrace(); - } - - this.tp = tp; - oldFont = tp.getTreeFont(); - init(); - } - - public FontChooser(AlignmentPanel ap) - { - try - { - jbInit(); - } - catch (Exception e) - { - e.printStackTrace(); - } - - this.ap = ap; - oldFont = ap.av.getFont(); - init(); - } - - void init() - { - String fonts[] = Toolkit.getDefaultToolkit().getFontList(); - for (int i = 0; i < fonts.length; i++) - { - fontName.addItem(fonts[i]); - } - - for (int i = 1; i < 31; i++) - { - fontSize.addItem(i + ""); - } - - fontStyle.addItem("plain"); - fontStyle.addItem("bold"); - fontStyle.addItem("italic"); - - fontName.select(oldFont.getName()); - fontSize.select(oldFont.getSize() + ""); - fontStyle.select(oldFont.getStyle()); - - Frame frame = new Frame(); - this.frame = frame; - frame.add(this); - jalview.bin.JalviewLite.addFrame(frame, "Change Font", 440, 115); - - init = false; - } - - public void actionPerformed(ActionEvent evt) - { - if (evt.getSource() == ok) - { - ok_actionPerformed(); - } - else if (evt.getSource() == cancel) - { - cancel_actionPerformed(); - } - } - - public void itemStateChanged(ItemEvent evt) - { - if (evt.getSource() == fontName) - { - fontName_actionPerformed(); - } - else if (evt.getSource() == fontSize) - { - fontSize_actionPerformed(); - } - else if (evt.getSource() == fontStyle) - { - fontStyle_actionPerformed(); - } - } - - protected void ok_actionPerformed() - { - frame.setVisible(false); - if (ap != null) - { - if (ap.getOverviewPanel() != null) - { - ap.getOverviewPanel().updateOverviewImage(); - } - } - - } - - protected void cancel_actionPerformed() - { - if (ap != null) - { - ap.av.setFont(oldFont); - ap.paintAlignment(true); - } - else if (tp != null) - { - tp.setTreeFont(oldFont); - tp.treeCanvas.repaint(); - } - - fontName.select(oldFont.getName()); - fontSize.select(oldFont.getSize() + ""); - fontStyle.select(oldFont.getStyle()); - - frame.setVisible(false); - } - - void changeFont() - { - Font newFont = new Font(fontName.getSelectedItem().toString(), - fontStyle.getSelectedIndex(), - Integer.parseInt(fontSize.getSelectedItem(). - toString()) - ); - if (ap != null) - { - ap.av.setFont(newFont); - ap.fontChanged(); - } - else if (tp != null) - { - tp.setTreeFont(newFont); - } - } - - protected void fontName_actionPerformed() - { - if (init) - { - return; - } - changeFont(); - } - - protected void fontSize_actionPerformed() - { - if (init) - { - return; - } - changeFont(); - } - - protected void fontStyle_actionPerformed() - { - if (init) - { - return; - } - changeFont(); - } - - Label label1 = new Label(); - protected Choice fontSize = new Choice(); - protected Choice fontStyle = new Choice(); - Label label2 = new Label(); - Label label3 = new Label(); - protected Choice fontName = new Choice(); - Button ok = new Button(); - Button cancel = new Button(); - Panel panel1 = new Panel(); - Panel panel2 = new Panel(); - Panel panel3 = new Panel(); - BorderLayout borderLayout1 = new BorderLayout(); - BorderLayout borderLayout2 = new BorderLayout(); - BorderLayout borderLayout3 = new BorderLayout(); - Panel panel4 = new Panel(); - Panel panel5 = new Panel(); - BorderLayout borderLayout4 = new BorderLayout(); - - private void jbInit() - throws Exception - { - label1.setFont(new java.awt.Font("Verdana", 0, 11)); - label1.setAlignment(Label.RIGHT); - label1.setText("Font: "); - this.setLayout(borderLayout4); - fontSize.setFont(new java.awt.Font("Verdana", 0, 11)); - fontSize.addItemListener(this); - fontStyle.setFont(new java.awt.Font("Verdana", 0, 11)); - fontStyle.addItemListener(this); - label2.setAlignment(Label.RIGHT); - label2.setFont(new java.awt.Font("Verdana", 0, 11)); - label2.setText("Size: "); - label3.setAlignment(Label.RIGHT); - label3.setFont(new java.awt.Font("Verdana", 0, 11)); - label3.setText("Style: "); - fontName.setFont(new java.awt.Font("Verdana", 0, 11)); - fontName.addItemListener(this); - ok.setFont(new java.awt.Font("Verdana", 0, 11)); - ok.setLabel("OK"); - ok.addActionListener(this); - cancel.setFont(new java.awt.Font("Verdana", 0, 11)); - cancel.setLabel("Cancel"); - cancel.addActionListener(this); - this.setBackground(Color.white); - panel1.setLayout(borderLayout1); - panel2.setLayout(borderLayout3); - panel3.setLayout(borderLayout2); - panel5.setBackground(Color.white); - panel4.setBackground(Color.white); - panel1.setBackground(Color.white); - panel2.setBackground(Color.white); - panel3.setBackground(Color.white); - panel1.add(label1, BorderLayout.WEST); - panel1.add(fontName, BorderLayout.CENTER); - panel5.add(panel1, null); - panel5.add(panel3, null); - panel5.add(panel2, null); - panel2.add(label3, BorderLayout.WEST); - panel2.add(fontStyle, BorderLayout.CENTER); - panel3.add(label2, BorderLayout.WEST); - panel3.add(fontSize, BorderLayout.CENTER); - this.add(panel4, BorderLayout.SOUTH); - panel4.add(ok, null); - panel4.add(cancel, null); - this.add(panel5, BorderLayout.CENTER); - } - -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.appletgui; + +import java.awt.*; +import java.awt.event.*; + +public class FontChooser + extends Panel implements ActionListener, ItemListener +{ + AlignmentPanel ap; + TreePanel tp; + Font oldFont; + boolean init = true; + Frame frame; + + public FontChooser(TreePanel tp) + { + try + { + jbInit(); + } + catch (Exception e) + { + e.printStackTrace(); + } + + this.tp = tp; + oldFont = tp.getTreeFont(); + init(); + } + + public FontChooser(AlignmentPanel ap) + { + try + { + jbInit(); + } + catch (Exception e) + { + e.printStackTrace(); + } + + this.ap = ap; + oldFont = ap.av.getFont(); + init(); + } + + void init() + { + String fonts[] = Toolkit.getDefaultToolkit().getFontList(); + for (int i = 0; i < fonts.length; i++) + { + fontName.addItem(fonts[i]); + } + + for (int i = 1; i < 31; i++) + { + fontSize.addItem(i + ""); + } + + fontStyle.addItem("plain"); + fontStyle.addItem("bold"); + fontStyle.addItem("italic"); + + fontName.select(oldFont.getName()); + fontSize.select(oldFont.getSize() + ""); + fontStyle.select(oldFont.getStyle()); + + Frame frame = new Frame(); + this.frame = frame; + frame.add(this); + jalview.bin.JalviewLite.addFrame(frame, "Change Font", 440, 115); + + init = false; + } + + public void actionPerformed(ActionEvent evt) + { + if (evt.getSource() == ok) + { + ok_actionPerformed(); + } + else if (evt.getSource() == cancel) + { + cancel_actionPerformed(); + } + } + + public void itemStateChanged(ItemEvent evt) + { + if (evt.getSource() == fontName) + { + fontName_actionPerformed(); + } + else if (evt.getSource() == fontSize) + { + fontSize_actionPerformed(); + } + else if (evt.getSource() == fontStyle) + { + fontStyle_actionPerformed(); + } + } + + protected void ok_actionPerformed() + { + frame.setVisible(false); + if (ap != null) + { + if (ap.getOverviewPanel() != null) + { + ap.getOverviewPanel().updateOverviewImage(); + } + } + + } + + protected void cancel_actionPerformed() + { + if (ap != null) + { + ap.av.setFont(oldFont); + ap.paintAlignment(true); + } + else if (tp != null) + { + tp.setTreeFont(oldFont); + tp.treeCanvas.repaint(); + } + + fontName.select(oldFont.getName()); + fontSize.select(oldFont.getSize() + ""); + fontStyle.select(oldFont.getStyle()); + + frame.setVisible(false); + } + + void changeFont() + { + Font newFont = new Font(fontName.getSelectedItem().toString(), + fontStyle.getSelectedIndex(), + Integer.parseInt(fontSize.getSelectedItem(). + toString()) + ); + if (ap != null) + { + ap.av.setFont(newFont); + ap.fontChanged(); + } + else if (tp != null) + { + tp.setTreeFont(newFont); + } + } + + protected void fontName_actionPerformed() + { + if (init) + { + return; + } + changeFont(); + } + + protected void fontSize_actionPerformed() + { + if (init) + { + return; + } + changeFont(); + } + + protected void fontStyle_actionPerformed() + { + if (init) + { + return; + } + changeFont(); + } + + Label label1 = new Label(); + protected Choice fontSize = new Choice(); + protected Choice fontStyle = new Choice(); + Label label2 = new Label(); + Label label3 = new Label(); + protected Choice fontName = new Choice(); + Button ok = new Button(); + Button cancel = new Button(); + Panel panel1 = new Panel(); + Panel panel2 = new Panel(); + Panel panel3 = new Panel(); + BorderLayout borderLayout1 = new BorderLayout(); + BorderLayout borderLayout2 = new BorderLayout(); + BorderLayout borderLayout3 = new BorderLayout(); + Panel panel4 = new Panel(); + Panel panel5 = new Panel(); + BorderLayout borderLayout4 = new BorderLayout(); + + private void jbInit() + throws Exception + { + label1.setFont(new java.awt.Font("Verdana", 0, 11)); + label1.setAlignment(Label.RIGHT); + label1.setText("Font: "); + this.setLayout(borderLayout4); + fontSize.setFont(new java.awt.Font("Verdana", 0, 11)); + fontSize.addItemListener(this); + fontStyle.setFont(new java.awt.Font("Verdana", 0, 11)); + fontStyle.addItemListener(this); + label2.setAlignment(Label.RIGHT); + label2.setFont(new java.awt.Font("Verdana", 0, 11)); + label2.setText("Size: "); + label3.setAlignment(Label.RIGHT); + label3.setFont(new java.awt.Font("Verdana", 0, 11)); + label3.setText("Style: "); + fontName.setFont(new java.awt.Font("Verdana", 0, 11)); + fontName.addItemListener(this); + ok.setFont(new java.awt.Font("Verdana", 0, 11)); + ok.setLabel("OK"); + ok.addActionListener(this); + cancel.setFont(new java.awt.Font("Verdana", 0, 11)); + cancel.setLabel("Cancel"); + cancel.addActionListener(this); + this.setBackground(Color.white); + panel1.setLayout(borderLayout1); + panel2.setLayout(borderLayout3); + panel3.setLayout(borderLayout2); + panel5.setBackground(Color.white); + panel4.setBackground(Color.white); + panel1.setBackground(Color.white); + panel2.setBackground(Color.white); + panel3.setBackground(Color.white); + panel1.add(label1, BorderLayout.WEST); + panel1.add(fontName, BorderLayout.CENTER); + panel5.add(panel1, null); + panel5.add(panel3, null); + panel5.add(panel2, null); + panel2.add(label3, BorderLayout.WEST); + panel2.add(fontStyle, BorderLayout.CENTER); + panel3.add(label2, BorderLayout.WEST); + panel3.add(fontSize, BorderLayout.CENTER); + this.add(panel4, BorderLayout.SOUTH); + panel4.add(ok, null); + panel4.add(cancel, null); + this.add(panel5, BorderLayout.CENTER); + } + +} diff --git a/src/jalview/appletgui/IdCanvas.java b/src/jalview/appletgui/IdCanvas.java index bec3c63..3093087 100755 --- a/src/jalview/appletgui/IdCanvas.java +++ b/src/jalview/appletgui/IdCanvas.java @@ -1,22 +1,21 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.appletgui; import java.awt.*; diff --git a/src/jalview/appletgui/IdPanel.java b/src/jalview/appletgui/IdPanel.java index 44a03ec..5bfde8d 100755 --- a/src/jalview/appletgui/IdPanel.java +++ b/src/jalview/appletgui/IdPanel.java @@ -1,22 +1,21 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.appletgui; import java.awt.*; diff --git a/src/jalview/appletgui/IdwidthAdjuster.java b/src/jalview/appletgui/IdwidthAdjuster.java index 052a95e..685ea60 100755 --- a/src/jalview/appletgui/IdwidthAdjuster.java +++ b/src/jalview/appletgui/IdwidthAdjuster.java @@ -1,104 +1,103 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -package jalview.appletgui; - -import java.awt.*; -import java.awt.event.*; - -public class IdwidthAdjuster - extends Panel implements MouseListener, MouseMotionListener -{ - boolean active = false; - int oldX = 0; - Image image; - AlignmentPanel ap; - - public IdwidthAdjuster(AlignmentPanel ap) - { - setLayout(null); - this.ap = ap; - java.net.URL url = getClass().getResource("/images/idwidth.gif"); - if (url != null) - { - image = java.awt.Toolkit.getDefaultToolkit().getImage(url); - } - - addMouseListener(this); - addMouseMotionListener(this); - } - - public void mousePressed(MouseEvent evt) - { - oldX = evt.getX(); - } - - public void mouseReleased(MouseEvent evt) - { - active = false; - repaint(); - } - - public void mouseEntered(MouseEvent evt) - { - active = true; - repaint(); - } - - public void mouseExited(MouseEvent evt) - { - active = false; - repaint(); - } - - public void mouseDragged(MouseEvent evt) - { - active = true; - Dimension d = ap.idPanel.idCanvas.getSize(); - int dif = evt.getX() - oldX; - - if (d.width + dif > 20 || dif > 0) - { - ap.setIdWidth(d.width + dif, d.height); - this.setSize(d.width + dif, getSize().height); - } - - oldX = evt.getX(); - } - - public void mouseMoved(MouseEvent evt) - {} - - public void mouseClicked(MouseEvent evt) - {} - - public void paint(Graphics g) - { - g.setColor(Color.white); - g.fillRect(0, 0, getSize().width, getSize().height); - if (active) - { - if (image != null) - { - g.drawImage(image, getSize().width - 20, 2, this); - } - } - } - -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.appletgui; + +import java.awt.*; +import java.awt.event.*; + +public class IdwidthAdjuster + extends Panel implements MouseListener, MouseMotionListener +{ + boolean active = false; + int oldX = 0; + Image image; + AlignmentPanel ap; + + public IdwidthAdjuster(AlignmentPanel ap) + { + setLayout(null); + this.ap = ap; + java.net.URL url = getClass().getResource("/images/idwidth.gif"); + if (url != null) + { + image = java.awt.Toolkit.getDefaultToolkit().getImage(url); + } + + addMouseListener(this); + addMouseMotionListener(this); + } + + public void mousePressed(MouseEvent evt) + { + oldX = evt.getX(); + } + + public void mouseReleased(MouseEvent evt) + { + active = false; + repaint(); + } + + public void mouseEntered(MouseEvent evt) + { + active = true; + repaint(); + } + + public void mouseExited(MouseEvent evt) + { + active = false; + repaint(); + } + + public void mouseDragged(MouseEvent evt) + { + active = true; + Dimension d = ap.idPanel.idCanvas.getSize(); + int dif = evt.getX() - oldX; + + if (d.width + dif > 20 || dif > 0) + { + ap.setIdWidth(d.width + dif, d.height); + this.setSize(d.width + dif, getSize().height); + } + + oldX = evt.getX(); + } + + public void mouseMoved(MouseEvent evt) + {} + + public void mouseClicked(MouseEvent evt) + {} + + public void paint(Graphics g) + { + g.setColor(Color.white); + g.fillRect(0, 0, getSize().width, getSize().height); + if (active) + { + if (image != null) + { + g.drawImage(image, getSize().width - 20, 2, this); + } + } + } + +} diff --git a/src/jalview/appletgui/JVDialog.java b/src/jalview/appletgui/JVDialog.java index b8e0abc..520dc2e 100644 --- a/src/jalview/appletgui/JVDialog.java +++ b/src/jalview/appletgui/JVDialog.java @@ -1,79 +1,78 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -package jalview.appletgui; - -import java.awt.*; -import java.awt.event.*; - -public class JVDialog extends Dialog implements ActionListener -{ - AlignmentPanel ap; - Panel buttonPanel; - Button ok = new Button("Accept"); - Button cancel = new Button("Cancel"); - boolean accept = false; - Frame owner; - - public JVDialog(Frame owner, - String title, - boolean modal, - int width, int height) - { - super(owner, title, modal); - this.owner = owner; - - height += owner.getInsets().top + getInsets().bottom; - - setBounds(owner.getBounds().x - + (owner.getSize().width - width) / 2, - owner.getBounds().y - + (owner.getSize().height - height) / 2, - width, height); - } - - void setMainPanel(Panel panel) - { - add(panel, BorderLayout.NORTH); - - buttonPanel = new Panel(new FlowLayout()); - - buttonPanel.add(ok); - buttonPanel.add(cancel); - ok.addActionListener(this); - cancel.addActionListener(this); - - add(buttonPanel, BorderLayout.SOUTH); - - pack(); - - } - - public void actionPerformed(ActionEvent evt) - { - if (evt.getSource() == ok) - { - accept = true; - } - - setVisible(false); - } - - -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.appletgui; + +import java.awt.*; +import java.awt.event.*; + +public class JVDialog extends Dialog implements ActionListener +{ + AlignmentPanel ap; + Panel buttonPanel; + Button ok = new Button("Accept"); + Button cancel = new Button("Cancel"); + boolean accept = false; + Frame owner; + + public JVDialog(Frame owner, + String title, + boolean modal, + int width, int height) + { + super(owner, title, modal); + this.owner = owner; + + height += owner.getInsets().top + getInsets().bottom; + + setBounds(owner.getBounds().x + + (owner.getSize().width - width) / 2, + owner.getBounds().y + + (owner.getSize().height - height) / 2, + width, height); + } + + void setMainPanel(Panel panel) + { + add(panel, BorderLayout.NORTH); + + buttonPanel = new Panel(new FlowLayout()); + + buttonPanel.add(ok); + buttonPanel.add(cancel); + ok.addActionListener(this); + cancel.addActionListener(this); + + add(buttonPanel, BorderLayout.SOUTH); + + pack(); + + } + + public void actionPerformed(ActionEvent evt) + { + if (evt.getSource() == ok) + { + accept = true; + } + + setVisible(false); + } + + +} diff --git a/src/jalview/appletgui/OverviewPanel.java b/src/jalview/appletgui/OverviewPanel.java index 7265489..3f20d16 100755 --- a/src/jalview/appletgui/OverviewPanel.java +++ b/src/jalview/appletgui/OverviewPanel.java @@ -1,449 +1,448 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -package jalview.appletgui; - -import java.awt.*; -import java.awt.event.*; - -public class OverviewPanel - extends Panel implements Runnable, MouseMotionListener, MouseListener -{ - Image miniMe; - Image offscreen; - AlignViewport av; - AlignmentPanel ap; - float scalew = 1f; - float scaleh = 1f; - - public int width, sequencesHeight; - int graphHeight = 20; - int boxX = -1, boxY = -1, boxWidth = -1, boxHeight = -1; - - boolean resizing = false; - - // Can set different properties in this seqCanvas than - // main visible SeqCanvas - SequenceRenderer sr; - FeatureRenderer fr; - - Frame nullFrame; - - public OverviewPanel(AlignmentPanel ap) - { - this.av = ap.av; - this.ap = ap; - setLayout(null); - nullFrame = new Frame(); - nullFrame.addNotify(); - - sr = new SequenceRenderer(av); - sr.graphics = nullFrame.getGraphics(); - sr.renderGaps = false; - sr.forOverview = true; - fr = new FeatureRenderer(av); - fr.overview = true; - - // scale the initial size of overviewpanel to shape of alignment - float initialScale = (float) av.alignment.getWidth() / - (float) av.alignment.getHeight(); - - if (av.hconsensus == null) - { - graphHeight = 0; - } - - if (av.alignment.getWidth() > av.alignment.getHeight()) - { - // wider - width = 400; - sequencesHeight = (int) (400f / initialScale); - if (sequencesHeight < 40) - { - sequencesHeight = 40; - } - } - else - { - // taller - width = (int) (400f * initialScale); - sequencesHeight = 300; - if (width < 120) - { - width = 120; - } - } - - setSize(new Dimension(width, sequencesHeight + graphHeight)); - addComponentListener(new ComponentAdapter() - { - - public void componentResized(ComponentEvent evt) - { - if (getSize().width != width || - getSize().height != sequencesHeight + graphHeight) - { - updateOverviewImage(); - } - } - }); - - addMouseMotionListener(this); - - addMouseListener(this); - - updateOverviewImage(); - - } - - public void mouseEntered(MouseEvent evt) - {} - - public void mouseExited(MouseEvent evt) - {} - - public void mouseClicked(MouseEvent evt) - {} - - public void mouseMoved(MouseEvent evt) - {} - - public void mousePressed(MouseEvent evt) - { - boxX = evt.getX(); - boxY = evt.getY(); - checkValid(); - } - - public void mouseReleased(MouseEvent evt) - { - boxX = evt.getX(); - boxY = evt.getY(); - checkValid(); - } - - public void mouseDragged(MouseEvent evt) - { - boxX = evt.getX(); - boxY = evt.getY(); - checkValid(); - } - - void checkValid() - { - if (boxY < 0) - { - boxY = 0; - } - - if (boxY > (sequencesHeight - boxHeight)) - { - boxY = sequencesHeight - boxHeight + 1; - } - - if (boxX < 0) - { - boxX = 0; - } - - if (boxX > (width - boxWidth)) - { - if (av.hasHiddenColumns) - { - //Try smallest possible box - boxWidth = (int) ( (av.endRes - av.startRes + 1) * - av.getCharWidth() * scalew); - } - boxX = width - boxWidth; - } - - int col = (int) (boxX / scalew / av.getCharWidth()); - int row = (int) (boxY / scaleh / av.getCharHeight()); - - if (av.hasHiddenColumns) - { - if (!av.getColumnSelection().isVisible(col)) - { - return; - } - - col = av.getColumnSelection().findColumnPosition(col); - } - - if (av.hasHiddenRows) - { - row = av.alignment.getHiddenSequences().findIndexWithoutHiddenSeqs(row); - } - - ap.setScrollValues(col, row); - ap.paintAlignment(false); - } - - /** - * DOCUMENT ME! - */ - public void updateOverviewImage() - { - if (resizing) - { - resizeAgain = true; - return; - } - - if (av.showSequenceFeatures) - { - fr.featureGroups = ap.seqPanel.seqCanvas.getFeatureRenderer(). - featureGroups; - fr.featureColours = ap.seqPanel.seqCanvas.getFeatureRenderer(). - featureColours; - } - - resizing = true; - - if ( (getSize().width > 0) && (getSize().height > 0)) - { - width = getSize().width; - sequencesHeight = getSize().height - graphHeight; - } - setSize(new Dimension(width, sequencesHeight + graphHeight)); - - Thread thread = new Thread(this); - thread.start(); - repaint(); - } - - // This is set true if the user resizes whilst - // the overview is being calculated - boolean resizeAgain = false; - - public void run() - { - miniMe = null; - int alwidth = av.alignment.getWidth(); - int alheight = av.alignment.getHeight(); - - if (av.showSequenceFeatures) - { - fr.transferSettings(ap.seqPanel.seqCanvas.getFeatureRenderer()); - } - - if (getSize().width > 0 && getSize().height > 0) - { - width = getSize().width; - sequencesHeight = getSize().height - graphHeight; - } - - setSize(new Dimension(width, sequencesHeight + graphHeight)); - - int fullsizeWidth = alwidth * av.getCharWidth(); - int fullsizeHeight = alheight * av.getCharHeight(); - - scalew = (float) width / (float) fullsizeWidth; - scaleh = (float) sequencesHeight / (float) fullsizeHeight; - - miniMe = nullFrame.createImage(width, sequencesHeight + graphHeight); - offscreen = nullFrame.createImage(width, sequencesHeight + graphHeight); - - Graphics mg = miniMe.getGraphics(); - float sampleCol = (float) alwidth / (float) width; - float sampleRow = (float) alheight / (float) sequencesHeight; - - int lastcol = 0, lastrow = 0; - int xstart = 0, ystart = 0; - Color color = Color.yellow; - int row, col, sameRow = 0, sameCol = 0; - jalview.datamodel.SequenceI seq; - boolean hiddenRow = false; - for (row = 0; row <= sequencesHeight; row++) - { - if ( (int) (row * sampleRow) == lastrow) - { - sameRow++; - continue; - } - - hiddenRow = false; - if (av.hasHiddenRows) - { - seq = av.alignment.getHiddenSequences().getHiddenSequence(lastrow); - if (seq == null) - { - int index = - av.alignment.getHiddenSequences().findIndexWithoutHiddenSeqs( - lastrow); - - seq = av.alignment.getSequenceAt(index); - } - else - { - hiddenRow = true; - } - } - else - { - seq = av.alignment.getSequenceAt(lastrow); - } - - for (col = 0; col < width; col++) - { - if ( (int) (col * sampleCol) == lastcol && - (int) (row * sampleRow) == lastrow) - { - sameCol++; - continue; - } - - lastcol = (int) (col * sampleCol); - - if (seq.getLength() > lastcol) - { - color = sr.getResidueBoxColour( - seq, lastcol); - - if (av.showSequenceFeatures) - { - color = fr.findFeatureColour(color, seq, lastcol); - } - } - else - { - color = Color.white; //White - } - - if (hiddenRow || - (av.hasHiddenColumns && !av.getColumnSelection().isVisible(lastcol))) - { - color = color.darker().darker(); - } - - mg.setColor(color); - if (sameCol == 1 && sameRow == 1) - { - mg.drawLine(xstart, ystart, xstart, ystart); - } - else - { - mg.fillRect(xstart, ystart, sameCol, sameRow); - } - - xstart = col; - sameCol = 1; - } - lastrow = (int) (row * sampleRow); - ystart = row; - sameRow = 1; - } - - if (av.conservation != null) - { - for (col = 0; col < width; col++) - { - lastcol = (int) (col * sampleCol); - { - mg.translate(col, sequencesHeight); - ap.annotationPanel.drawGraph(mg, av.conservation, - (int) (sampleCol) + 1, - graphHeight, - (int) (col * sampleCol), - (int) (col * sampleCol) + 1); - mg.translate( -col, -sequencesHeight); - } - } - } - System.gc(); - - resizing = false; - - setBoxPosition(); - - if (resizeAgain) - { - resizeAgain = false; - updateOverviewImage(); - } - } - - public void setBoxPosition() - { - int fullsizeWidth = av.alignment.getWidth() * av.getCharWidth(); - int fullsizeHeight = (av.alignment.getHeight() - + av.alignment.getHiddenSequences().getSize()) * - av.getCharHeight(); - - int startRes = av.getStartRes(); - int endRes = av.getEndRes(); - - if (av.hasHiddenColumns) - { - startRes = av.getColumnSelection().adjustForHiddenColumns(startRes); - endRes = av.getColumnSelection().adjustForHiddenColumns(endRes); - } - - int startSeq = av.startSeq; - int endSeq = av.endSeq; - - if (av.hasHiddenRows) - { - startSeq = - av.alignment.getHiddenSequences().adjustForHiddenSeqs(startSeq); - - endSeq = - av.alignment.getHiddenSequences().adjustForHiddenSeqs(endSeq); - - } - - scalew = (float) width / (float) fullsizeWidth; - scaleh = (float) sequencesHeight / (float) fullsizeHeight; - - boxX = (int) (startRes * av.getCharWidth() * scalew); - boxY = (int) (startSeq * av.getCharHeight() * scaleh); - - if (av.hasHiddenColumns) - { - boxWidth = (int) ( (endRes - startRes + 1) * av.getCharWidth() * scalew); - } - else - { - boxWidth = (int) ( (endRes - startRes + 1) * av.getCharWidth() * scalew); - } - - boxHeight = (int) ( (endSeq - startSeq) * av.getCharHeight() * scaleh); - - repaint(); - } - - public void update(Graphics g) - { - paint(g); - } - - public void paint(Graphics g) - { - Graphics og = offscreen.getGraphics(); - if (miniMe != null) - { - og.drawImage(miniMe, 0, 0, this); - og.setColor(Color.red); - og.drawRect(boxX, boxY, boxWidth, boxHeight); - og.drawRect(boxX + 1, boxY + 1, boxWidth - 2, boxHeight - 2); - g.drawImage(offscreen, 0, 0, this); - } - } - -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.appletgui; + +import java.awt.*; +import java.awt.event.*; + +public class OverviewPanel + extends Panel implements Runnable, MouseMotionListener, MouseListener +{ + Image miniMe; + Image offscreen; + AlignViewport av; + AlignmentPanel ap; + float scalew = 1f; + float scaleh = 1f; + + public int width, sequencesHeight; + int graphHeight = 20; + int boxX = -1, boxY = -1, boxWidth = -1, boxHeight = -1; + + boolean resizing = false; + + // Can set different properties in this seqCanvas than + // main visible SeqCanvas + SequenceRenderer sr; + FeatureRenderer fr; + + Frame nullFrame; + + public OverviewPanel(AlignmentPanel ap) + { + this.av = ap.av; + this.ap = ap; + setLayout(null); + nullFrame = new Frame(); + nullFrame.addNotify(); + + sr = new SequenceRenderer(av); + sr.graphics = nullFrame.getGraphics(); + sr.renderGaps = false; + sr.forOverview = true; + fr = new FeatureRenderer(av); + fr.overview = true; + + // scale the initial size of overviewpanel to shape of alignment + float initialScale = (float) av.alignment.getWidth() / + (float) av.alignment.getHeight(); + + if (av.hconsensus == null) + { + graphHeight = 0; + } + + if (av.alignment.getWidth() > av.alignment.getHeight()) + { + // wider + width = 400; + sequencesHeight = (int) (400f / initialScale); + if (sequencesHeight < 40) + { + sequencesHeight = 40; + } + } + else + { + // taller + width = (int) (400f * initialScale); + sequencesHeight = 300; + if (width < 120) + { + width = 120; + } + } + + setSize(new Dimension(width, sequencesHeight + graphHeight)); + addComponentListener(new ComponentAdapter() + { + + public void componentResized(ComponentEvent evt) + { + if (getSize().width != width || + getSize().height != sequencesHeight + graphHeight) + { + updateOverviewImage(); + } + } + }); + + addMouseMotionListener(this); + + addMouseListener(this); + + updateOverviewImage(); + + } + + public void mouseEntered(MouseEvent evt) + {} + + public void mouseExited(MouseEvent evt) + {} + + public void mouseClicked(MouseEvent evt) + {} + + public void mouseMoved(MouseEvent evt) + {} + + public void mousePressed(MouseEvent evt) + { + boxX = evt.getX(); + boxY = evt.getY(); + checkValid(); + } + + public void mouseReleased(MouseEvent evt) + { + boxX = evt.getX(); + boxY = evt.getY(); + checkValid(); + } + + public void mouseDragged(MouseEvent evt) + { + boxX = evt.getX(); + boxY = evt.getY(); + checkValid(); + } + + void checkValid() + { + if (boxY < 0) + { + boxY = 0; + } + + if (boxY > (sequencesHeight - boxHeight)) + { + boxY = sequencesHeight - boxHeight + 1; + } + + if (boxX < 0) + { + boxX = 0; + } + + if (boxX > (width - boxWidth)) + { + if (av.hasHiddenColumns) + { + //Try smallest possible box + boxWidth = (int) ( (av.endRes - av.startRes + 1) * + av.getCharWidth() * scalew); + } + boxX = width - boxWidth; + } + + int col = (int) (boxX / scalew / av.getCharWidth()); + int row = (int) (boxY / scaleh / av.getCharHeight()); + + if (av.hasHiddenColumns) + { + if (!av.getColumnSelection().isVisible(col)) + { + return; + } + + col = av.getColumnSelection().findColumnPosition(col); + } + + if (av.hasHiddenRows) + { + row = av.alignment.getHiddenSequences().findIndexWithoutHiddenSeqs(row); + } + + ap.setScrollValues(col, row); + ap.paintAlignment(false); + } + + /** + * DOCUMENT ME! + */ + public void updateOverviewImage() + { + if (resizing) + { + resizeAgain = true; + return; + } + + if (av.showSequenceFeatures) + { + fr.featureGroups = ap.seqPanel.seqCanvas.getFeatureRenderer(). + featureGroups; + fr.featureColours = ap.seqPanel.seqCanvas.getFeatureRenderer(). + featureColours; + } + + resizing = true; + + if ( (getSize().width > 0) && (getSize().height > 0)) + { + width = getSize().width; + sequencesHeight = getSize().height - graphHeight; + } + setSize(new Dimension(width, sequencesHeight + graphHeight)); + + Thread thread = new Thread(this); + thread.start(); + repaint(); + } + + // This is set true if the user resizes whilst + // the overview is being calculated + boolean resizeAgain = false; + + public void run() + { + miniMe = null; + int alwidth = av.alignment.getWidth(); + int alheight = av.alignment.getHeight(); + + if (av.showSequenceFeatures) + { + fr.transferSettings(ap.seqPanel.seqCanvas.getFeatureRenderer()); + } + + if (getSize().width > 0 && getSize().height > 0) + { + width = getSize().width; + sequencesHeight = getSize().height - graphHeight; + } + + setSize(new Dimension(width, sequencesHeight + graphHeight)); + + int fullsizeWidth = alwidth * av.getCharWidth(); + int fullsizeHeight = alheight * av.getCharHeight(); + + scalew = (float) width / (float) fullsizeWidth; + scaleh = (float) sequencesHeight / (float) fullsizeHeight; + + miniMe = nullFrame.createImage(width, sequencesHeight + graphHeight); + offscreen = nullFrame.createImage(width, sequencesHeight + graphHeight); + + Graphics mg = miniMe.getGraphics(); + float sampleCol = (float) alwidth / (float) width; + float sampleRow = (float) alheight / (float) sequencesHeight; + + int lastcol = 0, lastrow = 0; + int xstart = 0, ystart = 0; + Color color = Color.yellow; + int row, col, sameRow = 0, sameCol = 0; + jalview.datamodel.SequenceI seq; + boolean hiddenRow = false; + for (row = 0; row <= sequencesHeight; row++) + { + if ( (int) (row * sampleRow) == lastrow) + { + sameRow++; + continue; + } + + hiddenRow = false; + if (av.hasHiddenRows) + { + seq = av.alignment.getHiddenSequences().getHiddenSequence(lastrow); + if (seq == null) + { + int index = + av.alignment.getHiddenSequences().findIndexWithoutHiddenSeqs( + lastrow); + + seq = av.alignment.getSequenceAt(index); + } + else + { + hiddenRow = true; + } + } + else + { + seq = av.alignment.getSequenceAt(lastrow); + } + + for (col = 0; col < width; col++) + { + if ( (int) (col * sampleCol) == lastcol && + (int) (row * sampleRow) == lastrow) + { + sameCol++; + continue; + } + + lastcol = (int) (col * sampleCol); + + if (seq.getLength() > lastcol) + { + color = sr.getResidueBoxColour( + seq, lastcol); + + if (av.showSequenceFeatures) + { + color = fr.findFeatureColour(color, seq, lastcol); + } + } + else + { + color = Color.white; //White + } + + if (hiddenRow || + (av.hasHiddenColumns && !av.getColumnSelection().isVisible(lastcol))) + { + color = color.darker().darker(); + } + + mg.setColor(color); + if (sameCol == 1 && sameRow == 1) + { + mg.drawLine(xstart, ystart, xstart, ystart); + } + else + { + mg.fillRect(xstart, ystart, sameCol, sameRow); + } + + xstart = col; + sameCol = 1; + } + lastrow = (int) (row * sampleRow); + ystart = row; + sameRow = 1; + } + + if (av.conservation != null) + { + for (col = 0; col < width; col++) + { + lastcol = (int) (col * sampleCol); + { + mg.translate(col, sequencesHeight); + ap.annotationPanel.drawGraph(mg, av.conservation, + (int) (sampleCol) + 1, + graphHeight, + (int) (col * sampleCol), + (int) (col * sampleCol) + 1); + mg.translate( -col, -sequencesHeight); + } + } + } + System.gc(); + + resizing = false; + + setBoxPosition(); + + if (resizeAgain) + { + resizeAgain = false; + updateOverviewImage(); + } + } + + public void setBoxPosition() + { + int fullsizeWidth = av.alignment.getWidth() * av.getCharWidth(); + int fullsizeHeight = (av.alignment.getHeight() + + av.alignment.getHiddenSequences().getSize()) * + av.getCharHeight(); + + int startRes = av.getStartRes(); + int endRes = av.getEndRes(); + + if (av.hasHiddenColumns) + { + startRes = av.getColumnSelection().adjustForHiddenColumns(startRes); + endRes = av.getColumnSelection().adjustForHiddenColumns(endRes); + } + + int startSeq = av.startSeq; + int endSeq = av.endSeq; + + if (av.hasHiddenRows) + { + startSeq = + av.alignment.getHiddenSequences().adjustForHiddenSeqs(startSeq); + + endSeq = + av.alignment.getHiddenSequences().adjustForHiddenSeqs(endSeq); + + } + + scalew = (float) width / (float) fullsizeWidth; + scaleh = (float) sequencesHeight / (float) fullsizeHeight; + + boxX = (int) (startRes * av.getCharWidth() * scalew); + boxY = (int) (startSeq * av.getCharHeight() * scaleh); + + if (av.hasHiddenColumns) + { + boxWidth = (int) ( (endRes - startRes + 1) * av.getCharWidth() * scalew); + } + else + { + boxWidth = (int) ( (endRes - startRes + 1) * av.getCharWidth() * scalew); + } + + boxHeight = (int) ( (endSeq - startSeq) * av.getCharHeight() * scaleh); + + repaint(); + } + + public void update(Graphics g) + { + paint(g); + } + + public void paint(Graphics g) + { + Graphics og = offscreen.getGraphics(); + if (miniMe != null) + { + og.drawImage(miniMe, 0, 0, this); + og.setColor(Color.red); + og.drawRect(boxX, boxY, boxWidth, boxHeight); + og.drawRect(boxX + 1, boxY + 1, boxWidth - 2, boxHeight - 2); + g.drawImage(offscreen, 0, 0, this); + } + } + +} diff --git a/src/jalview/appletgui/PCAPanel.java b/src/jalview/appletgui/PCAPanel.java index ee54478..fac7ad2 100755 --- a/src/jalview/appletgui/PCAPanel.java +++ b/src/jalview/appletgui/PCAPanel.java @@ -1,22 +1,21 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.appletgui; import java.util.*; diff --git a/src/jalview/appletgui/PaintRefresher.java b/src/jalview/appletgui/PaintRefresher.java index 7e0edf7..422257b 100755 --- a/src/jalview/appletgui/PaintRefresher.java +++ b/src/jalview/appletgui/PaintRefresher.java @@ -1,228 +1,228 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.appletgui; - -import java.util.*; - -import java.awt.*; - -import jalview.datamodel.*; - -/** - * DOCUMENT ME! - * - * @author $author$ - * @version $Revision$ - */ -public class PaintRefresher -{ - static Hashtable components; - - /** - * DOCUMENT ME! - * - * @param comp DOCUMENT ME! - * @param al DOCUMENT ME! - */ - public static void Register(Component comp, String seqSetId) - { - if (components == null) - { - components = new Hashtable(); - } - - if (components.containsKey(seqSetId)) - { - Vector comps = (Vector) components.get(seqSetId); - if (!comps.contains(comp)) - { - comps.addElement(comp); - } - } - else - { - Vector vcoms = new Vector(); - vcoms.addElement(comp); - components.put(seqSetId, vcoms); - } - } - - public static void RemoveComponent(Component comp) - { - if (components == null) - { - return; - } - - Enumeration en = components.keys(); - while (en.hasMoreElements()) - { - String id = en.nextElement().toString(); - Vector comps = (Vector) components.get(id); - comps.removeElement(comp); - if (comps.size() == 0) - { - components.remove(id); - } - } - } - - public static void Refresh(Component source, String id) - { - Refresh(source, id, false, false); - } - - public static void Refresh(Component source, - String id, - boolean alignmentChanged, - boolean validateSequences) - { - if (components == null) - { - return; - } - - Component comp; - Vector comps = (Vector) components.get(id); - - if (comps == null) - { - return; - } - - Enumeration e = comps.elements(); - while (e.hasMoreElements()) - { - comp = (Component) e.nextElement(); - - if (comp == source) - { - continue; - } - - if (!comp.isValid()) - { - comps.removeElement(comp); - } - else if (validateSequences - && comp instanceof AlignmentPanel - && source instanceof AlignmentPanel) - { - validateSequences( ( (AlignmentPanel) source).av.alignment, - ( (AlignmentPanel) comp).av.alignment); - } - - if (comp instanceof AlignmentPanel && alignmentChanged) - { - ( (AlignmentPanel) comp).alignmentChanged(); - } - - comp.repaint(); - } - } - - static void validateSequences(AlignmentI source, AlignmentI comp) - { - SequenceI[] a1; - if (source.getHiddenSequences().getSize() > 0) - { - a1 = source.getHiddenSequences().getFullAlignment().getSequencesArray(); - } - else - { - a1 = source.getSequencesArray(); - } - - SequenceI[] a2; - if (comp.getHiddenSequences().getSize() > 0) - { - a2 = comp.getHiddenSequences().getFullAlignment().getSequencesArray(); - } - else - { - a2 = comp.getSequencesArray(); - } - - int i, iSize = a1.length, j, jSize = a2.length; - - if (iSize == jSize) - { - return; - } - - boolean exists = false; - for (i = 0; i < iSize; i++) - { - exists = false; - - for (j = 0; j < jSize; j++) - { - if (a2[j] == a1[i]) - { - exists = true; - break; - } - } - - if (!exists) - { - if (i < comp.getHeight()) - { - comp.getSequences().insertElementAt(a1[i], i); - } - else - { - comp.addSequence(a1[i]); - } - - if (comp.getHiddenSequences().getSize() > 0) - { - a2 = comp.getHiddenSequences().getFullAlignment().getSequencesArray(); - } - else - { - a2 = comp.getSequencesArray(); - } - - jSize = a2.length; - } - } - - iSize = a1.length; - jSize = a2.length; - - for (j = 0; j < jSize; j++) - { - exists = false; - for (i = 0; i < iSize; i++) - { - if (a2[j] == a1[i]) - { - exists = true; - break; - } - } - - if (!exists) - { - comp.deleteSequence(a2[j]); - } - } - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.appletgui; + +import java.util.*; + +import java.awt.*; + +import jalview.datamodel.*; + +/** + * DOCUMENT ME! + * + * @author $author$ + * @version $Revision$ + */ +public class PaintRefresher +{ + static Hashtable components; + + /** + * DOCUMENT ME! + * + * @param comp DOCUMENT ME! + * @param al DOCUMENT ME! + */ + public static void Register(Component comp, String seqSetId) + { + if (components == null) + { + components = new Hashtable(); + } + + if (components.containsKey(seqSetId)) + { + Vector comps = (Vector) components.get(seqSetId); + if (!comps.contains(comp)) + { + comps.addElement(comp); + } + } + else + { + Vector vcoms = new Vector(); + vcoms.addElement(comp); + components.put(seqSetId, vcoms); + } + } + + public static void RemoveComponent(Component comp) + { + if (components == null) + { + return; + } + + Enumeration en = components.keys(); + while (en.hasMoreElements()) + { + String id = en.nextElement().toString(); + Vector comps = (Vector) components.get(id); + comps.removeElement(comp); + if (comps.size() == 0) + { + components.remove(id); + } + } + } + + public static void Refresh(Component source, String id) + { + Refresh(source, id, false, false); + } + + public static void Refresh(Component source, + String id, + boolean alignmentChanged, + boolean validateSequences) + { + if (components == null) + { + return; + } + + Component comp; + Vector comps = (Vector) components.get(id); + + if (comps == null) + { + return; + } + + Enumeration e = comps.elements(); + while (e.hasMoreElements()) + { + comp = (Component) e.nextElement(); + + if (comp == source) + { + continue; + } + + if (!comp.isValid()) + { + comps.removeElement(comp); + } + else if (validateSequences + && comp instanceof AlignmentPanel + && source instanceof AlignmentPanel) + { + validateSequences( ( (AlignmentPanel) source).av.alignment, + ( (AlignmentPanel) comp).av.alignment); + } + + if (comp instanceof AlignmentPanel && alignmentChanged) + { + ( (AlignmentPanel) comp).alignmentChanged(); + } + + comp.repaint(); + } + } + + static void validateSequences(AlignmentI source, AlignmentI comp) + { + SequenceI[] a1; + if (source.getHiddenSequences().getSize() > 0) + { + a1 = source.getHiddenSequences().getFullAlignment().getSequencesArray(); + } + else + { + a1 = source.getSequencesArray(); + } + + SequenceI[] a2; + if (comp.getHiddenSequences().getSize() > 0) + { + a2 = comp.getHiddenSequences().getFullAlignment().getSequencesArray(); + } + else + { + a2 = comp.getSequencesArray(); + } + + int i, iSize = a1.length, j, jSize = a2.length; + + if (iSize == jSize) + { + return; + } + + boolean exists = false; + for (i = 0; i < iSize; i++) + { + exists = false; + + for (j = 0; j < jSize; j++) + { + if (a2[j] == a1[i]) + { + exists = true; + break; + } + } + + if (!exists) + { + if (i < comp.getHeight()) + { + comp.getSequences().insertElementAt(a1[i], i); + } + else + { + comp.addSequence(a1[i]); + } + + if (comp.getHiddenSequences().getSize() > 0) + { + a2 = comp.getHiddenSequences().getFullAlignment().getSequencesArray(); + } + else + { + a2 = comp.getSequencesArray(); + } + + jSize = a2.length; + } + } + + iSize = a1.length; + jSize = a2.length; + + for (j = 0; j < jSize; j++) + { + exists = false; + for (i = 0; i < iSize; i++) + { + if (a2[j] == a1[i]) + { + exists = true; + break; + } + } + + if (!exists) + { + comp.deleteSequence(a2[j]); + } + } + } +} diff --git a/src/jalview/appletgui/PairwiseAlignPanel.java b/src/jalview/appletgui/PairwiseAlignPanel.java index 05372a4..31f1340 100755 --- a/src/jalview/appletgui/PairwiseAlignPanel.java +++ b/src/jalview/appletgui/PairwiseAlignPanel.java @@ -1,22 +1,21 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.appletgui; import java.util.*; diff --git a/src/jalview/appletgui/RedundancyPanel.java b/src/jalview/appletgui/RedundancyPanel.java index 9881b64..8415153 100755 --- a/src/jalview/appletgui/RedundancyPanel.java +++ b/src/jalview/appletgui/RedundancyPanel.java @@ -1,22 +1,21 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.appletgui; import java.util.*; diff --git a/src/jalview/appletgui/RotatableCanvas.java b/src/jalview/appletgui/RotatableCanvas.java index a2463e8..dc53d15 100755 --- a/src/jalview/appletgui/RotatableCanvas.java +++ b/src/jalview/appletgui/RotatableCanvas.java @@ -1,622 +1,621 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -package jalview.appletgui; - -import java.util.*; - -import java.awt.*; -import java.awt.event.*; - -import jalview.datamodel.*; -import jalview.math.*; -import jalview.util.*; - -public class RotatableCanvas - extends Panel implements MouseListener, - MouseMotionListener, - KeyListener -{ - RotatableMatrix idmat = new RotatableMatrix(3, 3); - RotatableMatrix objmat = new RotatableMatrix(3, 3); - RotatableMatrix rotmat = new RotatableMatrix(3, 3); - String tooltip; - int toolx, tooly; - - //RubberbandRectangle rubberband; - - boolean drawAxes = true; - - int omx = 0; - int mx = 0; - int omy = 0; - int my = 0; - - Image img; - Graphics ig; - - Dimension prefsize; - - float centre[] = new float[3]; - float width[] = new float[3]; - - float max[] = new float[3]; - float min[] = new float[3]; - - float maxwidth; - float scale; - - int npoint; - - Vector points; - float[][] orig; - float[][] axes; - - int startx; - int starty; - - int lastx; - int lasty; - - int rectx1; - int recty1; - int rectx2; - int recty2; - - float scalefactor = 1; - - AlignViewport av; - boolean showLabels = false; - - public RotatableCanvas(AlignViewport av) - { - this.av = av; - } - - public void showLabels(boolean b) - { - showLabels = b; - repaint(); - } - - public void setPoints(Vector points, int npoint) - { - this.points = points; - this.npoint = npoint; - PaintRefresher.Register(this, av.getSequenceSetId()); - - prefsize = getPreferredSize(); - orig = new float[npoint][3]; - - for (int i = 0; i < npoint; i++) - { - SequencePoint sp = (SequencePoint) points.elementAt(i); - for (int j = 0; j < 3; j++) - { - orig[i][j] = sp.coord[j]; - } - } - //Initialize the matrices to identity - - for (int i = 0; i < 3; i++) - { - for (int j = 0; j < 3; j++) - { - if (i != j) - { - idmat.addElement(i, j, 0); - objmat.addElement(i, j, 0); - rotmat.addElement(i, j, 0); - } - else - { - idmat.addElement(i, j, 0); - objmat.addElement(i, j, 0); - rotmat.addElement(i, j, 0); - } - } - } - - axes = new float[3][3]; - initAxes(); - - findCentre(); - findWidth(); - - scale = findScale(); - - // System.out.println("Scale factor = " + scale); - - addMouseListener(this); - addKeyListener(this); - // if (getParent() != null) { - // getParent().addKeyListener(this); - //} - addMouseMotionListener(this); - - // Add rubberband - // rubberband = new RubberbandRectangle(this); - // rubberband.setActive(true); - // rubberband.addListener(this); - } - - /* public boolean handleSequenceSelectionEvent(SequenceSelectionEvent evt) { - redrawneeded = true; - repaint(); - return true; - } - - public void removeNotify() { - controller.removeListener(this); - super.removeNotify(); - }*/ - - public void initAxes() - { - for (int i = 0; i < 3; i++) - { - for (int j = 0; j < 3; j++) - { - if (i != j) - { - axes[i][j] = 0; - } - else - { - axes[i][j] = 1; - } - } - } - } - - public void findWidth() - { - max = new float[3]; - min = new float[3]; - - max[0] = (float) - 1e30; - max[1] = (float) - 1e30; - max[2] = (float) - 1e30; - - min[0] = (float) 1e30; - min[1] = (float) 1e30; - min[2] = (float) 1e30; - - for (int i = 0; i < 3; i++) - { - for (int j = 0; j < npoint; j++) - { - SequencePoint sp = (SequencePoint) points.elementAt(j); - if (sp.coord[i] >= max[i]) - { - max[i] = sp.coord[i]; - } - if (sp.coord[i] <= min[i]) - { - min[i] = sp.coord[i]; - } - } - } - - // System.out.println("xmax " + max[0] + " min " + min[0]); - //System.out.println("ymax " + max[1] + " min " + min[1]); - //System.out.println("zmax " + max[2] + " min " + min[2]); - - width[0] = Math.abs(max[0] - min[0]); - width[1] = Math.abs(max[1] - min[1]); - width[2] = Math.abs(max[2] - min[2]); - - maxwidth = width[0]; - - if (width[1] > width[0]) - { - maxwidth = width[1]; - } - if (width[2] > width[1]) - { - maxwidth = width[2]; - } - - //System.out.println("Maxwidth = " + maxwidth); - } - - public float findScale() - { - int dim, width, height; - if (getSize().width != 0) - { - width = getSize().width; - height = getSize().height; - } - else - { - width = prefsize.width; - height = prefsize.height; - } - - if (width < height) - { - dim = width; - } - else - { - dim = height; - } - - return (float) (dim * scalefactor / (2 * maxwidth)); - } - - public void findCentre() - { - //Find centre coordinate - findWidth(); - - centre[0] = (max[0] + min[0]) / 2; - centre[1] = (max[1] + min[1]) / 2; - centre[2] = (max[2] + min[2]) / 2; - - // System.out.println("Centre x " + centre[0]); - //System.out.println("Centre y " + centre[1]); - //System.out.println("Centre z " + centre[2]); - } - - public Dimension getPreferredSize() - { - if (prefsize != null) - { - return prefsize; - } - else - { - return new Dimension(400, 400); - } - } - - public Dimension getMinimumSize() - { - return getPreferredSize(); - } - - public void update(Graphics g) - { - paint(g); - } - - public void paint(Graphics g) - { - if (points == null) - { - g.setFont(new Font("Verdana", Font.PLAIN, 18)); - g.drawString("Calculating PCA....", 20, getSize().height / 2); - } - else - { - - //Only create the image at the beginning - - if ( (img == null) || (prefsize.width != getSize().width) || - (prefsize.height != getSize().height)) - { - prefsize.width = getSize().width; - prefsize.height = getSize().height; - - scale = findScale(); - - // System.out.println("New scale = " + scale); - img = createImage(getSize().width, getSize().height); - ig = img.getGraphics(); - - } - - drawBackground(ig, Color.black); - drawScene(ig); - if (drawAxes == true) - { - drawAxes(ig); - } - - if (tooltip != null) - { - ig.setColor(Color.red); - ig.drawString(tooltip, toolx, tooly); - } - - g.drawImage(img, 0, 0, this); - } - } - - public void drawAxes(Graphics g) - { - - g.setColor(Color.yellow); - for (int i = 0; i < 3; i++) - { - g.drawLine(getSize().width / 2, getSize().height / 2, - (int) (axes[i][0] * scale * max[0] + getSize().width / 2), - (int) (axes[i][1] * scale * max[1] + getSize().height / 2)); - } - } - - public void drawBackground(Graphics g, Color col) - { - g.setColor(col); - g.fillRect(0, 0, prefsize.width, prefsize.height); - } - - public void drawScene(Graphics g) - { - //boolean darker = false; - - int halfwidth = getSize().width / 2; - int halfheight = getSize().height / 2; - - for (int i = 0; i < npoint; i++) - { - SequencePoint sp = (SequencePoint) points.elementAt(i); - int x = (int) ( (float) (sp.coord[0] - centre[0]) * scale) + halfwidth; - int y = (int) ( (float) (sp.coord[1] - centre[1]) * scale) + halfheight; - float z = sp.coord[1] - centre[2]; - - if (av.getSequenceColour(sp.sequence) == Color.black) - { - g.setColor(Color.white); - } - else - { - g.setColor(av.getSequenceColour(sp.sequence)); - } - - if (av.getSelectionGroup() != null) - { - if (av.getSelectionGroup().getSequences(null).contains( ( ( - SequencePoint) points. - elementAt(i)).sequence)) - { - g.setColor(Color.gray); - } - } - if (z < 0) - { - g.setColor(g.getColor().darker()); - } - - g.fillRect(x - 3, y - 3, 6, 6); - if (showLabels) - { - g.setColor(Color.red); - g.drawString( ( (SequencePoint) points.elementAt(i)).sequence. - getName(), - x - 3, y - 4); - } - } - } - - public Dimension minimumsize() - { - return prefsize; - } - - public Dimension preferredsize() - { - return prefsize; - } - - public void keyTyped(KeyEvent evt) - {} - - public void keyReleased(KeyEvent evt) - {} - - public void keyPressed(KeyEvent evt) - { - if (evt.getKeyCode() == KeyEvent.VK_UP) - { - scalefactor = (float) (scalefactor * 1.1); - scale = findScale(); - } - else if (evt.getKeyCode() == KeyEvent.VK_DOWN) - { - scalefactor = (float) (scalefactor * 0.9); - scale = findScale(); - } - else if (evt.getKeyChar() == 's') - { - System.err.println("DEBUG: Rectangle selection"); // log.debug - if (rectx2 != -1 && recty2 != -1) - { - rectSelect(rectx1, recty1, rectx2, recty2); - - } - } - repaint(); - } - - public void printPoints() - { - for (int i = 0; i < npoint; i++) - { - SequencePoint sp = (SequencePoint) points.elementAt(i); - Format.print(System.out, "%5d ", i); - for (int j = 0; j < 3; j++) - { - Format.print(System.out, "%13.3f ", sp.coord[j]); - } - System.out.println(); - } - } - - public void mouseClicked(MouseEvent evt) - {} - - public void mouseEntered(MouseEvent evt) - {} - - public void mouseExited(MouseEvent evt) - {} - - public void mouseReleased(MouseEvent evt) - {} - - public void mousePressed(MouseEvent evt) - { - int x = evt.getX(); - int y = evt.getY(); - - mx = x; - my = y; - - omx = mx; - omy = my; - - startx = x; - starty = y; - - rectx1 = x; - recty1 = y; - - rectx2 = -1; - recty2 = -1; - - SequenceI found = findPoint(x, y); - - if (found != null) - { - if (av.getSelectionGroup() != null) - { - av.getSelectionGroup().addOrRemove(found, true); - av.getSelectionGroup().setEndRes(av.alignment.getWidth() - 1); - PaintRefresher.Refresh(this, av.getSequenceSetId()); - } - else - { - av.setSelectionGroup(new SequenceGroup()); - av.getSelectionGroup().addOrRemove(found, true); - av.getSelectionGroup().setEndRes(av.alignment.getWidth() - 1); - - } - } - repaint(); - } - - public void mouseMoved(MouseEvent evt) - { - SequenceI found = findPoint(evt.getX(), evt.getY()); - if (found == null) - { - tooltip = null; - } - else - { - tooltip = found.getName(); - toolx = evt.getX(); - tooly = evt.getY(); - } - repaint(); - } - - public void mouseDragged(MouseEvent evt) - { - mx = evt.getX(); - my = evt.getY(); - - rotmat.setIdentity(); - - rotmat.rotate( (float) (my - omy), 'x'); - rotmat.rotate( (float) (mx - omx), 'y'); - - for (int i = 0; i < npoint; i++) - { - SequencePoint sp = (SequencePoint) points.elementAt(i); - sp.coord[0] -= centre[0]; - sp.coord[1] -= centre[1]; - sp.coord[2] -= centre[2]; - - //Now apply the rotation matrix - sp.coord = rotmat.vectorMultiply(sp.coord); - - //Now translate back again - sp.coord[0] += centre[0]; - sp.coord[1] += centre[1]; - sp.coord[2] += centre[2]; - } - - for (int i = 0; i < 3; i++) - { - axes[i] = rotmat.vectorMultiply(axes[i]); - } - omx = mx; - omy = my; - - paint(this.getGraphics()); - } - - public void rectSelect(int x1, int y1, int x2, int y2) - { - //boolean changedSel = false; - 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); - - if (tmp1 > x1 && tmp1 < x2 && tmp2 > y1 && tmp2 < y2) - { - if (av != null) - { - if (!av.getSelectionGroup().getSequences(null).contains(sp.sequence)) - { - av.getSelectionGroup().addSequence(sp.sequence, true); - } - } - } - } - } - - public SequenceI findPoint(int x, int y) - { - - int halfwidth = getSize().width / 2; - int halfheight = getSize().height / 2; - - int found = -1; - - for (int i = 0; i < npoint; i++) - { - - SequencePoint sp = (SequencePoint) points.elementAt(i); - int px = (int) ( (float) (sp.coord[0] - centre[0]) * scale) + halfwidth; - int py = (int) ( (float) (sp.coord[1] - centre[1]) * scale) + halfheight; - - if (Math.abs(px - x) < 3 && Math.abs(py - y) < 3) - { - found = i; - } - } - if (found != -1) - { - return ( (SequencePoint) points.elementAt(found)).sequence; - } - else - { - return null; - } - } - -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.appletgui; + +import java.util.*; + +import java.awt.*; +import java.awt.event.*; + +import jalview.datamodel.*; +import jalview.math.*; +import jalview.util.*; + +public class RotatableCanvas + extends Panel implements MouseListener, + MouseMotionListener, + KeyListener +{ + RotatableMatrix idmat = new RotatableMatrix(3, 3); + RotatableMatrix objmat = new RotatableMatrix(3, 3); + RotatableMatrix rotmat = new RotatableMatrix(3, 3); + String tooltip; + int toolx, tooly; + + //RubberbandRectangle rubberband; + + boolean drawAxes = true; + + int omx = 0; + int mx = 0; + int omy = 0; + int my = 0; + + Image img; + Graphics ig; + + Dimension prefsize; + + float centre[] = new float[3]; + float width[] = new float[3]; + + float max[] = new float[3]; + float min[] = new float[3]; + + float maxwidth; + float scale; + + int npoint; + + Vector points; + float[][] orig; + float[][] axes; + + int startx; + int starty; + + int lastx; + int lasty; + + int rectx1; + int recty1; + int rectx2; + int recty2; + + float scalefactor = 1; + + AlignViewport av; + boolean showLabels = false; + + public RotatableCanvas(AlignViewport av) + { + this.av = av; + } + + public void showLabels(boolean b) + { + showLabels = b; + repaint(); + } + + public void setPoints(Vector points, int npoint) + { + this.points = points; + this.npoint = npoint; + PaintRefresher.Register(this, av.getSequenceSetId()); + + prefsize = getPreferredSize(); + orig = new float[npoint][3]; + + for (int i = 0; i < npoint; i++) + { + SequencePoint sp = (SequencePoint) points.elementAt(i); + for (int j = 0; j < 3; j++) + { + orig[i][j] = sp.coord[j]; + } + } + //Initialize the matrices to identity + + for (int i = 0; i < 3; i++) + { + for (int j = 0; j < 3; j++) + { + if (i != j) + { + idmat.addElement(i, j, 0); + objmat.addElement(i, j, 0); + rotmat.addElement(i, j, 0); + } + else + { + idmat.addElement(i, j, 0); + objmat.addElement(i, j, 0); + rotmat.addElement(i, j, 0); + } + } + } + + axes = new float[3][3]; + initAxes(); + + findCentre(); + findWidth(); + + scale = findScale(); + + // System.out.println("Scale factor = " + scale); + + addMouseListener(this); + addKeyListener(this); + // if (getParent() != null) { + // getParent().addKeyListener(this); + //} + addMouseMotionListener(this); + + // Add rubberband + // rubberband = new RubberbandRectangle(this); + // rubberband.setActive(true); + // rubberband.addListener(this); + } + + /* public boolean handleSequenceSelectionEvent(SequenceSelectionEvent evt) { + redrawneeded = true; + repaint(); + return true; + } + + public void removeNotify() { + controller.removeListener(this); + super.removeNotify(); + }*/ + + public void initAxes() + { + for (int i = 0; i < 3; i++) + { + for (int j = 0; j < 3; j++) + { + if (i != j) + { + axes[i][j] = 0; + } + else + { + axes[i][j] = 1; + } + } + } + } + + public void findWidth() + { + max = new float[3]; + min = new float[3]; + + max[0] = (float) - 1e30; + max[1] = (float) - 1e30; + max[2] = (float) - 1e30; + + min[0] = (float) 1e30; + min[1] = (float) 1e30; + min[2] = (float) 1e30; + + for (int i = 0; i < 3; i++) + { + for (int j = 0; j < npoint; j++) + { + SequencePoint sp = (SequencePoint) points.elementAt(j); + if (sp.coord[i] >= max[i]) + { + max[i] = sp.coord[i]; + } + if (sp.coord[i] <= min[i]) + { + min[i] = sp.coord[i]; + } + } + } + + // System.out.println("xmax " + max[0] + " min " + min[0]); + //System.out.println("ymax " + max[1] + " min " + min[1]); + //System.out.println("zmax " + max[2] + " min " + min[2]); + + width[0] = Math.abs(max[0] - min[0]); + width[1] = Math.abs(max[1] - min[1]); + width[2] = Math.abs(max[2] - min[2]); + + maxwidth = width[0]; + + if (width[1] > width[0]) + { + maxwidth = width[1]; + } + if (width[2] > width[1]) + { + maxwidth = width[2]; + } + + //System.out.println("Maxwidth = " + maxwidth); + } + + public float findScale() + { + int dim, width, height; + if (getSize().width != 0) + { + width = getSize().width; + height = getSize().height; + } + else + { + width = prefsize.width; + height = prefsize.height; + } + + if (width < height) + { + dim = width; + } + else + { + dim = height; + } + + return (float) (dim * scalefactor / (2 * maxwidth)); + } + + public void findCentre() + { + //Find centre coordinate + findWidth(); + + centre[0] = (max[0] + min[0]) / 2; + centre[1] = (max[1] + min[1]) / 2; + centre[2] = (max[2] + min[2]) / 2; + + // System.out.println("Centre x " + centre[0]); + //System.out.println("Centre y " + centre[1]); + //System.out.println("Centre z " + centre[2]); + } + + public Dimension getPreferredSize() + { + if (prefsize != null) + { + return prefsize; + } + else + { + return new Dimension(400, 400); + } + } + + public Dimension getMinimumSize() + { + return getPreferredSize(); + } + + public void update(Graphics g) + { + paint(g); + } + + public void paint(Graphics g) + { + if (points == null) + { + g.setFont(new Font("Verdana", Font.PLAIN, 18)); + g.drawString("Calculating PCA....", 20, getSize().height / 2); + } + else + { + + //Only create the image at the beginning - + if ( (img == null) || (prefsize.width != getSize().width) || + (prefsize.height != getSize().height)) + { + prefsize.width = getSize().width; + prefsize.height = getSize().height; + + scale = findScale(); + + // System.out.println("New scale = " + scale); + img = createImage(getSize().width, getSize().height); + ig = img.getGraphics(); + + } + + drawBackground(ig, Color.black); + drawScene(ig); + if (drawAxes == true) + { + drawAxes(ig); + } + + if (tooltip != null) + { + ig.setColor(Color.red); + ig.drawString(tooltip, toolx, tooly); + } + + g.drawImage(img, 0, 0, this); + } + } + + public void drawAxes(Graphics g) + { + + g.setColor(Color.yellow); + for (int i = 0; i < 3; i++) + { + g.drawLine(getSize().width / 2, getSize().height / 2, + (int) (axes[i][0] * scale * max[0] + getSize().width / 2), + (int) (axes[i][1] * scale * max[1] + getSize().height / 2)); + } + } + + public void drawBackground(Graphics g, Color col) + { + g.setColor(col); + g.fillRect(0, 0, prefsize.width, prefsize.height); + } + + public void drawScene(Graphics g) + { + //boolean darker = false; + + int halfwidth = getSize().width / 2; + int halfheight = getSize().height / 2; + + for (int i = 0; i < npoint; i++) + { + SequencePoint sp = (SequencePoint) points.elementAt(i); + int x = (int) ( (float) (sp.coord[0] - centre[0]) * scale) + halfwidth; + int y = (int) ( (float) (sp.coord[1] - centre[1]) * scale) + halfheight; + float z = sp.coord[1] - centre[2]; + + if (av.getSequenceColour(sp.sequence) == Color.black) + { + g.setColor(Color.white); + } + else + { + g.setColor(av.getSequenceColour(sp.sequence)); + } + + if (av.getSelectionGroup() != null) + { + if (av.getSelectionGroup().getSequences(null).contains( ( ( + SequencePoint) points. + elementAt(i)).sequence)) + { + g.setColor(Color.gray); + } + } + if (z < 0) + { + g.setColor(g.getColor().darker()); + } + + g.fillRect(x - 3, y - 3, 6, 6); + if (showLabels) + { + g.setColor(Color.red); + g.drawString( ( (SequencePoint) points.elementAt(i)).sequence. + getName(), + x - 3, y - 4); + } + } + } + + public Dimension minimumsize() + { + return prefsize; + } + + public Dimension preferredsize() + { + return prefsize; + } + + public void keyTyped(KeyEvent evt) + {} + + public void keyReleased(KeyEvent evt) + {} + + public void keyPressed(KeyEvent evt) + { + if (evt.getKeyCode() == KeyEvent.VK_UP) + { + scalefactor = (float) (scalefactor * 1.1); + scale = findScale(); + } + else if (evt.getKeyCode() == KeyEvent.VK_DOWN) + { + scalefactor = (float) (scalefactor * 0.9); + scale = findScale(); + } + else if (evt.getKeyChar() == 's') + { + System.err.println("DEBUG: Rectangle selection"); // log.debug + if (rectx2 != -1 && recty2 != -1) + { + rectSelect(rectx1, recty1, rectx2, recty2); + + } + } + repaint(); + } + + public void printPoints() + { + for (int i = 0; i < npoint; i++) + { + SequencePoint sp = (SequencePoint) points.elementAt(i); + Format.print(System.out, "%5d ", i); + for (int j = 0; j < 3; j++) + { + Format.print(System.out, "%13.3f ", sp.coord[j]); + } + System.out.println(); + } + } + + public void mouseClicked(MouseEvent evt) + {} + + public void mouseEntered(MouseEvent evt) + {} + + public void mouseExited(MouseEvent evt) + {} + + public void mouseReleased(MouseEvent evt) + {} + + public void mousePressed(MouseEvent evt) + { + int x = evt.getX(); + int y = evt.getY(); + + mx = x; + my = y; + + omx = mx; + omy = my; + + startx = x; + starty = y; + + rectx1 = x; + recty1 = y; + + rectx2 = -1; + recty2 = -1; + + SequenceI found = findPoint(x, y); + + if (found != null) + { + if (av.getSelectionGroup() != null) + { + av.getSelectionGroup().addOrRemove(found, true); + av.getSelectionGroup().setEndRes(av.alignment.getWidth() - 1); + PaintRefresher.Refresh(this, av.getSequenceSetId()); + } + else + { + av.setSelectionGroup(new SequenceGroup()); + av.getSelectionGroup().addOrRemove(found, true); + av.getSelectionGroup().setEndRes(av.alignment.getWidth() - 1); + + } + } + repaint(); + } + + public void mouseMoved(MouseEvent evt) + { + SequenceI found = findPoint(evt.getX(), evt.getY()); + if (found == null) + { + tooltip = null; + } + else + { + tooltip = found.getName(); + toolx = evt.getX(); + tooly = evt.getY(); + } + repaint(); + } + + public void mouseDragged(MouseEvent evt) + { + mx = evt.getX(); + my = evt.getY(); + + rotmat.setIdentity(); + + rotmat.rotate( (float) (my - omy), 'x'); + rotmat.rotate( (float) (mx - omx), 'y'); + + for (int i = 0; i < npoint; i++) + { + SequencePoint sp = (SequencePoint) points.elementAt(i); + sp.coord[0] -= centre[0]; + sp.coord[1] -= centre[1]; + sp.coord[2] -= centre[2]; + + //Now apply the rotation matrix + sp.coord = rotmat.vectorMultiply(sp.coord); + + //Now translate back again + sp.coord[0] += centre[0]; + sp.coord[1] += centre[1]; + sp.coord[2] += centre[2]; + } + + for (int i = 0; i < 3; i++) + { + axes[i] = rotmat.vectorMultiply(axes[i]); + } + omx = mx; + omy = my; + + paint(this.getGraphics()); + } + + public void rectSelect(int x1, int y1, int x2, int y2) + { + //boolean changedSel = false; + 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); + + if (tmp1 > x1 && tmp1 < x2 && tmp2 > y1 && tmp2 < y2) + { + if (av != null) + { + if (!av.getSelectionGroup().getSequences(null).contains(sp.sequence)) + { + av.getSelectionGroup().addSequence(sp.sequence, true); + } + } + } + } + } + + public SequenceI findPoint(int x, int y) + { + + int halfwidth = getSize().width / 2; + int halfheight = getSize().height / 2; + + int found = -1; + + for (int i = 0; i < npoint; i++) + { + + SequencePoint sp = (SequencePoint) points.elementAt(i); + int px = (int) ( (float) (sp.coord[0] - centre[0]) * scale) + halfwidth; + int py = (int) ( (float) (sp.coord[1] - centre[1]) * scale) + halfheight; + + if (Math.abs(px - x) < 3 && Math.abs(py - y) < 3) + { + found = i; + } + } + if (found != -1) + { + return ( (SequencePoint) points.elementAt(found)).sequence; + } + else + { + return null; + } + } + +} diff --git a/src/jalview/appletgui/ScalePanel.java b/src/jalview/appletgui/ScalePanel.java index a1d0bf7..b938cb8 100755 --- a/src/jalview/appletgui/ScalePanel.java +++ b/src/jalview/appletgui/ScalePanel.java @@ -1,453 +1,452 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -package jalview.appletgui; - -import java.awt.*; -import java.awt.event.*; - -import jalview.datamodel.*; - -public class ScalePanel - extends Panel implements MouseMotionListener, MouseListener -{ - - protected int offy = 4; - public int width; - - protected AlignViewport av; - AlignmentPanel ap; - - boolean stretchingGroup = false; - int min; //used by mouseDragged to see if user - int max; //used by mouseDragged to see if user - boolean mouseDragging = false; - int[] reveal; - - public ScalePanel(AlignViewport av, AlignmentPanel ap) - { - setLayout(null); - this.av = av; - this.ap = ap; - - addMouseListener(this); - addMouseMotionListener(this); - - } - - public void mousePressed(MouseEvent evt) - { - int x = (evt.getX() / av.getCharWidth()) + av.getStartRes(); - final int res; - - if (av.hasHiddenColumns) - { - res = av.getColumnSelection().adjustForHiddenColumns(x); - } - else - { - res = x; - } - - min = res; - max = res; - if ( (evt.getModifiers() & InputEvent.BUTTON3_MASK) - == InputEvent.BUTTON3_MASK) - { - PopupMenu pop = new PopupMenu(); - if (reveal != null) - { - MenuItem item = new MenuItem("Reveal"); - item.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - av.showColumn(reveal[0]); - reveal = null; - ap.paintAlignment(true); - if (ap.overviewPanel != null) - { - ap.overviewPanel.updateOverviewImage(); - } - } - }); - pop.add(item); - - if (av.getColumnSelection().getHiddenColumns().size() > 1) - { - item = new MenuItem("Reveal All"); - item.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - av.showAllHiddenColumns(); - reveal = null; - ap.paintAlignment(true); - if (ap.overviewPanel != null) - { - ap.overviewPanel.updateOverviewImage(); - } - } - }); - pop.add(item); - } - this.add(pop); - pop.show(this, evt.getX(), evt.getY()); - } - else if (av.getColumnSelection().contains(res)) - { - MenuItem item = new MenuItem("Hide Columns"); - item.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - av.hideColumns(res, res); - if (av.getSelectionGroup() != null - && - av.getSelectionGroup().getSize() == av.alignment.getHeight()) - { - av.setSelectionGroup(null); - } - - ap.paintAlignment(true); - if (ap.overviewPanel != null) - { - ap.overviewPanel.updateOverviewImage(); - } - } - }); - pop.add(item); - this.add(pop); - pop.show(this, evt.getX(), evt.getY()); - } - } - else // LEFT MOUSE TO SELECT - { - if (!evt.isControlDown() && !evt.isShiftDown()) - { - av.getColumnSelection().clear(); - } - - av.getColumnSelection().addElement(res); - SequenceGroup sg = new SequenceGroup(); - for (int i = 0; i < av.alignment.getSequences().size(); i++) - { - sg.addSequence(av.alignment.getSequenceAt(i), false); - } - - sg.setStartRes(res); - sg.setEndRes(res); - av.setSelectionGroup(sg); - - if (evt.isShiftDown()) - { - int min = Math.min(av.getColumnSelection().getMin(), res); - int max = Math.max(av.getColumnSelection().getMax(), res); - for (int i = min; i < max; i++) - { - av.getColumnSelection().addElement(i); - } - sg.setStartRes(min); - sg.setEndRes(max); - } - } - - ap.paintAlignment(true); - } - - public void mouseReleased(MouseEvent evt) - { - mouseDragging = false; - - int res = (evt.getX() / av.getCharWidth()) + av.getStartRes(); - - if (res > av.alignment.getWidth()) - { - res = av.alignment.getWidth() - 1; - } - - if (av.hasHiddenColumns) - { - res = av.getColumnSelection().adjustForHiddenColumns(res); - } - - if (!stretchingGroup) - { - ap.paintAlignment(false); - - return; - } - - SequenceGroup sg = av.getSelectionGroup(); - - if (res > sg.getStartRes()) - { - sg.setEndRes(res); - } - else if (res < sg.getStartRes()) - { - sg.setStartRes(res); - } - - stretchingGroup = false; - ap.paintAlignment(false); - } - - public void mouseDragged(MouseEvent evt) - { - mouseDragging = true; - - int res = (evt.getX() / av.getCharWidth()) + av.getStartRes(); - if (res < 0) - { - res = 0; - } - - if (av.hasHiddenColumns) - { - res = av.getColumnSelection().adjustForHiddenColumns(res); - } - - if (res > av.alignment.getWidth()) - { - res = av.alignment.getWidth() - 1; - } - - if (res < min) - { - min = res; - } - - if (res > max) - { - max = res; - } - - SequenceGroup sg = av.getSelectionGroup(); - - if (sg != null) - { - stretchingGroup = true; - - if (!av.getColumnSelection().contains(res)) - { - av.getColumnSelection().addElement(res); - } - - if (res > sg.getStartRes()) - { - sg.setEndRes(res); - } - if (res < sg.getStartRes()) - { - sg.setStartRes(res); - } - - int col; - for (int i = min; i <= max; i++) - { - col = av.getColumnSelection().adjustForHiddenColumns(i); - - if ( (col < sg.getStartRes()) || (col > sg.getEndRes())) - { - av.getColumnSelection().removeElement(col); - } - else - { - av.getColumnSelection().addElement(col); - } - } - - ap.paintAlignment(false); - } - } - - public void mouseEntered(MouseEvent evt) - { - if (mouseDragging) - { - ap.seqPanel.scrollCanvas(null); - } - } - - public void mouseExited(MouseEvent evt) - { - if (mouseDragging) - { - ap.seqPanel.scrollCanvas(evt); - } - } - - public void mouseClicked(MouseEvent evt) - { - - } - - public void mouseMoved(MouseEvent evt) - { - if (!av.hasHiddenColumns) - { - return; - } - - int res = (evt.getX() / av.getCharWidth()) + av.getStartRes(); - - res = av.getColumnSelection().adjustForHiddenColumns(res); - - reveal = null; - for (int i = 0; i < av.getColumnSelection().getHiddenColumns().size(); i++) - { - int[] region = (int[]) av.getColumnSelection().getHiddenColumns(). - elementAt(i); - if (res + 1 == region[0] || res - 1 == region[1]) - { - reveal = region; - break; - } - } - - repaint(); - } - - public void update(Graphics g) - { - paint(g); - } - - public void paint(Graphics g) - { - drawScale(g, av.getStartRes(), av.getEndRes(), getSize().width, - getSize().height); - } - -// scalewidth will normally be screenwidth, - public void drawScale(Graphics gg, int startx, int endx, int width, - int height) - { - gg.setFont(av.getFont()); - - //Fill in the background - gg.setColor(Color.white); - gg.fillRect(0, 0, width, height); - gg.setColor(Color.black); - - //Fill the selected columns - ColumnSelection cs = av.getColumnSelection(); - gg.setColor(new Color(220, 0, 0)); - - for (int i = 0; i < cs.size(); i++) - { - int sel = cs.columnAt(i); - if (av.hasHiddenColumns) - { - sel = av.getColumnSelection().findColumnPosition(sel); - } - - if ( (sel >= startx) && (sel <= endx)) - { - gg.fillRect( (sel - startx) * av.charWidth, 0, av.charWidth, - getSize().height); - } - } - - // Draw the scale numbers - gg.setColor(Color.black); - - int scalestartx = (startx / 10) * 10; - - FontMetrics fm = gg.getFontMetrics(av.getFont()); - int y = av.charHeight - fm.getDescent(); - - if ( (scalestartx % 10) == 0) - { - scalestartx += 5; - } - - String string; - int maxX = 0; - - for (int i = scalestartx; i < endx; i += 5) - { - if ( (i % 10) == 0) - { - string = String.valueOf(av.getColumnSelection().adjustForHiddenColumns( - i)); - if ( (i - startx - 1) * av.charWidth > maxX) - { - gg.drawString(string, - (i - startx - 1) * av.charWidth, y); - maxX = (i - startx + 1) * av.charWidth + fm.stringWidth(string); - } - - gg.drawLine( (int) ( ( (i - startx - 1) * av.charWidth) + - (av.charWidth / 2)), y + 2, - (int) ( ( (i - startx - 1) * av.charWidth) + - (av.charWidth / 2)), - y + (fm.getDescent() * 2)); - - } - else - { - gg.drawLine( (int) ( ( (i - startx - 1) * av.charWidth) + - (av.charWidth / 2)), y + fm.getDescent(), - (int) ( ( (i - startx - 1) * av.charWidth) + - (av.charWidth / 2)), y + (fm.getDescent() * 2)); - } - } - - if (av.hasHiddenColumns) - { - gg.setColor(Color.blue); - int res; - if (av.getShowHiddenMarkers()) - { - for (int i = 0; i < av.getColumnSelection().getHiddenColumns().size(); - i++) - { - - res = av.getColumnSelection().findHiddenRegionPosition(i) - - startx; - - if (res < 0 || res > endx - scalestartx) - { - continue; - } - - gg.fillPolygon(new int[] - {res * av.charWidth - av.charHeight / 4, - res * av.charWidth + av.charHeight / 4, - res * av.charWidth}, - new int[] - { - y - av.charHeight / 2, y - av.charHeight / 2, - y + 8 - }, 3); - - } - } - - if (reveal != null && reveal[0] > startx && reveal[0] < endx) - { - gg.drawString("Reveal Columns", reveal[0] * av.charWidth, 0); - } - } - - } - -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.appletgui; + +import java.awt.*; +import java.awt.event.*; + +import jalview.datamodel.*; + +public class ScalePanel + extends Panel implements MouseMotionListener, MouseListener +{ + + protected int offy = 4; + public int width; + + protected AlignViewport av; + AlignmentPanel ap; + + boolean stretchingGroup = false; + int min; //used by mouseDragged to see if user + int max; //used by mouseDragged to see if user + boolean mouseDragging = false; + int[] reveal; + + public ScalePanel(AlignViewport av, AlignmentPanel ap) + { + setLayout(null); + this.av = av; + this.ap = ap; + + addMouseListener(this); + addMouseMotionListener(this); + + } + + public void mousePressed(MouseEvent evt) + { + int x = (evt.getX() / av.getCharWidth()) + av.getStartRes(); + final int res; + + if (av.hasHiddenColumns) + { + res = av.getColumnSelection().adjustForHiddenColumns(x); + } + else + { + res = x; + } + + min = res; + max = res; + if ( (evt.getModifiers() & InputEvent.BUTTON3_MASK) + == InputEvent.BUTTON3_MASK) + { + PopupMenu pop = new PopupMenu(); + if (reveal != null) + { + MenuItem item = new MenuItem("Reveal"); + item.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + av.showColumn(reveal[0]); + reveal = null; + ap.paintAlignment(true); + if (ap.overviewPanel != null) + { + ap.overviewPanel.updateOverviewImage(); + } + } + }); + pop.add(item); + + if (av.getColumnSelection().getHiddenColumns().size() > 1) + { + item = new MenuItem("Reveal All"); + item.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + av.showAllHiddenColumns(); + reveal = null; + ap.paintAlignment(true); + if (ap.overviewPanel != null) + { + ap.overviewPanel.updateOverviewImage(); + } + } + }); + pop.add(item); + } + this.add(pop); + pop.show(this, evt.getX(), evt.getY()); + } + else if (av.getColumnSelection().contains(res)) + { + MenuItem item = new MenuItem("Hide Columns"); + item.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + av.hideColumns(res, res); + if (av.getSelectionGroup() != null + && + av.getSelectionGroup().getSize() == av.alignment.getHeight()) + { + av.setSelectionGroup(null); + } + + ap.paintAlignment(true); + if (ap.overviewPanel != null) + { + ap.overviewPanel.updateOverviewImage(); + } + } + }); + pop.add(item); + this.add(pop); + pop.show(this, evt.getX(), evt.getY()); + } + } + else // LEFT MOUSE TO SELECT + { + if (!evt.isControlDown() && !evt.isShiftDown()) + { + av.getColumnSelection().clear(); + } + + av.getColumnSelection().addElement(res); + SequenceGroup sg = new SequenceGroup(); + for (int i = 0; i < av.alignment.getSequences().size(); i++) + { + sg.addSequence(av.alignment.getSequenceAt(i), false); + } + + sg.setStartRes(res); + sg.setEndRes(res); + av.setSelectionGroup(sg); + + if (evt.isShiftDown()) + { + int min = Math.min(av.getColumnSelection().getMin(), res); + int max = Math.max(av.getColumnSelection().getMax(), res); + for (int i = min; i < max; i++) + { + av.getColumnSelection().addElement(i); + } + sg.setStartRes(min); + sg.setEndRes(max); + } + } + + ap.paintAlignment(true); + } + + public void mouseReleased(MouseEvent evt) + { + mouseDragging = false; + + int res = (evt.getX() / av.getCharWidth()) + av.getStartRes(); + + if (res > av.alignment.getWidth()) + { + res = av.alignment.getWidth() - 1; + } + + if (av.hasHiddenColumns) + { + res = av.getColumnSelection().adjustForHiddenColumns(res); + } + + if (!stretchingGroup) + { + ap.paintAlignment(false); + + return; + } + + SequenceGroup sg = av.getSelectionGroup(); + + if (res > sg.getStartRes()) + { + sg.setEndRes(res); + } + else if (res < sg.getStartRes()) + { + sg.setStartRes(res); + } + + stretchingGroup = false; + ap.paintAlignment(false); + } + + public void mouseDragged(MouseEvent evt) + { + mouseDragging = true; + + int res = (evt.getX() / av.getCharWidth()) + av.getStartRes(); + if (res < 0) + { + res = 0; + } + + if (av.hasHiddenColumns) + { + res = av.getColumnSelection().adjustForHiddenColumns(res); + } + + if (res > av.alignment.getWidth()) + { + res = av.alignment.getWidth() - 1; + } + + if (res < min) + { + min = res; + } + + if (res > max) + { + max = res; + } + + SequenceGroup sg = av.getSelectionGroup(); + + if (sg != null) + { + stretchingGroup = true; + + if (!av.getColumnSelection().contains(res)) + { + av.getColumnSelection().addElement(res); + } + + if (res > sg.getStartRes()) + { + sg.setEndRes(res); + } + if (res < sg.getStartRes()) + { + sg.setStartRes(res); + } + + int col; + for (int i = min; i <= max; i++) + { + col = av.getColumnSelection().adjustForHiddenColumns(i); + + if ( (col < sg.getStartRes()) || (col > sg.getEndRes())) + { + av.getColumnSelection().removeElement(col); + } + else + { + av.getColumnSelection().addElement(col); + } + } + + ap.paintAlignment(false); + } + } + + public void mouseEntered(MouseEvent evt) + { + if (mouseDragging) + { + ap.seqPanel.scrollCanvas(null); + } + } + + public void mouseExited(MouseEvent evt) + { + if (mouseDragging) + { + ap.seqPanel.scrollCanvas(evt); + } + } + + public void mouseClicked(MouseEvent evt) + { + + } + + public void mouseMoved(MouseEvent evt) + { + if (!av.hasHiddenColumns) + { + return; + } + + int res = (evt.getX() / av.getCharWidth()) + av.getStartRes(); + + res = av.getColumnSelection().adjustForHiddenColumns(res); + + reveal = null; + for (int i = 0; i < av.getColumnSelection().getHiddenColumns().size(); i++) + { + int[] region = (int[]) av.getColumnSelection().getHiddenColumns(). + elementAt(i); + if (res + 1 == region[0] || res - 1 == region[1]) + { + reveal = region; + break; + } + } + + repaint(); + } + + public void update(Graphics g) + { + paint(g); + } + + public void paint(Graphics g) + { + drawScale(g, av.getStartRes(), av.getEndRes(), getSize().width, + getSize().height); + } + +// scalewidth will normally be screenwidth, + public void drawScale(Graphics gg, int startx, int endx, int width, + int height) + { + gg.setFont(av.getFont()); + + //Fill in the background + gg.setColor(Color.white); + gg.fillRect(0, 0, width, height); + gg.setColor(Color.black); + + //Fill the selected columns + ColumnSelection cs = av.getColumnSelection(); + gg.setColor(new Color(220, 0, 0)); + + for (int i = 0; i < cs.size(); i++) + { + int sel = cs.columnAt(i); + if (av.hasHiddenColumns) + { + sel = av.getColumnSelection().findColumnPosition(sel); + } + + if ( (sel >= startx) && (sel <= endx)) + { + gg.fillRect( (sel - startx) * av.charWidth, 0, av.charWidth, + getSize().height); + } + } + + // Draw the scale numbers + gg.setColor(Color.black); + + int scalestartx = (startx / 10) * 10; + + FontMetrics fm = gg.getFontMetrics(av.getFont()); + int y = av.charHeight - fm.getDescent(); + + if ( (scalestartx % 10) == 0) + { + scalestartx += 5; + } + + String string; + int maxX = 0; + + for (int i = scalestartx; i < endx; i += 5) + { + if ( (i % 10) == 0) + { + string = String.valueOf(av.getColumnSelection().adjustForHiddenColumns( + i)); + if ( (i - startx - 1) * av.charWidth > maxX) + { + gg.drawString(string, + (i - startx - 1) * av.charWidth, y); + maxX = (i - startx + 1) * av.charWidth + fm.stringWidth(string); + } + + gg.drawLine( (int) ( ( (i - startx - 1) * av.charWidth) + + (av.charWidth / 2)), y + 2, + (int) ( ( (i - startx - 1) * av.charWidth) + + (av.charWidth / 2)), + y + (fm.getDescent() * 2)); + + } + else + { + gg.drawLine( (int) ( ( (i - startx - 1) * av.charWidth) + + (av.charWidth / 2)), y + fm.getDescent(), + (int) ( ( (i - startx - 1) * av.charWidth) + + (av.charWidth / 2)), y + (fm.getDescent() * 2)); + } + } + + if (av.hasHiddenColumns) + { + gg.setColor(Color.blue); + int res; + if (av.getShowHiddenMarkers()) + { + for (int i = 0; i < av.getColumnSelection().getHiddenColumns().size(); + i++) + { + + res = av.getColumnSelection().findHiddenRegionPosition(i) - + startx; + + if (res < 0 || res > endx - scalestartx) + { + continue; + } + + gg.fillPolygon(new int[] + {res * av.charWidth - av.charHeight / 4, + res * av.charWidth + av.charHeight / 4, + res * av.charWidth}, + new int[] + { + y - av.charHeight / 2, y - av.charHeight / 2, + y + 8 + }, 3); + + } + } + + if (reveal != null && reveal[0] > startx && reveal[0] < endx) + { + gg.drawString("Reveal Columns", reveal[0] * av.charWidth, 0); + } + } + + } + +} diff --git a/src/jalview/appletgui/SeqCanvas.java b/src/jalview/appletgui/SeqCanvas.java index 5fb956c..dcf205e 100755 --- a/src/jalview/appletgui/SeqCanvas.java +++ b/src/jalview/appletgui/SeqCanvas.java @@ -1,825 +1,824 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -package jalview.appletgui; - -import java.awt.*; - -import jalview.datamodel.*; - -public class SeqCanvas - extends Panel -{ - FeatureRenderer fr; - SequenceRenderer sr; - Image img; - Graphics gg; - int imgWidth; - int imgHeight; - - AlignViewport av; - - SearchResults searchResults = null; - - boolean fastPaint = false; - - int cursorX = 0; - int cursorY = 0; - - public SeqCanvas(AlignViewport av) - { - this.av = av; - fr = new FeatureRenderer(av); - sr = new SequenceRenderer(av); - PaintRefresher.Register(this, av.getSequenceSetId()); - } - - public AlignViewport getViewport() - { - return av; - } - - public FeatureRenderer getFeatureRenderer() - { - return fr; - } - - public SequenceRenderer getSequenceRenderer() - { - return sr; - } - - void drawNorthScale(Graphics g, int startx, int endx, int ypos) - { - int scalestartx = startx - startx % 10 + 10; - - g.setColor(Color.black); - - // NORTH SCALE - for (int i = scalestartx; i < endx; i += 10) - { - int value = i; - if (av.hasHiddenColumns) - { - value = av.getColumnSelection().adjustForHiddenColumns(value); - } - - g.drawString(String.valueOf(value), (i - startx - 1) * av.charWidth, - ypos - (av.charHeight / 2)); - - g.drawLine( ( (i - startx - 1) * av.charWidth) + (av.charWidth / 2), - (ypos + 2) - (av.charHeight / 2), - ( (i - startx - 1) * av.charWidth) + (av.charWidth / 2), ypos - - 2); - } - } - - void drawWestScale(Graphics g, int startx, int endx, int ypos) - { - FontMetrics fm = getFontMetrics(av.getFont()); - ypos += av.charHeight; - if (av.hasHiddenColumns) - { - startx = av.getColumnSelection().adjustForHiddenColumns(startx); - endx = av.getColumnSelection().adjustForHiddenColumns(endx); - } - - int maxwidth = av.alignment.getWidth(); - if (av.hasHiddenColumns) - { - maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1; - } - - // WEST SCALE - for (int i = 0; i < av.alignment.getHeight(); i++) - { - SequenceI seq = av.alignment.getSequenceAt(i); - int index = startx; - int value = -1; - - while (index < endx) - { - if (jalview.util.Comparison.isGap(seq.getCharAt(index))) - { - index++; - - continue; - } - - value = av.alignment.getSequenceAt(i).findPosition(index); - - break; - } - - if (value != -1) - { - int x = LABEL_WEST - fm.stringWidth(String.valueOf(value)) - - av.charWidth / 2; - g.drawString(value + "", x, - (ypos + (i * av.charHeight)) - (av.charHeight / 5)); - } - } - } - - void drawEastScale(Graphics g, int startx, int endx, int ypos) - { - ypos += av.charHeight; - - if (av.hasHiddenColumns) - { - endx = av.getColumnSelection().adjustForHiddenColumns(endx); - } - - SequenceI seq; - // EAST SCALE - for (int i = 0; i < av.alignment.getHeight(); i++) - { - seq = av.alignment.getSequenceAt(i); - int index = endx; - int value = -1; - - while (index > startx) - { - if (jalview.util.Comparison.isGap(seq.getCharAt(index))) - { - index--; - - continue; - } - - value = seq.findPosition(index); - - break; - } - - if (value != -1) - { - g.drawString(String.valueOf(value), 0, - (ypos + (i * av.charHeight)) - (av.charHeight / 5)); - } - } - } - - int lastsr = 0; - void fastPaint(int horizontal, int vertical) - { - if (fastPaint || gg == null) - { - return; - } - - // Its possible on certain browsers that the call to fastpaint - // is faster than it can paint, so this check here catches - // this possibility - if (lastsr + horizontal != av.startRes) - { - horizontal = av.startRes - lastsr; - } - - lastsr = av.startRes; - - fastPaint = true; - gg.copyArea(horizontal * av.charWidth, - vertical * av.charHeight, - imgWidth - horizontal * av.charWidth, - imgHeight - vertical * av.charHeight, - -horizontal * av.charWidth, - -vertical * av.charHeight); - - int sr = av.startRes, er = av.endRes, ss = av.startSeq, es = av.endSeq, - transX = 0, transY = 0; - - if (horizontal > 0) // scrollbar pulled right, image to the left - { - transX = (er - sr - horizontal) * av.charWidth; - sr = er - horizontal; - } - else if (horizontal < 0) - { - er = sr - horizontal; - } - - else if (vertical > 0) // scroll down - { - ss = es - vertical; - if (ss < av.startSeq) // ie scrolling too fast, more than a page at a time - { - ss = av.startSeq; - } - else - { - transY = imgHeight - vertical * av.charHeight; - } - } - else if (vertical < 0) - { - es = ss - vertical; - if (es > av.endSeq) - { - es = av.endSeq; - } - } - - gg.translate(transX, transY); - - drawPanel(gg, sr, er, ss, es, 0); - gg.translate( -transX, -transY); - - repaint(); - - } - - /** - * Definitions of startx and endx (hopefully): - * SMJS This is what I'm working towards! - * startx is the first residue (starting at 0) to display. - * endx is the last residue to display (starting at 0). - * starty is the first sequence to display (starting at 0). - * endy is the last sequence to display (starting at 0). - * NOTE 1: The av limits are set in setFont in this class and - * in the adjustment listener in SeqPanel when the scrollbars move. - */ - public void update(Graphics g) - { - paint(g); - } - - public void paint(Graphics g) - { - - if (img != null && (fastPaint - || (getSize().width != g.getClipBounds().width) - || (getSize().height != g.getClipBounds().height))) - { - g.drawImage(img, 0, 0, this); - fastPaint = false; - return; - } - - if (fastPaint) - { - g.drawImage(img, 0, 0, this); - fastPaint = false; - return; - } - - // this draws the whole of the alignment - imgWidth = this.getSize().width; - imgHeight = this.getSize().height; - - imgWidth -= imgWidth % av.charWidth; - imgHeight -= imgHeight % av.charHeight; - - if (imgWidth < 1 || imgHeight < 1) - { - return; - } - - if (img == null || imgWidth != img.getWidth(this) || - imgHeight != img.getHeight(this)) - { - img = createImage(imgWidth, imgHeight); - gg = img.getGraphics(); - gg.setFont(av.getFont()); - } - - gg.setColor(Color.white); - gg.fillRect(0, 0, imgWidth, imgHeight); - - if (av.getWrapAlignment()) - { - drawWrappedPanel(gg, imgWidth, imgHeight, av.startRes); - } - else - { - drawPanel(gg, av.startRes, av.endRes, av.startSeq, av.endSeq, 0); - } - - g.drawImage(img, 0, 0, this); - - } - - int LABEL_WEST, LABEL_EAST; - public int getWrappedCanvasWidth(int cwidth) - { - cwidth -= cwidth % av.charWidth; - - FontMetrics fm = getFontMetrics(av.getFont()); - - LABEL_EAST = 0; - LABEL_WEST = 0; - - if (av.scaleRightWrapped) - { - LABEL_EAST = fm.stringWidth(getMask()); - } - - if (av.scaleLeftWrapped) - { - LABEL_WEST = fm.stringWidth(getMask()); - } - - return (cwidth - LABEL_EAST - LABEL_WEST) / av.charWidth; - } - - /** - * Generates a string of zeroes. - * @return String - */ - String getMask() - { - String mask = "0"; - int maxWidth = 0; - int tmp; - for (int i = 0; i < av.alignment.getHeight(); i++) - { - tmp = av.alignment.getSequenceAt(i).getEnd(); - if (tmp > maxWidth) - { - maxWidth = tmp; - } - } - - for (int i = maxWidth; i > 0; i /= 10) - { - mask += "0"; - } - return mask; - } - - public void drawWrappedPanel(Graphics g, int canvasWidth, int canvasHeight, - int startRes) - { - AlignmentI al = av.getAlignment(); - - FontMetrics fm = getFontMetrics(av.getFont()); - - if (av.scaleRightWrapped) - { - LABEL_EAST = fm.stringWidth(getMask()); - } - - if (av.scaleLeftWrapped) - { - LABEL_WEST = fm.stringWidth(getMask()); - } - - int hgap = av.charHeight; - if (av.scaleAboveWrapped) - { - hgap += av.charHeight; - } - - int cWidth = (canvasWidth - LABEL_EAST - LABEL_WEST) / av.charWidth; - int cHeight = av.getAlignment().getHeight() * av.charHeight; - - av.setWrappedWidth(cWidth); - - av.endRes = av.startRes + cWidth; - - int endx; - int ypos = hgap; - - int maxwidth = av.alignment.getWidth() - 1; - - if (av.hasHiddenColumns) - { - maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1; - } - - while ( (ypos <= canvasHeight) && (startRes < maxwidth)) - { - endx = startRes + cWidth - 1; - - if (endx > maxwidth) - { - endx = maxwidth; - } - - g.setColor(Color.black); - - if (av.scaleLeftWrapped) - { - drawWestScale(g, startRes, endx, ypos); - } - - if (av.scaleRightWrapped) - { - g.translate(canvasWidth - LABEL_EAST, 0); - drawEastScale(g, startRes, endx, ypos); - g.translate( - (canvasWidth - LABEL_EAST), 0); - } - - g.translate(LABEL_WEST, 0); - - if (av.scaleAboveWrapped) - { - drawNorthScale(g, startRes, endx, ypos); - } - if (av.hasHiddenColumns && av.showHiddenMarkers) - { - g.setColor(Color.blue); - int res; - for (int i = 0; i < av.getColumnSelection().getHiddenColumns().size(); - i++) - { - res = av.getColumnSelection().findHiddenRegionPosition(i) - - startRes; - - if (res < 0 || res > endx - startRes) - { - continue; - } - - gg.fillPolygon(new int[] - {res * av.charWidth - av.charHeight / 4, - res * av.charWidth + av.charHeight / 4, - res * av.charWidth}, - new int[] - { - ypos - (av.charHeight / 2), - ypos - (av.charHeight / 2), - ypos - (av.charHeight / 2) + 8 - }, 3); - - } - } - - if (g.getClip() == null) - { - g.setClip(0, 0, cWidth * av.charWidth, canvasHeight); - } - - drawPanel(g, startRes, endx, 0, al.getHeight(), ypos); - g.setClip(null); - - if (av.showAnnotation) - { - g.translate(0, cHeight + ypos + 4); - if (annotations == null) - { - annotations = new AnnotationPanel(av); - } - - annotations.drawComponent(g, startRes, endx + 1); - g.translate(0, -cHeight - ypos - 4); - } - g.translate( -LABEL_WEST, 0); - - ypos += cHeight + getAnnotationHeight() + hgap; - - startRes += cWidth; - } - - } - - AnnotationPanel annotations; - int getAnnotationHeight() - { - if (!av.showAnnotation) - { - return 0; - } - - if (annotations == null) - { - annotations = new AnnotationPanel(av); - } - - return annotations.adjustPanelHeight(); - } - - void drawPanel(Graphics g1, int startRes, int endRes, - int startSeq, int endSeq, int offset) - { - if (!av.hasHiddenColumns) - { - draw(g1, startRes, endRes, startSeq, endSeq, offset); - } - else - { - java.util.Vector regions = av.getColumnSelection().getHiddenColumns(); - - int screenY = 0; - int blockStart = startRes; - int blockEnd = endRes; - - for (int i = 0; i < regions.size(); i++) - { - int[] region = (int[]) regions.elementAt(i); - int hideStart = region[0]; - int hideEnd = region[1]; - - if (hideStart <= blockStart) - { - blockStart += (hideEnd - hideStart) + 1; - continue; - } - - blockEnd = hideStart - 1; - - g1.translate(screenY * av.charWidth, 0); - - draw(g1, blockStart, blockEnd, startSeq, endSeq, offset); - - if (av.getShowHiddenMarkers()) - { - g1.setColor(Color.blue); - g1.drawLine( (blockEnd - blockStart + 1) * av.charWidth - 1, - 0 + offset, - (blockEnd - blockStart + 1) * av.charWidth - 1, - (endSeq - startSeq) * av.charHeight + offset); - } - - g1.translate( -screenY * av.charWidth, 0); - screenY += blockEnd - blockStart + 1; - blockStart = hideEnd + 1; - } - - if (screenY <= (endRes - startRes)) - { - blockEnd = blockStart + (endRes - startRes) - screenY; - g1.translate(screenY * av.charWidth, 0); - draw(g1, blockStart, blockEnd, startSeq, endSeq, offset); - - g1.translate( -screenY * av.charWidth, 0); - } - } - - } - - //int startRes, int endRes, int startSeq, int endSeq, int x, int y, - // int x1, int x2, int y1, int y2, int startx, int starty, - void draw(Graphics g, - int startRes, int endRes, - int startSeq, int endSeq, - int offset) - { - g.setFont(av.getFont()); - sr.prepare(g, av.renderGaps); - - SequenceI nextSeq; - - /// First draw the sequences - ///////////////////////////// - for (int i = startSeq; i < endSeq; i++) - { - nextSeq = av.alignment.getSequenceAt(i); - - if (nextSeq == null) - { - continue; - } - - sr.drawSequence(nextSeq, av.alignment.findAllGroups(nextSeq), - startRes, endRes, - offset + ( (i - startSeq) * av.charHeight)); - - if (av.showSequenceFeatures) - { - fr.drawSequence(g, nextSeq, startRes, endRes, - offset + ( (i - startSeq) * av.charHeight)); - } - - /// Highlight search Results once all sequences have been drawn - ////////////////////////////////////////////////////////// - if (searchResults != null) - { - int[] visibleResults = searchResults.getResults(nextSeq, 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) * - av.charWidth, - offset + ( (i - startSeq) * av.charHeight)); - } - } - } - - if (av.cursorMode && cursorY == i - && cursorX >= startRes && cursorX <= endRes) - { - sr.drawCursor(nextSeq, cursorX, (cursorX - startRes) * av.charWidth, - offset + ( (i - startSeq) * av.charHeight)); - } - } - - if (av.getSelectionGroup() != null || av.alignment.getGroups().size() > 0) - { - drawGroupsBoundaries(g, startRes, endRes, startSeq, endSeq, offset); - } - - } - - void drawGroupsBoundaries(Graphics g, - int startRes, int endRes, - int startSeq, int endSeq, - int offset) - { - // - ///////////////////////////////////// - // Now outline any areas if necessary - ///////////////////////////////////// - SequenceGroup group = av.getSelectionGroup(); - - int sx = -1; - int sy = -1; - int ex = -1; - int groupIndex = -1; - - if ( (group == null) && (av.alignment.getGroups().size() > 0)) - { - group = (SequenceGroup) av.alignment.getGroups().elementAt(0); - groupIndex = 0; - } - - if (group != null) - { - do - { - int oldY = -1; - int i = 0; - boolean inGroup = false; - int top = -1; - int bottom = -1; - int alHeight = av.alignment.getHeight() - 1; - - for (i = startSeq; i < endSeq; i++) - { - sx = (group.getStartRes() - startRes) * av.charWidth; - sy = offset + ( (i - startSeq) * av.charHeight); - ex = ( ( (group.getEndRes() + 1) - group.getStartRes()) * - av.charWidth) - - 1; - - if (sx + ex < 0 || sx > imgWidth) - { - continue; - } - - if ( (sx <= (endRes - startRes) * av.charWidth) && - group.getSequences(null). - contains(av.alignment.getSequenceAt(i))) - { - if ( (bottom == -1) && - (i >= alHeight || - !group.getSequences(null).contains( - av.alignment.getSequenceAt(i + 1)))) - { - bottom = sy + av.charHeight; - } - - if (!inGroup) - { - if ( ( (top == -1) && (i == 0)) || - !group.getSequences(null).contains( - av.alignment.getSequenceAt(i - 1))) - { - top = sy; - } - - oldY = sy; - inGroup = true; - - if (group == av.getSelectionGroup()) - { - g.setColor(Color.red); - } - else - { - g.setColor(group.getOutlineColour()); - } - } - } - else - { - if (inGroup) - { - if (sx >= 0 && sx < imgWidth) - { - g.drawLine(sx, oldY, sx, sy); - } - - if (sx + ex < imgWidth) - { - g.drawLine(sx + ex, oldY, sx + ex, sy); - } - - if (sx < 0) - { - ex += sx; - sx = 0; - } - - if (sx + ex > imgWidth) - { - ex = imgWidth; - } - - else if (sx + ex >= (endRes - startRes + 1) * av.charWidth) - { - ex = (endRes - startRes + 1) * av.charWidth; - } - - if (top != -1) - { - g.drawLine(sx, top, sx + ex, top); - top = -1; - } - - if (bottom != -1) - { - g.drawLine(sx, bottom, sx + ex, bottom); - bottom = -1; - } - - inGroup = false; - } - } - } - - if (inGroup) - { - sy = offset + ( (i - startSeq) * av.charHeight); - if (sx >= 0 && sx < imgWidth) - { - g.drawLine(sx, oldY, sx, sy); - } - - if (sx + ex < imgWidth) - { - g.drawLine(sx + ex, oldY, sx + ex, sy); - } - - if (sx < 0) - { - ex += sx; - sx = 0; - } - - if (sx + ex > imgWidth) - { - ex = imgWidth; - } - else if (sx + ex >= (endRes - startRes + 1) * av.charWidth) - { - ex = (endRes - startRes + 1) * av.charWidth; - } - - if (top != -1) - { - g.drawLine(sx, top, sx + ex, top); - top = -1; - } - - if (bottom != -1) - { - g.drawLine(sx, bottom - 1, sx + ex, bottom - 1); - bottom = -1; - } - - inGroup = false; - } - - groupIndex++; - - if (groupIndex >= av.alignment.getGroups().size()) - { - break; - } - - group = (SequenceGroup) av.alignment.getGroups().elementAt(groupIndex); - } - while (groupIndex < av.alignment.getGroups().size()); - - } - } - - public void highlightSearchResults(SearchResults results) - { - searchResults = results; - - repaint(); - } - -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.appletgui; + +import java.awt.*; + +import jalview.datamodel.*; + +public class SeqCanvas + extends Panel +{ + FeatureRenderer fr; + SequenceRenderer sr; + Image img; + Graphics gg; + int imgWidth; + int imgHeight; + + AlignViewport av; + + SearchResults searchResults = null; + + boolean fastPaint = false; + + int cursorX = 0; + int cursorY = 0; + + public SeqCanvas(AlignViewport av) + { + this.av = av; + fr = new FeatureRenderer(av); + sr = new SequenceRenderer(av); + PaintRefresher.Register(this, av.getSequenceSetId()); + } + + public AlignViewport getViewport() + { + return av; + } + + public FeatureRenderer getFeatureRenderer() + { + return fr; + } + + public SequenceRenderer getSequenceRenderer() + { + return sr; + } + + void drawNorthScale(Graphics g, int startx, int endx, int ypos) + { + int scalestartx = startx - startx % 10 + 10; + + g.setColor(Color.black); + + // NORTH SCALE + for (int i = scalestartx; i < endx; i += 10) + { + int value = i; + if (av.hasHiddenColumns) + { + value = av.getColumnSelection().adjustForHiddenColumns(value); + } + + g.drawString(String.valueOf(value), (i - startx - 1) * av.charWidth, + ypos - (av.charHeight / 2)); + + g.drawLine( ( (i - startx - 1) * av.charWidth) + (av.charWidth / 2), + (ypos + 2) - (av.charHeight / 2), + ( (i - startx - 1) * av.charWidth) + (av.charWidth / 2), ypos - + 2); + } + } + + void drawWestScale(Graphics g, int startx, int endx, int ypos) + { + FontMetrics fm = getFontMetrics(av.getFont()); + ypos += av.charHeight; + if (av.hasHiddenColumns) + { + startx = av.getColumnSelection().adjustForHiddenColumns(startx); + endx = av.getColumnSelection().adjustForHiddenColumns(endx); + } + + int maxwidth = av.alignment.getWidth(); + if (av.hasHiddenColumns) + { + maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1; + } + + // WEST SCALE + for (int i = 0; i < av.alignment.getHeight(); i++) + { + SequenceI seq = av.alignment.getSequenceAt(i); + int index = startx; + int value = -1; + + while (index < endx) + { + if (jalview.util.Comparison.isGap(seq.getCharAt(index))) + { + index++; + + continue; + } + + value = av.alignment.getSequenceAt(i).findPosition(index); + + break; + } + + if (value != -1) + { + int x = LABEL_WEST - fm.stringWidth(String.valueOf(value)) - + av.charWidth / 2; + g.drawString(value + "", x, + (ypos + (i * av.charHeight)) - (av.charHeight / 5)); + } + } + } + + void drawEastScale(Graphics g, int startx, int endx, int ypos) + { + ypos += av.charHeight; + + if (av.hasHiddenColumns) + { + endx = av.getColumnSelection().adjustForHiddenColumns(endx); + } + + SequenceI seq; + // EAST SCALE + for (int i = 0; i < av.alignment.getHeight(); i++) + { + seq = av.alignment.getSequenceAt(i); + int index = endx; + int value = -1; + + while (index > startx) + { + if (jalview.util.Comparison.isGap(seq.getCharAt(index))) + { + index--; + + continue; + } + + value = seq.findPosition(index); + + break; + } + + if (value != -1) + { + g.drawString(String.valueOf(value), 0, + (ypos + (i * av.charHeight)) - (av.charHeight / 5)); + } + } + } + + int lastsr = 0; + void fastPaint(int horizontal, int vertical) + { + if (fastPaint || gg == null) + { + return; + } + + // Its possible on certain browsers that the call to fastpaint + // is faster than it can paint, so this check here catches + // this possibility + if (lastsr + horizontal != av.startRes) + { + horizontal = av.startRes - lastsr; + } + + lastsr = av.startRes; + + fastPaint = true; + gg.copyArea(horizontal * av.charWidth, + vertical * av.charHeight, + imgWidth - horizontal * av.charWidth, + imgHeight - vertical * av.charHeight, + -horizontal * av.charWidth, + -vertical * av.charHeight); + + int sr = av.startRes, er = av.endRes, ss = av.startSeq, es = av.endSeq, + transX = 0, transY = 0; + + if (horizontal > 0) // scrollbar pulled right, image to the left + { + transX = (er - sr - horizontal) * av.charWidth; + sr = er - horizontal; + } + else if (horizontal < 0) + { + er = sr - horizontal; + } + + else if (vertical > 0) // scroll down + { + ss = es - vertical; + if (ss < av.startSeq) // ie scrolling too fast, more than a page at a time + { + ss = av.startSeq; + } + else + { + transY = imgHeight - vertical * av.charHeight; + } + } + else if (vertical < 0) + { + es = ss - vertical; + if (es > av.endSeq) + { + es = av.endSeq; + } + } + + gg.translate(transX, transY); + + drawPanel(gg, sr, er, ss, es, 0); + gg.translate( -transX, -transY); + + repaint(); + + } + + /** + * Definitions of startx and endx (hopefully): + * SMJS This is what I'm working towards! + * startx is the first residue (starting at 0) to display. + * endx is the last residue to display (starting at 0). + * starty is the first sequence to display (starting at 0). + * endy is the last sequence to display (starting at 0). + * NOTE 1: The av limits are set in setFont in this class and + * in the adjustment listener in SeqPanel when the scrollbars move. + */ + public void update(Graphics g) + { + paint(g); + } + + public void paint(Graphics g) + { + + if (img != null && (fastPaint + || (getSize().width != g.getClipBounds().width) + || (getSize().height != g.getClipBounds().height))) + { + g.drawImage(img, 0, 0, this); + fastPaint = false; + return; + } + + if (fastPaint) + { + g.drawImage(img, 0, 0, this); + fastPaint = false; + return; + } + + // this draws the whole of the alignment + imgWidth = this.getSize().width; + imgHeight = this.getSize().height; + + imgWidth -= imgWidth % av.charWidth; + imgHeight -= imgHeight % av.charHeight; + + if (imgWidth < 1 || imgHeight < 1) + { + return; + } + + if (img == null || imgWidth != img.getWidth(this) || + imgHeight != img.getHeight(this)) + { + img = createImage(imgWidth, imgHeight); + gg = img.getGraphics(); + gg.setFont(av.getFont()); + } + + gg.setColor(Color.white); + gg.fillRect(0, 0, imgWidth, imgHeight); + + if (av.getWrapAlignment()) + { + drawWrappedPanel(gg, imgWidth, imgHeight, av.startRes); + } + else + { + drawPanel(gg, av.startRes, av.endRes, av.startSeq, av.endSeq, 0); + } + + g.drawImage(img, 0, 0, this); + + } + + int LABEL_WEST, LABEL_EAST; + public int getWrappedCanvasWidth(int cwidth) + { + cwidth -= cwidth % av.charWidth; + + FontMetrics fm = getFontMetrics(av.getFont()); + + LABEL_EAST = 0; + LABEL_WEST = 0; + + if (av.scaleRightWrapped) + { + LABEL_EAST = fm.stringWidth(getMask()); + } + + if (av.scaleLeftWrapped) + { + LABEL_WEST = fm.stringWidth(getMask()); + } + + return (cwidth - LABEL_EAST - LABEL_WEST) / av.charWidth; + } + + /** + * Generates a string of zeroes. + * @return String + */ + String getMask() + { + String mask = "0"; + int maxWidth = 0; + int tmp; + for (int i = 0; i < av.alignment.getHeight(); i++) + { + tmp = av.alignment.getSequenceAt(i).getEnd(); + if (tmp > maxWidth) + { + maxWidth = tmp; + } + } + + for (int i = maxWidth; i > 0; i /= 10) + { + mask += "0"; + } + return mask; + } + + public void drawWrappedPanel(Graphics g, int canvasWidth, int canvasHeight, + int startRes) + { + AlignmentI al = av.getAlignment(); + + FontMetrics fm = getFontMetrics(av.getFont()); + + if (av.scaleRightWrapped) + { + LABEL_EAST = fm.stringWidth(getMask()); + } + + if (av.scaleLeftWrapped) + { + LABEL_WEST = fm.stringWidth(getMask()); + } + + int hgap = av.charHeight; + if (av.scaleAboveWrapped) + { + hgap += av.charHeight; + } + + int cWidth = (canvasWidth - LABEL_EAST - LABEL_WEST) / av.charWidth; + int cHeight = av.getAlignment().getHeight() * av.charHeight; + + av.setWrappedWidth(cWidth); + + av.endRes = av.startRes + cWidth; + + int endx; + int ypos = hgap; + + int maxwidth = av.alignment.getWidth() - 1; + + if (av.hasHiddenColumns) + { + maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1; + } + + while ( (ypos <= canvasHeight) && (startRes < maxwidth)) + { + endx = startRes + cWidth - 1; + + if (endx > maxwidth) + { + endx = maxwidth; + } + + g.setColor(Color.black); + + if (av.scaleLeftWrapped) + { + drawWestScale(g, startRes, endx, ypos); + } + + if (av.scaleRightWrapped) + { + g.translate(canvasWidth - LABEL_EAST, 0); + drawEastScale(g, startRes, endx, ypos); + g.translate( - (canvasWidth - LABEL_EAST), 0); + } + + g.translate(LABEL_WEST, 0); + + if (av.scaleAboveWrapped) + { + drawNorthScale(g, startRes, endx, ypos); + } + if (av.hasHiddenColumns && av.showHiddenMarkers) + { + g.setColor(Color.blue); + int res; + for (int i = 0; i < av.getColumnSelection().getHiddenColumns().size(); + i++) + { + res = av.getColumnSelection().findHiddenRegionPosition(i) - + startRes; + + if (res < 0 || res > endx - startRes) + { + continue; + } + + gg.fillPolygon(new int[] + {res * av.charWidth - av.charHeight / 4, + res * av.charWidth + av.charHeight / 4, + res * av.charWidth}, + new int[] + { + ypos - (av.charHeight / 2), + ypos - (av.charHeight / 2), + ypos - (av.charHeight / 2) + 8 + }, 3); + + } + } + + if (g.getClip() == null) + { + g.setClip(0, 0, cWidth * av.charWidth, canvasHeight); + } + + drawPanel(g, startRes, endx, 0, al.getHeight(), ypos); + g.setClip(null); + + if (av.showAnnotation) + { + g.translate(0, cHeight + ypos + 4); + if (annotations == null) + { + annotations = new AnnotationPanel(av); + } + + annotations.drawComponent(g, startRes, endx + 1); + g.translate(0, -cHeight - ypos - 4); + } + g.translate( -LABEL_WEST, 0); + + ypos += cHeight + getAnnotationHeight() + hgap; + + startRes += cWidth; + } + + } + + AnnotationPanel annotations; + int getAnnotationHeight() + { + if (!av.showAnnotation) + { + return 0; + } + + if (annotations == null) + { + annotations = new AnnotationPanel(av); + } + + return annotations.adjustPanelHeight(); + } + + void drawPanel(Graphics g1, int startRes, int endRes, + int startSeq, int endSeq, int offset) + { + if (!av.hasHiddenColumns) + { + draw(g1, startRes, endRes, startSeq, endSeq, offset); + } + else + { + java.util.Vector regions = av.getColumnSelection().getHiddenColumns(); + + int screenY = 0; + int blockStart = startRes; + int blockEnd = endRes; + + for (int i = 0; i < regions.size(); i++) + { + int[] region = (int[]) regions.elementAt(i); + int hideStart = region[0]; + int hideEnd = region[1]; + + if (hideStart <= blockStart) + { + blockStart += (hideEnd - hideStart) + 1; + continue; + } + + blockEnd = hideStart - 1; + + g1.translate(screenY * av.charWidth, 0); + + draw(g1, blockStart, blockEnd, startSeq, endSeq, offset); + + if (av.getShowHiddenMarkers()) + { + g1.setColor(Color.blue); + g1.drawLine( (blockEnd - blockStart + 1) * av.charWidth - 1, + 0 + offset, + (blockEnd - blockStart + 1) * av.charWidth - 1, + (endSeq - startSeq) * av.charHeight + offset); + } + + g1.translate( -screenY * av.charWidth, 0); + screenY += blockEnd - blockStart + 1; + blockStart = hideEnd + 1; + } + + if (screenY <= (endRes - startRes)) + { + blockEnd = blockStart + (endRes - startRes) - screenY; + g1.translate(screenY * av.charWidth, 0); + draw(g1, blockStart, blockEnd, startSeq, endSeq, offset); + + g1.translate( -screenY * av.charWidth, 0); + } + } + + } + + //int startRes, int endRes, int startSeq, int endSeq, int x, int y, + // int x1, int x2, int y1, int y2, int startx, int starty, + void draw(Graphics g, + int startRes, int endRes, + int startSeq, int endSeq, + int offset) + { + g.setFont(av.getFont()); + sr.prepare(g, av.renderGaps); + + SequenceI nextSeq; + + /// First draw the sequences + ///////////////////////////// + for (int i = startSeq; i < endSeq; i++) + { + nextSeq = av.alignment.getSequenceAt(i); + + if (nextSeq == null) + { + continue; + } + + sr.drawSequence(nextSeq, av.alignment.findAllGroups(nextSeq), + startRes, endRes, + offset + ( (i - startSeq) * av.charHeight)); + + if (av.showSequenceFeatures) + { + fr.drawSequence(g, nextSeq, startRes, endRes, + offset + ( (i - startSeq) * av.charHeight)); + } + + /// Highlight search Results once all sequences have been drawn + ////////////////////////////////////////////////////////// + if (searchResults != null) + { + int[] visibleResults = searchResults.getResults(nextSeq, 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) * + av.charWidth, + offset + ( (i - startSeq) * av.charHeight)); + } + } + } + + if (av.cursorMode && cursorY == i + && cursorX >= startRes && cursorX <= endRes) + { + sr.drawCursor(nextSeq, cursorX, (cursorX - startRes) * av.charWidth, + offset + ( (i - startSeq) * av.charHeight)); + } + } + + if (av.getSelectionGroup() != null || av.alignment.getGroups().size() > 0) + { + drawGroupsBoundaries(g, startRes, endRes, startSeq, endSeq, offset); + } + + } + + void drawGroupsBoundaries(Graphics g, + int startRes, int endRes, + int startSeq, int endSeq, + int offset) + { + // + ///////////////////////////////////// + // Now outline any areas if necessary + ///////////////////////////////////// + SequenceGroup group = av.getSelectionGroup(); + + int sx = -1; + int sy = -1; + int ex = -1; + int groupIndex = -1; + + if ( (group == null) && (av.alignment.getGroups().size() > 0)) + { + group = (SequenceGroup) av.alignment.getGroups().elementAt(0); + groupIndex = 0; + } + + if (group != null) + { + do + { + int oldY = -1; + int i = 0; + boolean inGroup = false; + int top = -1; + int bottom = -1; + int alHeight = av.alignment.getHeight() - 1; + + for (i = startSeq; i < endSeq; i++) + { + sx = (group.getStartRes() - startRes) * av.charWidth; + sy = offset + ( (i - startSeq) * av.charHeight); + ex = ( ( (group.getEndRes() + 1) - group.getStartRes()) * + av.charWidth) - + 1; + + if (sx + ex < 0 || sx > imgWidth) + { + continue; + } + + if ( (sx <= (endRes - startRes) * av.charWidth) && + group.getSequences(null). + contains(av.alignment.getSequenceAt(i))) + { + if ( (bottom == -1) && + (i >= alHeight || + !group.getSequences(null).contains( + av.alignment.getSequenceAt(i + 1)))) + { + bottom = sy + av.charHeight; + } + + if (!inGroup) + { + if ( ( (top == -1) && (i == 0)) || + !group.getSequences(null).contains( + av.alignment.getSequenceAt(i - 1))) + { + top = sy; + } + + oldY = sy; + inGroup = true; + + if (group == av.getSelectionGroup()) + { + g.setColor(Color.red); + } + else + { + g.setColor(group.getOutlineColour()); + } + } + } + else + { + if (inGroup) + { + if (sx >= 0 && sx < imgWidth) + { + g.drawLine(sx, oldY, sx, sy); + } + + if (sx + ex < imgWidth) + { + g.drawLine(sx + ex, oldY, sx + ex, sy); + } + + if (sx < 0) + { + ex += sx; + sx = 0; + } + + if (sx + ex > imgWidth) + { + ex = imgWidth; + } + + else if (sx + ex >= (endRes - startRes + 1) * av.charWidth) + { + ex = (endRes - startRes + 1) * av.charWidth; + } + + if (top != -1) + { + g.drawLine(sx, top, sx + ex, top); + top = -1; + } + + if (bottom != -1) + { + g.drawLine(sx, bottom, sx + ex, bottom); + bottom = -1; + } + + inGroup = false; + } + } + } + + if (inGroup) + { + sy = offset + ( (i - startSeq) * av.charHeight); + if (sx >= 0 && sx < imgWidth) + { + g.drawLine(sx, oldY, sx, sy); + } + + if (sx + ex < imgWidth) + { + g.drawLine(sx + ex, oldY, sx + ex, sy); + } + + if (sx < 0) + { + ex += sx; + sx = 0; + } + + if (sx + ex > imgWidth) + { + ex = imgWidth; + } + else if (sx + ex >= (endRes - startRes + 1) * av.charWidth) + { + ex = (endRes - startRes + 1) * av.charWidth; + } + + if (top != -1) + { + g.drawLine(sx, top, sx + ex, top); + top = -1; + } + + if (bottom != -1) + { + g.drawLine(sx, bottom - 1, sx + ex, bottom - 1); + bottom = -1; + } + + inGroup = false; + } + + groupIndex++; + + if (groupIndex >= av.alignment.getGroups().size()) + { + break; + } + + group = (SequenceGroup) av.alignment.getGroups().elementAt(groupIndex); + } + while (groupIndex < av.alignment.getGroups().size()); + + } + } + + public void highlightSearchResults(SearchResults results) + { + searchResults = results; + + repaint(); + } + +} diff --git a/src/jalview/appletgui/SeqPanel.java b/src/jalview/appletgui/SeqPanel.java index 158f0ab..39309fd 100755 --- a/src/jalview/appletgui/SeqPanel.java +++ b/src/jalview/appletgui/SeqPanel.java @@ -1,22 +1,21 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.appletgui; import java.util.*; diff --git a/src/jalview/appletgui/SequenceRenderer.java b/src/jalview/appletgui/SequenceRenderer.java index daf971d..2885a62 100755 --- a/src/jalview/appletgui/SequenceRenderer.java +++ b/src/jalview/appletgui/SequenceRenderer.java @@ -1,333 +1,332 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -package jalview.appletgui; - -import java.awt.*; - -import jalview.datamodel.*; -import jalview.schemes.*; - -public class SequenceRenderer -{ - AlignViewport av; - FontMetrics fm; - boolean renderGaps = true; - SequenceGroup currentSequenceGroup = null; - SequenceGroup[] allGroups = null; - Color resBoxColour; - Graphics graphics; - boolean forOverview = false; - - public SequenceRenderer(AlignViewport av) - { - this.av = av; - } - - /** - * DOCUMENT ME! - * - * @param b DOCUMENT ME! - */ - public void prepare(Graphics g, boolean renderGaps) - { - graphics = g; - fm = g.getFontMetrics(); - - this.renderGaps = renderGaps; - } - - public Color getResidueBoxColour(SequenceI seq, int i) - { - allGroups = av.alignment.findAllGroups(seq); - - if (inCurrentSequenceGroup(i)) - { - if (currentSequenceGroup.getDisplayBoxes()) - { - getBoxColour(currentSequenceGroup.cs, seq, i); - } - } - else if (av.getShowBoxes()) - { - getBoxColour(av.globalColourScheme, seq, i); - } - - return resBoxColour; - } - - void getBoxColour(ColourSchemeI cs, SequenceI seq, int i) - { - if (cs != null) - { - resBoxColour = cs.findColour(seq.getCharAt(i), i); - } - else if (forOverview && !jalview.util.Comparison.isGap(seq.getCharAt(i))) - { - resBoxColour = Color.lightGray; - } - else - { - resBoxColour = Color.white; - } - - } - - public Color findSequenceColour(SequenceI seq, int i) - { - allGroups = av.alignment.findAllGroups(seq); - drawBoxes(seq, i, i, 0); - return resBoxColour; - } - - public void drawSequence(SequenceI seq, SequenceGroup[] sg, - int start, int end, int y1) - { - if (seq == null) - { - return; - } - - allGroups = sg; - - drawBoxes(seq, start, end, y1); - - if (av.validCharWidth) - { - drawText(seq, start, end, y1); - } - } - - public void drawBoxes(SequenceI seq, int start, int end, int y1) - { - int i = start; - int length = seq.getLength(); - - int curStart = -1; - int curWidth = av.charWidth; - - Color tempColour = null; - while (i <= end) - { - resBoxColour = Color.white; - if (i < length) - { - if (inCurrentSequenceGroup(i)) - { - if (currentSequenceGroup.getDisplayBoxes()) - { - getBoxColour(currentSequenceGroup.cs, seq, i); - } - } - else if (av.getShowBoxes()) - { - getBoxColour(av.getGlobalColourScheme(), seq, i); - } - } - - if (resBoxColour != tempColour) - { - if (tempColour != null) - { - graphics.fillRect(av.charWidth * (curStart - start), y1, curWidth, - av.charHeight); - } - graphics.setColor(resBoxColour); - - curStart = i; - curWidth = av.charWidth; - tempColour = resBoxColour; - - } - else - { - curWidth += av.charWidth; - } - - i++; - } - - graphics.fillRect(av.charWidth * (curStart - start), y1, curWidth, - av.charHeight); - } - - public void drawText(SequenceI seq, int start, int end, int y1) - { - Font boldFont = null; - boolean bold = false; - if (av.upperCasebold) - { - boldFont = new Font(av.getFont().getName(), Font.BOLD, av.charHeight); - - graphics.setFont(av.getFont()); - } - - y1 += av.charHeight - av.charHeight / 5; // height/5 replaces pady - - int charOffset = 0; - - // Need to find the sequence position here. - if (end + 1 >= seq.getLength()) - { - end = seq.getLength() - 1; - } - - char s = ' '; - - for (int i = start; i <= end; i++) - { - graphics.setColor(Color.black); - - s = seq.getCharAt(i); - if (!renderGaps && jalview.util.Comparison.isGap(s)) - { - continue; - } - - if (inCurrentSequenceGroup(i)) - { - if (!currentSequenceGroup.getDisplayText()) - { - continue; - } - - if (currentSequenceGroup.getColourText()) - { - getBoxColour(currentSequenceGroup.cs, seq, i); - graphics.setColor(resBoxColour.darker()); - } - } - else - { - if (!av.getShowText()) - { - continue; - } - - if (av.getColourText()) - { - getBoxColour(av.getGlobalColourScheme(), seq, i); - if (av.getShowBoxes()) - { - graphics.setColor(resBoxColour.darker()); - } - else - { - graphics.setColor(resBoxColour); - } - } - } - - if (av.upperCasebold) - { - fm = graphics.getFontMetrics(); - if ('A' <= s && s <= 'Z') - { - if (!bold) - { - - graphics.setFont(boldFont); - } - bold = true; - } - else if (bold) - { - graphics.setFont(av.font); - bold = false; - } - - } - - charOffset = (av.charWidth - fm.charWidth(s)) / 2; - graphics.drawString(String.valueOf(s), - charOffset + av.charWidth * (i - start), - y1); - } - - } - - boolean inCurrentSequenceGroup(int res) - { - if (allGroups == null) - { - return false; - } - - for (int i = 0; i < allGroups.length; i++) - { - if (allGroups[i].getStartRes() <= res && allGroups[i].getEndRes() >= res) - { - currentSequenceGroup = allGroups[i]; - return true; - } - } - - return false; - } - - public void drawHighlightedText(SequenceI seq, int start, int end, int x1, - int y1) - { - int pady = av.charHeight / 5; - int charOffset = 0; - graphics.setColor(Color.black); - graphics.fillRect(x1, y1, av.charWidth * (end - start + 1), av.charHeight); - graphics.setColor(Color.white); - - char s = '~'; - // Need to find the sequence position here. - if (av.validCharWidth) - { - for (int i = start; i <= end; i++) - { - if (i < seq.getLength()) - { - s = seq.getCharAt(i); - } - - charOffset = (av.charWidth - fm.charWidth(s)) / 2; - graphics.drawString(String.valueOf(s), - charOffset + x1 + av.charWidth * (i - start), - y1 + av.charHeight - pady); - } - } - } - - public void drawCursor(SequenceI seq, int res, int x1, int y1) - { - int pady = av.charHeight / 5; - int charOffset = 0; - graphics.setColor(Color.black); - graphics.fillRect(x1, y1, av.charWidth, av.charHeight); - graphics.setColor(Color.white); - - graphics.setColor(Color.white); - - char s = seq.getCharAt(res); - if (av.validCharWidth) - { - - charOffset = (av.charWidth - fm.charWidth(s)) / 2; - graphics.drawString(String.valueOf(s), - charOffset + x1, - (y1 + av.charHeight) - pady); - } - } - -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.appletgui; + +import java.awt.*; + +import jalview.datamodel.*; +import jalview.schemes.*; + +public class SequenceRenderer +{ + AlignViewport av; + FontMetrics fm; + boolean renderGaps = true; + SequenceGroup currentSequenceGroup = null; + SequenceGroup[] allGroups = null; + Color resBoxColour; + Graphics graphics; + boolean forOverview = false; + + public SequenceRenderer(AlignViewport av) + { + this.av = av; + } + + /** + * DOCUMENT ME! + * + * @param b DOCUMENT ME! + */ + public void prepare(Graphics g, boolean renderGaps) + { + graphics = g; + fm = g.getFontMetrics(); + + this.renderGaps = renderGaps; + } + + public Color getResidueBoxColour(SequenceI seq, int i) + { + allGroups = av.alignment.findAllGroups(seq); + + if (inCurrentSequenceGroup(i)) + { + if (currentSequenceGroup.getDisplayBoxes()) + { + getBoxColour(currentSequenceGroup.cs, seq, i); + } + } + else if (av.getShowBoxes()) + { + getBoxColour(av.globalColourScheme, seq, i); + } + + return resBoxColour; + } + + void getBoxColour(ColourSchemeI cs, SequenceI seq, int i) + { + if (cs != null) + { + resBoxColour = cs.findColour(seq.getCharAt(i), i); + } + else if (forOverview && !jalview.util.Comparison.isGap(seq.getCharAt(i))) + { + resBoxColour = Color.lightGray; + } + else + { + resBoxColour = Color.white; + } + + } + + public Color findSequenceColour(SequenceI seq, int i) + { + allGroups = av.alignment.findAllGroups(seq); + drawBoxes(seq, i, i, 0); + return resBoxColour; + } + + public void drawSequence(SequenceI seq, SequenceGroup[] sg, + int start, int end, int y1) + { + if (seq == null) + { + return; + } + + allGroups = sg; + + drawBoxes(seq, start, end, y1); + + if (av.validCharWidth) + { + drawText(seq, start, end, y1); + } + } + + public void drawBoxes(SequenceI seq, int start, int end, int y1) + { + int i = start; + int length = seq.getLength(); + + int curStart = -1; + int curWidth = av.charWidth; + + Color tempColour = null; + while (i <= end) + { + resBoxColour = Color.white; + if (i < length) + { + if (inCurrentSequenceGroup(i)) + { + if (currentSequenceGroup.getDisplayBoxes()) + { + getBoxColour(currentSequenceGroup.cs, seq, i); + } + } + else if (av.getShowBoxes()) + { + getBoxColour(av.getGlobalColourScheme(), seq, i); + } + } + + if (resBoxColour != tempColour) + { + if (tempColour != null) + { + graphics.fillRect(av.charWidth * (curStart - start), y1, curWidth, + av.charHeight); + } + graphics.setColor(resBoxColour); + + curStart = i; + curWidth = av.charWidth; + tempColour = resBoxColour; + + } + else + { + curWidth += av.charWidth; + } + + i++; + } + + graphics.fillRect(av.charWidth * (curStart - start), y1, curWidth, + av.charHeight); + } + + public void drawText(SequenceI seq, int start, int end, int y1) + { + Font boldFont = null; + boolean bold = false; + if (av.upperCasebold) + { + boldFont = new Font(av.getFont().getName(), Font.BOLD, av.charHeight); + + graphics.setFont(av.getFont()); + } + + y1 += av.charHeight - av.charHeight / 5; // height/5 replaces pady + + int charOffset = 0; + + // Need to find the sequence position here. + if (end + 1 >= seq.getLength()) + { + end = seq.getLength() - 1; + } + + char s = ' '; + + for (int i = start; i <= end; i++) + { + graphics.setColor(Color.black); + + s = seq.getCharAt(i); + if (!renderGaps && jalview.util.Comparison.isGap(s)) + { + continue; + } + + if (inCurrentSequenceGroup(i)) + { + if (!currentSequenceGroup.getDisplayText()) + { + continue; + } + + if (currentSequenceGroup.getColourText()) + { + getBoxColour(currentSequenceGroup.cs, seq, i); + graphics.setColor(resBoxColour.darker()); + } + } + else + { + if (!av.getShowText()) + { + continue; + } + + if (av.getColourText()) + { + getBoxColour(av.getGlobalColourScheme(), seq, i); + if (av.getShowBoxes()) + { + graphics.setColor(resBoxColour.darker()); + } + else + { + graphics.setColor(resBoxColour); + } + } + } + + if (av.upperCasebold) + { + fm = graphics.getFontMetrics(); + if ('A' <= s && s <= 'Z') + { + if (!bold) + { + + graphics.setFont(boldFont); + } + bold = true; + } + else if (bold) + { + graphics.setFont(av.font); + bold = false; + } + + } + + charOffset = (av.charWidth - fm.charWidth(s)) / 2; + graphics.drawString(String.valueOf(s), + charOffset + av.charWidth * (i - start), + y1); + } + + } + + boolean inCurrentSequenceGroup(int res) + { + if (allGroups == null) + { + return false; + } + + for (int i = 0; i < allGroups.length; i++) + { + if (allGroups[i].getStartRes() <= res && allGroups[i].getEndRes() >= res) + { + currentSequenceGroup = allGroups[i]; + return true; + } + } + + return false; + } + + public void drawHighlightedText(SequenceI seq, int start, int end, int x1, + int y1) + { + int pady = av.charHeight / 5; + int charOffset = 0; + graphics.setColor(Color.black); + graphics.fillRect(x1, y1, av.charWidth * (end - start + 1), av.charHeight); + graphics.setColor(Color.white); + + char s = '~'; + // Need to find the sequence position here. + if (av.validCharWidth) + { + for (int i = start; i <= end; i++) + { + if (i < seq.getLength()) + { + s = seq.getCharAt(i); + } + + charOffset = (av.charWidth - fm.charWidth(s)) / 2; + graphics.drawString(String.valueOf(s), + charOffset + x1 + av.charWidth * (i - start), + y1 + av.charHeight - pady); + } + } + } + + public void drawCursor(SequenceI seq, int res, int x1, int y1) + { + int pady = av.charHeight / 5; + int charOffset = 0; + graphics.setColor(Color.black); + graphics.fillRect(x1, y1, av.charWidth, av.charHeight); + graphics.setColor(Color.white); + + graphics.setColor(Color.white); + + char s = seq.getCharAt(res); + if (av.validCharWidth) + { + + charOffset = (av.charWidth - fm.charWidth(s)) / 2; + graphics.drawString(String.valueOf(s), + charOffset + x1, + (y1 + av.charHeight) - pady); + } + } + +} diff --git a/src/jalview/appletgui/SliderPanel.java b/src/jalview/appletgui/SliderPanel.java index 8507331..b898b2c 100755 --- a/src/jalview/appletgui/SliderPanel.java +++ b/src/jalview/appletgui/SliderPanel.java @@ -1,363 +1,362 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -package jalview.appletgui; - -import java.util.*; - -import java.awt.*; -import java.awt.event.*; - -import jalview.datamodel.*; -import jalview.schemes.*; - -public class SliderPanel - extends Panel implements ActionListener, - AdjustmentListener, - MouseListener -{ - AlignmentPanel ap; - boolean forConservation = true; - ColourSchemeI cs; - - static Frame conservationSlider; - static Frame PIDSlider; - - public static int setConservationSlider(AlignmentPanel ap, ColourSchemeI cs, - String source) - { - SliderPanel sp = null; - - if (conservationSlider == null) - { - sp = new SliderPanel(ap, cs.getConservationInc(), true, cs); - conservationSlider = new Frame(); - conservationSlider.add(sp); - } - else - { - sp = (SliderPanel) conservationSlider.getComponent(0); - sp.cs = cs; - } - - conservationSlider.setTitle("Conservation Colour Increment (" + source + - ")"); - if (ap.av.alignment.getGroups() != null) - { - sp.setAllGroupsCheckEnabled(true); - } - else - { - sp.setAllGroupsCheckEnabled(false); - } - - return sp.getValue(); - } - - public static void showConservationSlider() - { - try - { - PIDSlider.setVisible(false); - PIDSlider = null; - } - catch (Exception ex) - {} - - if (!conservationSlider.isVisible()) - { - jalview.bin.JalviewLite.addFrame(conservationSlider, - conservationSlider.getTitle(), 420, 100); - conservationSlider.addWindowListener(new WindowAdapter() - { - public void windowClosing(WindowEvent e) - { - conservationSlider = null; - } - }); - - } - - } - - public static int setPIDSliderSource(AlignmentPanel ap, ColourSchemeI cs, - String source) - { - SliderPanel pid = null; - if (PIDSlider == null) - { - pid = new SliderPanel(ap, 50, false, cs); - PIDSlider = new Frame(); - PIDSlider.add(pid); - } - else - { - pid = (SliderPanel) PIDSlider.getComponent(0); - pid.cs = cs; - } - PIDSlider.setTitle("Percentage Identity Threshold (" + source + ")"); - - if (ap.av.alignment.getGroups() != null) - { - pid.setAllGroupsCheckEnabled(true); - } - else - { - pid.setAllGroupsCheckEnabled(false); - } - - return pid.getValue(); - - } - - public static void showPIDSlider() - { - try - { - conservationSlider.setVisible(false); - conservationSlider = null; - } - catch (Exception ex) - {} - - if (!PIDSlider.isVisible()) - { - jalview.bin.JalviewLite.addFrame(PIDSlider, PIDSlider.getTitle(), 420, - 100); - PIDSlider.addWindowListener(new WindowAdapter() - { - public void windowClosing(WindowEvent e) - { - PIDSlider = null; - } - }); - } - - } - - public SliderPanel(AlignmentPanel ap, int value, boolean forConserve, - ColourSchemeI cs) - { - try - { - jbInit(); - } - catch (Exception e) - { - e.printStackTrace(); - } - this.ap = ap; - this.cs = cs; - forConservation = forConserve; - undoButton.setVisible(false); - applyButton.setVisible(false); - if (forConservation) - { - label.setText("Modify conservation visibility"); - slider.setMinimum(0); - slider.setMaximum(50 + slider.getVisibleAmount()); - slider.setUnitIncrement(1); - } - else - { - label.setText("Colour residues above % occurence"); - slider.setMinimum(0); - slider.setMaximum(100 + slider.getVisibleAmount()); - slider.setBlockIncrement(1); - } - - slider.addAdjustmentListener(this); - slider.addMouseListener(this); - - slider.setValue(value); - valueField.setText(value + ""); - } - - public void valueChanged(int i) - { - if (cs == null) - { - return; - } - - ColourSchemeI toChange = null; - Vector allGroups = null; - int groupIndex = 0; - - if (allGroupsCheck.getState()) - { - allGroups = ap.av.alignment.getGroups(); - groupIndex = allGroups.size() - 1; - } - else - { - toChange = cs; - } - - while (groupIndex > -1) - { - if (allGroups != null) - { - toChange = ( (SequenceGroup) allGroups.elementAt(groupIndex)).cs; - } - - if (forConservation) - { - toChange.setConservationInc(i); - } - else - { - toChange.setThreshold(i, ap.av.getIgnoreGapsConsensus()); - } - - groupIndex--; - } - - ap.seqPanel.seqCanvas.repaint(); - - } - - public void setAllGroupsCheckEnabled(boolean b) - { - allGroupsCheck.setEnabled(b); - } - - public void actionPerformed(ActionEvent evt) - { - if (evt.getSource() == applyButton) - { - applyButton_actionPerformed(); - } - else if (evt.getSource() == undoButton) - { - undoButton_actionPerformed(); - } - else if (evt.getSource() == valueField) - { - valueField_actionPerformed(); - } - } - - public void adjustmentValueChanged(AdjustmentEvent evt) - { - valueField.setText(slider.getValue() + ""); - valueChanged(slider.getValue()); - } - - public void valueField_actionPerformed() - { - try - { - int i = Integer.parseInt(valueField.getText()); - slider.setValue(i); - } - catch (Exception ex) - { - valueField.setText(slider.getValue() + ""); - } - } - - public void setValue(int value) - { - slider.setValue(value); - } - - public int getValue() - { - return Integer.parseInt(valueField.getText()); - } - - // this is used for conservation colours, PID colours and redundancy threshold - protected Scrollbar slider = new Scrollbar(); - protected TextField valueField = new TextField(); - protected Label label = new Label(); - Panel jPanel1 = new Panel(); - Panel jPanel2 = new Panel(); - protected Button applyButton = new Button(); - protected Button undoButton = new Button(); - FlowLayout flowLayout1 = new FlowLayout(); - protected Checkbox allGroupsCheck = new Checkbox(); - BorderLayout borderLayout1 = new BorderLayout(); - BorderLayout borderLayout2 = new BorderLayout(); - FlowLayout flowLayout2 = new FlowLayout(); - - private void jbInit() - throws Exception - { - this.setLayout(borderLayout2); - - // slider.setMajorTickSpacing(10); - // slider.setMinorTickSpacing(1); - // slider.setPaintTicks(true); - slider.setBackground(Color.white); - slider.setFont(new java.awt.Font("Verdana", 0, 11)); - slider.setOrientation(0); - valueField.setFont(new java.awt.Font("Verdana", 0, 11)); - valueField.setText(" "); - valueField.addActionListener(this); - label.setFont(new java.awt.Font("Verdana", 0, 11)); - label.setText("set this label text"); - jPanel1.setLayout(borderLayout1); - jPanel2.setLayout(flowLayout1); - applyButton.setFont(new java.awt.Font("Verdana", 0, 11)); - applyButton.setLabel("Apply"); - applyButton.addActionListener(this); - undoButton.setEnabled(false); - undoButton.setFont(new java.awt.Font("Verdana", 0, 11)); - undoButton.setLabel("Undo"); - undoButton.addActionListener(this); - allGroupsCheck.setEnabled(false); - allGroupsCheck.setFont(new java.awt.Font("Verdana", 0, 11)); - allGroupsCheck.setLabel("Apply threshold to all groups"); - allGroupsCheck.setName("Apply to all Groups"); - this.setBackground(Color.white); - this.setForeground(Color.black); - jPanel2.add(label, null); - jPanel2.add(applyButton, null); - jPanel2.add(undoButton, null); - jPanel2.add(allGroupsCheck); - jPanel1.add(valueField, java.awt.BorderLayout.EAST); - jPanel1.add(slider, java.awt.BorderLayout.CENTER); - this.add(jPanel1, java.awt.BorderLayout.SOUTH); - this.add(jPanel2, java.awt.BorderLayout.CENTER); - } - - protected void applyButton_actionPerformed() - {} - - protected void undoButton_actionPerformed() - {} - - public void mousePressed(MouseEvent evt) - {} - - public void mouseReleased(MouseEvent evt) - { - ap.paintAlignment(true); - } - - public void mouseClicked(MouseEvent evt) - {} - - public void mouseEntered(MouseEvent evt) - {} - - public void mouseExited(MouseEvent evt) - {} -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.appletgui; + +import java.util.*; + +import java.awt.*; +import java.awt.event.*; + +import jalview.datamodel.*; +import jalview.schemes.*; + +public class SliderPanel + extends Panel implements ActionListener, + AdjustmentListener, + MouseListener +{ + AlignmentPanel ap; + boolean forConservation = true; + ColourSchemeI cs; + + static Frame conservationSlider; + static Frame PIDSlider; + + public static int setConservationSlider(AlignmentPanel ap, ColourSchemeI cs, + String source) + { + SliderPanel sp = null; + + if (conservationSlider == null) + { + sp = new SliderPanel(ap, cs.getConservationInc(), true, cs); + conservationSlider = new Frame(); + conservationSlider.add(sp); + } + else + { + sp = (SliderPanel) conservationSlider.getComponent(0); + sp.cs = cs; + } + + conservationSlider.setTitle("Conservation Colour Increment (" + source + + ")"); + if (ap.av.alignment.getGroups() != null) + { + sp.setAllGroupsCheckEnabled(true); + } + else + { + sp.setAllGroupsCheckEnabled(false); + } + + return sp.getValue(); + } + + public static void showConservationSlider() + { + try + { + PIDSlider.setVisible(false); + PIDSlider = null; + } + catch (Exception ex) + {} + + if (!conservationSlider.isVisible()) + { + jalview.bin.JalviewLite.addFrame(conservationSlider, + conservationSlider.getTitle(), 420, 100); + conservationSlider.addWindowListener(new WindowAdapter() + { + public void windowClosing(WindowEvent e) + { + conservationSlider = null; + } + }); + + } + + } + + public static int setPIDSliderSource(AlignmentPanel ap, ColourSchemeI cs, + String source) + { + SliderPanel pid = null; + if (PIDSlider == null) + { + pid = new SliderPanel(ap, 50, false, cs); + PIDSlider = new Frame(); + PIDSlider.add(pid); + } + else + { + pid = (SliderPanel) PIDSlider.getComponent(0); + pid.cs = cs; + } + PIDSlider.setTitle("Percentage Identity Threshold (" + source + ")"); + + if (ap.av.alignment.getGroups() != null) + { + pid.setAllGroupsCheckEnabled(true); + } + else + { + pid.setAllGroupsCheckEnabled(false); + } + + return pid.getValue(); + + } + + public static void showPIDSlider() + { + try + { + conservationSlider.setVisible(false); + conservationSlider = null; + } + catch (Exception ex) + {} + + if (!PIDSlider.isVisible()) + { + jalview.bin.JalviewLite.addFrame(PIDSlider, PIDSlider.getTitle(), 420, + 100); + PIDSlider.addWindowListener(new WindowAdapter() + { + public void windowClosing(WindowEvent e) + { + PIDSlider = null; + } + }); + } + + } + + public SliderPanel(AlignmentPanel ap, int value, boolean forConserve, + ColourSchemeI cs) + { + try + { + jbInit(); + } + catch (Exception e) + { + e.printStackTrace(); + } + this.ap = ap; + this.cs = cs; + forConservation = forConserve; + undoButton.setVisible(false); + applyButton.setVisible(false); + if (forConservation) + { + label.setText("Modify conservation visibility"); + slider.setMinimum(0); + slider.setMaximum(50 + slider.getVisibleAmount()); + slider.setUnitIncrement(1); + } + else + { + label.setText("Colour residues above % occurence"); + slider.setMinimum(0); + slider.setMaximum(100 + slider.getVisibleAmount()); + slider.setBlockIncrement(1); + } + + slider.addAdjustmentListener(this); + slider.addMouseListener(this); + + slider.setValue(value); + valueField.setText(value + ""); + } + + public void valueChanged(int i) + { + if (cs == null) + { + return; + } + + ColourSchemeI toChange = null; + Vector allGroups = null; + int groupIndex = 0; + + if (allGroupsCheck.getState()) + { + allGroups = ap.av.alignment.getGroups(); + groupIndex = allGroups.size() - 1; + } + else + { + toChange = cs; + } + + while (groupIndex > -1) + { + if (allGroups != null) + { + toChange = ( (SequenceGroup) allGroups.elementAt(groupIndex)).cs; + } + + if (forConservation) + { + toChange.setConservationInc(i); + } + else + { + toChange.setThreshold(i, ap.av.getIgnoreGapsConsensus()); + } + + groupIndex--; + } + + ap.seqPanel.seqCanvas.repaint(); + + } + + public void setAllGroupsCheckEnabled(boolean b) + { + allGroupsCheck.setEnabled(b); + } + + public void actionPerformed(ActionEvent evt) + { + if (evt.getSource() == applyButton) + { + applyButton_actionPerformed(); + } + else if (evt.getSource() == undoButton) + { + undoButton_actionPerformed(); + } + else if (evt.getSource() == valueField) + { + valueField_actionPerformed(); + } + } + + public void adjustmentValueChanged(AdjustmentEvent evt) + { + valueField.setText(slider.getValue() + ""); + valueChanged(slider.getValue()); + } + + public void valueField_actionPerformed() + { + try + { + int i = Integer.parseInt(valueField.getText()); + slider.setValue(i); + } + catch (Exception ex) + { + valueField.setText(slider.getValue() + ""); + } + } + + public void setValue(int value) + { + slider.setValue(value); + } + + public int getValue() + { + return Integer.parseInt(valueField.getText()); + } + + // this is used for conservation colours, PID colours and redundancy threshold + protected Scrollbar slider = new Scrollbar(); + protected TextField valueField = new TextField(); + protected Label label = new Label(); + Panel jPanel1 = new Panel(); + Panel jPanel2 = new Panel(); + protected Button applyButton = new Button(); + protected Button undoButton = new Button(); + FlowLayout flowLayout1 = new FlowLayout(); + protected Checkbox allGroupsCheck = new Checkbox(); + BorderLayout borderLayout1 = new BorderLayout(); + BorderLayout borderLayout2 = new BorderLayout(); + FlowLayout flowLayout2 = new FlowLayout(); + + private void jbInit() + throws Exception + { + this.setLayout(borderLayout2); + + // slider.setMajorTickSpacing(10); + // slider.setMinorTickSpacing(1); + // slider.setPaintTicks(true); + slider.setBackground(Color.white); + slider.setFont(new java.awt.Font("Verdana", 0, 11)); + slider.setOrientation(0); + valueField.setFont(new java.awt.Font("Verdana", 0, 11)); + valueField.setText(" "); + valueField.addActionListener(this); + label.setFont(new java.awt.Font("Verdana", 0, 11)); + label.setText("set this label text"); + jPanel1.setLayout(borderLayout1); + jPanel2.setLayout(flowLayout1); + applyButton.setFont(new java.awt.Font("Verdana", 0, 11)); + applyButton.setLabel("Apply"); + applyButton.addActionListener(this); + undoButton.setEnabled(false); + undoButton.setFont(new java.awt.Font("Verdana", 0, 11)); + undoButton.setLabel("Undo"); + undoButton.addActionListener(this); + allGroupsCheck.setEnabled(false); + allGroupsCheck.setFont(new java.awt.Font("Verdana", 0, 11)); + allGroupsCheck.setLabel("Apply threshold to all groups"); + allGroupsCheck.setName("Apply to all Groups"); + this.setBackground(Color.white); + this.setForeground(Color.black); + jPanel2.add(label, null); + jPanel2.add(applyButton, null); + jPanel2.add(undoButton, null); + jPanel2.add(allGroupsCheck); + jPanel1.add(valueField, java.awt.BorderLayout.EAST); + jPanel1.add(slider, java.awt.BorderLayout.CENTER); + this.add(jPanel1, java.awt.BorderLayout.SOUTH); + this.add(jPanel2, java.awt.BorderLayout.CENTER); + } + + protected void applyButton_actionPerformed() + {} + + protected void undoButton_actionPerformed() + {} + + public void mousePressed(MouseEvent evt) + {} + + public void mouseReleased(MouseEvent evt) + { + ap.paintAlignment(true); + } + + public void mouseClicked(MouseEvent evt) + {} + + public void mouseEntered(MouseEvent evt) + {} + + public void mouseExited(MouseEvent evt) + {} +} diff --git a/src/jalview/appletgui/Tooltip.java b/src/jalview/appletgui/Tooltip.java index 7de5193..cfc6bcc 100755 --- a/src/jalview/appletgui/Tooltip.java +++ b/src/jalview/appletgui/Tooltip.java @@ -1,22 +1,21 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.appletgui; import java.applet.*; diff --git a/src/jalview/appletgui/TreeCanvas.java b/src/jalview/appletgui/TreeCanvas.java index 425c7a9..d312fbf 100755 --- a/src/jalview/appletgui/TreeCanvas.java +++ b/src/jalview/appletgui/TreeCanvas.java @@ -1,22 +1,21 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.appletgui; import java.util.*; diff --git a/src/jalview/appletgui/TreePanel.java b/src/jalview/appletgui/TreePanel.java index 6ab01aa..71fe134 100755 --- a/src/jalview/appletgui/TreePanel.java +++ b/src/jalview/appletgui/TreePanel.java @@ -1,22 +1,21 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.appletgui; import java.awt.*; diff --git a/src/jalview/appletgui/UserDefinedColours.java b/src/jalview/appletgui/UserDefinedColours.java index 6e14146..68cb610 100755 --- a/src/jalview/appletgui/UserDefinedColours.java +++ b/src/jalview/appletgui/UserDefinedColours.java @@ -1,589 +1,588 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -package jalview.appletgui; - -import java.util.*; - -import java.awt.*; -import java.awt.event.*; - -import jalview.datamodel.*; -import jalview.schemes.*; - -public class UserDefinedColours - extends Panel implements ActionListener, AdjustmentListener -{ - - AlignmentPanel ap; - SequenceGroup seqGroup; - Button selectedButton; - Vector oldColours = new Vector(); - ColourSchemeI oldColourScheme; - Frame frame; - MCview.AppletPDBCanvas pdbcanvas; - AppletJmol jmol; - - Dialog dialog; - Object caller; - String originalLabel; - Color originalColour; - - int R = 0, G = 0, B = 0; - - public ColourSchemeI loadDefaultColours() - { - // NOT IMPLEMENTED YET IN APPLET VERSION - return null; - } - - public UserDefinedColours(AlignmentPanel ap, SequenceGroup sg) - { - this.ap = ap; - seqGroup = sg; - - if (seqGroup != null) - { - oldColourScheme = seqGroup.cs; - } - else - { - oldColourScheme = ap.av.getGlobalColourScheme(); - } - - init(); - } - - public UserDefinedColours(MCview.AppletPDBCanvas pdb) - { - this.pdbcanvas = pdb; - init(); - } - - public UserDefinedColours(AppletJmol jmol) - { - this.jmol = jmol; - init(); - } - - public UserDefinedColours(FeatureRenderer fr, Frame alignframe) - { - caller = fr; - originalColour = fr.colourPanel.getBackground(); - originalLabel = "Feature Colour"; - setForDialog("Select Feature Colour", alignframe); - setTargetColour(fr.colourPanel.getBackground()); - dialog.setVisible(true); - } - - public UserDefinedColours(Component caller, - Color col1, - Frame alignframe) - { - this.caller = caller; - originalColour = col1; - originalLabel = "Select Colour"; - setForDialog("Select Colour", alignframe); - setTargetColour(col1); - dialog.setVisible(true); - } - - - public UserDefinedColours(Object caller, - String label, - Color colour) - { - this.caller = caller; - originalColour = colour; - originalLabel = label; - init(); - remove(buttonPanel); - - setTargetColour(colour); - - okcancelPanel.setBounds(new Rectangle(0, 113, 400, 35)); - frame.setTitle("User Defined Colours - " + label); - frame.setSize(420, 200); - } - - void setForDialog(String title, Frame alignframe) - { - init(); - frame.setVisible(false); - remove(buttonPanel); - dialog = new Dialog(alignframe, title, true); - - dialog.add(this); - this.setSize(400,123); - okcancelPanel.setBounds(new Rectangle(0, 123, 400, 35)); - int height = 160 + alignframe.getInsets().top + getInsets().bottom; - int width = 400; - - dialog.setBounds(alignframe.getBounds().x - + (alignframe.getSize().width - width) / 2, - alignframe.getBounds().y - + (alignframe.getSize().height - height) / 2, - width, height); - - } - - public void actionPerformed(ActionEvent evt) - { - if (evt.getSource() == okButton) - { - okButton_actionPerformed(); - } - else if (evt.getSource() == applyButton) - { - applyButton_actionPerformed(); - } - else if (evt.getSource() == cancelButton) - { - cancelButton_actionPerformed(); - } - else if (evt.getSource() == rText) - { - rText_actionPerformed(); - } - else if (evt.getSource() == gText) - { - gText_actionPerformed(); - } - else if (evt.getSource() == bText) - { - bText_actionPerformed(); - } - } - - public void adjustmentValueChanged(AdjustmentEvent evt) - { - if (evt.getSource() == rScroller) - { - rScroller_adjustmentValueChanged(); - } - else if (evt.getSource() == gScroller) - { - gScroller_adjustmentValueChanged(); - } - else if (evt.getSource() == bScroller) - { - bScroller_adjustmentValueChanged(); - } - } - - void init() - { - try - { - jbInit(); - } - catch (Exception e) - { - e.printStackTrace(); - } - frame = new Frame(); - frame.add(this); - jalview.bin.JalviewLite.addFrame(frame, "User defined colours", 420, 345); - - if (seqGroup != null) - { - frame.setTitle(frame.getTitle() + " (" + seqGroup.getName() + ")"); - } - - for (int i = 0; i < 20; i++) - { - makeButton(ResidueProperties.aa2Triplet.get(ResidueProperties.aa[i]) + - "", ResidueProperties.aa[i]); - } - - makeButton("B", "B"); - makeButton("Z", "Z"); - makeButton("X", "X"); - makeButton("Gap", "'.','-',' '"); - - validate(); - } - - protected void rText_actionPerformed() - { - try - { - int i = Integer.parseInt(rText.getText()); - rScroller.setValue(i); - rScroller_adjustmentValueChanged(); - } - catch (NumberFormatException ex) - {} - } - - protected void gText_actionPerformed() - { - try - { - int i = Integer.parseInt(gText.getText()); - gScroller.setValue(i); - gScroller_adjustmentValueChanged(); - } - catch (NumberFormatException ex) - {} - - } - - protected void bText_actionPerformed() - { - try - { - int i = Integer.parseInt(bText.getText()); - bScroller.setValue(i); - bScroller_adjustmentValueChanged(); - } - catch (NumberFormatException ex) - {} - - } - - protected void rScroller_adjustmentValueChanged() - { - R = rScroller.getValue(); - rText.setText(R + ""); - colourChanged(); - } - - protected void gScroller_adjustmentValueChanged() - { - G = gScroller.getValue(); - gText.setText(G + ""); - colourChanged(); - } - - protected void bScroller_adjustmentValueChanged() - { - B = bScroller.getValue(); - bText.setText(B + ""); - colourChanged(); - } - - public void colourChanged() - { - Color col = new Color(R, G, B); - target.setBackground(col); - target.repaint(); - - if (selectedButton != null) - { - selectedButton.setBackground(col); - selectedButton.repaint(); - } - } - - void setTargetColour(Color col) - { - R = col.getRed(); - G = col.getGreen(); - B = col.getBlue(); - - rScroller.setValue(R); - gScroller.setValue(G); - bScroller.setValue(B); - rText.setText(R + ""); - gText.setText(G + ""); - bText.setText(B + ""); - colourChanged(); - } - - public void colourButtonPressed(MouseEvent e) - { - selectedButton = (Button) e.getSource(); - setTargetColour(selectedButton.getBackground()); - } - - void makeButton(String label, String aa) - { - final Button button = new Button(); - Color col = Color.white; - - try - { - col = oldColourScheme.findColour(aa.charAt(0), -1); - } - catch (Exception ex) - {} - - button.setBackground(col); - oldColours.addElement(col); - button.setLabel(label); - button.setForeground(col.darker().darker().darker()); - button.setFont(new java.awt.Font("Verdana", 1, 10)); - button.addMouseListener(new java.awt.event.MouseAdapter() - { - public void mousePressed(MouseEvent e) - { - colourButtonPressed(e); - } - }); - - buttonPanel.add(button, null); - } - - protected void okButton_actionPerformed() - { - applyButton_actionPerformed(); - if (dialog != null) - dialog.setVisible(false); - - frame.setVisible(false); - } - - public Color getColor() - { - return new Color(R, G, B); - } - - protected void applyButton_actionPerformed() - { - if (caller != null) - { - if (caller instanceof FeatureSettings) - { - ( (FeatureSettings) caller).setUserColour - (originalLabel, getColor()); - } - else if (caller instanceof AnnotationColourChooser) - { - if (originalLabel.equals("Min Colour")) - { - ( (AnnotationColourChooser) caller).minColour_actionPerformed - (getColor()); - } - else - { - ( (AnnotationColourChooser) caller).maxColour_actionPerformed - (getColor()); - } - } - else if(caller instanceof FeatureRenderer) - { - ((FeatureRenderer)caller).colourPanel.setBackground(getColor()); - } - - return; - } - - Color[] newColours = new Color[24]; - for (int i = 0; i < 24; i++) - { - Button button = (Button) buttonPanel.getComponent(i); - newColours[i] = button.getBackground(); - } - - UserColourScheme ucs = new UserColourScheme(newColours); - if (ap != null) - { - ucs.setThreshold(0, ap.av.getIgnoreGapsConsensus()); - } - - if (ap != null) - { - if (seqGroup != null) - { - seqGroup.cs = ucs; - } - else - { - ap.av.setGlobalColourScheme(ucs); - } - ap.seqPanel.seqCanvas.img = null; - ap.paintAlignment(true); - } - else if(jmol!=null) - { - jmol.setJalviewColourScheme(ucs); - } - else if (pdbcanvas != null) - { - pdbcanvas.setColours(ucs); - } - } - - protected void cancelButton_actionPerformed() - { - if (caller != null) - { - if (caller instanceof FeatureSettings) - { - ( (FeatureSettings) caller).setUserColour - (originalLabel, originalColour); - } - else if (caller instanceof AnnotationColourChooser) - { - if (originalLabel.equals("Min Colour")) - { - ( (AnnotationColourChooser) caller).minColour_actionPerformed - (originalColour); - } - else - { - ( (AnnotationColourChooser) caller).maxColour_actionPerformed - (originalColour); - } - } - else if (caller instanceof FeatureRenderer) - { - ( (FeatureRenderer) caller).colourPanel.setBackground(originalColour); - - } - - if(dialog!=null) - dialog.setVisible(false); - - frame.setVisible(false); - return; - } - - Color[] newColours = new Color[24]; - for (int i = 0; i < 24; i++) - { - newColours[i] = (Color) oldColours.elementAt(i); - buttonPanel.getComponent(i).setBackground(newColours[i]); - } - - UserColourScheme ucs = new UserColourScheme(newColours); - - if (ap != null) - { - if (seqGroup != null) - { - seqGroup.cs = ucs; - } - else - { - ap.av.setGlobalColourScheme(ucs); - } - ap.paintAlignment(true); - } - else if(jmol !=null) - { - jmol.setJalviewColourScheme(ucs); - } - else if (pdbcanvas != null) - { - pdbcanvas.pdb.setColours(ucs); - } - - frame.setVisible(false); - } - - protected Panel buttonPanel = new Panel(); - protected GridLayout gridLayout = new GridLayout(); - Panel okcancelPanel = new Panel(); - protected Button okButton = new Button(); - protected Button applyButton = new Button(); - protected Button cancelButton = new Button(); - protected Scrollbar rScroller = new Scrollbar(); - Label label1 = new Label(); - protected TextField rText = new TextField(); - Label label4 = new Label(); - protected Scrollbar gScroller = new Scrollbar(); - protected TextField gText = new TextField(); - Label label5 = new Label(); - protected Scrollbar bScroller = new Scrollbar(); - protected TextField bText = new TextField(); - protected Panel target = new Panel(); - - private void jbInit() - throws Exception - { - this.setLayout(null); - buttonPanel.setLayout(gridLayout); - gridLayout.setColumns(6); - gridLayout.setRows(4); - okButton.setFont(new java.awt.Font("Verdana", 0, 11)); - okButton.setLabel("OK"); - okButton.addActionListener(this); - applyButton.setFont(new java.awt.Font("Verdana", 0, 11)); - applyButton.setLabel("Apply"); - applyButton.addActionListener(this); - cancelButton.setFont(new java.awt.Font("Verdana", 0, 11)); - cancelButton.setLabel("Cancel"); - cancelButton.addActionListener(this); - this.setBackground(new Color(212, 208, 223)); - okcancelPanel.setBounds(new Rectangle(0, 265, 400, 35)); - buttonPanel.setBounds(new Rectangle(0, 123, 400, 142)); - rScroller.setMaximum(256); - rScroller.setMinimum(0); - rScroller.setOrientation(0); - rScroller.setUnitIncrement(1); - rScroller.setVisibleAmount(1); - rScroller.setBounds(new Rectangle(36, 27, 119, 19)); - rScroller.addAdjustmentListener(this); - label1.setAlignment(Label.RIGHT); - label1.setText("R"); - label1.setBounds(new Rectangle(19, 30, 16, 15)); - rText.setFont(new java.awt.Font("Dialog", Font.PLAIN, 10)); - rText.setText("0 "); - rText.setBounds(new Rectangle(156, 27, 53, 19)); - rText.addActionListener(this); - label4.setAlignment(Label.RIGHT); - label4.setText("G"); - label4.setBounds(new Rectangle(15, 56, 20, 15)); - gScroller.setMaximum(256); - gScroller.setMinimum(0); - gScroller.setOrientation(0); - gScroller.setUnitIncrement(1); - gScroller.setVisibleAmount(1); - gScroller.setBounds(new Rectangle(35, 52, 120, 20)); - gScroller.addAdjustmentListener(this); - gText.setFont(new java.awt.Font("Dialog", Font.PLAIN, 10)); - gText.setText("0 "); - gText.setBounds(new Rectangle(156, 52, 53, 20)); - gText.addActionListener(this); - label5.setAlignment(Label.RIGHT); - label5.setText("B"); - label5.setBounds(new Rectangle(14, 82, 20, 15)); - bScroller.setMaximum(256); - bScroller.setMinimum(0); - bScroller.setOrientation(0); - bScroller.setUnitIncrement(1); - bScroller.setVisibleAmount(1); - bScroller.setBounds(new Rectangle(35, 78, 120, 20)); - bScroller.addAdjustmentListener(this); - bText.setFont(new java.awt.Font("Dialog", Font.PLAIN, 10)); - bText.setText("0 "); - bText.setBounds(new Rectangle(157, 78, 52, 20)); - bText.addActionListener(this); - target.setBackground(Color.black); - target.setBounds(new Rectangle(229, 26, 134, 79)); - this.add(okcancelPanel, null); - okcancelPanel.add(okButton, null); - okcancelPanel.add(applyButton, null); - okcancelPanel.add(cancelButton, null); - this.add(buttonPanel, null); - this.add(target, null); - this.add(gScroller); - this.add(rScroller); - this.add(bScroller); - this.add(label5); - this.add(label4); - this.add(label1); - this.add(gText); - this.add(rText); - this.add(bText); - } - -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.appletgui; + +import java.util.*; + +import java.awt.*; +import java.awt.event.*; + +import jalview.datamodel.*; +import jalview.schemes.*; + +public class UserDefinedColours + extends Panel implements ActionListener, AdjustmentListener +{ + + AlignmentPanel ap; + SequenceGroup seqGroup; + Button selectedButton; + Vector oldColours = new Vector(); + ColourSchemeI oldColourScheme; + Frame frame; + MCview.AppletPDBCanvas pdbcanvas; + AppletJmol jmol; + + Dialog dialog; + Object caller; + String originalLabel; + Color originalColour; + + int R = 0, G = 0, B = 0; + + public ColourSchemeI loadDefaultColours() + { + // NOT IMPLEMENTED YET IN APPLET VERSION + return null; + } + + public UserDefinedColours(AlignmentPanel ap, SequenceGroup sg) + { + this.ap = ap; + seqGroup = sg; + + if (seqGroup != null) + { + oldColourScheme = seqGroup.cs; + } + else + { + oldColourScheme = ap.av.getGlobalColourScheme(); + } + + init(); + } + + public UserDefinedColours(MCview.AppletPDBCanvas pdb) + { + this.pdbcanvas = pdb; + init(); + } + + public UserDefinedColours(AppletJmol jmol) + { + this.jmol = jmol; + init(); + } + + public UserDefinedColours(FeatureRenderer fr, Frame alignframe) + { + caller = fr; + originalColour = fr.colourPanel.getBackground(); + originalLabel = "Feature Colour"; + setForDialog("Select Feature Colour", alignframe); + setTargetColour(fr.colourPanel.getBackground()); + dialog.setVisible(true); + } + + public UserDefinedColours(Component caller, + Color col1, + Frame alignframe) + { + this.caller = caller; + originalColour = col1; + originalLabel = "Select Colour"; + setForDialog("Select Colour", alignframe); + setTargetColour(col1); + dialog.setVisible(true); + } + + + public UserDefinedColours(Object caller, + String label, + Color colour) + { + this.caller = caller; + originalColour = colour; + originalLabel = label; + init(); + remove(buttonPanel); + + setTargetColour(colour); + + okcancelPanel.setBounds(new Rectangle(0, 113, 400, 35)); + frame.setTitle("User Defined Colours - " + label); + frame.setSize(420, 200); + } + + void setForDialog(String title, Frame alignframe) + { + init(); + frame.setVisible(false); + remove(buttonPanel); + dialog = new Dialog(alignframe, title, true); + + dialog.add(this); + this.setSize(400,123); + okcancelPanel.setBounds(new Rectangle(0, 123, 400, 35)); + int height = 160 + alignframe.getInsets().top + getInsets().bottom; + int width = 400; + + dialog.setBounds(alignframe.getBounds().x + + (alignframe.getSize().width - width) / 2, + alignframe.getBounds().y + + (alignframe.getSize().height - height) / 2, + width, height); + + } + + public void actionPerformed(ActionEvent evt) + { + if (evt.getSource() == okButton) + { + okButton_actionPerformed(); + } + else if (evt.getSource() == applyButton) + { + applyButton_actionPerformed(); + } + else if (evt.getSource() == cancelButton) + { + cancelButton_actionPerformed(); + } + else if (evt.getSource() == rText) + { + rText_actionPerformed(); + } + else if (evt.getSource() == gText) + { + gText_actionPerformed(); + } + else if (evt.getSource() == bText) + { + bText_actionPerformed(); + } + } + + public void adjustmentValueChanged(AdjustmentEvent evt) + { + if (evt.getSource() == rScroller) + { + rScroller_adjustmentValueChanged(); + } + else if (evt.getSource() == gScroller) + { + gScroller_adjustmentValueChanged(); + } + else if (evt.getSource() == bScroller) + { + bScroller_adjustmentValueChanged(); + } + } + + void init() + { + try + { + jbInit(); + } + catch (Exception e) + { + e.printStackTrace(); + } + frame = new Frame(); + frame.add(this); + jalview.bin.JalviewLite.addFrame(frame, "User defined colours", 420, 345); + + if (seqGroup != null) + { + frame.setTitle(frame.getTitle() + " (" + seqGroup.getName() + ")"); + } + + for (int i = 0; i < 20; i++) + { + makeButton(ResidueProperties.aa2Triplet.get(ResidueProperties.aa[i]) + + "", ResidueProperties.aa[i]); + } + + makeButton("B", "B"); + makeButton("Z", "Z"); + makeButton("X", "X"); + makeButton("Gap", "'.','-',' '"); + + validate(); + } + + protected void rText_actionPerformed() + { + try + { + int i = Integer.parseInt(rText.getText()); + rScroller.setValue(i); + rScroller_adjustmentValueChanged(); + } + catch (NumberFormatException ex) + {} + } + + protected void gText_actionPerformed() + { + try + { + int i = Integer.parseInt(gText.getText()); + gScroller.setValue(i); + gScroller_adjustmentValueChanged(); + } + catch (NumberFormatException ex) + {} + + } + + protected void bText_actionPerformed() + { + try + { + int i = Integer.parseInt(bText.getText()); + bScroller.setValue(i); + bScroller_adjustmentValueChanged(); + } + catch (NumberFormatException ex) + {} + + } + + protected void rScroller_adjustmentValueChanged() + { + R = rScroller.getValue(); + rText.setText(R + ""); + colourChanged(); + } + + protected void gScroller_adjustmentValueChanged() + { + G = gScroller.getValue(); + gText.setText(G + ""); + colourChanged(); + } + + protected void bScroller_adjustmentValueChanged() + { + B = bScroller.getValue(); + bText.setText(B + ""); + colourChanged(); + } + + public void colourChanged() + { + Color col = new Color(R, G, B); + target.setBackground(col); + target.repaint(); + + if (selectedButton != null) + { + selectedButton.setBackground(col); + selectedButton.repaint(); + } + } + + void setTargetColour(Color col) + { + R = col.getRed(); + G = col.getGreen(); + B = col.getBlue(); + + rScroller.setValue(R); + gScroller.setValue(G); + bScroller.setValue(B); + rText.setText(R + ""); + gText.setText(G + ""); + bText.setText(B + ""); + colourChanged(); + } + + public void colourButtonPressed(MouseEvent e) + { + selectedButton = (Button) e.getSource(); + setTargetColour(selectedButton.getBackground()); + } + + void makeButton(String label, String aa) + { + final Button button = new Button(); + Color col = Color.white; + + try + { + col = oldColourScheme.findColour(aa.charAt(0), -1); + } + catch (Exception ex) + {} + + button.setBackground(col); + oldColours.addElement(col); + button.setLabel(label); + button.setForeground(col.darker().darker().darker()); + button.setFont(new java.awt.Font("Verdana", 1, 10)); + button.addMouseListener(new java.awt.event.MouseAdapter() + { + public void mousePressed(MouseEvent e) + { + colourButtonPressed(e); + } + }); + + buttonPanel.add(button, null); + } + + protected void okButton_actionPerformed() + { + applyButton_actionPerformed(); + if (dialog != null) + dialog.setVisible(false); + + frame.setVisible(false); + } + + public Color getColor() + { + return new Color(R, G, B); + } + + protected void applyButton_actionPerformed() + { + if (caller != null) + { + if (caller instanceof FeatureSettings) + { + ( (FeatureSettings) caller).setUserColour + (originalLabel, getColor()); + } + else if (caller instanceof AnnotationColourChooser) + { + if (originalLabel.equals("Min Colour")) + { + ( (AnnotationColourChooser) caller).minColour_actionPerformed + (getColor()); + } + else + { + ( (AnnotationColourChooser) caller).maxColour_actionPerformed + (getColor()); + } + } + else if(caller instanceof FeatureRenderer) + { + ((FeatureRenderer)caller).colourPanel.setBackground(getColor()); + } + + return; + } + + Color[] newColours = new Color[24]; + for (int i = 0; i < 24; i++) + { + Button button = (Button) buttonPanel.getComponent(i); + newColours[i] = button.getBackground(); + } + + UserColourScheme ucs = new UserColourScheme(newColours); + if (ap != null) + { + ucs.setThreshold(0, ap.av.getIgnoreGapsConsensus()); + } + + if (ap != null) + { + if (seqGroup != null) + { + seqGroup.cs = ucs; + } + else + { + ap.av.setGlobalColourScheme(ucs); + } + ap.seqPanel.seqCanvas.img = null; + ap.paintAlignment(true); + } + else if(jmol!=null) + { + jmol.setJalviewColourScheme(ucs); + } + else if (pdbcanvas != null) + { + pdbcanvas.setColours(ucs); + } + } + + protected void cancelButton_actionPerformed() + { + if (caller != null) + { + if (caller instanceof FeatureSettings) + { + ( (FeatureSettings) caller).setUserColour + (originalLabel, originalColour); + } + else if (caller instanceof AnnotationColourChooser) + { + if (originalLabel.equals("Min Colour")) + { + ( (AnnotationColourChooser) caller).minColour_actionPerformed + (originalColour); + } + else + { + ( (AnnotationColourChooser) caller).maxColour_actionPerformed + (originalColour); + } + } + else if (caller instanceof FeatureRenderer) + { + ( (FeatureRenderer) caller).colourPanel.setBackground(originalColour); + + } + + if(dialog!=null) + dialog.setVisible(false); + + frame.setVisible(false); + return; + } + + Color[] newColours = new Color[24]; + for (int i = 0; i < 24; i++) + { + newColours[i] = (Color) oldColours.elementAt(i); + buttonPanel.getComponent(i).setBackground(newColours[i]); + } + + UserColourScheme ucs = new UserColourScheme(newColours); + + if (ap != null) + { + if (seqGroup != null) + { + seqGroup.cs = ucs; + } + else + { + ap.av.setGlobalColourScheme(ucs); + } + ap.paintAlignment(true); + } + else if(jmol !=null) + { + jmol.setJalviewColourScheme(ucs); + } + else if (pdbcanvas != null) + { + pdbcanvas.pdb.setColours(ucs); + } + + frame.setVisible(false); + } + + protected Panel buttonPanel = new Panel(); + protected GridLayout gridLayout = new GridLayout(); + Panel okcancelPanel = new Panel(); + protected Button okButton = new Button(); + protected Button applyButton = new Button(); + protected Button cancelButton = new Button(); + protected Scrollbar rScroller = new Scrollbar(); + Label label1 = new Label(); + protected TextField rText = new TextField(); + Label label4 = new Label(); + protected Scrollbar gScroller = new Scrollbar(); + protected TextField gText = new TextField(); + Label label5 = new Label(); + protected Scrollbar bScroller = new Scrollbar(); + protected TextField bText = new TextField(); + protected Panel target = new Panel(); + + private void jbInit() + throws Exception + { + this.setLayout(null); + buttonPanel.setLayout(gridLayout); + gridLayout.setColumns(6); + gridLayout.setRows(4); + okButton.setFont(new java.awt.Font("Verdana", 0, 11)); + okButton.setLabel("OK"); + okButton.addActionListener(this); + applyButton.setFont(new java.awt.Font("Verdana", 0, 11)); + applyButton.setLabel("Apply"); + applyButton.addActionListener(this); + cancelButton.setFont(new java.awt.Font("Verdana", 0, 11)); + cancelButton.setLabel("Cancel"); + cancelButton.addActionListener(this); + this.setBackground(new Color(212, 208, 223)); + okcancelPanel.setBounds(new Rectangle(0, 265, 400, 35)); + buttonPanel.setBounds(new Rectangle(0, 123, 400, 142)); + rScroller.setMaximum(256); + rScroller.setMinimum(0); + rScroller.setOrientation(0); + rScroller.setUnitIncrement(1); + rScroller.setVisibleAmount(1); + rScroller.setBounds(new Rectangle(36, 27, 119, 19)); + rScroller.addAdjustmentListener(this); + label1.setAlignment(Label.RIGHT); + label1.setText("R"); + label1.setBounds(new Rectangle(19, 30, 16, 15)); + rText.setFont(new java.awt.Font("Dialog", Font.PLAIN, 10)); + rText.setText("0 "); + rText.setBounds(new Rectangle(156, 27, 53, 19)); + rText.addActionListener(this); + label4.setAlignment(Label.RIGHT); + label4.setText("G"); + label4.setBounds(new Rectangle(15, 56, 20, 15)); + gScroller.setMaximum(256); + gScroller.setMinimum(0); + gScroller.setOrientation(0); + gScroller.setUnitIncrement(1); + gScroller.setVisibleAmount(1); + gScroller.setBounds(new Rectangle(35, 52, 120, 20)); + gScroller.addAdjustmentListener(this); + gText.setFont(new java.awt.Font("Dialog", Font.PLAIN, 10)); + gText.setText("0 "); + gText.setBounds(new Rectangle(156, 52, 53, 20)); + gText.addActionListener(this); + label5.setAlignment(Label.RIGHT); + label5.setText("B"); + label5.setBounds(new Rectangle(14, 82, 20, 15)); + bScroller.setMaximum(256); + bScroller.setMinimum(0); + bScroller.setOrientation(0); + bScroller.setUnitIncrement(1); + bScroller.setVisibleAmount(1); + bScroller.setBounds(new Rectangle(35, 78, 120, 20)); + bScroller.addAdjustmentListener(this); + bText.setFont(new java.awt.Font("Dialog", Font.PLAIN, 10)); + bText.setText("0 "); + bText.setBounds(new Rectangle(157, 78, 52, 20)); + bText.addActionListener(this); + target.setBackground(Color.black); + target.setBounds(new Rectangle(229, 26, 134, 79)); + this.add(okcancelPanel, null); + okcancelPanel.add(okButton, null); + okcancelPanel.add(applyButton, null); + okcancelPanel.add(cancelButton, null); + this.add(buttonPanel, null); + this.add(target, null); + this.add(gScroller); + this.add(rScroller); + this.add(bScroller); + this.add(label5); + this.add(label4); + this.add(label1); + this.add(gText); + this.add(rText); + this.add(bText); + } + +} diff --git a/src/jalview/bin/Cache.java b/src/jalview/bin/Cache.java index 0744cd9..65ff8c5 100755 --- a/src/jalview/bin/Cache.java +++ b/src/jalview/bin/Cache.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/bin/Jalview.java b/src/jalview/bin/Jalview.java index 4f383a0..cf3ac30 100755 --- a/src/jalview/bin/Jalview.java +++ b/src/jalview/bin/Jalview.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/bin/JalviewLite.java b/src/jalview/bin/JalviewLite.java index 393476d..8f2b3d4 100755 --- a/src/jalview/bin/JalviewLite.java +++ b/src/jalview/bin/JalviewLite.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/binding/Alignment.java b/src/jalview/binding/Alignment.java index 5b107b5..3a90ca9 100755 --- a/src/jalview/binding/Alignment.java +++ b/src/jalview/binding/Alignment.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.binding; //---------------------------------/ diff --git a/src/jalview/binding/Annotation.java b/src/jalview/binding/Annotation.java index 108d3ad..2608d9d 100755 --- a/src/jalview/binding/Annotation.java +++ b/src/jalview/binding/Annotation.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.binding; //---------------------------------/ diff --git a/src/jalview/binding/AnnotationElement.java b/src/jalview/binding/AnnotationElement.java index d133fe0..7293790 100755 --- a/src/jalview/binding/AnnotationElement.java +++ b/src/jalview/binding/AnnotationElement.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.binding; //---------------------------------/ diff --git a/src/jalview/binding/Colour.java b/src/jalview/binding/Colour.java index 488ff98..f0a0ec2 100755 --- a/src/jalview/binding/Colour.java +++ b/src/jalview/binding/Colour.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.binding; //---------------------------------/ diff --git a/src/jalview/binding/Feature.java b/src/jalview/binding/Feature.java index d429df3..de40051 100755 --- a/src/jalview/binding/Feature.java +++ b/src/jalview/binding/Feature.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.binding; //---------------------------------/ diff --git a/src/jalview/binding/FeatureSettings.java b/src/jalview/binding/FeatureSettings.java index f3d06be..87b12ef 100755 --- a/src/jalview/binding/FeatureSettings.java +++ b/src/jalview/binding/FeatureSettings.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.binding; //---------------------------------/ diff --git a/src/jalview/binding/Features.java b/src/jalview/binding/Features.java index e50ae7c..0ca7e53 100755 --- a/src/jalview/binding/Features.java +++ b/src/jalview/binding/Features.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.binding; //---------------------------------/ diff --git a/src/jalview/binding/JGroup.java b/src/jalview/binding/JGroup.java index 862eebd..fe15b16 100755 --- a/src/jalview/binding/JGroup.java +++ b/src/jalview/binding/JGroup.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.binding; //---------------------------------/ diff --git a/src/jalview/binding/JSeq.java b/src/jalview/binding/JSeq.java index 14b1f2f..0a967bd 100755 --- a/src/jalview/binding/JSeq.java +++ b/src/jalview/binding/JSeq.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.binding; //---------------------------------/ diff --git a/src/jalview/binding/JalviewModel.java b/src/jalview/binding/JalviewModel.java index 21f8be9..e49546a 100755 --- a/src/jalview/binding/JalviewModel.java +++ b/src/jalview/binding/JalviewModel.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.binding; //---------------------------------/ diff --git a/src/jalview/binding/JalviewModelSequence.java b/src/jalview/binding/JalviewModelSequence.java index 5ebcee6..784af77 100755 --- a/src/jalview/binding/JalviewModelSequence.java +++ b/src/jalview/binding/JalviewModelSequence.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.binding; //---------------------------------/ diff --git a/src/jalview/binding/JalviewUserColours.java b/src/jalview/binding/JalviewUserColours.java index b5d0335..3aa2f76 100755 --- a/src/jalview/binding/JalviewUserColours.java +++ b/src/jalview/binding/JalviewUserColours.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.binding; //---------------------------------/ diff --git a/src/jalview/binding/Pdbentry.java b/src/jalview/binding/Pdbentry.java index cac4cf6..341d498 100755 --- a/src/jalview/binding/Pdbentry.java +++ b/src/jalview/binding/Pdbentry.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.binding; //---------------------------------/ diff --git a/src/jalview/binding/PdbentryItem.java b/src/jalview/binding/PdbentryItem.java index 83bc40a..2299e41 100755 --- a/src/jalview/binding/PdbentryItem.java +++ b/src/jalview/binding/PdbentryItem.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.binding; /** diff --git a/src/jalview/binding/Pdbids.java b/src/jalview/binding/Pdbids.java index b4745a2..ed6fd8f 100755 --- a/src/jalview/binding/Pdbids.java +++ b/src/jalview/binding/Pdbids.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.binding; //---------------------------------/ diff --git a/src/jalview/binding/Property.java b/src/jalview/binding/Property.java index f1114f7..c05e3c4 100755 --- a/src/jalview/binding/Property.java +++ b/src/jalview/binding/Property.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.binding; //---------------------------------/ diff --git a/src/jalview/binding/Sequence.java b/src/jalview/binding/Sequence.java index 9c8cbc2..7370668 100755 --- a/src/jalview/binding/Sequence.java +++ b/src/jalview/binding/Sequence.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.binding; //---------------------------------/ diff --git a/src/jalview/binding/SequenceSet.java b/src/jalview/binding/SequenceSet.java index 13a9020..32c2f0f 100755 --- a/src/jalview/binding/SequenceSet.java +++ b/src/jalview/binding/SequenceSet.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.binding; //---------------------------------/ diff --git a/src/jalview/binding/SequenceType.java b/src/jalview/binding/SequenceType.java index 1bb2a62..32d09ea 100755 --- a/src/jalview/binding/SequenceType.java +++ b/src/jalview/binding/SequenceType.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.binding; //---------------------------------/ diff --git a/src/jalview/binding/Setting.java b/src/jalview/binding/Setting.java index 9cd84b4..253c77f 100755 --- a/src/jalview/binding/Setting.java +++ b/src/jalview/binding/Setting.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.binding; //---------------------------------/ diff --git a/src/jalview/binding/Tree.java b/src/jalview/binding/Tree.java index 5f138d0..afebcf6 100755 --- a/src/jalview/binding/Tree.java +++ b/src/jalview/binding/Tree.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.binding; //---------------------------------/ diff --git a/src/jalview/binding/UserColourScheme.java b/src/jalview/binding/UserColourScheme.java index 24c97ff..6d81bac 100755 --- a/src/jalview/binding/UserColourScheme.java +++ b/src/jalview/binding/UserColourScheme.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.binding; //---------------------------------/ diff --git a/src/jalview/binding/UserColours.java b/src/jalview/binding/UserColours.java index bdefe05..ae14b12 100755 --- a/src/jalview/binding/UserColours.java +++ b/src/jalview/binding/UserColours.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.binding; //---------------------------------/ diff --git a/src/jalview/binding/VAMSAS.java b/src/jalview/binding/VAMSAS.java index 1c92bd3..19440c1 100755 --- a/src/jalview/binding/VAMSAS.java +++ b/src/jalview/binding/VAMSAS.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.binding; //---------------------------------/ diff --git a/src/jalview/binding/VamsasModel.java b/src/jalview/binding/VamsasModel.java index 5fda35e..2901305 100755 --- a/src/jalview/binding/VamsasModel.java +++ b/src/jalview/binding/VamsasModel.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.binding; //---------------------------------/ diff --git a/src/jalview/binding/Viewport.java b/src/jalview/binding/Viewport.java index 643c323..34d8f69 100755 --- a/src/jalview/binding/Viewport.java +++ b/src/jalview/binding/Viewport.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.binding; //---------------------------------/ diff --git a/src/jalview/commands/ChangeCaseCommand.java b/src/jalview/commands/ChangeCaseCommand.java index 976be92..64bffbc 100644 --- a/src/jalview/commands/ChangeCaseCommand.java +++ b/src/jalview/commands/ChangeCaseCommand.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/commands/CommandI.java b/src/jalview/commands/CommandI.java index 97675e7..9fe508b 100644 --- a/src/jalview/commands/CommandI.java +++ b/src/jalview/commands/CommandI.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/commands/EditCommand.java b/src/jalview/commands/EditCommand.java index e859e3e..a50cdc4 100644 --- a/src/jalview/commands/EditCommand.java +++ b/src/jalview/commands/EditCommand.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/commands/OrderCommand.java b/src/jalview/commands/OrderCommand.java index b331690..13328b8 100644 --- a/src/jalview/commands/OrderCommand.java +++ b/src/jalview/commands/OrderCommand.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/commands/RemoveGapColCommand.java b/src/jalview/commands/RemoveGapColCommand.java index a874f71..ecd2cba 100644 --- a/src/jalview/commands/RemoveGapColCommand.java +++ b/src/jalview/commands/RemoveGapColCommand.java @@ -1,3 +1,21 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ package jalview.commands; /* diff --git a/src/jalview/commands/RemoveGapsCommand.java b/src/jalview/commands/RemoveGapsCommand.java index 5639fa5..fffea86 100644 --- a/src/jalview/commands/RemoveGapsCommand.java +++ b/src/jalview/commands/RemoveGapsCommand.java @@ -1,3 +1,21 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ package jalview.commands; /* diff --git a/src/jalview/commands/SlideSequencesCommand.java b/src/jalview/commands/SlideSequencesCommand.java index 9b9c99e..ff5742b 100644 --- a/src/jalview/commands/SlideSequencesCommand.java +++ b/src/jalview/commands/SlideSequencesCommand.java @@ -1,23 +1,21 @@ - /* -* Jalview - A Sequence Alignment Editor and Viewer -* Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; either version 2 -* of the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA -*/ - + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ package jalview.commands; import jalview.datamodel.*; diff --git a/src/jalview/commands/TrimRegionCommand.java b/src/jalview/commands/TrimRegionCommand.java index 4110bd1..81b5dca 100644 --- a/src/jalview/commands/TrimRegionCommand.java +++ b/src/jalview/commands/TrimRegionCommand.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/datamodel/AlignedCodonFrame.java b/src/jalview/datamodel/AlignedCodonFrame.java index 6c6c26e..3f05d5f 100644 --- a/src/jalview/datamodel/AlignedCodonFrame.java +++ b/src/jalview/datamodel/AlignedCodonFrame.java @@ -1,3 +1,21 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ package jalview.datamodel; import java.util.Enumeration; diff --git a/src/jalview/datamodel/Alignment.java b/src/jalview/datamodel/Alignment.java index a88fa9e..82bc8db 100755 --- a/src/jalview/datamodel/Alignment.java +++ b/src/jalview/datamodel/Alignment.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/datamodel/AlignmentAnnotation.java b/src/jalview/datamodel/AlignmentAnnotation.java index f2864db..07fbfa5 100755 --- a/src/jalview/datamodel/AlignmentAnnotation.java +++ b/src/jalview/datamodel/AlignmentAnnotation.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/datamodel/AlignmentI.java b/src/jalview/datamodel/AlignmentI.java index f89602f..eb27908 100755 --- a/src/jalview/datamodel/AlignmentI.java +++ b/src/jalview/datamodel/AlignmentI.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/datamodel/AlignmentOrder.java b/src/jalview/datamodel/AlignmentOrder.java index b149749..3f806b6 100755 --- a/src/jalview/datamodel/AlignmentOrder.java +++ b/src/jalview/datamodel/AlignmentOrder.java @@ -1,316 +1,316 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.datamodel; - -import java.util.*; - -/** - *

Title:

- * - *

Description:

- * - *

Copyright: Copyright (c) 2004

- * - *

Company: Dundee University

- * - * @author not attributable - * @version 1.0 - */ -public class AlignmentOrder -{ - // JBPNote : this method would return a vector containing all sequences in seqset - // with those also contained in order at the beginning of the vector in the order - // given by order. AlignmentSorter.vectorSubsetToArray already does this, but that method - // should be here for completeness. - - /* public Vector getOrder(AlignmentI seqset) - { - Vector perm = new Vector(seqset.getHeight()); - for (i=0, o = 0, n=seqset.getHeight(), p = Order.size(); i -1) - { - Order.setElementAt(newref, found); - } - return found > -1; - } - - /** - * Exact equivalence of two AlignmentOrders - * @param o - * @return true if o orders the same sequenceI objects in the same way - */ - public boolean equals(AlignmentOrder o) - { - return equals(o, true); - } - - /** - * Exact equivalence of two AlignmentOrders - * // TODO: Weak SequenceI equivalence - will throw Error at moment - * @param o - * @param identity - false - use weak equivalence (refers to same or different parts of same sequence) - * @return true if o orders equivalent sequenceI objects in the same way - */ - public boolean equals(AlignmentOrder o, boolean identity) - { - if (o != this) - { - if (o == null) - { - return false; - } - if (Order != null && o.Order != null && Order.size() == o.Order.size()) - { - if (!identity) - { - throw new Error("Weak sequenceI equivalence not yet implemented."); - } - else - { - for (int i = 0, j = o.Order.size(); i < j; i++) - { - if (Order.elementAt(i) != o.Order.elementAt(i)) - { - return false; - } - } - } - } - else - { - return false; - } - } - return true; - } - - /** - * Consistency test for alignmentOrders - * @param o - * @return true if o contains or is contained by this and the common SequenceI objects are ordered in the same way - */ - public boolean isConsistent(AlignmentOrder o) - { - return isConsistent(o, true); - } - - /** - * Consistency test for alignmentOrders - * @param o - * // TODO: Weak SequenceI equivalence - will throw Error at moment - * @param identity - false - use weak equivalence (refers to same or different parts of same sequence) - * @return true if o contains or is contained by this and the common SequenceI objects are ordered in the same way - */ - public boolean isConsistent(AlignmentOrder o, boolean identity) - { - if (o != this) - { - if (o == null) - { - return false; - } - if (Order != null && o.Order != null) - { - Vector c, s; - if (o.Order.size() > Order.size()) - { - c = o.Order; - s = Order; - } - else - { - c = Order; - s = o.Order; - } - if (!identity) - { - throw new Error("Weak sequenceI equivalence not yet implemented."); - } - else - { - // test if c contains s and order in s is conserved in c - int last = -1; - for (int i = 0, j = s.size(); i < j; i++) - { - int pos = c.indexOf(s.elementAt(i)); // JBPNote - optimize by incremental position search - if (pos > last) - { - last = pos; - } - else - { - return false; - } - } - } - } - else - { - return false; - } - } - return true; - } - /** - * AlignmentOrder - * - * @param orderThis AlignmentI - * @param byThat AlignmentI - */ - - /* public AlignmentOrder(AlignmentI orderThis, AlignmentI byThat) - { - // Vector is an ordering of this alignment using the order of sequence objects in byThat, - // where ids and unaligned sequences must match - - } */ -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.datamodel; + +import java.util.*; + +/** + *

Title:

+ * + *

Description:

+ * + *

Copyright: Copyright (c) 2004

+ * + *

Company: Dundee University

+ * + * @author not attributable + * @version 1.0 + */ +public class AlignmentOrder +{ + // JBPNote : this method would return a vector containing all sequences in seqset + // with those also contained in order at the beginning of the vector in the order + // given by order. AlignmentSorter.vectorSubsetToArray already does this, but that method + // should be here for completeness. + + /* public Vector getOrder(AlignmentI seqset) + { + Vector perm = new Vector(seqset.getHeight()); + for (i=0, o = 0, n=seqset.getHeight(), p = Order.size(); i -1) + { + Order.setElementAt(newref, found); + } + return found > -1; + } + + /** + * Exact equivalence of two AlignmentOrders + * @param o + * @return true if o orders the same sequenceI objects in the same way + */ + public boolean equals(AlignmentOrder o) + { + return equals(o, true); + } + + /** + * Exact equivalence of two AlignmentOrders + * // TODO: Weak SequenceI equivalence - will throw Error at moment + * @param o + * @param identity - false - use weak equivalence (refers to same or different parts of same sequence) + * @return true if o orders equivalent sequenceI objects in the same way + */ + public boolean equals(AlignmentOrder o, boolean identity) + { + if (o != this) + { + if (o == null) + { + return false; + } + if (Order != null && o.Order != null && Order.size() == o.Order.size()) + { + if (!identity) + { + throw new Error("Weak sequenceI equivalence not yet implemented."); + } + else + { + for (int i = 0, j = o.Order.size(); i < j; i++) + { + if (Order.elementAt(i) != o.Order.elementAt(i)) + { + return false; + } + } + } + } + else + { + return false; + } + } + return true; + } + + /** + * Consistency test for alignmentOrders + * @param o + * @return true if o contains or is contained by this and the common SequenceI objects are ordered in the same way + */ + public boolean isConsistent(AlignmentOrder o) + { + return isConsistent(o, true); + } + + /** + * Consistency test for alignmentOrders + * @param o + * // TODO: Weak SequenceI equivalence - will throw Error at moment + * @param identity - false - use weak equivalence (refers to same or different parts of same sequence) + * @return true if o contains or is contained by this and the common SequenceI objects are ordered in the same way + */ + public boolean isConsistent(AlignmentOrder o, boolean identity) + { + if (o != this) + { + if (o == null) + { + return false; + } + if (Order != null && o.Order != null) + { + Vector c, s; + if (o.Order.size() > Order.size()) + { + c = o.Order; + s = Order; + } + else + { + c = Order; + s = o.Order; + } + if (!identity) + { + throw new Error("Weak sequenceI equivalence not yet implemented."); + } + else + { + // test if c contains s and order in s is conserved in c + int last = -1; + for (int i = 0, j = s.size(); i < j; i++) + { + int pos = c.indexOf(s.elementAt(i)); // JBPNote - optimize by incremental position search + if (pos > last) + { + last = pos; + } + else + { + return false; + } + } + } + } + else + { + return false; + } + } + return true; + } + /** + * AlignmentOrder + * + * @param orderThis AlignmentI + * @param byThat AlignmentI + */ + + /* public AlignmentOrder(AlignmentI orderThis, AlignmentI byThat) + { + // Vector is an ordering of this alignment using the order of sequence objects in byThat, + // where ids and unaligned sequences must match + + } */ +} diff --git a/src/jalview/datamodel/AlignmentView.java b/src/jalview/datamodel/AlignmentView.java index 79e0ba2..ad4e895 100644 --- a/src/jalview/datamodel/AlignmentView.java +++ b/src/jalview/datamodel/AlignmentView.java @@ -1,510 +1,510 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.datamodel; - -/** - *

Title:

- * - *

Description:

- * - *

Copyright: Copyright (c) 2004

- * - *

Company: Dundee University

- * - * @author not attributable - * @version 1.0 - */ -public class AlignmentView -{ - /** - * Transient object compactly representing a 'view' of an alignment - with discontinuities marked. - */ - private SeqCigar[] sequences = null; - private int[] contigs = null; - private int width = 0; - private int firstCol = 0; - public AlignmentView(CigarArray seqcigararray) - { - if (!seqcigararray.isSeqCigarArray()) - { - throw new Error("Implementation Error - can only make an alignment view from a CigarArray of sequences."); - } - //contigs = seqcigararray.applyDeletions(); - contigs = seqcigararray.getDeletedRegions(); - sequences = seqcigararray.getSeqCigarArray(); - width = seqcigararray.getWidth(); // visible width - } - - /** - * Create an alignmentView where the first column corresponds with the 'firstcol' column of some reference alignment - * @param sdata - * @param firstcol - */ - public AlignmentView(CigarArray sdata, int firstcol) - { - this(sdata); - firstCol = firstcol; - } - - public void setSequences(SeqCigar[] sequences) - { - this.sequences = sequences; - } - - public void setContigs(int[] contigs) - { - this.contigs = contigs; - } - - public SeqCigar[] getSequences() - { - return sequences; - } - - /** - * @see CigarArray.getDeletedRegions - * @return int[] { vis_start, sym_start, length } - */ - public int[] getContigs() - { - return contigs; - } - - /** - * get the full alignment and a columnselection object marking the hidden regions - * @param gapCharacter char - * @return Object[] { SequenceI[], ColumnSelection} - */ - public Object[] getAlignmentAndColumnSelection(char gapCharacter) - { - ColumnSelection colsel = new ColumnSelection(); - - return new Object[] - { - SeqCigar.createAlignmentSequences(sequences, gapCharacter, colsel, - contigs), colsel}; - } - - /** - * getSequenceStrings - * - * @param c char - * @return String[] - */ - public String[] getSequenceStrings(char c) - { - String[] seqs = new String[sequences.length]; - for (int n = 0; n < sequences.length; n++) - { - String fullseq = sequences[n].getSequenceString(c); - if (contigs != null) - { - seqs[n] = ""; - int p = 0; - for (int h = 0; h < contigs.length; h += 3) - { - seqs[n] += fullseq.substring(p, contigs[h + 1]); - p = contigs[h + 1] + contigs[h + 2]; - } - seqs[n] += fullseq.substring(p); - } - else - { - seqs[n] = fullseq; - } - } - return seqs; - } - - /** - * - * @return visible number of columns in alignment view - */ - public int getWidth() - { - return width; - } - - protected void setWidth(int width) - { - this.width = width; - } - - /** - * get the contiguous subalignments in an alignment view. - * @param gapCharacter char - * @return SequenceI[][] - */ - public SequenceI[][] getVisibleContigs(char gapCharacter) - { - SequenceI[][] smsa; - int njobs = 1; - if (sequences == null || width <= 0) - { - return null; - } - if (contigs != null && contigs.length > 0) - { - int start = 0; - njobs = 0; - int fwidth = width; - for (int contig = 0; contig < contigs.length; contig += 3) - { - if ( (contigs[contig + 1] - start) > 0) - { - njobs++; - } - fwidth += contigs[contig + 2]; // end up with full region width (including hidden regions) - start = contigs[contig + 1] + contigs[contig + 2]; - } - if (start < fwidth) - { - njobs++; - } - smsa = new SequenceI[njobs][]; - start = 0; - int j = 0; - for (int contig = 0; contig < contigs.length; contig += 3) - { - if (contigs[contig + 1] - start > 0) - { - 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]); - } - smsa[j] = mseq; - j++; - } - start = contigs[contig + 1] + contigs[contig + 2]; - } - if (start < fwidth) - { - SequenceI mseq[] = new SequenceI[sequences.length]; - for (int s = 0; s < mseq.length; s++) - { - mseq[s] = sequences[s].getSeq(gapCharacter).getSubSequence(start, - fwidth + 1); - } - smsa[j] = mseq; - j++; - } - } - else - { - smsa = new SequenceI[1][]; - smsa[0] = new SequenceI[sequences.length]; - for (int s = 0; s < sequences.length; s++) - { - smsa[0][s] = sequences[s].getSeq(gapCharacter); - } - } - return smsa; - } - - /** - * return full msa and hidden regions with visible blocks replaced with new sub alignments - * @param nvismsa SequenceI[][] - * @param orders AlignmentOrder[] corresponding to each SequenceI[] block. - * @return Object[] - */ - public Object[] getUpdatedView(SequenceI[][] nvismsa, AlignmentOrder[] orders, - char gapCharacter) - { - if (sequences == null || width <= 0) - { - throw new Error("empty view cannot be updated."); - } - if (nvismsa == null) - { - throw new Error( - "nvismsa==null. use getAlignmentAndColumnSelection() instead."); - } - if (contigs != null && contigs.length > 0) - { - SequenceI[] alignment = new SequenceI[sequences.length]; - ColumnSelection columnselection = new ColumnSelection(); - if (contigs != null && contigs.length > 0) - { - int start = 0; - int nwidth = 0; - int owidth = width; - int j = 0; - for (int contig = 0; contig < contigs.length; contig += 3) - { - owidth += contigs[contig + 2]; // recover final column width - if (contigs[contig + 1] - start > 0) - { - int swidth = 0; // subalignment width - if (nvismsa[j] != null) - { - SequenceI mseq[] = nvismsa[j]; - AlignmentOrder order = (orders == null) ? null : orders[j]; - j++; - if (mseq.length != sequences.length) - { - throw new Error( - "Mismatch between number of sequences in block " + j + " (" + - mseq.length + ") and the original view (" + - sequences.length + ")"); - } - swidth = mseq[0].getLength(); // JBPNote: could ensure padded here. - for (int s = 0; s < mseq.length; s++) - { - if (alignment[s] == null) - { - alignment[s] = mseq[s]; - } - else - { - alignment[s].setSequence(alignment[s].getSequenceAsString() + - mseq[s].getSequenceAsString()); - if (mseq[s].getStart() <= mseq[s].getEnd()) - { - alignment[s].setEnd(mseq[s].getEnd()); - } - if (order != null) - { - order.updateSequence(mseq[s], alignment[s]); - } - } - } - } - else - { - // recover original alignment block or place gaps - if (true) - { - // recover input data - for (int s = 0; s < sequences.length; s++) - { - SequenceI oseq = sequences[s].getSeq(gapCharacter). - getSubSequence(start, - contigs[contig + 1]); - if (swidth < oseq.getLength()) - { - swidth = oseq.getLength(); - } - if (alignment[s] == null) - { - alignment[s] = oseq; - } - else - { - alignment[s].setSequence(alignment[s].getSequenceAsString() + - oseq.getSequenceAsString()); - if (oseq.getEnd() >= oseq.getStart()) - { - alignment[s].setEnd(oseq.getEnd()); - } - } - } - - } - j++; - } - nwidth += swidth; - } - // advance to begining of visible region - start = contigs[contig + 1] + contigs[contig + 2]; - // add hidden segment to right of next region - for (int s = 0; s < sequences.length; s++) - { - SequenceI hseq = sequences[s].getSeq(gapCharacter).getSubSequence( - contigs[contig + - 1], start); - if (alignment[s] == null) - { - alignment[s] = hseq; - } - else - { - alignment[s].setSequence(alignment[s].getSequenceAsString() + - hseq.getSequenceAsString()); - if (hseq.getEnd() >= hseq.getStart()) - { - alignment[s].setEnd(hseq.getEnd()); - } - } - } - // mark hidden segment as hidden in the new alignment - columnselection.hideColumns(nwidth, nwidth + contigs[contig + 2] - 1); - nwidth += contigs[contig + 2]; - } - // Do final segment - if it exists - if (j < nvismsa.length) - { - int swidth = 0; - if (nvismsa[j] != null) - { - SequenceI mseq[] = nvismsa[j]; - AlignmentOrder order = (orders != null) ? orders[j] : null; - swidth = mseq[0].getLength(); - for (int s = 0; s < mseq.length; s++) - { - if (alignment[s] == null) - { - alignment[s] = mseq[s]; - } - else - { - alignment[s].setSequence(alignment[s].getSequenceAsString() + - mseq[s].getSequenceAsString()); - if (mseq[s].getEnd() >= mseq[s].getStart()) - { - alignment[s].setEnd(mseq[s].getEnd()); - } - if (order != null) - { - order.updateSequence(mseq[s], alignment[s]); - } - } - } - } - else - { - if (start < owidth) - { - // recover input data or place gaps - if (true) - { - // recover input data - for (int s = 0; s < sequences.length; s++) - { - SequenceI oseq = sequences[s].getSeq(gapCharacter). - getSubSequence(start, - owidth + 1); - if (swidth < oseq.getLength()) - { - swidth = oseq.getLength(); - } - if (alignment[s] == null) - { - alignment[s] = oseq; - } - else - { - alignment[s].setSequence(alignment[s].getSequenceAsString() + - oseq.getSequenceAsString()); - if (oseq.getEnd() >= oseq.getStart()) - { - alignment[s].setEnd(oseq.getEnd()); - } - } - } - nwidth += swidth; - } - else - { - // place gaps. - throw new Error("Padding not yet implemented."); - } - } - } - } - } - return new Object[] - { - alignment, columnselection}; - } - else - { - if (nvismsa.length != 1) - { - throw new Error("Mismatch between visible blocks to update and number of contigs in view (contigs=0,blocks=" + - nvismsa.length); - } - if (nvismsa[0] != null) - { - return new Object[] - { - nvismsa[0], new ColumnSelection()}; - } - else - { - return getAlignmentAndColumnSelection(gapCharacter); - } - } - } - - /** - * returns simple array of start end positions of visible range on alignment. - * vis_start and vis_end are inclusive - use SequenceI.getSubSequence(vis_start, vis_end+1) to recover visible sequence from underlying alignment. - * @return int[] { start_i, end_i } for 1 0) - { - int start = 0; - int nvis = 0; - int fwidth = width; - for (int contig = 0; contig < contigs.length; contig += 3) - { - if ( (contigs[contig + 1] - start) > 0) - { - nvis++; - } - fwidth += contigs[contig + 2]; // end up with full region width (including hidden regions) - start = contigs[contig + 1] + contigs[contig + 2]; - } - if (start < fwidth) - { - nvis++; - } - int viscontigs[] = new int[nvis * 2]; - nvis = 0; - start = 0; - for (int contig = 0; contig < contigs.length; contig += 3) - { - if ( (contigs[contig + 1] - start) > 0) - { - viscontigs[nvis] = start; - viscontigs[nvis + 1] = contigs[contig + 1] - 1; // end is inclusive - nvis += 2; - } - start = contigs[contig + 1] + contigs[contig + 2]; - } - if (start < fwidth) - { - viscontigs[nvis] = start; - viscontigs[nvis + 1] = fwidth; // end is inclusive - nvis += 2; - } - return viscontigs; - } - else - { - return new int[] - { - 0, width}; - } - } - - /** - * - * @return position of first visible column of AlignmentView within its parent's alignment reference frame - */ - public int getAlignmentOrigin() - { - // TODO Auto-generated method stub - return firstCol; - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.datamodel; + +/** + *

Title:

+ * + *

Description:

+ * + *

Copyright: Copyright (c) 2004

+ * + *

Company: Dundee University

+ * + * @author not attributable + * @version 1.0 + */ +public class AlignmentView +{ + /** + * Transient object compactly representing a 'view' of an alignment - with discontinuities marked. + */ + private SeqCigar[] sequences = null; + private int[] contigs = null; + private int width = 0; + private int firstCol = 0; + public AlignmentView(CigarArray seqcigararray) + { + if (!seqcigararray.isSeqCigarArray()) + { + throw new Error("Implementation Error - can only make an alignment view from a CigarArray of sequences."); + } + //contigs = seqcigararray.applyDeletions(); + contigs = seqcigararray.getDeletedRegions(); + sequences = seqcigararray.getSeqCigarArray(); + width = seqcigararray.getWidth(); // visible width + } + + /** + * Create an alignmentView where the first column corresponds with the 'firstcol' column of some reference alignment + * @param sdata + * @param firstcol + */ + public AlignmentView(CigarArray sdata, int firstcol) + { + this(sdata); + firstCol = firstcol; + } + + public void setSequences(SeqCigar[] sequences) + { + this.sequences = sequences; + } + + public void setContigs(int[] contigs) + { + this.contigs = contigs; + } + + public SeqCigar[] getSequences() + { + return sequences; + } + + /** + * @see CigarArray.getDeletedRegions + * @return int[] { vis_start, sym_start, length } + */ + public int[] getContigs() + { + return contigs; + } + + /** + * get the full alignment and a columnselection object marking the hidden regions + * @param gapCharacter char + * @return Object[] { SequenceI[], ColumnSelection} + */ + public Object[] getAlignmentAndColumnSelection(char gapCharacter) + { + ColumnSelection colsel = new ColumnSelection(); + + return new Object[] + { + SeqCigar.createAlignmentSequences(sequences, gapCharacter, colsel, + contigs), colsel}; + } + + /** + * getSequenceStrings + * + * @param c char + * @return String[] + */ + public String[] getSequenceStrings(char c) + { + String[] seqs = new String[sequences.length]; + for (int n = 0; n < sequences.length; n++) + { + String fullseq = sequences[n].getSequenceString(c); + if (contigs != null) + { + seqs[n] = ""; + int p = 0; + for (int h = 0; h < contigs.length; h += 3) + { + seqs[n] += fullseq.substring(p, contigs[h + 1]); + p = contigs[h + 1] + contigs[h + 2]; + } + seqs[n] += fullseq.substring(p); + } + else + { + seqs[n] = fullseq; + } + } + return seqs; + } + + /** + * + * @return visible number of columns in alignment view + */ + public int getWidth() + { + return width; + } + + protected void setWidth(int width) + { + this.width = width; + } + + /** + * get the contiguous subalignments in an alignment view. + * @param gapCharacter char + * @return SequenceI[][] + */ + public SequenceI[][] getVisibleContigs(char gapCharacter) + { + SequenceI[][] smsa; + int njobs = 1; + if (sequences == null || width <= 0) + { + return null; + } + if (contigs != null && contigs.length > 0) + { + int start = 0; + njobs = 0; + int fwidth = width; + for (int contig = 0; contig < contigs.length; contig += 3) + { + if ( (contigs[contig + 1] - start) > 0) + { + njobs++; + } + fwidth += contigs[contig + 2]; // end up with full region width (including hidden regions) + start = contigs[contig + 1] + contigs[contig + 2]; + } + if (start < fwidth) + { + njobs++; + } + smsa = new SequenceI[njobs][]; + start = 0; + int j = 0; + for (int contig = 0; contig < contigs.length; contig += 3) + { + if (contigs[contig + 1] - start > 0) + { + 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]); + } + smsa[j] = mseq; + j++; + } + start = contigs[contig + 1] + contigs[contig + 2]; + } + if (start < fwidth) + { + SequenceI mseq[] = new SequenceI[sequences.length]; + for (int s = 0; s < mseq.length; s++) + { + mseq[s] = sequences[s].getSeq(gapCharacter).getSubSequence(start, + fwidth + 1); + } + smsa[j] = mseq; + j++; + } + } + else + { + smsa = new SequenceI[1][]; + smsa[0] = new SequenceI[sequences.length]; + for (int s = 0; s < sequences.length; s++) + { + smsa[0][s] = sequences[s].getSeq(gapCharacter); + } + } + return smsa; + } + + /** + * return full msa and hidden regions with visible blocks replaced with new sub alignments + * @param nvismsa SequenceI[][] + * @param orders AlignmentOrder[] corresponding to each SequenceI[] block. + * @return Object[] + */ + public Object[] getUpdatedView(SequenceI[][] nvismsa, AlignmentOrder[] orders, + char gapCharacter) + { + if (sequences == null || width <= 0) + { + throw new Error("empty view cannot be updated."); + } + if (nvismsa == null) + { + throw new Error( + "nvismsa==null. use getAlignmentAndColumnSelection() instead."); + } + if (contigs != null && contigs.length > 0) + { + SequenceI[] alignment = new SequenceI[sequences.length]; + ColumnSelection columnselection = new ColumnSelection(); + if (contigs != null && contigs.length > 0) + { + int start = 0; + int nwidth = 0; + int owidth = width; + int j = 0; + for (int contig = 0; contig < contigs.length; contig += 3) + { + owidth += contigs[contig + 2]; // recover final column width + if (contigs[contig + 1] - start > 0) + { + int swidth = 0; // subalignment width + if (nvismsa[j] != null) + { + SequenceI mseq[] = nvismsa[j]; + AlignmentOrder order = (orders == null) ? null : orders[j]; + j++; + if (mseq.length != sequences.length) + { + throw new Error( + "Mismatch between number of sequences in block " + j + " (" + + mseq.length + ") and the original view (" + + sequences.length + ")"); + } + swidth = mseq[0].getLength(); // JBPNote: could ensure padded here. + for (int s = 0; s < mseq.length; s++) + { + if (alignment[s] == null) + { + alignment[s] = mseq[s]; + } + else + { + alignment[s].setSequence(alignment[s].getSequenceAsString() + + mseq[s].getSequenceAsString()); + if (mseq[s].getStart() <= mseq[s].getEnd()) + { + alignment[s].setEnd(mseq[s].getEnd()); + } + if (order != null) + { + order.updateSequence(mseq[s], alignment[s]); + } + } + } + } + else + { + // recover original alignment block or place gaps + if (true) + { + // recover input data + for (int s = 0; s < sequences.length; s++) + { + SequenceI oseq = sequences[s].getSeq(gapCharacter). + getSubSequence(start, + contigs[contig + 1]); + if (swidth < oseq.getLength()) + { + swidth = oseq.getLength(); + } + if (alignment[s] == null) + { + alignment[s] = oseq; + } + else + { + alignment[s].setSequence(alignment[s].getSequenceAsString() + + oseq.getSequenceAsString()); + if (oseq.getEnd() >= oseq.getStart()) + { + alignment[s].setEnd(oseq.getEnd()); + } + } + } + + } + j++; + } + nwidth += swidth; + } + // advance to begining of visible region + start = contigs[contig + 1] + contigs[contig + 2]; + // add hidden segment to right of next region + for (int s = 0; s < sequences.length; s++) + { + SequenceI hseq = sequences[s].getSeq(gapCharacter).getSubSequence( + contigs[contig + + 1], start); + if (alignment[s] == null) + { + alignment[s] = hseq; + } + else + { + alignment[s].setSequence(alignment[s].getSequenceAsString() + + hseq.getSequenceAsString()); + if (hseq.getEnd() >= hseq.getStart()) + { + alignment[s].setEnd(hseq.getEnd()); + } + } + } + // mark hidden segment as hidden in the new alignment + columnselection.hideColumns(nwidth, nwidth + contigs[contig + 2] - 1); + nwidth += contigs[contig + 2]; + } + // Do final segment - if it exists + if (j < nvismsa.length) + { + int swidth = 0; + if (nvismsa[j] != null) + { + SequenceI mseq[] = nvismsa[j]; + AlignmentOrder order = (orders != null) ? orders[j] : null; + swidth = mseq[0].getLength(); + for (int s = 0; s < mseq.length; s++) + { + if (alignment[s] == null) + { + alignment[s] = mseq[s]; + } + else + { + alignment[s].setSequence(alignment[s].getSequenceAsString() + + mseq[s].getSequenceAsString()); + if (mseq[s].getEnd() >= mseq[s].getStart()) + { + alignment[s].setEnd(mseq[s].getEnd()); + } + if (order != null) + { + order.updateSequence(mseq[s], alignment[s]); + } + } + } + } + else + { + if (start < owidth) + { + // recover input data or place gaps + if (true) + { + // recover input data + for (int s = 0; s < sequences.length; s++) + { + SequenceI oseq = sequences[s].getSeq(gapCharacter). + getSubSequence(start, + owidth + 1); + if (swidth < oseq.getLength()) + { + swidth = oseq.getLength(); + } + if (alignment[s] == null) + { + alignment[s] = oseq; + } + else + { + alignment[s].setSequence(alignment[s].getSequenceAsString() + + oseq.getSequenceAsString()); + if (oseq.getEnd() >= oseq.getStart()) + { + alignment[s].setEnd(oseq.getEnd()); + } + } + } + nwidth += swidth; + } + else + { + // place gaps. + throw new Error("Padding not yet implemented."); + } + } + } + } + } + return new Object[] + { + alignment, columnselection}; + } + else + { + if (nvismsa.length != 1) + { + throw new Error("Mismatch between visible blocks to update and number of contigs in view (contigs=0,blocks=" + + nvismsa.length); + } + if (nvismsa[0] != null) + { + return new Object[] + { + nvismsa[0], new ColumnSelection()}; + } + else + { + return getAlignmentAndColumnSelection(gapCharacter); + } + } + } + + /** + * returns simple array of start end positions of visible range on alignment. + * vis_start and vis_end are inclusive - use SequenceI.getSubSequence(vis_start, vis_end+1) to recover visible sequence from underlying alignment. + * @return int[] { start_i, end_i } for 1 0) + { + int start = 0; + int nvis = 0; + int fwidth = width; + for (int contig = 0; contig < contigs.length; contig += 3) + { + if ( (contigs[contig + 1] - start) > 0) + { + nvis++; + } + fwidth += contigs[contig + 2]; // end up with full region width (including hidden regions) + start = contigs[contig + 1] + contigs[contig + 2]; + } + if (start < fwidth) + { + nvis++; + } + int viscontigs[] = new int[nvis * 2]; + nvis = 0; + start = 0; + for (int contig = 0; contig < contigs.length; contig += 3) + { + if ( (contigs[contig + 1] - start) > 0) + { + viscontigs[nvis] = start; + viscontigs[nvis + 1] = contigs[contig + 1] - 1; // end is inclusive + nvis += 2; + } + start = contigs[contig + 1] + contigs[contig + 2]; + } + if (start < fwidth) + { + viscontigs[nvis] = start; + viscontigs[nvis + 1] = fwidth; // end is inclusive + nvis += 2; + } + return viscontigs; + } + else + { + return new int[] + { + 0, width}; + } + } + + /** + * + * @return position of first visible column of AlignmentView within its parent's alignment reference frame + */ + public int getAlignmentOrigin() + { + // TODO Auto-generated method stub + return firstCol; + } +} diff --git a/src/jalview/datamodel/Annotation.java b/src/jalview/datamodel/Annotation.java index 9fc69bb..b332fb4 100755 --- a/src/jalview/datamodel/Annotation.java +++ b/src/jalview/datamodel/Annotation.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/datamodel/BinaryNode.java b/src/jalview/datamodel/BinaryNode.java index a7e8254..da63613 100755 --- a/src/jalview/datamodel/BinaryNode.java +++ b/src/jalview/datamodel/BinaryNode.java @@ -1,284 +1,284 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.datamodel; - -/** - * DOCUMENT ME! - * - * @author $author$ - * @version $Revision$ - */ -public class BinaryNode -{ - Object element; - String name; - BinaryNode left; - BinaryNode right; - BinaryNode parent; - - /** DOCUMENT ME!! */ - public int bootstrap; - - /** - * Creates a new BinaryNode object. - */ - public BinaryNode() - { - left = right = parent = null; - bootstrap = 0; - } - - /** - * Creates a new BinaryNode object. - * - * @param element DOCUMENT ME! - * @param parent DOCUMENT ME! - * @param name DOCUMENT ME! - */ - public BinaryNode(Object element, BinaryNode parent, String name) - { - this.element = element; - this.parent = parent; - this.name = name; - - left = right = null; - } - - /** - * DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public Object element() - { - return element; - } - - /** - * DOCUMENT ME! - * - * @param v DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public Object setElement(Object v) - { - return element = v; - } - - /** - * DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public BinaryNode left() - { - return left; - } - - /** - * DOCUMENT ME! - * - * @param n DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public BinaryNode setLeft(BinaryNode n) - { - return left = n; - } - - /** - * DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public BinaryNode right() - { - return right; - } - - /** - * DOCUMENT ME! - * - * @param n DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public BinaryNode setRight(BinaryNode n) - { - return right = n; - } - - /** - * DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public BinaryNode parent() - { - return parent; - } - - /** - * DOCUMENT ME! - * - * @param n DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public BinaryNode setParent(BinaryNode n) - { - return parent = n; - } - - /** - * DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public boolean isLeaf() - { - return (left == null) && (right == null); - } - - /** - * attaches FIRST and SECOND node arguments as the LEFT and RIGHT children of this node (removing any old references) - * a null parameter DOES NOT mean that the pointer to the corresponding child node is set to NULL - you should use - * setChild(null), or detach() for this. - * - */ - public void SetChildren(BinaryNode leftchild, BinaryNode rightchild) - { - if (leftchild != null) - { - this.setLeft(leftchild); - leftchild.detach(); - leftchild.setParent(this); - } - - if (rightchild != null) - { - this.setRight(rightchild); - rightchild.detach(); - rightchild.setParent(this); - } - } - - /** - * Detaches the node from the binary tree, along with all its child nodes. - * @return BinaryNode The detached node. - */ - public BinaryNode detach() - { - if (this.parent != null) - { - if (this.parent.left == this) - { - this.parent.left = null; - } - else - { - if (this.parent.right == this) - { - this.parent.right = null; - } - } - } - - this.parent = null; - - return this; - } - - /** - * Traverses up through the tree until a node with a free leftchild is discovered. - * @return BinaryNode - */ - public BinaryNode ascendLeft() - { - BinaryNode c = this; - - do - { - c = c.parent(); - } - while ( (c != null) && (c.left() != null) && !c.left().isLeaf()); - - return c; - } - - /** - * Traverses up through the tree until a node with a free rightchild is discovered. - * Jalview builds trees by descent on the left, so this may be unused. - * @return BinaryNode - */ - public BinaryNode ascendRight() - { - BinaryNode c = this; - - do - { - c = c.parent(); - } - while ( (c != null) && (c.right() != null) && !c.right().isLeaf()); - - return c; - } - - /** - * DOCUMENT ME! - * - * @param name DOCUMENT ME! - */ - public void setName(String name) - { - this.name = name; - } - - /** - * DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public String getName() - { - return this.name; - } - - /** - * DOCUMENT ME! - * - * @param boot DOCUMENT ME! - */ - public void setBootstrap(int boot) - { - this.bootstrap = boot; - } - - /** - * DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public int getBootstrap() - { - return bootstrap; - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.datamodel; + +/** + * DOCUMENT ME! + * + * @author $author$ + * @version $Revision$ + */ +public class BinaryNode +{ + Object element; + String name; + BinaryNode left; + BinaryNode right; + BinaryNode parent; + + /** DOCUMENT ME!! */ + public int bootstrap; + + /** + * Creates a new BinaryNode object. + */ + public BinaryNode() + { + left = right = parent = null; + bootstrap = 0; + } + + /** + * Creates a new BinaryNode object. + * + * @param element DOCUMENT ME! + * @param parent DOCUMENT ME! + * @param name DOCUMENT ME! + */ + public BinaryNode(Object element, BinaryNode parent, String name) + { + this.element = element; + this.parent = parent; + this.name = name; + + left = right = null; + } + + /** + * DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public Object element() + { + return element; + } + + /** + * DOCUMENT ME! + * + * @param v DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public Object setElement(Object v) + { + return element = v; + } + + /** + * DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public BinaryNode left() + { + return left; + } + + /** + * DOCUMENT ME! + * + * @param n DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public BinaryNode setLeft(BinaryNode n) + { + return left = n; + } + + /** + * DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public BinaryNode right() + { + return right; + } + + /** + * DOCUMENT ME! + * + * @param n DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public BinaryNode setRight(BinaryNode n) + { + return right = n; + } + + /** + * DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public BinaryNode parent() + { + return parent; + } + + /** + * DOCUMENT ME! + * + * @param n DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public BinaryNode setParent(BinaryNode n) + { + return parent = n; + } + + /** + * DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public boolean isLeaf() + { + return (left == null) && (right == null); + } + + /** + * attaches FIRST and SECOND node arguments as the LEFT and RIGHT children of this node (removing any old references) + * a null parameter DOES NOT mean that the pointer to the corresponding child node is set to NULL - you should use + * setChild(null), or detach() for this. + * + */ + public void SetChildren(BinaryNode leftchild, BinaryNode rightchild) + { + if (leftchild != null) + { + this.setLeft(leftchild); + leftchild.detach(); + leftchild.setParent(this); + } + + if (rightchild != null) + { + this.setRight(rightchild); + rightchild.detach(); + rightchild.setParent(this); + } + } + + /** + * Detaches the node from the binary tree, along with all its child nodes. + * @return BinaryNode The detached node. + */ + public BinaryNode detach() + { + if (this.parent != null) + { + if (this.parent.left == this) + { + this.parent.left = null; + } + else + { + if (this.parent.right == this) + { + this.parent.right = null; + } + } + } + + this.parent = null; + + return this; + } + + /** + * Traverses up through the tree until a node with a free leftchild is discovered. + * @return BinaryNode + */ + public BinaryNode ascendLeft() + { + BinaryNode c = this; + + do + { + c = c.parent(); + } + while ( (c != null) && (c.left() != null) && !c.left().isLeaf()); + + return c; + } + + /** + * Traverses up through the tree until a node with a free rightchild is discovered. + * Jalview builds trees by descent on the left, so this may be unused. + * @return BinaryNode + */ + public BinaryNode ascendRight() + { + BinaryNode c = this; + + do + { + c = c.parent(); + } + while ( (c != null) && (c.right() != null) && !c.right().isLeaf()); + + return c; + } + + /** + * DOCUMENT ME! + * + * @param name DOCUMENT ME! + */ + public void setName(String name) + { + this.name = name; + } + + /** + * DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public String getName() + { + return this.name; + } + + /** + * DOCUMENT ME! + * + * @param boot DOCUMENT ME! + */ + public void setBootstrap(int boot) + { + this.bootstrap = boot; + } + + /** + * DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public int getBootstrap() + { + return bootstrap; + } +} diff --git a/src/jalview/datamodel/BinarySequence.java b/src/jalview/datamodel/BinarySequence.java index 1cdc934..596fb60 100755 --- a/src/jalview/datamodel/BinarySequence.java +++ b/src/jalview/datamodel/BinarySequence.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/datamodel/CigarArray.java b/src/jalview/datamodel/CigarArray.java index c17e01e..fdd3bff 100644 --- a/src/jalview/datamodel/CigarArray.java +++ b/src/jalview/datamodel/CigarArray.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/datamodel/CigarBase.java b/src/jalview/datamodel/CigarBase.java index d44d599..4ca2720 100644 --- a/src/jalview/datamodel/CigarBase.java +++ b/src/jalview/datamodel/CigarBase.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/datamodel/CigarCigar.java b/src/jalview/datamodel/CigarCigar.java index 83cce19..a47c5eb 100644 --- a/src/jalview/datamodel/CigarCigar.java +++ b/src/jalview/datamodel/CigarCigar.java @@ -1,59 +1,59 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.datamodel; - -public class CigarCigar - extends CigarSimple -{ - SeqCigar refCigar; - /** - * Apply CIGAR operations to the result of another cigar - * @param cigar Cigar - */ - CigarCigar(SeqCigar cigar) - { - super(); - refCigar = cigar; - } - - /** - * - * @return String formed by applying CIGAR operations to the reference object - * @param GapChar char - * @todo Implement this jalview.datamodel.Cigar method - */ - public String getSequenceString(char GapChar) - { - if (length == 0) - { - return ""; - } - String refString = refCigar.getSequenceString(GapChar); - if (refString != null) - { - return (length == 0) ? "" : - (String) getSequenceAndDeletions(refString, GapChar)[0]; - } - else - { - return null; - } - } - -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.datamodel; + +public class CigarCigar + extends CigarSimple +{ + SeqCigar refCigar; + /** + * Apply CIGAR operations to the result of another cigar + * @param cigar Cigar + */ + CigarCigar(SeqCigar cigar) + { + super(); + refCigar = cigar; + } + + /** + * + * @return String formed by applying CIGAR operations to the reference object + * @param GapChar char + * @todo Implement this jalview.datamodel.Cigar method + */ + public String getSequenceString(char GapChar) + { + if (length == 0) + { + return ""; + } + String refString = refCigar.getSequenceString(GapChar); + if (refString != null) + { + return (length == 0) ? "" : + (String) getSequenceAndDeletions(refString, GapChar)[0]; + } + else + { + return null; + } + } + +} diff --git a/src/jalview/datamodel/CigarSimple.java b/src/jalview/datamodel/CigarSimple.java index 3891687..2616d74 100644 --- a/src/jalview/datamodel/CigarSimple.java +++ b/src/jalview/datamodel/CigarSimple.java @@ -1,43 +1,43 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.datamodel; - -/** - *

Title:

- * - *

Description:

- * - *

Copyright: Copyright (c) 2004

- * - *

Company: Dundee University

- * - * @author not attributable - * @version 1.0 - */ -public abstract class CigarSimple - extends CigarBase -{ - /** - * Return a symbol sequence with edits (gaps, insertions and deletions) applied - * @param GapChar char - * @return String - */ - public abstract String getSequenceString(char GapChar); - -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.datamodel; + +/** + *

Title:

+ * + *

Description:

+ * + *

Copyright: Copyright (c) 2004

+ * + *

Company: Dundee University

+ * + * @author not attributable + * @version 1.0 + */ +public abstract class CigarSimple + extends CigarBase +{ + /** + * Return a symbol sequence with edits (gaps, insertions and deletions) applied + * @param GapChar char + * @return String + */ + public abstract String getSequenceString(char GapChar); + +} diff --git a/src/jalview/datamodel/ColumnSelection.java b/src/jalview/datamodel/ColumnSelection.java index 74f4cda..9ec4270 100644 --- a/src/jalview/datamodel/ColumnSelection.java +++ b/src/jalview/datamodel/ColumnSelection.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/datamodel/DBRefEntry.java b/src/jalview/datamodel/DBRefEntry.java index b6c3192..f827bad 100755 --- a/src/jalview/datamodel/DBRefEntry.java +++ b/src/jalview/datamodel/DBRefEntry.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/datamodel/DBRefSource.java b/src/jalview/datamodel/DBRefSource.java index 0552b2c..1aabf70 100755 --- a/src/jalview/datamodel/DBRefSource.java +++ b/src/jalview/datamodel/DBRefSource.java @@ -1,102 +1,102 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.datamodel; -/** - * Defines internal constants for unambiguous annotation - * of DbRefEntry source strings and describing the data - * retrieved from external database sources (see jalview.ws.DbSourcProxy) - * @author JimP - * - */ -public class DBRefSource -{ - /** - * UNIPROT Accession Number - */ - public static String UNIPROT = "UNIPROT"; - /** - * UNIPROT Entry Name - */ - public static String UP_NAME = "UNIPROT_NAME"; - /** - * Uniprot Knowledgebase/TrEMBL - * as served from EMBL protein products. - */ - public static final String UNIPROTKB = "UniProtKB/TrEMBL"; - /** - * PDB Entry Code - */ - public static String PDB = "PDB"; - /** - * EMBL ID - */ - public static String EMBL = "EMBL"; - /** - * EMBLCDS ID - */ - public static String EMBLCDS = "EMBLCDS"; - /** - * PFAM ID - */ - public static String PFAM = "PFAM"; - /** - * GeneDB ID - */ - public static final String GENEDB = "GeneDB"; - - /** - * List of databases whose sequences might have coding regions annotated - */ - public static final String[] DNACODINGDBS = { EMBL, EMBLCDS, GENEDB}; - public static final String[] CODINGDBS = { EMBLCDS, GENEDB}; - public static final String[] PROTEINDBS = { UNIPROT, PDB, UNIPROTKB}; - public static final String[] PROTEINSEQ = { UNIPROT, UNIPROTKB}; - public static final String[] PROTEINSTR = { PDB }; - public static final String[] DOMAINDBS = { PFAM }; - /** - * set of unique DBRefSource property constants. - * These could be used to reconstruct the above groupings - */ - public static final Object SEQDB = "SQ"; - /** - * database of nucleic acid sequences - */ - public static final Object DNASEQDB = "NASQ"; - /** - * database of amino acid sequences - */ - public static final Object PROTSEQDB = "PROTSQ"; - /** - * database of cDNA sequences - */ - public static final Object CODINGSEQDB = "CODING"; - /** - * database of na sequences with exon annotation - */ - public static final Object DNACODINGSEQDB = "XONCODING"; - /** - * DB returns several sequences associated with a protein domain - */ - public static final Object DOMAINDB = "DOMAIN"; - /** - * DB query can take multiple accession codes concatenated - * by a separator. Value of property indicates maximum number of accession codes to send at a time. - */ - public static final Object MULTIACC = "MULTIACC"; -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.datamodel; +/** + * Defines internal constants for unambiguous annotation + * of DbRefEntry source strings and describing the data + * retrieved from external database sources (see jalview.ws.DbSourcProxy) + * @author JimP + * + */ +public class DBRefSource +{ + /** + * UNIPROT Accession Number + */ + public static String UNIPROT = "UNIPROT"; + /** + * UNIPROT Entry Name + */ + public static String UP_NAME = "UNIPROT_NAME"; + /** + * Uniprot Knowledgebase/TrEMBL + * as served from EMBL protein products. + */ + public static final String UNIPROTKB = "UniProtKB/TrEMBL"; + /** + * PDB Entry Code + */ + public static String PDB = "PDB"; + /** + * EMBL ID + */ + public static String EMBL = "EMBL"; + /** + * EMBLCDS ID + */ + public static String EMBLCDS = "EMBLCDS"; + /** + * PFAM ID + */ + public static String PFAM = "PFAM"; + /** + * GeneDB ID + */ + public static final String GENEDB = "GeneDB"; + + /** + * List of databases whose sequences might have coding regions annotated + */ + public static final String[] DNACODINGDBS = { EMBL, EMBLCDS, GENEDB}; + public static final String[] CODINGDBS = { EMBLCDS, GENEDB}; + public static final String[] PROTEINDBS = { UNIPROT, PDB, UNIPROTKB}; + public static final String[] PROTEINSEQ = { UNIPROT, UNIPROTKB}; + public static final String[] PROTEINSTR = { PDB }; + public static final String[] DOMAINDBS = { PFAM }; + /** + * set of unique DBRefSource property constants. + * These could be used to reconstruct the above groupings + */ + public static final Object SEQDB = "SQ"; + /** + * database of nucleic acid sequences + */ + public static final Object DNASEQDB = "NASQ"; + /** + * database of amino acid sequences + */ + public static final Object PROTSEQDB = "PROTSQ"; + /** + * database of cDNA sequences + */ + public static final Object CODINGSEQDB = "CODING"; + /** + * database of na sequences with exon annotation + */ + public static final Object DNACODINGSEQDB = "XONCODING"; + /** + * DB returns several sequences associated with a protein domain + */ + public static final Object DOMAINDB = "DOMAIN"; + /** + * DB query can take multiple accession codes concatenated + * by a separator. Value of property indicates maximum number of accession codes to send at a time. + */ + public static final Object MULTIACC = "MULTIACC"; +} diff --git a/src/jalview/datamodel/FeatureProperties.java b/src/jalview/datamodel/FeatureProperties.java index d81a31c..e5c56b9 100644 --- a/src/jalview/datamodel/FeatureProperties.java +++ b/src/jalview/datamodel/FeatureProperties.java @@ -1,3 +1,21 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ package jalview.datamodel; /** diff --git a/src/jalview/datamodel/GraphLine.java b/src/jalview/datamodel/GraphLine.java index 77b7ef5..7791ead 100755 --- a/src/jalview/datamodel/GraphLine.java +++ b/src/jalview/datamodel/GraphLine.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/datamodel/HiddenSequences.java b/src/jalview/datamodel/HiddenSequences.java index 21dcce1..d64e8e0 100755 --- a/src/jalview/datamodel/HiddenSequences.java +++ b/src/jalview/datamodel/HiddenSequences.java @@ -1,22 +1,21 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.datamodel; import java.util.*; diff --git a/src/jalview/datamodel/Mapping.java b/src/jalview/datamodel/Mapping.java index 835400e..7440fd0 100644 --- a/src/jalview/datamodel/Mapping.java +++ b/src/jalview/datamodel/Mapping.java @@ -1,3 +1,21 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ package jalview.datamodel; import java.util.Vector; diff --git a/src/jalview/datamodel/PDBEntry.java b/src/jalview/datamodel/PDBEntry.java index 69f0d68..5c98874 100755 --- a/src/jalview/datamodel/PDBEntry.java +++ b/src/jalview/datamodel/PDBEntry.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/datamodel/Provenance.java b/src/jalview/datamodel/Provenance.java index f8afedf..46e4fe3 100755 --- a/src/jalview/datamodel/Provenance.java +++ b/src/jalview/datamodel/Provenance.java @@ -1,47 +1,47 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.datamodel; - -import java.util.*; - -public class Provenance -{ - Vector entries = new Vector(); - public Provenance() - { - - } - - public ProvenanceEntry[] getEntries() - { - ProvenanceEntry[] ret = new ProvenanceEntry[entries.size()]; - for (int i = 0; i < entries.size(); i++) - { - ret[i] = (ProvenanceEntry) entries.elementAt(i); - } - return ret; - } - - public void addEntry(String user, String action, java.util.Date date, - String id) - { - entries.addElement(new ProvenanceEntry(user, action, date, id)); - } - -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.datamodel; + +import java.util.*; + +public class Provenance +{ + Vector entries = new Vector(); + public Provenance() + { + + } + + public ProvenanceEntry[] getEntries() + { + ProvenanceEntry[] ret = new ProvenanceEntry[entries.size()]; + for (int i = 0; i < entries.size(); i++) + { + ret[i] = (ProvenanceEntry) entries.elementAt(i); + } + return ret; + } + + public void addEntry(String user, String action, java.util.Date date, + String id) + { + entries.addElement(new ProvenanceEntry(user, action, date, id)); + } + +} diff --git a/src/jalview/datamodel/ProvenanceEntry.java b/src/jalview/datamodel/ProvenanceEntry.java index b08dd6d..de3b2d5 100755 --- a/src/jalview/datamodel/ProvenanceEntry.java +++ b/src/jalview/datamodel/ProvenanceEntry.java @@ -1,52 +1,52 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.datamodel; - -public class ProvenanceEntry -{ - String user, action, id; - java.util.Date date; - public ProvenanceEntry(String u, String a, java.util.Date d, String i) - { - user = u; - action = a; - date = d; - id = i; - } - - public String getUser() - { - return user; - } - - public String getAction() - { - return action; - } - - public java.util.Date getDate() - { - return date; - } - - public String getID() - { - return id; - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.datamodel; + +public class ProvenanceEntry +{ + String user, action, id; + java.util.Date date; + public ProvenanceEntry(String u, String a, java.util.Date d, String i) + { + user = u; + action = a; + date = d; + id = i; + } + + public String getUser() + { + return user; + } + + public String getAction() + { + return action; + } + + public java.util.Date getDate() + { + return date; + } + + public String getID() + { + return id; + } +} diff --git a/src/jalview/datamodel/SearchResults.java b/src/jalview/datamodel/SearchResults.java index b9176b4..c5f8e6f 100755 --- a/src/jalview/datamodel/SearchResults.java +++ b/src/jalview/datamodel/SearchResults.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/datamodel/SeqCigar.java b/src/jalview/datamodel/SeqCigar.java index 9ed0388..da8fada 100644 --- a/src/jalview/datamodel/SeqCigar.java +++ b/src/jalview/datamodel/SeqCigar.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/datamodel/Sequence.java b/src/jalview/datamodel/Sequence.java index 56a829c..53dffbf 100755 --- a/src/jalview/datamodel/Sequence.java +++ b/src/jalview/datamodel/Sequence.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/datamodel/SequenceFeature.java b/src/jalview/datamodel/SequenceFeature.java index 1f34b8b..3e1c2b7 100755 --- a/src/jalview/datamodel/SequenceFeature.java +++ b/src/jalview/datamodel/SequenceFeature.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/datamodel/SequenceGroup.java b/src/jalview/datamodel/SequenceGroup.java index 6ded8bd..292f9e7 100755 --- a/src/jalview/datamodel/SequenceGroup.java +++ b/src/jalview/datamodel/SequenceGroup.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/datamodel/SequenceI.java b/src/jalview/datamodel/SequenceI.java index d9ffc81..b610bbe 100755 --- a/src/jalview/datamodel/SequenceI.java +++ b/src/jalview/datamodel/SequenceI.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/datamodel/SequenceNode.java b/src/jalview/datamodel/SequenceNode.java index ca09301..d847510 100755 --- a/src/jalview/datamodel/SequenceNode.java +++ b/src/jalview/datamodel/SequenceNode.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/datamodel/SequencePoint.java b/src/jalview/datamodel/SequencePoint.java index f105cc8..e2fb924 100755 --- a/src/jalview/datamodel/SequencePoint.java +++ b/src/jalview/datamodel/SequencePoint.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/datamodel/UniprotEntry.java b/src/jalview/datamodel/UniprotEntry.java index b963022..41e75d7 100755 --- a/src/jalview/datamodel/UniprotEntry.java +++ b/src/jalview/datamodel/UniprotEntry.java @@ -1,93 +1,93 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.datamodel; - -import java.util.*; - -public class UniprotEntry -{ - - UniprotSequence sequence; - Vector name; - Vector accession; - Vector feature; - Vector dbrefs; - UniprotProteinName protName; - - public void setAccession(Vector items) - { - accession = items; - } - - public void setFeature(Vector items) - { - feature = items; - } - - public Vector getFeature() - { - return feature; - } - - public Vector getAccession() - { - return accession; - } - - public void setProtein(UniprotProteinName names) - { - protName = names; - } - - public UniprotProteinName getProtein() - { - return protName; - } - - public void setName(Vector na) - { - name = na; - } - - public Vector getName() - { - return name; - } - - public UniprotSequence getUniprotSequence() - { - return sequence; - } - - public void setUniprotSequence(UniprotSequence seq) - { - sequence = seq; - } - - public Vector getDbReference() - { - return dbrefs; - } - - public void setDbReference(Vector dbref) - { - this.dbrefs = dbref; - } - -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.datamodel; + +import java.util.*; + +public class UniprotEntry +{ + + UniprotSequence sequence; + Vector name; + Vector accession; + Vector feature; + Vector dbrefs; + UniprotProteinName protName; + + public void setAccession(Vector items) + { + accession = items; + } + + public void setFeature(Vector items) + { + feature = items; + } + + public Vector getFeature() + { + return feature; + } + + public Vector getAccession() + { + return accession; + } + + public void setProtein(UniprotProteinName names) + { + protName = names; + } + + public UniprotProteinName getProtein() + { + return protName; + } + + public void setName(Vector na) + { + name = na; + } + + public Vector getName() + { + return name; + } + + public UniprotSequence getUniprotSequence() + { + return sequence; + } + + public void setUniprotSequence(UniprotSequence seq) + { + sequence = seq; + } + + public Vector getDbReference() + { + return dbrefs; + } + + public void setDbReference(Vector dbref) + { + this.dbrefs = dbref; + } + +} diff --git a/src/jalview/datamodel/UniprotFile.java b/src/jalview/datamodel/UniprotFile.java index b088ec2..6df0bad 100755 --- a/src/jalview/datamodel/UniprotFile.java +++ b/src/jalview/datamodel/UniprotFile.java @@ -1,36 +1,36 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.datamodel; - -import java.util.*; - -public class UniprotFile -{ - Vector _items; - - public void setUniprotEntries(Vector items) - { - _items = items; - } - - public Vector getUniprotEntries() - { - return _items; - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.datamodel; + +import java.util.*; + +public class UniprotFile +{ + Vector _items; + + public void setUniprotEntries(Vector items) + { + _items = items; + } + + public Vector getUniprotEntries() + { + return _items; + } +} diff --git a/src/jalview/datamodel/UniprotProteinName.java b/src/jalview/datamodel/UniprotProteinName.java index bb9a628..ebdf7d7 100755 --- a/src/jalview/datamodel/UniprotProteinName.java +++ b/src/jalview/datamodel/UniprotProteinName.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/datamodel/UniprotSequence.java b/src/jalview/datamodel/UniprotSequence.java index d5262e3..410f7b8 100755 --- a/src/jalview/datamodel/UniprotSequence.java +++ b/src/jalview/datamodel/UniprotSequence.java @@ -1,46 +1,46 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.datamodel; - -public class UniprotSequence -{ - /** - * internal content storage - */ - private java.lang.String _content = ""; - - public void setContent(String seq) - { - StringBuffer sb = new StringBuffer(); - for (int i = 0; i < seq.length(); i++) - { - if (seq.charAt(i) != ' ') - { - sb.append(seq.charAt(i)); - } - } - _content = sb.toString(); - } - - public String getContent() - { - return _content; - } - -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.datamodel; + +public class UniprotSequence +{ + /** + * internal content storage + */ + private java.lang.String _content = ""; + + public void setContent(String seq) + { + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < seq.length(); i++) + { + if (seq.charAt(i) != ' ') + { + sb.append(seq.charAt(i)); + } + } + _content = sb.toString(); + } + + public String getContent() + { + return _content; + } + +} diff --git a/src/jalview/datamodel/xdb/embl/BasePosition.java b/src/jalview/datamodel/xdb/embl/BasePosition.java index e0fe833..a0ff2e6 100644 --- a/src/jalview/datamodel/xdb/embl/BasePosition.java +++ b/src/jalview/datamodel/xdb/embl/BasePosition.java @@ -1,3 +1,21 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ package jalview.datamodel.xdb.embl; public class BasePosition { diff --git a/src/jalview/datamodel/xdb/embl/EmblEntry.java b/src/jalview/datamodel/xdb/embl/EmblEntry.java index d08ee0a..73ffeef 100644 --- a/src/jalview/datamodel/xdb/embl/EmblEntry.java +++ b/src/jalview/datamodel/xdb/embl/EmblEntry.java @@ -1,3 +1,21 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ package jalview.datamodel.xdb.embl; import jalview.datamodel.DBRefEntry; diff --git a/src/jalview/datamodel/xdb/embl/EmblError.java b/src/jalview/datamodel/xdb/embl/EmblError.java index 3db5eca..29b6e65 100644 --- a/src/jalview/datamodel/xdb/embl/EmblError.java +++ b/src/jalview/datamodel/xdb/embl/EmblError.java @@ -1,3 +1,21 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ package jalview.datamodel.xdb.embl; public class EmblError { diff --git a/src/jalview/datamodel/xdb/embl/EmblFeature.java b/src/jalview/datamodel/xdb/embl/EmblFeature.java index e2997fb..babc96d 100644 --- a/src/jalview/datamodel/xdb/embl/EmblFeature.java +++ b/src/jalview/datamodel/xdb/embl/EmblFeature.java @@ -1,3 +1,21 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ package jalview.datamodel.xdb.embl; import java.util.Hashtable; import java.util.Vector; diff --git a/src/jalview/datamodel/xdb/embl/EmblFeatureLocElement.java b/src/jalview/datamodel/xdb/embl/EmblFeatureLocElement.java index 09d27fe..9ac59e3 100644 --- a/src/jalview/datamodel/xdb/embl/EmblFeatureLocElement.java +++ b/src/jalview/datamodel/xdb/embl/EmblFeatureLocElement.java @@ -1,3 +1,21 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ package jalview.datamodel.xdb.embl; public class EmblFeatureLocElement { diff --git a/src/jalview/datamodel/xdb/embl/EmblFeatureLocations.java b/src/jalview/datamodel/xdb/embl/EmblFeatureLocations.java index 0341ec3..632ca21 100644 --- a/src/jalview/datamodel/xdb/embl/EmblFeatureLocations.java +++ b/src/jalview/datamodel/xdb/embl/EmblFeatureLocations.java @@ -1,3 +1,21 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ package jalview.datamodel.xdb.embl; import java.util.Enumeration; @@ -109,4 +127,4 @@ public class EmblFeatureLocations { } return se; } -} \ No newline at end of file +} diff --git a/src/jalview/datamodel/xdb/embl/EmblFile.java b/src/jalview/datamodel/xdb/embl/EmblFile.java index 691cbad..b731d4b 100644 --- a/src/jalview/datamodel/xdb/embl/EmblFile.java +++ b/src/jalview/datamodel/xdb/embl/EmblFile.java @@ -1,3 +1,21 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ package jalview.datamodel.xdb.embl; diff --git a/src/jalview/datamodel/xdb/embl/EmblSequence.java b/src/jalview/datamodel/xdb/embl/EmblSequence.java index c68bcc5..5501a00 100644 --- a/src/jalview/datamodel/xdb/embl/EmblSequence.java +++ b/src/jalview/datamodel/xdb/embl/EmblSequence.java @@ -1,3 +1,21 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ package jalview.datamodel.xdb.embl; public class EmblSequence { diff --git a/src/jalview/datamodel/xdb/embl/Qualifier.java b/src/jalview/datamodel/xdb/embl/Qualifier.java index 37a0239..f94f88c 100644 --- a/src/jalview/datamodel/xdb/embl/Qualifier.java +++ b/src/jalview/datamodel/xdb/embl/Qualifier.java @@ -1,3 +1,21 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ package jalview.datamodel.xdb.embl; public class Qualifier { diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 648f94c..1320aa0 100755 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -1,19 +1,19 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Softwarechang + * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ package jalview.gui; diff --git a/src/jalview/gui/AlignViewport.java b/src/jalview/gui/AlignViewport.java index f798671..96dfc1c 100755 --- a/src/jalview/gui/AlignViewport.java +++ b/src/jalview/gui/AlignViewport.java @@ -1,3 +1,21 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ /* * Jalview - A Sequence Alignment Editor and Viewer * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index 95b4220..d81de9b 100755 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/gui/AnnotationColourChooser.java b/src/jalview/gui/AnnotationColourChooser.java index 83a8a12..9ca5d66 100755 --- a/src/jalview/gui/AnnotationColourChooser.java +++ b/src/jalview/gui/AnnotationColourChooser.java @@ -1,517 +1,517 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.gui; - -import java.util.*; - -import java.awt.*; -import java.awt.event.*; -import javax.swing.*; -import javax.swing.event.*; - -import jalview.datamodel.*; -import jalview.schemes.*; -import java.awt.Dimension; - -public class AnnotationColourChooser - extends JPanel -{ - JInternalFrame frame; - AlignViewport av; - AlignmentPanel ap; - ColourSchemeI oldcs; - Hashtable oldgroupColours; - jalview.datamodel.AlignmentAnnotation currentAnnotation; - boolean adjusting = false; - - public AnnotationColourChooser(AlignViewport av, final AlignmentPanel ap) - { - oldcs = av.getGlobalColourScheme(); - if (av.alignment.getGroups() != null) - { - oldgroupColours = new Hashtable(); - Vector allGroups = ap.av.alignment.getGroups(); - SequenceGroup sg; - for (int g = 0; g < allGroups.size(); g++) - { - sg = (SequenceGroup) allGroups.get(g); - if (sg.cs != null) - { - oldgroupColours.put(sg, sg.cs); - } - } - } - this.av = av; - this.ap = ap; - frame = new JInternalFrame(); - frame.setContentPane(this); - frame.setLayer(JLayeredPane.PALETTE_LAYER); - Desktop.addInternalFrame(frame, "Colour by Annotation", 480, 145); - - - slider.addChangeListener(new ChangeListener() - { - public void stateChanged(ChangeEvent evt) - { - if (!adjusting) - { - thresholdValue.setText( ( (float) slider.getValue() / 1000f) + ""); - valueChanged(); - } - } - }); - slider.addMouseListener(new MouseAdapter() - { - public void mouseReleased(MouseEvent evt) - { - ap.paintAlignment(true); - } - }); - - if (av.alignment.getAlignmentAnnotation() == null) - { - return; - } - - if (oldcs instanceof AnnotationColourGradient) - { - AnnotationColourGradient acg = (AnnotationColourGradient) oldcs; - minColour.setBackground(acg.getMinColour()); - maxColour.setBackground(acg.getMaxColour()); - } - else - { - minColour.setBackground(Color.orange); - maxColour.setBackground(Color.red); - } - - adjusting = true; - Vector list = new Vector(); - int index = 1; - for (int i = 0; i < av.alignment.getAlignmentAnnotation().length; i++) - { - String label = av.alignment.getAlignmentAnnotation()[i].label; - if (!list.contains(label)) - list.addElement(label); - else - list.addElement(label+"_"+(index++)); - } - - annotations = new JComboBox(list); - - threshold.addItem("No Threshold"); - threshold.addItem("Above Threshold"); - threshold.addItem("Below Threshold"); - - try - { - jbInit(); - } - catch (Exception ex) - {} - - adjusting = false; - - changeColour(); - - } - - public AnnotationColourChooser() - { - try - { - jbInit(); - } - catch (Exception ex) - { - ex.printStackTrace(); - } - } - - private void jbInit() - throws Exception - { - minColour.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); - minColour.setBorder(BorderFactory.createEtchedBorder()); - minColour.setPreferredSize(new Dimension(40, 20)); - minColour.setToolTipText("Minimum Colour"); - minColour.addMouseListener(new MouseAdapter() - { - public void mousePressed(MouseEvent e) - { - if (minColour.isEnabled()) - { - minColour_actionPerformed(); - } - } - }); - maxColour.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); - maxColour.setBorder(BorderFactory.createEtchedBorder()); - maxColour.setPreferredSize(new Dimension(40, 20)); - maxColour.setToolTipText("Maximum Colour"); - maxColour.addMouseListener(new MouseAdapter() - { - public void mousePressed(MouseEvent e) - { - if (maxColour.isEnabled()) - { - maxColour_actionPerformed(); - } - } - }); - ok.setOpaque(false); - ok.setText("OK"); - ok.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - ok_actionPerformed(e); - } - }); - cancel.setOpaque(false); - cancel.setText("Cancel"); - cancel.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - cancel_actionPerformed(e); - } - }); - this.setLayout(borderLayout1); - jPanel2.setLayout(flowLayout1); - annotations.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - annotations_actionPerformed(e); - } - }); - jPanel1.setBackground(Color.white); - jPanel2.setBackground(Color.white); - threshold.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - threshold_actionPerformed(e); - } - }); - jPanel3.setLayout(flowLayout2); - thresholdValue.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - thresholdValue_actionPerformed(e); - } - }); - slider.setPaintLabels(false); - slider.setPaintTicks(true); - slider.setBackground(Color.white); - slider.setEnabled(false); - slider.setOpaque(false); - slider.setPreferredSize(new Dimension(100, 32)); - thresholdValue.setEnabled(false); - thresholdValue.setColumns(7); - jPanel3.setBackground(Color.white); - currentColours.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); - currentColours.setOpaque(false); - currentColours.setText("Use Original Colours"); - currentColours.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - currentColours_actionPerformed(e); - } - }); - thresholdIsMin.setBackground(Color.white); - thresholdIsMin.setText("Threshold is Min/Max"); - thresholdIsMin.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent actionEvent) - { - thresholdIsMin_actionPerformed(actionEvent); - } - }); - jPanel1.add(ok); - jPanel1.add(cancel); - jPanel2.add(annotations); - jPanel2.add(currentColours); - jPanel2.add(minColour); - jPanel2.add(maxColour); - this.add(jPanel3, java.awt.BorderLayout.CENTER); - jPanel3.add(threshold); - jPanel3.add(slider); - jPanel3.add(thresholdValue); - jPanel3.add(thresholdIsMin); - this.add(jPanel1, java.awt.BorderLayout.SOUTH); - this.add(jPanel2, java.awt.BorderLayout.NORTH); - } - - JComboBox annotations; - JPanel minColour = new JPanel(); - JPanel maxColour = new JPanel(); - JButton ok = new JButton(); - JButton cancel = new JButton(); - JPanel jPanel1 = new JPanel(); - JPanel jPanel2 = new JPanel(); - BorderLayout borderLayout1 = new BorderLayout(); - JComboBox threshold = new JComboBox(); - FlowLayout flowLayout1 = new FlowLayout(); - JPanel jPanel3 = new JPanel(); - FlowLayout flowLayout2 = new FlowLayout(); - JSlider slider = new JSlider(); - JTextField thresholdValue = new JTextField(20); - JCheckBox currentColours = new JCheckBox(); - JCheckBox thresholdIsMin = new JCheckBox(); - - public void minColour_actionPerformed() - { - Color col = JColorChooser.showDialog(this, - "Select Colour for Minimum Value", - minColour.getBackground()); - if (col != null) - { - minColour.setBackground(col); - } - minColour.repaint(); - changeColour(); - } - - public void maxColour_actionPerformed() - { - Color col = JColorChooser.showDialog(this, - "Select Colour for Maximum Value", - maxColour.getBackground()); - if (col != null) - { - maxColour.setBackground(col); - } - maxColour.repaint(); - changeColour(); - } - - void changeColour() - { - // Check if combobox is still adjusting - if (adjusting) - { - return; - } - - - currentAnnotation = av.alignment.getAlignmentAnnotation()[annotations.getSelectedIndex()]; - - int aboveThreshold = -1; - if (threshold.getSelectedItem().equals("Above Threshold")) - { - aboveThreshold = AnnotationColourGradient.ABOVE_THRESHOLD; - } - else if (threshold.getSelectedItem().equals("Below Threshold")) - { - aboveThreshold = AnnotationColourGradient.BELOW_THRESHOLD; - } - - slider.setEnabled(true); - thresholdValue.setEnabled(true); - - if (aboveThreshold == AnnotationColourGradient.NO_THRESHOLD) - { - slider.setEnabled(false); - thresholdValue.setEnabled(false); - thresholdValue.setText(""); - } - else if (aboveThreshold != AnnotationColourGradient.NO_THRESHOLD && - currentAnnotation.threshold == null) - { - currentAnnotation.setThreshold(new jalview.datamodel.GraphLine - ( (currentAnnotation.graphMax - - currentAnnotation.graphMin) / 2f, - "Threshold", - Color.black)); - } - - if (aboveThreshold != AnnotationColourGradient.NO_THRESHOLD) - { - adjusting = true; - float range = currentAnnotation.graphMax * 1000 - - currentAnnotation.graphMin * 1000; - - slider.setMinimum( (int) (currentAnnotation.graphMin * 1000)); - slider.setMaximum( (int) (currentAnnotation.graphMax * 1000)); - slider.setValue( (int) (currentAnnotation.threshold.value * 1000)); - thresholdValue.setText(currentAnnotation.threshold.value + ""); - slider.setMajorTickSpacing( (int) (range / 10f)); - slider.setEnabled(true); - thresholdValue.setEnabled(true); - adjusting = false; - } - - AnnotationColourGradient acg = null; - if (currentColours.isSelected()) - { - acg = new AnnotationColourGradient( - currentAnnotation, - av.getGlobalColourScheme(), aboveThreshold); - } - else - { - acg = - new AnnotationColourGradient( - currentAnnotation, - minColour.getBackground(), - maxColour.getBackground(), - aboveThreshold); - } - - if(currentAnnotation.graphMin==0f&& currentAnnotation.graphMax==0f) - { - acg.predefinedColours = true; - } - - acg.thresholdIsMinMax = thresholdIsMin.isSelected(); - - av.setGlobalColourScheme(acg); - - if (av.alignment.getGroups() != null) - { - Vector allGroups = ap.av.alignment.getGroups(); - SequenceGroup sg; - for (int g = 0; g < allGroups.size(); g++) - { - sg = (SequenceGroup) allGroups.get(g); - - if (sg.cs == null) - { - continue; - } - - if (currentColours.isSelected()) - { - sg.cs = new AnnotationColourGradient( - currentAnnotation, - sg.cs, aboveThreshold); - } - else - { - sg.cs = new AnnotationColourGradient( - currentAnnotation, - minColour.getBackground(), - maxColour.getBackground(), - aboveThreshold); - } - - } - } - - ap.paintAlignment(false); - } - - public void ok_actionPerformed(ActionEvent e) - { - changeColour(); - try - { - frame.setClosed(true); - } - catch (Exception ex) - {} - } - - public void cancel_actionPerformed(ActionEvent e) - { - reset(); - try - { - frame.setClosed(true); - } - catch (Exception ex) - {} - } - - void reset() - { - av.setGlobalColourScheme(oldcs); - if (av.alignment.getGroups() != null) - { - Vector allGroups = ap.av.alignment.getGroups(); - SequenceGroup sg; - for (int g = 0; g < allGroups.size(); g++) - { - sg = (SequenceGroup) allGroups.get(g); - sg.cs = (ColourSchemeI) oldgroupColours.get(sg); - } - } - } - - public void thresholdCheck_actionPerformed(ActionEvent e) - { - changeColour(); - } - - public void annotations_actionPerformed(ActionEvent e) - { - changeColour(); - } - - public void threshold_actionPerformed(ActionEvent e) - { - changeColour(); - } - - public void thresholdValue_actionPerformed(ActionEvent e) - { - try - { - float f = Float.parseFloat(thresholdValue.getText()); - slider.setValue( (int) (f * 1000)); - } - catch (NumberFormatException ex) - {} - } - - public void valueChanged() - { - if (currentColours.isSelected() - && ! (av.getGlobalColourScheme() instanceof AnnotationColourGradient)) - { - changeColour(); - } - - currentAnnotation.threshold.value = (float) slider.getValue() / 1000f; - ap.paintAlignment(false); - } - - public void currentColours_actionPerformed(ActionEvent e) - { - if (currentColours.isSelected()) - { - reset(); - } - - maxColour.setEnabled(!currentColours.isSelected()); - minColour.setEnabled(!currentColours.isSelected()); - - changeColour(); - } - - public void thresholdIsMin_actionPerformed(ActionEvent actionEvent) - { - changeColour(); - } - -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.gui; + +import java.util.*; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +import javax.swing.event.*; + +import jalview.datamodel.*; +import jalview.schemes.*; +import java.awt.Dimension; + +public class AnnotationColourChooser + extends JPanel +{ + JInternalFrame frame; + AlignViewport av; + AlignmentPanel ap; + ColourSchemeI oldcs; + Hashtable oldgroupColours; + jalview.datamodel.AlignmentAnnotation currentAnnotation; + boolean adjusting = false; + + public AnnotationColourChooser(AlignViewport av, final AlignmentPanel ap) + { + oldcs = av.getGlobalColourScheme(); + if (av.alignment.getGroups() != null) + { + oldgroupColours = new Hashtable(); + Vector allGroups = ap.av.alignment.getGroups(); + SequenceGroup sg; + for (int g = 0; g < allGroups.size(); g++) + { + sg = (SequenceGroup) allGroups.get(g); + if (sg.cs != null) + { + oldgroupColours.put(sg, sg.cs); + } + } + } + this.av = av; + this.ap = ap; + frame = new JInternalFrame(); + frame.setContentPane(this); + frame.setLayer(JLayeredPane.PALETTE_LAYER); + Desktop.addInternalFrame(frame, "Colour by Annotation", 480, 145); + + + slider.addChangeListener(new ChangeListener() + { + public void stateChanged(ChangeEvent evt) + { + if (!adjusting) + { + thresholdValue.setText( ( (float) slider.getValue() / 1000f) + ""); + valueChanged(); + } + } + }); + slider.addMouseListener(new MouseAdapter() + { + public void mouseReleased(MouseEvent evt) + { + ap.paintAlignment(true); + } + }); + + if (av.alignment.getAlignmentAnnotation() == null) + { + return; + } + + if (oldcs instanceof AnnotationColourGradient) + { + AnnotationColourGradient acg = (AnnotationColourGradient) oldcs; + minColour.setBackground(acg.getMinColour()); + maxColour.setBackground(acg.getMaxColour()); + } + else + { + minColour.setBackground(Color.orange); + maxColour.setBackground(Color.red); + } + + adjusting = true; + Vector list = new Vector(); + int index = 1; + for (int i = 0; i < av.alignment.getAlignmentAnnotation().length; i++) + { + String label = av.alignment.getAlignmentAnnotation()[i].label; + if (!list.contains(label)) + list.addElement(label); + else + list.addElement(label+"_"+(index++)); + } + + annotations = new JComboBox(list); + + threshold.addItem("No Threshold"); + threshold.addItem("Above Threshold"); + threshold.addItem("Below Threshold"); + + try + { + jbInit(); + } + catch (Exception ex) + {} + + adjusting = false; + + changeColour(); + + } + + public AnnotationColourChooser() + { + try + { + jbInit(); + } + catch (Exception ex) + { + ex.printStackTrace(); + } + } + + private void jbInit() + throws Exception + { + minColour.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); + minColour.setBorder(BorderFactory.createEtchedBorder()); + minColour.setPreferredSize(new Dimension(40, 20)); + minColour.setToolTipText("Minimum Colour"); + minColour.addMouseListener(new MouseAdapter() + { + public void mousePressed(MouseEvent e) + { + if (minColour.isEnabled()) + { + minColour_actionPerformed(); + } + } + }); + maxColour.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); + maxColour.setBorder(BorderFactory.createEtchedBorder()); + maxColour.setPreferredSize(new Dimension(40, 20)); + maxColour.setToolTipText("Maximum Colour"); + maxColour.addMouseListener(new MouseAdapter() + { + public void mousePressed(MouseEvent e) + { + if (maxColour.isEnabled()) + { + maxColour_actionPerformed(); + } + } + }); + ok.setOpaque(false); + ok.setText("OK"); + ok.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + ok_actionPerformed(e); + } + }); + cancel.setOpaque(false); + cancel.setText("Cancel"); + cancel.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + cancel_actionPerformed(e); + } + }); + this.setLayout(borderLayout1); + jPanel2.setLayout(flowLayout1); + annotations.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + annotations_actionPerformed(e); + } + }); + jPanel1.setBackground(Color.white); + jPanel2.setBackground(Color.white); + threshold.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + threshold_actionPerformed(e); + } + }); + jPanel3.setLayout(flowLayout2); + thresholdValue.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + thresholdValue_actionPerformed(e); + } + }); + slider.setPaintLabels(false); + slider.setPaintTicks(true); + slider.setBackground(Color.white); + slider.setEnabled(false); + slider.setOpaque(false); + slider.setPreferredSize(new Dimension(100, 32)); + thresholdValue.setEnabled(false); + thresholdValue.setColumns(7); + jPanel3.setBackground(Color.white); + currentColours.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); + currentColours.setOpaque(false); + currentColours.setText("Use Original Colours"); + currentColours.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + currentColours_actionPerformed(e); + } + }); + thresholdIsMin.setBackground(Color.white); + thresholdIsMin.setText("Threshold is Min/Max"); + thresholdIsMin.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent actionEvent) + { + thresholdIsMin_actionPerformed(actionEvent); + } + }); + jPanel1.add(ok); + jPanel1.add(cancel); + jPanel2.add(annotations); + jPanel2.add(currentColours); + jPanel2.add(minColour); + jPanel2.add(maxColour); + this.add(jPanel3, java.awt.BorderLayout.CENTER); + jPanel3.add(threshold); + jPanel3.add(slider); + jPanel3.add(thresholdValue); + jPanel3.add(thresholdIsMin); + this.add(jPanel1, java.awt.BorderLayout.SOUTH); + this.add(jPanel2, java.awt.BorderLayout.NORTH); + } + + JComboBox annotations; + JPanel minColour = new JPanel(); + JPanel maxColour = new JPanel(); + JButton ok = new JButton(); + JButton cancel = new JButton(); + JPanel jPanel1 = new JPanel(); + JPanel jPanel2 = new JPanel(); + BorderLayout borderLayout1 = new BorderLayout(); + JComboBox threshold = new JComboBox(); + FlowLayout flowLayout1 = new FlowLayout(); + JPanel jPanel3 = new JPanel(); + FlowLayout flowLayout2 = new FlowLayout(); + JSlider slider = new JSlider(); + JTextField thresholdValue = new JTextField(20); + JCheckBox currentColours = new JCheckBox(); + JCheckBox thresholdIsMin = new JCheckBox(); + + public void minColour_actionPerformed() + { + Color col = JColorChooser.showDialog(this, + "Select Colour for Minimum Value", + minColour.getBackground()); + if (col != null) + { + minColour.setBackground(col); + } + minColour.repaint(); + changeColour(); + } + + public void maxColour_actionPerformed() + { + Color col = JColorChooser.showDialog(this, + "Select Colour for Maximum Value", + maxColour.getBackground()); + if (col != null) + { + maxColour.setBackground(col); + } + maxColour.repaint(); + changeColour(); + } + + void changeColour() + { + // Check if combobox is still adjusting + if (adjusting) + { + return; + } + + + currentAnnotation = av.alignment.getAlignmentAnnotation()[annotations.getSelectedIndex()]; + + int aboveThreshold = -1; + if (threshold.getSelectedItem().equals("Above Threshold")) + { + aboveThreshold = AnnotationColourGradient.ABOVE_THRESHOLD; + } + else if (threshold.getSelectedItem().equals("Below Threshold")) + { + aboveThreshold = AnnotationColourGradient.BELOW_THRESHOLD; + } + + slider.setEnabled(true); + thresholdValue.setEnabled(true); + + if (aboveThreshold == AnnotationColourGradient.NO_THRESHOLD) + { + slider.setEnabled(false); + thresholdValue.setEnabled(false); + thresholdValue.setText(""); + } + else if (aboveThreshold != AnnotationColourGradient.NO_THRESHOLD && + currentAnnotation.threshold == null) + { + currentAnnotation.setThreshold(new jalview.datamodel.GraphLine + ( (currentAnnotation.graphMax - + currentAnnotation.graphMin) / 2f, + "Threshold", + Color.black)); + } + + if (aboveThreshold != AnnotationColourGradient.NO_THRESHOLD) + { + adjusting = true; + float range = currentAnnotation.graphMax * 1000 - + currentAnnotation.graphMin * 1000; + + slider.setMinimum( (int) (currentAnnotation.graphMin * 1000)); + slider.setMaximum( (int) (currentAnnotation.graphMax * 1000)); + slider.setValue( (int) (currentAnnotation.threshold.value * 1000)); + thresholdValue.setText(currentAnnotation.threshold.value + ""); + slider.setMajorTickSpacing( (int) (range / 10f)); + slider.setEnabled(true); + thresholdValue.setEnabled(true); + adjusting = false; + } + + AnnotationColourGradient acg = null; + if (currentColours.isSelected()) + { + acg = new AnnotationColourGradient( + currentAnnotation, + av.getGlobalColourScheme(), aboveThreshold); + } + else + { + acg = + new AnnotationColourGradient( + currentAnnotation, + minColour.getBackground(), + maxColour.getBackground(), + aboveThreshold); + } + + if(currentAnnotation.graphMin==0f&& currentAnnotation.graphMax==0f) + { + acg.predefinedColours = true; + } + + acg.thresholdIsMinMax = thresholdIsMin.isSelected(); + + av.setGlobalColourScheme(acg); + + if (av.alignment.getGroups() != null) + { + Vector allGroups = ap.av.alignment.getGroups(); + SequenceGroup sg; + for (int g = 0; g < allGroups.size(); g++) + { + sg = (SequenceGroup) allGroups.get(g); + + if (sg.cs == null) + { + continue; + } + + if (currentColours.isSelected()) + { + sg.cs = new AnnotationColourGradient( + currentAnnotation, + sg.cs, aboveThreshold); + } + else + { + sg.cs = new AnnotationColourGradient( + currentAnnotation, + minColour.getBackground(), + maxColour.getBackground(), + aboveThreshold); + } + + } + } + + ap.paintAlignment(false); + } + + public void ok_actionPerformed(ActionEvent e) + { + changeColour(); + try + { + frame.setClosed(true); + } + catch (Exception ex) + {} + } + + public void cancel_actionPerformed(ActionEvent e) + { + reset(); + try + { + frame.setClosed(true); + } + catch (Exception ex) + {} + } + + void reset() + { + av.setGlobalColourScheme(oldcs); + if (av.alignment.getGroups() != null) + { + Vector allGroups = ap.av.alignment.getGroups(); + SequenceGroup sg; + for (int g = 0; g < allGroups.size(); g++) + { + sg = (SequenceGroup) allGroups.get(g); + sg.cs = (ColourSchemeI) oldgroupColours.get(sg); + } + } + } + + public void thresholdCheck_actionPerformed(ActionEvent e) + { + changeColour(); + } + + public void annotations_actionPerformed(ActionEvent e) + { + changeColour(); + } + + public void threshold_actionPerformed(ActionEvent e) + { + changeColour(); + } + + public void thresholdValue_actionPerformed(ActionEvent e) + { + try + { + float f = Float.parseFloat(thresholdValue.getText()); + slider.setValue( (int) (f * 1000)); + } + catch (NumberFormatException ex) + {} + } + + public void valueChanged() + { + if (currentColours.isSelected() + && ! (av.getGlobalColourScheme() instanceof AnnotationColourGradient)) + { + changeColour(); + } + + currentAnnotation.threshold.value = (float) slider.getValue() / 1000f; + ap.paintAlignment(false); + } + + public void currentColours_actionPerformed(ActionEvent e) + { + if (currentColours.isSelected()) + { + reset(); + } + + maxColour.setEnabled(!currentColours.isSelected()); + minColour.setEnabled(!currentColours.isSelected()); + + changeColour(); + } + + public void thresholdIsMin_actionPerformed(ActionEvent actionEvent) + { + changeColour(); + } + +} diff --git a/src/jalview/gui/AnnotationExporter.java b/src/jalview/gui/AnnotationExporter.java index ab3f0d1..8354572 100755 --- a/src/jalview/gui/AnnotationExporter.java +++ b/src/jalview/gui/AnnotationExporter.java @@ -1,22 +1,21 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.gui; import java.util.*; diff --git a/src/jalview/gui/AnnotationLabels.java b/src/jalview/gui/AnnotationLabels.java index 2eda839..8c42790 100755 --- a/src/jalview/gui/AnnotationLabels.java +++ b/src/jalview/gui/AnnotationLabels.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/gui/AnnotationPanel.java b/src/jalview/gui/AnnotationPanel.java index 6371e86..410c84c 100755 --- a/src/jalview/gui/AnnotationPanel.java +++ b/src/jalview/gui/AnnotationPanel.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/gui/AppJmol.java b/src/jalview/gui/AppJmol.java index 50e5644..6454c59 100644 --- a/src/jalview/gui/AppJmol.java +++ b/src/jalview/gui/AppJmol.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/gui/CutAndPasteTransfer.java b/src/jalview/gui/CutAndPasteTransfer.java index a3fa7c7..4212ae8 100755 --- a/src/jalview/gui/CutAndPasteTransfer.java +++ b/src/jalview/gui/CutAndPasteTransfer.java @@ -1,265 +1,265 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.gui; - -import java.awt.*; -import java.awt.datatransfer.*; -import java.awt.event.*; -import javax.swing.*; - -import jalview.datamodel.*; -import jalview.io.*; -import jalview.jbgui.*; - -/** - * DOCUMENT ME! - * - * @author $author$ - * @version $Revision$ - */ -public class CutAndPasteTransfer - extends GCutAndPasteTransfer -{ - - AlignViewport viewport; - - public CutAndPasteTransfer() - { - SwingUtilities.invokeLater(new Runnable() - { - public void run() - { - textarea.requestFocus(); - } - }); - - } - - /** - * DOCUMENT ME! - */ - public void setForInput(AlignViewport viewport) - { - this.viewport = viewport; - if (viewport != null) - { - ok.setText("Add"); - } - - getContentPane().add(inputButtonPanel, java.awt.BorderLayout.SOUTH); - } - - /** - * DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public String getText() - { - return textarea.getText(); - } - - /** - * DOCUMENT ME! - * - * @param text DOCUMENT ME! - */ - public void setText(String text) - { - textarea.setText(text); - } - - public void appendText(String text) - { - textarea.append(text); - } - - public void save_actionPerformed(ActionEvent e) - { - JalviewFileChooser chooser = new JalviewFileChooser( - jalview.bin.Cache.getProperty( - "LAST_DIRECTORY")); - - chooser.setAcceptAllFileFilterUsed(false); - chooser.setFileView(new JalviewFileView()); - chooser.setDialogTitle("Save Text to File"); - chooser.setToolTipText("Save"); - - int value = chooser.showSaveDialog(this); - - if (value == JalviewFileChooser.APPROVE_OPTION) - { - try - { - java.io.PrintWriter out = new java.io.PrintWriter( - new java.io.FileWriter(chooser.getSelectedFile())); - - out.print(getText()); - out.close(); - } - catch (Exception ex) - { - ex.printStackTrace(); - } - - } - } - - /** - * DOCUMENT ME! - * - * @param e DOCUMENT ME! - */ - public void copyItem_actionPerformed(ActionEvent e) - { - textarea.getSelectedText(); - Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard(); - c.setContents(new StringSelection(textarea.getSelectedText()), null); - } - - /** - * DOCUMENT ME! - * - * @param e DOCUMENT ME! - */ - public void pasteMenu_actionPerformed(ActionEvent e) - { - Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard(); - Transferable contents = c.getContents(this); - - if (contents == null) - { - return; - } - - try - { - textarea.append( (String) contents.getTransferData( - DataFlavor.stringFlavor)); - } - catch (Exception ex) - { - } - } - - /** - * DOCUMENT ME! - * - * @param e DOCUMENT ME! - */ - public void ok_actionPerformed(ActionEvent e) - { - String format = new IdentifyFile().Identify(getText(), "Paste"); - Alignment al = null; - - if (FormatAdapter.isValidFormat(format)) - { - try - { - al = new FormatAdapter().readFile(getText(), "Paste", format); - } - catch (java.io.IOException ex) - { - JOptionPane.showInternalMessageDialog(Desktop.desktop, - "Couldn't read the pasted text.\n" + - ex.toString(), - "Error parsing text", - JOptionPane.WARNING_MESSAGE); - } - } - - if (al != null) - { - if (viewport != null) - { - for (int i = 0; i < al.getHeight(); i++) - { - viewport.getAlignment().addSequence(al.getSequenceAt(i)); - } - - viewport.firePropertyChange("alignment", null, - viewport.getAlignment().getSequences()); - } - else - { - AlignFrame af = new AlignFrame(al, - AlignFrame.DEFAULT_WIDTH, - AlignFrame.DEFAULT_HEIGHT); - af.currentFileFormat = format; - Desktop.addInternalFrame(af, "Cut & Paste input - " + format, - AlignFrame.DEFAULT_WIDTH, - AlignFrame.DEFAULT_HEIGHT); - af.statusBar.setText("Successfully pasted alignment file"); - - try - { - af.setMaximum(jalview.bin.Cache.getDefault("SHOW_FULLSCREEN", false)); - } - catch (Exception ex) - { - } - } - } - } - - /** - * DOCUMENT ME! - * - * @param e DOCUMENT ME! - */ - public void cancel_actionPerformed(ActionEvent e) - { - try - { - this.setClosed(true); - } - catch (Exception ex) - { - } - } - - public void textarea_mousePressed(MouseEvent e) - { - if (SwingUtilities.isRightMouseButton(e)) - { - JPopupMenu popup = new JPopupMenu("Edit"); - JMenuItem item = new JMenuItem("Copy"); - item.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - copyItem_actionPerformed(e); - } - }); - popup.add(item); - item = new JMenuItem("Paste"); - item.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - pasteMenu_actionPerformed(e); - } - }); - popup.add(item); - popup.show(this, e.getX() + 10, e.getY() + textarea.getY() + 40); - - } - } - -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.gui; + +import java.awt.*; +import java.awt.datatransfer.*; +import java.awt.event.*; +import javax.swing.*; + +import jalview.datamodel.*; +import jalview.io.*; +import jalview.jbgui.*; + +/** + * DOCUMENT ME! + * + * @author $author$ + * @version $Revision$ + */ +public class CutAndPasteTransfer + extends GCutAndPasteTransfer +{ + + AlignViewport viewport; + + public CutAndPasteTransfer() + { + SwingUtilities.invokeLater(new Runnable() + { + public void run() + { + textarea.requestFocus(); + } + }); + + } + + /** + * DOCUMENT ME! + */ + public void setForInput(AlignViewport viewport) + { + this.viewport = viewport; + if (viewport != null) + { + ok.setText("Add"); + } + + getContentPane().add(inputButtonPanel, java.awt.BorderLayout.SOUTH); + } + + /** + * DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public String getText() + { + return textarea.getText(); + } + + /** + * DOCUMENT ME! + * + * @param text DOCUMENT ME! + */ + public void setText(String text) + { + textarea.setText(text); + } + + public void appendText(String text) + { + textarea.append(text); + } + + public void save_actionPerformed(ActionEvent e) + { + JalviewFileChooser chooser = new JalviewFileChooser( + jalview.bin.Cache.getProperty( + "LAST_DIRECTORY")); + + chooser.setAcceptAllFileFilterUsed(false); + chooser.setFileView(new JalviewFileView()); + chooser.setDialogTitle("Save Text to File"); + chooser.setToolTipText("Save"); + + int value = chooser.showSaveDialog(this); + + if (value == JalviewFileChooser.APPROVE_OPTION) + { + try + { + java.io.PrintWriter out = new java.io.PrintWriter( + new java.io.FileWriter(chooser.getSelectedFile())); + + out.print(getText()); + out.close(); + } + catch (Exception ex) + { + ex.printStackTrace(); + } + + } + } + + /** + * DOCUMENT ME! + * + * @param e DOCUMENT ME! + */ + public void copyItem_actionPerformed(ActionEvent e) + { + textarea.getSelectedText(); + Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard(); + c.setContents(new StringSelection(textarea.getSelectedText()), null); + } + + /** + * DOCUMENT ME! + * + * @param e DOCUMENT ME! + */ + public void pasteMenu_actionPerformed(ActionEvent e) + { + Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard(); + Transferable contents = c.getContents(this); + + if (contents == null) + { + return; + } + + try + { + textarea.append( (String) contents.getTransferData( + DataFlavor.stringFlavor)); + } + catch (Exception ex) + { + } + } + + /** + * DOCUMENT ME! + * + * @param e DOCUMENT ME! + */ + public void ok_actionPerformed(ActionEvent e) + { + String format = new IdentifyFile().Identify(getText(), "Paste"); + Alignment al = null; + + if (FormatAdapter.isValidFormat(format)) + { + try + { + al = new FormatAdapter().readFile(getText(), "Paste", format); + } + catch (java.io.IOException ex) + { + JOptionPane.showInternalMessageDialog(Desktop.desktop, + "Couldn't read the pasted text.\n" + + ex.toString(), + "Error parsing text", + JOptionPane.WARNING_MESSAGE); + } + } + + if (al != null) + { + if (viewport != null) + { + for (int i = 0; i < al.getHeight(); i++) + { + viewport.getAlignment().addSequence(al.getSequenceAt(i)); + } + + viewport.firePropertyChange("alignment", null, + viewport.getAlignment().getSequences()); + } + else + { + AlignFrame af = new AlignFrame(al, + AlignFrame.DEFAULT_WIDTH, + AlignFrame.DEFAULT_HEIGHT); + af.currentFileFormat = format; + Desktop.addInternalFrame(af, "Cut & Paste input - " + format, + AlignFrame.DEFAULT_WIDTH, + AlignFrame.DEFAULT_HEIGHT); + af.statusBar.setText("Successfully pasted alignment file"); + + try + { + af.setMaximum(jalview.bin.Cache.getDefault("SHOW_FULLSCREEN", false)); + } + catch (Exception ex) + { + } + } + } + } + + /** + * DOCUMENT ME! + * + * @param e DOCUMENT ME! + */ + public void cancel_actionPerformed(ActionEvent e) + { + try + { + this.setClosed(true); + } + catch (Exception ex) + { + } + } + + public void textarea_mousePressed(MouseEvent e) + { + if (SwingUtilities.isRightMouseButton(e)) + { + JPopupMenu popup = new JPopupMenu("Edit"); + JMenuItem item = new JMenuItem("Copy"); + item.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + copyItem_actionPerformed(e); + } + }); + popup.add(item); + item = new JMenuItem("Paste"); + item.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + pasteMenu_actionPerformed(e); + } + }); + popup.add(item); + popup.show(this, e.getX() + 10, e.getY() + textarea.getY() + 40); + + } + } + +} diff --git a/src/jalview/gui/DasSourceBrowser.java b/src/jalview/gui/DasSourceBrowser.java index 807aa4b..91711dc 100755 --- a/src/jalview/gui/DasSourceBrowser.java +++ b/src/jalview/gui/DasSourceBrowser.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index 10687cd..310ec93 100755 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/gui/EPSOptions.java b/src/jalview/gui/EPSOptions.java index dc7b650..a3339c1 100755 --- a/src/jalview/gui/EPSOptions.java +++ b/src/jalview/gui/EPSOptions.java @@ -1,143 +1,143 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.gui; - -import java.awt.*; -import java.awt.event.*; -import javax.swing.*; - -public class EPSOptions - extends JPanel -{ - JDialog dialog; - public boolean cancelled = false; - String value; - - public EPSOptions() - { - try - { - jbInit(); - } - catch (Exception ex) - { - ex.printStackTrace(); - } - - ButtonGroup bg = new ButtonGroup(); - bg.add(lineart); - bg.add(text); - - JOptionPane pane = new JOptionPane(null, - JOptionPane.DEFAULT_OPTION, - JOptionPane.DEFAULT_OPTION, - null, new Object[] - {this}); - - dialog = pane.createDialog(Desktop.desktop, "EPS Rendering options"); - dialog.setVisible(true); - - } - - private void jbInit() - throws Exception - { - lineart.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); - lineart.setText("Lineart"); - text.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); - text.setText("Text"); - text.setSelected(true); - askAgain.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); - askAgain.setText("Don\'t ask me again"); - ok.setText("OK"); - ok.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - ok_actionPerformed(e); - } - }); - cancel.setText("Cancel"); - cancel.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - cancel_actionPerformed(e); - } - }); - jLabel1.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); - jLabel1.setText("Select EPS character rendering style"); - this.setLayout(borderLayout1); - jPanel3.setBorder(BorderFactory.createEtchedBorder()); - jPanel2.add(text); - jPanel2.add(lineart); - jPanel2.add(askAgain); - jPanel1.add(ok); - jPanel1.add(cancel); - jPanel3.add(jLabel1); - jPanel3.add(jPanel2); - this.add(jPanel3, java.awt.BorderLayout.CENTER); - this.add(jPanel1, java.awt.BorderLayout.SOUTH); - } - - JRadioButton lineart = new JRadioButton(); - JRadioButton text = new JRadioButton(); - JCheckBox askAgain = new JCheckBox(); - JButton ok = new JButton(); - JButton cancel = new JButton(); - JPanel jPanel1 = new JPanel(); - JLabel jLabel1 = new JLabel(); - JPanel jPanel2 = new JPanel(); - JPanel jPanel3 = new JPanel(); - BorderLayout borderLayout1 = new BorderLayout(); - - public void ok_actionPerformed(ActionEvent e) - { - if (lineart.isSelected()) - { - value = "Lineart"; - } - else - { - value = "Text"; - } - - if (!askAgain.isSelected()) - { - jalview.bin.Cache.applicationProperties.remove("EPS_RENDERING"); - } - else - { - jalview.bin.Cache.setProperty("EPS_RENDERING", value); - } - - dialog.setVisible(false); - } - - public void cancel_actionPerformed(ActionEvent e) - { - cancelled = true; - dialog.setVisible(false); - } - - public String getValue() - { - return value; - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.gui; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; + +public class EPSOptions + extends JPanel +{ + JDialog dialog; + public boolean cancelled = false; + String value; + + public EPSOptions() + { + try + { + jbInit(); + } + catch (Exception ex) + { + ex.printStackTrace(); + } + + ButtonGroup bg = new ButtonGroup(); + bg.add(lineart); + bg.add(text); + + JOptionPane pane = new JOptionPane(null, + JOptionPane.DEFAULT_OPTION, + JOptionPane.DEFAULT_OPTION, + null, new Object[] + {this}); + + dialog = pane.createDialog(Desktop.desktop, "EPS Rendering options"); + dialog.setVisible(true); + + } + + private void jbInit() + throws Exception + { + lineart.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); + lineart.setText("Lineart"); + text.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); + text.setText("Text"); + text.setSelected(true); + askAgain.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); + askAgain.setText("Don\'t ask me again"); + ok.setText("OK"); + ok.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + ok_actionPerformed(e); + } + }); + cancel.setText("Cancel"); + cancel.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + cancel_actionPerformed(e); + } + }); + jLabel1.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); + jLabel1.setText("Select EPS character rendering style"); + this.setLayout(borderLayout1); + jPanel3.setBorder(BorderFactory.createEtchedBorder()); + jPanel2.add(text); + jPanel2.add(lineart); + jPanel2.add(askAgain); + jPanel1.add(ok); + jPanel1.add(cancel); + jPanel3.add(jLabel1); + jPanel3.add(jPanel2); + this.add(jPanel3, java.awt.BorderLayout.CENTER); + this.add(jPanel1, java.awt.BorderLayout.SOUTH); + } + + JRadioButton lineart = new JRadioButton(); + JRadioButton text = new JRadioButton(); + JCheckBox askAgain = new JCheckBox(); + JButton ok = new JButton(); + JButton cancel = new JButton(); + JPanel jPanel1 = new JPanel(); + JLabel jLabel1 = new JLabel(); + JPanel jPanel2 = new JPanel(); + JPanel jPanel3 = new JPanel(); + BorderLayout borderLayout1 = new BorderLayout(); + + public void ok_actionPerformed(ActionEvent e) + { + if (lineart.isSelected()) + { + value = "Lineart"; + } + else + { + value = "Text"; + } + + if (!askAgain.isSelected()) + { + jalview.bin.Cache.applicationProperties.remove("EPS_RENDERING"); + } + else + { + jalview.bin.Cache.setProperty("EPS_RENDERING", value); + } + + dialog.setVisible(false); + } + + public void cancel_actionPerformed(ActionEvent e) + { + cancelled = true; + dialog.setVisible(false); + } + + public String getValue() + { + return value; + } +} diff --git a/src/jalview/gui/EditNameDialog.java b/src/jalview/gui/EditNameDialog.java index a3d2d47..10e329f 100644 --- a/src/jalview/gui/EditNameDialog.java +++ b/src/jalview/gui/EditNameDialog.java @@ -1,83 +1,82 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -package jalview.gui; - -import java.awt.*; -import javax.swing.*; - -public class EditNameDialog -{ - JTextField id, description; - JButton ok = new JButton("Accept"); - JButton cancel = new JButton("Cancel"); - boolean accept = false; - - public String getName() - { - return id.getText(); - } - - public String getDescription() - { - if (description.getText().length() < 1) - { - return null; - } - else - { - return description.getText(); - } - } - - public EditNameDialog(String name, - String desc, - String label1, - String label2, - String title) - { - JLabel idlabel = new JLabel(label1); - JLabel desclabel = new JLabel(label2); - idlabel.setFont(new Font("Courier", Font.PLAIN, 12)); - desclabel.setFont(new Font("Courier", Font.PLAIN, 12)); - id = new JTextField(name, 40); - description = new JTextField(desc, 40); - JPanel panel = new JPanel(new BorderLayout()); - JPanel panel2 = new JPanel(new BorderLayout()); - panel2.add(idlabel, BorderLayout.WEST); - panel2.add(id, BorderLayout.CENTER); - panel.add(panel2, BorderLayout.NORTH); - if(desc!=null || label2!=null) - { - panel2 = new JPanel(new BorderLayout()); - panel2.add(desclabel, BorderLayout.WEST); - panel2.add(description, BorderLayout.CENTER); - panel.add(panel2, BorderLayout.SOUTH); - } - - int reply = JOptionPane.showInternalConfirmDialog(Desktop.desktop, - panel, title, - JOptionPane.OK_CANCEL_OPTION); - - if (reply == JOptionPane.OK_OPTION) - { - accept = true; - } - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.gui; + +import java.awt.*; +import javax.swing.*; + +public class EditNameDialog +{ + JTextField id, description; + JButton ok = new JButton("Accept"); + JButton cancel = new JButton("Cancel"); + boolean accept = false; + + public String getName() + { + return id.getText(); + } + + public String getDescription() + { + if (description.getText().length() < 1) + { + return null; + } + else + { + return description.getText(); + } + } + + public EditNameDialog(String name, + String desc, + String label1, + String label2, + String title) + { + JLabel idlabel = new JLabel(label1); + JLabel desclabel = new JLabel(label2); + idlabel.setFont(new Font("Courier", Font.PLAIN, 12)); + desclabel.setFont(new Font("Courier", Font.PLAIN, 12)); + id = new JTextField(name, 40); + description = new JTextField(desc, 40); + JPanel panel = new JPanel(new BorderLayout()); + JPanel panel2 = new JPanel(new BorderLayout()); + panel2.add(idlabel, BorderLayout.WEST); + panel2.add(id, BorderLayout.CENTER); + panel.add(panel2, BorderLayout.NORTH); + if(desc!=null || label2!=null) + { + panel2 = new JPanel(new BorderLayout()); + panel2.add(desclabel, BorderLayout.WEST); + panel2.add(description, BorderLayout.CENTER); + panel.add(panel2, BorderLayout.SOUTH); + } + + int reply = JOptionPane.showInternalConfirmDialog(Desktop.desktop, + panel, title, + JOptionPane.OK_CANCEL_OPTION); + + if (reply == JOptionPane.OK_OPTION) + { + accept = true; + } + } +} diff --git a/src/jalview/gui/FeatureRenderer.java b/src/jalview/gui/FeatureRenderer.java index b643efb..fb0abd5 100755 --- a/src/jalview/gui/FeatureRenderer.java +++ b/src/jalview/gui/FeatureRenderer.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/gui/FeatureSettings.java b/src/jalview/gui/FeatureSettings.java index ea492e2..cd950ed 100755 --- a/src/jalview/gui/FeatureSettings.java +++ b/src/jalview/gui/FeatureSettings.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/gui/Finder.java b/src/jalview/gui/Finder.java index 5668b42..7d7ab0f 100755 --- a/src/jalview/gui/Finder.java +++ b/src/jalview/gui/Finder.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/gui/FontChooser.java b/src/jalview/gui/FontChooser.java index aaf0abc..5a4d219 100755 --- a/src/jalview/gui/FontChooser.java +++ b/src/jalview/gui/FontChooser.java @@ -1,259 +1,259 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.gui; - -import java.awt.*; -import java.awt.event.*; -import javax.swing.*; - -import jalview.bin.*; -import jalview.jbgui.*; - -/** - * DOCUMENT ME! - * - * @author $author$ - * @version $Revision$ - */ -public class FontChooser - extends GFontChooser -{ - AlignmentPanel ap; - TreePanel tp; - Font oldFont; - boolean init = true; - JInternalFrame frame; - - /** - * Creates a new FontChooser object. - * - * @param ap DOCUMENT ME! - */ - public FontChooser(TreePanel tp) - { - this.tp = tp; - ap = tp.treeCanvas.ap; - oldFont = tp.getTreeFont(); - defaultButton.setVisible(false); - smoothFont.setEnabled(false); - init(); - } - - /** - * Creates a new FontChooser object. - * - * @param ap DOCUMENT ME! - */ - public FontChooser(AlignmentPanel ap) - { - oldFont = ap.av.getFont(); - this.ap = ap; - init(); - } - - void init() - { - frame = new JInternalFrame(); - frame.setContentPane(this); - - smoothFont.setSelected(ap.av.antiAlias); - - if (tp != null) - { - Desktop.addInternalFrame(frame, "Change Font (Tree Panel)", 340, 170, false); - } - else - { - Desktop.addInternalFrame(frame, "Change Font", 340, 170, false); - } - - frame.setLayer(JLayeredPane.PALETTE_LAYER); - - String[] fonts = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment() - .getAvailableFontFamilyNames(); - - for (int i = 0; i < fonts.length; i++) - { - fontName.addItem(fonts[i]); - } - - for (int i = 1; i < 51; i++) - { - fontSize.addItem(i + ""); - } - - fontStyle.addItem("plain"); - fontStyle.addItem("bold"); - fontStyle.addItem("italic"); - - fontName.setSelectedItem(oldFont.getName()); - fontSize.setSelectedItem(oldFont.getSize() + ""); - fontStyle.setSelectedIndex(oldFont.getStyle()); - - FontMetrics fm = getGraphics().getFontMetrics(oldFont); - monospaced.setSelected(fm.getStringBounds("M", getGraphics()).getWidth() - == fm.getStringBounds("|", getGraphics()).getWidth()); - - init = false; - } - - public void smoothFont_actionPerformed(ActionEvent e) - { - ap.av.antiAlias = smoothFont.isSelected(); - ap.annotationPanel.image = null; - ap.paintAlignment(true); - } - - /** - * DOCUMENT ME! - * - * @param e DOCUMENT ME! - */ - protected void ok_actionPerformed(ActionEvent e) - { - try - { - frame.setClosed(true); - } - catch (Exception ex) - { - } - - if (ap != null) - { - if (ap.getOverviewPanel() != null) - { - ap.getOverviewPanel().updateOverviewImage(); - } - } - } - - /** - * DOCUMENT ME! - * - * @param e DOCUMENT ME! - */ - protected void cancel_actionPerformed(ActionEvent e) - { - if (ap != null) - { - ap.av.setFont(oldFont); - ap.paintAlignment(true); - } - else if (tp != null) - { - tp.setTreeFont(oldFont); - } - fontName.setSelectedItem(oldFont.getName()); - fontSize.setSelectedItem(oldFont.getSize() + ""); - fontStyle.setSelectedIndex(oldFont.getStyle()); - - try - { - frame.setClosed(true); - } - catch (Exception ex) - { - } - } - - /** - * DOCUMENT ME! - */ - void changeFont() - { - Font newFont = new Font(fontName.getSelectedItem().toString(), - fontStyle.getSelectedIndex(), - Integer.parseInt(fontSize.getSelectedItem(). - toString())); - if (tp != null) - { - tp.setTreeFont(newFont); - } - else if (ap != null) - { - ap.av.setFont(newFont); - ap.fontChanged(); - } - - FontMetrics fm = getGraphics().getFontMetrics(newFont); - - monospaced.setSelected(fm.getStringBounds("M", getGraphics()).getWidth() - == fm.getStringBounds("|", getGraphics()).getWidth()); - - } - - /** - * DOCUMENT ME! - * - * @param e DOCUMENT ME! - */ - protected void fontName_actionPerformed(ActionEvent e) - { - if (init) - { - return; - } - - changeFont(); - } - - /** - * DOCUMENT ME! - * - * @param e DOCUMENT ME! - */ - protected void fontSize_actionPerformed(ActionEvent e) - { - if (init) - { - return; - } - - changeFont(); - } - - /** - * DOCUMENT ME! - * - * @param e DOCUMENT ME! - */ - protected void fontStyle_actionPerformed(ActionEvent e) - { - if (init) - { - return; - } - - changeFont(); - } - - /** - * DOCUMENT ME! - * - * @param e DOCUMENT ME! - */ - public void defaultButton_actionPerformed(ActionEvent e) - { - Cache.setProperty("FONT_NAME", fontName.getSelectedItem().toString()); - Cache.setProperty("FONT_STYLE", fontStyle.getSelectedIndex() + ""); - Cache.setProperty("FONT_SIZE", fontSize.getSelectedItem().toString()); - Cache.setProperty("ANTI_ALIAS", Boolean.toString(smoothFont.isSelected())); - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.gui; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; + +import jalview.bin.*; +import jalview.jbgui.*; + +/** + * DOCUMENT ME! + * + * @author $author$ + * @version $Revision$ + */ +public class FontChooser + extends GFontChooser +{ + AlignmentPanel ap; + TreePanel tp; + Font oldFont; + boolean init = true; + JInternalFrame frame; + + /** + * Creates a new FontChooser object. + * + * @param ap DOCUMENT ME! + */ + public FontChooser(TreePanel tp) + { + this.tp = tp; + ap = tp.treeCanvas.ap; + oldFont = tp.getTreeFont(); + defaultButton.setVisible(false); + smoothFont.setEnabled(false); + init(); + } + + /** + * Creates a new FontChooser object. + * + * @param ap DOCUMENT ME! + */ + public FontChooser(AlignmentPanel ap) + { + oldFont = ap.av.getFont(); + this.ap = ap; + init(); + } + + void init() + { + frame = new JInternalFrame(); + frame.setContentPane(this); + + smoothFont.setSelected(ap.av.antiAlias); + + if (tp != null) + { + Desktop.addInternalFrame(frame, "Change Font (Tree Panel)", 340, 170, false); + } + else + { + Desktop.addInternalFrame(frame, "Change Font", 340, 170, false); + } + + frame.setLayer(JLayeredPane.PALETTE_LAYER); + + String[] fonts = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment() + .getAvailableFontFamilyNames(); + + for (int i = 0; i < fonts.length; i++) + { + fontName.addItem(fonts[i]); + } + + for (int i = 1; i < 51; i++) + { + fontSize.addItem(i + ""); + } + + fontStyle.addItem("plain"); + fontStyle.addItem("bold"); + fontStyle.addItem("italic"); + + fontName.setSelectedItem(oldFont.getName()); + fontSize.setSelectedItem(oldFont.getSize() + ""); + fontStyle.setSelectedIndex(oldFont.getStyle()); + + FontMetrics fm = getGraphics().getFontMetrics(oldFont); + monospaced.setSelected(fm.getStringBounds("M", getGraphics()).getWidth() + == fm.getStringBounds("|", getGraphics()).getWidth()); + + init = false; + } + + public void smoothFont_actionPerformed(ActionEvent e) + { + ap.av.antiAlias = smoothFont.isSelected(); + ap.annotationPanel.image = null; + ap.paintAlignment(true); + } + + /** + * DOCUMENT ME! + * + * @param e DOCUMENT ME! + */ + protected void ok_actionPerformed(ActionEvent e) + { + try + { + frame.setClosed(true); + } + catch (Exception ex) + { + } + + if (ap != null) + { + if (ap.getOverviewPanel() != null) + { + ap.getOverviewPanel().updateOverviewImage(); + } + } + } + + /** + * DOCUMENT ME! + * + * @param e DOCUMENT ME! + */ + protected void cancel_actionPerformed(ActionEvent e) + { + if (ap != null) + { + ap.av.setFont(oldFont); + ap.paintAlignment(true); + } + else if (tp != null) + { + tp.setTreeFont(oldFont); + } + fontName.setSelectedItem(oldFont.getName()); + fontSize.setSelectedItem(oldFont.getSize() + ""); + fontStyle.setSelectedIndex(oldFont.getStyle()); + + try + { + frame.setClosed(true); + } + catch (Exception ex) + { + } + } + + /** + * DOCUMENT ME! + */ + void changeFont() + { + Font newFont = new Font(fontName.getSelectedItem().toString(), + fontStyle.getSelectedIndex(), + Integer.parseInt(fontSize.getSelectedItem(). + toString())); + if (tp != null) + { + tp.setTreeFont(newFont); + } + else if (ap != null) + { + ap.av.setFont(newFont); + ap.fontChanged(); + } + + FontMetrics fm = getGraphics().getFontMetrics(newFont); + + monospaced.setSelected(fm.getStringBounds("M", getGraphics()).getWidth() + == fm.getStringBounds("|", getGraphics()).getWidth()); + + } + + /** + * DOCUMENT ME! + * + * @param e DOCUMENT ME! + */ + protected void fontName_actionPerformed(ActionEvent e) + { + if (init) + { + return; + } + + changeFont(); + } + + /** + * DOCUMENT ME! + * + * @param e DOCUMENT ME! + */ + protected void fontSize_actionPerformed(ActionEvent e) + { + if (init) + { + return; + } + + changeFont(); + } + + /** + * DOCUMENT ME! + * + * @param e DOCUMENT ME! + */ + protected void fontStyle_actionPerformed(ActionEvent e) + { + if (init) + { + return; + } + + changeFont(); + } + + /** + * DOCUMENT ME! + * + * @param e DOCUMENT ME! + */ + public void defaultButton_actionPerformed(ActionEvent e) + { + Cache.setProperty("FONT_NAME", fontName.getSelectedItem().toString()); + Cache.setProperty("FONT_STYLE", fontStyle.getSelectedIndex() + ""); + Cache.setProperty("FONT_SIZE", fontSize.getSelectedItem().toString()); + Cache.setProperty("ANTI_ALIAS", Boolean.toString(smoothFont.isSelected())); + } +} diff --git a/src/jalview/gui/IProgressIndicator.java b/src/jalview/gui/IProgressIndicator.java index 4acaba9..d88c05f 100644 --- a/src/jalview/gui/IProgressIndicator.java +++ b/src/jalview/gui/IProgressIndicator.java @@ -1,3 +1,21 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ package jalview.gui; /** @@ -15,4 +33,4 @@ public interface IProgressIndicator */ public abstract void setProgressBar(String message, long id); -} \ No newline at end of file +} diff --git a/src/jalview/gui/IdCanvas.java b/src/jalview/gui/IdCanvas.java index 97b8669..17e7683 100755 --- a/src/jalview/gui/IdCanvas.java +++ b/src/jalview/gui/IdCanvas.java @@ -1,477 +1,477 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.gui; - -import java.awt.*; -import java.awt.image.*; -import javax.swing.*; - -import jalview.datamodel.*; - -/** - * DOCUMENT ME! - * - * @author $author$ - * @version $Revision$ - */ -public class IdCanvas - extends JPanel -{ - protected AlignViewport av; - protected boolean showScores = true; - protected int maxIdLength = -1; - protected String maxIdStr = null; - BufferedImage image; - Graphics2D gg; - int imgHeight = 0; - boolean fastPaint = false; - java.util.Vector searchResults; - FontMetrics fm; - AnnotationLabels labels = null; - AnnotationPanel ap; - Font idfont; - - /** - * Creates a new IdCanvas object. - * - * @param av DOCUMENT ME! - */ - public IdCanvas(AlignViewport av) - { - setLayout(new BorderLayout()); - this.av = av; - PaintRefresher.Register(this, av.getSequenceSetId()); - } - - /** - * DOCUMENT ME! - * - * @param gg DOCUMENT ME! - * @param s DOCUMENT ME! - * @param i DOCUMENT ME! - * @param starty DOCUMENT ME! - * @param ypos DOCUMENT ME! - */ - public void drawIdString(Graphics2D gg, SequenceI s, int i, int starty, - int ypos) - { - int xPos = 0; - int panelWidth = getWidth(); - int charHeight = av.charHeight; - - if ( (searchResults != null) && searchResults.contains(s)) - { - gg.setColor(Color.black); - gg.fillRect(0, ( (i - starty) * charHeight) + ypos, getWidth(), - charHeight); - gg.setColor(Color.white); - } - else if ( (av.getSelectionGroup() != null) && - av.getSelectionGroup().getSequences(null).contains(s)) - { - gg.setColor(Color.lightGray); - gg.fillRect(0, ( (i - starty) * charHeight) + ypos, getWidth(), - charHeight); - gg.setColor(Color.white); - } - else - { - gg.setColor(av.getSequenceColour(s)); - gg.fillRect(0, ( (i - starty) * charHeight) + ypos, getWidth(), - charHeight); - gg.setColor(Color.black); - } - - if (av.rightAlignIds) - { - xPos = panelWidth - fm.stringWidth( - s.getDisplayId(av.getShowJVSuffix()) - ) - 4; - } - - gg.drawString(s.getDisplayId(av.getShowJVSuffix()), - xPos, - ( ( (i - starty + 1) * charHeight) + ypos) - (charHeight / 5)); - - if (av.hasHiddenRows && av.showHiddenMarkers) - { - drawMarker(i, starty, ypos); - } - - } - - /** - * DOCUMENT ME! - * - * @param vertical DOCUMENT ME! - */ - public void fastPaint(int vertical) - { - if (gg == null) - { - repaint(); - - return; - } - - gg.copyArea(0, 0, getWidth(), imgHeight, 0, -vertical * av.charHeight); - - int ss = av.startSeq; - int es = av.endSeq; - int transY = 0; - - if (vertical > 0) // scroll down - { - ss = es - vertical; - - if (ss < av.startSeq) - { // ie scrolling too fast, more than a page at a time - ss = av.startSeq; - } - else - { - transY = imgHeight - (vertical * av.charHeight); - } - } - else if (vertical < 0) - { - es = ss - vertical; - - if (es > av.endSeq) - { - es = av.endSeq; - } - } - - gg.translate(0, transY); - - drawIds(ss, es); - - gg.translate(0, -transY); - - fastPaint = true; - repaint(); - } - - /** - * DOCUMENT ME! - * - * @param g DOCUMENT ME! - */ - public void paintComponent(Graphics g) - { - g.setColor(Color.white); - g.fillRect(0, 0, getWidth(), getHeight()); - - if (fastPaint) - { - fastPaint = false; - g.drawImage(image, 0, 0, this); - - return; - } - - int oldHeight = imgHeight; - - imgHeight = getHeight(); - imgHeight -= (imgHeight % av.charHeight); - - if (imgHeight < 1) - { - return; - } - - if (oldHeight != imgHeight || image.getWidth(this) != getWidth()) - { - image = new BufferedImage(getWidth(), imgHeight, - BufferedImage.TYPE_INT_RGB); - } - - gg = (Graphics2D) image.getGraphics(); - - //Fill in the background - gg.setColor(Color.white); - gg.fillRect(0, 0, getWidth(), imgHeight); - - drawIds(av.getStartSeq(), av.endSeq); - - g.drawImage(image, 0, 0, this); - } - - /** - * DOCUMENT ME! - * - * @param starty DOCUMENT ME! - * @param endy DOCUMENT ME! - */ - void drawIds(int starty, int endy) - { - if (av.seqNameItalics) - { - idfont = new Font(av.getFont().getName(), Font.ITALIC, - av.getFont().getSize()); - } - else - { - idfont = av.getFont(); - } - - gg.setFont(idfont); - fm = gg.getFontMetrics(); - - if (av.antiAlias) - { - gg.setRenderingHint(RenderingHints.KEY_ANTIALIASING, - RenderingHints.VALUE_ANTIALIAS_ON); - } - - Color currentColor = Color.white; - Color currentTextColor = Color.black; - - if (av.getWrapAlignment()) - { - int maxwidth = av.alignment.getWidth(); - int alheight = av.alignment.getHeight(); - - if (av.hasHiddenColumns) - { - maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1; - } - - int annotationHeight = 0; - - if (av.showAnnotation) - { - if (ap == null) - { - ap = new AnnotationPanel(av); - } - - annotationHeight = ap.adjustPanelHeight(); - if (labels == null) - { - labels = new AnnotationLabels(av); - } - } - - int hgap = av.charHeight; - if (av.scaleAboveWrapped) - { - hgap += av.charHeight; - } - - int cHeight = alheight * av.charHeight - + hgap - + annotationHeight; - - int rowSize = av.getEndRes() - av.getStartRes(); - - // Draw the rest of the panels - for (int ypos = hgap, row = av.startRes; - (ypos <= getHeight()) && (row < maxwidth); - ypos += cHeight, row += rowSize) - { - for (int i = starty; i < alheight; i++) - { - SequenceI s = av.alignment.getSequenceAt(i); - if (av.hasHiddenRows) - { - setHiddenFont(s); - } - else - { - gg.setFont(idfont); - } - - drawIdString(gg, s, i, 0, ypos); - } - - if (labels != null && av.showAnnotation) - { - gg.translate(0, ypos + (alheight * av.charHeight)); - labels.drawComponent(gg, getWidth()); - gg.translate(0, -ypos - (alheight * av.charHeight)); - } - } - } - else - { - //No need to hang on to labels if we're not wrapped - labels = null; - - //Now draw the id strings - int panelWidth = getWidth(); - int xPos = 0; - - SequenceI sequence; - //Now draw the id strings - for (int i = starty; i < endy; i++) - { - sequence = av.alignment.getSequenceAt(i); - - if (sequence == null) - { - continue; - } - - if (av.hasHiddenRows) - { - setHiddenFont(sequence); - } - - // Selected sequence colours - if ( (searchResults != null) && - searchResults.contains(sequence)) - { - currentColor = Color.black; - currentTextColor = Color.white; - } - else if ( (av.getSelectionGroup() != null) && - av.getSelectionGroup().getSequences(null).contains( - sequence)) - { - currentColor = Color.lightGray; - currentTextColor = Color.black; - } - else - { - currentColor = av.getSequenceColour(sequence); - currentTextColor = Color.black; - } - - gg.setColor(currentColor); - - gg.fillRect(0, (i - starty) * av.charHeight, getWidth(), - av.charHeight); - - gg.setColor(currentTextColor); - - String string = sequence.getDisplayId(av.getShowJVSuffix()); - - if (av.rightAlignIds) - { - xPos = panelWidth - fm.stringWidth(string) - 4; - } - - gg.drawString(string, xPos, - ( ( (i - starty) * av.charHeight) + av.charHeight) - - (av.charHeight / 5)); - - if (av.hasHiddenRows && av.showHiddenMarkers) - { - drawMarker(i, starty, 0); - } - - } - - } - } - - void drawMarker(int i, int starty, int yoffset) - { - - SequenceI[] hseqs = av.alignment.getHiddenSequences().hiddenSequences; - //Use this method here instead of calling hiddenSeq adjust - //3 times. - int hSize = hseqs.length; - - int hiddenIndex = i; - int lastIndex = i - 1; - int nextIndex = i + 1; - - for (int j = 0; j < hSize; j++) - { - if (hseqs[j] != null) - { - if (j - 1 < hiddenIndex) - { - hiddenIndex++; - } - if (j - 1 < lastIndex) - { - lastIndex++; - } - if (j - 1 < nextIndex) - { - nextIndex++; - } - } - } - - boolean below = (hiddenIndex > lastIndex + 1); - boolean above = (nextIndex > hiddenIndex + 1); - - gg.setColor(Color.blue); - if (below) - { - gg.fillPolygon(new int[] - {getWidth() - av.charHeight, - getWidth() - av.charHeight, - getWidth()}, - new int[] - { - (i - starty) * av.charHeight + yoffset, - (i - starty) * av.charHeight + yoffset + av.charHeight / 4, - (i - starty) * av.charHeight + yoffset - }, 3); - } - if (above) - { - gg.fillPolygon(new int[] - {getWidth() - av.charHeight, - getWidth() - av.charHeight, - getWidth()}, - new int[] - { - (i - starty + 1) * av.charHeight + yoffset, - (i - starty + 1) * av.charHeight + yoffset - - av.charHeight / 4, - (i - starty + 1) * av.charHeight + yoffset - }, 3); - - } - } - - void setHiddenFont(SequenceI seq) - { - Font bold = new Font(av.getFont().getName(), Font.BOLD, - av.getFont().getSize()); - - if (av.hiddenRepSequences != null && - av.hiddenRepSequences.containsKey(seq)) - { - gg.setFont(bold); - } - else - { - gg.setFont(idfont); - } - } - - /** - * DOCUMENT ME! - * - * @param found DOCUMENT ME! - */ - public void setHighlighted(java.util.Vector found) - { - searchResults = found; - repaint(); - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.gui; + +import java.awt.*; +import java.awt.image.*; +import javax.swing.*; + +import jalview.datamodel.*; + +/** + * DOCUMENT ME! + * + * @author $author$ + * @version $Revision$ + */ +public class IdCanvas + extends JPanel +{ + protected AlignViewport av; + protected boolean showScores = true; + protected int maxIdLength = -1; + protected String maxIdStr = null; + BufferedImage image; + Graphics2D gg; + int imgHeight = 0; + boolean fastPaint = false; + java.util.Vector searchResults; + FontMetrics fm; + AnnotationLabels labels = null; + AnnotationPanel ap; + Font idfont; + + /** + * Creates a new IdCanvas object. + * + * @param av DOCUMENT ME! + */ + public IdCanvas(AlignViewport av) + { + setLayout(new BorderLayout()); + this.av = av; + PaintRefresher.Register(this, av.getSequenceSetId()); + } + + /** + * DOCUMENT ME! + * + * @param gg DOCUMENT ME! + * @param s DOCUMENT ME! + * @param i DOCUMENT ME! + * @param starty DOCUMENT ME! + * @param ypos DOCUMENT ME! + */ + public void drawIdString(Graphics2D gg, SequenceI s, int i, int starty, + int ypos) + { + int xPos = 0; + int panelWidth = getWidth(); + int charHeight = av.charHeight; + + if ( (searchResults != null) && searchResults.contains(s)) + { + gg.setColor(Color.black); + gg.fillRect(0, ( (i - starty) * charHeight) + ypos, getWidth(), + charHeight); + gg.setColor(Color.white); + } + else if ( (av.getSelectionGroup() != null) && + av.getSelectionGroup().getSequences(null).contains(s)) + { + gg.setColor(Color.lightGray); + gg.fillRect(0, ( (i - starty) * charHeight) + ypos, getWidth(), + charHeight); + gg.setColor(Color.white); + } + else + { + gg.setColor(av.getSequenceColour(s)); + gg.fillRect(0, ( (i - starty) * charHeight) + ypos, getWidth(), + charHeight); + gg.setColor(Color.black); + } + + if (av.rightAlignIds) + { + xPos = panelWidth - fm.stringWidth( + s.getDisplayId(av.getShowJVSuffix()) + ) - 4; + } + + gg.drawString(s.getDisplayId(av.getShowJVSuffix()), + xPos, + ( ( (i - starty + 1) * charHeight) + ypos) - (charHeight / 5)); + + if (av.hasHiddenRows && av.showHiddenMarkers) + { + drawMarker(i, starty, ypos); + } + + } + + /** + * DOCUMENT ME! + * + * @param vertical DOCUMENT ME! + */ + public void fastPaint(int vertical) + { + if (gg == null) + { + repaint(); + + return; + } + + gg.copyArea(0, 0, getWidth(), imgHeight, 0, -vertical * av.charHeight); + + int ss = av.startSeq; + int es = av.endSeq; + int transY = 0; + + if (vertical > 0) // scroll down + { + ss = es - vertical; + + if (ss < av.startSeq) + { // ie scrolling too fast, more than a page at a time + ss = av.startSeq; + } + else + { + transY = imgHeight - (vertical * av.charHeight); + } + } + else if (vertical < 0) + { + es = ss - vertical; + + if (es > av.endSeq) + { + es = av.endSeq; + } + } + + gg.translate(0, transY); + + drawIds(ss, es); + + gg.translate(0, -transY); + + fastPaint = true; + repaint(); + } + + /** + * DOCUMENT ME! + * + * @param g DOCUMENT ME! + */ + public void paintComponent(Graphics g) + { + g.setColor(Color.white); + g.fillRect(0, 0, getWidth(), getHeight()); + + if (fastPaint) + { + fastPaint = false; + g.drawImage(image, 0, 0, this); + + return; + } + + int oldHeight = imgHeight; + + imgHeight = getHeight(); + imgHeight -= (imgHeight % av.charHeight); + + if (imgHeight < 1) + { + return; + } + + if (oldHeight != imgHeight || image.getWidth(this) != getWidth()) + { + image = new BufferedImage(getWidth(), imgHeight, + BufferedImage.TYPE_INT_RGB); + } + + gg = (Graphics2D) image.getGraphics(); + + //Fill in the background + gg.setColor(Color.white); + gg.fillRect(0, 0, getWidth(), imgHeight); + + drawIds(av.getStartSeq(), av.endSeq); + + g.drawImage(image, 0, 0, this); + } + + /** + * DOCUMENT ME! + * + * @param starty DOCUMENT ME! + * @param endy DOCUMENT ME! + */ + void drawIds(int starty, int endy) + { + if (av.seqNameItalics) + { + idfont = new Font(av.getFont().getName(), Font.ITALIC, + av.getFont().getSize()); + } + else + { + idfont = av.getFont(); + } + + gg.setFont(idfont); + fm = gg.getFontMetrics(); + + if (av.antiAlias) + { + gg.setRenderingHint(RenderingHints.KEY_ANTIALIASING, + RenderingHints.VALUE_ANTIALIAS_ON); + } + + Color currentColor = Color.white; + Color currentTextColor = Color.black; + + if (av.getWrapAlignment()) + { + int maxwidth = av.alignment.getWidth(); + int alheight = av.alignment.getHeight(); + + if (av.hasHiddenColumns) + { + maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1; + } + + int annotationHeight = 0; + + if (av.showAnnotation) + { + if (ap == null) + { + ap = new AnnotationPanel(av); + } + + annotationHeight = ap.adjustPanelHeight(); + if (labels == null) + { + labels = new AnnotationLabels(av); + } + } + + int hgap = av.charHeight; + if (av.scaleAboveWrapped) + { + hgap += av.charHeight; + } + + int cHeight = alheight * av.charHeight + + hgap + + annotationHeight; + + int rowSize = av.getEndRes() - av.getStartRes(); + + // Draw the rest of the panels + for (int ypos = hgap, row = av.startRes; + (ypos <= getHeight()) && (row < maxwidth); + ypos += cHeight, row += rowSize) + { + for (int i = starty; i < alheight; i++) + { + SequenceI s = av.alignment.getSequenceAt(i); + if (av.hasHiddenRows) + { + setHiddenFont(s); + } + else + { + gg.setFont(idfont); + } + + drawIdString(gg, s, i, 0, ypos); + } + + if (labels != null && av.showAnnotation) + { + gg.translate(0, ypos + (alheight * av.charHeight)); + labels.drawComponent(gg, getWidth()); + gg.translate(0, -ypos - (alheight * av.charHeight)); + } + } + } + else + { + //No need to hang on to labels if we're not wrapped + labels = null; + + //Now draw the id strings + int panelWidth = getWidth(); + int xPos = 0; + + SequenceI sequence; + //Now draw the id strings + for (int i = starty; i < endy; i++) + { + sequence = av.alignment.getSequenceAt(i); + + if (sequence == null) + { + continue; + } + + if (av.hasHiddenRows) + { + setHiddenFont(sequence); + } + + // Selected sequence colours + if ( (searchResults != null) && + searchResults.contains(sequence)) + { + currentColor = Color.black; + currentTextColor = Color.white; + } + else if ( (av.getSelectionGroup() != null) && + av.getSelectionGroup().getSequences(null).contains( + sequence)) + { + currentColor = Color.lightGray; + currentTextColor = Color.black; + } + else + { + currentColor = av.getSequenceColour(sequence); + currentTextColor = Color.black; + } + + gg.setColor(currentColor); + + gg.fillRect(0, (i - starty) * av.charHeight, getWidth(), + av.charHeight); + + gg.setColor(currentTextColor); + + String string = sequence.getDisplayId(av.getShowJVSuffix()); + + if (av.rightAlignIds) + { + xPos = panelWidth - fm.stringWidth(string) - 4; + } + + gg.drawString(string, xPos, + ( ( (i - starty) * av.charHeight) + av.charHeight) - + (av.charHeight / 5)); + + if (av.hasHiddenRows && av.showHiddenMarkers) + { + drawMarker(i, starty, 0); + } + + } + + } + } + + void drawMarker(int i, int starty, int yoffset) + { + + SequenceI[] hseqs = av.alignment.getHiddenSequences().hiddenSequences; + //Use this method here instead of calling hiddenSeq adjust + //3 times. + int hSize = hseqs.length; + + int hiddenIndex = i; + int lastIndex = i - 1; + int nextIndex = i + 1; + + for (int j = 0; j < hSize; j++) + { + if (hseqs[j] != null) + { + if (j - 1 < hiddenIndex) + { + hiddenIndex++; + } + if (j - 1 < lastIndex) + { + lastIndex++; + } + if (j - 1 < nextIndex) + { + nextIndex++; + } + } + } + + boolean below = (hiddenIndex > lastIndex + 1); + boolean above = (nextIndex > hiddenIndex + 1); + + gg.setColor(Color.blue); + if (below) + { + gg.fillPolygon(new int[] + {getWidth() - av.charHeight, + getWidth() - av.charHeight, + getWidth()}, + new int[] + { + (i - starty) * av.charHeight + yoffset, + (i - starty) * av.charHeight + yoffset + av.charHeight / 4, + (i - starty) * av.charHeight + yoffset + }, 3); + } + if (above) + { + gg.fillPolygon(new int[] + {getWidth() - av.charHeight, + getWidth() - av.charHeight, + getWidth()}, + new int[] + { + (i - starty + 1) * av.charHeight + yoffset, + (i - starty + 1) * av.charHeight + yoffset - + av.charHeight / 4, + (i - starty + 1) * av.charHeight + yoffset + }, 3); + + } + } + + void setHiddenFont(SequenceI seq) + { + Font bold = new Font(av.getFont().getName(), Font.BOLD, + av.getFont().getSize()); + + if (av.hiddenRepSequences != null && + av.hiddenRepSequences.containsKey(seq)) + { + gg.setFont(bold); + } + else + { + gg.setFont(idfont); + } + } + + /** + * DOCUMENT ME! + * + * @param found DOCUMENT ME! + */ + public void setHighlighted(java.util.Vector found) + { + searchResults = found; + repaint(); + } +} diff --git a/src/jalview/gui/IdPanel.java b/src/jalview/gui/IdPanel.java index 4741974..a9c3f21 100755 --- a/src/jalview/gui/IdPanel.java +++ b/src/jalview/gui/IdPanel.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/gui/IdwidthAdjuster.java b/src/jalview/gui/IdwidthAdjuster.java index 1c7d215..47df3ae 100755 --- a/src/jalview/gui/IdwidthAdjuster.java +++ b/src/jalview/gui/IdwidthAdjuster.java @@ -1,161 +1,161 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.gui; - -import java.awt.*; -import java.awt.event.*; -import javax.swing.*; - -/** - * DOCUMENT ME! - * - * @author $author$ - * @version $Revision$ - */ -public class IdwidthAdjuster - extends JPanel implements MouseListener, - MouseMotionListener -{ - boolean active = false; - int oldX = 0; - Image image; - AlignmentPanel ap; - - /** - * Creates a new IdwidthAdjuster object. - * - * @param ap DOCUMENT ME! - */ - public IdwidthAdjuster(AlignmentPanel ap) - { - this.ap = ap; - - java.net.URL url = getClass().getResource("/images/idwidth.gif"); - - if (url != null) - { - image = java.awt.Toolkit.getDefaultToolkit().createImage(url); - } - - addMouseListener(this); - addMouseMotionListener(this); - } - - /** - * DOCUMENT ME! - * - * @param evt DOCUMENT ME! - */ - public void mousePressed(MouseEvent evt) - { - oldX = evt.getX(); - } - - /** - * DOCUMENT ME! - * - * @param evt DOCUMENT ME! - */ - public void mouseReleased(MouseEvent evt) - { - active = false; - repaint(); - } - - /** - * DOCUMENT ME! - * - * @param evt DOCUMENT ME! - */ - public void mouseEntered(MouseEvent evt) - { - active = true; - repaint(); - } - - /** - * DOCUMENT ME! - * - * @param evt DOCUMENT ME! - */ - public void mouseExited(MouseEvent evt) - { - active = false; - repaint(); - } - - /** - * DOCUMENT ME! - * - * @param evt DOCUMENT ME! - */ - public void mouseDragged(MouseEvent evt) - { - active = true; - - Dimension d = ap.idPanel.idCanvas.getPreferredSize(); - int dif = evt.getX() - oldX; - - if ( ( (d.width + dif) > 20) || (dif > 0)) - { - ap.idPanel.idCanvas.setPreferredSize(new Dimension(d.width + dif, - d.height)); - ap.paintAlignment(true); - } - - oldX = evt.getX(); - } - - /** - * DOCUMENT ME! - * - * @param evt DOCUMENT ME! - */ - public void mouseMoved(MouseEvent evt) - { - } - - /** - * DOCUMENT ME! - * - * @param evt DOCUMENT ME! - */ - public void mouseClicked(MouseEvent evt) - { - } - - /** - * DOCUMENT ME! - * - * @param g DOCUMENT ME! - */ - public void paintComponent(Graphics g) - { - g.setColor(Color.white); - g.fillRect(0, 0, getWidth(), getHeight()); - - if (active) - { - if (image != null) - { - g.drawImage(image, getWidth() - 20, 2, this); - } - } - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.gui; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; + +/** + * DOCUMENT ME! + * + * @author $author$ + * @version $Revision$ + */ +public class IdwidthAdjuster + extends JPanel implements MouseListener, + MouseMotionListener +{ + boolean active = false; + int oldX = 0; + Image image; + AlignmentPanel ap; + + /** + * Creates a new IdwidthAdjuster object. + * + * @param ap DOCUMENT ME! + */ + public IdwidthAdjuster(AlignmentPanel ap) + { + this.ap = ap; + + java.net.URL url = getClass().getResource("/images/idwidth.gif"); + + if (url != null) + { + image = java.awt.Toolkit.getDefaultToolkit().createImage(url); + } + + addMouseListener(this); + addMouseMotionListener(this); + } + + /** + * DOCUMENT ME! + * + * @param evt DOCUMENT ME! + */ + public void mousePressed(MouseEvent evt) + { + oldX = evt.getX(); + } + + /** + * DOCUMENT ME! + * + * @param evt DOCUMENT ME! + */ + public void mouseReleased(MouseEvent evt) + { + active = false; + repaint(); + } + + /** + * DOCUMENT ME! + * + * @param evt DOCUMENT ME! + */ + public void mouseEntered(MouseEvent evt) + { + active = true; + repaint(); + } + + /** + * DOCUMENT ME! + * + * @param evt DOCUMENT ME! + */ + public void mouseExited(MouseEvent evt) + { + active = false; + repaint(); + } + + /** + * DOCUMENT ME! + * + * @param evt DOCUMENT ME! + */ + public void mouseDragged(MouseEvent evt) + { + active = true; + + Dimension d = ap.idPanel.idCanvas.getPreferredSize(); + int dif = evt.getX() - oldX; + + if ( ( (d.width + dif) > 20) || (dif > 0)) + { + ap.idPanel.idCanvas.setPreferredSize(new Dimension(d.width + dif, + d.height)); + ap.paintAlignment(true); + } + + oldX = evt.getX(); + } + + /** + * DOCUMENT ME! + * + * @param evt DOCUMENT ME! + */ + public void mouseMoved(MouseEvent evt) + { + } + + /** + * DOCUMENT ME! + * + * @param evt DOCUMENT ME! + */ + public void mouseClicked(MouseEvent evt) + { + } + + /** + * DOCUMENT ME! + * + * @param g DOCUMENT ME! + */ + public void paintComponent(Graphics g) + { + g.setColor(Color.white); + g.fillRect(0, 0, getWidth(), getHeight()); + + if (active) + { + if (image != null) + { + g.drawImage(image, getWidth() - 20, 2, this); + } + } + } +} diff --git a/src/jalview/gui/Jalview2XML.java b/src/jalview/gui/Jalview2XML.java index ebf7aba..85b7f86 100755 --- a/src/jalview/gui/Jalview2XML.java +++ b/src/jalview/gui/Jalview2XML.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/gui/Jalview2XML_V1.java b/src/jalview/gui/Jalview2XML_V1.java index fe17dff..32b93db 100755 --- a/src/jalview/gui/Jalview2XML_V1.java +++ b/src/jalview/gui/Jalview2XML_V1.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/gui/OverviewPanel.java b/src/jalview/gui/OverviewPanel.java index 04e5f13..545e0cd 100755 --- a/src/jalview/gui/OverviewPanel.java +++ b/src/jalview/gui/OverviewPanel.java @@ -1,447 +1,447 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.gui; - -import java.awt.*; -import java.awt.event.*; -import java.awt.image.*; -import javax.swing.*; - -/** - * DOCUMENT ME! - * - * @author $author$ - * @version $Revision$ - */ -public class OverviewPanel - extends JPanel implements Runnable -{ - BufferedImage miniMe; - AlignViewport av; - AlignmentPanel ap; - float scalew = 1f; - float scaleh = 1f; - int width; - int sequencesHeight; - int graphHeight = 20; - int boxX = -1; - int boxY = -1; - int boxWidth = -1; - int boxHeight = -1; - boolean resizing = false; - - // Can set different properties in this seqCanvas than - // main visible SeqCanvas - SequenceRenderer sr; - FeatureRenderer fr; - - /** - * Creates a new OverviewPanel object. - * - * @param ap DOCUMENT ME! - */ - public OverviewPanel(AlignmentPanel ap) - { - this.av = ap.av; - this.ap = ap; - setLayout(null); - - sr = new SequenceRenderer(av); - sr.renderGaps = false; - sr.forOverview = true; - fr = new FeatureRenderer(ap); - - // scale the initial size of overviewpanel to shape of alignment - float initialScale = (float) av.alignment.getWidth() / - (float) av.alignment.getHeight(); - - if (av.conservation == null) - { - graphHeight = 0; - } - - if (av.alignment.getWidth() > av.alignment.getHeight()) - { - // wider - width = 400; - sequencesHeight = (int) (400f / initialScale); - if (sequencesHeight < 40) - { - sequencesHeight = 40; - } - } - else - { - // taller - width = (int) (400f * initialScale); - sequencesHeight = 300; - - if (width < 120) - { - width = 120; - } - } - - addComponentListener(new ComponentAdapter() - { - public void componentResized(ComponentEvent evt) - { - if ( (getWidth() != width) || - (getHeight() != (sequencesHeight + graphHeight))) - { - updateOverviewImage(); - } - } - }); - - addMouseMotionListener(new MouseMotionAdapter() - { - public void mouseDragged(MouseEvent evt) - { - if (!av.wrapAlignment) - { - boxX = evt.getX(); - boxY = evt.getY(); - checkValid(); - } - } - }); - - addMouseListener(new MouseAdapter() - { - public void mousePressed(MouseEvent evt) - { - if (!av.wrapAlignment) - { - boxX = evt.getX(); - boxY = evt.getY(); - checkValid(); - } - } - }); - - updateOverviewImage(); - } - - /** - * DOCUMENT ME! - */ - void checkValid() - { - if (boxY < 0) - { - boxY = 0; - } - - if (boxY > (sequencesHeight - boxHeight)) - { - boxY = sequencesHeight - boxHeight + 1; - } - - if (boxX < 0) - { - boxX = 0; - } - - if (boxX > (width - boxWidth)) - { - if (av.hasHiddenColumns) - { - //Try smallest possible box - boxWidth = (int) ( (av.endRes - av.startRes + 1) * - av.getCharWidth() * scalew); - } - boxX = width - boxWidth; - } - - int col = (int) (boxX / scalew / av.getCharWidth()); - int row = (int) (boxY / scaleh / av.getCharHeight()); - - if (av.hasHiddenColumns) - { - if (!av.getColumnSelection().isVisible(col)) - { - return; - } - - col = av.getColumnSelection().findColumnPosition(col); - } - - if (av.hasHiddenRows) - { - row = av.alignment.getHiddenSequences().findIndexWithoutHiddenSeqs(row); - } - - ap.setScrollValues(col, row); - - } - - /** - * DOCUMENT ME! - */ - public void updateOverviewImage() - { - if (resizing) - { - resizeAgain = true; - return; - } - - resizing = true; - - if ( (getWidth() > 0) && (getHeight() > 0)) - { - width = getWidth(); - sequencesHeight = getHeight() - graphHeight; - } - - setPreferredSize(new Dimension(width, sequencesHeight + graphHeight)); - - Thread thread = new Thread(this); - thread.start(); - repaint(); - } - - // This is set true if the user resizes whilst - // the overview is being calculated - boolean resizeAgain = false; - - /** - * DOCUMENT ME! - */ - public void run() - { - miniMe = null; - - if (av.showSequenceFeatures) - { - fr.transferSettings(ap.seqPanel.seqCanvas.getFeatureRenderer()); - } - - int alwidth = av.alignment.getWidth(); - int alheight = av.alignment.getHeight() - + av.alignment.getHiddenSequences().getSize(); - - setPreferredSize(new Dimension(width, sequencesHeight + graphHeight)); - - int fullsizeWidth = alwidth * av.getCharWidth(); - int fullsizeHeight = alheight * av.getCharHeight(); - - scalew = (float) width / (float) fullsizeWidth; - scaleh = (float) sequencesHeight / (float) fullsizeHeight; - - miniMe = new BufferedImage(width, sequencesHeight + graphHeight, - BufferedImage.TYPE_INT_RGB); - - Graphics mg = miniMe.getGraphics(); - mg.setColor(Color.orange); - mg.fillRect(0, 0, width, miniMe.getHeight()); - - float sampleCol = (float) alwidth / (float) width; - float sampleRow = (float) alheight / (float) sequencesHeight; - - int lastcol = -1, lastrow = -1; - int color = Color.white.getRGB(); - int row, col; - jalview.datamodel.SequenceI seq; - boolean hiddenRow = false; - for (row = 0; row < sequencesHeight; row++) - { - if ( (int) (row * sampleRow) == lastrow) - { - //No need to recalculate the colours, - //Just copy from the row above - for (col = 0; col < width; col++) - { - miniMe.setRGB(col, row, miniMe.getRGB(col, row - 1)); - } - continue; - } - - lastrow = (int) (row * sampleRow); - - hiddenRow = false; - if (av.hasHiddenRows) - { - seq = av.alignment.getHiddenSequences().getHiddenSequence(lastrow); - if (seq == null) - { - int index = - av.alignment.getHiddenSequences().findIndexWithoutHiddenSeqs( - lastrow); - - seq = av.alignment.getSequenceAt(index); - } - else - { - hiddenRow = true; - } - } - else - { - seq = av.alignment.getSequenceAt(lastrow); - } - - if (seq == null) - { - System.out.println(lastrow + " null"); - continue; - } - - for (col = 0; col < width; col++) - { - if ( (int) (col * sampleCol) == lastcol && - (int) (row * sampleRow) == lastrow) - { - miniMe.setRGB(col, row, color); - continue; - } - - lastcol = (int) (col * sampleCol); - - if (seq.getLength() > lastcol) - { - color = sr.getResidueBoxColour( - seq, lastcol).getRGB(); - - if (av.showSequenceFeatures) - { - color = fr.findFeatureColour(color, seq, lastcol); - } - } - else - { - color = -1; //White - } - - if (hiddenRow || - (av.hasHiddenColumns && !av.getColumnSelection().isVisible(lastcol))) - { - color = new Color(color).darker().darker().getRGB(); - } - - miniMe.setRGB(col, row, color); - - } - } - - if (av.conservation != null) - { - for (col = 0; col < width; col++) - { - lastcol = (int) (col * sampleCol); - { - mg.translate(col, sequencesHeight); - ap.annotationPanel.drawGraph(mg, av.conservation, - (int) (sampleCol) + 1, - graphHeight, - (int) (col * sampleCol), - (int) (col * sampleCol) + 1); - mg.translate( -col, -sequencesHeight); - } - } - } - System.gc(); - - resizing = false; - - setBoxPosition(); - - if (resizeAgain) - { - resizeAgain = false; - updateOverviewImage(); - } - } - - /** - * DOCUMENT ME! - */ - public void setBoxPosition() - { - int fullsizeWidth = av.alignment.getWidth() * av.getCharWidth(); - int fullsizeHeight = (av.alignment.getHeight() - + av.alignment.getHiddenSequences().getSize()) * - av.getCharHeight(); - - int startRes = av.getStartRes(); - int endRes = av.getEndRes(); - - if (av.hasHiddenColumns) - { - startRes = av.getColumnSelection().adjustForHiddenColumns(startRes); - endRes = av.getColumnSelection().adjustForHiddenColumns(endRes); - } - - int startSeq = av.startSeq; - int endSeq = av.endSeq; - - if (av.hasHiddenRows) - { - startSeq = - av.alignment.getHiddenSequences().adjustForHiddenSeqs(startSeq); - - endSeq = - av.alignment.getHiddenSequences().adjustForHiddenSeqs(endSeq); - - } - - scalew = (float) width / (float) fullsizeWidth; - scaleh = (float) sequencesHeight / (float) fullsizeHeight; - - boxX = (int) (startRes * av.getCharWidth() * scalew); - boxY = (int) (startSeq * av.getCharHeight() * scaleh); - - if (av.hasHiddenColumns) - { - boxWidth = (int) ( (endRes - startRes + 1) * av.getCharWidth() * scalew); - } - else - { - boxWidth = (int) ( (endRes - startRes + 1) * av.getCharWidth() * scalew); - } - - boxHeight = (int) ( (endSeq - startSeq) * av.getCharHeight() * scaleh); - - repaint(); - } - - /** - * DOCUMENT ME! - * - * @param g DOCUMENT ME! - */ - public void paintComponent(Graphics g) - { - if(resizing) - { - g.setColor(Color.white); - g.fillRect(0,0,getWidth(),getHeight()); - } - else if (miniMe != null) - { - g.drawImage(miniMe, 0, 0, this); - } - - g.setColor(Color.red); - g.drawRect(boxX, boxY, boxWidth, boxHeight); - g.drawRect(boxX + 1, boxY + 1, boxWidth - 2, boxHeight - 2); - - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.gui; + +import java.awt.*; +import java.awt.event.*; +import java.awt.image.*; +import javax.swing.*; + +/** + * DOCUMENT ME! + * + * @author $author$ + * @version $Revision$ + */ +public class OverviewPanel + extends JPanel implements Runnable +{ + BufferedImage miniMe; + AlignViewport av; + AlignmentPanel ap; + float scalew = 1f; + float scaleh = 1f; + int width; + int sequencesHeight; + int graphHeight = 20; + int boxX = -1; + int boxY = -1; + int boxWidth = -1; + int boxHeight = -1; + boolean resizing = false; + + // Can set different properties in this seqCanvas than + // main visible SeqCanvas + SequenceRenderer sr; + FeatureRenderer fr; + + /** + * Creates a new OverviewPanel object. + * + * @param ap DOCUMENT ME! + */ + public OverviewPanel(AlignmentPanel ap) + { + this.av = ap.av; + this.ap = ap; + setLayout(null); + + sr = new SequenceRenderer(av); + sr.renderGaps = false; + sr.forOverview = true; + fr = new FeatureRenderer(ap); + + // scale the initial size of overviewpanel to shape of alignment + float initialScale = (float) av.alignment.getWidth() / + (float) av.alignment.getHeight(); + + if (av.conservation == null) + { + graphHeight = 0; + } + + if (av.alignment.getWidth() > av.alignment.getHeight()) + { + // wider + width = 400; + sequencesHeight = (int) (400f / initialScale); + if (sequencesHeight < 40) + { + sequencesHeight = 40; + } + } + else + { + // taller + width = (int) (400f * initialScale); + sequencesHeight = 300; + + if (width < 120) + { + width = 120; + } + } + + addComponentListener(new ComponentAdapter() + { + public void componentResized(ComponentEvent evt) + { + if ( (getWidth() != width) || + (getHeight() != (sequencesHeight + graphHeight))) + { + updateOverviewImage(); + } + } + }); + + addMouseMotionListener(new MouseMotionAdapter() + { + public void mouseDragged(MouseEvent evt) + { + if (!av.wrapAlignment) + { + boxX = evt.getX(); + boxY = evt.getY(); + checkValid(); + } + } + }); + + addMouseListener(new MouseAdapter() + { + public void mousePressed(MouseEvent evt) + { + if (!av.wrapAlignment) + { + boxX = evt.getX(); + boxY = evt.getY(); + checkValid(); + } + } + }); + + updateOverviewImage(); + } + + /** + * DOCUMENT ME! + */ + void checkValid() + { + if (boxY < 0) + { + boxY = 0; + } + + if (boxY > (sequencesHeight - boxHeight)) + { + boxY = sequencesHeight - boxHeight + 1; + } + + if (boxX < 0) + { + boxX = 0; + } + + if (boxX > (width - boxWidth)) + { + if (av.hasHiddenColumns) + { + //Try smallest possible box + boxWidth = (int) ( (av.endRes - av.startRes + 1) * + av.getCharWidth() * scalew); + } + boxX = width - boxWidth; + } + + int col = (int) (boxX / scalew / av.getCharWidth()); + int row = (int) (boxY / scaleh / av.getCharHeight()); + + if (av.hasHiddenColumns) + { + if (!av.getColumnSelection().isVisible(col)) + { + return; + } + + col = av.getColumnSelection().findColumnPosition(col); + } + + if (av.hasHiddenRows) + { + row = av.alignment.getHiddenSequences().findIndexWithoutHiddenSeqs(row); + } + + ap.setScrollValues(col, row); + + } + + /** + * DOCUMENT ME! + */ + public void updateOverviewImage() + { + if (resizing) + { + resizeAgain = true; + return; + } + + resizing = true; + + if ( (getWidth() > 0) && (getHeight() > 0)) + { + width = getWidth(); + sequencesHeight = getHeight() - graphHeight; + } + + setPreferredSize(new Dimension(width, sequencesHeight + graphHeight)); + + Thread thread = new Thread(this); + thread.start(); + repaint(); + } + + // This is set true if the user resizes whilst + // the overview is being calculated + boolean resizeAgain = false; + + /** + * DOCUMENT ME! + */ + public void run() + { + miniMe = null; + + if (av.showSequenceFeatures) + { + fr.transferSettings(ap.seqPanel.seqCanvas.getFeatureRenderer()); + } + + int alwidth = av.alignment.getWidth(); + int alheight = av.alignment.getHeight() + + av.alignment.getHiddenSequences().getSize(); + + setPreferredSize(new Dimension(width, sequencesHeight + graphHeight)); + + int fullsizeWidth = alwidth * av.getCharWidth(); + int fullsizeHeight = alheight * av.getCharHeight(); + + scalew = (float) width / (float) fullsizeWidth; + scaleh = (float) sequencesHeight / (float) fullsizeHeight; + + miniMe = new BufferedImage(width, sequencesHeight + graphHeight, + BufferedImage.TYPE_INT_RGB); + + Graphics mg = miniMe.getGraphics(); + mg.setColor(Color.orange); + mg.fillRect(0, 0, width, miniMe.getHeight()); + + float sampleCol = (float) alwidth / (float) width; + float sampleRow = (float) alheight / (float) sequencesHeight; + + int lastcol = -1, lastrow = -1; + int color = Color.white.getRGB(); + int row, col; + jalview.datamodel.SequenceI seq; + boolean hiddenRow = false; + for (row = 0; row < sequencesHeight; row++) + { + if ( (int) (row * sampleRow) == lastrow) + { + //No need to recalculate the colours, + //Just copy from the row above + for (col = 0; col < width; col++) + { + miniMe.setRGB(col, row, miniMe.getRGB(col, row - 1)); + } + continue; + } + + lastrow = (int) (row * sampleRow); + + hiddenRow = false; + if (av.hasHiddenRows) + { + seq = av.alignment.getHiddenSequences().getHiddenSequence(lastrow); + if (seq == null) + { + int index = + av.alignment.getHiddenSequences().findIndexWithoutHiddenSeqs( + lastrow); + + seq = av.alignment.getSequenceAt(index); + } + else + { + hiddenRow = true; + } + } + else + { + seq = av.alignment.getSequenceAt(lastrow); + } + + if (seq == null) + { + System.out.println(lastrow + " null"); + continue; + } + + for (col = 0; col < width; col++) + { + if ( (int) (col * sampleCol) == lastcol && + (int) (row * sampleRow) == lastrow) + { + miniMe.setRGB(col, row, color); + continue; + } + + lastcol = (int) (col * sampleCol); + + if (seq.getLength() > lastcol) + { + color = sr.getResidueBoxColour( + seq, lastcol).getRGB(); + + if (av.showSequenceFeatures) + { + color = fr.findFeatureColour(color, seq, lastcol); + } + } + else + { + color = -1; //White + } + + if (hiddenRow || + (av.hasHiddenColumns && !av.getColumnSelection().isVisible(lastcol))) + { + color = new Color(color).darker().darker().getRGB(); + } + + miniMe.setRGB(col, row, color); + + } + } + + if (av.conservation != null) + { + for (col = 0; col < width; col++) + { + lastcol = (int) (col * sampleCol); + { + mg.translate(col, sequencesHeight); + ap.annotationPanel.drawGraph(mg, av.conservation, + (int) (sampleCol) + 1, + graphHeight, + (int) (col * sampleCol), + (int) (col * sampleCol) + 1); + mg.translate( -col, -sequencesHeight); + } + } + } + System.gc(); + + resizing = false; + + setBoxPosition(); + + if (resizeAgain) + { + resizeAgain = false; + updateOverviewImage(); + } + } + + /** + * DOCUMENT ME! + */ + public void setBoxPosition() + { + int fullsizeWidth = av.alignment.getWidth() * av.getCharWidth(); + int fullsizeHeight = (av.alignment.getHeight() + + av.alignment.getHiddenSequences().getSize()) * + av.getCharHeight(); + + int startRes = av.getStartRes(); + int endRes = av.getEndRes(); + + if (av.hasHiddenColumns) + { + startRes = av.getColumnSelection().adjustForHiddenColumns(startRes); + endRes = av.getColumnSelection().adjustForHiddenColumns(endRes); + } + + int startSeq = av.startSeq; + int endSeq = av.endSeq; + + if (av.hasHiddenRows) + { + startSeq = + av.alignment.getHiddenSequences().adjustForHiddenSeqs(startSeq); + + endSeq = + av.alignment.getHiddenSequences().adjustForHiddenSeqs(endSeq); + + } + + scalew = (float) width / (float) fullsizeWidth; + scaleh = (float) sequencesHeight / (float) fullsizeHeight; + + boxX = (int) (startRes * av.getCharWidth() * scalew); + boxY = (int) (startSeq * av.getCharHeight() * scaleh); + + if (av.hasHiddenColumns) + { + boxWidth = (int) ( (endRes - startRes + 1) * av.getCharWidth() * scalew); + } + else + { + boxWidth = (int) ( (endRes - startRes + 1) * av.getCharWidth() * scalew); + } + + boxHeight = (int) ( (endSeq - startSeq) * av.getCharHeight() * scaleh); + + repaint(); + } + + /** + * DOCUMENT ME! + * + * @param g DOCUMENT ME! + */ + public void paintComponent(Graphics g) + { + if(resizing) + { + g.setColor(Color.white); + g.fillRect(0,0,getWidth(),getHeight()); + } + else if (miniMe != null) + { + g.drawImage(miniMe, 0, 0, this); + } + + g.setColor(Color.red); + g.drawRect(boxX, boxY, boxWidth, boxHeight); + g.drawRect(boxX + 1, boxY + 1, boxWidth - 2, boxHeight - 2); + + } +} diff --git a/src/jalview/gui/PCAPanel.java b/src/jalview/gui/PCAPanel.java index 06f1b25..00d3105 100755 --- a/src/jalview/gui/PCAPanel.java +++ b/src/jalview/gui/PCAPanel.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/gui/PaintRefresher.java b/src/jalview/gui/PaintRefresher.java index c6d3b58..915e4aa 100755 --- a/src/jalview/gui/PaintRefresher.java +++ b/src/jalview/gui/PaintRefresher.java @@ -1,243 +1,243 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.gui; - -import java.util.*; - -import java.awt.*; - -import jalview.datamodel.*; - -/** - * DOCUMENT ME! - * - * @author $author$ - * @version $Revision$ - */ -public class PaintRefresher -{ - static Hashtable components; - - /** - * DOCUMENT ME! - * - * @param comp DOCUMENT ME! - * @param al DOCUMENT ME! - */ - public static void Register(Component comp, String seqSetId) - { - if (components == null) - { - components = new Hashtable(); - } - - if (components.containsKey(seqSetId)) - { - Vector comps = (Vector) components.get(seqSetId); - if (!comps.contains(comp)) - { - comps.addElement(comp); - } - } - else - { - Vector vcoms = new Vector(); - vcoms.addElement(comp); - components.put(seqSetId, vcoms); - } - } - - public static void RemoveComponent(Component comp) - { - if (components == null) - { - return; - } - - Enumeration en = components.keys(); - while (en.hasMoreElements()) - { - String id = en.nextElement().toString(); - Vector comps = (Vector) components.get(id); - comps.remove(comp); - if (comps.size() == 0) - { - components.remove(id); - } - } - } - - public static void Refresh(Component source, String id) - { - Refresh(source, id, false, false); - } - - public static void Refresh(Component source, - String id, - boolean alignmentChanged, - boolean validateSequences) - { - if (components == null) - { - return; - } - - Component comp; - Vector comps = (Vector) components.get(id); - - if (comps == null) - { - return; - } - - Enumeration e = comps.elements(); - while (e.hasMoreElements()) - { - comp = (Component) e.nextElement(); - - if (comp == source) - { - continue; - } - - if (validateSequences - && comp instanceof AlignmentPanel - && source instanceof AlignmentPanel) - { - validateSequences( ( (AlignmentPanel) source).av.alignment, - ( (AlignmentPanel) comp).av.alignment); - } - - if (comp instanceof AlignmentPanel && alignmentChanged) - { - ( (AlignmentPanel) comp).alignmentChanged(); - } - - comp.repaint(); - } - } - - static void validateSequences(AlignmentI source, AlignmentI comp) - { - SequenceI[] a1; - if (source.getHiddenSequences().getSize() > 0) - { - a1 = source.getHiddenSequences().getFullAlignment().getSequencesArray(); - } - else - { - a1 = source.getSequencesArray(); - } - - SequenceI[] a2; - if (comp.getHiddenSequences().getSize() > 0) - { - a2 = comp.getHiddenSequences().getFullAlignment().getSequencesArray(); - } - else - { - a2 = comp.getSequencesArray(); - } - - int i, iSize = a1.length, j, jSize = a2.length; - - if (iSize == jSize) - { - return; - } - - boolean exists = false; - for (i = 0; i < iSize; i++) - { - exists = false; - - for (j = 0; j < jSize; j++) - { - if (a2[j] == a1[i]) - { - exists = true; - break; - } - } - - if (!exists) - { - if (i < comp.getHeight()) - { - comp.getSequences().insertElementAt(a1[i], i); - } - else - { - comp.addSequence(a1[i]); - } - - if (comp.getHiddenSequences().getSize() > 0) - { - a2 = comp.getHiddenSequences().getFullAlignment().getSequencesArray(); - } - else - { - a2 = comp.getSequencesArray(); - } - - jSize = a2.length; - } - } - - iSize = a1.length; - jSize = a2.length; - - for (j = 0; j < jSize; j++) - { - exists = false; - for (i = 0; i < iSize; i++) - { - if (a2[j] == a1[i]) - { - exists = true; - break; - } - } - - if (!exists) - { - comp.deleteSequence(a2[j]); - } - } - } - - static AlignmentPanel[] getAssociatedPanels(String id) - { - Vector comps = (Vector) components.get(id); - Vector tmp = new Vector(); - int i, iSize = comps.size(); - for (i = 0; i < iSize; i++) - { - if (comps.elementAt(i) instanceof AlignmentPanel) - { - tmp.addElement( ( (AlignmentPanel) comps.elementAt(i))); - } - } - AlignmentPanel[] result = new AlignmentPanel[tmp.size()]; - tmp.toArray(result); - - return result; - } - -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.gui; + +import java.util.*; + +import java.awt.*; + +import jalview.datamodel.*; + +/** + * DOCUMENT ME! + * + * @author $author$ + * @version $Revision$ + */ +public class PaintRefresher +{ + static Hashtable components; + + /** + * DOCUMENT ME! + * + * @param comp DOCUMENT ME! + * @param al DOCUMENT ME! + */ + public static void Register(Component comp, String seqSetId) + { + if (components == null) + { + components = new Hashtable(); + } + + if (components.containsKey(seqSetId)) + { + Vector comps = (Vector) components.get(seqSetId); + if (!comps.contains(comp)) + { + comps.addElement(comp); + } + } + else + { + Vector vcoms = new Vector(); + vcoms.addElement(comp); + components.put(seqSetId, vcoms); + } + } + + public static void RemoveComponent(Component comp) + { + if (components == null) + { + return; + } + + Enumeration en = components.keys(); + while (en.hasMoreElements()) + { + String id = en.nextElement().toString(); + Vector comps = (Vector) components.get(id); + comps.remove(comp); + if (comps.size() == 0) + { + components.remove(id); + } + } + } + + public static void Refresh(Component source, String id) + { + Refresh(source, id, false, false); + } + + public static void Refresh(Component source, + String id, + boolean alignmentChanged, + boolean validateSequences) + { + if (components == null) + { + return; + } + + Component comp; + Vector comps = (Vector) components.get(id); + + if (comps == null) + { + return; + } + + Enumeration e = comps.elements(); + while (e.hasMoreElements()) + { + comp = (Component) e.nextElement(); + + if (comp == source) + { + continue; + } + + if (validateSequences + && comp instanceof AlignmentPanel + && source instanceof AlignmentPanel) + { + validateSequences( ( (AlignmentPanel) source).av.alignment, + ( (AlignmentPanel) comp).av.alignment); + } + + if (comp instanceof AlignmentPanel && alignmentChanged) + { + ( (AlignmentPanel) comp).alignmentChanged(); + } + + comp.repaint(); + } + } + + static void validateSequences(AlignmentI source, AlignmentI comp) + { + SequenceI[] a1; + if (source.getHiddenSequences().getSize() > 0) + { + a1 = source.getHiddenSequences().getFullAlignment().getSequencesArray(); + } + else + { + a1 = source.getSequencesArray(); + } + + SequenceI[] a2; + if (comp.getHiddenSequences().getSize() > 0) + { + a2 = comp.getHiddenSequences().getFullAlignment().getSequencesArray(); + } + else + { + a2 = comp.getSequencesArray(); + } + + int i, iSize = a1.length, j, jSize = a2.length; + + if (iSize == jSize) + { + return; + } + + boolean exists = false; + for (i = 0; i < iSize; i++) + { + exists = false; + + for (j = 0; j < jSize; j++) + { + if (a2[j] == a1[i]) + { + exists = true; + break; + } + } + + if (!exists) + { + if (i < comp.getHeight()) + { + comp.getSequences().insertElementAt(a1[i], i); + } + else + { + comp.addSequence(a1[i]); + } + + if (comp.getHiddenSequences().getSize() > 0) + { + a2 = comp.getHiddenSequences().getFullAlignment().getSequencesArray(); + } + else + { + a2 = comp.getSequencesArray(); + } + + jSize = a2.length; + } + } + + iSize = a1.length; + jSize = a2.length; + + for (j = 0; j < jSize; j++) + { + exists = false; + for (i = 0; i < iSize; i++) + { + if (a2[j] == a1[i]) + { + exists = true; + break; + } + } + + if (!exists) + { + comp.deleteSequence(a2[j]); + } + } + } + + static AlignmentPanel[] getAssociatedPanels(String id) + { + Vector comps = (Vector) components.get(id); + Vector tmp = new Vector(); + int i, iSize = comps.size(); + for (i = 0; i < iSize; i++) + { + if (comps.elementAt(i) instanceof AlignmentPanel) + { + tmp.addElement( ( (AlignmentPanel) comps.elementAt(i))); + } + } + AlignmentPanel[] result = new AlignmentPanel[tmp.size()]; + tmp.toArray(result); + + return result; + } + +} diff --git a/src/jalview/gui/PairwiseAlignPanel.java b/src/jalview/gui/PairwiseAlignPanel.java index 190dcb0..7347f0a 100755 --- a/src/jalview/gui/PairwiseAlignPanel.java +++ b/src/jalview/gui/PairwiseAlignPanel.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/gui/PopupMenu.java b/src/jalview/gui/PopupMenu.java index 056a983..ce71034 100755 --- a/src/jalview/gui/PopupMenu.java +++ b/src/jalview/gui/PopupMenu.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/gui/Preferences.java b/src/jalview/gui/Preferences.java index 7226283..ae23ba1 100755 --- a/src/jalview/gui/Preferences.java +++ b/src/jalview/gui/Preferences.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/gui/RedundancyPanel.java b/src/jalview/gui/RedundancyPanel.java index 1e51879..366922b 100755 --- a/src/jalview/gui/RedundancyPanel.java +++ b/src/jalview/gui/RedundancyPanel.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/gui/RotatableCanvas.java b/src/jalview/gui/RotatableCanvas.java index 32c4adc..feaabf6 100755 --- a/src/jalview/gui/RotatableCanvas.java +++ b/src/jalview/gui/RotatableCanvas.java @@ -1,769 +1,769 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.gui; - -import java.util.*; - -import java.awt.*; -import java.awt.event.*; -import javax.swing.*; - -import jalview.datamodel.*; -import jalview.math.*; - -/** - * DOCUMENT ME! - * - * @author $author$ - * @version $Revision$ - */ -public class RotatableCanvas - extends JPanel implements MouseListener, - MouseMotionListener, KeyListener -{ - RotatableMatrix idmat = new RotatableMatrix(3, 3); - RotatableMatrix objmat = new RotatableMatrix(3, 3); - RotatableMatrix rotmat = new RotatableMatrix(3, 3); - - //RubberbandRectangle rubberband; - boolean drawAxes = true; - int omx = 0; - int mx = 0; - int omy = 0; - int my = 0; - Image img; - Graphics ig; - Dimension prefsize; - float[] centre = new float[3]; - float[] width = new float[3]; - float[] max = new float[3]; - float[] min = new float[3]; - float maxwidth; - float scale; - int npoint; - Vector points; - float[][] orig; - float[][] axes; - int startx; - int starty; - int lastx; - int lasty; - int rectx1; - int recty1; - int rectx2; - int recty2; - float scalefactor = 1; - AlignViewport av; - AlignmentPanel ap; - boolean showLabels = false; - Color bgColour = Color.black; - boolean applyToAllViews = false; - - // Controller controller; - public RotatableCanvas(AlignmentPanel ap) - { - this.av = ap.av; - this.ap = ap; - - addMouseWheelListener(new MouseWheelListener() - { - public void mouseWheelMoved(MouseWheelEvent e) - { - if (e.getWheelRotation() > 0) - { - scale = (float) (scale * 1.1); - repaint(); - } - - else - { - scale = (float) (scale * 0.9); - repaint(); - } - } - }); - - } - - public void showLabels(boolean b) - { - showLabels = b; - repaint(); - } - - public void setPoints(Vector points, int npoint) - { - this.points = points; - this.npoint = npoint; - ToolTipManager.sharedInstance().registerComponent(this); - ToolTipManager.sharedInstance().setInitialDelay(0); - ToolTipManager.sharedInstance().setDismissDelay(10000); - - prefsize = getPreferredSize(); - orig = new float[npoint][3]; - - for (int i = 0; i < npoint; i++) - { - SequencePoint sp = (SequencePoint) points.elementAt(i); - - for (int j = 0; j < 3; j++) - { - orig[i][j] = sp.coord[j]; - } - } - - //Initialize the matrices to identity - for (int i = 0; i < 3; i++) - { - for (int j = 0; j < 3; j++) - { - if (i != j) - { - idmat.addElement(i, j, 0); - objmat.addElement(i, j, 0); - rotmat.addElement(i, j, 0); - } - else - { - idmat.addElement(i, j, 0); - objmat.addElement(i, j, 0); - rotmat.addElement(i, j, 0); - } - } - } - - axes = new float[3][3]; - initAxes(); - - findCentre(); - findWidth(); - - scale = findScale(); - - addMouseListener(this); - - addMouseMotionListener(this); - - } - - public void initAxes() - { - for (int i = 0; i < 3; i++) - { - for (int j = 0; j < 3; j++) - { - if (i != j) - { - axes[i][j] = 0; - } - else - { - axes[i][j] = 1; - } - } - } - } - - /** - * DOCUMENT ME! - */ - public void findWidth() - { - max = new float[3]; - min = new float[3]; - - max[0] = (float) - 1e30; - max[1] = (float) - 1e30; - max[2] = (float) - 1e30; - - min[0] = (float) 1e30; - min[1] = (float) 1e30; - min[2] = (float) 1e30; - - for (int i = 0; i < 3; i++) - { - for (int j = 0; j < npoint; j++) - { - SequencePoint sp = (SequencePoint) points.elementAt(j); - - if (sp.coord[i] >= max[i]) - { - max[i] = sp.coord[i]; - } - - if (sp.coord[i] <= min[i]) - { - min[i] = sp.coord[i]; - } - } - } - - // System.out.println("xmax " + max[0] + " min " + min[0]); - //System.out.println("ymax " + max[1] + " min " + min[1]); - //System.out.println("zmax " + max[2] + " min " + min[2]); - width[0] = Math.abs(max[0] - min[0]); - width[1] = Math.abs(max[1] - min[1]); - width[2] = Math.abs(max[2] - min[2]); - - maxwidth = width[0]; - - if (width[1] > width[0]) - { - maxwidth = width[1]; - } - - if (width[2] > width[1]) - { - maxwidth = width[2]; - } - - //System.out.println("Maxwidth = " + maxwidth); - } - - /** - * DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public float findScale() - { - int dim; - int width; - int height; - - if (getWidth() != 0) - { - width = getWidth(); - height = getHeight(); - } - else - { - width = prefsize.width; - height = prefsize.height; - } - - if (width < height) - { - dim = width; - } - else - { - dim = height; - } - - return (float) ( (dim * scalefactor) / (2 * maxwidth)); - } - - /** - * DOCUMENT ME! - */ - public void findCentre() - { - //Find centre coordinate - findWidth(); - - centre[0] = (max[0] + min[0]) / 2; - centre[1] = (max[1] + min[1]) / 2; - centre[2] = (max[2] + min[2]) / 2; - - // System.out.println("Centre x " + centre[0]); - //System.out.println("Centre y " + centre[1]); - //System.out.println("Centre z " + centre[2]); - } - - /** - * DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public Dimension getPreferredSize() - { - if (prefsize != null) - { - return prefsize; - } - else - { - return new Dimension(400, 400); - } - } - - /** - * DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public Dimension getMinimumSize() - { - return getPreferredSize(); - } - - /** - * DOCUMENT ME! - * - * @param g DOCUMENT ME! - */ - public void paintComponent(Graphics g1) - { - - Graphics2D g = (Graphics2D) g1; - - g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, - RenderingHints.VALUE_ANTIALIAS_ON); - if (points == null) - { - g.setFont(new Font("Verdana", Font.PLAIN, 18)); - g.drawString("Calculating PCA....", 20, getHeight() / 2); - } - else - { - //Only create the image at the beginning - - if ( (img == null) || (prefsize.width != getWidth()) || - (prefsize.height != getHeight())) - { - prefsize.width = getWidth(); - prefsize.height = getHeight(); - - scale = findScale(); - - // System.out.println("New scale = " + scale); - img = createImage(getWidth(), getHeight()); - ig = img.getGraphics(); - } - - drawBackground(ig, bgColour); - drawScene(ig); - - if (drawAxes == true) - { - drawAxes(ig); - } - - g.drawImage(img, 0, 0, this); - } - } - - /** - * DOCUMENT ME! - * - * @param g DOCUMENT ME! - */ - public void drawAxes(Graphics g) - { - - g.setColor(Color.yellow); - - 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))); - } - } - - /** - * DOCUMENT ME! - * - * @param g DOCUMENT ME! - * @param col DOCUMENT ME! - */ - public void drawBackground(Graphics g, Color col) - { - g.setColor(col); - g.fillRect(0, 0, prefsize.width, prefsize.height); - } - - /** - * DOCUMENT ME! - * - * @param g DOCUMENT ME! - */ - public void drawScene(Graphics g1) - { - - Graphics2D g = (Graphics2D) g1; - - g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, - RenderingHints.VALUE_ANTIALIAS_ON); - - int halfwidth = getWidth() / 2; - int halfheight = getHeight() / 2; - - for (int i = 0; i < npoint; i++) - { - SequencePoint sp = (SequencePoint) points.elementAt(i); - int x = (int) ( (float) (sp.coord[0] - centre[0]) * scale) + - halfwidth; - int y = (int) ( (float) (sp.coord[1] - centre[1]) * scale) + - halfheight; - float z = sp.coord[1] - centre[2]; - - if (av.getSequenceColour(sp.sequence) == Color.black) - { - g.setColor(Color.white); - } - else - { - g.setColor(av.getSequenceColour(sp.sequence)); - } - - if (av.getSelectionGroup() != null) - { - if (av.getSelectionGroup().getSequences(null).contains( - ( (SequencePoint) points.elementAt(i)).sequence)) - { - g.setColor(Color.gray); - } - } - - if (z < 0) - { - g.setColor(g.getColor().darker()); - } - - g.fillRect(x - 3, y - 3, 6, 6); - if (showLabels) - { - g.setColor(Color.red); - g.drawString( ( (SequencePoint) points.elementAt(i)).sequence. - getName(), - x - 3, y - 4); - } - } - - // //Now the rectangle - // if (rectx2 != -1 && recty2 != -1) { - // g.setColor(Color.white); - // - // g.drawRect(rectx1,recty1,rectx2-rectx1,recty2-recty1); - // } - } - - /** - * DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public Dimension minimumsize() - { - return prefsize; - } - - /** - * DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public Dimension preferredsize() - { - return prefsize; - } - - /** - * DOCUMENT ME! - * - * @param evt DOCUMENT ME! - */ - public void keyTyped(KeyEvent evt) - { - } - - /** - * DOCUMENT ME! - * - * @param evt DOCUMENT ME! - */ - public void keyReleased(KeyEvent evt) - { - } - - /** - * DOCUMENT ME! - * - * @param evt DOCUMENT ME! - */ - public void keyPressed(KeyEvent evt) - { - if (evt.getKeyCode() == KeyEvent.VK_UP) - { - scalefactor = (float) (scalefactor * 1.1); - scale = findScale(); - } - else if (evt.getKeyCode() == KeyEvent.VK_DOWN) - { - scalefactor = (float) (scalefactor * 0.9); - scale = findScale(); - } - else if (evt.getKeyChar() == 's') - { - System.err.println("DEBUG: Rectangle selection"); // log.debug - - if ( (rectx2 != -1) && (recty2 != -1)) - { - rectSelect(rectx1, recty1, rectx2, recty2); - } - } - - repaint(); - } - - /** - * DOCUMENT ME! - * - * @param evt DOCUMENT ME! - */ - public void mouseClicked(MouseEvent evt) - { - } - - /** - * DOCUMENT ME! - * - * @param evt DOCUMENT ME! - */ - public void mouseEntered(MouseEvent evt) - { - } - - /** - * DOCUMENT ME! - * - * @param evt DOCUMENT ME! - */ - public void mouseExited(MouseEvent evt) - { - } - - /** - * DOCUMENT ME! - * - * @param evt DOCUMENT ME! - */ - public void mouseReleased(MouseEvent evt) - { - } - - /** - * DOCUMENT ME! - * - * @param evt DOCUMENT ME! - */ - public void mousePressed(MouseEvent evt) - { - int x = evt.getX(); - int y = evt.getY(); - - mx = x; - my = y; - - omx = mx; - omy = my; - - startx = x; - starty = y; - - rectx1 = x; - recty1 = y; - - rectx2 = -1; - recty2 = -1; - - SequenceI found = findPoint(x, y); - - if (found != null) - { - AlignmentPanel[] aps = getAssociatedPanels(); - - for (int a = 0; a < aps.length; a++) - { - if (aps[a].av.getSelectionGroup() != null) - { - aps[a].av.getSelectionGroup().addOrRemove(found, true); - } - else - { - aps[a].av.setSelectionGroup(new SequenceGroup()); - aps[a].av.getSelectionGroup().addOrRemove(found, true); - aps[a].av.getSelectionGroup().setEndRes( - aps[a].av.alignment.getWidth() - 1); - } - } - - PaintRefresher.Refresh(this, av.getSequenceSetId()); - } - - repaint(); - } - - // private void fireSequenceSelectionEvent(Selection sel) { - // controller.handleSequenceSelectionEvent(new SequenceSelectionEvent(this,sel)); - //} - public void mouseMoved(MouseEvent evt) - { - SequenceI found = findPoint(evt.getX(), evt.getY()); - - if (found != null) - { - this.setToolTipText(found.getName()); - } - else - { - this.setToolTipText(null); - } - } - - /** - * DOCUMENT ME! - * - * @param evt DOCUMENT ME! - */ - public void mouseDragged(MouseEvent evt) - { - mx = evt.getX(); - my = evt.getY(); - - //Check if this is a rectangle drawing drag - if ( (evt.getModifiers() & InputEvent.BUTTON2_MASK) != 0) - { - // rectx2 = evt.getX(); - // recty2 = evt.getY(); - } - else - { - rotmat.setIdentity(); - - rotmat.rotate( (float) (my - omy), 'x'); - rotmat.rotate( (float) (mx - omx), 'y'); - - for (int i = 0; i < npoint; i++) - { - SequencePoint sp = (SequencePoint) points.elementAt(i); - sp.coord[0] -= centre[0]; - sp.coord[1] -= centre[1]; - sp.coord[2] -= centre[2]; - - //Now apply the rotation matrix - sp.coord = rotmat.vectorMultiply(sp.coord); - - //Now translate back again - sp.coord[0] += centre[0]; - sp.coord[1] += centre[1]; - sp.coord[2] += centre[2]; - } - - for (int i = 0; i < 3; i++) - { - axes[i] = rotmat.vectorMultiply(axes[i]); - } - - omx = mx; - omy = my; - - paint(this.getGraphics()); - } - } - - /** - * DOCUMENT ME! - * - * @param x1 DOCUMENT ME! - * @param y1 DOCUMENT ME! - * @param x2 DOCUMENT ME! - * @param y2 DOCUMENT ME! - */ - public void rectSelect(int x1, int y1, int x2, int y2) - { - 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)); - - if ( (tmp1 > x1) && (tmp1 < x2) && (tmp2 > y1) && (tmp2 < y2)) - { - if (av != null) - { - if (!av.getSelectionGroup().getSequences(null).contains(sp.sequence)) - { - av.getSelectionGroup().addSequence(sp.sequence, true); - } - } - } - } - - // if (changedSel) { - // fireSequenceSelectionEvent(av.getSelection()); - // } - } - - /** - * DOCUMENT ME! - * - * @param x DOCUMENT ME! - * @param y DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public SequenceI findPoint(int x, int y) - { - int halfwidth = getWidth() / 2; - int halfheight = getHeight() / 2; - - int found = -1; - - for (int i = 0; i < npoint; i++) - { - SequencePoint sp = (SequencePoint) points.elementAt(i); - int px = (int) ( (float) (sp.coord[0] - centre[0]) * scale) + - halfwidth; - int py = (int) ( (float) (sp.coord[1] - centre[1]) * scale) + - halfheight; - - if ( (Math.abs(px - x) < 3) && (Math.abs(py - y) < 3)) - { - found = i; - } - } - - if (found != -1) - { - return ( (SequencePoint) points.elementAt(found)).sequence; - } - else - { - return null; - } - } - - AlignmentPanel[] getAssociatedPanels() - { - if (applyToAllViews) - { - return PaintRefresher.getAssociatedPanels(av.getSequenceSetId()); - } - else - { - return new AlignmentPanel[] - { - ap}; - } - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.gui; + +import java.util.*; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; + +import jalview.datamodel.*; +import jalview.math.*; + +/** + * DOCUMENT ME! + * + * @author $author$ + * @version $Revision$ + */ +public class RotatableCanvas + extends JPanel implements MouseListener, + MouseMotionListener, KeyListener +{ + RotatableMatrix idmat = new RotatableMatrix(3, 3); + RotatableMatrix objmat = new RotatableMatrix(3, 3); + RotatableMatrix rotmat = new RotatableMatrix(3, 3); + + //RubberbandRectangle rubberband; + boolean drawAxes = true; + int omx = 0; + int mx = 0; + int omy = 0; + int my = 0; + Image img; + Graphics ig; + Dimension prefsize; + float[] centre = new float[3]; + float[] width = new float[3]; + float[] max = new float[3]; + float[] min = new float[3]; + float maxwidth; + float scale; + int npoint; + Vector points; + float[][] orig; + float[][] axes; + int startx; + int starty; + int lastx; + int lasty; + int rectx1; + int recty1; + int rectx2; + int recty2; + float scalefactor = 1; + AlignViewport av; + AlignmentPanel ap; + boolean showLabels = false; + Color bgColour = Color.black; + boolean applyToAllViews = false; + + // Controller controller; + public RotatableCanvas(AlignmentPanel ap) + { + this.av = ap.av; + this.ap = ap; + + addMouseWheelListener(new MouseWheelListener() + { + public void mouseWheelMoved(MouseWheelEvent e) + { + if (e.getWheelRotation() > 0) + { + scale = (float) (scale * 1.1); + repaint(); + } + + else + { + scale = (float) (scale * 0.9); + repaint(); + } + } + }); + + } + + public void showLabels(boolean b) + { + showLabels = b; + repaint(); + } + + public void setPoints(Vector points, int npoint) + { + this.points = points; + this.npoint = npoint; + ToolTipManager.sharedInstance().registerComponent(this); + ToolTipManager.sharedInstance().setInitialDelay(0); + ToolTipManager.sharedInstance().setDismissDelay(10000); + + prefsize = getPreferredSize(); + orig = new float[npoint][3]; + + for (int i = 0; i < npoint; i++) + { + SequencePoint sp = (SequencePoint) points.elementAt(i); + + for (int j = 0; j < 3; j++) + { + orig[i][j] = sp.coord[j]; + } + } + + //Initialize the matrices to identity + for (int i = 0; i < 3; i++) + { + for (int j = 0; j < 3; j++) + { + if (i != j) + { + idmat.addElement(i, j, 0); + objmat.addElement(i, j, 0); + rotmat.addElement(i, j, 0); + } + else + { + idmat.addElement(i, j, 0); + objmat.addElement(i, j, 0); + rotmat.addElement(i, j, 0); + } + } + } + + axes = new float[3][3]; + initAxes(); + + findCentre(); + findWidth(); + + scale = findScale(); + + addMouseListener(this); + + addMouseMotionListener(this); + + } + + public void initAxes() + { + for (int i = 0; i < 3; i++) + { + for (int j = 0; j < 3; j++) + { + if (i != j) + { + axes[i][j] = 0; + } + else + { + axes[i][j] = 1; + } + } + } + } + + /** + * DOCUMENT ME! + */ + public void findWidth() + { + max = new float[3]; + min = new float[3]; + + max[0] = (float) - 1e30; + max[1] = (float) - 1e30; + max[2] = (float) - 1e30; + + min[0] = (float) 1e30; + min[1] = (float) 1e30; + min[2] = (float) 1e30; + + for (int i = 0; i < 3; i++) + { + for (int j = 0; j < npoint; j++) + { + SequencePoint sp = (SequencePoint) points.elementAt(j); + + if (sp.coord[i] >= max[i]) + { + max[i] = sp.coord[i]; + } + + if (sp.coord[i] <= min[i]) + { + min[i] = sp.coord[i]; + } + } + } + + // System.out.println("xmax " + max[0] + " min " + min[0]); + //System.out.println("ymax " + max[1] + " min " + min[1]); + //System.out.println("zmax " + max[2] + " min " + min[2]); + width[0] = Math.abs(max[0] - min[0]); + width[1] = Math.abs(max[1] - min[1]); + width[2] = Math.abs(max[2] - min[2]); + + maxwidth = width[0]; + + if (width[1] > width[0]) + { + maxwidth = width[1]; + } + + if (width[2] > width[1]) + { + maxwidth = width[2]; + } + + //System.out.println("Maxwidth = " + maxwidth); + } + + /** + * DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public float findScale() + { + int dim; + int width; + int height; + + if (getWidth() != 0) + { + width = getWidth(); + height = getHeight(); + } + else + { + width = prefsize.width; + height = prefsize.height; + } + + if (width < height) + { + dim = width; + } + else + { + dim = height; + } + + return (float) ( (dim * scalefactor) / (2 * maxwidth)); + } + + /** + * DOCUMENT ME! + */ + public void findCentre() + { + //Find centre coordinate + findWidth(); + + centre[0] = (max[0] + min[0]) / 2; + centre[1] = (max[1] + min[1]) / 2; + centre[2] = (max[2] + min[2]) / 2; + + // System.out.println("Centre x " + centre[0]); + //System.out.println("Centre y " + centre[1]); + //System.out.println("Centre z " + centre[2]); + } + + /** + * DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public Dimension getPreferredSize() + { + if (prefsize != null) + { + return prefsize; + } + else + { + return new Dimension(400, 400); + } + } + + /** + * DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public Dimension getMinimumSize() + { + return getPreferredSize(); + } + + /** + * DOCUMENT ME! + * + * @param g DOCUMENT ME! + */ + public void paintComponent(Graphics g1) + { + + Graphics2D g = (Graphics2D) g1; + + g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, + RenderingHints.VALUE_ANTIALIAS_ON); + if (points == null) + { + g.setFont(new Font("Verdana", Font.PLAIN, 18)); + g.drawString("Calculating PCA....", 20, getHeight() / 2); + } + else + { + //Only create the image at the beginning - + if ( (img == null) || (prefsize.width != getWidth()) || + (prefsize.height != getHeight())) + { + prefsize.width = getWidth(); + prefsize.height = getHeight(); + + scale = findScale(); + + // System.out.println("New scale = " + scale); + img = createImage(getWidth(), getHeight()); + ig = img.getGraphics(); + } + + drawBackground(ig, bgColour); + drawScene(ig); + + if (drawAxes == true) + { + drawAxes(ig); + } + + g.drawImage(img, 0, 0, this); + } + } + + /** + * DOCUMENT ME! + * + * @param g DOCUMENT ME! + */ + public void drawAxes(Graphics g) + { + + g.setColor(Color.yellow); + + 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))); + } + } + + /** + * DOCUMENT ME! + * + * @param g DOCUMENT ME! + * @param col DOCUMENT ME! + */ + public void drawBackground(Graphics g, Color col) + { + g.setColor(col); + g.fillRect(0, 0, prefsize.width, prefsize.height); + } + + /** + * DOCUMENT ME! + * + * @param g DOCUMENT ME! + */ + public void drawScene(Graphics g1) + { + + Graphics2D g = (Graphics2D) g1; + + g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, + RenderingHints.VALUE_ANTIALIAS_ON); + + int halfwidth = getWidth() / 2; + int halfheight = getHeight() / 2; + + for (int i = 0; i < npoint; i++) + { + SequencePoint sp = (SequencePoint) points.elementAt(i); + int x = (int) ( (float) (sp.coord[0] - centre[0]) * scale) + + halfwidth; + int y = (int) ( (float) (sp.coord[1] - centre[1]) * scale) + + halfheight; + float z = sp.coord[1] - centre[2]; + + if (av.getSequenceColour(sp.sequence) == Color.black) + { + g.setColor(Color.white); + } + else + { + g.setColor(av.getSequenceColour(sp.sequence)); + } + + if (av.getSelectionGroup() != null) + { + if (av.getSelectionGroup().getSequences(null).contains( + ( (SequencePoint) points.elementAt(i)).sequence)) + { + g.setColor(Color.gray); + } + } + + if (z < 0) + { + g.setColor(g.getColor().darker()); + } + + g.fillRect(x - 3, y - 3, 6, 6); + if (showLabels) + { + g.setColor(Color.red); + g.drawString( ( (SequencePoint) points.elementAt(i)).sequence. + getName(), + x - 3, y - 4); + } + } + + // //Now the rectangle + // if (rectx2 != -1 && recty2 != -1) { + // g.setColor(Color.white); + // + // g.drawRect(rectx1,recty1,rectx2-rectx1,recty2-recty1); + // } + } + + /** + * DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public Dimension minimumsize() + { + return prefsize; + } + + /** + * DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public Dimension preferredsize() + { + return prefsize; + } + + /** + * DOCUMENT ME! + * + * @param evt DOCUMENT ME! + */ + public void keyTyped(KeyEvent evt) + { + } + + /** + * DOCUMENT ME! + * + * @param evt DOCUMENT ME! + */ + public void keyReleased(KeyEvent evt) + { + } + + /** + * DOCUMENT ME! + * + * @param evt DOCUMENT ME! + */ + public void keyPressed(KeyEvent evt) + { + if (evt.getKeyCode() == KeyEvent.VK_UP) + { + scalefactor = (float) (scalefactor * 1.1); + scale = findScale(); + } + else if (evt.getKeyCode() == KeyEvent.VK_DOWN) + { + scalefactor = (float) (scalefactor * 0.9); + scale = findScale(); + } + else if (evt.getKeyChar() == 's') + { + System.err.println("DEBUG: Rectangle selection"); // log.debug + + if ( (rectx2 != -1) && (recty2 != -1)) + { + rectSelect(rectx1, recty1, rectx2, recty2); + } + } + + repaint(); + } + + /** + * DOCUMENT ME! + * + * @param evt DOCUMENT ME! + */ + public void mouseClicked(MouseEvent evt) + { + } + + /** + * DOCUMENT ME! + * + * @param evt DOCUMENT ME! + */ + public void mouseEntered(MouseEvent evt) + { + } + + /** + * DOCUMENT ME! + * + * @param evt DOCUMENT ME! + */ + public void mouseExited(MouseEvent evt) + { + } + + /** + * DOCUMENT ME! + * + * @param evt DOCUMENT ME! + */ + public void mouseReleased(MouseEvent evt) + { + } + + /** + * DOCUMENT ME! + * + * @param evt DOCUMENT ME! + */ + public void mousePressed(MouseEvent evt) + { + int x = evt.getX(); + int y = evt.getY(); + + mx = x; + my = y; + + omx = mx; + omy = my; + + startx = x; + starty = y; + + rectx1 = x; + recty1 = y; + + rectx2 = -1; + recty2 = -1; + + SequenceI found = findPoint(x, y); + + if (found != null) + { + AlignmentPanel[] aps = getAssociatedPanels(); + + for (int a = 0; a < aps.length; a++) + { + if (aps[a].av.getSelectionGroup() != null) + { + aps[a].av.getSelectionGroup().addOrRemove(found, true); + } + else + { + aps[a].av.setSelectionGroup(new SequenceGroup()); + aps[a].av.getSelectionGroup().addOrRemove(found, true); + aps[a].av.getSelectionGroup().setEndRes( + aps[a].av.alignment.getWidth() - 1); + } + } + + PaintRefresher.Refresh(this, av.getSequenceSetId()); + } + + repaint(); + } + + // private void fireSequenceSelectionEvent(Selection sel) { + // controller.handleSequenceSelectionEvent(new SequenceSelectionEvent(this,sel)); + //} + public void mouseMoved(MouseEvent evt) + { + SequenceI found = findPoint(evt.getX(), evt.getY()); + + if (found != null) + { + this.setToolTipText(found.getName()); + } + else + { + this.setToolTipText(null); + } + } + + /** + * DOCUMENT ME! + * + * @param evt DOCUMENT ME! + */ + public void mouseDragged(MouseEvent evt) + { + mx = evt.getX(); + my = evt.getY(); + + //Check if this is a rectangle drawing drag + if ( (evt.getModifiers() & InputEvent.BUTTON2_MASK) != 0) + { + // rectx2 = evt.getX(); + // recty2 = evt.getY(); + } + else + { + rotmat.setIdentity(); + + rotmat.rotate( (float) (my - omy), 'x'); + rotmat.rotate( (float) (mx - omx), 'y'); + + for (int i = 0; i < npoint; i++) + { + SequencePoint sp = (SequencePoint) points.elementAt(i); + sp.coord[0] -= centre[0]; + sp.coord[1] -= centre[1]; + sp.coord[2] -= centre[2]; + + //Now apply the rotation matrix + sp.coord = rotmat.vectorMultiply(sp.coord); + + //Now translate back again + sp.coord[0] += centre[0]; + sp.coord[1] += centre[1]; + sp.coord[2] += centre[2]; + } + + for (int i = 0; i < 3; i++) + { + axes[i] = rotmat.vectorMultiply(axes[i]); + } + + omx = mx; + omy = my; + + paint(this.getGraphics()); + } + } + + /** + * DOCUMENT ME! + * + * @param x1 DOCUMENT ME! + * @param y1 DOCUMENT ME! + * @param x2 DOCUMENT ME! + * @param y2 DOCUMENT ME! + */ + public void rectSelect(int x1, int y1, int x2, int y2) + { + 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)); + + if ( (tmp1 > x1) && (tmp1 < x2) && (tmp2 > y1) && (tmp2 < y2)) + { + if (av != null) + { + if (!av.getSelectionGroup().getSequences(null).contains(sp.sequence)) + { + av.getSelectionGroup().addSequence(sp.sequence, true); + } + } + } + } + + // if (changedSel) { + // fireSequenceSelectionEvent(av.getSelection()); + // } + } + + /** + * DOCUMENT ME! + * + * @param x DOCUMENT ME! + * @param y DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public SequenceI findPoint(int x, int y) + { + int halfwidth = getWidth() / 2; + int halfheight = getHeight() / 2; + + int found = -1; + + for (int i = 0; i < npoint; i++) + { + SequencePoint sp = (SequencePoint) points.elementAt(i); + int px = (int) ( (float) (sp.coord[0] - centre[0]) * scale) + + halfwidth; + int py = (int) ( (float) (sp.coord[1] - centre[1]) * scale) + + halfheight; + + if ( (Math.abs(px - x) < 3) && (Math.abs(py - y) < 3)) + { + found = i; + } + } + + if (found != -1) + { + return ( (SequencePoint) points.elementAt(found)).sequence; + } + else + { + return null; + } + } + + AlignmentPanel[] getAssociatedPanels() + { + if (applyToAllViews) + { + return PaintRefresher.getAssociatedPanels(av.getSequenceSetId()); + } + else + { + return new AlignmentPanel[] + { + ap}; + } + } +} diff --git a/src/jalview/gui/ScalePanel.java b/src/jalview/gui/ScalePanel.java index d8bdba3..88f0584 100755 --- a/src/jalview/gui/ScalePanel.java +++ b/src/jalview/gui/ScalePanel.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/gui/ScriptWindow.java b/src/jalview/gui/ScriptWindow.java index 8e69584..1e8b201 100644 --- a/src/jalview/gui/ScriptWindow.java +++ b/src/jalview/gui/ScriptWindow.java @@ -1,616 +1,606 @@ -/* $RCSfile$ - * $Author$ - * $Date$ - * $Revision$ - * - * Copyright (C) 2002-2005 The Jmol Development Team - * - * Contact: jmol-developers@lists.sf.net - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - - * - * Modified and added to Jalview by A Waterhouse to extend JInternalFrame - * - - */ -package jalview.gui; - -import org.jmol.api.*; - -import java.awt.*; -import java.awt.event.*; -import javax.swing.*; -import javax.swing.text.*; -import java.util.Vector; - -import org.jmol.i18n.GT; -import org.jmol.util.Logger; -import org.jmol.util.CommandHistory; - -public final class ScriptWindow extends JPanel - implements ActionListener, EnterListener{ - - private ConsoleTextPane console; - private JButton closeButton; - private JButton runButton; - private JButton haltButton; - private JButton clearButton; - private JButton historyButton; - private JButton stateButton; - JmolViewer viewer; - AppJmol appJmol; - - public ScriptWindow(AppJmol appJmol) - { - this.viewer = appJmol.viewer; - this.appJmol = appJmol; - - - setLayout(new BorderLayout()); - - console = new ConsoleTextPane(this); - - - console.setPrompt(); - add(new JScrollPane(console) - , BorderLayout.CENTER); - - JPanel buttonPanel = new JPanel(); - add(buttonPanel, BorderLayout.SOUTH); - - runButton = new JButton(GT._("Run")); - haltButton = new JButton(GT._("Halt")); - runButton.addActionListener(this); - // buttonPanel.add(runButton); - haltButton.addActionListener(this); - // buttonPanel.add(haltButton); - haltButton.setEnabled(false); - - clearButton = new JButton(GT._("Clear")); - clearButton.addActionListener(this); - buttonPanel.add(clearButton); - - historyButton = new JButton(GT._("History")); - historyButton.addActionListener(this); - buttonPanel.add(historyButton); - - stateButton = new JButton(GT._("State")); - stateButton.addActionListener(this); - buttonPanel.add(stateButton); - - closeButton = new JButton(GT._("Close")); - closeButton.addActionListener(this); - buttonPanel.add(closeButton); - - for(int i=0; i= 0) { - console.outputError(strStatus); - isError = true; - } else if (!isError) { - console.outputStatus(strStatus); - } - } - - public void notifyScriptTermination(String strMsg, int msWalltime) { - if (strMsg != null && strMsg.indexOf("ERROR") >= 0) { - console.outputError(strMsg); - } - runButton.setEnabled(true); - haltButton.setEnabled(false); - } - - public void enterPressed() { - runButton.doClick(100); - // executeCommand(); - } - - - class ExecuteCommandThread extends Thread { - - String strCommand; - ExecuteCommandThread (String command) { - strCommand = command; - } - - public void run() { - try { - executeCommand(strCommand); - } catch (Exception ie) { - Logger.debug("execution command interrupted!"+ie); - } - } - } - - ExecuteCommandThread execThread; - void executeCommandAsThread(){ - String strCommand = console.getCommandString().trim(); - if (strCommand.length() > 0) { - execThread = new ExecuteCommandThread(strCommand); - execThread.start(); - } - } - - void executeCommand(String strCommand) { - boolean doWait; - setError(false); - console.appendNewline(); - console.setPrompt(); - if (strCommand.length() > 0) { - String strErrorMessage = null; - doWait = (strCommand.indexOf("WAIT ") == 0); - if (doWait) { //for testing, mainly - // demonstrates using the statusManager system. - runButton.setEnabled(false); - haltButton.setEnabled(true); - - Vector info = (Vector) viewer - .scriptWaitStatus(strCommand.substring(5), - "+fileLoaded,+scriptStarted,+scriptStatus,+scriptEcho,+scriptTerminated"); - runButton.setEnabled(true); - haltButton.setEnabled(false); - /* - * info = [ statusRecortSet0, statusRecortSet1, statusRecortSet2, ...] - * statusRecordSet = [ statusRecord0, statusRecord1, statusRecord2, ...] - * statusRecord = [int msgPtr, String statusName, int intInfo, String msg] - */ - for (int i = 0; i < info.size(); i++) { - Vector statusRecordSet = (Vector) info.get(i); - for (int j = 0; j < statusRecordSet.size(); j++) { - Vector statusRecord = (Vector) statusRecordSet.get(j); - Logger.info("msg#=" + statusRecord.get(0) + " " - + statusRecord.get(1) + " intInfo=" + statusRecord.get(2) - + " stringInfo=" + statusRecord.get(3)); - } - } - console.appendNewline(); - } else { - boolean isScriptExecuting = viewer.isScriptExecuting(); - if (viewer.checkHalt(strCommand)) - strErrorMessage = (isScriptExecuting ? "string execution halted with " + strCommand : "no script was executing"); - else - strErrorMessage = "";//viewer.scriptCheck(strCommand); - //the problem is that scriptCheck is synchronized, so these might get backed up. - if (strErrorMessage != null && strErrorMessage.length() > 0) { - console.outputError(strErrorMessage); - } else { - //runButton.setEnabled(false); - haltButton.setEnabled(true); - viewer.script(strCommand); - } - } - } - console.grabFocus(); - } - - public void actionPerformed(ActionEvent e) { - Object source = e.getSource(); - if (source == closeButton) { - appJmol.showConsole(false); - } else if (source == runButton) { - executeCommandAsThread(); - } else if (source == clearButton) { - console.clearContent(); - } else if (source == historyButton) { - console.clearContent(viewer.getSetHistory(Integer.MAX_VALUE)); - } else if (source == stateButton) { - console.clearContent(viewer.getStateInfo()); - } else if (source == haltButton) { - viewer.haltScriptExecution(); - } - console.grabFocus(); // always grab the focus (e.g., after clear) - } -} - -class ConsoleTextPane extends JTextPane { - - ConsoleDocument consoleDoc; - EnterListener enterListener; - JmolViewer viewer; - - ConsoleTextPane(ScriptWindow scriptWindow) { - super(new ConsoleDocument()); - consoleDoc = (ConsoleDocument)getDocument(); - consoleDoc.setConsoleTextPane(this); - this.enterListener = (EnterListener) scriptWindow; - this.viewer = scriptWindow.viewer; - } - - public String getCommandString() { - String cmd = consoleDoc.getCommandString(); - return cmd; - } - - public void setPrompt() { - consoleDoc.setPrompt(); - } - - public void appendNewline() { - consoleDoc.appendNewline(); - } - - public void outputError(String strError) { - consoleDoc.outputError(strError); - } - - public void outputErrorForeground(String strError) { - consoleDoc.outputErrorForeground(strError); - } - - public void outputEcho(String strEcho) { - consoleDoc.outputEcho(strEcho); - } - - public void outputStatus(String strStatus) { - consoleDoc.outputStatus(strStatus); - } - - public void enterPressed() { - if (enterListener != null) - enterListener.enterPressed(); - } - - public void clearContent() { - clearContent(null); - } - public void clearContent(String text) { - consoleDoc.clearContent(); - if (text != null) - consoleDoc.outputEcho(text); - setPrompt(); - } - - /* (non-Javadoc) - * @see java.awt.Component#processKeyEvent(java.awt.event.KeyEvent) - */ - - /** - * Custom key event processing for command 0 implementation. - * - * Captures key up and key down strokes to call command history - * and redefines the same events with control down to allow - * caret vertical shift. - * - * @see java.awt.Component#processKeyEvent(java.awt.event.KeyEvent) - */ - protected void processKeyEvent(KeyEvent ke) - { - // Id Control key is down, captures events does command - // history recall and inhibits caret vertical shift. - if (ke.getKeyCode() == KeyEvent.VK_UP - && ke.getID() == KeyEvent.KEY_PRESSED - && !ke.isControlDown()) - { - recallCommand(true); - } - else if ( - ke.getKeyCode() == KeyEvent.VK_DOWN - && ke.getID() == KeyEvent.KEY_PRESSED - && !ke.isControlDown()) - { - recallCommand(false); - } - // If Control key is down, redefines the event as if it - // where a key up or key down stroke without modifiers. - // This allows to move the caret up and down - // with no command history recall. - else if ( - (ke.getKeyCode() == KeyEvent.VK_DOWN - || ke.getKeyCode() == KeyEvent.VK_UP) - && ke.getID() == KeyEvent.KEY_PRESSED - && ke.isControlDown()) - { - super - .processKeyEvent(new KeyEvent( - (Component) ke.getSource(), - ke.getID(), - ke.getWhen(), - 0, // No modifiers - ke.getKeyCode(), - ke.getKeyChar(), - ke.getKeyLocation())); - } - // Standard processing for other events. - else - { - super.processKeyEvent(ke); - //check command for compiler-identifyable syntax issues - //this may have to be taken out if people start complaining - //that only some of the commands are being checked - //that is -- that the script itself is not being fully checked - - //not perfect -- help here? - if (ke.getID() == KeyEvent.KEY_RELEASED - && (ke.getKeyCode() > KeyEvent.VK_DOWN) || ke.getKeyCode() == KeyEvent.VK_BACK_SPACE) - checkCommand(); - } - } - - /** - * Recall command history. - * - * @param up - history up or down - */ - void recallCommand(boolean up) { - String cmd = viewer.getSetHistory(up ? -1 : 1); - if (cmd == null) { - return; - } - try { - if (cmd.endsWith(CommandHistory.ERROR_FLAG)) { - cmd = cmd.substring(0, cmd.indexOf(CommandHistory.ERROR_FLAG)); - consoleDoc.replaceCommand(cmd, true); - } else { - consoleDoc.replaceCommand(cmd, false); - } - } catch (BadLocationException e) { - e.printStackTrace(); - } - } - - void checkCommand() { - String strCommand = consoleDoc.getCommandString(); - if (strCommand.length() == 0) - return; - consoleDoc - .colorCommand(viewer.scriptCheck(strCommand) == null ? consoleDoc.attUserInput - : consoleDoc.attError); - } - - -} - -class ConsoleDocument extends DefaultStyledDocument { - - ConsoleTextPane consoleTextPane; - - SimpleAttributeSet attError; - SimpleAttributeSet attEcho; - SimpleAttributeSet attPrompt; - SimpleAttributeSet attUserInput; - SimpleAttributeSet attStatus; - - ConsoleDocument() { - super(); - - attError = new SimpleAttributeSet(); - StyleConstants.setForeground(attError, Color.red); - - attPrompt = new SimpleAttributeSet(); - StyleConstants.setForeground(attPrompt, Color.magenta); - - attUserInput = new SimpleAttributeSet(); - StyleConstants.setForeground(attUserInput, Color.black); - - attEcho = new SimpleAttributeSet(); - StyleConstants.setForeground(attEcho, Color.blue); - StyleConstants.setBold(attEcho, true); - - attStatus = new SimpleAttributeSet(); - StyleConstants.setForeground(attStatus, Color.black); - StyleConstants.setItalic(attStatus, true); - } - - void setConsoleTextPane(ConsoleTextPane consoleTextPane) { - this.consoleTextPane = consoleTextPane; - } - - Position positionBeforePrompt; // starts at 0, so first time isn't tracked (at least on Mac OS X) - Position positionAfterPrompt; // immediately after $, so this will track - int offsetAfterPrompt; // only still needed for the insertString override and replaceCommand - - /** - * Removes all content of the script window, and add a new prompt. - */ - void clearContent() { - try { - super.remove(0, getLength()); - } catch (BadLocationException exception) { - System.out.println("Could not clear script window content: " + exception.getMessage()); - } - } - - void setPrompt() { - try { - super.insertString(getLength(), "$ ", attPrompt); - setOffsetPositions(); - consoleTextPane.setCaretPosition(offsetAfterPrompt); - } catch (BadLocationException e) { - e.printStackTrace(); - } - } - - void setOffsetPositions() { - try { - offsetAfterPrompt = getLength(); - positionBeforePrompt = createPosition(offsetAfterPrompt - 2); - // after prompt should be immediately after $ otherwise tracks the end - // of the line (and no command will be found) at least on Mac OS X it did. - positionAfterPrompt = createPosition(offsetAfterPrompt - 1); - } catch (BadLocationException e) { - e.printStackTrace(); - } - } - - void setNoPrompt() { - try { - offsetAfterPrompt = getLength(); - positionAfterPrompt = positionBeforePrompt = createPosition(offsetAfterPrompt); - consoleTextPane.setCaretPosition(offsetAfterPrompt); - } catch (BadLocationException e) { - e.printStackTrace(); - } - } - - // it looks like the positionBeforePrompt does not track when it started out as 0 - // and a insertString at location 0 occurs. It may be better to track the - // position after the prompt in stead - void outputBeforePrompt(String str, SimpleAttributeSet attribute) { - try { - int pt = consoleTextPane.getCaretPosition(); - Position caretPosition = createPosition(pt); - pt = positionBeforePrompt.getOffset(); - super.insertString(pt, str+"\n", attribute); - setOffsetPositions(); - pt = caretPosition.getOffset(); - consoleTextPane.setCaretPosition(pt); - } catch (BadLocationException e) { - e.printStackTrace(); - } - } - - void outputError(String strError) { - outputBeforePrompt(strError, attError); - } - - void outputErrorForeground(String strError) { - try { - super.insertString(getLength(), strError+"\n", attError); - consoleTextPane.setCaretPosition(getLength()); - } catch (BadLocationException e) { - e.printStackTrace(); - - } - } - - void outputEcho(String strEcho) { - outputBeforePrompt(strEcho, attEcho); - } - - void outputStatus(String strStatus) { - outputBeforePrompt(strStatus, attStatus); - } - - void appendNewline() { - try { - super.insertString(getLength(), "\n", attUserInput); - consoleTextPane.setCaretPosition(getLength()); - } catch (BadLocationException e) { - e.printStackTrace(); - } - } - - // override the insertString to make sure everything typed ends up at the end - // or in the 'command line' using the proper font, and the newline is processed. - public void insertString(int offs, String str, AttributeSet a) - throws BadLocationException { - int ichNewline = str.indexOf('\n'); - if (ichNewline > 0) - str = str.substring(0, ichNewline); - if (ichNewline != 0) { - if (offs < offsetAfterPrompt) { - offs = getLength(); - } - super.insertString(offs, str, a == attError ? a : attUserInput); - consoleTextPane.setCaretPosition(offs+str.length()); - } - if (ichNewline >= 0) { - consoleTextPane.enterPressed(); - } - } - - String getCommandString() { - String strCommand = ""; - try { - int cmdStart = positionAfterPrompt.getOffset(); - strCommand = getText(cmdStart, getLength() - cmdStart); - while (strCommand.length() > 0 && strCommand.charAt(0) == ' ') - strCommand = strCommand.substring(1); - } catch (BadLocationException e) { - e.printStackTrace(); - } - return strCommand; - } - - public void remove(int offs, int len) - throws BadLocationException { - if (offs < offsetAfterPrompt) { - len -= offsetAfterPrompt - offs; - if (len <= 0) - return; - offs = offsetAfterPrompt; - } - super.remove(offs, len); -// consoleTextPane.setCaretPosition(offs); - } - - public void replace(int offs, int length, String str, AttributeSet attrs) - throws BadLocationException { - if (offs < offsetAfterPrompt) { - if (offs + length < offsetAfterPrompt) { - offs = getLength(); - length = 0; - } else { - length -= offsetAfterPrompt - offs; - offs = offsetAfterPrompt; - } - } - super.replace(offs, length, str, attrs); -// consoleTextPane.setCaretPosition(offs + str.length()); - } - - /** - * Replaces current command on script. - * - * @param newCommand new command value - * @param isError true to set error color ends with #?? - * - * @throws BadLocationException - */ - void replaceCommand(String newCommand, boolean isError) throws BadLocationException { - if (positionAfterPrompt == positionBeforePrompt) - return; - replace(offsetAfterPrompt, getLength() - offsetAfterPrompt, newCommand, - isError ? attError : attUserInput); - } - - void colorCommand(SimpleAttributeSet att) { - if (positionAfterPrompt == positionBeforePrompt) - return; - setCharacterAttributes(offsetAfterPrompt, getLength() - offsetAfterPrompt, att, true); - } -} - -interface EnterListener { - public void enterPressed(); -} - +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.gui; + +import org.jmol.api.*; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +import javax.swing.text.*; +import java.util.Vector; + +import org.jmol.i18n.GT; +import org.jmol.util.Logger; +import org.jmol.util.CommandHistory; + +public final class ScriptWindow extends JPanel + implements ActionListener, EnterListener{ + + private ConsoleTextPane console; + private JButton closeButton; + private JButton runButton; + private JButton haltButton; + private JButton clearButton; + private JButton historyButton; + private JButton stateButton; + JmolViewer viewer; + AppJmol appJmol; + + public ScriptWindow(AppJmol appJmol) + { + this.viewer = appJmol.viewer; + this.appJmol = appJmol; + + + setLayout(new BorderLayout()); + + console = new ConsoleTextPane(this); + + + console.setPrompt(); + add(new JScrollPane(console) + , BorderLayout.CENTER); + + JPanel buttonPanel = new JPanel(); + add(buttonPanel, BorderLayout.SOUTH); + + runButton = new JButton(GT._("Run")); + haltButton = new JButton(GT._("Halt")); + runButton.addActionListener(this); + // buttonPanel.add(runButton); + haltButton.addActionListener(this); + // buttonPanel.add(haltButton); + haltButton.setEnabled(false); + + clearButton = new JButton(GT._("Clear")); + clearButton.addActionListener(this); + buttonPanel.add(clearButton); + + historyButton = new JButton(GT._("History")); + historyButton.addActionListener(this); + buttonPanel.add(historyButton); + + stateButton = new JButton(GT._("State")); + stateButton.addActionListener(this); + buttonPanel.add(stateButton); + + closeButton = new JButton(GT._("Close")); + closeButton.addActionListener(this); + buttonPanel.add(closeButton); + + for(int i=0; i= 0) { + console.outputError(strStatus); + isError = true; + } else if (!isError) { + console.outputStatus(strStatus); + } + } + + public void notifyScriptTermination(String strMsg, int msWalltime) { + if (strMsg != null && strMsg.indexOf("ERROR") >= 0) { + console.outputError(strMsg); + } + runButton.setEnabled(true); + haltButton.setEnabled(false); + } + + public void enterPressed() { + runButton.doClick(100); + // executeCommand(); + } + + + class ExecuteCommandThread extends Thread { + + String strCommand; + ExecuteCommandThread (String command) { + strCommand = command; + } + + public void run() { + try { + executeCommand(strCommand); + } catch (Exception ie) { + Logger.debug("execution command interrupted!"+ie); + } + } + } + + ExecuteCommandThread execThread; + void executeCommandAsThread(){ + String strCommand = console.getCommandString().trim(); + if (strCommand.length() > 0) { + execThread = new ExecuteCommandThread(strCommand); + execThread.start(); + } + } + + void executeCommand(String strCommand) { + boolean doWait; + setError(false); + console.appendNewline(); + console.setPrompt(); + if (strCommand.length() > 0) { + String strErrorMessage = null; + doWait = (strCommand.indexOf("WAIT ") == 0); + if (doWait) { //for testing, mainly + // demonstrates using the statusManager system. + runButton.setEnabled(false); + haltButton.setEnabled(true); + + Vector info = (Vector) viewer + .scriptWaitStatus(strCommand.substring(5), + "+fileLoaded,+scriptStarted,+scriptStatus,+scriptEcho,+scriptTerminated"); + runButton.setEnabled(true); + haltButton.setEnabled(false); + /* + * info = [ statusRecortSet0, statusRecortSet1, statusRecortSet2, ...] + * statusRecordSet = [ statusRecord0, statusRecord1, statusRecord2, ...] + * statusRecord = [int msgPtr, String statusName, int intInfo, String msg] + */ + for (int i = 0; i < info.size(); i++) { + Vector statusRecordSet = (Vector) info.get(i); + for (int j = 0; j < statusRecordSet.size(); j++) { + Vector statusRecord = (Vector) statusRecordSet.get(j); + Logger.info("msg#=" + statusRecord.get(0) + " " + + statusRecord.get(1) + " intInfo=" + statusRecord.get(2) + + " stringInfo=" + statusRecord.get(3)); + } + } + console.appendNewline(); + } else { + boolean isScriptExecuting = viewer.isScriptExecuting(); + if (viewer.checkHalt(strCommand)) + strErrorMessage = (isScriptExecuting ? "string execution halted with " + strCommand : "no script was executing"); + else + strErrorMessage = "";//viewer.scriptCheck(strCommand); + //the problem is that scriptCheck is synchronized, so these might get backed up. + if (strErrorMessage != null && strErrorMessage.length() > 0) { + console.outputError(strErrorMessage); + } else { + //runButton.setEnabled(false); + haltButton.setEnabled(true); + viewer.script(strCommand); + } + } + } + console.grabFocus(); + } + + public void actionPerformed(ActionEvent e) { + Object source = e.getSource(); + if (source == closeButton) { + appJmol.showConsole(false); + } else if (source == runButton) { + executeCommandAsThread(); + } else if (source == clearButton) { + console.clearContent(); + } else if (source == historyButton) { + console.clearContent(viewer.getSetHistory(Integer.MAX_VALUE)); + } else if (source == stateButton) { + console.clearContent(viewer.getStateInfo()); + } else if (source == haltButton) { + viewer.haltScriptExecution(); + } + console.grabFocus(); // always grab the focus (e.g., after clear) + } +} + +class ConsoleTextPane extends JTextPane { + + ConsoleDocument consoleDoc; + EnterListener enterListener; + JmolViewer viewer; + + ConsoleTextPane(ScriptWindow scriptWindow) { + super(new ConsoleDocument()); + consoleDoc = (ConsoleDocument)getDocument(); + consoleDoc.setConsoleTextPane(this); + this.enterListener = (EnterListener) scriptWindow; + this.viewer = scriptWindow.viewer; + } + + public String getCommandString() { + String cmd = consoleDoc.getCommandString(); + return cmd; + } + + public void setPrompt() { + consoleDoc.setPrompt(); + } + + public void appendNewline() { + consoleDoc.appendNewline(); + } + + public void outputError(String strError) { + consoleDoc.outputError(strError); + } + + public void outputErrorForeground(String strError) { + consoleDoc.outputErrorForeground(strError); + } + + public void outputEcho(String strEcho) { + consoleDoc.outputEcho(strEcho); + } + + public void outputStatus(String strStatus) { + consoleDoc.outputStatus(strStatus); + } + + public void enterPressed() { + if (enterListener != null) + enterListener.enterPressed(); + } + + public void clearContent() { + clearContent(null); + } + public void clearContent(String text) { + consoleDoc.clearContent(); + if (text != null) + consoleDoc.outputEcho(text); + setPrompt(); + } + + /* (non-Javadoc) + * @see java.awt.Component#processKeyEvent(java.awt.event.KeyEvent) + */ + + /** + * Custom key event processing for command 0 implementation. + * + * Captures key up and key down strokes to call command history + * and redefines the same events with control down to allow + * caret vertical shift. + * + * @see java.awt.Component#processKeyEvent(java.awt.event.KeyEvent) + */ + protected void processKeyEvent(KeyEvent ke) + { + // Id Control key is down, captures events does command + // history recall and inhibits caret vertical shift. + if (ke.getKeyCode() == KeyEvent.VK_UP + && ke.getID() == KeyEvent.KEY_PRESSED + && !ke.isControlDown()) + { + recallCommand(true); + } + else if ( + ke.getKeyCode() == KeyEvent.VK_DOWN + && ke.getID() == KeyEvent.KEY_PRESSED + && !ke.isControlDown()) + { + recallCommand(false); + } + // If Control key is down, redefines the event as if it + // where a key up or key down stroke without modifiers. + // This allows to move the caret up and down + // with no command history recall. + else if ( + (ke.getKeyCode() == KeyEvent.VK_DOWN + || ke.getKeyCode() == KeyEvent.VK_UP) + && ke.getID() == KeyEvent.KEY_PRESSED + && ke.isControlDown()) + { + super + .processKeyEvent(new KeyEvent( + (Component) ke.getSource(), + ke.getID(), + ke.getWhen(), + 0, // No modifiers + ke.getKeyCode(), + ke.getKeyChar(), + ke.getKeyLocation())); + } + // Standard processing for other events. + else + { + super.processKeyEvent(ke); + //check command for compiler-identifyable syntax issues + //this may have to be taken out if people start complaining + //that only some of the commands are being checked + //that is -- that the script itself is not being fully checked + + //not perfect -- help here? + if (ke.getID() == KeyEvent.KEY_RELEASED + && (ke.getKeyCode() > KeyEvent.VK_DOWN) || ke.getKeyCode() == KeyEvent.VK_BACK_SPACE) + checkCommand(); + } + } + + /** + * Recall command history. + * + * @param up - history up or down + */ + void recallCommand(boolean up) { + String cmd = viewer.getSetHistory(up ? -1 : 1); + if (cmd == null) { + return; + } + try { + if (cmd.endsWith(CommandHistory.ERROR_FLAG)) { + cmd = cmd.substring(0, cmd.indexOf(CommandHistory.ERROR_FLAG)); + consoleDoc.replaceCommand(cmd, true); + } else { + consoleDoc.replaceCommand(cmd, false); + } + } catch (BadLocationException e) { + e.printStackTrace(); + } + } + + void checkCommand() { + String strCommand = consoleDoc.getCommandString(); + if (strCommand.length() == 0) + return; + consoleDoc + .colorCommand(viewer.scriptCheck(strCommand) == null ? consoleDoc.attUserInput + : consoleDoc.attError); + } + + +} + +class ConsoleDocument extends DefaultStyledDocument { + + ConsoleTextPane consoleTextPane; + + SimpleAttributeSet attError; + SimpleAttributeSet attEcho; + SimpleAttributeSet attPrompt; + SimpleAttributeSet attUserInput; + SimpleAttributeSet attStatus; + + ConsoleDocument() { + super(); + + attError = new SimpleAttributeSet(); + StyleConstants.setForeground(attError, Color.red); + + attPrompt = new SimpleAttributeSet(); + StyleConstants.setForeground(attPrompt, Color.magenta); + + attUserInput = new SimpleAttributeSet(); + StyleConstants.setForeground(attUserInput, Color.black); + + attEcho = new SimpleAttributeSet(); + StyleConstants.setForeground(attEcho, Color.blue); + StyleConstants.setBold(attEcho, true); + + attStatus = new SimpleAttributeSet(); + StyleConstants.setForeground(attStatus, Color.black); + StyleConstants.setItalic(attStatus, true); + } + + void setConsoleTextPane(ConsoleTextPane consoleTextPane) { + this.consoleTextPane = consoleTextPane; + } + + Position positionBeforePrompt; // starts at 0, so first time isn't tracked (at least on Mac OS X) + Position positionAfterPrompt; // immediately after $, so this will track + int offsetAfterPrompt; // only still needed for the insertString override and replaceCommand + + /** + * Removes all content of the script window, and add a new prompt. + */ + void clearContent() { + try { + super.remove(0, getLength()); + } catch (BadLocationException exception) { + System.out.println("Could not clear script window content: " + exception.getMessage()); + } + } + + void setPrompt() { + try { + super.insertString(getLength(), "$ ", attPrompt); + setOffsetPositions(); + consoleTextPane.setCaretPosition(offsetAfterPrompt); + } catch (BadLocationException e) { + e.printStackTrace(); + } + } + + void setOffsetPositions() { + try { + offsetAfterPrompt = getLength(); + positionBeforePrompt = createPosition(offsetAfterPrompt - 2); + // after prompt should be immediately after $ otherwise tracks the end + // of the line (and no command will be found) at least on Mac OS X it did. + positionAfterPrompt = createPosition(offsetAfterPrompt - 1); + } catch (BadLocationException e) { + e.printStackTrace(); + } + } + + void setNoPrompt() { + try { + offsetAfterPrompt = getLength(); + positionAfterPrompt = positionBeforePrompt = createPosition(offsetAfterPrompt); + consoleTextPane.setCaretPosition(offsetAfterPrompt); + } catch (BadLocationException e) { + e.printStackTrace(); + } + } + + // it looks like the positionBeforePrompt does not track when it started out as 0 + // and a insertString at location 0 occurs. It may be better to track the + // position after the prompt in stead + void outputBeforePrompt(String str, SimpleAttributeSet attribute) { + try { + int pt = consoleTextPane.getCaretPosition(); + Position caretPosition = createPosition(pt); + pt = positionBeforePrompt.getOffset(); + super.insertString(pt, str+"\n", attribute); + setOffsetPositions(); + pt = caretPosition.getOffset(); + consoleTextPane.setCaretPosition(pt); + } catch (BadLocationException e) { + e.printStackTrace(); + } + } + + void outputError(String strError) { + outputBeforePrompt(strError, attError); + } + + void outputErrorForeground(String strError) { + try { + super.insertString(getLength(), strError+"\n", attError); + consoleTextPane.setCaretPosition(getLength()); + } catch (BadLocationException e) { + e.printStackTrace(); + + } + } + + void outputEcho(String strEcho) { + outputBeforePrompt(strEcho, attEcho); + } + + void outputStatus(String strStatus) { + outputBeforePrompt(strStatus, attStatus); + } + + void appendNewline() { + try { + super.insertString(getLength(), "\n", attUserInput); + consoleTextPane.setCaretPosition(getLength()); + } catch (BadLocationException e) { + e.printStackTrace(); + } + } + + // override the insertString to make sure everything typed ends up at the end + // or in the 'command line' using the proper font, and the newline is processed. + public void insertString(int offs, String str, AttributeSet a) + throws BadLocationException { + int ichNewline = str.indexOf('\n'); + if (ichNewline > 0) + str = str.substring(0, ichNewline); + if (ichNewline != 0) { + if (offs < offsetAfterPrompt) { + offs = getLength(); + } + super.insertString(offs, str, a == attError ? a : attUserInput); + consoleTextPane.setCaretPosition(offs+str.length()); + } + if (ichNewline >= 0) { + consoleTextPane.enterPressed(); + } + } + + String getCommandString() { + String strCommand = ""; + try { + int cmdStart = positionAfterPrompt.getOffset(); + strCommand = getText(cmdStart, getLength() - cmdStart); + while (strCommand.length() > 0 && strCommand.charAt(0) == ' ') + strCommand = strCommand.substring(1); + } catch (BadLocationException e) { + e.printStackTrace(); + } + return strCommand; + } + + public void remove(int offs, int len) + throws BadLocationException { + if (offs < offsetAfterPrompt) { + len -= offsetAfterPrompt - offs; + if (len <= 0) + return; + offs = offsetAfterPrompt; + } + super.remove(offs, len); +// consoleTextPane.setCaretPosition(offs); + } + + public void replace(int offs, int length, String str, AttributeSet attrs) + throws BadLocationException { + if (offs < offsetAfterPrompt) { + if (offs + length < offsetAfterPrompt) { + offs = getLength(); + length = 0; + } else { + length -= offsetAfterPrompt - offs; + offs = offsetAfterPrompt; + } + } + super.replace(offs, length, str, attrs); +// consoleTextPane.setCaretPosition(offs + str.length()); + } + + /** + * Replaces current command on script. + * + * @param newCommand new command value + * @param isError true to set error color ends with #?? + * + * @throws BadLocationException + */ + void replaceCommand(String newCommand, boolean isError) throws BadLocationException { + if (positionAfterPrompt == positionBeforePrompt) + return; + replace(offsetAfterPrompt, getLength() - offsetAfterPrompt, newCommand, + isError ? attError : attUserInput); + } + + void colorCommand(SimpleAttributeSet att) { + if (positionAfterPrompt == positionBeforePrompt) + return; + setCharacterAttributes(offsetAfterPrompt, getLength() - offsetAfterPrompt, att, true); + } +} + +interface EnterListener { + public void enterPressed(); +} + diff --git a/src/jalview/gui/SeqCanvas.java b/src/jalview/gui/SeqCanvas.java index cd7c231..67f1ce0 100755 --- a/src/jalview/gui/SeqCanvas.java +++ b/src/jalview/gui/SeqCanvas.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/gui/SeqPanel.java b/src/jalview/gui/SeqPanel.java index 7d451da..2b919e0 100755 --- a/src/jalview/gui/SeqPanel.java +++ b/src/jalview/gui/SeqPanel.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/gui/SequenceFetcher.java b/src/jalview/gui/SequenceFetcher.java index f594554..37bfc00 100755 --- a/src/jalview/gui/SequenceFetcher.java +++ b/src/jalview/gui/SequenceFetcher.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/gui/SequenceRenderer.java b/src/jalview/gui/SequenceRenderer.java index 70f67d7..25bcb6d 100755 --- a/src/jalview/gui/SequenceRenderer.java +++ b/src/jalview/gui/SequenceRenderer.java @@ -1,434 +1,434 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.gui; - -import java.awt.*; - -import jalview.datamodel.*; -import jalview.schemes.*; - -/** - * DOCUMENT ME! - * - * @author $author$ - * @version $Revision$ - */ -public class SequenceRenderer -{ - AlignViewport av; - FontMetrics fm; - boolean renderGaps = true; - SequenceGroup currentSequenceGroup = null; - SequenceGroup[] allGroups = null; - Color resBoxColour; - Graphics graphics; - boolean monospacedFont; - boolean forOverview = false; - - /** - * Creates a new SequenceRenderer object. - * - * @param av DOCUMENT ME! - */ - public SequenceRenderer(AlignViewport av) - { - this.av = av; - } - - /** - * DOCUMENT ME! - * - * @param b DOCUMENT ME! - */ - public void prepare(Graphics g, boolean renderGaps) - { - graphics = g; - fm = g.getFontMetrics(); - - // If EPS graphics, stringWidth will be a double, not an int - double dwidth = fm.getStringBounds("M", g).getWidth(); - - monospacedFont = - (dwidth == fm.getStringBounds("|", g).getWidth() - && (float) av.charWidth == dwidth); - - this.renderGaps = renderGaps; - } - - public Color getResidueBoxColour(SequenceI seq, int i) - { - allGroups = av.alignment.findAllGroups(seq); - - if (inCurrentSequenceGroup(i)) - { - if (currentSequenceGroup.getDisplayBoxes()) - { - getBoxColour(currentSequenceGroup.cs, seq, i); - } - } - else if (av.getShowBoxes()) - { - getBoxColour(av.globalColourScheme, seq, i); - } - - return resBoxColour; - } - - /** - * DOCUMENT ME! - * - * @param cs DOCUMENT ME! - * @param seq DOCUMENT ME! - * @param i DOCUMENT ME! - */ - void getBoxColour(ColourSchemeI cs, SequenceI seq, int i) - { - if (cs != null) - { - resBoxColour = cs.findColour(seq.getCharAt(i), i); - } - else if (forOverview && !jalview.util.Comparison.isGap(seq.getCharAt(i))) - { - resBoxColour = Color.lightGray; - } - else - { - resBoxColour = Color.white; - } - } - - /** - * DOCUMENT ME! - * - * @param g DOCUMENT ME! - * @param seq DOCUMENT ME! - * @param sg DOCUMENT ME! - * @param start DOCUMENT ME! - * @param end DOCUMENT ME! - * @param x1 DOCUMENT ME! - * @param y1 DOCUMENT ME! - * @param width DOCUMENT ME! - * @param height DOCUMENT ME! - */ - public void drawSequence(SequenceI seq, SequenceGroup[] sg, - int start, int end, int y1) - { - allGroups = sg; - - drawBoxes(seq, start, end, y1); - - if (av.validCharWidth) - { - drawText(seq, start, end, y1); - } - } - - /** - * DOCUMENT ME! - * - * @param seq DOCUMENT ME! - * @param start DOCUMENT ME! - * @param end DOCUMENT ME! - * @param x1 DOCUMENT ME! - * @param y1 DOCUMENT ME! - * @param width DOCUMENT ME! - * @param height DOCUMENT ME! - */ - public synchronized void drawBoxes(SequenceI seq, int start, int end, int y1) - { - int i = start; - int length = seq.getLength(); - - int curStart = -1; - int curWidth = av.charWidth; - - Color tempColour = null; - - while (i <= end) - { - resBoxColour = Color.white; - - if (i < length) - { - if (inCurrentSequenceGroup(i)) - { - if (currentSequenceGroup.getDisplayBoxes()) - { - getBoxColour(currentSequenceGroup.cs, seq, i); - } - } - else if (av.getShowBoxes()) - { - getBoxColour(av.globalColourScheme, seq, i); - } - - } - - if (resBoxColour != tempColour) - { - if (tempColour != null) - { - graphics.fillRect(av.charWidth * (curStart - start), y1, - curWidth, av.charHeight); - } - - graphics.setColor(resBoxColour); - - curStart = i; - curWidth = av.charWidth; - tempColour = resBoxColour; - } - else - { - curWidth += av.charWidth; - } - - i++; - } - - graphics.fillRect(av.charWidth * (curStart - start), y1, curWidth, - av.charHeight); - - } - - /** - * DOCUMENT ME! - * - * @param seq DOCUMENT ME! - * @param start DOCUMENT ME! - * @param end DOCUMENT ME! - * @param x1 DOCUMENT ME! - * @param y1 DOCUMENT ME! - * @param width DOCUMENT ME! - * @param height DOCUMENT ME! - */ - public void drawText(SequenceI seq, int start, int end, int y1) - { - y1 += av.charHeight - av.charHeight / 5; // height/5 replaces pady - int charOffset = 0; - char s; - - if (end + 1 >= seq.getLength()) - { - end = seq.getLength() - 1; - } - graphics.setColor(av.textColour); - - if (monospacedFont - && av.showText - && allGroups.length == 0 - && !av.getColourText() - && av.thresholdTextColour == 0) - { - if (av.renderGaps) - { - graphics.drawString(seq.getSequenceAsString(start, end + 1), 0, y1); - } - else - { - char gap = av.getGapCharacter(); - graphics.drawString(seq.getSequenceAsString(start, end + 1).replace(gap, - ' '), 0, y1); - } - } - else - { - boolean getboxColour = false; - for (int i = start; i <= end; i++) - { - graphics.setColor(av.textColour); - getboxColour = false; - s = seq.getCharAt(i); - if (!renderGaps && jalview.util.Comparison.isGap(s)) - { - continue; - } - - if (inCurrentSequenceGroup(i)) - { - if (!currentSequenceGroup.getDisplayText()) - { - continue; - } - - if (currentSequenceGroup.thresholdTextColour > 0 - || currentSequenceGroup.getColourText()) - { - getboxColour = true; - getBoxColour(currentSequenceGroup.cs, seq, i); - - if (currentSequenceGroup.getColourText()) - { - graphics.setColor(resBoxColour.darker()); - } - - if (currentSequenceGroup.thresholdTextColour > 0) - { - if (resBoxColour.getRed() + - resBoxColour.getBlue() + - resBoxColour.getGreen() < - currentSequenceGroup.thresholdTextColour) - { - graphics.setColor(currentSequenceGroup.textColour2); - } - } - } - else - { - graphics.setColor(currentSequenceGroup.textColour); - } - - } - else - { - if (!av.getShowText()) - { - continue; - } - - if (av.getColourText()) - { - getboxColour = true; - getBoxColour(av.globalColourScheme, seq, i); - - if (av.getShowBoxes()) - { - graphics.setColor(resBoxColour.darker()); - } - else - { - graphics.setColor(resBoxColour); - } - } - - if (av.thresholdTextColour > 0) - { - if (!getboxColour) - { - getBoxColour(av.globalColourScheme, seq, i); - } - - if (resBoxColour.getRed() + - resBoxColour.getBlue() + - resBoxColour.getGreen() < av.thresholdTextColour) - { - graphics.setColor(av.textColour2); - } - } - - } - - charOffset = (av.charWidth - fm.charWidth(s)) / 2; - graphics.drawString(String.valueOf(s), - charOffset + av.charWidth * (i - start), - y1); - - } - } - } - - /** - * DOCUMENT ME! - * - * @param res DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - boolean inCurrentSequenceGroup(int res) - { - if (allGroups == null) - { - return false; - } - - for (int i = 0; i < allGroups.length; i++) - { - if ( (allGroups[i].getStartRes() <= res) && - (allGroups[i].getEndRes() >= res)) - { - currentSequenceGroup = allGroups[i]; - - return true; - } - } - - return false; - } - - /** - * DOCUMENT ME! - * - * @param seq DOCUMENT ME! - * @param start DOCUMENT ME! - * @param end DOCUMENT ME! - * @param x1 DOCUMENT ME! - * @param y1 DOCUMENT ME! - * @param width DOCUMENT ME! - * @param height DOCUMENT ME! - */ - public void drawHighlightedText(SequenceI seq, int start, int end, int x1, - int y1) - { - int pady = av.charHeight / 5; - int charOffset = 0; - graphics.setColor(Color.BLACK); - graphics.fillRect(x1, y1, av.charWidth * (end - start + 1), av.charHeight); - graphics.setColor(Color.white); - - char s = '~'; - - // Need to find the sequence position here. - if (av.validCharWidth) - { - for (int i = start; i <= end; i++) - { - if (i < seq.getLength()) - { - s = seq.getCharAt(i); - } - - charOffset = (av.charWidth - fm.charWidth(s)) / 2; - graphics.drawString(String.valueOf(s), - charOffset + x1 + (av.charWidth * (i - start)), - (y1 + av.charHeight) - pady); - } - } - } - - public void drawCursor(SequenceI seq, int res, int x1, int y1) - { - int pady = av.charHeight / 5; - int charOffset = 0; - graphics.setColor(Color.black); - graphics.fillRect(x1, y1, av.charWidth, av.charHeight); - - if (av.validCharWidth) - { - graphics.setColor(Color.white); - - char s = seq.getCharAt(res); - - charOffset = (av.charWidth - fm.charWidth(s)) / 2; - graphics.drawString(String.valueOf(s), - charOffset + x1, - (y1 + av.charHeight) - pady); - } - - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.gui; + +import java.awt.*; + +import jalview.datamodel.*; +import jalview.schemes.*; + +/** + * DOCUMENT ME! + * + * @author $author$ + * @version $Revision$ + */ +public class SequenceRenderer +{ + AlignViewport av; + FontMetrics fm; + boolean renderGaps = true; + SequenceGroup currentSequenceGroup = null; + SequenceGroup[] allGroups = null; + Color resBoxColour; + Graphics graphics; + boolean monospacedFont; + boolean forOverview = false; + + /** + * Creates a new SequenceRenderer object. + * + * @param av DOCUMENT ME! + */ + public SequenceRenderer(AlignViewport av) + { + this.av = av; + } + + /** + * DOCUMENT ME! + * + * @param b DOCUMENT ME! + */ + public void prepare(Graphics g, boolean renderGaps) + { + graphics = g; + fm = g.getFontMetrics(); + + // If EPS graphics, stringWidth will be a double, not an int + double dwidth = fm.getStringBounds("M", g).getWidth(); + + monospacedFont = + (dwidth == fm.getStringBounds("|", g).getWidth() + && (float) av.charWidth == dwidth); + + this.renderGaps = renderGaps; + } + + public Color getResidueBoxColour(SequenceI seq, int i) + { + allGroups = av.alignment.findAllGroups(seq); + + if (inCurrentSequenceGroup(i)) + { + if (currentSequenceGroup.getDisplayBoxes()) + { + getBoxColour(currentSequenceGroup.cs, seq, i); + } + } + else if (av.getShowBoxes()) + { + getBoxColour(av.globalColourScheme, seq, i); + } + + return resBoxColour; + } + + /** + * DOCUMENT ME! + * + * @param cs DOCUMENT ME! + * @param seq DOCUMENT ME! + * @param i DOCUMENT ME! + */ + void getBoxColour(ColourSchemeI cs, SequenceI seq, int i) + { + if (cs != null) + { + resBoxColour = cs.findColour(seq.getCharAt(i), i); + } + else if (forOverview && !jalview.util.Comparison.isGap(seq.getCharAt(i))) + { + resBoxColour = Color.lightGray; + } + else + { + resBoxColour = Color.white; + } + } + + /** + * DOCUMENT ME! + * + * @param g DOCUMENT ME! + * @param seq DOCUMENT ME! + * @param sg DOCUMENT ME! + * @param start DOCUMENT ME! + * @param end DOCUMENT ME! + * @param x1 DOCUMENT ME! + * @param y1 DOCUMENT ME! + * @param width DOCUMENT ME! + * @param height DOCUMENT ME! + */ + public void drawSequence(SequenceI seq, SequenceGroup[] sg, + int start, int end, int y1) + { + allGroups = sg; + + drawBoxes(seq, start, end, y1); + + if (av.validCharWidth) + { + drawText(seq, start, end, y1); + } + } + + /** + * DOCUMENT ME! + * + * @param seq DOCUMENT ME! + * @param start DOCUMENT ME! + * @param end DOCUMENT ME! + * @param x1 DOCUMENT ME! + * @param y1 DOCUMENT ME! + * @param width DOCUMENT ME! + * @param height DOCUMENT ME! + */ + public synchronized void drawBoxes(SequenceI seq, int start, int end, int y1) + { + int i = start; + int length = seq.getLength(); + + int curStart = -1; + int curWidth = av.charWidth; + + Color tempColour = null; + + while (i <= end) + { + resBoxColour = Color.white; + + if (i < length) + { + if (inCurrentSequenceGroup(i)) + { + if (currentSequenceGroup.getDisplayBoxes()) + { + getBoxColour(currentSequenceGroup.cs, seq, i); + } + } + else if (av.getShowBoxes()) + { + getBoxColour(av.globalColourScheme, seq, i); + } + + } + + if (resBoxColour != tempColour) + { + if (tempColour != null) + { + graphics.fillRect(av.charWidth * (curStart - start), y1, + curWidth, av.charHeight); + } + + graphics.setColor(resBoxColour); + + curStart = i; + curWidth = av.charWidth; + tempColour = resBoxColour; + } + else + { + curWidth += av.charWidth; + } + + i++; + } + + graphics.fillRect(av.charWidth * (curStart - start), y1, curWidth, + av.charHeight); + + } + + /** + * DOCUMENT ME! + * + * @param seq DOCUMENT ME! + * @param start DOCUMENT ME! + * @param end DOCUMENT ME! + * @param x1 DOCUMENT ME! + * @param y1 DOCUMENT ME! + * @param width DOCUMENT ME! + * @param height DOCUMENT ME! + */ + public void drawText(SequenceI seq, int start, int end, int y1) + { + y1 += av.charHeight - av.charHeight / 5; // height/5 replaces pady + int charOffset = 0; + char s; + + if (end + 1 >= seq.getLength()) + { + end = seq.getLength() - 1; + } + graphics.setColor(av.textColour); + + if (monospacedFont + && av.showText + && allGroups.length == 0 + && !av.getColourText() + && av.thresholdTextColour == 0) + { + if (av.renderGaps) + { + graphics.drawString(seq.getSequenceAsString(start, end + 1), 0, y1); + } + else + { + char gap = av.getGapCharacter(); + graphics.drawString(seq.getSequenceAsString(start, end + 1).replace(gap, + ' '), 0, y1); + } + } + else + { + boolean getboxColour = false; + for (int i = start; i <= end; i++) + { + graphics.setColor(av.textColour); + getboxColour = false; + s = seq.getCharAt(i); + if (!renderGaps && jalview.util.Comparison.isGap(s)) + { + continue; + } + + if (inCurrentSequenceGroup(i)) + { + if (!currentSequenceGroup.getDisplayText()) + { + continue; + } + + if (currentSequenceGroup.thresholdTextColour > 0 + || currentSequenceGroup.getColourText()) + { + getboxColour = true; + getBoxColour(currentSequenceGroup.cs, seq, i); + + if (currentSequenceGroup.getColourText()) + { + graphics.setColor(resBoxColour.darker()); + } + + if (currentSequenceGroup.thresholdTextColour > 0) + { + if (resBoxColour.getRed() + + resBoxColour.getBlue() + + resBoxColour.getGreen() < + currentSequenceGroup.thresholdTextColour) + { + graphics.setColor(currentSequenceGroup.textColour2); + } + } + } + else + { + graphics.setColor(currentSequenceGroup.textColour); + } + + } + else + { + if (!av.getShowText()) + { + continue; + } + + if (av.getColourText()) + { + getboxColour = true; + getBoxColour(av.globalColourScheme, seq, i); + + if (av.getShowBoxes()) + { + graphics.setColor(resBoxColour.darker()); + } + else + { + graphics.setColor(resBoxColour); + } + } + + if (av.thresholdTextColour > 0) + { + if (!getboxColour) + { + getBoxColour(av.globalColourScheme, seq, i); + } + + if (resBoxColour.getRed() + + resBoxColour.getBlue() + + resBoxColour.getGreen() < av.thresholdTextColour) + { + graphics.setColor(av.textColour2); + } + } + + } + + charOffset = (av.charWidth - fm.charWidth(s)) / 2; + graphics.drawString(String.valueOf(s), + charOffset + av.charWidth * (i - start), + y1); + + } + } + } + + /** + * DOCUMENT ME! + * + * @param res DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + boolean inCurrentSequenceGroup(int res) + { + if (allGroups == null) + { + return false; + } + + for (int i = 0; i < allGroups.length; i++) + { + if ( (allGroups[i].getStartRes() <= res) && + (allGroups[i].getEndRes() >= res)) + { + currentSequenceGroup = allGroups[i]; + + return true; + } + } + + return false; + } + + /** + * DOCUMENT ME! + * + * @param seq DOCUMENT ME! + * @param start DOCUMENT ME! + * @param end DOCUMENT ME! + * @param x1 DOCUMENT ME! + * @param y1 DOCUMENT ME! + * @param width DOCUMENT ME! + * @param height DOCUMENT ME! + */ + public void drawHighlightedText(SequenceI seq, int start, int end, int x1, + int y1) + { + int pady = av.charHeight / 5; + int charOffset = 0; + graphics.setColor(Color.BLACK); + graphics.fillRect(x1, y1, av.charWidth * (end - start + 1), av.charHeight); + graphics.setColor(Color.white); + + char s = '~'; + + // Need to find the sequence position here. + if (av.validCharWidth) + { + for (int i = start; i <= end; i++) + { + if (i < seq.getLength()) + { + s = seq.getCharAt(i); + } + + charOffset = (av.charWidth - fm.charWidth(s)) / 2; + graphics.drawString(String.valueOf(s), + charOffset + x1 + (av.charWidth * (i - start)), + (y1 + av.charHeight) - pady); + } + } + } + + public void drawCursor(SequenceI seq, int res, int x1, int y1) + { + int pady = av.charHeight / 5; + int charOffset = 0; + graphics.setColor(Color.black); + graphics.fillRect(x1, y1, av.charWidth, av.charHeight); + + if (av.validCharWidth) + { + graphics.setColor(Color.white); + + char s = seq.getCharAt(res); + + charOffset = (av.charWidth - fm.charWidth(s)) / 2; + graphics.drawString(String.valueOf(s), + charOffset + x1, + (y1 + av.charHeight) - pady); + } + + } +} diff --git a/src/jalview/gui/SliderPanel.java b/src/jalview/gui/SliderPanel.java index 23b76e3..315935b 100755 --- a/src/jalview/gui/SliderPanel.java +++ b/src/jalview/gui/SliderPanel.java @@ -1,359 +1,359 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.gui; - -import java.util.*; - -import java.awt.event.*; -import javax.swing.*; -import javax.swing.event.*; - -import jalview.datamodel.*; -import jalview.jbgui.*; -import jalview.schemes.*; - -/** - * DOCUMENT ME! - * - * @author $author$ - * @version $Revision$ - */ -public class SliderPanel - extends GSliderPanel -{ - static JInternalFrame conservationSlider; - static JInternalFrame PIDSlider; - AlignmentPanel ap; - boolean forConservation = true; - ColourSchemeI cs; - - /** - * Creates a new SliderPanel object. - * - * @param ap DOCUMENT ME! - * @param value DOCUMENT ME! - * @param forConserve DOCUMENT ME! - * @param cs DOCUMENT ME! - */ - public SliderPanel(final AlignmentPanel ap, int value, boolean forConserve, - ColourSchemeI cs) - { - this.ap = ap; - this.cs = cs; - forConservation = forConserve; - undoButton.setVisible(false); - applyButton.setVisible(false); - - if (forConservation) - { - label.setText("Enter value to increase conservation visibility"); - slider.setMinimum(0); - slider.setMaximum(100); - } - else - { - label.setText("Enter % identity above which to colour residues"); - slider.setMinimum(0); - slider.setMaximum(100); - } - - slider.addChangeListener(new ChangeListener() - { - public void stateChanged(ChangeEvent evt) - { - valueField.setText(slider.getValue() + ""); - valueChanged(slider.getValue()); - } - }); - - slider.addMouseListener(new MouseAdapter() - { - public void mouseReleased(MouseEvent evt) - { - ap.paintAlignment(true); - } - }); - - slider.setValue(value); - valueField.setText(value + ""); - } - - /** - * DOCUMENT ME! - * - * @param ap DOCUMENT ME! - * @param cs DOCUMENT ME! - * @param source DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public static int setConservationSlider(AlignmentPanel ap, - ColourSchemeI cs, String source) - { - SliderPanel sp = null; - - if (conservationSlider == null) - { - sp = new SliderPanel(ap, cs.getConservationInc(), true, cs); - conservationSlider = new JInternalFrame(); - conservationSlider.setContentPane(sp); - conservationSlider.setLayer(JLayeredPane.PALETTE_LAYER); - } - else - { - sp = (SliderPanel) conservationSlider.getContentPane(); - sp.cs = cs; - } - - conservationSlider.setTitle("Conservation Colour Increment (" + - source + ")"); - - if (ap.av.alignment.getGroups() != null) - { - sp.setAllGroupsCheckEnabled(true); - } - else - { - sp.setAllGroupsCheckEnabled(false); - } - - return sp.getValue(); - } - - /** - * DOCUMENT ME! - */ - public static void showConservationSlider() - { - try - { - PIDSlider.setClosed(true); - PIDSlider = null; - } - catch (Exception ex) - { - } - - if (!conservationSlider.isVisible()) - { - Desktop.addInternalFrame(conservationSlider, - conservationSlider.getTitle(), 420, 90, false); - conservationSlider.addInternalFrameListener(new javax.swing.event. - InternalFrameAdapter() - { - public void internalFrameClosed( - javax.swing.event.InternalFrameEvent e) - { - conservationSlider = null; - } - }); - conservationSlider.setLayer(JLayeredPane.PALETTE_LAYER); - } - } - - /** - * DOCUMENT ME! - * - * @param ap DOCUMENT ME! - * @param cs DOCUMENT ME! - * @param source DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public static int setPIDSliderSource(AlignmentPanel ap, ColourSchemeI cs, - String source) - { - SliderPanel pid = null; - - int threshold = cs.getThreshold(); - - if (PIDSlider == null) - { - pid = new SliderPanel(ap, threshold, false, cs); - PIDSlider = new JInternalFrame(); - PIDSlider.setContentPane(pid); - PIDSlider.setLayer(JLayeredPane.PALETTE_LAYER); - } - else - { - pid = (SliderPanel) PIDSlider.getContentPane(); - pid.cs = cs; - } - - PIDSlider.setTitle("Percentage Identity Threshold (" + source + ")"); - - if (ap.av.alignment.getGroups() != null) - { - pid.setAllGroupsCheckEnabled(true); - } - else - { - pid.setAllGroupsCheckEnabled(false); - } - - return pid.getValue(); - } - - /** - * DOCUMENT ME! - */ - public static void showPIDSlider() - { - try - { - conservationSlider.setClosed(true); - conservationSlider = null; - } - catch (Exception ex) - { - } - - if (!PIDSlider.isVisible()) - { - Desktop.addInternalFrame(PIDSlider, PIDSlider.getTitle(), 420, 90, - false); - PIDSlider.setLayer(JLayeredPane.PALETTE_LAYER); - PIDSlider.addInternalFrameListener(new javax.swing.event. - InternalFrameAdapter() - { - public void internalFrameClosed( - javax.swing.event.InternalFrameEvent e) - { - PIDSlider = null; - } - }); - PIDSlider.setLayer(JLayeredPane.PALETTE_LAYER); - } - } - - /** - * DOCUMENT ME! - * - * @param i DOCUMENT ME! - */ - public void valueChanged(int i) - { - if (cs == null) - { - return; - } - - ColourSchemeI toChange = null; - Vector allGroups = null; - int groupIndex = 0; - - if (allGroupsCheck.isSelected()) - { - allGroups = ap.av.alignment.getGroups(); - groupIndex = allGroups.size() - 1; - } - else - { - toChange = cs; - } - - while (groupIndex > -1) - { - if (allGroups != null) - { - toChange = ( (SequenceGroup) allGroups.get(groupIndex)).cs; - - if (toChange == null) - { - groupIndex--; - - continue; - } - } - - if (forConservation) - { - if (toChange.conservationApplied()) - { - toChange.setConservationInc(i); - } - } - else - { - toChange.setThreshold(i, ap.av.getIgnoreGapsConsensus()); - } - - groupIndex--; - } - - ap.seqPanel.seqCanvas.repaint(); - } - - /** - * DOCUMENT ME! - * - * @param b DOCUMENT ME! - */ - public void setAllGroupsCheckEnabled(boolean b) - { - allGroupsCheck.setEnabled(b); - } - - /** - * DOCUMENT ME! - * - * @param e DOCUMENT ME! - */ - public void valueField_actionPerformed(ActionEvent e) - { - try - { - int i = Integer.parseInt(valueField.getText()); - slider.setValue(i); - } - catch (NumberFormatException ex) - { - valueField.setText(slider.getValue() + ""); - } - } - - /** - * DOCUMENT ME! - * - * @param value DOCUMENT ME! - */ - public void setValue(int value) - { - slider.setValue(value); - } - - /** - * DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public int getValue() - { - return Integer.parseInt(valueField.getText()); - } - - public void slider_mouseReleased(MouseEvent e) - { - if (ap.overviewPanel != null) - { - ap.overviewPanel.updateOverviewImage(); - } - } - -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.gui; + +import java.util.*; + +import java.awt.event.*; +import javax.swing.*; +import javax.swing.event.*; + +import jalview.datamodel.*; +import jalview.jbgui.*; +import jalview.schemes.*; + +/** + * DOCUMENT ME! + * + * @author $author$ + * @version $Revision$ + */ +public class SliderPanel + extends GSliderPanel +{ + static JInternalFrame conservationSlider; + static JInternalFrame PIDSlider; + AlignmentPanel ap; + boolean forConservation = true; + ColourSchemeI cs; + + /** + * Creates a new SliderPanel object. + * + * @param ap DOCUMENT ME! + * @param value DOCUMENT ME! + * @param forConserve DOCUMENT ME! + * @param cs DOCUMENT ME! + */ + public SliderPanel(final AlignmentPanel ap, int value, boolean forConserve, + ColourSchemeI cs) + { + this.ap = ap; + this.cs = cs; + forConservation = forConserve; + undoButton.setVisible(false); + applyButton.setVisible(false); + + if (forConservation) + { + label.setText("Enter value to increase conservation visibility"); + slider.setMinimum(0); + slider.setMaximum(100); + } + else + { + label.setText("Enter % identity above which to colour residues"); + slider.setMinimum(0); + slider.setMaximum(100); + } + + slider.addChangeListener(new ChangeListener() + { + public void stateChanged(ChangeEvent evt) + { + valueField.setText(slider.getValue() + ""); + valueChanged(slider.getValue()); + } + }); + + slider.addMouseListener(new MouseAdapter() + { + public void mouseReleased(MouseEvent evt) + { + ap.paintAlignment(true); + } + }); + + slider.setValue(value); + valueField.setText(value + ""); + } + + /** + * DOCUMENT ME! + * + * @param ap DOCUMENT ME! + * @param cs DOCUMENT ME! + * @param source DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public static int setConservationSlider(AlignmentPanel ap, + ColourSchemeI cs, String source) + { + SliderPanel sp = null; + + if (conservationSlider == null) + { + sp = new SliderPanel(ap, cs.getConservationInc(), true, cs); + conservationSlider = new JInternalFrame(); + conservationSlider.setContentPane(sp); + conservationSlider.setLayer(JLayeredPane.PALETTE_LAYER); + } + else + { + sp = (SliderPanel) conservationSlider.getContentPane(); + sp.cs = cs; + } + + conservationSlider.setTitle("Conservation Colour Increment (" + + source + ")"); + + if (ap.av.alignment.getGroups() != null) + { + sp.setAllGroupsCheckEnabled(true); + } + else + { + sp.setAllGroupsCheckEnabled(false); + } + + return sp.getValue(); + } + + /** + * DOCUMENT ME! + */ + public static void showConservationSlider() + { + try + { + PIDSlider.setClosed(true); + PIDSlider = null; + } + catch (Exception ex) + { + } + + if (!conservationSlider.isVisible()) + { + Desktop.addInternalFrame(conservationSlider, + conservationSlider.getTitle(), 420, 90, false); + conservationSlider.addInternalFrameListener(new javax.swing.event. + InternalFrameAdapter() + { + public void internalFrameClosed( + javax.swing.event.InternalFrameEvent e) + { + conservationSlider = null; + } + }); + conservationSlider.setLayer(JLayeredPane.PALETTE_LAYER); + } + } + + /** + * DOCUMENT ME! + * + * @param ap DOCUMENT ME! + * @param cs DOCUMENT ME! + * @param source DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public static int setPIDSliderSource(AlignmentPanel ap, ColourSchemeI cs, + String source) + { + SliderPanel pid = null; + + int threshold = cs.getThreshold(); + + if (PIDSlider == null) + { + pid = new SliderPanel(ap, threshold, false, cs); + PIDSlider = new JInternalFrame(); + PIDSlider.setContentPane(pid); + PIDSlider.setLayer(JLayeredPane.PALETTE_LAYER); + } + else + { + pid = (SliderPanel) PIDSlider.getContentPane(); + pid.cs = cs; + } + + PIDSlider.setTitle("Percentage Identity Threshold (" + source + ")"); + + if (ap.av.alignment.getGroups() != null) + { + pid.setAllGroupsCheckEnabled(true); + } + else + { + pid.setAllGroupsCheckEnabled(false); + } + + return pid.getValue(); + } + + /** + * DOCUMENT ME! + */ + public static void showPIDSlider() + { + try + { + conservationSlider.setClosed(true); + conservationSlider = null; + } + catch (Exception ex) + { + } + + if (!PIDSlider.isVisible()) + { + Desktop.addInternalFrame(PIDSlider, PIDSlider.getTitle(), 420, 90, + false); + PIDSlider.setLayer(JLayeredPane.PALETTE_LAYER); + PIDSlider.addInternalFrameListener(new javax.swing.event. + InternalFrameAdapter() + { + public void internalFrameClosed( + javax.swing.event.InternalFrameEvent e) + { + PIDSlider = null; + } + }); + PIDSlider.setLayer(JLayeredPane.PALETTE_LAYER); + } + } + + /** + * DOCUMENT ME! + * + * @param i DOCUMENT ME! + */ + public void valueChanged(int i) + { + if (cs == null) + { + return; + } + + ColourSchemeI toChange = null; + Vector allGroups = null; + int groupIndex = 0; + + if (allGroupsCheck.isSelected()) + { + allGroups = ap.av.alignment.getGroups(); + groupIndex = allGroups.size() - 1; + } + else + { + toChange = cs; + } + + while (groupIndex > -1) + { + if (allGroups != null) + { + toChange = ( (SequenceGroup) allGroups.get(groupIndex)).cs; + + if (toChange == null) + { + groupIndex--; + + continue; + } + } + + if (forConservation) + { + if (toChange.conservationApplied()) + { + toChange.setConservationInc(i); + } + } + else + { + toChange.setThreshold(i, ap.av.getIgnoreGapsConsensus()); + } + + groupIndex--; + } + + ap.seqPanel.seqCanvas.repaint(); + } + + /** + * DOCUMENT ME! + * + * @param b DOCUMENT ME! + */ + public void setAllGroupsCheckEnabled(boolean b) + { + allGroupsCheck.setEnabled(b); + } + + /** + * DOCUMENT ME! + * + * @param e DOCUMENT ME! + */ + public void valueField_actionPerformed(ActionEvent e) + { + try + { + int i = Integer.parseInt(valueField.getText()); + slider.setValue(i); + } + catch (NumberFormatException ex) + { + valueField.setText(slider.getValue() + ""); + } + } + + /** + * DOCUMENT ME! + * + * @param value DOCUMENT ME! + */ + public void setValue(int value) + { + slider.setValue(value); + } + + /** + * DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public int getValue() + { + return Integer.parseInt(valueField.getText()); + } + + public void slider_mouseReleased(MouseEvent e) + { + if (ap.overviewPanel != null) + { + ap.overviewPanel.updateOverviewImage(); + } + } + +} diff --git a/src/jalview/gui/SplashScreen.java b/src/jalview/gui/SplashScreen.java index b72cc61..031e930 100755 --- a/src/jalview/gui/SplashScreen.java +++ b/src/jalview/gui/SplashScreen.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/gui/TextColourChooser.java b/src/jalview/gui/TextColourChooser.java index 8dd9d49..2f887cb 100644 --- a/src/jalview/gui/TextColourChooser.java +++ b/src/jalview/gui/TextColourChooser.java @@ -1,213 +1,212 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -package jalview.gui; - -import java.util.*; - -import java.awt.*; -import java.awt.event.*; -import javax.swing.*; -import javax.swing.event.*; - -import jalview.datamodel.*; - -public class TextColourChooser -{ - AlignmentPanel ap; - SequenceGroup sg; - - public void chooseColour(AlignmentPanel ap, SequenceGroup sg) - { - this.ap = ap; - this.sg = sg; - - int original1, original2, originalThreshold; - if (sg == null) - { - original1 = ap.av.textColour.getRGB(); - original2 = ap.av.textColour2.getRGB(); - originalThreshold = ap.av.thresholdTextColour; - } - else - { - original1 = sg.textColour.getRGB(); - original2 = sg.textColour2.getRGB(); - originalThreshold = sg.thresholdTextColour; - } - - final JSlider slider = new JSlider(0, 750, originalThreshold); - final JPanel col1 = new JPanel(); - col1.setPreferredSize(new Dimension(40, 20)); - col1.setBorder(BorderFactory.createEtchedBorder()); - col1.setToolTipText("Dark Colour"); - col1.setBackground(new Color(original1)); - final JPanel col2 = new JPanel(); - col2.setPreferredSize(new Dimension(40, 20)); - col2.setBorder(BorderFactory.createEtchedBorder()); - col2.setToolTipText("Light Colour"); - col2.setBackground(new Color(original2)); - final JPanel bigpanel = new JPanel(new BorderLayout()); - JPanel panel = new JPanel(); - bigpanel.add(panel, BorderLayout.CENTER); - bigpanel.add(new JLabel( - "Select a dark and light text colour, then set the threshold to" - + "
switch between colours, based on background colour
"), - BorderLayout.NORTH); - panel.add(col1); - panel.add(slider); - panel.add(col2); - - col1.addMouseListener(new MouseAdapter() - { - public void mousePressed(MouseEvent e) - { - Color col = JColorChooser.showDialog(bigpanel, - "Select Colour for Text", - col1.getBackground()); - if (col != null) - { - colour1Changed(col); - col1.setBackground(col); - } - } - }); - - col2.addMouseListener(new MouseAdapter() - { - public void mousePressed(MouseEvent e) - { - Color col = JColorChooser.showDialog(bigpanel, - "Select Colour for Text", - col2.getBackground()); - if (col != null) - { - colour2Changed(col); - col2.setBackground(col); - } - } - }); - - slider.addChangeListener(new ChangeListener() - { - public void stateChanged(ChangeEvent evt) - { - thresholdChanged(slider.getValue()); - } - }); - - int reply = JOptionPane.showInternalOptionDialog( - ap, - bigpanel, - "Adjust Foreground Text Colour Threshold", - JOptionPane.OK_CANCEL_OPTION, - JOptionPane.QUESTION_MESSAGE, - null, - null, null); - - if (reply == JOptionPane.CANCEL_OPTION) - { - if (sg == null) - { - ap.av.textColour = new Color(original1); - ap.av.textColour2 = new Color(original2); - ap.av.thresholdTextColour = originalThreshold; - } - else - { - sg.textColour = new Color(original1); - sg.textColour2 = new Color(original2); - sg.thresholdTextColour = originalThreshold; - } - } - } - - void colour1Changed(Color col) - { - if (sg == null) - { - ap.av.textColour = col; - if (ap.av.colourAppliesToAllGroups) - { - setGroupTextColour(); - } - } - else - { - sg.textColour = col; - } - - ap.paintAlignment(true); - } - - void colour2Changed(Color col) - { - if (sg == null) - { - ap.av.textColour2 = col; - if (ap.av.colourAppliesToAllGroups) - { - setGroupTextColour(); - } - } - else - { - sg.textColour2 = col; - } - - ap.paintAlignment(true); - } - - void thresholdChanged(int value) - { - if (sg == null) - { - ap.av.thresholdTextColour = value; - if (ap.av.colourAppliesToAllGroups) - { - setGroupTextColour(); - } - } - else - { - sg.thresholdTextColour = value; - } - - ap.paintAlignment(true); - } - - void setGroupTextColour() - { - if (ap.av.alignment.getGroups() == null) - { - return; - } - - Vector groups = ap.av.alignment.getGroups(); - - for (int i = 0; i < groups.size(); i++) - { - SequenceGroup sg = (SequenceGroup) groups.elementAt(i); - sg.textColour = ap.av.textColour; - sg.textColour2 = ap.av.textColour2; - sg.thresholdTextColour = ap.av.thresholdTextColour; - } - } - -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.gui; + +import java.util.*; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +import javax.swing.event.*; + +import jalview.datamodel.*; + +public class TextColourChooser +{ + AlignmentPanel ap; + SequenceGroup sg; + + public void chooseColour(AlignmentPanel ap, SequenceGroup sg) + { + this.ap = ap; + this.sg = sg; + + int original1, original2, originalThreshold; + if (sg == null) + { + original1 = ap.av.textColour.getRGB(); + original2 = ap.av.textColour2.getRGB(); + originalThreshold = ap.av.thresholdTextColour; + } + else + { + original1 = sg.textColour.getRGB(); + original2 = sg.textColour2.getRGB(); + originalThreshold = sg.thresholdTextColour; + } + + final JSlider slider = new JSlider(0, 750, originalThreshold); + final JPanel col1 = new JPanel(); + col1.setPreferredSize(new Dimension(40, 20)); + col1.setBorder(BorderFactory.createEtchedBorder()); + col1.setToolTipText("Dark Colour"); + col1.setBackground(new Color(original1)); + final JPanel col2 = new JPanel(); + col2.setPreferredSize(new Dimension(40, 20)); + col2.setBorder(BorderFactory.createEtchedBorder()); + col2.setToolTipText("Light Colour"); + col2.setBackground(new Color(original2)); + final JPanel bigpanel = new JPanel(new BorderLayout()); + JPanel panel = new JPanel(); + bigpanel.add(panel, BorderLayout.CENTER); + bigpanel.add(new JLabel( + "Select a dark and light text colour, then set the threshold to" + + "
switch between colours, based on background colour
"), + BorderLayout.NORTH); + panel.add(col1); + panel.add(slider); + panel.add(col2); + + col1.addMouseListener(new MouseAdapter() + { + public void mousePressed(MouseEvent e) + { + Color col = JColorChooser.showDialog(bigpanel, + "Select Colour for Text", + col1.getBackground()); + if (col != null) + { + colour1Changed(col); + col1.setBackground(col); + } + } + }); + + col2.addMouseListener(new MouseAdapter() + { + public void mousePressed(MouseEvent e) + { + Color col = JColorChooser.showDialog(bigpanel, + "Select Colour for Text", + col2.getBackground()); + if (col != null) + { + colour2Changed(col); + col2.setBackground(col); + } + } + }); + + slider.addChangeListener(new ChangeListener() + { + public void stateChanged(ChangeEvent evt) + { + thresholdChanged(slider.getValue()); + } + }); + + int reply = JOptionPane.showInternalOptionDialog( + ap, + bigpanel, + "Adjust Foreground Text Colour Threshold", + JOptionPane.OK_CANCEL_OPTION, + JOptionPane.QUESTION_MESSAGE, + null, + null, null); + + if (reply == JOptionPane.CANCEL_OPTION) + { + if (sg == null) + { + ap.av.textColour = new Color(original1); + ap.av.textColour2 = new Color(original2); + ap.av.thresholdTextColour = originalThreshold; + } + else + { + sg.textColour = new Color(original1); + sg.textColour2 = new Color(original2); + sg.thresholdTextColour = originalThreshold; + } + } + } + + void colour1Changed(Color col) + { + if (sg == null) + { + ap.av.textColour = col; + if (ap.av.colourAppliesToAllGroups) + { + setGroupTextColour(); + } + } + else + { + sg.textColour = col; + } + + ap.paintAlignment(true); + } + + void colour2Changed(Color col) + { + if (sg == null) + { + ap.av.textColour2 = col; + if (ap.av.colourAppliesToAllGroups) + { + setGroupTextColour(); + } + } + else + { + sg.textColour2 = col; + } + + ap.paintAlignment(true); + } + + void thresholdChanged(int value) + { + if (sg == null) + { + ap.av.thresholdTextColour = value; + if (ap.av.colourAppliesToAllGroups) + { + setGroupTextColour(); + } + } + else + { + sg.thresholdTextColour = value; + } + + ap.paintAlignment(true); + } + + void setGroupTextColour() + { + if (ap.av.alignment.getGroups() == null) + { + return; + } + + Vector groups = ap.av.alignment.getGroups(); + + for (int i = 0; i < groups.size(); i++) + { + SequenceGroup sg = (SequenceGroup) groups.elementAt(i); + sg.textColour = ap.av.textColour; + sg.textColour2 = ap.av.textColour2; + sg.thresholdTextColour = ap.av.thresholdTextColour; + } + } + +} diff --git a/src/jalview/gui/TreeCanvas.java b/src/jalview/gui/TreeCanvas.java index 3407c07..a022408 100755 --- a/src/jalview/gui/TreeCanvas.java +++ b/src/jalview/gui/TreeCanvas.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/gui/TreePanel.java b/src/jalview/gui/TreePanel.java index f85ad9c..1ebb24d 100755 --- a/src/jalview/gui/TreePanel.java +++ b/src/jalview/gui/TreePanel.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/gui/UserDefinedColours.java b/src/jalview/gui/UserDefinedColours.java index 85f35cd..7a866ea 100755 --- a/src/jalview/gui/UserDefinedColours.java +++ b/src/jalview/gui/UserDefinedColours.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/gui/UserQuestionnaireCheck.java b/src/jalview/gui/UserQuestionnaireCheck.java index 0accc9c..9dc101a 100644 --- a/src/jalview/gui/UserQuestionnaireCheck.java +++ b/src/jalview/gui/UserQuestionnaireCheck.java @@ -1,3 +1,21 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ package jalview.gui; import java.io.*; diff --git a/src/jalview/gui/VamsasApplication.java b/src/jalview/gui/VamsasApplication.java index 121a200..6967bac 100644 --- a/src/jalview/gui/VamsasApplication.java +++ b/src/jalview/gui/VamsasApplication.java @@ -1,5 +1,20 @@ -/** - * +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ package jalview.gui; diff --git a/src/jalview/gui/WebserviceInfo.java b/src/jalview/gui/WebserviceInfo.java index 5f02c09..a0eeedf 100755 --- a/src/jalview/gui/WebserviceInfo.java +++ b/src/jalview/gui/WebserviceInfo.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/io/AMSAFile.java b/src/jalview/io/AMSAFile.java index e7e6d97..6aa5c01 100644 --- a/src/jalview/io/AMSAFile.java +++ b/src/jalview/io/AMSAFile.java @@ -1,100 +1,100 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.io; - -import jalview.datamodel.*; - -public class AMSAFile - extends jalview.io.FastaFile -{ - - AlignmentI al; - /** - * Creates a new AMSAFile object for output. - */ - public AMSAFile(AlignmentI al) - { - this.al = al; - } - - /** - * DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public String print() - { - super.print(getSeqsAsArray()); - - AlignmentAnnotation aa; - if (al.getAlignmentAnnotation() != null) - { - - for (int i = 0; i < al.getAlignmentAnnotation().length; i++) - { - aa = al.getAlignmentAnnotation()[i]; - - - if (aa.autoCalculated || !aa.visible) - { - continue; - } - - out.append(">#_" + aa.label); - if (aa.description != null) - { - out.append(" " + aa.description); - } - - out.append("\n"); - - int nochunks = Math.min(aa.annotations.length, al.getWidth()) - / len + 1; - - for (int j = 0; j < nochunks; j++) - { - int start = j * len; - int end = start + len; - if (end > aa.annotations.length) - { - end = aa.annotations.length; - } - - String ch; - for (int k = start; k < end; k++) - { - if (aa.annotations[k] == null) - { - ch = " "; - } - else - { - ch = aa.annotations[k].displayCharacter; - } - - out.append(ch); - - } - out.append("\n"); - } - } - } - return out.toString(); - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.io; + +import jalview.datamodel.*; + +public class AMSAFile + extends jalview.io.FastaFile +{ + + AlignmentI al; + /** + * Creates a new AMSAFile object for output. + */ + public AMSAFile(AlignmentI al) + { + this.al = al; + } + + /** + * DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public String print() + { + super.print(getSeqsAsArray()); + + AlignmentAnnotation aa; + if (al.getAlignmentAnnotation() != null) + { + + for (int i = 0; i < al.getAlignmentAnnotation().length; i++) + { + aa = al.getAlignmentAnnotation()[i]; + + + if (aa.autoCalculated || !aa.visible) + { + continue; + } + + out.append(">#_" + aa.label); + if (aa.description != null) + { + out.append(" " + aa.description); + } + + out.append("\n"); + + int nochunks = Math.min(aa.annotations.length, al.getWidth()) + / len + 1; + + for (int j = 0; j < nochunks; j++) + { + int start = j * len; + int end = start + len; + if (end > aa.annotations.length) + { + end = aa.annotations.length; + } + + String ch; + for (int k = start; k < end; k++) + { + if (aa.annotations[k] == null) + { + ch = " "; + } + else + { + ch = aa.annotations[k].displayCharacter; + } + + out.append(ch); + + } + out.append("\n"); + } + } + } + return out.toString(); + } +} diff --git a/src/jalview/io/AlignFile.java b/src/jalview/io/AlignFile.java index 2ad32f0..c38fad3 100755 --- a/src/jalview/io/AlignFile.java +++ b/src/jalview/io/AlignFile.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/io/AnnotationFile.java b/src/jalview/io/AnnotationFile.java index 288ce2f..ddf4348 100755 --- a/src/jalview/io/AnnotationFile.java +++ b/src/jalview/io/AnnotationFile.java @@ -1,22 +1,21 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.io; import java.io.*; diff --git a/src/jalview/io/AppletFormatAdapter.java b/src/jalview/io/AppletFormatAdapter.java index c7b0575..370a45d 100755 --- a/src/jalview/io/AppletFormatAdapter.java +++ b/src/jalview/io/AppletFormatAdapter.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/io/BLCFile.java b/src/jalview/io/BLCFile.java index fa6f8e2..1d25d46 100755 --- a/src/jalview/io/BLCFile.java +++ b/src/jalview/io/BLCFile.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/io/ClansFile.java b/src/jalview/io/ClansFile.java index ee709e5..6347268 100644 --- a/src/jalview/io/ClansFile.java +++ b/src/jalview/io/ClansFile.java @@ -1,3 +1,21 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ package jalview.io; /** diff --git a/src/jalview/io/ClustalFile.java b/src/jalview/io/ClustalFile.java index d62d185..387d576 100755 --- a/src/jalview/io/ClustalFile.java +++ b/src/jalview/io/ClustalFile.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/io/DBRefFile.java b/src/jalview/io/DBRefFile.java index f43a2a6..87e62b5 100644 --- a/src/jalview/io/DBRefFile.java +++ b/src/jalview/io/DBRefFile.java @@ -1,3 +1,21 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ package jalview.io; import java.io.IOException; diff --git a/src/jalview/io/FastaFile.java b/src/jalview/io/FastaFile.java index 1cb016c..b40460b 100755 --- a/src/jalview/io/FastaFile.java +++ b/src/jalview/io/FastaFile.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/io/FeaturesFile.java b/src/jalview/io/FeaturesFile.java index 3e0314a..d7e2ef5 100755 --- a/src/jalview/io/FeaturesFile.java +++ b/src/jalview/io/FeaturesFile.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/io/FileLoader.java b/src/jalview/io/FileLoader.java index 584840e..f185205 100755 --- a/src/jalview/io/FileLoader.java +++ b/src/jalview/io/FileLoader.java @@ -1,22 +1,21 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.io; import java.util.*; diff --git a/src/jalview/io/FileParse.java b/src/jalview/io/FileParse.java index 04a673c..cb3b122 100755 --- a/src/jalview/io/FileParse.java +++ b/src/jalview/io/FileParse.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/io/FormatAdapter.java b/src/jalview/io/FormatAdapter.java index 983d02e..f22795e 100755 --- a/src/jalview/io/FormatAdapter.java +++ b/src/jalview/io/FormatAdapter.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/io/HTMLOutput.java b/src/jalview/io/HTMLOutput.java index 8406f3d..e53f14c 100755 --- a/src/jalview/io/HTMLOutput.java +++ b/src/jalview/io/HTMLOutput.java @@ -1,389 +1,389 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.io; - -import java.io.*; - -import java.awt.*; - -import jalview.datamodel.*; -import jalview.gui.*; - -public class HTMLOutput -{ - AlignViewport av; - SequenceRenderer sr; - FeatureRenderer fr; - Color color; - - public HTMLOutput(AlignmentPanel ap, SequenceRenderer sr, FeatureRenderer fr1) - { - this.av = ap.av; - this.sr = sr; - - fr = new FeatureRenderer(ap); - fr.transferSettings(fr1); - - JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache. - getProperty( - "LAST_DIRECTORY"), new String[] - {"html"}, - new String[] - {"HTML files"}, "HTML files"); - - chooser.setFileView(new JalviewFileView()); - chooser.setDialogTitle("Save as HTML"); - chooser.setToolTipText("Save"); - - int value = chooser.showSaveDialog(null); - - if (value == JalviewFileChooser.APPROVE_OPTION) - { - String choice = chooser.getSelectedFile().getPath(); - jalview.bin.Cache.setProperty("LAST_DIRECTORY", - chooser.getSelectedFile().getParent()); - - try - { - PrintWriter out = new java.io.PrintWriter(new java.io.FileWriter( - choice)); - out.println(""); - out.println(""); - out.println(""); - - if (av.getWrapAlignment()) - { - drawWrappedAlignment(out); - } - else - { - drawUnwrappedAlignment(out); - } - - out.println("\n\n"); - out.close(); - jalview.util.BrowserLauncher.openURL("file:///" + choice); - } - catch (Exception ex) - { - ex.printStackTrace(); - } - } - } - - void drawUnwrappedAlignment(PrintWriter out) - { - out.println("
\n"); - out.println( - "\n"); - - ////////////// - SequenceI seq; - AlignmentI alignment = av.getAlignment(); - - // draws the top row, the measure rule - out.println(""); - - int i = 0; - - for (i = 10; i < (alignment.getWidth() - 10); i += 10) - { - out.println(""); - } - - out.println(""); - out.println(""); - - for (i = 0; i < alignment.getHeight(); i++) - { - seq = alignment.getSequenceAt(i); - - String id = seq.getDisplayId(av.getShowJVSuffix()); - - out.println(""); - - for (int res = 0; res < seq.getLength(); res++) - { - if (!jalview.util.Comparison.isGap(seq.getCharAt(res))) - { - color = sr.getResidueBoxColour(seq, res); - - color = fr.findFeatureColour(color, seq, res); - } - else - { - color = Color.white; - } - - if (color.getRGB() < -1) - { - out.println(""); - } - else - { - out.println(""); - } - } - - out.println(""); - } - - ////////////// - out.println("
" + i + "
|
" + i + - "
|
" + id + - "  " + - seq.getCharAt(res) + "" + seq.getCharAt(res) + "
"); - out.println("
"); - } - - void drawWrappedAlignment(PrintWriter out) - { - //////////////////////////////////// - /// How many sequences and residues can we fit on a printable page? - AlignmentI al = av.getAlignment(); - SequenceI seq; - String r; - String g; - String b; - - out.println("
\n"); - out.println( - "\n"); - - for (int startRes = 0; startRes < al.getWidth(); - startRes += av.getWrappedWidth()) - { - int endRes = startRes + av.getWrappedWidth(); - - if (endRes > al.getWidth()) - { - endRes = al.getWidth(); - } - - if (av.getScaleAboveWrapped()) - { - out.println(""); - - if (av.getScaleLeftWrapped()) - { - out.println(""); - } - else - { - out.println(""); - } - - for (int i = startRes + 10; i < endRes; i += 10) - { - out.println(""); - } - - out.println(""); - } - - int startPos, endPos; - for (int s = 0; s < al.getHeight(); s++) - { - out.println(""); - seq = al.getSequenceAt(s); - - startPos = seq.findPosition(startRes); - endPos = seq.findPosition(endRes) - 1; - - String id = seq.getDisplayId(av.getShowJVSuffix()); - - out.println(""); - - if (av.getScaleLeftWrapped()) - { - if (startPos > seq.getEnd() || endPos == 0) - { - out.println(""); - } - else - { - out.println(""); - } - } - - for (int res = startRes; res < endRes; res++) - { - if (!jalview.util.Comparison.isGap(seq.getCharAt(res))) - { - color = sr.getResidueBoxColour(seq, res); - - color = fr.findFeatureColour(color, seq, res); - } - else - { - color = Color.white; - } - - if (color.getRGB() < -1) - { - out.println(""); - } - else - { - out.println(""); - } - - } - - if (av.getScaleRightWrapped() && - endRes < startRes + av.getWrappedWidth()) - { - out.println(""); - } - - if (av.getScaleRightWrapped() && startPos < endPos) - { - out.println(""); - } - - out.println(""); - } - - if (endRes < al.getWidth()) - { - out.println(""); - } - } - - out.println("
  " + i + "
|
" + id + - "   " + startPos + - "  " + - seq.getCharAt(res) + "" + seq.getCharAt(res) + "" - + "   " + endPos + - "  
"); - out.println("
"); - } - - public static String getImageMapHTML() - { - return new String( - "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "
\n" - + "\n"); - - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.io; + +import java.io.*; + +import java.awt.*; + +import jalview.datamodel.*; +import jalview.gui.*; + +public class HTMLOutput +{ + AlignViewport av; + SequenceRenderer sr; + FeatureRenderer fr; + Color color; + + public HTMLOutput(AlignmentPanel ap, SequenceRenderer sr, FeatureRenderer fr1) + { + this.av = ap.av; + this.sr = sr; + + fr = new FeatureRenderer(ap); + fr.transferSettings(fr1); + + JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache. + getProperty( + "LAST_DIRECTORY"), new String[] + {"html"}, + new String[] + {"HTML files"}, "HTML files"); + + chooser.setFileView(new JalviewFileView()); + chooser.setDialogTitle("Save as HTML"); + chooser.setToolTipText("Save"); + + int value = chooser.showSaveDialog(null); + + if (value == JalviewFileChooser.APPROVE_OPTION) + { + String choice = chooser.getSelectedFile().getPath(); + jalview.bin.Cache.setProperty("LAST_DIRECTORY", + chooser.getSelectedFile().getParent()); + + try + { + PrintWriter out = new java.io.PrintWriter(new java.io.FileWriter( + choice)); + out.println(""); + out.println(""); + out.println(""); + + if (av.getWrapAlignment()) + { + drawWrappedAlignment(out); + } + else + { + drawUnwrappedAlignment(out); + } + + out.println("\n\n"); + out.close(); + jalview.util.BrowserLauncher.openURL("file:///" + choice); + } + catch (Exception ex) + { + ex.printStackTrace(); + } + } + } + + void drawUnwrappedAlignment(PrintWriter out) + { + out.println("
\n"); + out.println( + "\n"); + + ////////////// + SequenceI seq; + AlignmentI alignment = av.getAlignment(); + + // draws the top row, the measure rule + out.println(""); + + int i = 0; + + for (i = 10; i < (alignment.getWidth() - 10); i += 10) + { + out.println(""); + } + + out.println(""); + out.println(""); + + for (i = 0; i < alignment.getHeight(); i++) + { + seq = alignment.getSequenceAt(i); + + String id = seq.getDisplayId(av.getShowJVSuffix()); + + out.println(""); + + for (int res = 0; res < seq.getLength(); res++) + { + if (!jalview.util.Comparison.isGap(seq.getCharAt(res))) + { + color = sr.getResidueBoxColour(seq, res); + + color = fr.findFeatureColour(color, seq, res); + } + else + { + color = Color.white; + } + + if (color.getRGB() < -1) + { + out.println(""); + } + else + { + out.println(""); + } + } + + out.println(""); + } + + ////////////// + out.println("
" + i + "
|
" + i + + "
|
" + id + + "  " + + seq.getCharAt(res) + "" + seq.getCharAt(res) + "
"); + out.println("
"); + } + + void drawWrappedAlignment(PrintWriter out) + { + //////////////////////////////////// + /// How many sequences and residues can we fit on a printable page? + AlignmentI al = av.getAlignment(); + SequenceI seq; + String r; + String g; + String b; + + out.println("
\n"); + out.println( + "\n"); + + for (int startRes = 0; startRes < al.getWidth(); + startRes += av.getWrappedWidth()) + { + int endRes = startRes + av.getWrappedWidth(); + + if (endRes > al.getWidth()) + { + endRes = al.getWidth(); + } + + if (av.getScaleAboveWrapped()) + { + out.println(""); + + if (av.getScaleLeftWrapped()) + { + out.println(""); + } + else + { + out.println(""); + } + + for (int i = startRes + 10; i < endRes; i += 10) + { + out.println(""); + } + + out.println(""); + } + + int startPos, endPos; + for (int s = 0; s < al.getHeight(); s++) + { + out.println(""); + seq = al.getSequenceAt(s); + + startPos = seq.findPosition(startRes); + endPos = seq.findPosition(endRes) - 1; + + String id = seq.getDisplayId(av.getShowJVSuffix()); + + out.println(""); + + if (av.getScaleLeftWrapped()) + { + if (startPos > seq.getEnd() || endPos == 0) + { + out.println(""); + } + else + { + out.println(""); + } + } + + for (int res = startRes; res < endRes; res++) + { + if (!jalview.util.Comparison.isGap(seq.getCharAt(res))) + { + color = sr.getResidueBoxColour(seq, res); + + color = fr.findFeatureColour(color, seq, res); + } + else + { + color = Color.white; + } + + if (color.getRGB() < -1) + { + out.println(""); + } + else + { + out.println(""); + } + + } + + if (av.getScaleRightWrapped() && + endRes < startRes + av.getWrappedWidth()) + { + out.println(""); + } + + if (av.getScaleRightWrapped() && startPos < endPos) + { + out.println(""); + } + + out.println(""); + } + + if (endRes < al.getWidth()) + { + out.println(""); + } + } + + out.println("
  " + i + "
|
" + id + + "   " + startPos + + "  " + + seq.getCharAt(res) + "" + seq.getCharAt(res) + "" + + "   " + endPos + + "  
"); + out.println("
"); + } + + public static String getImageMapHTML() + { + return new String( + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "
\n" + + "\n"); + + } +} diff --git a/src/jalview/io/IdentifyFile.java b/src/jalview/io/IdentifyFile.java index 46899da..4deb858 100755 --- a/src/jalview/io/IdentifyFile.java +++ b/src/jalview/io/IdentifyFile.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/io/JPredFile.java b/src/jalview/io/JPredFile.java index dfe1ecf..7daee55 100755 --- a/src/jalview/io/JPredFile.java +++ b/src/jalview/io/JPredFile.java @@ -1,22 +1,21 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - /** * PredFile.java * JalviewX / Vamsas Project diff --git a/src/jalview/io/JalviewFileChooser.java b/src/jalview/io/JalviewFileChooser.java index 465b8a3..bc360ca 100755 --- a/src/jalview/io/JalviewFileChooser.java +++ b/src/jalview/io/JalviewFileChooser.java @@ -1,22 +1,21 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - ////////////////////////////////////////////////////////////////// package jalview.io; diff --git a/src/jalview/io/JalviewFileFilter.java b/src/jalview/io/JalviewFileFilter.java index fd8bcd3..aa4f233 100755 --- a/src/jalview/io/JalviewFileFilter.java +++ b/src/jalview/io/JalviewFileFilter.java @@ -1,172 +1,172 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.io; - -import java.io.*; -import java.util.*; - -import javax.swing.filechooser.FileFilter; - -public class JalviewFileFilter - extends FileFilter -{ - public static Hashtable suffixHash = new Hashtable(); - private Hashtable filters = null; - private String description = "no description"; - private String fullDescription = "full description"; - private boolean useExtensionsInDescription = true; - - public JalviewFileFilter(String extension, String description) - { - StringTokenizer st = new StringTokenizer(extension, ","); - - while (st.hasMoreElements()) - { - addExtension(st.nextToken().trim()); - } - - setDescription(description); - } - - public JalviewFileFilter(String[] filts) - { - this(filts, null); - } - - public JalviewFileFilter(String[] filts, String description) - { - for (int i = 0; i < filts.length; i++) - { - // add filters one by one - addExtension(filts[i]); - } - - if (description != null) - { - setDescription(description); - } - } - - public String getAcceptableExtension() - { - return filters.keys().nextElement().toString(); - } - - // takes account of the fact that database is a directory - public boolean accept(File f) - { - if (f != null) - { - String extension = getExtension(f); - - if (f.isDirectory()) - { - return true; - } - - if ( (extension != null) && (filters.get(getExtension(f)) != null)) - { - return true; - } - } - - return false; - } - - public String getExtension(File f) - { - if (f != null) - { - String filename = f.getName(); - int i = filename.lastIndexOf('.'); - - if ( (i > 0) && (i < (filename.length() - 1))) - { - return filename.substring(i + 1).toLowerCase(); - } - - ; - } - - return ""; - } - - public void addExtension(String extension) - { - if (filters == null) - { - filters = new Hashtable(5); - } - - filters.put(extension.toLowerCase(), this); - fullDescription = null; - } - - public String getDescription() - { - if (fullDescription == null) - { - if ( (description == null) || isExtensionListInDescription()) - { - fullDescription = (description == null) ? "(" : (description + - " ("); - - // build the description from the extension list - Enumeration extensions = filters.keys(); - - if (extensions != null) - { - fullDescription += ("." + - (String) extensions.nextElement()); - - while (extensions.hasMoreElements()) - { - fullDescription += (", " + - (String) extensions.nextElement()); - } - } - - fullDescription += ")"; - } - else - { - fullDescription = description; - } - } - - return fullDescription; - } - - public void setDescription(String description) - { - this.description = description; - fullDescription = null; - } - - public void setExtensionListInDescription(boolean b) - { - useExtensionsInDescription = b; - fullDescription = null; - } - - public boolean isExtensionListInDescription() - { - return useExtensionsInDescription; - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.io; + +import java.io.*; +import java.util.*; + +import javax.swing.filechooser.FileFilter; + +public class JalviewFileFilter + extends FileFilter +{ + public static Hashtable suffixHash = new Hashtable(); + private Hashtable filters = null; + private String description = "no description"; + private String fullDescription = "full description"; + private boolean useExtensionsInDescription = true; + + public JalviewFileFilter(String extension, String description) + { + StringTokenizer st = new StringTokenizer(extension, ","); + + while (st.hasMoreElements()) + { + addExtension(st.nextToken().trim()); + } + + setDescription(description); + } + + public JalviewFileFilter(String[] filts) + { + this(filts, null); + } + + public JalviewFileFilter(String[] filts, String description) + { + for (int i = 0; i < filts.length; i++) + { + // add filters one by one + addExtension(filts[i]); + } + + if (description != null) + { + setDescription(description); + } + } + + public String getAcceptableExtension() + { + return filters.keys().nextElement().toString(); + } + + // takes account of the fact that database is a directory + public boolean accept(File f) + { + if (f != null) + { + String extension = getExtension(f); + + if (f.isDirectory()) + { + return true; + } + + if ( (extension != null) && (filters.get(getExtension(f)) != null)) + { + return true; + } + } + + return false; + } + + public String getExtension(File f) + { + if (f != null) + { + String filename = f.getName(); + int i = filename.lastIndexOf('.'); + + if ( (i > 0) && (i < (filename.length() - 1))) + { + return filename.substring(i + 1).toLowerCase(); + } + + ; + } + + return ""; + } + + public void addExtension(String extension) + { + if (filters == null) + { + filters = new Hashtable(5); + } + + filters.put(extension.toLowerCase(), this); + fullDescription = null; + } + + public String getDescription() + { + if (fullDescription == null) + { + if ( (description == null) || isExtensionListInDescription()) + { + fullDescription = (description == null) ? "(" : (description + + " ("); + + // build the description from the extension list + Enumeration extensions = filters.keys(); + + if (extensions != null) + { + fullDescription += ("." + + (String) extensions.nextElement()); + + while (extensions.hasMoreElements()) + { + fullDescription += (", " + + (String) extensions.nextElement()); + } + } + + fullDescription += ")"; + } + else + { + fullDescription = description; + } + } + + return fullDescription; + } + + public void setDescription(String description) + { + this.description = description; + fullDescription = null; + } + + public void setExtensionListInDescription(boolean b) + { + useExtensionsInDescription = b; + fullDescription = null; + } + + public boolean isExtensionListInDescription() + { + return useExtensionsInDescription; + } +} diff --git a/src/jalview/io/JalviewFileView.java b/src/jalview/io/JalviewFileView.java index b32cbb6..e821ada 100755 --- a/src/jalview/io/JalviewFileView.java +++ b/src/jalview/io/JalviewFileView.java @@ -1,111 +1,111 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.io; - -import java.io.*; -import java.util.*; - -import javax.swing.*; -import javax.swing.filechooser.*; - -public class JalviewFileView - extends FileView -{ - static Hashtable alignSuffix = new Hashtable(); - - static - { - alignSuffix.put("fasta", "Fasta file"); - alignSuffix.put("fa", "Fasta file"); - alignSuffix.put("fastq", "Fasta file"); - alignSuffix.put("blc", "BLC file"); - alignSuffix.put("msf", "MSF file"); - alignSuffix.put("pfam", "PFAM file"); - alignSuffix.put("aln", "Clustal file"); - alignSuffix.put("pir", "PIR file"); - alignSuffix.put("jar", "Jalview file"); - } - - public String getTypeDescription(File f) - { - String extension = getExtension(f); - String type = null; - - if (extension != null) - { - if (alignSuffix.containsKey(extension)) - { - type = alignSuffix.get(extension).toString(); - } - } - - return type; - } - - public Icon getIcon(File f) - { - String extension = getExtension(f); - Icon icon = null; - - if (extension != null) - { - if (alignSuffix.containsKey(extension)) - { - icon = createImageIcon("/images/file.png"); - } - } - - return icon; - } - - /* - * Get the extension of a file. - */ - public static String getExtension(File f) - { - String ext = null; - String s = f.getName(); - int i = s.lastIndexOf('.'); - - if ( (i > 0) && (i < (s.length() - 1))) - { - ext = s.substring(i + 1).toLowerCase(); - } - - return ext; - } - - /** Returns an ImageIcon, or null if the path was invalid. */ - protected static ImageIcon createImageIcon(String path) - { - java.net.URL imgURL = JalviewFileView.class.getResource(path); - - if (imgURL != null) - { - return new ImageIcon(imgURL); - } - else - { - System.err.println( - "JalviewFileView.createImageIcon: Couldn't find file: " + path); - - return null; - } - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.io; + +import java.io.*; +import java.util.*; + +import javax.swing.*; +import javax.swing.filechooser.*; + +public class JalviewFileView + extends FileView +{ + static Hashtable alignSuffix = new Hashtable(); + + static + { + alignSuffix.put("fasta", "Fasta file"); + alignSuffix.put("fa", "Fasta file"); + alignSuffix.put("fastq", "Fasta file"); + alignSuffix.put("blc", "BLC file"); + alignSuffix.put("msf", "MSF file"); + alignSuffix.put("pfam", "PFAM file"); + alignSuffix.put("aln", "Clustal file"); + alignSuffix.put("pir", "PIR file"); + alignSuffix.put("jar", "Jalview file"); + } + + public String getTypeDescription(File f) + { + String extension = getExtension(f); + String type = null; + + if (extension != null) + { + if (alignSuffix.containsKey(extension)) + { + type = alignSuffix.get(extension).toString(); + } + } + + return type; + } + + public Icon getIcon(File f) + { + String extension = getExtension(f); + Icon icon = null; + + if (extension != null) + { + if (alignSuffix.containsKey(extension)) + { + icon = createImageIcon("/images/file.png"); + } + } + + return icon; + } + + /* + * Get the extension of a file. + */ + public static String getExtension(File f) + { + String ext = null; + String s = f.getName(); + int i = s.lastIndexOf('.'); + + if ( (i > 0) && (i < (s.length() - 1))) + { + ext = s.substring(i + 1).toLowerCase(); + } + + return ext; + } + + /** Returns an ImageIcon, or null if the path was invalid. */ + protected static ImageIcon createImageIcon(String path) + { + java.net.URL imgURL = JalviewFileView.class.getResource(path); + + if (imgURL != null) + { + return new ImageIcon(imgURL); + } + else + { + System.err.println( + "JalviewFileView.createImageIcon: Couldn't find file: " + path); + + return null; + } + } +} diff --git a/src/jalview/io/JnetAnnotationMaker.java b/src/jalview/io/JnetAnnotationMaker.java index 8d0f40b..7d09cce 100755 --- a/src/jalview/io/JnetAnnotationMaker.java +++ b/src/jalview/io/JnetAnnotationMaker.java @@ -1,21 +1,22 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA -*/package jalview.io; + */ +package jalview.io; import jalview.datamodel.*; @@ -35,7 +36,7 @@ public class JnetAnnotationMaker * @param firstSeq int the index of the sequence to attach the annotation to (usually zero) * @param noMsa boolean * @param delMap mapping from columns in JPredFile prediction to residue number in al.getSequence(firstSeq) - */ + */ public static void add_annotation(JPredFile prediction, AlignmentI al, int firstSeq, boolean noMsa, int[] delMap) throws Exception diff --git a/src/jalview/io/MSFfile.java b/src/jalview/io/MSFfile.java index e2d3704..bb1ad7d 100755 --- a/src/jalview/io/MSFfile.java +++ b/src/jalview/io/MSFfile.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/io/MatrixFile.java b/src/jalview/io/MatrixFile.java index 5b9e79f..7b3bdab 100644 --- a/src/jalview/io/MatrixFile.java +++ b/src/jalview/io/MatrixFile.java @@ -1,3 +1,21 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ package jalview.io; import java.io.IOException; diff --git a/src/jalview/io/ModellerDescription.java b/src/jalview/io/ModellerDescription.java index fa6ef6d..91f7961 100755 --- a/src/jalview/io/ModellerDescription.java +++ b/src/jalview/io/ModellerDescription.java @@ -1,391 +1,391 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.io; - -import jalview.datamodel.*; - -public class ModellerDescription -{ - /** - * Translates between a String containing a set of colon-separated values - * on a single line, and sequence start/end and other properties. - * See PIRFile IO for its use. - */ - final String[] seqTypes = - { - "sequence", "structure", "structureX", "structureN"}; - final String[] Fields = - { - "objectType", "objectId", - "startField", "startCode", - "endField", "endCode", - "description1", "description2", - "resolutionField", "tailField"}; - final int TYPE = 0; - final int LOCALID = 1; - final int START = 2; - final int START_CHAIN = 3; - final int END = 4; - final int END_CHAIN = 5; - final int DESCRIPTION1 = 6; - final int DESCRIPTION2 = 7; - final int RESOLUTION = 8; - final int TAIL = 9; - - /** - * 0 is free text or empty - * 1 is something that parses to an integer, or \@ - */ - final int Types[] = - { - 0, 0, 1, 0, 1, 0, 0, 0, 0, 0 - }; - final char Padding[] = - { - ' ', ' ', ' ', '.', ' ', '.', '.', '.', '.', '.' - }; - - java.util.Hashtable fields = new java.util.Hashtable(); - ModellerDescription() - { - fields.put(Fields[TAIL], ""); - } - - class resCode - { - Integer val; - String field; - resCode(String f, Integer v) - { - val = v; - field = f; - } - - resCode(int v) - { - val = new Integer(v); - field = val.toString(); - } - }; - - private resCode validResidueCode(String field) - { - Integer val = null; - com.stevesoft.pat.Regex r = new com.stevesoft.pat.Regex( - "\\s*((([-0-9]+).?)|FIRST|LAST|@)"); - - if (!r.search(field)) - { - return null; // invalid - } - String value = r.stringMatched(3); - if (value == null) - { - value = r.stringMatched(1); - } - // jalview.bin.Cache.log.debug("from '" + field + "' matched '" + value + - // "'"); - try - { - val = Integer.valueOf(value); - return new resCode(field, val); // successful numeric extraction - } - catch (Exception e) - { - } - return new resCode(field, null); - } - - private java.util.Hashtable parseDescription(String desc) - { - java.util.Hashtable fields = new java.util.Hashtable(); - java.util.StringTokenizer st = new java.util.StringTokenizer(desc, ":"); - String field; - int type = -1; - if (st.countTokens() > 0) - { - // parse colon-fields - int i = 0; - field = st.nextToken(":"); - do - { - if (seqTypes[i].equalsIgnoreCase(field)) - { - break; - } - } - while (++i < seqTypes.length); - - if (i < seqTypes.length) - { - // valid seqType for modeller - type = i; - i = 1; // continue parsing fields - while (i < TAIL && st.hasMoreTokens()) - { - if ( (field = st.nextToken(":")) != null) - { - // validate residue field value - if (Types[i] == 1) - { - resCode val = validResidueCode(field); - if (val != null) - { - fields.put(new String(Fields[i] + "num"), val); - } - else - { - // jalview.bin.Cache.log.debug( - // "Ignoring non-Modeller description: invalid integer-like field '" + field + "'"); - type = -1; /* invalid field! - throw the FieldSet away */ - } - ; - } - fields.put(Fields[i++], field); - } - } - if (i == TAIL) - { - // slurp remaining fields - while (st.hasMoreTokens()) - { - field += ":" + st.nextToken(":"); - } - fields.put(Fields[TAIL], field); - } - } - } - if (type == -1) - { - // object is not a proper ModellerPIR object - fields = new java.util.Hashtable(); - fields.put(Fields[TAIL], new String(desc)); - } - else - { - fields.put(Fields[TYPE], seqTypes[type]); - } - return fields; - } - - ModellerDescription(String desc) - { - if (desc == null) - { - desc = ""; - } - fields = parseDescription(desc); - } - - void setStartCode(int v) - { - resCode r; - fields.put(Fields[START] + "num", r = new resCode(v)); - fields.put(Fields[START], r.field); - } - - void setEndCode(int v) - { - resCode r; - fields.put(Fields[END] + "num", r = new resCode(v)); - fields.put(Fields[END], r.field); - } - - /** - * make a possibly updated modeller field line for the sequence object - * @param seq SequenceI - */ - ModellerDescription(SequenceI seq) - { - - if (seq.getDescription() != null) - { - fields = parseDescription(seq.getDescription()); - } - - if (isModellerFieldset()) - { - // Set start and end before we update the type (in the case of a synthesized field set) - if (getStartNum() != seq.getStart() && getStartCode().val != null) - { - setStartCode(seq.getStart()); - } - - if (getEndNum() != seq.getEnd() && getStartCode().val != null) - { - setEndCode(seq.getEnd()); - } - } - else - { - // synthesize fields - setStartCode(seq.getStart()); - setEndCode(seq.getEnd()); - fields.put(Fields[LOCALID], seq.getName()); // this may be overwritten below... - // type - decide based on evidence of PDB database references - this also sets the local reference field - int t = 0; // sequence - if (seq.getDatasetSequence() != null && - seq.getDatasetSequence().getDBRef() != null) - { - jalview.datamodel.DBRefEntry[] dbr = seq.getDatasetSequence().getDBRef(); - int i, j; - for (i = 0, j = dbr.length; i < j; i++) - { - if (dbr[i] != null) - { - // JBPNote PDB dbRefEntry needs properties to propagate onto ModellerField - // JBPNote Need to get info from the user about whether the sequence is the one being modelled, or if it is a template. - if (dbr[i].getSource().equals(jalview.datamodel.DBRefSource.PDB)) - { - fields.put(Fields[LOCALID], dbr[i].getAccessionId()); - t = 2; - break; - } - } - } - } - fields.put(Fields[TYPE], seqTypes[t]); - } - - } - - /** - * Indicate if fields parsed to a modeller-like colon-separated value line - * @return boolean - */ - boolean isModellerFieldset() - { - return (fields.containsKey(Fields[TYPE])); - } - - String getDescriptionLine() - { - String desc = ""; - int lastfield = Fields.length - 1; - - if (isModellerFieldset()) - { - String value; - // try to write a minimal modeller field set, so.. - - // find the last valid field in the entry - - for (; lastfield > 6; lastfield--) - { - if (fields.containsKey(Fields[lastfield])) - { - break; - } - } - - for (int i = 0; i < lastfield; i++) - { - value = (String) fields.get(Fields[i]); - if (value != null && value.length() > 0) - { - desc += ( (String) fields.get(Fields[i])) + ":"; - } - else - { - desc += Padding[i] + ":"; - } - } - } - // just return the last field if no others were defined. - if (fields.containsKey(Fields[lastfield])) - { - desc += (String) fields.get(Fields[lastfield]); - } - else - { - desc += "."; - } - return desc; - } - - int getStartNum() - { - int start = 0; - resCode val = getStartCode(); - if (val.val != null) - { - return val.val.intValue(); - } - return start; - } - - resCode getStartCode() - { - if (isModellerFieldset() && fields.containsKey(Fields[START] + "num")) - { - return (resCode) fields.get(Fields[START] + "num"); - } - return null; - } - - resCode getEndCode() - { - if (isModellerFieldset() && fields.containsKey(Fields[END] + "num")) - { - return (resCode) fields.get(Fields[END] + "num"); - } - return null; - } - - int getEndNum() - { - int end = 0; - resCode val = getEndCode(); - if (val.val != null) - { - return val.val.intValue(); - } - return end; - } - - /** - * returns true if sequence object was modifed with a valid modellerField set - * @param newSeq SequenceI - * @return boolean - */ - boolean updateSequenceI(SequenceI newSeq) - { - if (isModellerFieldset()) - { - if (getStartCode().val != null) - { - newSeq.setStart(getStartNum()); - } - else - { - newSeq.setStart(1); - } - if (getEndCode().val != null) - { - newSeq.setEnd(getEndNum()); - } - else - { - newSeq.setEnd(newSeq.getStart() + newSeq.getLength()); - } - return true; - } - return false; - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.io; + +import jalview.datamodel.*; + +public class ModellerDescription +{ + /** + * Translates between a String containing a set of colon-separated values + * on a single line, and sequence start/end and other properties. + * See PIRFile IO for its use. + */ + final String[] seqTypes = + { + "sequence", "structure", "structureX", "structureN"}; + final String[] Fields = + { + "objectType", "objectId", + "startField", "startCode", + "endField", "endCode", + "description1", "description2", + "resolutionField", "tailField"}; + final int TYPE = 0; + final int LOCALID = 1; + final int START = 2; + final int START_CHAIN = 3; + final int END = 4; + final int END_CHAIN = 5; + final int DESCRIPTION1 = 6; + final int DESCRIPTION2 = 7; + final int RESOLUTION = 8; + final int TAIL = 9; + + /** + * 0 is free text or empty + * 1 is something that parses to an integer, or \@ + */ + final int Types[] = + { + 0, 0, 1, 0, 1, 0, 0, 0, 0, 0 + }; + final char Padding[] = + { + ' ', ' ', ' ', '.', ' ', '.', '.', '.', '.', '.' + }; + + java.util.Hashtable fields = new java.util.Hashtable(); + ModellerDescription() + { + fields.put(Fields[TAIL], ""); + } + + class resCode + { + Integer val; + String field; + resCode(String f, Integer v) + { + val = v; + field = f; + } + + resCode(int v) + { + val = new Integer(v); + field = val.toString(); + } + }; + + private resCode validResidueCode(String field) + { + Integer val = null; + com.stevesoft.pat.Regex r = new com.stevesoft.pat.Regex( + "\\s*((([-0-9]+).?)|FIRST|LAST|@)"); + + if (!r.search(field)) + { + return null; // invalid + } + String value = r.stringMatched(3); + if (value == null) + { + value = r.stringMatched(1); + } + // jalview.bin.Cache.log.debug("from '" + field + "' matched '" + value + + // "'"); + try + { + val = Integer.valueOf(value); + return new resCode(field, val); // successful numeric extraction + } + catch (Exception e) + { + } + return new resCode(field, null); + } + + private java.util.Hashtable parseDescription(String desc) + { + java.util.Hashtable fields = new java.util.Hashtable(); + java.util.StringTokenizer st = new java.util.StringTokenizer(desc, ":"); + String field; + int type = -1; + if (st.countTokens() > 0) + { + // parse colon-fields + int i = 0; + field = st.nextToken(":"); + do + { + if (seqTypes[i].equalsIgnoreCase(field)) + { + break; + } + } + while (++i < seqTypes.length); + + if (i < seqTypes.length) + { + // valid seqType for modeller + type = i; + i = 1; // continue parsing fields + while (i < TAIL && st.hasMoreTokens()) + { + if ( (field = st.nextToken(":")) != null) + { + // validate residue field value + if (Types[i] == 1) + { + resCode val = validResidueCode(field); + if (val != null) + { + fields.put(new String(Fields[i] + "num"), val); + } + else + { + // jalview.bin.Cache.log.debug( + // "Ignoring non-Modeller description: invalid integer-like field '" + field + "'"); + type = -1; /* invalid field! - throw the FieldSet away */ + } + ; + } + fields.put(Fields[i++], field); + } + } + if (i == TAIL) + { + // slurp remaining fields + while (st.hasMoreTokens()) + { + field += ":" + st.nextToken(":"); + } + fields.put(Fields[TAIL], field); + } + } + } + if (type == -1) + { + // object is not a proper ModellerPIR object + fields = new java.util.Hashtable(); + fields.put(Fields[TAIL], new String(desc)); + } + else + { + fields.put(Fields[TYPE], seqTypes[type]); + } + return fields; + } + + ModellerDescription(String desc) + { + if (desc == null) + { + desc = ""; + } + fields = parseDescription(desc); + } + + void setStartCode(int v) + { + resCode r; + fields.put(Fields[START] + "num", r = new resCode(v)); + fields.put(Fields[START], r.field); + } + + void setEndCode(int v) + { + resCode r; + fields.put(Fields[END] + "num", r = new resCode(v)); + fields.put(Fields[END], r.field); + } + + /** + * make a possibly updated modeller field line for the sequence object + * @param seq SequenceI + */ + ModellerDescription(SequenceI seq) + { + + if (seq.getDescription() != null) + { + fields = parseDescription(seq.getDescription()); + } + + if (isModellerFieldset()) + { + // Set start and end before we update the type (in the case of a synthesized field set) + if (getStartNum() != seq.getStart() && getStartCode().val != null) + { + setStartCode(seq.getStart()); + } + + if (getEndNum() != seq.getEnd() && getStartCode().val != null) + { + setEndCode(seq.getEnd()); + } + } + else + { + // synthesize fields + setStartCode(seq.getStart()); + setEndCode(seq.getEnd()); + fields.put(Fields[LOCALID], seq.getName()); // this may be overwritten below... + // type - decide based on evidence of PDB database references - this also sets the local reference field + int t = 0; // sequence + if (seq.getDatasetSequence() != null && + seq.getDatasetSequence().getDBRef() != null) + { + jalview.datamodel.DBRefEntry[] dbr = seq.getDatasetSequence().getDBRef(); + int i, j; + for (i = 0, j = dbr.length; i < j; i++) + { + if (dbr[i] != null) + { + // JBPNote PDB dbRefEntry needs properties to propagate onto ModellerField + // JBPNote Need to get info from the user about whether the sequence is the one being modelled, or if it is a template. + if (dbr[i].getSource().equals(jalview.datamodel.DBRefSource.PDB)) + { + fields.put(Fields[LOCALID], dbr[i].getAccessionId()); + t = 2; + break; + } + } + } + } + fields.put(Fields[TYPE], seqTypes[t]); + } + + } + + /** + * Indicate if fields parsed to a modeller-like colon-separated value line + * @return boolean + */ + boolean isModellerFieldset() + { + return (fields.containsKey(Fields[TYPE])); + } + + String getDescriptionLine() + { + String desc = ""; + int lastfield = Fields.length - 1; + + if (isModellerFieldset()) + { + String value; + // try to write a minimal modeller field set, so.. + + // find the last valid field in the entry + + for (; lastfield > 6; lastfield--) + { + if (fields.containsKey(Fields[lastfield])) + { + break; + } + } + + for (int i = 0; i < lastfield; i++) + { + value = (String) fields.get(Fields[i]); + if (value != null && value.length() > 0) + { + desc += ( (String) fields.get(Fields[i])) + ":"; + } + else + { + desc += Padding[i] + ":"; + } + } + } + // just return the last field if no others were defined. + if (fields.containsKey(Fields[lastfield])) + { + desc += (String) fields.get(Fields[lastfield]); + } + else + { + desc += "."; + } + return desc; + } + + int getStartNum() + { + int start = 0; + resCode val = getStartCode(); + if (val.val != null) + { + return val.val.intValue(); + } + return start; + } + + resCode getStartCode() + { + if (isModellerFieldset() && fields.containsKey(Fields[START] + "num")) + { + return (resCode) fields.get(Fields[START] + "num"); + } + return null; + } + + resCode getEndCode() + { + if (isModellerFieldset() && fields.containsKey(Fields[END] + "num")) + { + return (resCode) fields.get(Fields[END] + "num"); + } + return null; + } + + int getEndNum() + { + int end = 0; + resCode val = getEndCode(); + if (val.val != null) + { + return val.val.intValue(); + } + return end; + } + + /** + * returns true if sequence object was modifed with a valid modellerField set + * @param newSeq SequenceI + * @return boolean + */ + boolean updateSequenceI(SequenceI newSeq) + { + if (isModellerFieldset()) + { + if (getStartCode().val != null) + { + newSeq.setStart(getStartNum()); + } + else + { + newSeq.setStart(1); + } + if (getEndCode().val != null) + { + newSeq.setEnd(getEndNum()); + } + else + { + newSeq.setEnd(newSeq.getStart() + newSeq.getLength()); + } + return true; + } + return false; + } +} diff --git a/src/jalview/io/NewickFile.java b/src/jalview/io/NewickFile.java index 9a7f6fb..7dd98c0 100755 --- a/src/jalview/io/NewickFile.java +++ b/src/jalview/io/NewickFile.java @@ -1,22 +1,21 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - // NewickFile.java // Tree I/O // http://evolution.genetics.washington.edu/phylip/newick_doc.html diff --git a/src/jalview/io/PIRFile.java b/src/jalview/io/PIRFile.java index b18b8f4..3e5abd6 100755 --- a/src/jalview/io/PIRFile.java +++ b/src/jalview/io/PIRFile.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/io/PfamFile.java b/src/jalview/io/PfamFile.java index 2b0bf13..07c660c 100755 --- a/src/jalview/io/PfamFile.java +++ b/src/jalview/io/PfamFile.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/io/PileUpfile.java b/src/jalview/io/PileUpfile.java index cd46541..e469b5f 100755 --- a/src/jalview/io/PileUpfile.java +++ b/src/jalview/io/PileUpfile.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/io/StockholmFile.java b/src/jalview/io/StockholmFile.java index ccbe818..4ba1851 100644 --- a/src/jalview/io/StockholmFile.java +++ b/src/jalview/io/StockholmFile.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/io/VamsasAppDatastore.java b/src/jalview/io/VamsasAppDatastore.java index 1964c2f..e77355e 100644 --- a/src/jalview/io/VamsasAppDatastore.java +++ b/src/jalview/io/VamsasAppDatastore.java @@ -1,22 +1,21 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.io; import jalview.bin.Cache; diff --git a/src/jalview/io/WSWUBlastClient.java b/src/jalview/io/WSWUBlastClient.java index 1d42620..2a5f02f 100755 --- a/src/jalview/io/WSWUBlastClient.java +++ b/src/jalview/io/WSWUBlastClient.java @@ -1,303 +1,303 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.io; - -import java.util.*; - -import javax.swing.*; - -import jalview.analysis.*; -import jalview.datamodel.*; -import jalview.gui.*; -import uk.ac.ebi.www.*; - -/** - * DOCUMENT ME! - * - * @author $author$ - * @version $Revision$ - */ -public class WSWUBlastClient -{ - AlignmentPanel ap; - AlignmentI al; - CutAndPasteTransfer output = new CutAndPasteTransfer(); - int jobsRunning = 0; - - Vector suggestedIds = new Vector(); - /** - * Creates a new WSWUBlastClient object. - * - * @param al DOCUMENT ME! - * @param ids DOCUMENT ME! - */ - public WSWUBlastClient(AlignmentPanel ap, AlignmentI al, ArrayList ids) - { - this.ap = ap; - this.al = al; - output.setText( - "To display sequence features an exact Uniprot id with 100% sequence identity match must be entered." - + "\nIn order to display these features, try changing the names of your sequences to the ids suggested below." - + "\n\nRunning WSWUBlast at EBI." - + "\nPlease quote Pillai S., Silventoinen V., Kallio K., Senger M., Sobhany S., Tate J., Velankar S., Golovin A., Henrick K., Rice P., Stoehr P., Lopez R." - + - "\nSOAP-based services provided by the European Bioinformatics Institute." - + "\nNucleic Acids Res. 33(1):W25-W28 (2005));"); - - Desktop.addInternalFrame(output, - "BLASTing for unidentified sequences ", 800, 300); - - for (int i = 0; i < ids.size(); i++) - { - Sequence sequence = (Sequence) ids.get(i); - System.out.println(sequence.getName()); - - BlastThread thread = new BlastThread(sequence); - thread.start(); - jobsRunning++; - } - - ImageTwirler thread = new ImageTwirler(); - thread.start(); - } - - /** - * DOCUMENT ME! - * - * @param id1 DOCUMENT ME! - * @param res DOCUMENT ME! - */ - void parseResult(Sequence seq, String res) - { - StringTokenizer st = new StringTokenizer(res, "\n"); - String data; - String id2; - int maxFound = 90; - StringBuffer buffer = new StringBuffer("\n\n" + seq.getName() + " :"); - - while (st.hasMoreTokens()) - { - data = st.nextToken(); - - if (data.indexOf(">UNIPROT") > -1) - { - int index = data.indexOf(">UNIPROT") + 9; - id2 = data.substring(index, data.indexOf(" ", index)); - - boolean identitiesFound = false; - while (!identitiesFound) - { - data = st.nextToken(); - - if (data.indexOf("Identities") > -1) - { - identitiesFound = true; - - int value = Integer.parseInt(data.substring(data.indexOf( - "(") + 1, - data.indexOf("%"))); - - if (value >= maxFound) - { - maxFound = value; - buffer.append(" " + id2 + " " + value + "%; "); - suggestedIds.addElement(new Object[] - {seq, id2}); - } - } - } - } - } - - output.appendText(buffer.toString()); - } - - void updateIds() - { - // This must be outside the run() body as java 1.5 - // will not return any value from the OptionPane to the expired thread. - int reply = JOptionPane.showConfirmDialog( - Desktop.desktop, "Automatically update suggested ids?", - "Auto replace sequence ids", JOptionPane.YES_NO_OPTION); - - if (reply == JOptionPane.YES_OPTION) - { - Enumeration keys = suggestedIds.elements(); - while (keys.hasMoreElements()) - { - Object[] object = (Object[]) keys.nextElement(); - - Sequence oldseq = (Sequence) object[0]; - - oldseq.setName(object[1].toString()); - - // Oldseq is actually in the dataset, we must find the - // Visible seq and change its name also. - for (int i = 0; i < al.getHeight(); i++) - { - if (al.getSequenceAt(i).getDatasetSequence() == oldseq) - { - al.getSequenceAt(i).setName(oldseq.getName()); - break; - } - } - - DBRefEntry[] entries = oldseq.getDBRef(); - if (entries != null) - { - oldseq.addDBRef(new jalview.datamodel. - DBRefEntry(jalview.datamodel.DBRefSource.UNIPROT, - "0", - entries[0].getAccessionId())); - } - } - } - ap.paintAlignment(true); - - } - - class ImageTwirler - extends Thread - { - ImageIcon[] imageIcon; - int imageIndex = 0; - - public ImageTwirler() - { - imageIcon = new ImageIcon[9]; - - for (int i = 0; i < 9; i++) - { - java.net.URL url = getClass().getResource("/images/dna" + - (i + 1) + ".gif"); - - if (url != null) - { - imageIcon[i] = new ImageIcon(url); - } - } - } - - public void run() - { - while (jobsRunning > 0) - { - try - { - Thread.sleep(100); - imageIndex++; - imageIndex %= 9; - output.setFrameIcon(imageIcon[imageIndex]); - output.setTitle("BLASTing for unidentified sequences - " + - jobsRunning + " jobs running."); - } - catch (Exception ex) - { - } - } - - if (jobsRunning == 0) - { - updateIds(); - } - } - } - - class BlastThread - extends Thread - { - Sequence sequence; - String jobid; - boolean jobComplete = false; - - BlastThread(Sequence sequence) - { - System.out.println("blasting for: " + sequence.getName()); - this.sequence = sequence; - } - - public void run() - { - StartJob(); - - while (!jobComplete) - { - try - { - WSWUBlastService service = new WSWUBlastServiceLocator(); - WSWUBlast wublast = service.getWSWUBlast(); - WSFile[] results = wublast.getResults(jobid); - - if (results != null) - { - String result = new String(wublast.poll(jobid, "tooloutput")); - parseResult(sequence, result); - jobComplete = true; - jobsRunning--; - } - else - { - Thread.sleep(10000); - System.out.println("WSWuBlastClient: I'm alive " + - sequence.getName() + " " + jobid); // log.debug - } - } - catch (Exception ex) - { - } - } - } - - void StartJob() - { - InputParams params = new InputParams(); - - params.setProgram("blastp"); - params.setDatabase("uniprot"); - params.setMatrix("pam10"); - - params.setNumal(5); - params.setSensitivity("low"); - params.setSort("totalscore"); - params.setOutformat("txt"); - params.setAsync(true); - - try - { - Data inputs[] = new Data[1]; - Data input = new Data(); - input.setType("sequence"); - input.setContent(AlignSeq.extractGaps("-. ", - sequence.getSequenceAsString())); - inputs[0] = input; - - WSWUBlastService service = new WSWUBlastServiceLocator(); - WSWUBlast wublast = service.getWSWUBlast(); - jobid = wublast.runWUBlast(params, inputs); - } - catch (Exception exp) - { - jobComplete = true; - jobsRunning--; - System.err.println("WSWUBlastClient error:\n" + exp.toString()); - exp.printStackTrace(); - } - } - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.io; + +import java.util.*; + +import javax.swing.*; + +import jalview.analysis.*; +import jalview.datamodel.*; +import jalview.gui.*; +import uk.ac.ebi.www.*; + +/** + * DOCUMENT ME! + * + * @author $author$ + * @version $Revision$ + */ +public class WSWUBlastClient +{ + AlignmentPanel ap; + AlignmentI al; + CutAndPasteTransfer output = new CutAndPasteTransfer(); + int jobsRunning = 0; + + Vector suggestedIds = new Vector(); + /** + * Creates a new WSWUBlastClient object. + * + * @param al DOCUMENT ME! + * @param ids DOCUMENT ME! + */ + public WSWUBlastClient(AlignmentPanel ap, AlignmentI al, ArrayList ids) + { + this.ap = ap; + this.al = al; + output.setText( + "To display sequence features an exact Uniprot id with 100% sequence identity match must be entered." + + "\nIn order to display these features, try changing the names of your sequences to the ids suggested below." + + "\n\nRunning WSWUBlast at EBI." + + "\nPlease quote Pillai S., Silventoinen V., Kallio K., Senger M., Sobhany S., Tate J., Velankar S., Golovin A., Henrick K., Rice P., Stoehr P., Lopez R." + + + "\nSOAP-based services provided by the European Bioinformatics Institute." + + "\nNucleic Acids Res. 33(1):W25-W28 (2005));"); + + Desktop.addInternalFrame(output, + "BLASTing for unidentified sequences ", 800, 300); + + for (int i = 0; i < ids.size(); i++) + { + Sequence sequence = (Sequence) ids.get(i); + System.out.println(sequence.getName()); + + BlastThread thread = new BlastThread(sequence); + thread.start(); + jobsRunning++; + } + + ImageTwirler thread = new ImageTwirler(); + thread.start(); + } + + /** + * DOCUMENT ME! + * + * @param id1 DOCUMENT ME! + * @param res DOCUMENT ME! + */ + void parseResult(Sequence seq, String res) + { + StringTokenizer st = new StringTokenizer(res, "\n"); + String data; + String id2; + int maxFound = 90; + StringBuffer buffer = new StringBuffer("\n\n" + seq.getName() + " :"); + + while (st.hasMoreTokens()) + { + data = st.nextToken(); + + if (data.indexOf(">UNIPROT") > -1) + { + int index = data.indexOf(">UNIPROT") + 9; + id2 = data.substring(index, data.indexOf(" ", index)); + + boolean identitiesFound = false; + while (!identitiesFound) + { + data = st.nextToken(); + + if (data.indexOf("Identities") > -1) + { + identitiesFound = true; + + int value = Integer.parseInt(data.substring(data.indexOf( + "(") + 1, + data.indexOf("%"))); + + if (value >= maxFound) + { + maxFound = value; + buffer.append(" " + id2 + " " + value + "%; "); + suggestedIds.addElement(new Object[] + {seq, id2}); + } + } + } + } + } + + output.appendText(buffer.toString()); + } + + void updateIds() + { + // This must be outside the run() body as java 1.5 + // will not return any value from the OptionPane to the expired thread. + int reply = JOptionPane.showConfirmDialog( + Desktop.desktop, "Automatically update suggested ids?", + "Auto replace sequence ids", JOptionPane.YES_NO_OPTION); + + if (reply == JOptionPane.YES_OPTION) + { + Enumeration keys = suggestedIds.elements(); + while (keys.hasMoreElements()) + { + Object[] object = (Object[]) keys.nextElement(); + + Sequence oldseq = (Sequence) object[0]; + + oldseq.setName(object[1].toString()); + + // Oldseq is actually in the dataset, we must find the + // Visible seq and change its name also. + for (int i = 0; i < al.getHeight(); i++) + { + if (al.getSequenceAt(i).getDatasetSequence() == oldseq) + { + al.getSequenceAt(i).setName(oldseq.getName()); + break; + } + } + + DBRefEntry[] entries = oldseq.getDBRef(); + if (entries != null) + { + oldseq.addDBRef(new jalview.datamodel. + DBRefEntry(jalview.datamodel.DBRefSource.UNIPROT, + "0", + entries[0].getAccessionId())); + } + } + } + ap.paintAlignment(true); + + } + + class ImageTwirler + extends Thread + { + ImageIcon[] imageIcon; + int imageIndex = 0; + + public ImageTwirler() + { + imageIcon = new ImageIcon[9]; + + for (int i = 0; i < 9; i++) + { + java.net.URL url = getClass().getResource("/images/dna" + + (i + 1) + ".gif"); + + if (url != null) + { + imageIcon[i] = new ImageIcon(url); + } + } + } + + public void run() + { + while (jobsRunning > 0) + { + try + { + Thread.sleep(100); + imageIndex++; + imageIndex %= 9; + output.setFrameIcon(imageIcon[imageIndex]); + output.setTitle("BLASTing for unidentified sequences - " + + jobsRunning + " jobs running."); + } + catch (Exception ex) + { + } + } + + if (jobsRunning == 0) + { + updateIds(); + } + } + } + + class BlastThread + extends Thread + { + Sequence sequence; + String jobid; + boolean jobComplete = false; + + BlastThread(Sequence sequence) + { + System.out.println("blasting for: " + sequence.getName()); + this.sequence = sequence; + } + + public void run() + { + StartJob(); + + while (!jobComplete) + { + try + { + WSWUBlastService service = new WSWUBlastServiceLocator(); + WSWUBlast wublast = service.getWSWUBlast(); + WSFile[] results = wublast.getResults(jobid); + + if (results != null) + { + String result = new String(wublast.poll(jobid, "tooloutput")); + parseResult(sequence, result); + jobComplete = true; + jobsRunning--; + } + else + { + Thread.sleep(10000); + System.out.println("WSWuBlastClient: I'm alive " + + sequence.getName() + " " + jobid); // log.debug + } + } + catch (Exception ex) + { + } + } + } + + void StartJob() + { + InputParams params = new InputParams(); + + params.setProgram("blastp"); + params.setDatabase("uniprot"); + params.setMatrix("pam10"); + + params.setNumal(5); + params.setSensitivity("low"); + params.setSort("totalscore"); + params.setOutformat("txt"); + params.setAsync(true); + + try + { + Data inputs[] = new Data[1]; + Data input = new Data(); + input.setType("sequence"); + input.setContent(AlignSeq.extractGaps("-. ", + sequence.getSequenceAsString())); + inputs[0] = input; + + WSWUBlastService service = new WSWUBlastServiceLocator(); + WSWUBlast wublast = service.getWSWUBlast(); + jobid = wublast.runWUBlast(params, inputs); + } + catch (Exception exp) + { + jobComplete = true; + jobsRunning--; + System.err.println("WSWUBlastClient error:\n" + exp.toString()); + exp.printStackTrace(); + } + } + } +} diff --git a/src/jalview/io/vamsas/DatastoreItem.java b/src/jalview/io/vamsas/DatastoreItem.java index 4cc540d..bcbcf38 100644 --- a/src/jalview/io/vamsas/DatastoreItem.java +++ b/src/jalview/io/vamsas/DatastoreItem.java @@ -1,3 +1,21 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ package jalview.io.vamsas; import jalview.bin.Cache; diff --git a/src/jalview/io/vamsas/Dbref.java b/src/jalview/io/vamsas/Dbref.java index c4d72c3..a26da89 100644 --- a/src/jalview/io/vamsas/Dbref.java +++ b/src/jalview/io/vamsas/Dbref.java @@ -1,3 +1,21 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ package jalview.io.vamsas; import jalview.datamodel.DBRefEntry; diff --git a/src/jalview/io/vamsas/LocalDocSyncObject.java b/src/jalview/io/vamsas/LocalDocSyncObject.java index bfc2123..99e72ab 100644 --- a/src/jalview/io/vamsas/LocalDocSyncObject.java +++ b/src/jalview/io/vamsas/LocalDocSyncObject.java @@ -1,3 +1,21 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ package jalview.io.vamsas; import uk.ac.vamsas.client.Vobject; diff --git a/src/jalview/io/vamsas/Rangetype.java b/src/jalview/io/vamsas/Rangetype.java index b7e6f79..a475000 100644 --- a/src/jalview/io/vamsas/Rangetype.java +++ b/src/jalview/io/vamsas/Rangetype.java @@ -1,3 +1,21 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ package jalview.io.vamsas; @@ -267,4 +285,4 @@ public class Rangetype extends DatastoreItem } } -} \ No newline at end of file +} diff --git a/src/jalview/io/vamsas/Sequencemapping.java b/src/jalview/io/vamsas/Sequencemapping.java index 8c73992..c37dfd3 100644 --- a/src/jalview/io/vamsas/Sequencemapping.java +++ b/src/jalview/io/vamsas/Sequencemapping.java @@ -1,3 +1,21 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ package jalview.io.vamsas; import java.util.Vector; @@ -324,4 +342,4 @@ public class Sequencemapping extends Rangetype } } } -} \ No newline at end of file +} diff --git a/src/jalview/io/vamsas/Tree.java b/src/jalview/io/vamsas/Tree.java index eb4af4a..663325c 100644 --- a/src/jalview/io/vamsas/Tree.java +++ b/src/jalview/io/vamsas/Tree.java @@ -1,3 +1,21 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ package jalview.io.vamsas; import java.io.IOException; diff --git a/src/jalview/jbgui/GAlignFrame.java b/src/jalview/jbgui/GAlignFrame.java index 1bc0b72..675fc99 100755 --- a/src/jalview/jbgui/GAlignFrame.java +++ b/src/jalview/jbgui/GAlignFrame.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/jbgui/GAlignmentPanel.java b/src/jalview/jbgui/GAlignmentPanel.java index f8b91c4..b159e47 100755 --- a/src/jalview/jbgui/GAlignmentPanel.java +++ b/src/jalview/jbgui/GAlignmentPanel.java @@ -1,108 +1,108 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.jbgui; - -import java.awt.*; -import javax.swing.*; -import javax.swing.border.*; - -public class GAlignmentPanel - extends JPanel -{ - protected JPanel sequenceHolderPanel = new JPanel(); - protected JScrollBar vscroll = new JScrollBar(); - protected JScrollBar hscroll = new JScrollBar(); - protected JPanel seqPanelHolder = new JPanel(); - BorderLayout borderLayout1 = new BorderLayout(); - BorderLayout borderLayout3 = new BorderLayout(); - protected JPanel scalePanelHolder = new JPanel(); - protected JPanel idPanelHolder = new JPanel(); - BorderLayout borderLayout5 = new BorderLayout(); - protected JPanel idSpaceFillerPanel1 = new JPanel(); - public JPanel annotationSpaceFillerHolder = new JPanel(); - BorderLayout borderLayout6 = new BorderLayout(); - ButtonGroup buttonGroup1 = new ButtonGroup(); - BorderLayout borderLayout7 = new BorderLayout(); - JPanel hscrollHolder = new JPanel(); - BorderLayout borderLayout10 = new BorderLayout(); - protected JPanel hscrollFillerPanel = new JPanel(); - BorderLayout borderLayout11 = new BorderLayout(); - public JScrollPane annotationScroller = new JScrollPane(); - Border border1; - BorderLayout borderLayout4 = new BorderLayout(); - - public GAlignmentPanel() - { - try - { - jbInit(); - } - catch (Exception e) - { - e.printStackTrace(); - } - } - - private void jbInit() - throws Exception - { - border1 = BorderFactory.createLineBorder(Color.gray, 1); - idPanelHolder.setBorder(null); - idPanelHolder.setPreferredSize(new Dimension(70, 10)); - this.setLayout(borderLayout7); - sequenceHolderPanel.setMaximumSize(new Dimension(2147483647, 2147483647)); - sequenceHolderPanel.setMinimumSize(new Dimension(150, 150)); - sequenceHolderPanel.setPreferredSize(new Dimension(150, 150)); - sequenceHolderPanel.setLayout(borderLayout3); - seqPanelHolder.setLayout(borderLayout1); - scalePanelHolder.setBackground(Color.white); - scalePanelHolder.setMinimumSize(new Dimension(10, 80)); - scalePanelHolder.setPreferredSize(new Dimension(10, 30)); - scalePanelHolder.setLayout(borderLayout6); - idPanelHolder.setLayout(borderLayout5); - idSpaceFillerPanel1.setBackground(Color.white); - idSpaceFillerPanel1.setPreferredSize(new Dimension(10, 30)); - idSpaceFillerPanel1.setLayout(borderLayout11); - annotationSpaceFillerHolder.setBackground(Color.white); - annotationSpaceFillerHolder.setPreferredSize(new Dimension(10, 80)); - annotationSpaceFillerHolder.setLayout(borderLayout4); - hscroll.setOrientation(JScrollBar.HORIZONTAL); - hscrollHolder.setLayout(borderLayout10); - hscrollFillerPanel.setBackground(Color.white); - hscrollFillerPanel.setPreferredSize(new Dimension(70, 10)); - hscrollHolder.setBackground(Color.white); - annotationScroller.setBorder(null); - annotationScroller.setPreferredSize(new Dimension(10, 80)); - this.setPreferredSize(new Dimension(220, 166)); - - sequenceHolderPanel.add(scalePanelHolder, BorderLayout.NORTH); - sequenceHolderPanel.add(seqPanelHolder, BorderLayout.CENTER); - seqPanelHolder.add(vscroll, BorderLayout.EAST); - sequenceHolderPanel.add(annotationScroller, BorderLayout.SOUTH); - - // jPanel3.add(secondaryPanelHolder, BorderLayout.SOUTH); - this.add(idPanelHolder, BorderLayout.WEST); - idPanelHolder.add(idSpaceFillerPanel1, BorderLayout.NORTH); - idPanelHolder.add(annotationSpaceFillerHolder, BorderLayout.SOUTH); - this.add(hscrollHolder, BorderLayout.SOUTH); - hscrollHolder.add(hscroll, BorderLayout.CENTER); - hscrollHolder.add(hscrollFillerPanel, BorderLayout.WEST); - this.add(sequenceHolderPanel, BorderLayout.CENTER); - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.jbgui; + +import java.awt.*; +import javax.swing.*; +import javax.swing.border.*; + +public class GAlignmentPanel + extends JPanel +{ + protected JPanel sequenceHolderPanel = new JPanel(); + protected JScrollBar vscroll = new JScrollBar(); + protected JScrollBar hscroll = new JScrollBar(); + protected JPanel seqPanelHolder = new JPanel(); + BorderLayout borderLayout1 = new BorderLayout(); + BorderLayout borderLayout3 = new BorderLayout(); + protected JPanel scalePanelHolder = new JPanel(); + protected JPanel idPanelHolder = new JPanel(); + BorderLayout borderLayout5 = new BorderLayout(); + protected JPanel idSpaceFillerPanel1 = new JPanel(); + public JPanel annotationSpaceFillerHolder = new JPanel(); + BorderLayout borderLayout6 = new BorderLayout(); + ButtonGroup buttonGroup1 = new ButtonGroup(); + BorderLayout borderLayout7 = new BorderLayout(); + JPanel hscrollHolder = new JPanel(); + BorderLayout borderLayout10 = new BorderLayout(); + protected JPanel hscrollFillerPanel = new JPanel(); + BorderLayout borderLayout11 = new BorderLayout(); + public JScrollPane annotationScroller = new JScrollPane(); + Border border1; + BorderLayout borderLayout4 = new BorderLayout(); + + public GAlignmentPanel() + { + try + { + jbInit(); + } + catch (Exception e) + { + e.printStackTrace(); + } + } + + private void jbInit() + throws Exception + { + border1 = BorderFactory.createLineBorder(Color.gray, 1); + idPanelHolder.setBorder(null); + idPanelHolder.setPreferredSize(new Dimension(70, 10)); + this.setLayout(borderLayout7); + sequenceHolderPanel.setMaximumSize(new Dimension(2147483647, 2147483647)); + sequenceHolderPanel.setMinimumSize(new Dimension(150, 150)); + sequenceHolderPanel.setPreferredSize(new Dimension(150, 150)); + sequenceHolderPanel.setLayout(borderLayout3); + seqPanelHolder.setLayout(borderLayout1); + scalePanelHolder.setBackground(Color.white); + scalePanelHolder.setMinimumSize(new Dimension(10, 80)); + scalePanelHolder.setPreferredSize(new Dimension(10, 30)); + scalePanelHolder.setLayout(borderLayout6); + idPanelHolder.setLayout(borderLayout5); + idSpaceFillerPanel1.setBackground(Color.white); + idSpaceFillerPanel1.setPreferredSize(new Dimension(10, 30)); + idSpaceFillerPanel1.setLayout(borderLayout11); + annotationSpaceFillerHolder.setBackground(Color.white); + annotationSpaceFillerHolder.setPreferredSize(new Dimension(10, 80)); + annotationSpaceFillerHolder.setLayout(borderLayout4); + hscroll.setOrientation(JScrollBar.HORIZONTAL); + hscrollHolder.setLayout(borderLayout10); + hscrollFillerPanel.setBackground(Color.white); + hscrollFillerPanel.setPreferredSize(new Dimension(70, 10)); + hscrollHolder.setBackground(Color.white); + annotationScroller.setBorder(null); + annotationScroller.setPreferredSize(new Dimension(10, 80)); + this.setPreferredSize(new Dimension(220, 166)); + + sequenceHolderPanel.add(scalePanelHolder, BorderLayout.NORTH); + sequenceHolderPanel.add(seqPanelHolder, BorderLayout.CENTER); + seqPanelHolder.add(vscroll, BorderLayout.EAST); + sequenceHolderPanel.add(annotationScroller, BorderLayout.SOUTH); + + // jPanel3.add(secondaryPanelHolder, BorderLayout.SOUTH); + this.add(idPanelHolder, BorderLayout.WEST); + idPanelHolder.add(idSpaceFillerPanel1, BorderLayout.NORTH); + idPanelHolder.add(annotationSpaceFillerHolder, BorderLayout.SOUTH); + this.add(hscrollHolder, BorderLayout.SOUTH); + hscrollHolder.add(hscroll, BorderLayout.CENTER); + hscrollHolder.add(hscrollFillerPanel, BorderLayout.WEST); + this.add(sequenceHolderPanel, BorderLayout.CENTER); + } +} diff --git a/src/jalview/jbgui/GCutAndPasteTransfer.java b/src/jalview/jbgui/GCutAndPasteTransfer.java index c19db0e..5db9b74 100755 --- a/src/jalview/jbgui/GCutAndPasteTransfer.java +++ b/src/jalview/jbgui/GCutAndPasteTransfer.java @@ -1,212 +1,212 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.jbgui; - -import java.awt.*; -import java.awt.event.*; -import javax.swing.*; - -/** - * DOCUMENT ME! - * - * @author $author$ - * @version $Revision$ - */ -public class GCutAndPasteTransfer - extends JInternalFrame -{ - protected JTextArea textarea = new JTextArea(); - protected JScrollPane scrollPane = new JScrollPane(); - BorderLayout borderLayout1 = new BorderLayout(); - JMenuBar editMenubar = new JMenuBar(); - JMenu editMenu = new JMenu(); - JMenuItem copyItem = new JMenuItem(); - JMenuItem pasteMenu = new JMenuItem(); - BorderLayout borderLayout2 = new BorderLayout(); - protected JPanel inputButtonPanel = new JPanel(); - protected JButton ok = new JButton(); - JButton cancel = new JButton(); - JMenuItem selectAll = new JMenuItem(); - JMenu jMenu1 = new JMenu(); - JMenuItem save = new JMenuItem(); - - /** - * Creates a new GCutAndPasteTransfer object. - */ - public GCutAndPasteTransfer() - { - try - { - setJMenuBar(editMenubar); - jbInit(); - } - catch (Exception e) - { - e.printStackTrace(); - } - } - - /** - * DOCUMENT ME! - * - * @throws Exception DOCUMENT ME! - */ - private void jbInit() - throws Exception - { - scrollPane.setBorder(null); - ok.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); - ok.setText("New Window"); - ok.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - ok_actionPerformed(e); - } - }); - cancel.setText("Close"); - cancel.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - cancel_actionPerformed(e); - } - }); - textarea.setBorder(null); - - selectAll.setText("Select All"); - selectAll.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event. - KeyEvent.VK_A, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false)); - selectAll.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - selectAll_actionPerformed(e); - } - }); - jMenu1.setText("File"); - save.setText("Save"); - save.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event. - KeyEvent.VK_S, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false)); - save.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - save_actionPerformed(e); - } - }); - copyItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event. - KeyEvent.VK_C, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false)); - pasteMenu.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event. - KeyEvent.VK_V, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false)); - editMenubar.add(jMenu1); - editMenubar.add(editMenu); - textarea.setFont(new java.awt.Font("Monospaced", Font.PLAIN, 12)); - textarea.addMouseListener(new java.awt.event.MouseAdapter() - { - public void mousePressed(MouseEvent e) - { - textarea_mousePressed(e); - } - }); - editMenu.setText("Edit"); - pasteMenu.setText("Paste"); - pasteMenu.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - pasteMenu_actionPerformed(e); - } - }); - copyItem.setText("Copy"); - copyItem.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - copyItem_actionPerformed(e); - } - }); - this.getContentPane().setLayout(borderLayout2); - scrollPane.setBorder(null); - scrollPane.getViewport().add(textarea, null); - editMenu.add(selectAll); - editMenu.add(copyItem); - editMenu.add(pasteMenu); - this.getContentPane().add(scrollPane, java.awt.BorderLayout.CENTER); - inputButtonPanel.add(ok); - inputButtonPanel.add(cancel); - jMenu1.add(save); - } - - /** - * DOCUMENT ME! - * - * @param e DOCUMENT ME! - */ - public void textarea_mousePressed(MouseEvent e) - { - - } - - /** - * DOCUMENT ME! - * - * @param e DOCUMENT ME! - */ - public void copyItem_actionPerformed(ActionEvent e) - { - } - - /** - * DOCUMENT ME! - * - * @param e DOCUMENT ME! - */ - public void pasteMenu_actionPerformed(ActionEvent e) - { - } - - /** - * DOCUMENT ME! - * - * @param e DOCUMENT ME! - */ - public void ok_actionPerformed(ActionEvent e) - { - } - - /** - * DOCUMENT ME! - * - * @param e DOCUMENT ME! - */ - public void cancel_actionPerformed(ActionEvent e) - { - } - - public void selectAll_actionPerformed(ActionEvent e) - { - textarea.selectAll(); - } - - public void save_actionPerformed(ActionEvent e) - { - - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.jbgui; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; + +/** + * DOCUMENT ME! + * + * @author $author$ + * @version $Revision$ + */ +public class GCutAndPasteTransfer + extends JInternalFrame +{ + protected JTextArea textarea = new JTextArea(); + protected JScrollPane scrollPane = new JScrollPane(); + BorderLayout borderLayout1 = new BorderLayout(); + JMenuBar editMenubar = new JMenuBar(); + JMenu editMenu = new JMenu(); + JMenuItem copyItem = new JMenuItem(); + JMenuItem pasteMenu = new JMenuItem(); + BorderLayout borderLayout2 = new BorderLayout(); + protected JPanel inputButtonPanel = new JPanel(); + protected JButton ok = new JButton(); + JButton cancel = new JButton(); + JMenuItem selectAll = new JMenuItem(); + JMenu jMenu1 = new JMenu(); + JMenuItem save = new JMenuItem(); + + /** + * Creates a new GCutAndPasteTransfer object. + */ + public GCutAndPasteTransfer() + { + try + { + setJMenuBar(editMenubar); + jbInit(); + } + catch (Exception e) + { + e.printStackTrace(); + } + } + + /** + * DOCUMENT ME! + * + * @throws Exception DOCUMENT ME! + */ + private void jbInit() + throws Exception + { + scrollPane.setBorder(null); + ok.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); + ok.setText("New Window"); + ok.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + ok_actionPerformed(e); + } + }); + cancel.setText("Close"); + cancel.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + cancel_actionPerformed(e); + } + }); + textarea.setBorder(null); + + selectAll.setText("Select All"); + selectAll.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event. + KeyEvent.VK_A, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false)); + selectAll.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + selectAll_actionPerformed(e); + } + }); + jMenu1.setText("File"); + save.setText("Save"); + save.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event. + KeyEvent.VK_S, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false)); + save.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + save_actionPerformed(e); + } + }); + copyItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event. + KeyEvent.VK_C, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false)); + pasteMenu.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event. + KeyEvent.VK_V, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false)); + editMenubar.add(jMenu1); + editMenubar.add(editMenu); + textarea.setFont(new java.awt.Font("Monospaced", Font.PLAIN, 12)); + textarea.addMouseListener(new java.awt.event.MouseAdapter() + { + public void mousePressed(MouseEvent e) + { + textarea_mousePressed(e); + } + }); + editMenu.setText("Edit"); + pasteMenu.setText("Paste"); + pasteMenu.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + pasteMenu_actionPerformed(e); + } + }); + copyItem.setText("Copy"); + copyItem.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + copyItem_actionPerformed(e); + } + }); + this.getContentPane().setLayout(borderLayout2); + scrollPane.setBorder(null); + scrollPane.getViewport().add(textarea, null); + editMenu.add(selectAll); + editMenu.add(copyItem); + editMenu.add(pasteMenu); + this.getContentPane().add(scrollPane, java.awt.BorderLayout.CENTER); + inputButtonPanel.add(ok); + inputButtonPanel.add(cancel); + jMenu1.add(save); + } + + /** + * DOCUMENT ME! + * + * @param e DOCUMENT ME! + */ + public void textarea_mousePressed(MouseEvent e) + { + + } + + /** + * DOCUMENT ME! + * + * @param e DOCUMENT ME! + */ + public void copyItem_actionPerformed(ActionEvent e) + { + } + + /** + * DOCUMENT ME! + * + * @param e DOCUMENT ME! + */ + public void pasteMenu_actionPerformed(ActionEvent e) + { + } + + /** + * DOCUMENT ME! + * + * @param e DOCUMENT ME! + */ + public void ok_actionPerformed(ActionEvent e) + { + } + + /** + * DOCUMENT ME! + * + * @param e DOCUMENT ME! + */ + public void cancel_actionPerformed(ActionEvent e) + { + } + + public void selectAll_actionPerformed(ActionEvent e) + { + textarea.selectAll(); + } + + public void save_actionPerformed(ActionEvent e) + { + + } +} diff --git a/src/jalview/jbgui/GDasSourceBrowser.java b/src/jalview/jbgui/GDasSourceBrowser.java index d4f6d1d..1e644a0 100755 --- a/src/jalview/jbgui/GDasSourceBrowser.java +++ b/src/jalview/jbgui/GDasSourceBrowser.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/jbgui/GDesktop.java b/src/jalview/jbgui/GDesktop.java index aa86809..4145be4 100755 --- a/src/jalview/jbgui/GDesktop.java +++ b/src/jalview/jbgui/GDesktop.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/jbgui/GFinder.java b/src/jalview/jbgui/GFinder.java index 9d72d26..6f6e1e7 100755 --- a/src/jalview/jbgui/GFinder.java +++ b/src/jalview/jbgui/GFinder.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/jbgui/GFontChooser.java b/src/jalview/jbgui/GFontChooser.java index 6c04561..a620ebb 100755 --- a/src/jalview/jbgui/GFontChooser.java +++ b/src/jalview/jbgui/GFontChooser.java @@ -1,252 +1,252 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.jbgui; - -import java.awt.*; -import java.awt.event.*; -import javax.swing.*; - -/** - * DOCUMENT ME! - * - * @author $author$ - * @version $Revision$ - */ -public class GFontChooser - extends JPanel -{ - JLabel jLabel1 = new JLabel(); - protected JComboBox fontSize = new JComboBox(); - protected JComboBox fontStyle = new JComboBox(); - JLabel jLabel2 = new JLabel(); - JLabel jLabel3 = new JLabel(); - protected JComboBox fontName = new JComboBox(); - JButton ok = new JButton(); - JButton cancel = new JButton(); - JPanel jPanel1 = new JPanel(); - JPanel jPanel2 = new JPanel(); - JPanel jPanel3 = new JPanel(); - BorderLayout borderLayout1 = new BorderLayout(); - BorderLayout borderLayout2 = new BorderLayout(); - BorderLayout borderLayout3 = new BorderLayout(); - protected JButton defaultButton = new JButton(); - protected JCheckBox smoothFont = new JCheckBox(); - BorderLayout borderLayout4 = new BorderLayout(); - protected JCheckBox monospaced = new JCheckBox(); - JPanel jPanel4 = new JPanel(); - - /** - * Creates a new GFontChooser object. - */ - public GFontChooser() - { - try - { - jbInit(); - } - catch (Exception e) - { - e.printStackTrace(); - } - } - - /** - * DOCUMENT ME! - * - * @throws Exception DOCUMENT ME! - */ - private void jbInit() - throws Exception - { - jLabel1.setFont(new java.awt.Font("Verdana", 0, 11)); - jLabel1.setHorizontalAlignment(SwingConstants.RIGHT); - jLabel1.setText("Font: "); - jLabel1.setVerticalTextPosition(javax.swing.SwingConstants.CENTER); - this.setLayout(null); - fontSize.setFont(new java.awt.Font("Verdana", 0, 11)); - fontSize.setOpaque(false); - fontSize.setPreferredSize(new Dimension(50, 21)); - fontSize.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(ActionEvent e) - { - fontSize_actionPerformed(e); - } - }); - fontStyle.setFont(new java.awt.Font("Verdana", 0, 11)); - fontStyle.setOpaque(false); - fontStyle.setPreferredSize(new Dimension(90, 21)); - fontStyle.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(ActionEvent e) - { - fontStyle_actionPerformed(e); - } - }); - jLabel2.setFont(new java.awt.Font("Verdana", 0, 11)); - jLabel2.setHorizontalAlignment(SwingConstants.RIGHT); - jLabel2.setText("Size: "); - jLabel2.setVerticalTextPosition(javax.swing.SwingConstants.CENTER); - jLabel3.setFont(new java.awt.Font("Verdana", 0, 11)); - jLabel3.setHorizontalAlignment(SwingConstants.RIGHT); - jLabel3.setText("Style: "); - jLabel3.setVerticalTextPosition(javax.swing.SwingConstants.CENTER); - fontName.setFont(new java.awt.Font("Verdana", 0, 11)); - fontName.setMaximumSize(new Dimension(32767, 32767)); - fontName.setMinimumSize(new Dimension(300, 21)); - fontName.setOpaque(false); - fontName.setPreferredSize(new Dimension(180, 21)); - fontName.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(ActionEvent e) - { - fontName_actionPerformed(e); - } - }); - ok.setFont(new java.awt.Font("Verdana", 0, 11)); - ok.setText("OK"); - ok.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(ActionEvent e) - { - ok_actionPerformed(e); - } - }); - cancel.setFont(new java.awt.Font("Verdana", 0, 11)); - cancel.setText("Cancel"); - cancel.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(ActionEvent e) - { - cancel_actionPerformed(e); - } - }); - this.setBackground(Color.white); - jPanel1.setOpaque(false); - jPanel1.setBounds(new Rectangle(5, 6, 308, 23)); - jPanel1.setLayout(borderLayout1); - jPanel2.setOpaque(false); - jPanel2.setBounds(new Rectangle(5, 37, 128, 21)); - jPanel2.setLayout(borderLayout3); - jPanel3.setOpaque(false); - jPanel3.setBounds(new Rectangle(174, 38, 134, 21)); - jPanel3.setLayout(borderLayout2); - defaultButton.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); - defaultButton.setText("Set as Default"); - defaultButton.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - defaultButton_actionPerformed(e); - } - }); - smoothFont.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); - smoothFont.setOpaque(false); - smoothFont.setText("Anti-alias Fonts (Slower to render)"); - smoothFont.setBounds(new Rectangle(41, 65, 223, 23)); - smoothFont.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - smoothFont_actionPerformed(e); - } - }); - monospaced.setEnabled(false); - monospaced.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); - monospaced.setOpaque(false); - monospaced.setToolTipText("Monospaced fonts are faster to render"); - monospaced.setText("Monospaced"); - jPanel4.setOpaque(false); - jPanel4.setBounds(new Rectangle(24, 92, 259, 35)); - jPanel1.add(jLabel1, BorderLayout.WEST); - jPanel1.add(fontName, BorderLayout.CENTER); - jPanel1.add(monospaced, java.awt.BorderLayout.EAST); - this.add(jPanel3, null); - this.add(jPanel2, null); - jPanel2.add(fontSize, java.awt.BorderLayout.CENTER); - jPanel2.add(jLabel2, java.awt.BorderLayout.WEST); - jPanel4.add(defaultButton); - jPanel4.add(ok); - jPanel4.add(cancel); - this.add(smoothFont); - this.add(jPanel4); - jPanel3.add(jLabel3, java.awt.BorderLayout.WEST); - jPanel3.add(fontStyle, java.awt.BorderLayout.CENTER); - this.add(jPanel1, null); - } - - /** - * DOCUMENT ME! - * - * @param e DOCUMENT ME! - */ - protected void ok_actionPerformed(ActionEvent e) - { - } - - /** - * DOCUMENT ME! - * - * @param e DOCUMENT ME! - */ - protected void cancel_actionPerformed(ActionEvent e) - { - } - - /** - * DOCUMENT ME! - * - * @param e DOCUMENT ME! - */ - protected void fontName_actionPerformed(ActionEvent e) - { - } - - /** - * DOCUMENT ME! - * - * @param e DOCUMENT ME! - */ - protected void fontSize_actionPerformed(ActionEvent e) - { - } - - /** - * DOCUMENT ME! - * - * @param e DOCUMENT ME! - */ - protected void fontStyle_actionPerformed(ActionEvent e) - { - } - - /** - * DOCUMENT ME! - * - * @param e DOCUMENT ME! - */ - public void defaultButton_actionPerformed(ActionEvent e) - { - } - - public void smoothFont_actionPerformed(ActionEvent e) - { - - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.jbgui; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; + +/** + * DOCUMENT ME! + * + * @author $author$ + * @version $Revision$ + */ +public class GFontChooser + extends JPanel +{ + JLabel jLabel1 = new JLabel(); + protected JComboBox fontSize = new JComboBox(); + protected JComboBox fontStyle = new JComboBox(); + JLabel jLabel2 = new JLabel(); + JLabel jLabel3 = new JLabel(); + protected JComboBox fontName = new JComboBox(); + JButton ok = new JButton(); + JButton cancel = new JButton(); + JPanel jPanel1 = new JPanel(); + JPanel jPanel2 = new JPanel(); + JPanel jPanel3 = new JPanel(); + BorderLayout borderLayout1 = new BorderLayout(); + BorderLayout borderLayout2 = new BorderLayout(); + BorderLayout borderLayout3 = new BorderLayout(); + protected JButton defaultButton = new JButton(); + protected JCheckBox smoothFont = new JCheckBox(); + BorderLayout borderLayout4 = new BorderLayout(); + protected JCheckBox monospaced = new JCheckBox(); + JPanel jPanel4 = new JPanel(); + + /** + * Creates a new GFontChooser object. + */ + public GFontChooser() + { + try + { + jbInit(); + } + catch (Exception e) + { + e.printStackTrace(); + } + } + + /** + * DOCUMENT ME! + * + * @throws Exception DOCUMENT ME! + */ + private void jbInit() + throws Exception + { + jLabel1.setFont(new java.awt.Font("Verdana", 0, 11)); + jLabel1.setHorizontalAlignment(SwingConstants.RIGHT); + jLabel1.setText("Font: "); + jLabel1.setVerticalTextPosition(javax.swing.SwingConstants.CENTER); + this.setLayout(null); + fontSize.setFont(new java.awt.Font("Verdana", 0, 11)); + fontSize.setOpaque(false); + fontSize.setPreferredSize(new Dimension(50, 21)); + fontSize.addActionListener(new java.awt.event.ActionListener() + { + public void actionPerformed(ActionEvent e) + { + fontSize_actionPerformed(e); + } + }); + fontStyle.setFont(new java.awt.Font("Verdana", 0, 11)); + fontStyle.setOpaque(false); + fontStyle.setPreferredSize(new Dimension(90, 21)); + fontStyle.addActionListener(new java.awt.event.ActionListener() + { + public void actionPerformed(ActionEvent e) + { + fontStyle_actionPerformed(e); + } + }); + jLabel2.setFont(new java.awt.Font("Verdana", 0, 11)); + jLabel2.setHorizontalAlignment(SwingConstants.RIGHT); + jLabel2.setText("Size: "); + jLabel2.setVerticalTextPosition(javax.swing.SwingConstants.CENTER); + jLabel3.setFont(new java.awt.Font("Verdana", 0, 11)); + jLabel3.setHorizontalAlignment(SwingConstants.RIGHT); + jLabel3.setText("Style: "); + jLabel3.setVerticalTextPosition(javax.swing.SwingConstants.CENTER); + fontName.setFont(new java.awt.Font("Verdana", 0, 11)); + fontName.setMaximumSize(new Dimension(32767, 32767)); + fontName.setMinimumSize(new Dimension(300, 21)); + fontName.setOpaque(false); + fontName.setPreferredSize(new Dimension(180, 21)); + fontName.addActionListener(new java.awt.event.ActionListener() + { + public void actionPerformed(ActionEvent e) + { + fontName_actionPerformed(e); + } + }); + ok.setFont(new java.awt.Font("Verdana", 0, 11)); + ok.setText("OK"); + ok.addActionListener(new java.awt.event.ActionListener() + { + public void actionPerformed(ActionEvent e) + { + ok_actionPerformed(e); + } + }); + cancel.setFont(new java.awt.Font("Verdana", 0, 11)); + cancel.setText("Cancel"); + cancel.addActionListener(new java.awt.event.ActionListener() + { + public void actionPerformed(ActionEvent e) + { + cancel_actionPerformed(e); + } + }); + this.setBackground(Color.white); + jPanel1.setOpaque(false); + jPanel1.setBounds(new Rectangle(5, 6, 308, 23)); + jPanel1.setLayout(borderLayout1); + jPanel2.setOpaque(false); + jPanel2.setBounds(new Rectangle(5, 37, 128, 21)); + jPanel2.setLayout(borderLayout3); + jPanel3.setOpaque(false); + jPanel3.setBounds(new Rectangle(174, 38, 134, 21)); + jPanel3.setLayout(borderLayout2); + defaultButton.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); + defaultButton.setText("Set as Default"); + defaultButton.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + defaultButton_actionPerformed(e); + } + }); + smoothFont.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); + smoothFont.setOpaque(false); + smoothFont.setText("Anti-alias Fonts (Slower to render)"); + smoothFont.setBounds(new Rectangle(41, 65, 223, 23)); + smoothFont.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + smoothFont_actionPerformed(e); + } + }); + monospaced.setEnabled(false); + monospaced.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); + monospaced.setOpaque(false); + monospaced.setToolTipText("Monospaced fonts are faster to render"); + monospaced.setText("Monospaced"); + jPanel4.setOpaque(false); + jPanel4.setBounds(new Rectangle(24, 92, 259, 35)); + jPanel1.add(jLabel1, BorderLayout.WEST); + jPanel1.add(fontName, BorderLayout.CENTER); + jPanel1.add(monospaced, java.awt.BorderLayout.EAST); + this.add(jPanel3, null); + this.add(jPanel2, null); + jPanel2.add(fontSize, java.awt.BorderLayout.CENTER); + jPanel2.add(jLabel2, java.awt.BorderLayout.WEST); + jPanel4.add(defaultButton); + jPanel4.add(ok); + jPanel4.add(cancel); + this.add(smoothFont); + this.add(jPanel4); + jPanel3.add(jLabel3, java.awt.BorderLayout.WEST); + jPanel3.add(fontStyle, java.awt.BorderLayout.CENTER); + this.add(jPanel1, null); + } + + /** + * DOCUMENT ME! + * + * @param e DOCUMENT ME! + */ + protected void ok_actionPerformed(ActionEvent e) + { + } + + /** + * DOCUMENT ME! + * + * @param e DOCUMENT ME! + */ + protected void cancel_actionPerformed(ActionEvent e) + { + } + + /** + * DOCUMENT ME! + * + * @param e DOCUMENT ME! + */ + protected void fontName_actionPerformed(ActionEvent e) + { + } + + /** + * DOCUMENT ME! + * + * @param e DOCUMENT ME! + */ + protected void fontSize_actionPerformed(ActionEvent e) + { + } + + /** + * DOCUMENT ME! + * + * @param e DOCUMENT ME! + */ + protected void fontStyle_actionPerformed(ActionEvent e) + { + } + + /** + * DOCUMENT ME! + * + * @param e DOCUMENT ME! + */ + public void defaultButton_actionPerformed(ActionEvent e) + { + } + + public void smoothFont_actionPerformed(ActionEvent e) + { + + } +} diff --git a/src/jalview/jbgui/GPCAPanel.java b/src/jalview/jbgui/GPCAPanel.java index 5c17ba7..82d78e3 100755 --- a/src/jalview/jbgui/GPCAPanel.java +++ b/src/jalview/jbgui/GPCAPanel.java @@ -1,255 +1,255 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.jbgui; - -import java.awt.*; -import java.awt.event.*; -import javax.swing.*; -import javax.swing.event.*; - -public class GPCAPanel - extends JInternalFrame -{ - JPanel jPanel2 = new JPanel(); - JLabel jLabel1 = new JLabel(); - JLabel jLabel2 = new JLabel(); - JLabel jLabel3 = new JLabel(); - protected JComboBox xCombobox = new JComboBox(); - protected JComboBox yCombobox = new JComboBox(); - protected JComboBox zCombobox = new JComboBox(); - FlowLayout flowLayout1 = new FlowLayout(); - BorderLayout borderLayout1 = new BorderLayout(); - JMenuBar jMenuBar1 = new JMenuBar(); - JMenu fileMenu = new JMenu(); - JMenu saveMenu = new JMenu(); - JMenuItem eps = new JMenuItem(); - JMenuItem png = new JMenuItem(); - JMenuItem print = new JMenuItem(); - JMenuItem outputValues = new JMenuItem(); - protected JMenu viewMenu = new JMenu(); - protected JCheckBoxMenuItem showLabels = new JCheckBoxMenuItem(); - JMenuItem bgcolour = new JMenuItem(); - JMenuItem originalSeqData = new JMenuItem(); - protected JMenu associateViewsMenu = new JMenu(); - - public GPCAPanel() - { - try - { - jbInit(); - } - catch (Exception e) - { - e.printStackTrace(); - } - - for (int i = 1; i < 8; i++) - { - xCombobox.addItem("dim " + i); - yCombobox.addItem("dim " + i); - zCombobox.addItem("dim " + i); - } - - setJMenuBar(jMenuBar1); - } - - private void jbInit() - throws Exception - { - this.getContentPane().setLayout(borderLayout1); - jPanel2.setLayout(flowLayout1); - jLabel1.setFont(new java.awt.Font("Verdana", 0, 12)); - jLabel1.setText("x="); - jLabel2.setFont(new java.awt.Font("Verdana", 0, 12)); - jLabel2.setText("y="); - jLabel3.setFont(new java.awt.Font("Verdana", 0, 12)); - jLabel3.setText("z="); - jPanel2.setBackground(Color.white); - jPanel2.setBorder(null); - zCombobox.setFont(new java.awt.Font("Verdana", 0, 12)); - zCombobox.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(ActionEvent e) - { - zCombobox_actionPerformed(e); - } - }); - yCombobox.setFont(new java.awt.Font("Verdana", 0, 12)); - yCombobox.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(ActionEvent e) - { - yCombobox_actionPerformed(e); - } - }); - xCombobox.setFont(new java.awt.Font("Verdana", 0, 12)); - xCombobox.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(ActionEvent e) - { - xCombobox_actionPerformed(e); - } - }); - fileMenu.setText("File"); - saveMenu.setText("Save as"); - eps.setText("EPS"); - eps.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - eps_actionPerformed(e); - } - }); - png.setText("PNG"); - png.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - png_actionPerformed(e); - } - }); - outputValues.setText("Output Values..."); - outputValues.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - outputValues_actionPerformed(e); - } - }); - print.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - print_actionPerformed(e); - } - }); - viewMenu.setText("View"); - viewMenu.addMenuListener(new MenuListener() - { - public void menuSelected(MenuEvent e) - { - viewMenu_menuSelected(); - } - - public void menuDeselected(MenuEvent e) - { - } - - public void menuCanceled(MenuEvent e) - { - } - }); - showLabels.setText("Show Labels"); - showLabels.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - showLabels_actionPerformed(e); - } - }); - print.setText("Print"); - bgcolour.setText("Background Colour..."); - bgcolour.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - bgcolour_actionPerformed(e); - } - }); - originalSeqData.setText("Input Data..."); - originalSeqData.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - originalSeqData_actionPerformed(e); - } - }); - associateViewsMenu.setText("Associate Nodes With"); - this.getContentPane().add(jPanel2, BorderLayout.SOUTH); - jPanel2.add(jLabel1, null); - jPanel2.add(xCombobox, null); - jPanel2.add(jLabel2, null); - jPanel2.add(yCombobox, null); - jPanel2.add(jLabel3, null); - jPanel2.add(zCombobox, null); - jMenuBar1.add(fileMenu); - jMenuBar1.add(viewMenu); - fileMenu.add(saveMenu); - fileMenu.add(outputValues); - fileMenu.add(print); - fileMenu.add(originalSeqData); - saveMenu.add(eps); - saveMenu.add(png); - viewMenu.add(showLabels); - viewMenu.add(bgcolour); - viewMenu.add(associateViewsMenu); - } - - protected void xCombobox_actionPerformed(ActionEvent e) - { - } - - protected void yCombobox_actionPerformed(ActionEvent e) - { - } - - protected void zCombobox_actionPerformed(ActionEvent e) - { - } - - public void eps_actionPerformed(ActionEvent e) - { - - } - - public void png_actionPerformed(ActionEvent e) - { - - } - - public void outputValues_actionPerformed(ActionEvent e) - { - - } - - public void print_actionPerformed(ActionEvent e) - { - - } - - public void showLabels_actionPerformed(ActionEvent e) - { - - } - - public void bgcolour_actionPerformed(ActionEvent e) - { - - } - - public void originalSeqData_actionPerformed(ActionEvent e) - { - - } - - public void viewMenu_menuSelected() - { - - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.jbgui; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +import javax.swing.event.*; + +public class GPCAPanel + extends JInternalFrame +{ + JPanel jPanel2 = new JPanel(); + JLabel jLabel1 = new JLabel(); + JLabel jLabel2 = new JLabel(); + JLabel jLabel3 = new JLabel(); + protected JComboBox xCombobox = new JComboBox(); + protected JComboBox yCombobox = new JComboBox(); + protected JComboBox zCombobox = new JComboBox(); + FlowLayout flowLayout1 = new FlowLayout(); + BorderLayout borderLayout1 = new BorderLayout(); + JMenuBar jMenuBar1 = new JMenuBar(); + JMenu fileMenu = new JMenu(); + JMenu saveMenu = new JMenu(); + JMenuItem eps = new JMenuItem(); + JMenuItem png = new JMenuItem(); + JMenuItem print = new JMenuItem(); + JMenuItem outputValues = new JMenuItem(); + protected JMenu viewMenu = new JMenu(); + protected JCheckBoxMenuItem showLabels = new JCheckBoxMenuItem(); + JMenuItem bgcolour = new JMenuItem(); + JMenuItem originalSeqData = new JMenuItem(); + protected JMenu associateViewsMenu = new JMenu(); + + public GPCAPanel() + { + try + { + jbInit(); + } + catch (Exception e) + { + e.printStackTrace(); + } + + for (int i = 1; i < 8; i++) + { + xCombobox.addItem("dim " + i); + yCombobox.addItem("dim " + i); + zCombobox.addItem("dim " + i); + } + + setJMenuBar(jMenuBar1); + } + + private void jbInit() + throws Exception + { + this.getContentPane().setLayout(borderLayout1); + jPanel2.setLayout(flowLayout1); + jLabel1.setFont(new java.awt.Font("Verdana", 0, 12)); + jLabel1.setText("x="); + jLabel2.setFont(new java.awt.Font("Verdana", 0, 12)); + jLabel2.setText("y="); + jLabel3.setFont(new java.awt.Font("Verdana", 0, 12)); + jLabel3.setText("z="); + jPanel2.setBackground(Color.white); + jPanel2.setBorder(null); + zCombobox.setFont(new java.awt.Font("Verdana", 0, 12)); + zCombobox.addActionListener(new java.awt.event.ActionListener() + { + public void actionPerformed(ActionEvent e) + { + zCombobox_actionPerformed(e); + } + }); + yCombobox.setFont(new java.awt.Font("Verdana", 0, 12)); + yCombobox.addActionListener(new java.awt.event.ActionListener() + { + public void actionPerformed(ActionEvent e) + { + yCombobox_actionPerformed(e); + } + }); + xCombobox.setFont(new java.awt.Font("Verdana", 0, 12)); + xCombobox.addActionListener(new java.awt.event.ActionListener() + { + public void actionPerformed(ActionEvent e) + { + xCombobox_actionPerformed(e); + } + }); + fileMenu.setText("File"); + saveMenu.setText("Save as"); + eps.setText("EPS"); + eps.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + eps_actionPerformed(e); + } + }); + png.setText("PNG"); + png.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + png_actionPerformed(e); + } + }); + outputValues.setText("Output Values..."); + outputValues.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + outputValues_actionPerformed(e); + } + }); + print.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + print_actionPerformed(e); + } + }); + viewMenu.setText("View"); + viewMenu.addMenuListener(new MenuListener() + { + public void menuSelected(MenuEvent e) + { + viewMenu_menuSelected(); + } + + public void menuDeselected(MenuEvent e) + { + } + + public void menuCanceled(MenuEvent e) + { + } + }); + showLabels.setText("Show Labels"); + showLabels.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + showLabels_actionPerformed(e); + } + }); + print.setText("Print"); + bgcolour.setText("Background Colour..."); + bgcolour.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + bgcolour_actionPerformed(e); + } + }); + originalSeqData.setText("Input Data..."); + originalSeqData.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + originalSeqData_actionPerformed(e); + } + }); + associateViewsMenu.setText("Associate Nodes With"); + this.getContentPane().add(jPanel2, BorderLayout.SOUTH); + jPanel2.add(jLabel1, null); + jPanel2.add(xCombobox, null); + jPanel2.add(jLabel2, null); + jPanel2.add(yCombobox, null); + jPanel2.add(jLabel3, null); + jPanel2.add(zCombobox, null); + jMenuBar1.add(fileMenu); + jMenuBar1.add(viewMenu); + fileMenu.add(saveMenu); + fileMenu.add(outputValues); + fileMenu.add(print); + fileMenu.add(originalSeqData); + saveMenu.add(eps); + saveMenu.add(png); + viewMenu.add(showLabels); + viewMenu.add(bgcolour); + viewMenu.add(associateViewsMenu); + } + + protected void xCombobox_actionPerformed(ActionEvent e) + { + } + + protected void yCombobox_actionPerformed(ActionEvent e) + { + } + + protected void zCombobox_actionPerformed(ActionEvent e) + { + } + + public void eps_actionPerformed(ActionEvent e) + { + + } + + public void png_actionPerformed(ActionEvent e) + { + + } + + public void outputValues_actionPerformed(ActionEvent e) + { + + } + + public void print_actionPerformed(ActionEvent e) + { + + } + + public void showLabels_actionPerformed(ActionEvent e) + { + + } + + public void bgcolour_actionPerformed(ActionEvent e) + { + + } + + public void originalSeqData_actionPerformed(ActionEvent e) + { + + } + + public void viewMenu_menuSelected() + { + + } +} diff --git a/src/jalview/jbgui/GPairwiseAlignPanel.java b/src/jalview/jbgui/GPairwiseAlignPanel.java index f690a21..5e56bd9 100755 --- a/src/jalview/jbgui/GPairwiseAlignPanel.java +++ b/src/jalview/jbgui/GPairwiseAlignPanel.java @@ -1,90 +1,90 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.jbgui; - -import java.awt.*; -import java.awt.event.*; -import javax.swing.*; - -/** - * DOCUMENT ME! - * - * @author $author$ - * @version $Revision$ - */ -public class GPairwiseAlignPanel - extends JPanel -{ - protected JScrollPane scrollPane = new JScrollPane(); - protected JTextArea textarea = new JTextArea(); - protected JButton viewInEditorButton = new JButton(); - JPanel jPanel1 = new JPanel(); - BorderLayout borderLayout1 = new BorderLayout(); - - /** - * Creates a new GPairwiseAlignPanel object. - */ - public GPairwiseAlignPanel() - { - try - { - jbInit(); - } - catch (Exception e) - { - e.printStackTrace(); - } - } - - /** - * DOCUMENT ME! - * - * @throws Exception DOCUMENT ME! - */ - private void jbInit() - throws Exception - { - this.setLayout(borderLayout1); - textarea.setFont(new java.awt.Font("Monospaced", 0, 12)); - textarea.setText(""); - textarea.setWrapStyleWord(false); - viewInEditorButton.setFont(new java.awt.Font("Verdana", 0, 12)); - viewInEditorButton.setText("View in alignment editor"); - viewInEditorButton.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(ActionEvent e) - { - viewInEditorButton_actionPerformed(e); - } - }); - this.add(scrollPane, BorderLayout.CENTER); - scrollPane.getViewport().add(textarea, null); - this.add(jPanel1, BorderLayout.SOUTH); - jPanel1.add(viewInEditorButton, null); - } - - /** - * DOCUMENT ME! - * - * @param e DOCUMENT ME! - */ - protected void viewInEditorButton_actionPerformed(ActionEvent e) - { - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.jbgui; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; + +/** + * DOCUMENT ME! + * + * @author $author$ + * @version $Revision$ + */ +public class GPairwiseAlignPanel + extends JPanel +{ + protected JScrollPane scrollPane = new JScrollPane(); + protected JTextArea textarea = new JTextArea(); + protected JButton viewInEditorButton = new JButton(); + JPanel jPanel1 = new JPanel(); + BorderLayout borderLayout1 = new BorderLayout(); + + /** + * Creates a new GPairwiseAlignPanel object. + */ + public GPairwiseAlignPanel() + { + try + { + jbInit(); + } + catch (Exception e) + { + e.printStackTrace(); + } + } + + /** + * DOCUMENT ME! + * + * @throws Exception DOCUMENT ME! + */ + private void jbInit() + throws Exception + { + this.setLayout(borderLayout1); + textarea.setFont(new java.awt.Font("Monospaced", 0, 12)); + textarea.setText(""); + textarea.setWrapStyleWord(false); + viewInEditorButton.setFont(new java.awt.Font("Verdana", 0, 12)); + viewInEditorButton.setText("View in alignment editor"); + viewInEditorButton.addActionListener(new java.awt.event.ActionListener() + { + public void actionPerformed(ActionEvent e) + { + viewInEditorButton_actionPerformed(e); + } + }); + this.add(scrollPane, BorderLayout.CENTER); + scrollPane.getViewport().add(textarea, null); + this.add(jPanel1, BorderLayout.SOUTH); + jPanel1.add(viewInEditorButton, null); + } + + /** + * DOCUMENT ME! + * + * @param e DOCUMENT ME! + */ + protected void viewInEditorButton_actionPerformed(ActionEvent e) + { + } +} diff --git a/src/jalview/jbgui/GPreferences.java b/src/jalview/jbgui/GPreferences.java index 842ade9..fd142fc 100755 --- a/src/jalview/jbgui/GPreferences.java +++ b/src/jalview/jbgui/GPreferences.java @@ -1,565 +1,565 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.jbgui; - -import java.awt.*; -import java.awt.event.*; -import javax.swing.*; -import javax.swing.border.*; -import javax.swing.event.*; -import java.awt.Rectangle; - -/** - * DOCUMENT ME! - * - * @author $author$ - * @version $Revision$ - */ -public class GPreferences - extends JPanel -{ - JTabbedPane tabbedPane = new JTabbedPane(); - - JButton ok = new JButton(); - JButton cancel = new JButton(); - JPanel okCancelPanel = new JPanel(); - BorderLayout borderLayout1 = new BorderLayout(); - protected JCheckBox quality = new JCheckBox(); - JPanel visualTab = new JPanel(); - protected JCheckBox fullScreen = new JCheckBox(); - protected JCheckBox conservation = new JCheckBox(); - protected JCheckBox identity = new JCheckBox(); - protected JCheckBox annotations = new JCheckBox(); - JLabel gapLabel = new JLabel(); - protected JComboBox colour = new JComboBox(); - JLabel colourLabel = new JLabel(); - JLabel fontLabel = new JLabel(); - protected JComboBox fontSizeCB = new JComboBox(); - protected JComboBox fontStyleCB = new JComboBox(); - protected JComboBox fontNameCB = new JComboBox(); - protected JComboBox gapSymbolCB = new JComboBox(); - protected JCheckBox startupCheckbox = new JCheckBox(); - protected JTextField startupFileTextfield = new JTextField(); - JPanel connectTab = new JPanel(); - JLabel serverLabel = new JLabel(); - protected JList linkURLList = new JList(); - protected JTextField proxyServerTB = new JTextField(); - protected JTextField proxyPortTB = new JTextField(); - JLabel portLabel = new JLabel(); - JLabel browserLabel = new JLabel(); - protected JTextField defaultBrowser = new JTextField(); - JButton newLink = new JButton(); - JButton editLink = new JButton(); - JButton deleteLink = new JButton(); - JScrollPane linkScrollPane = new JScrollPane(); - JPanel linkPanel = new JPanel(); - BorderLayout borderLayout2 = new BorderLayout(); - JPanel editLinkButtons = new JPanel(); - GridLayout gridLayout1 = new GridLayout(); - protected JList linkNameList = new JList(); - JPanel linkPanel2 = new JPanel(); - BorderLayout borderLayout3 = new BorderLayout(); - protected JCheckBox useProxy = new JCheckBox(); - JPanel jPanel1 = new JPanel(); - TitledBorder titledBorder1 = new TitledBorder("Proxy Server"); - TitledBorder titledBorder2 = new TitledBorder("File Output"); - GridBagLayout gridBagLayout2 = new GridBagLayout(); - GridBagLayout gridBagLayout1 = new GridBagLayout(); - GridBagLayout gridBagLayout3 = new GridBagLayout(); - protected JComboBox sortby = new JComboBox(); - JLabel sortLabel = new JLabel(); - JPanel jPanel2 = new JPanel(); - GridLayout gridLayout2 = new GridLayout(); - JPanel jPanel3 = new JPanel(); - JPanel exportTab = new JPanel(); - JLabel epsLabel = new JLabel(); - protected JComboBox epsRendering = new JComboBox(); - JLabel jLabel1 = new JLabel(); - protected JCheckBox blcjv = new JCheckBox(); - protected JCheckBox pileupjv = new JCheckBox(); - protected JCheckBox clustaljv = new JCheckBox(); - protected JCheckBox msfjv = new JCheckBox(); - protected JCheckBox fastajv = new JCheckBox(); - protected JCheckBox pfamjv = new JCheckBox(); - FlowLayout flowLayout1 = new FlowLayout(); - protected JCheckBox pirjv = new JCheckBox(); - JPanel jPanel11 = new JPanel(); - Font verdana11 = new java.awt.Font("Verdana", Font.PLAIN, 11); - protected JCheckBox seqLimit = new JCheckBox(); - GridLayout gridLayout3 = new GridLayout(); - protected JCheckBox smoothFont = new JCheckBox(); - JPanel calcTab = new JPanel(); - protected JCheckBox autoCalculateConsCheck = new JCheckBox(); - protected JCheckBox padGaps = new JCheckBox(); - protected JCheckBox modellerOutput = new JCheckBox(); - protected JPanel dasPanel = new JPanel(); - BorderLayout borderLayout4 = new BorderLayout(); - protected JCheckBox wrap = new JCheckBox(); - protected JCheckBox rightAlign = new JCheckBox(); - protected JCheckBox idItalics = new JCheckBox(); - protected JCheckBox openoverv = new JCheckBox(); - /** - * Creates a new GPreferences object. - */ - public GPreferences() - { - try - { - jbInit(); - } - catch (Exception ex) - { - ex.printStackTrace(); - } - } - - /** - * DOCUMENT ME! - * - * @throws Exception DOCUMENT ME! - */ - private void jbInit() - throws Exception - { - this.setLayout(borderLayout1); - ok.setText("OK"); - ok.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - ok_actionPerformed(e); - } - }); - cancel.setText("Cancel"); - cancel.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - cancel_actionPerformed(e); - } - }); - quality.setEnabled(false); - quality.setFont(verdana11); - quality.setHorizontalAlignment(SwingConstants.RIGHT); - quality.setHorizontalTextPosition(SwingConstants.LEFT); - quality.setSelected(true); - quality.setText("Quality"); - visualTab.setBorder(new TitledBorder("Open new alignment")); - visualTab.setLayout(null); - fullScreen.setFont(verdana11); - fullScreen.setHorizontalAlignment(SwingConstants.RIGHT); - fullScreen.setHorizontalTextPosition(SwingConstants.LEFT); - fullScreen.setText("Maximise Window"); - conservation.setEnabled(false); - conservation.setFont(verdana11); - conservation.setHorizontalAlignment(SwingConstants.RIGHT); - conservation.setHorizontalTextPosition(SwingConstants.LEFT); - conservation.setSelected(true); - conservation.setText("Conservation"); - identity.setEnabled(false); - identity.setFont(verdana11); - identity.setHorizontalAlignment(SwingConstants.RIGHT); - identity.setHorizontalTextPosition(SwingConstants.LEFT); - identity.setSelected(true); - identity.setText("Consensus"); - annotations.setFont(verdana11); - annotations.setHorizontalAlignment(SwingConstants.RIGHT); - annotations.setHorizontalTextPosition(SwingConstants.LEFT); - annotations.setSelected(true); - annotations.setText("Show Annotations"); - annotations.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - annotations_actionPerformed(e); - } - }); - gapLabel.setFont(verdana11); - gapLabel.setHorizontalAlignment(SwingConstants.RIGHT); - gapLabel.setText("Gap Symbol "); - colour.setFont(verdana11); - colour.setBounds(new Rectangle(172, 225, 155, 21)); - colourLabel.setFont(verdana11); - colourLabel.setHorizontalAlignment(SwingConstants.RIGHT); - colourLabel.setText("Colour "); - fontLabel.setFont(verdana11); - fontLabel.setHorizontalAlignment(SwingConstants.RIGHT); - fontLabel.setText("Font "); - fontSizeCB.setFont(verdana11); - fontSizeCB.setBounds(new Rectangle(319, 111, 49, 21)); - fontStyleCB.setFont(verdana11); - fontStyleCB.setBounds(new Rectangle(367, 111, 70, 21)); - fontNameCB.setFont(verdana11); - fontNameCB.setBounds(new Rectangle(172, 111, 147, 21)); - gapSymbolCB.setFont(verdana11); - gapSymbolCB.setBounds(new Rectangle(172, 204, 69, 21)); - startupCheckbox.setText("Open file"); - startupCheckbox.setFont(verdana11); - startupCheckbox.setHorizontalAlignment(SwingConstants.RIGHT); - startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT); - startupCheckbox.setSelected(true); - startupFileTextfield.setFont(verdana11); - startupFileTextfield.setBounds(new Rectangle(172, 273, 270, 20)); - startupFileTextfield.addMouseListener(new MouseAdapter() - { - public void mouseClicked(MouseEvent e) - { - if (e.getClickCount() > 1) - { - startupFileTextfield_mouseClicked(); - } - } - }); - - connectTab.setLayout(gridBagLayout3); - serverLabel.setText("Address"); - serverLabel.setHorizontalAlignment(SwingConstants.RIGHT); - serverLabel.setFont(verdana11); - proxyServerTB.setFont(verdana11); - proxyPortTB.setFont(verdana11); - portLabel.setFont(verdana11); - portLabel.setHorizontalAlignment(SwingConstants.RIGHT); - portLabel.setText("Port"); - browserLabel.setFont(new java.awt.Font("SansSerif", 0, 11)); - browserLabel.setHorizontalAlignment(SwingConstants.TRAILING); - browserLabel.setText("Default Browser (Unix)"); - defaultBrowser.setFont(verdana11); - defaultBrowser.setText(""); - newLink.setText("New"); - newLink.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(ActionEvent e) - { - newLink_actionPerformed(e); - } - }); - editLink.setText("Edit"); - editLink.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(ActionEvent e) - { - editLink_actionPerformed(e); - } - }); - deleteLink.setText("Delete"); - deleteLink.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(ActionEvent e) - { - deleteLink_actionPerformed(e); - } - }); - - linkURLList.addListSelectionListener(new ListSelectionListener() - { - public void valueChanged(ListSelectionEvent e) - { - int index = linkURLList.getSelectedIndex(); - linkNameList.setSelectedIndex(index); - } - }); - - linkNameList.addListSelectionListener(new ListSelectionListener() - { - public void valueChanged(ListSelectionEvent e) - { - int index = linkNameList.getSelectedIndex(); - linkURLList.setSelectedIndex(index); - } - }); - - linkScrollPane.setBorder(null); - linkPanel.setBorder(new TitledBorder("URL link from Sequence ID")); - linkPanel.setLayout(borderLayout2); - editLinkButtons.setLayout(gridLayout1); - gridLayout1.setRows(3); - linkNameList.setFont(verdana11); - linkNameList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - linkPanel2.setLayout(borderLayout3); - linkURLList.setFont(verdana11); - linkURLList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - - defaultBrowser.addMouseListener(new MouseAdapter() - { - public void mouseClicked(MouseEvent e) - { - if (e.getClickCount() > 1) - { - defaultBrowser_mouseClicked(e); - } - } - }); - useProxy.setFont(verdana11); - useProxy.setHorizontalAlignment(SwingConstants.RIGHT); - useProxy.setHorizontalTextPosition(SwingConstants.LEADING); - useProxy.setText("Use a proxy server"); - useProxy.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - useProxy_actionPerformed(); - } - }); - jPanel1.setBorder(titledBorder1); - jPanel1.setLayout(gridBagLayout1); - sortby.setFont(verdana11); - sortby.setBounds(new Rectangle(172, 249, 155, 21)); - sortLabel.setFont(verdana11); - sortLabel.setHorizontalAlignment(SwingConstants.RIGHT); - sortLabel.setText("Sort by "); - jPanel2.setBounds(new Rectangle(7, 17, 158, 278)); - jPanel2.setLayout(gridLayout2); - gridLayout2.setRows(12); - jPanel3.setBounds(new Rectangle(173, 35, 274, 26)); - exportTab.setLayout(null); - epsLabel.setFont(verdana11); - epsLabel.setHorizontalAlignment(SwingConstants.RIGHT); - epsLabel.setText("EPS Rendering Style"); - epsLabel.setBounds(new Rectangle(9, 31, 140, 24)); - epsRendering.setFont(verdana11); - epsRendering.setBounds(new Rectangle(154, 34, 187, 21)); - jLabel1.setFont(verdana11); - jLabel1.setHorizontalAlignment(SwingConstants.CENTER); - jLabel1.setText("Append /start-end (/15-380)"); - jLabel1.setFont(verdana11); - fastajv.setFont(verdana11); - fastajv.setHorizontalAlignment(SwingConstants.LEFT); - clustaljv.setText("Clustal "); - blcjv.setText("BLC "); - fastajv.setText("Fasta "); - msfjv.setText("MSF "); - pfamjv.setText("PFAM "); - pileupjv.setText("Pileup "); - msfjv.setFont(verdana11); - msfjv.setHorizontalAlignment(SwingConstants.LEFT); - pirjv.setText("PIR "); - jPanel11.setFont(verdana11); - jPanel11.setBorder(titledBorder2); - jPanel11.setBounds(new Rectangle(30, 72, 196, 182)); - jPanel11.setLayout(gridLayout3); - blcjv.setFont(verdana11); - blcjv.setHorizontalAlignment(SwingConstants.LEFT); - clustaljv.setFont(verdana11); - clustaljv.setHorizontalAlignment(SwingConstants.LEFT); - pfamjv.setFont(verdana11); - pfamjv.setHorizontalAlignment(SwingConstants.LEFT); - pileupjv.setFont(verdana11); - pileupjv.setHorizontalAlignment(SwingConstants.LEFT); - pirjv.setFont(verdana11); - pirjv.setHorizontalAlignment(SwingConstants.LEFT); - seqLimit.setFont(verdana11); - seqLimit.setHorizontalAlignment(SwingConstants.RIGHT); - seqLimit.setHorizontalTextPosition(SwingConstants.LEFT); - seqLimit.setText("Full Sequence Id"); - gridLayout3.setRows(8); - smoothFont.setFont(verdana11); - smoothFont.setHorizontalAlignment(SwingConstants.RIGHT); - smoothFont.setHorizontalTextPosition(SwingConstants.LEADING); - smoothFont.setText("Smooth Font"); - calcTab.setLayout(null); - autoCalculateConsCheck.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); - autoCalculateConsCheck.setText("AutoCalculate Consensus"); - autoCalculateConsCheck.setBounds(new Rectangle(21, 52, 209, 23)); - padGaps.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); - padGaps.setText("Pad gaps when editing"); - padGaps.setBounds(new Rectangle(22, 94, 168, 23)); - modellerOutput.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); - modellerOutput.setText("Use Modeller Output"); - modellerOutput.setBounds(new Rectangle(228, 226, 168, 23)); - dasPanel.setLayout(borderLayout4); - wrap.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); - wrap.setHorizontalAlignment(SwingConstants.TRAILING); - wrap.setHorizontalTextPosition(SwingConstants.LEADING); - wrap.setText("Wrap Alignment"); - rightAlign.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); - rightAlign.setForeground(Color.black); - rightAlign.setHorizontalAlignment(SwingConstants.RIGHT); - rightAlign.setHorizontalTextPosition(SwingConstants.LEFT); - rightAlign.setText("Right Align Ids"); - idItalics.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); - idItalics.setHorizontalAlignment(SwingConstants.RIGHT); - idItalics.setHorizontalTextPosition(SwingConstants.LEADING); - idItalics.setText("Sequence Name Italics"); - openoverv.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); - openoverv.setActionCommand("Open Overview"); - openoverv.setHorizontalAlignment(SwingConstants.RIGHT); - openoverv.setHorizontalTextPosition(SwingConstants.LEADING); - openoverv.setText("Open Overview Window"); - openoverv.setBounds(new Rectangle(169, 17, 200, 23)); - jPanel2.add(fullScreen); - jPanel2.add(annotations); - jPanel2.add(seqLimit); - jPanel2.add(rightAlign); - jPanel2.add(fontLabel); - jPanel2.add(idItalics); - jPanel2.add(smoothFont); - jPanel2.add(wrap); - jPanel2.add(gapLabel); - jPanel2.add(colourLabel); - jPanel2.add(sortLabel); - jPanel2.add(startupCheckbox); - visualTab.add(openoverv); - visualTab.add(startupFileTextfield); - visualTab.add(sortby); - visualTab.add(colour); - visualTab.add(gapSymbolCB); - visualTab.add(jPanel3); - visualTab.add(fontNameCB); - visualTab.add(fontSizeCB); - visualTab.add(fontStyleCB); - jPanel3.add(conservation); - jPanel3.add(identity); - jPanel3.add(quality); - visualTab.add(jPanel2); - linkPanel.add(editLinkButtons, BorderLayout.EAST); - editLinkButtons.add(newLink, null); - editLinkButtons.add(editLink, null); - editLinkButtons.add(deleteLink, null); - linkPanel.add(linkScrollPane, BorderLayout.CENTER); - linkScrollPane.getViewport().add(linkPanel2, null); - linkPanel2.add(linkURLList, BorderLayout.CENTER); - linkPanel2.add(linkNameList, BorderLayout.WEST); - okCancelPanel.add(ok); - okCancelPanel.add(cancel); - this.add(tabbedPane, java.awt.BorderLayout.CENTER); - - this.add(okCancelPanel, java.awt.BorderLayout.SOUTH); - jPanel1.add(serverLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0 - , GridBagConstraints.WEST, GridBagConstraints.NONE, - new Insets(0, 2, 4, 0), 5, 0)); - jPanel1.add(portLabel, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0 - , GridBagConstraints.WEST, - GridBagConstraints.NONE, - new Insets(0, 0, 4, 0), 11, 6)); - connectTab.add(linkPanel, new GridBagConstraints(0, 0, 2, 1, 1.0, 1.0 - , GridBagConstraints.CENTER, GridBagConstraints.BOTH, - new Insets(16, 0, 0, 12), 359, -17)); - connectTab.add(jPanel1, new GridBagConstraints(0, 2, 2, 1, 1.0, 1.0 - , GridBagConstraints.CENTER, GridBagConstraints.BOTH, - new Insets(21, 0, 35, 12), 4, 6)); - connectTab.add(browserLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0 - , GridBagConstraints.WEST, GridBagConstraints.NONE, - new Insets(16, 0, 0, 0), 5, 1)); - jPanel1.add(proxyPortTB, new GridBagConstraints(3, 1, 1, 1, 1.0, 0.0 - , GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, - new Insets(0, 2, 4, 2), 54, 1)); - jPanel1.add(proxyServerTB, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0 - , GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, - new Insets(0, 2, 4, 0), 263, 1)); - connectTab.add(defaultBrowser, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0 - , GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, - new Insets(15, 0, 0, 15), 307, 1)); - - jPanel1.add(useProxy, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0 - , GridBagConstraints.WEST, - GridBagConstraints.NONE, - new Insets(0, 2, 5, 185), 2, - -4)); - DefaultListCellRenderer dlcr = new DefaultListCellRenderer(); - dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER); - gapSymbolCB.setRenderer(dlcr); - - tabbedPane.add(visualTab, "Visual"); - tabbedPane.add(connectTab, "Connections"); - tabbedPane.add(exportTab, "Output"); - jPanel11.add(jLabel1); - jPanel11.add(blcjv); - jPanel11.add(clustaljv); - jPanel11.add(fastajv); - jPanel11.add(msfjv); - jPanel11.add(pfamjv); - jPanel11.add(pileupjv); - jPanel11.add(pirjv); - exportTab.add(modellerOutput); - tabbedPane.add(calcTab, "Editing"); - calcTab.add(autoCalculateConsCheck); - calcTab.add(padGaps); - tabbedPane.add(dasPanel, "DAS Settings"); - - exportTab.add(epsLabel); - exportTab.add(epsRendering); - exportTab.add(jPanel11); - } - - /** - * DOCUMENT ME! - * - * @param e DOCUMENT ME! - */ - public void ok_actionPerformed(ActionEvent e) - { - } - - /** - * DOCUMENT ME! - * - * @param e DOCUMENT ME! - */ - public void cancel_actionPerformed(ActionEvent e) - { - } - - /** - * DOCUMENT ME! - * - * @param e DOCUMENT ME! - */ - public void annotations_actionPerformed(ActionEvent e) - { - } - - /** - * DOCUMENT ME! - */ - public void startupFileTextfield_mouseClicked() - { - } - - public void newLink_actionPerformed(ActionEvent e) - { - - } - - public void editLink_actionPerformed(ActionEvent e) - { - - } - - public void deleteLink_actionPerformed(ActionEvent e) - { - - } - - public void defaultBrowser_mouseClicked(MouseEvent e) - { - - } - - public void linkURLList_keyTyped(KeyEvent e) - { - - } - - public void useProxy_actionPerformed() - { - proxyServerTB.setEnabled(useProxy.isSelected()); - proxyPortTB.setEnabled(useProxy.isSelected()); - } - -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.jbgui; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +import javax.swing.border.*; +import javax.swing.event.*; +import java.awt.Rectangle; + +/** + * DOCUMENT ME! + * + * @author $author$ + * @version $Revision$ + */ +public class GPreferences + extends JPanel +{ + JTabbedPane tabbedPane = new JTabbedPane(); + + JButton ok = new JButton(); + JButton cancel = new JButton(); + JPanel okCancelPanel = new JPanel(); + BorderLayout borderLayout1 = new BorderLayout(); + protected JCheckBox quality = new JCheckBox(); + JPanel visualTab = new JPanel(); + protected JCheckBox fullScreen = new JCheckBox(); + protected JCheckBox conservation = new JCheckBox(); + protected JCheckBox identity = new JCheckBox(); + protected JCheckBox annotations = new JCheckBox(); + JLabel gapLabel = new JLabel(); + protected JComboBox colour = new JComboBox(); + JLabel colourLabel = new JLabel(); + JLabel fontLabel = new JLabel(); + protected JComboBox fontSizeCB = new JComboBox(); + protected JComboBox fontStyleCB = new JComboBox(); + protected JComboBox fontNameCB = new JComboBox(); + protected JComboBox gapSymbolCB = new JComboBox(); + protected JCheckBox startupCheckbox = new JCheckBox(); + protected JTextField startupFileTextfield = new JTextField(); + JPanel connectTab = new JPanel(); + JLabel serverLabel = new JLabel(); + protected JList linkURLList = new JList(); + protected JTextField proxyServerTB = new JTextField(); + protected JTextField proxyPortTB = new JTextField(); + JLabel portLabel = new JLabel(); + JLabel browserLabel = new JLabel(); + protected JTextField defaultBrowser = new JTextField(); + JButton newLink = new JButton(); + JButton editLink = new JButton(); + JButton deleteLink = new JButton(); + JScrollPane linkScrollPane = new JScrollPane(); + JPanel linkPanel = new JPanel(); + BorderLayout borderLayout2 = new BorderLayout(); + JPanel editLinkButtons = new JPanel(); + GridLayout gridLayout1 = new GridLayout(); + protected JList linkNameList = new JList(); + JPanel linkPanel2 = new JPanel(); + BorderLayout borderLayout3 = new BorderLayout(); + protected JCheckBox useProxy = new JCheckBox(); + JPanel jPanel1 = new JPanel(); + TitledBorder titledBorder1 = new TitledBorder("Proxy Server"); + TitledBorder titledBorder2 = new TitledBorder("File Output"); + GridBagLayout gridBagLayout2 = new GridBagLayout(); + GridBagLayout gridBagLayout1 = new GridBagLayout(); + GridBagLayout gridBagLayout3 = new GridBagLayout(); + protected JComboBox sortby = new JComboBox(); + JLabel sortLabel = new JLabel(); + JPanel jPanel2 = new JPanel(); + GridLayout gridLayout2 = new GridLayout(); + JPanel jPanel3 = new JPanel(); + JPanel exportTab = new JPanel(); + JLabel epsLabel = new JLabel(); + protected JComboBox epsRendering = new JComboBox(); + JLabel jLabel1 = new JLabel(); + protected JCheckBox blcjv = new JCheckBox(); + protected JCheckBox pileupjv = new JCheckBox(); + protected JCheckBox clustaljv = new JCheckBox(); + protected JCheckBox msfjv = new JCheckBox(); + protected JCheckBox fastajv = new JCheckBox(); + protected JCheckBox pfamjv = new JCheckBox(); + FlowLayout flowLayout1 = new FlowLayout(); + protected JCheckBox pirjv = new JCheckBox(); + JPanel jPanel11 = new JPanel(); + Font verdana11 = new java.awt.Font("Verdana", Font.PLAIN, 11); + protected JCheckBox seqLimit = new JCheckBox(); + GridLayout gridLayout3 = new GridLayout(); + protected JCheckBox smoothFont = new JCheckBox(); + JPanel calcTab = new JPanel(); + protected JCheckBox autoCalculateConsCheck = new JCheckBox(); + protected JCheckBox padGaps = new JCheckBox(); + protected JCheckBox modellerOutput = new JCheckBox(); + protected JPanel dasPanel = new JPanel(); + BorderLayout borderLayout4 = new BorderLayout(); + protected JCheckBox wrap = new JCheckBox(); + protected JCheckBox rightAlign = new JCheckBox(); + protected JCheckBox idItalics = new JCheckBox(); + protected JCheckBox openoverv = new JCheckBox(); + /** + * Creates a new GPreferences object. + */ + public GPreferences() + { + try + { + jbInit(); + } + catch (Exception ex) + { + ex.printStackTrace(); + } + } + + /** + * DOCUMENT ME! + * + * @throws Exception DOCUMENT ME! + */ + private void jbInit() + throws Exception + { + this.setLayout(borderLayout1); + ok.setText("OK"); + ok.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + ok_actionPerformed(e); + } + }); + cancel.setText("Cancel"); + cancel.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + cancel_actionPerformed(e); + } + }); + quality.setEnabled(false); + quality.setFont(verdana11); + quality.setHorizontalAlignment(SwingConstants.RIGHT); + quality.setHorizontalTextPosition(SwingConstants.LEFT); + quality.setSelected(true); + quality.setText("Quality"); + visualTab.setBorder(new TitledBorder("Open new alignment")); + visualTab.setLayout(null); + fullScreen.setFont(verdana11); + fullScreen.setHorizontalAlignment(SwingConstants.RIGHT); + fullScreen.setHorizontalTextPosition(SwingConstants.LEFT); + fullScreen.setText("Maximise Window"); + conservation.setEnabled(false); + conservation.setFont(verdana11); + conservation.setHorizontalAlignment(SwingConstants.RIGHT); + conservation.setHorizontalTextPosition(SwingConstants.LEFT); + conservation.setSelected(true); + conservation.setText("Conservation"); + identity.setEnabled(false); + identity.setFont(verdana11); + identity.setHorizontalAlignment(SwingConstants.RIGHT); + identity.setHorizontalTextPosition(SwingConstants.LEFT); + identity.setSelected(true); + identity.setText("Consensus"); + annotations.setFont(verdana11); + annotations.setHorizontalAlignment(SwingConstants.RIGHT); + annotations.setHorizontalTextPosition(SwingConstants.LEFT); + annotations.setSelected(true); + annotations.setText("Show Annotations"); + annotations.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + annotations_actionPerformed(e); + } + }); + gapLabel.setFont(verdana11); + gapLabel.setHorizontalAlignment(SwingConstants.RIGHT); + gapLabel.setText("Gap Symbol "); + colour.setFont(verdana11); + colour.setBounds(new Rectangle(172, 225, 155, 21)); + colourLabel.setFont(verdana11); + colourLabel.setHorizontalAlignment(SwingConstants.RIGHT); + colourLabel.setText("Colour "); + fontLabel.setFont(verdana11); + fontLabel.setHorizontalAlignment(SwingConstants.RIGHT); + fontLabel.setText("Font "); + fontSizeCB.setFont(verdana11); + fontSizeCB.setBounds(new Rectangle(319, 111, 49, 21)); + fontStyleCB.setFont(verdana11); + fontStyleCB.setBounds(new Rectangle(367, 111, 70, 21)); + fontNameCB.setFont(verdana11); + fontNameCB.setBounds(new Rectangle(172, 111, 147, 21)); + gapSymbolCB.setFont(verdana11); + gapSymbolCB.setBounds(new Rectangle(172, 204, 69, 21)); + startupCheckbox.setText("Open file"); + startupCheckbox.setFont(verdana11); + startupCheckbox.setHorizontalAlignment(SwingConstants.RIGHT); + startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT); + startupCheckbox.setSelected(true); + startupFileTextfield.setFont(verdana11); + startupFileTextfield.setBounds(new Rectangle(172, 273, 270, 20)); + startupFileTextfield.addMouseListener(new MouseAdapter() + { + public void mouseClicked(MouseEvent e) + { + if (e.getClickCount() > 1) + { + startupFileTextfield_mouseClicked(); + } + } + }); + + connectTab.setLayout(gridBagLayout3); + serverLabel.setText("Address"); + serverLabel.setHorizontalAlignment(SwingConstants.RIGHT); + serverLabel.setFont(verdana11); + proxyServerTB.setFont(verdana11); + proxyPortTB.setFont(verdana11); + portLabel.setFont(verdana11); + portLabel.setHorizontalAlignment(SwingConstants.RIGHT); + portLabel.setText("Port"); + browserLabel.setFont(new java.awt.Font("SansSerif", 0, 11)); + browserLabel.setHorizontalAlignment(SwingConstants.TRAILING); + browserLabel.setText("Default Browser (Unix)"); + defaultBrowser.setFont(verdana11); + defaultBrowser.setText(""); + newLink.setText("New"); + newLink.addActionListener(new java.awt.event.ActionListener() + { + public void actionPerformed(ActionEvent e) + { + newLink_actionPerformed(e); + } + }); + editLink.setText("Edit"); + editLink.addActionListener(new java.awt.event.ActionListener() + { + public void actionPerformed(ActionEvent e) + { + editLink_actionPerformed(e); + } + }); + deleteLink.setText("Delete"); + deleteLink.addActionListener(new java.awt.event.ActionListener() + { + public void actionPerformed(ActionEvent e) + { + deleteLink_actionPerformed(e); + } + }); + + linkURLList.addListSelectionListener(new ListSelectionListener() + { + public void valueChanged(ListSelectionEvent e) + { + int index = linkURLList.getSelectedIndex(); + linkNameList.setSelectedIndex(index); + } + }); + + linkNameList.addListSelectionListener(new ListSelectionListener() + { + public void valueChanged(ListSelectionEvent e) + { + int index = linkNameList.getSelectedIndex(); + linkURLList.setSelectedIndex(index); + } + }); + + linkScrollPane.setBorder(null); + linkPanel.setBorder(new TitledBorder("URL link from Sequence ID")); + linkPanel.setLayout(borderLayout2); + editLinkButtons.setLayout(gridLayout1); + gridLayout1.setRows(3); + linkNameList.setFont(verdana11); + linkNameList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + linkPanel2.setLayout(borderLayout3); + linkURLList.setFont(verdana11); + linkURLList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + + defaultBrowser.addMouseListener(new MouseAdapter() + { + public void mouseClicked(MouseEvent e) + { + if (e.getClickCount() > 1) + { + defaultBrowser_mouseClicked(e); + } + } + }); + useProxy.setFont(verdana11); + useProxy.setHorizontalAlignment(SwingConstants.RIGHT); + useProxy.setHorizontalTextPosition(SwingConstants.LEADING); + useProxy.setText("Use a proxy server"); + useProxy.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + useProxy_actionPerformed(); + } + }); + jPanel1.setBorder(titledBorder1); + jPanel1.setLayout(gridBagLayout1); + sortby.setFont(verdana11); + sortby.setBounds(new Rectangle(172, 249, 155, 21)); + sortLabel.setFont(verdana11); + sortLabel.setHorizontalAlignment(SwingConstants.RIGHT); + sortLabel.setText("Sort by "); + jPanel2.setBounds(new Rectangle(7, 17, 158, 278)); + jPanel2.setLayout(gridLayout2); + gridLayout2.setRows(12); + jPanel3.setBounds(new Rectangle(173, 35, 274, 26)); + exportTab.setLayout(null); + epsLabel.setFont(verdana11); + epsLabel.setHorizontalAlignment(SwingConstants.RIGHT); + epsLabel.setText("EPS Rendering Style"); + epsLabel.setBounds(new Rectangle(9, 31, 140, 24)); + epsRendering.setFont(verdana11); + epsRendering.setBounds(new Rectangle(154, 34, 187, 21)); + jLabel1.setFont(verdana11); + jLabel1.setHorizontalAlignment(SwingConstants.CENTER); + jLabel1.setText("Append /start-end (/15-380)"); + jLabel1.setFont(verdana11); + fastajv.setFont(verdana11); + fastajv.setHorizontalAlignment(SwingConstants.LEFT); + clustaljv.setText("Clustal "); + blcjv.setText("BLC "); + fastajv.setText("Fasta "); + msfjv.setText("MSF "); + pfamjv.setText("PFAM "); + pileupjv.setText("Pileup "); + msfjv.setFont(verdana11); + msfjv.setHorizontalAlignment(SwingConstants.LEFT); + pirjv.setText("PIR "); + jPanel11.setFont(verdana11); + jPanel11.setBorder(titledBorder2); + jPanel11.setBounds(new Rectangle(30, 72, 196, 182)); + jPanel11.setLayout(gridLayout3); + blcjv.setFont(verdana11); + blcjv.setHorizontalAlignment(SwingConstants.LEFT); + clustaljv.setFont(verdana11); + clustaljv.setHorizontalAlignment(SwingConstants.LEFT); + pfamjv.setFont(verdana11); + pfamjv.setHorizontalAlignment(SwingConstants.LEFT); + pileupjv.setFont(verdana11); + pileupjv.setHorizontalAlignment(SwingConstants.LEFT); + pirjv.setFont(verdana11); + pirjv.setHorizontalAlignment(SwingConstants.LEFT); + seqLimit.setFont(verdana11); + seqLimit.setHorizontalAlignment(SwingConstants.RIGHT); + seqLimit.setHorizontalTextPosition(SwingConstants.LEFT); + seqLimit.setText("Full Sequence Id"); + gridLayout3.setRows(8); + smoothFont.setFont(verdana11); + smoothFont.setHorizontalAlignment(SwingConstants.RIGHT); + smoothFont.setHorizontalTextPosition(SwingConstants.LEADING); + smoothFont.setText("Smooth Font"); + calcTab.setLayout(null); + autoCalculateConsCheck.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); + autoCalculateConsCheck.setText("AutoCalculate Consensus"); + autoCalculateConsCheck.setBounds(new Rectangle(21, 52, 209, 23)); + padGaps.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); + padGaps.setText("Pad gaps when editing"); + padGaps.setBounds(new Rectangle(22, 94, 168, 23)); + modellerOutput.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); + modellerOutput.setText("Use Modeller Output"); + modellerOutput.setBounds(new Rectangle(228, 226, 168, 23)); + dasPanel.setLayout(borderLayout4); + wrap.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); + wrap.setHorizontalAlignment(SwingConstants.TRAILING); + wrap.setHorizontalTextPosition(SwingConstants.LEADING); + wrap.setText("Wrap Alignment"); + rightAlign.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); + rightAlign.setForeground(Color.black); + rightAlign.setHorizontalAlignment(SwingConstants.RIGHT); + rightAlign.setHorizontalTextPosition(SwingConstants.LEFT); + rightAlign.setText("Right Align Ids"); + idItalics.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); + idItalics.setHorizontalAlignment(SwingConstants.RIGHT); + idItalics.setHorizontalTextPosition(SwingConstants.LEADING); + idItalics.setText("Sequence Name Italics"); + openoverv.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); + openoverv.setActionCommand("Open Overview"); + openoverv.setHorizontalAlignment(SwingConstants.RIGHT); + openoverv.setHorizontalTextPosition(SwingConstants.LEADING); + openoverv.setText("Open Overview Window"); + openoverv.setBounds(new Rectangle(169, 17, 200, 23)); + jPanel2.add(fullScreen); + jPanel2.add(annotations); + jPanel2.add(seqLimit); + jPanel2.add(rightAlign); + jPanel2.add(fontLabel); + jPanel2.add(idItalics); + jPanel2.add(smoothFont); + jPanel2.add(wrap); + jPanel2.add(gapLabel); + jPanel2.add(colourLabel); + jPanel2.add(sortLabel); + jPanel2.add(startupCheckbox); + visualTab.add(openoverv); + visualTab.add(startupFileTextfield); + visualTab.add(sortby); + visualTab.add(colour); + visualTab.add(gapSymbolCB); + visualTab.add(jPanel3); + visualTab.add(fontNameCB); + visualTab.add(fontSizeCB); + visualTab.add(fontStyleCB); + jPanel3.add(conservation); + jPanel3.add(identity); + jPanel3.add(quality); + visualTab.add(jPanel2); + linkPanel.add(editLinkButtons, BorderLayout.EAST); + editLinkButtons.add(newLink, null); + editLinkButtons.add(editLink, null); + editLinkButtons.add(deleteLink, null); + linkPanel.add(linkScrollPane, BorderLayout.CENTER); + linkScrollPane.getViewport().add(linkPanel2, null); + linkPanel2.add(linkURLList, BorderLayout.CENTER); + linkPanel2.add(linkNameList, BorderLayout.WEST); + okCancelPanel.add(ok); + okCancelPanel.add(cancel); + this.add(tabbedPane, java.awt.BorderLayout.CENTER); + + this.add(okCancelPanel, java.awt.BorderLayout.SOUTH); + jPanel1.add(serverLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0 + , GridBagConstraints.WEST, GridBagConstraints.NONE, + new Insets(0, 2, 4, 0), 5, 0)); + jPanel1.add(portLabel, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0 + , GridBagConstraints.WEST, + GridBagConstraints.NONE, + new Insets(0, 0, 4, 0), 11, 6)); + connectTab.add(linkPanel, new GridBagConstraints(0, 0, 2, 1, 1.0, 1.0 + , GridBagConstraints.CENTER, GridBagConstraints.BOTH, + new Insets(16, 0, 0, 12), 359, -17)); + connectTab.add(jPanel1, new GridBagConstraints(0, 2, 2, 1, 1.0, 1.0 + , GridBagConstraints.CENTER, GridBagConstraints.BOTH, + new Insets(21, 0, 35, 12), 4, 6)); + connectTab.add(browserLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0 + , GridBagConstraints.WEST, GridBagConstraints.NONE, + new Insets(16, 0, 0, 0), 5, 1)); + jPanel1.add(proxyPortTB, new GridBagConstraints(3, 1, 1, 1, 1.0, 0.0 + , GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, + new Insets(0, 2, 4, 2), 54, 1)); + jPanel1.add(proxyServerTB, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0 + , GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, + new Insets(0, 2, 4, 0), 263, 1)); + connectTab.add(defaultBrowser, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0 + , GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, + new Insets(15, 0, 0, 15), 307, 1)); + + jPanel1.add(useProxy, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0 + , GridBagConstraints.WEST, + GridBagConstraints.NONE, + new Insets(0, 2, 5, 185), 2, + -4)); + DefaultListCellRenderer dlcr = new DefaultListCellRenderer(); + dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER); + gapSymbolCB.setRenderer(dlcr); + + tabbedPane.add(visualTab, "Visual"); + tabbedPane.add(connectTab, "Connections"); + tabbedPane.add(exportTab, "Output"); + jPanel11.add(jLabel1); + jPanel11.add(blcjv); + jPanel11.add(clustaljv); + jPanel11.add(fastajv); + jPanel11.add(msfjv); + jPanel11.add(pfamjv); + jPanel11.add(pileupjv); + jPanel11.add(pirjv); + exportTab.add(modellerOutput); + tabbedPane.add(calcTab, "Editing"); + calcTab.add(autoCalculateConsCheck); + calcTab.add(padGaps); + tabbedPane.add(dasPanel, "DAS Settings"); + + exportTab.add(epsLabel); + exportTab.add(epsRendering); + exportTab.add(jPanel11); + } + + /** + * DOCUMENT ME! + * + * @param e DOCUMENT ME! + */ + public void ok_actionPerformed(ActionEvent e) + { + } + + /** + * DOCUMENT ME! + * + * @param e DOCUMENT ME! + */ + public void cancel_actionPerformed(ActionEvent e) + { + } + + /** + * DOCUMENT ME! + * + * @param e DOCUMENT ME! + */ + public void annotations_actionPerformed(ActionEvent e) + { + } + + /** + * DOCUMENT ME! + */ + public void startupFileTextfield_mouseClicked() + { + } + + public void newLink_actionPerformed(ActionEvent e) + { + + } + + public void editLink_actionPerformed(ActionEvent e) + { + + } + + public void deleteLink_actionPerformed(ActionEvent e) + { + + } + + public void defaultBrowser_mouseClicked(MouseEvent e) + { + + } + + public void linkURLList_keyTyped(KeyEvent e) + { + + } + + public void useProxy_actionPerformed() + { + proxyServerTB.setEnabled(useProxy.isSelected()); + proxyPortTB.setEnabled(useProxy.isSelected()); + } + +} diff --git a/src/jalview/jbgui/GSequenceLink.java b/src/jalview/jbgui/GSequenceLink.java index 40d00be..a5927f3 100755 --- a/src/jalview/jbgui/GSequenceLink.java +++ b/src/jalview/jbgui/GSequenceLink.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/jbgui/GSliderPanel.java b/src/jalview/jbgui/GSliderPanel.java index 568c66a..15058e1 100755 --- a/src/jalview/jbgui/GSliderPanel.java +++ b/src/jalview/jbgui/GSliderPanel.java @@ -1,194 +1,194 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.jbgui; - -import java.awt.*; -import java.awt.event.*; -import javax.swing.*; - -/** - * DOCUMENT ME! - * - * @author $author$ - * @version $Revision$ - */ -public class GSliderPanel - extends JPanel -{ - // this is used for conservation colours, PID colours and redundancy threshold - protected JSlider slider = new JSlider(); - protected JTextField valueField = new JTextField(); - protected JLabel label = new JLabel(); - protected JPanel southPanel = new JPanel(); - GridLayout gridLayout1 = new GridLayout(); - JPanel jPanel2 = new JPanel(); - protected JButton applyButton = new JButton(); - protected JButton undoButton = new JButton(); - FlowLayout flowLayout1 = new FlowLayout(); - protected JCheckBox allGroupsCheck = new JCheckBox(); - BorderLayout borderLayout1 = new BorderLayout(); - JPanel jPanel1 = new JPanel(); - BorderLayout borderLayout2 = new BorderLayout(); - - /** - * Creates a new GSliderPanel object. - */ - public GSliderPanel() - { - try - { - jbInit(); - } - catch (Exception e) - { - e.printStackTrace(); - } - } - - /** - * DOCUMENT ME! - * - * @throws Exception DOCUMENT ME! - */ - private void jbInit() - throws Exception - { - this.setLayout(gridLayout1); - slider.setMajorTickSpacing(10); - slider.setMinorTickSpacing(1); - slider.setPaintTicks(true); - slider.setBackground(Color.white); - slider.setFont(new java.awt.Font("Verdana", 0, 11)); - slider.setDoubleBuffered(true); - slider.addMouseListener(new MouseAdapter() - { - public void mouseReleased(MouseEvent e) - { - slider_mouseReleased(e); - } - }); - valueField.setFont(new java.awt.Font("Verdana", 0, 11)); - valueField.setMinimumSize(new Dimension(6, 14)); - valueField.setPreferredSize(new Dimension(50, 12)); - valueField.setText(""); - valueField.setHorizontalAlignment(SwingConstants.CENTER); - valueField.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(ActionEvent e) - { - valueField_actionPerformed(e); - } - }); - label.setFont(new java.awt.Font("Verdana", 0, 11)); - label.setOpaque(false); - label.setHorizontalAlignment(SwingConstants.CENTER); - label.setText("set this label text"); - southPanel.setLayout(borderLayout1); - gridLayout1.setRows(2); - jPanel2.setLayout(flowLayout1); - applyButton.setFont(new java.awt.Font("Verdana", 0, 11)); - applyButton.setOpaque(false); - applyButton.setText("Apply"); - applyButton.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(ActionEvent e) - { - applyButton_actionPerformed(e); - } - }); - undoButton.setEnabled(false); - undoButton.setFont(new java.awt.Font("Verdana", 0, 11)); - undoButton.setOpaque(false); - undoButton.setText("Undo"); - undoButton.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(ActionEvent e) - { - undoButton_actionPerformed(e); - } - }); - allGroupsCheck.setEnabled(false); - allGroupsCheck.setFont(new java.awt.Font("Verdana", 0, 11)); - allGroupsCheck.setOpaque(false); - allGroupsCheck.setText("Apply to all Groups"); - allGroupsCheck.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(ActionEvent e) - { - allGroupsCheck_actionPerformed(e); - } - }); - this.setBackground(Color.white); - this.setPreferredSize(new Dimension(415, 84)); - jPanel2.setOpaque(false); - southPanel.setOpaque(false); - jPanel1.setLayout(borderLayout2); - jPanel1.setOpaque(false); - this.add(jPanel2, null); - jPanel2.add(label, null); - jPanel2.add(applyButton, null); - jPanel2.add(undoButton, null); - this.add(southPanel, null); - southPanel.add(jPanel1, java.awt.BorderLayout.EAST); - southPanel.add(slider, java.awt.BorderLayout.CENTER); - jPanel1.add(valueField, java.awt.BorderLayout.CENTER); - jPanel1.add(allGroupsCheck, java.awt.BorderLayout.EAST); - } - - /** - * DOCUMENT ME! - * - * @param e DOCUMENT ME! - */ - protected void valueField_actionPerformed(ActionEvent e) - { - } - - /** - * DOCUMENT ME! - * - * @param e DOCUMENT ME! - */ - protected void applyButton_actionPerformed(ActionEvent e) - { - } - - /** - * DOCUMENT ME! - * - * @param e DOCUMENT ME! - */ - protected void undoButton_actionPerformed(ActionEvent e) - { - } - - /** - * DOCUMENT ME! - * - * @param e DOCUMENT ME! - */ - protected void allGroupsCheck_actionPerformed(ActionEvent e) - { - } - - public void slider_mouseReleased(MouseEvent e) - { - - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.jbgui; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; + +/** + * DOCUMENT ME! + * + * @author $author$ + * @version $Revision$ + */ +public class GSliderPanel + extends JPanel +{ + // this is used for conservation colours, PID colours and redundancy threshold + protected JSlider slider = new JSlider(); + protected JTextField valueField = new JTextField(); + protected JLabel label = new JLabel(); + protected JPanel southPanel = new JPanel(); + GridLayout gridLayout1 = new GridLayout(); + JPanel jPanel2 = new JPanel(); + protected JButton applyButton = new JButton(); + protected JButton undoButton = new JButton(); + FlowLayout flowLayout1 = new FlowLayout(); + protected JCheckBox allGroupsCheck = new JCheckBox(); + BorderLayout borderLayout1 = new BorderLayout(); + JPanel jPanel1 = new JPanel(); + BorderLayout borderLayout2 = new BorderLayout(); + + /** + * Creates a new GSliderPanel object. + */ + public GSliderPanel() + { + try + { + jbInit(); + } + catch (Exception e) + { + e.printStackTrace(); + } + } + + /** + * DOCUMENT ME! + * + * @throws Exception DOCUMENT ME! + */ + private void jbInit() + throws Exception + { + this.setLayout(gridLayout1); + slider.setMajorTickSpacing(10); + slider.setMinorTickSpacing(1); + slider.setPaintTicks(true); + slider.setBackground(Color.white); + slider.setFont(new java.awt.Font("Verdana", 0, 11)); + slider.setDoubleBuffered(true); + slider.addMouseListener(new MouseAdapter() + { + public void mouseReleased(MouseEvent e) + { + slider_mouseReleased(e); + } + }); + valueField.setFont(new java.awt.Font("Verdana", 0, 11)); + valueField.setMinimumSize(new Dimension(6, 14)); + valueField.setPreferredSize(new Dimension(50, 12)); + valueField.setText(""); + valueField.setHorizontalAlignment(SwingConstants.CENTER); + valueField.addActionListener(new java.awt.event.ActionListener() + { + public void actionPerformed(ActionEvent e) + { + valueField_actionPerformed(e); + } + }); + label.setFont(new java.awt.Font("Verdana", 0, 11)); + label.setOpaque(false); + label.setHorizontalAlignment(SwingConstants.CENTER); + label.setText("set this label text"); + southPanel.setLayout(borderLayout1); + gridLayout1.setRows(2); + jPanel2.setLayout(flowLayout1); + applyButton.setFont(new java.awt.Font("Verdana", 0, 11)); + applyButton.setOpaque(false); + applyButton.setText("Apply"); + applyButton.addActionListener(new java.awt.event.ActionListener() + { + public void actionPerformed(ActionEvent e) + { + applyButton_actionPerformed(e); + } + }); + undoButton.setEnabled(false); + undoButton.setFont(new java.awt.Font("Verdana", 0, 11)); + undoButton.setOpaque(false); + undoButton.setText("Undo"); + undoButton.addActionListener(new java.awt.event.ActionListener() + { + public void actionPerformed(ActionEvent e) + { + undoButton_actionPerformed(e); + } + }); + allGroupsCheck.setEnabled(false); + allGroupsCheck.setFont(new java.awt.Font("Verdana", 0, 11)); + allGroupsCheck.setOpaque(false); + allGroupsCheck.setText("Apply to all Groups"); + allGroupsCheck.addActionListener(new java.awt.event.ActionListener() + { + public void actionPerformed(ActionEvent e) + { + allGroupsCheck_actionPerformed(e); + } + }); + this.setBackground(Color.white); + this.setPreferredSize(new Dimension(415, 84)); + jPanel2.setOpaque(false); + southPanel.setOpaque(false); + jPanel1.setLayout(borderLayout2); + jPanel1.setOpaque(false); + this.add(jPanel2, null); + jPanel2.add(label, null); + jPanel2.add(applyButton, null); + jPanel2.add(undoButton, null); + this.add(southPanel, null); + southPanel.add(jPanel1, java.awt.BorderLayout.EAST); + southPanel.add(slider, java.awt.BorderLayout.CENTER); + jPanel1.add(valueField, java.awt.BorderLayout.CENTER); + jPanel1.add(allGroupsCheck, java.awt.BorderLayout.EAST); + } + + /** + * DOCUMENT ME! + * + * @param e DOCUMENT ME! + */ + protected void valueField_actionPerformed(ActionEvent e) + { + } + + /** + * DOCUMENT ME! + * + * @param e DOCUMENT ME! + */ + protected void applyButton_actionPerformed(ActionEvent e) + { + } + + /** + * DOCUMENT ME! + * + * @param e DOCUMENT ME! + */ + protected void undoButton_actionPerformed(ActionEvent e) + { + } + + /** + * DOCUMENT ME! + * + * @param e DOCUMENT ME! + */ + protected void allGroupsCheck_actionPerformed(ActionEvent e) + { + } + + public void slider_mouseReleased(MouseEvent e) + { + + } +} diff --git a/src/jalview/jbgui/GStructureViewer.java b/src/jalview/jbgui/GStructureViewer.java index 10e0b9b..395389b 100644 --- a/src/jalview/jbgui/GStructureViewer.java +++ b/src/jalview/jbgui/GStructureViewer.java @@ -1,322 +1,321 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -package jalview.jbgui; - -import javax.swing.*; -import java.awt.event.ActionListener; -import java.awt.event.ActionEvent; - -public class GStructureViewer extends JInternalFrame -{ - public GStructureViewer() - { - try - { - jbInit(); - } - catch (Exception ex) - { - ex.printStackTrace(); - } - } - - private void jbInit() - throws Exception - { - this.setJMenuBar(menuBar); - fileMenu.setText("File"); - savemenu.setActionCommand("Save Image"); - savemenu.setText("Save As"); - pdbFile.setText("PDB File"); - pdbFile.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent actionEvent) - { - pdbFile_actionPerformed(actionEvent); - } - }); - png.setText("PNG"); - png.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent actionEvent) - { - png_actionPerformed(actionEvent); - } - }); - eps.setText("EPS"); - eps.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent actionEvent) - { - eps_actionPerformed(actionEvent); - } - }); - viewMapping.setText("View Mapping"); - viewMapping.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent actionEvent) - { - viewMapping_actionPerformed(actionEvent); - } - }); - viewMenu.setText("View"); - chainMenu.setText("Show Chain"); - colourMenu.setText("Colours"); - backGround.setText("Background Colour..."); - backGround.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent actionEvent) - { - backGround_actionPerformed(actionEvent); - } - }); - seqColour.setSelected(true); - seqColour.setText("By Sequence"); - seqColour.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent actionEvent) - { - seqColour_actionPerformed(actionEvent); - } - }); - chainColour.setText("By Chain"); - chainColour.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent actionEvent) - { - chainColour_actionPerformed(actionEvent); - } - }); - chargeColour.setText("Charge & Cysteine"); - chargeColour.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent actionEvent) - { - chargeColour_actionPerformed(actionEvent); - } - }); - zappoColour.setText("Zappo"); - zappoColour.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent actionEvent) - { - zappoColour_actionPerformed(actionEvent); - } - }); - taylorColour.setText("Taylor"); - taylorColour.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent actionEvent) - { - taylorColour_actionPerformed(actionEvent); - } - }); - hydroColour.setText("Hydro"); - hydroColour.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent actionEvent) - { - hydroColour_actionPerformed(actionEvent); - } - }); - strandColour.setText("Strand"); - strandColour.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent actionEvent) - { - strandColour_actionPerformed(actionEvent); - } - }); - helixColour.setText("Helix Propensity"); - helixColour.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent actionEvent) - { - helixColour_actionPerformed(actionEvent); - } - }); - turnColour.setText("Turn Propensity"); - turnColour.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent actionEvent) - { - turnColour_actionPerformed(actionEvent); - } - }); - buriedColour.setText("Buried Index"); - buriedColour.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent actionEvent) - { - buriedColour_actionPerformed(actionEvent); - } - }); - userColour.setText("User Defined ..."); - userColour.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent actionEvent) - { - userColour_actionPerformed(actionEvent); - } - }); - helpMenu.setText("Help"); - jmolHelp.setText("Jmol Help"); - jmolHelp.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent actionEvent) - { - jmolHelp_actionPerformed(actionEvent); - } - }); - menuBar.add(fileMenu); - menuBar.add(viewMenu); - menuBar.add(colourMenu); - menuBar.add(helpMenu); - fileMenu.add(savemenu); - fileMenu.add(viewMapping); - savemenu.add(pdbFile); - savemenu.add(png); - savemenu.add(eps); - viewMenu.add(chainMenu); - colourMenu.add(seqColour); - colourMenu.add(chainColour); - colourMenu.add(chargeColour); - colourMenu.add(zappoColour); - colourMenu.add(taylorColour); - colourMenu.add(hydroColour); - colourMenu.add(helixColour); - colourMenu.add(strandColour); - colourMenu.add(turnColour); - colourMenu.add(buriedColour); - colourMenu.add(userColour); - colourMenu.add(backGround); - helpMenu.add(jmolHelp); - } - - JMenuBar menuBar = new JMenuBar(); - JMenu fileMenu = new JMenu(); - JMenu savemenu = new JMenu(); - JMenuItem pdbFile = new JMenuItem(); - JMenuItem png = new JMenuItem(); - JMenuItem eps = new JMenuItem(); - JMenuItem viewMapping = new JMenuItem(); - JMenu viewMenu = new JMenu(); - protected JMenu chainMenu = new JMenu(); - JMenu jMenu1 = new JMenu(); - JMenu colourMenu = new JMenu(); - JMenuItem backGround = new JMenuItem(); - protected JCheckBoxMenuItem seqColour = new JCheckBoxMenuItem(); - JMenuItem chainColour = new JMenuItem(); - JMenuItem chargeColour = new JMenuItem(); - JMenuItem zappoColour = new JMenuItem(); - JMenuItem taylorColour = new JMenuItem(); - JMenuItem hydroColour = new JMenuItem(); - JMenuItem strandColour = new JMenuItem(); - JMenuItem helixColour = new JMenuItem(); - JMenuItem turnColour = new JMenuItem(); - JMenuItem buriedColour = new JMenuItem(); - JMenuItem userColour = new JMenuItem(); - JMenu helpMenu = new JMenu(); - JMenuItem jmolHelp = new JMenuItem(); - public void pdbFile_actionPerformed(ActionEvent actionEvent) - { - - } - - public void png_actionPerformed(ActionEvent actionEvent) - { - - } - - public void eps_actionPerformed(ActionEvent actionEvent) - { - - } - - public void viewMapping_actionPerformed(ActionEvent actionEvent) - { - - } - - public void seqColour_actionPerformed(ActionEvent actionEvent) - { - - } - - public void chainColour_actionPerformed(ActionEvent actionEvent) - { - - } - - public void chargeColour_actionPerformed(ActionEvent actionEvent) - { - - } - - public void zappoColour_actionPerformed(ActionEvent actionEvent) - { - - } - - public void taylorColour_actionPerformed(ActionEvent actionEvent) - { - - } - - public void hydroColour_actionPerformed(ActionEvent actionEvent) - { - - } - - public void helixColour_actionPerformed(ActionEvent actionEvent) - { - - } - - public void strandColour_actionPerformed(ActionEvent actionEvent) - { - - } - - public void turnColour_actionPerformed(ActionEvent actionEvent) - { - - } - - public void buriedColour_actionPerformed(ActionEvent actionEvent) - { - - } - - public void userColour_actionPerformed(ActionEvent actionEvent) - { - - } - - public void backGround_actionPerformed(ActionEvent actionEvent) - { - - } - - public void jmolHelp_actionPerformed(ActionEvent actionEvent) - { - - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.jbgui; + +import javax.swing.*; +import java.awt.event.ActionListener; +import java.awt.event.ActionEvent; + +public class GStructureViewer extends JInternalFrame +{ + public GStructureViewer() + { + try + { + jbInit(); + } + catch (Exception ex) + { + ex.printStackTrace(); + } + } + + private void jbInit() + throws Exception + { + this.setJMenuBar(menuBar); + fileMenu.setText("File"); + savemenu.setActionCommand("Save Image"); + savemenu.setText("Save As"); + pdbFile.setText("PDB File"); + pdbFile.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent actionEvent) + { + pdbFile_actionPerformed(actionEvent); + } + }); + png.setText("PNG"); + png.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent actionEvent) + { + png_actionPerformed(actionEvent); + } + }); + eps.setText("EPS"); + eps.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent actionEvent) + { + eps_actionPerformed(actionEvent); + } + }); + viewMapping.setText("View Mapping"); + viewMapping.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent actionEvent) + { + viewMapping_actionPerformed(actionEvent); + } + }); + viewMenu.setText("View"); + chainMenu.setText("Show Chain"); + colourMenu.setText("Colours"); + backGround.setText("Background Colour..."); + backGround.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent actionEvent) + { + backGround_actionPerformed(actionEvent); + } + }); + seqColour.setSelected(true); + seqColour.setText("By Sequence"); + seqColour.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent actionEvent) + { + seqColour_actionPerformed(actionEvent); + } + }); + chainColour.setText("By Chain"); + chainColour.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent actionEvent) + { + chainColour_actionPerformed(actionEvent); + } + }); + chargeColour.setText("Charge & Cysteine"); + chargeColour.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent actionEvent) + { + chargeColour_actionPerformed(actionEvent); + } + }); + zappoColour.setText("Zappo"); + zappoColour.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent actionEvent) + { + zappoColour_actionPerformed(actionEvent); + } + }); + taylorColour.setText("Taylor"); + taylorColour.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent actionEvent) + { + taylorColour_actionPerformed(actionEvent); + } + }); + hydroColour.setText("Hydro"); + hydroColour.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent actionEvent) + { + hydroColour_actionPerformed(actionEvent); + } + }); + strandColour.setText("Strand"); + strandColour.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent actionEvent) + { + strandColour_actionPerformed(actionEvent); + } + }); + helixColour.setText("Helix Propensity"); + helixColour.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent actionEvent) + { + helixColour_actionPerformed(actionEvent); + } + }); + turnColour.setText("Turn Propensity"); + turnColour.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent actionEvent) + { + turnColour_actionPerformed(actionEvent); + } + }); + buriedColour.setText("Buried Index"); + buriedColour.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent actionEvent) + { + buriedColour_actionPerformed(actionEvent); + } + }); + userColour.setText("User Defined ..."); + userColour.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent actionEvent) + { + userColour_actionPerformed(actionEvent); + } + }); + helpMenu.setText("Help"); + jmolHelp.setText("Jmol Help"); + jmolHelp.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent actionEvent) + { + jmolHelp_actionPerformed(actionEvent); + } + }); + menuBar.add(fileMenu); + menuBar.add(viewMenu); + menuBar.add(colourMenu); + menuBar.add(helpMenu); + fileMenu.add(savemenu); + fileMenu.add(viewMapping); + savemenu.add(pdbFile); + savemenu.add(png); + savemenu.add(eps); + viewMenu.add(chainMenu); + colourMenu.add(seqColour); + colourMenu.add(chainColour); + colourMenu.add(chargeColour); + colourMenu.add(zappoColour); + colourMenu.add(taylorColour); + colourMenu.add(hydroColour); + colourMenu.add(helixColour); + colourMenu.add(strandColour); + colourMenu.add(turnColour); + colourMenu.add(buriedColour); + colourMenu.add(userColour); + colourMenu.add(backGround); + helpMenu.add(jmolHelp); + } + + JMenuBar menuBar = new JMenuBar(); + JMenu fileMenu = new JMenu(); + JMenu savemenu = new JMenu(); + JMenuItem pdbFile = new JMenuItem(); + JMenuItem png = new JMenuItem(); + JMenuItem eps = new JMenuItem(); + JMenuItem viewMapping = new JMenuItem(); + JMenu viewMenu = new JMenu(); + protected JMenu chainMenu = new JMenu(); + JMenu jMenu1 = new JMenu(); + JMenu colourMenu = new JMenu(); + JMenuItem backGround = new JMenuItem(); + protected JCheckBoxMenuItem seqColour = new JCheckBoxMenuItem(); + JMenuItem chainColour = new JMenuItem(); + JMenuItem chargeColour = new JMenuItem(); + JMenuItem zappoColour = new JMenuItem(); + JMenuItem taylorColour = new JMenuItem(); + JMenuItem hydroColour = new JMenuItem(); + JMenuItem strandColour = new JMenuItem(); + JMenuItem helixColour = new JMenuItem(); + JMenuItem turnColour = new JMenuItem(); + JMenuItem buriedColour = new JMenuItem(); + JMenuItem userColour = new JMenuItem(); + JMenu helpMenu = new JMenu(); + JMenuItem jmolHelp = new JMenuItem(); + public void pdbFile_actionPerformed(ActionEvent actionEvent) + { + + } + + public void png_actionPerformed(ActionEvent actionEvent) + { + + } + + public void eps_actionPerformed(ActionEvent actionEvent) + { + + } + + public void viewMapping_actionPerformed(ActionEvent actionEvent) + { + + } + + public void seqColour_actionPerformed(ActionEvent actionEvent) + { + + } + + public void chainColour_actionPerformed(ActionEvent actionEvent) + { + + } + + public void chargeColour_actionPerformed(ActionEvent actionEvent) + { + + } + + public void zappoColour_actionPerformed(ActionEvent actionEvent) + { + + } + + public void taylorColour_actionPerformed(ActionEvent actionEvent) + { + + } + + public void hydroColour_actionPerformed(ActionEvent actionEvent) + { + + } + + public void helixColour_actionPerformed(ActionEvent actionEvent) + { + + } + + public void strandColour_actionPerformed(ActionEvent actionEvent) + { + + } + + public void turnColour_actionPerformed(ActionEvent actionEvent) + { + + } + + public void buriedColour_actionPerformed(ActionEvent actionEvent) + { + + } + + public void userColour_actionPerformed(ActionEvent actionEvent) + { + + } + + public void backGround_actionPerformed(ActionEvent actionEvent) + { + + } + + public void jmolHelp_actionPerformed(ActionEvent actionEvent) + { + + } +} diff --git a/src/jalview/jbgui/GTreePanel.java b/src/jalview/jbgui/GTreePanel.java index 5d3b8b8..d2f5995 100755 --- a/src/jalview/jbgui/GTreePanel.java +++ b/src/jalview/jbgui/GTreePanel.java @@ -1,248 +1,248 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.jbgui; - -import java.awt.*; -import java.awt.event.*; -import javax.swing.*; -import javax.swing.event.*; - -public class GTreePanel - extends JInternalFrame -{ - BorderLayout borderLayout1 = new BorderLayout(); - public JScrollPane scrollPane = new JScrollPane(); - JMenuBar jMenuBar1 = new JMenuBar(); - JMenu fileMenu = new JMenu(); - JMenuItem saveAsNewick = new JMenuItem(); - JMenuItem printMenu = new JMenuItem(); - protected JMenu viewMenu = new JMenu(); - public JMenuItem font = new JMenuItem(); - public JCheckBoxMenuItem bootstrapMenu = new JCheckBoxMenuItem(); - public JCheckBoxMenuItem distanceMenu = new JCheckBoxMenuItem(); - public JCheckBoxMenuItem fitToWindow = new JCheckBoxMenuItem(); - public JCheckBoxMenuItem placeholdersMenu = new JCheckBoxMenuItem(); - JMenuItem pngTree = new JMenuItem(); - JMenuItem epsTree = new JMenuItem(); - JMenu saveAsMenu = new JMenu(); - JMenuItem textbox = new JMenuItem(); - public JMenuItem originalSeqData = new JMenuItem(); - protected JMenu associateLeavesMenu = new JMenu(); - public GTreePanel() - { - try - { - jbInit(); - this.setJMenuBar(jMenuBar1); - } - catch (Exception e) - { - e.printStackTrace(); - } - } - - private void jbInit() - throws Exception - { - this.getContentPane().setLayout(borderLayout1); - this.setBackground(Color.white); - this.setFont(new java.awt.Font("Verdana", 0, 12)); - scrollPane.setOpaque(false); - fileMenu.setText("File"); - saveAsNewick.setText("Newick Format"); - saveAsNewick.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - saveAsNewick_actionPerformed(e); - } - }); - printMenu.setText("Print"); - printMenu.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(ActionEvent e) - { - printMenu_actionPerformed(e); - } - }); - viewMenu.setText("View"); - viewMenu.addMenuListener(new MenuListener() - { - public void menuSelected(MenuEvent e) - { - viewMenu_menuSelected(); - } - - public void menuDeselected(MenuEvent e) - { - } - - public void menuCanceled(MenuEvent e) - { - } - }); - font.setText("Font..."); - font.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(ActionEvent e) - { - font_actionPerformed(e); - } - }); - bootstrapMenu.setText("Show Bootstrap Values"); - bootstrapMenu.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(ActionEvent e) - { - bootstrapMenu_actionPerformed(e); - } - }); - distanceMenu.setText("Show Distances"); - distanceMenu.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(ActionEvent e) - { - distanceMenu_actionPerformed(e); - } - }); - fitToWindow.setSelected(true); - fitToWindow.setText("Fit To Window"); - fitToWindow.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(ActionEvent e) - { - fitToWindow_actionPerformed(e); - } - }); - epsTree.setText("EPS"); - epsTree.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(ActionEvent e) - { - epsTree_actionPerformed(e); - } - }); - pngTree.setText("PNG"); - pngTree.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(ActionEvent e) - { - pngTree_actionPerformed(e); - } - }); - saveAsMenu.setText("Save as"); - placeholdersMenu.setToolTipText( - "Marks leaves of tree not associated with a sequence"); - placeholdersMenu.setText("Mark Unlinked Leaves"); - placeholdersMenu.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - placeholdersMenu_actionPerformed(e); - } - }); - textbox.setText("Output to Textbox..."); - textbox.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - textbox_actionPerformed(e); - } - }); - originalSeqData.setText("Input Data..."); - originalSeqData.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - originalSeqData_actionPerformed(e); - } - }); - associateLeavesMenu.setText("Associate Leaves With"); - this.getContentPane().add(scrollPane, BorderLayout.CENTER); - jMenuBar1.add(fileMenu); - jMenuBar1.add(viewMenu); - fileMenu.add(saveAsMenu); - fileMenu.add(textbox); - fileMenu.add(printMenu); - fileMenu.add(originalSeqData); - viewMenu.add(fitToWindow); - viewMenu.add(font); - viewMenu.add(distanceMenu); - viewMenu.add(bootstrapMenu); - viewMenu.add(placeholdersMenu); - viewMenu.add(associateLeavesMenu); - saveAsMenu.add(saveAsNewick); - saveAsMenu.add(epsTree); - saveAsMenu.add(pngTree); - } - - public void printMenu_actionPerformed(ActionEvent e) - { - } - - public void font_actionPerformed(ActionEvent e) - { - } - - public void distanceMenu_actionPerformed(ActionEvent e) - { - } - - public void bootstrapMenu_actionPerformed(ActionEvent e) - { - } - - public void fitToWindow_actionPerformed(ActionEvent e) - { - } - - public void pngTree_actionPerformed(ActionEvent e) - { - } - - public void epsTree_actionPerformed(ActionEvent e) - { - } - - public void saveAsNewick_actionPerformed(ActionEvent e) - { - } - - public void placeholdersMenu_actionPerformed(ActionEvent e) - { - } - - public void textbox_actionPerformed(ActionEvent e) - { - } - - public void fullid_actionPerformed(ActionEvent e) - { - - } - - public void originalSeqData_actionPerformed(ActionEvent e) - { - - } - - public void viewMenu_menuSelected() - { - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.jbgui; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +import javax.swing.event.*; + +public class GTreePanel + extends JInternalFrame +{ + BorderLayout borderLayout1 = new BorderLayout(); + public JScrollPane scrollPane = new JScrollPane(); + JMenuBar jMenuBar1 = new JMenuBar(); + JMenu fileMenu = new JMenu(); + JMenuItem saveAsNewick = new JMenuItem(); + JMenuItem printMenu = new JMenuItem(); + protected JMenu viewMenu = new JMenu(); + public JMenuItem font = new JMenuItem(); + public JCheckBoxMenuItem bootstrapMenu = new JCheckBoxMenuItem(); + public JCheckBoxMenuItem distanceMenu = new JCheckBoxMenuItem(); + public JCheckBoxMenuItem fitToWindow = new JCheckBoxMenuItem(); + public JCheckBoxMenuItem placeholdersMenu = new JCheckBoxMenuItem(); + JMenuItem pngTree = new JMenuItem(); + JMenuItem epsTree = new JMenuItem(); + JMenu saveAsMenu = new JMenu(); + JMenuItem textbox = new JMenuItem(); + public JMenuItem originalSeqData = new JMenuItem(); + protected JMenu associateLeavesMenu = new JMenu(); + public GTreePanel() + { + try + { + jbInit(); + this.setJMenuBar(jMenuBar1); + } + catch (Exception e) + { + e.printStackTrace(); + } + } + + private void jbInit() + throws Exception + { + this.getContentPane().setLayout(borderLayout1); + this.setBackground(Color.white); + this.setFont(new java.awt.Font("Verdana", 0, 12)); + scrollPane.setOpaque(false); + fileMenu.setText("File"); + saveAsNewick.setText("Newick Format"); + saveAsNewick.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + saveAsNewick_actionPerformed(e); + } + }); + printMenu.setText("Print"); + printMenu.addActionListener(new java.awt.event.ActionListener() + { + public void actionPerformed(ActionEvent e) + { + printMenu_actionPerformed(e); + } + }); + viewMenu.setText("View"); + viewMenu.addMenuListener(new MenuListener() + { + public void menuSelected(MenuEvent e) + { + viewMenu_menuSelected(); + } + + public void menuDeselected(MenuEvent e) + { + } + + public void menuCanceled(MenuEvent e) + { + } + }); + font.setText("Font..."); + font.addActionListener(new java.awt.event.ActionListener() + { + public void actionPerformed(ActionEvent e) + { + font_actionPerformed(e); + } + }); + bootstrapMenu.setText("Show Bootstrap Values"); + bootstrapMenu.addActionListener(new java.awt.event.ActionListener() + { + public void actionPerformed(ActionEvent e) + { + bootstrapMenu_actionPerformed(e); + } + }); + distanceMenu.setText("Show Distances"); + distanceMenu.addActionListener(new java.awt.event.ActionListener() + { + public void actionPerformed(ActionEvent e) + { + distanceMenu_actionPerformed(e); + } + }); + fitToWindow.setSelected(true); + fitToWindow.setText("Fit To Window"); + fitToWindow.addActionListener(new java.awt.event.ActionListener() + { + public void actionPerformed(ActionEvent e) + { + fitToWindow_actionPerformed(e); + } + }); + epsTree.setText("EPS"); + epsTree.addActionListener(new java.awt.event.ActionListener() + { + public void actionPerformed(ActionEvent e) + { + epsTree_actionPerformed(e); + } + }); + pngTree.setText("PNG"); + pngTree.addActionListener(new java.awt.event.ActionListener() + { + public void actionPerformed(ActionEvent e) + { + pngTree_actionPerformed(e); + } + }); + saveAsMenu.setText("Save as"); + placeholdersMenu.setToolTipText( + "Marks leaves of tree not associated with a sequence"); + placeholdersMenu.setText("Mark Unlinked Leaves"); + placeholdersMenu.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + placeholdersMenu_actionPerformed(e); + } + }); + textbox.setText("Output to Textbox..."); + textbox.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + textbox_actionPerformed(e); + } + }); + originalSeqData.setText("Input Data..."); + originalSeqData.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + originalSeqData_actionPerformed(e); + } + }); + associateLeavesMenu.setText("Associate Leaves With"); + this.getContentPane().add(scrollPane, BorderLayout.CENTER); + jMenuBar1.add(fileMenu); + jMenuBar1.add(viewMenu); + fileMenu.add(saveAsMenu); + fileMenu.add(textbox); + fileMenu.add(printMenu); + fileMenu.add(originalSeqData); + viewMenu.add(fitToWindow); + viewMenu.add(font); + viewMenu.add(distanceMenu); + viewMenu.add(bootstrapMenu); + viewMenu.add(placeholdersMenu); + viewMenu.add(associateLeavesMenu); + saveAsMenu.add(saveAsNewick); + saveAsMenu.add(epsTree); + saveAsMenu.add(pngTree); + } + + public void printMenu_actionPerformed(ActionEvent e) + { + } + + public void font_actionPerformed(ActionEvent e) + { + } + + public void distanceMenu_actionPerformed(ActionEvent e) + { + } + + public void bootstrapMenu_actionPerformed(ActionEvent e) + { + } + + public void fitToWindow_actionPerformed(ActionEvent e) + { + } + + public void pngTree_actionPerformed(ActionEvent e) + { + } + + public void epsTree_actionPerformed(ActionEvent e) + { + } + + public void saveAsNewick_actionPerformed(ActionEvent e) + { + } + + public void placeholdersMenu_actionPerformed(ActionEvent e) + { + } + + public void textbox_actionPerformed(ActionEvent e) + { + } + + public void fullid_actionPerformed(ActionEvent e) + { + + } + + public void originalSeqData_actionPerformed(ActionEvent e) + { + + } + + public void viewMenu_menuSelected() + { + } +} diff --git a/src/jalview/jbgui/GUserDefinedColours.java b/src/jalview/jbgui/GUserDefinedColours.java index 1801152..f974133 100755 --- a/src/jalview/jbgui/GUserDefinedColours.java +++ b/src/jalview/jbgui/GUserDefinedColours.java @@ -1,253 +1,253 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.jbgui; - -import java.awt.*; -import java.awt.event.*; -import javax.swing.*; - -/** - * DOCUMENT ME! - * - * @author $author$ - * @version $Revision$ - */ -public class GUserDefinedColours - extends JPanel -{ - protected JColorChooser colorChooser = new JColorChooser(); - protected JPanel buttonPanel = new JPanel(); - protected GridLayout gridLayout = new GridLayout(); - JPanel lowerPanel = new JPanel(); - protected JButton okButton = new JButton(); - protected JButton applyButton = new JButton(); - protected JButton loadbutton = new JButton(); - protected JButton savebutton = new JButton(); - protected JButton cancelButton = new JButton(); - JPanel namePanel = new JPanel(); - JLabel jLabel1 = new JLabel(); - protected JTextField schemeName = new JTextField(); - BorderLayout borderLayout1 = new BorderLayout(); - JPanel panel1 = new JPanel(); - JPanel okCancelPanel = new JPanel(); - JPanel saveLoadPanel = new JPanel(); - BorderLayout borderLayout3 = new BorderLayout(); - GridBagLayout gridBagLayout1 = new GridBagLayout(); - BorderLayout borderLayout2 = new BorderLayout(); - FlowLayout flowLayout1 = new FlowLayout(); - BorderLayout borderLayout4 = new BorderLayout(); - JPanel jPanel4 = new JPanel(); - BorderLayout borderLayout5 = new BorderLayout(); - JLabel label = new JLabel(); - protected JPanel casePanel = new JPanel(); - protected JCheckBox caseSensitive = new JCheckBox(); - protected JButton lcaseColour = new JButton(); - /** - * Creates a new GUserDefinedColours object. - */ - public GUserDefinedColours() - { - try - { - jbInit(); - } - catch (Exception e) - { - e.printStackTrace(); - } - - } - - /** - * DOCUMENT ME! - * - * @throws Exception DOCUMENT ME! - */ - private void jbInit() - throws Exception - { - this.setLayout(borderLayout4); - buttonPanel.setLayout(gridLayout); - gridLayout.setColumns(4); - gridLayout.setRows(5); - okButton.setFont(new java.awt.Font("Verdana", 0, 11)); - okButton.setText("OK"); - okButton.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(ActionEvent e) - { - okButton_actionPerformed(e); - } - }); - applyButton.setFont(new java.awt.Font("Verdana", 0, 11)); - applyButton.setText("Apply"); - applyButton.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(ActionEvent e) - { - applyButton_actionPerformed(e); - } - }); - loadbutton.setFont(new java.awt.Font("Verdana", 0, 11)); - loadbutton.setText("Load scheme"); - loadbutton.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(ActionEvent e) - { - loadbutton_actionPerformed(e); - } - }); - savebutton.setFont(new java.awt.Font("Verdana", 0, 11)); - savebutton.setText("Save scheme"); - savebutton.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(ActionEvent e) - { - savebutton_actionPerformed(e); - } - }); - cancelButton.setFont(new java.awt.Font("Verdana", 0, 11)); - cancelButton.setText("Cancel"); - cancelButton.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(ActionEvent e) - { - cancelButton_actionPerformed(e); - } - }); - this.setBackground(new Color(212, 208, 223)); - lowerPanel.setOpaque(false); - lowerPanel.setLayout(borderLayout3); - colorChooser.setOpaque(false); - jLabel1.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); - jLabel1.setText("Name"); - namePanel.setMinimumSize(new Dimension(300, 31)); - namePanel.setOpaque(false); - namePanel.setPreferredSize(new Dimension(240, 25)); - namePanel.setLayout(borderLayout1); - schemeName.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); - schemeName.setPreferredSize(new Dimension(105, 21)); - schemeName.setText(""); - schemeName.setHorizontalAlignment(SwingConstants.CENTER); - panel1.setLayout(flowLayout1); - panel1.setOpaque(false); - okCancelPanel.setOpaque(false); - saveLoadPanel.setOpaque(false); - jPanel4.setLayout(borderLayout5); - label.setFont(new java.awt.Font("Verdana", Font.ITALIC, 10)); - label.setOpaque(false); - label.setPreferredSize(new Dimension(260, 34)); - label.setText( - "Save your colour scheme with a unique name and it will be added " + - "to the Colour menu."); - caseSensitive.setText("Case Sensitive"); - caseSensitive.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - caseSensitive_actionPerformed(e); - } - }); - lcaseColour.setText("Lower Case Colour"); - lcaseColour.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - lcaseColour_actionPerformed(e); - } - }); - - saveLoadPanel.add(savebutton); - saveLoadPanel.add(loadbutton); - okCancelPanel.add(applyButton); - okCancelPanel.add(okButton); - okCancelPanel.add(cancelButton); - lowerPanel.add(saveLoadPanel, java.awt.BorderLayout.NORTH); - lowerPanel.add(okCancelPanel, java.awt.BorderLayout.SOUTH); - - namePanel.add(schemeName, java.awt.BorderLayout.CENTER); - namePanel.add(jLabel1, java.awt.BorderLayout.WEST); - panel1.add(namePanel, null); - panel1.add(buttonPanel, null); - panel1.add(casePanel); - casePanel.add(caseSensitive); - casePanel.add(lcaseColour); - panel1.add(lowerPanel, null); - panel1.add(label); - - jPanel4.add(panel1, java.awt.BorderLayout.CENTER); - this.add(jPanel4, java.awt.BorderLayout.CENTER); - this.add(colorChooser, java.awt.BorderLayout.EAST); - } - - /** - * DOCUMENT ME! - * - * @param e DOCUMENT ME! - */ - protected void okButton_actionPerformed(ActionEvent e) - { - } - - /** - * DOCUMENT ME! - * - * @param e DOCUMENT ME! - */ - protected void applyButton_actionPerformed(ActionEvent e) - { - } - - /** - * DOCUMENT ME! - * - * @param e DOCUMENT ME! - */ - protected void loadbutton_actionPerformed(ActionEvent e) - { - } - - /** - * DOCUMENT ME! - * - * @param e DOCUMENT ME! - */ - protected void savebutton_actionPerformed(ActionEvent e) - { - } - - /** - * DOCUMENT ME! - * - * @param e DOCUMENT ME! - */ - protected void cancelButton_actionPerformed(ActionEvent e) - { - } - - public void caseSensitive_actionPerformed(ActionEvent e) - { - - } - - public void lcaseColour_actionPerformed(ActionEvent e) - { - - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.jbgui; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; + +/** + * DOCUMENT ME! + * + * @author $author$ + * @version $Revision$ + */ +public class GUserDefinedColours + extends JPanel +{ + protected JColorChooser colorChooser = new JColorChooser(); + protected JPanel buttonPanel = new JPanel(); + protected GridLayout gridLayout = new GridLayout(); + JPanel lowerPanel = new JPanel(); + protected JButton okButton = new JButton(); + protected JButton applyButton = new JButton(); + protected JButton loadbutton = new JButton(); + protected JButton savebutton = new JButton(); + protected JButton cancelButton = new JButton(); + JPanel namePanel = new JPanel(); + JLabel jLabel1 = new JLabel(); + protected JTextField schemeName = new JTextField(); + BorderLayout borderLayout1 = new BorderLayout(); + JPanel panel1 = new JPanel(); + JPanel okCancelPanel = new JPanel(); + JPanel saveLoadPanel = new JPanel(); + BorderLayout borderLayout3 = new BorderLayout(); + GridBagLayout gridBagLayout1 = new GridBagLayout(); + BorderLayout borderLayout2 = new BorderLayout(); + FlowLayout flowLayout1 = new FlowLayout(); + BorderLayout borderLayout4 = new BorderLayout(); + JPanel jPanel4 = new JPanel(); + BorderLayout borderLayout5 = new BorderLayout(); + JLabel label = new JLabel(); + protected JPanel casePanel = new JPanel(); + protected JCheckBox caseSensitive = new JCheckBox(); + protected JButton lcaseColour = new JButton(); + /** + * Creates a new GUserDefinedColours object. + */ + public GUserDefinedColours() + { + try + { + jbInit(); + } + catch (Exception e) + { + e.printStackTrace(); + } + + } + + /** + * DOCUMENT ME! + * + * @throws Exception DOCUMENT ME! + */ + private void jbInit() + throws Exception + { + this.setLayout(borderLayout4); + buttonPanel.setLayout(gridLayout); + gridLayout.setColumns(4); + gridLayout.setRows(5); + okButton.setFont(new java.awt.Font("Verdana", 0, 11)); + okButton.setText("OK"); + okButton.addActionListener(new java.awt.event.ActionListener() + { + public void actionPerformed(ActionEvent e) + { + okButton_actionPerformed(e); + } + }); + applyButton.setFont(new java.awt.Font("Verdana", 0, 11)); + applyButton.setText("Apply"); + applyButton.addActionListener(new java.awt.event.ActionListener() + { + public void actionPerformed(ActionEvent e) + { + applyButton_actionPerformed(e); + } + }); + loadbutton.setFont(new java.awt.Font("Verdana", 0, 11)); + loadbutton.setText("Load scheme"); + loadbutton.addActionListener(new java.awt.event.ActionListener() + { + public void actionPerformed(ActionEvent e) + { + loadbutton_actionPerformed(e); + } + }); + savebutton.setFont(new java.awt.Font("Verdana", 0, 11)); + savebutton.setText("Save scheme"); + savebutton.addActionListener(new java.awt.event.ActionListener() + { + public void actionPerformed(ActionEvent e) + { + savebutton_actionPerformed(e); + } + }); + cancelButton.setFont(new java.awt.Font("Verdana", 0, 11)); + cancelButton.setText("Cancel"); + cancelButton.addActionListener(new java.awt.event.ActionListener() + { + public void actionPerformed(ActionEvent e) + { + cancelButton_actionPerformed(e); + } + }); + this.setBackground(new Color(212, 208, 223)); + lowerPanel.setOpaque(false); + lowerPanel.setLayout(borderLayout3); + colorChooser.setOpaque(false); + jLabel1.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); + jLabel1.setText("Name"); + namePanel.setMinimumSize(new Dimension(300, 31)); + namePanel.setOpaque(false); + namePanel.setPreferredSize(new Dimension(240, 25)); + namePanel.setLayout(borderLayout1); + schemeName.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); + schemeName.setPreferredSize(new Dimension(105, 21)); + schemeName.setText(""); + schemeName.setHorizontalAlignment(SwingConstants.CENTER); + panel1.setLayout(flowLayout1); + panel1.setOpaque(false); + okCancelPanel.setOpaque(false); + saveLoadPanel.setOpaque(false); + jPanel4.setLayout(borderLayout5); + label.setFont(new java.awt.Font("Verdana", Font.ITALIC, 10)); + label.setOpaque(false); + label.setPreferredSize(new Dimension(260, 34)); + label.setText( + "Save your colour scheme with a unique name and it will be added " + + "to the Colour menu."); + caseSensitive.setText("Case Sensitive"); + caseSensitive.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + caseSensitive_actionPerformed(e); + } + }); + lcaseColour.setText("Lower Case Colour"); + lcaseColour.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + lcaseColour_actionPerformed(e); + } + }); + + saveLoadPanel.add(savebutton); + saveLoadPanel.add(loadbutton); + okCancelPanel.add(applyButton); + okCancelPanel.add(okButton); + okCancelPanel.add(cancelButton); + lowerPanel.add(saveLoadPanel, java.awt.BorderLayout.NORTH); + lowerPanel.add(okCancelPanel, java.awt.BorderLayout.SOUTH); + + namePanel.add(schemeName, java.awt.BorderLayout.CENTER); + namePanel.add(jLabel1, java.awt.BorderLayout.WEST); + panel1.add(namePanel, null); + panel1.add(buttonPanel, null); + panel1.add(casePanel); + casePanel.add(caseSensitive); + casePanel.add(lcaseColour); + panel1.add(lowerPanel, null); + panel1.add(label); + + jPanel4.add(panel1, java.awt.BorderLayout.CENTER); + this.add(jPanel4, java.awt.BorderLayout.CENTER); + this.add(colorChooser, java.awt.BorderLayout.EAST); + } + + /** + * DOCUMENT ME! + * + * @param e DOCUMENT ME! + */ + protected void okButton_actionPerformed(ActionEvent e) + { + } + + /** + * DOCUMENT ME! + * + * @param e DOCUMENT ME! + */ + protected void applyButton_actionPerformed(ActionEvent e) + { + } + + /** + * DOCUMENT ME! + * + * @param e DOCUMENT ME! + */ + protected void loadbutton_actionPerformed(ActionEvent e) + { + } + + /** + * DOCUMENT ME! + * + * @param e DOCUMENT ME! + */ + protected void savebutton_actionPerformed(ActionEvent e) + { + } + + /** + * DOCUMENT ME! + * + * @param e DOCUMENT ME! + */ + protected void cancelButton_actionPerformed(ActionEvent e) + { + } + + public void caseSensitive_actionPerformed(ActionEvent e) + { + + } + + public void lcaseColour_actionPerformed(ActionEvent e) + { + + } +} diff --git a/src/jalview/jbgui/GWebserviceInfo.java b/src/jalview/jbgui/GWebserviceInfo.java index ca68115..7aadd77 100755 --- a/src/jalview/jbgui/GWebserviceInfo.java +++ b/src/jalview/jbgui/GWebserviceInfo.java @@ -1,115 +1,115 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.jbgui; - -import java.awt.*; -import java.awt.event.*; -import javax.swing.*; - -/** - * DOCUMENT ME! - * - * @author $author$ - * @version $Revision$ - */ -public class GWebserviceInfo - extends JPanel -{ - protected JTextArea infoText = new JTextArea(); - JScrollPane jScrollPane1 = new JScrollPane(); - JPanel jPanel1 = new JPanel(); - BorderLayout borderLayout1 = new BorderLayout(); - BorderLayout borderLayout2 = new BorderLayout(); - protected JPanel titlePanel = new JPanel(); - BorderLayout borderLayout3 = new BorderLayout(); - protected JPanel buttonPanel = new JPanel(); - public JButton cancel = new JButton(); - public JButton showResultsNewFrame = new JButton(); - public JButton mergeResults = new JButton(); - GridBagLayout gridBagLayout1 = new GridBagLayout(); - /** - * Creates a new GWebserviceInfo object. - */ - public GWebserviceInfo() - { - try - { - jbInit(); - } - catch (Exception e) - { - e.printStackTrace(); - } - } - - /** - * DOCUMENT ME! - * - * @throws Exception DOCUMENT ME! - */ - private void jbInit() - throws Exception - { - infoText.setFont(new java.awt.Font("Verdana", 0, 10)); - infoText.setBorder(null); - infoText.setEditable(false); - infoText.setText(""); - infoText.setLineWrap(true); - infoText.setWrapStyleWord(true); - this.setLayout(borderLayout1); - jPanel1.setLayout(borderLayout2); - titlePanel.setBackground(Color.white); - titlePanel.setPreferredSize(new Dimension(0, 60)); - titlePanel.setLayout(borderLayout3); - jScrollPane1.setBorder(null); - jScrollPane1.setPreferredSize(new Dimension(400, 70)); - cancel.setFont(new java.awt.Font("Verdana", 0, 11)); - cancel.setText("Cancel"); - cancel.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(ActionEvent e) - { - cancel_actionPerformed(e); - } - }); - buttonPanel.setLayout(gridBagLayout1); - buttonPanel.setOpaque(false); - showResultsNewFrame.setText("New Window"); - mergeResults.setText("Merge Results"); - this.setBackground(Color.white); - this.add(jPanel1, BorderLayout.NORTH); - jPanel1.add(jScrollPane1, BorderLayout.CENTER); - jScrollPane1.getViewport().add(infoText, null); - jPanel1.add(titlePanel, BorderLayout.NORTH); - titlePanel.add(buttonPanel, BorderLayout.EAST); - buttonPanel.add(cancel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0 - , GridBagConstraints.CENTER, - GridBagConstraints.NONE, - new Insets(19, 6, 16, 4), 0, 0)); - } - - /** - * DOCUMENT ME! - * - * @param e DOCUMENT ME! - */ - protected void cancel_actionPerformed(ActionEvent e) - { - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.jbgui; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; + +/** + * DOCUMENT ME! + * + * @author $author$ + * @version $Revision$ + */ +public class GWebserviceInfo + extends JPanel +{ + protected JTextArea infoText = new JTextArea(); + JScrollPane jScrollPane1 = new JScrollPane(); + JPanel jPanel1 = new JPanel(); + BorderLayout borderLayout1 = new BorderLayout(); + BorderLayout borderLayout2 = new BorderLayout(); + protected JPanel titlePanel = new JPanel(); + BorderLayout borderLayout3 = new BorderLayout(); + protected JPanel buttonPanel = new JPanel(); + public JButton cancel = new JButton(); + public JButton showResultsNewFrame = new JButton(); + public JButton mergeResults = new JButton(); + GridBagLayout gridBagLayout1 = new GridBagLayout(); + /** + * Creates a new GWebserviceInfo object. + */ + public GWebserviceInfo() + { + try + { + jbInit(); + } + catch (Exception e) + { + e.printStackTrace(); + } + } + + /** + * DOCUMENT ME! + * + * @throws Exception DOCUMENT ME! + */ + private void jbInit() + throws Exception + { + infoText.setFont(new java.awt.Font("Verdana", 0, 10)); + infoText.setBorder(null); + infoText.setEditable(false); + infoText.setText(""); + infoText.setLineWrap(true); + infoText.setWrapStyleWord(true); + this.setLayout(borderLayout1); + jPanel1.setLayout(borderLayout2); + titlePanel.setBackground(Color.white); + titlePanel.setPreferredSize(new Dimension(0, 60)); + titlePanel.setLayout(borderLayout3); + jScrollPane1.setBorder(null); + jScrollPane1.setPreferredSize(new Dimension(400, 70)); + cancel.setFont(new java.awt.Font("Verdana", 0, 11)); + cancel.setText("Cancel"); + cancel.addActionListener(new java.awt.event.ActionListener() + { + public void actionPerformed(ActionEvent e) + { + cancel_actionPerformed(e); + } + }); + buttonPanel.setLayout(gridBagLayout1); + buttonPanel.setOpaque(false); + showResultsNewFrame.setText("New Window"); + mergeResults.setText("Merge Results"); + this.setBackground(Color.white); + this.add(jPanel1, BorderLayout.NORTH); + jPanel1.add(jScrollPane1, BorderLayout.CENTER); + jScrollPane1.getViewport().add(infoText, null); + jPanel1.add(titlePanel, BorderLayout.NORTH); + titlePanel.add(buttonPanel, BorderLayout.EAST); + buttonPanel.add(cancel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0 + , GridBagConstraints.CENTER, + GridBagConstraints.NONE, + new Insets(19, 6, 16, 4), 0, 0)); + } + + /** + * DOCUMENT ME! + * + * @param e DOCUMENT ME! + */ + protected void cancel_actionPerformed(ActionEvent e) + { + } +} diff --git a/src/jalview/math/Matrix.java b/src/jalview/math/Matrix.java index 2f79875..673854a 100755 --- a/src/jalview/math/Matrix.java +++ b/src/jalview/math/Matrix.java @@ -1,851 +1,851 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.math; - -import java.io.*; - -import jalview.util.*; - -/** - * DOCUMENT ME! - * - * @author $author$ - * @version $Revision$ - */ -public class Matrix -{ - /** - * SMJSPUBLIC - */ - public double[][] value; - - /** DOCUMENT ME!! */ - public int rows; - - /** DOCUMENT ME!! */ - public int cols; - - /** DOCUMENT ME!! */ - public double[] d; // Diagonal - - /** DOCUMENT ME!! */ - public double[] e; // off diagonal - - /** - * Creates a new Matrix object. - * - * @param value DOCUMENT ME! - * @param rows DOCUMENT ME! - * @param cols DOCUMENT ME! - */ - public Matrix(double[][] value, int rows, int cols) - { - this.rows = rows; - this.cols = cols; - this.value = value; - } - - /** - * DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public Matrix transpose() - { - double[][] out = new double[cols][rows]; - - for (int i = 0; i < cols; i++) - { - for (int j = 0; j < rows; j++) - { - out[i][j] = value[j][i]; - } - } - - return new Matrix(out, cols, rows); - } - - /** - * DOCUMENT ME! - * - * @param ps DOCUMENT ME! - */ - public void print(PrintStream ps) - { - for (int i = 0; i < rows; i++) - { - for (int j = 0; j < cols; j++) - { - Format.print(ps, "%8.2f", value[i][j]); - } - - ps.println(); - } - } - - /** - * DOCUMENT ME! - * - * @param in DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public Matrix preMultiply(Matrix in) - { - double[][] tmp = new double[in.rows][this.cols]; - - for (int i = 0; i < in.rows; i++) - { - for (int j = 0; j < this.cols; j++) - { - tmp[i][j] = 0.0; - - for (int k = 0; k < in.cols; k++) - { - tmp[i][j] += (in.value[i][k] * this.value[k][j]); - } - } - } - - return new Matrix(tmp, in.rows, this.cols); - } - - /** - * DOCUMENT ME! - * - * @param in DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public double[] vectorPostMultiply(double[] in) - { - double[] out = new double[in.length]; - - for (int i = 0; i < in.length; i++) - { - out[i] = 0.0; - - for (int k = 0; k < in.length; k++) - { - out[i] += (value[i][k] * in[k]); - } - } - - return out; - } - - /** - * DOCUMENT ME! - * - * @param in DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public Matrix postMultiply(Matrix in) - { - double[][] out = new double[this.rows][in.cols]; - - for (int i = 0; i < this.rows; i++) - { - for (int j = 0; j < in.cols; j++) - { - out[i][j] = 0.0; - - for (int k = 0; k < rows; k++) - { - out[i][j] = out[i][j] + (value[i][k] * in.value[k][j]); - } - } - } - - return new Matrix(out, this.cols, in.rows); - } - - /** - * DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public Matrix copy() - { - double[][] newmat = new double[rows][cols]; - - for (int i = 0; i < rows; i++) - { - for (int j = 0; j < cols; j++) - { - newmat[i][j] = value[i][j]; - } - } - - return new Matrix(newmat, rows, cols); - } - - /** - * DOCUMENT ME! - */ - public void tred() - { - int n = rows; - int l; - int k; - int j; - int i; - - double scale; - double hh; - double h; - double g; - double f; - - this.d = new double[rows]; - this.e = new double[rows]; - - for (i = n; i >= 2; i--) - { - l = i - 1; - h = 0.0; - scale = 0.0; - - if (l > 1) - { - for (k = 1; k <= l; k++) - { - scale += Math.abs(value[i - 1][k - 1]); - } - - if (scale == 0.0) - { - e[i - 1] = value[i - 1][l - 1]; - } - else - { - for (k = 1; k <= l; k++) - { - value[i - 1][k - 1] /= scale; - h += (value[i - 1][k - 1] * value[i - 1][k - 1]); - } - - f = value[i - 1][l - 1]; - - if (f > 0) - { - g = -1.0 * Math.sqrt(h); - } - else - { - g = Math.sqrt(h); - } - - e[i - 1] = scale * g; - h -= (f * g); - value[i - 1][l - 1] = f - g; - f = 0.0; - - for (j = 1; j <= l; j++) - { - value[j - 1][i - 1] = value[i - 1][j - 1] / h; - g = 0.0; - - for (k = 1; k <= j; k++) - { - g += (value[j - 1][k - 1] * value[i - 1][k - 1]); - } - - for (k = j + 1; k <= l; k++) - { - g += (value[k - 1][j - 1] * value[i - 1][k - 1]); - } - - e[j - 1] = g / h; - f += (e[j - 1] * value[i - 1][j - 1]); - } - - hh = f / (h + h); - - for (j = 1; j <= l; j++) - { - f = value[i - 1][j - 1]; - g = e[j - 1] - (hh * f); - e[j - 1] = g; - - for (k = 1; k <= j; k++) - { - value[j - 1][k - 1] -= ( (f * e[k - 1]) + - (g * value[i - 1][k - 1])); - } - } - } - } - else - { - e[i - 1] = value[i - 1][l - 1]; - } - - d[i - 1] = h; - } - - d[0] = 0.0; - e[0] = 0.0; - - for (i = 1; i <= n; i++) - { - l = i - 1; - - if (d[i - 1] != 0.0) - { - for (j = 1; j <= l; j++) - { - g = 0.0; - - for (k = 1; k <= l; k++) - { - g += (value[i - 1][k - 1] * value[k - 1][j - 1]); - } - - for (k = 1; k <= l; k++) - { - value[k - 1][j - 1] -= (g * value[k - 1][i - 1]); - } - } - } - - d[i - 1] = value[i - 1][i - 1]; - value[i - 1][i - 1] = 1.0; - - for (j = 1; j <= l; j++) - { - value[j - 1][i - 1] = 0.0; - value[i - 1][j - 1] = 0.0; - } - } - } - - /** - * DOCUMENT ME! - */ - public void tqli() - { - int n = rows; - - int m; - int l; - int iter; - int i; - int k; - double s; - double r; - double p; - ; - - double g; - double f; - double dd; - double c; - double b; - - for (i = 2; i <= n; i++) - { - e[i - 2] = e[i - 1]; - } - - e[n - 1] = 0.0; - - for (l = 1; l <= n; l++) - { - iter = 0; - - do - { - for (m = l; m <= (n - 1); m++) - { - dd = Math.abs(d[m - 1]) + Math.abs(d[m]); - - if ( (Math.abs(e[m - 1]) + dd) == dd) - { - break; - } - } - - if (m != l) - { - iter++; - - if (iter == 30) - { - System.err.print("Too many iterations in tqli"); - System.exit(0); // JBPNote - should this really be here ??? - } - else - { - // System.out.println("Iteration " + iter); - } - - g = (d[l] - d[l - 1]) / (2.0 * e[l - 1]); - r = Math.sqrt( (g * g) + 1.0); - g = d[m - 1] - d[l - 1] + (e[l - 1] / (g + sign(r, g))); - c = 1.0; - s = c; - p = 0.0; - - for (i = m - 1; i >= l; i--) - { - f = s * e[i - 1]; - b = c * e[i - 1]; - - if (Math.abs(f) >= Math.abs(g)) - { - c = g / f; - r = Math.sqrt( (c * c) + 1.0); - e[i] = f * r; - s = 1.0 / r; - c *= s; - } - else - { - s = f / g; - r = Math.sqrt( (s * s) + 1.0); - e[i] = g * r; - c = 1.0 / r; - s *= c; - } - - g = d[i] - p; - r = ( (d[i - 1] - g) * s) + (2.0 * c * b); - p = s * r; - d[i] = g + p; - g = (c * r) - b; - - for (k = 1; k <= n; k++) - { - f = value[k - 1][i]; - value[k - 1][i] = (s * value[k - 1][i - 1]) + - (c * f); - value[k - 1][i - 1] = (c * value[k - 1][i - 1]) - - (s * f); - } - } - - d[l - 1] = d[l - 1] - p; - e[l - 1] = g; - e[m - 1] = 0.0; - } - } - while (m != l); - } - } - - /** - * DOCUMENT ME! - */ - public void tred2() - { - int n = rows; - int l; - int k; - int j; - int i; - - double scale; - double hh; - double h; - double g; - double f; - - this.d = new double[rows]; - this.e = new double[rows]; - - for (i = n - 1; i >= 1; i--) - { - l = i - 1; - h = 0.0; - scale = 0.0; - - if (l > 0) - { - for (k = 0; k < l; k++) - { - scale += Math.abs(value[i][k]); - } - - if (scale == 0.0) - { - e[i] = value[i][l]; - } - else - { - for (k = 0; k < l; k++) - { - value[i][k] /= scale; - h += (value[i][k] * value[i][k]); - } - - f = value[i][l]; - - if (f > 0) - { - g = -1.0 * Math.sqrt(h); - } - else - { - g = Math.sqrt(h); - } - - e[i] = scale * g; - h -= (f * g); - value[i][l] = f - g; - f = 0.0; - - for (j = 0; j < l; j++) - { - value[j][i] = value[i][j] / h; - g = 0.0; - - for (k = 0; k < j; k++) - { - g += (value[j][k] * value[i][k]); - } - - for (k = j; k < l; k++) - { - g += (value[k][j] * value[i][k]); - } - - e[j] = g / h; - f += (e[j] * value[i][j]); - } - - hh = f / (h + h); - - for (j = 0; j < l; j++) - { - f = value[i][j]; - g = e[j] - (hh * f); - e[j] = g; - - for (k = 0; k < j; k++) - { - value[j][k] -= ( (f * e[k]) + (g * value[i][k])); - } - } - } - } - else - { - e[i] = value[i][l]; - } - - d[i] = h; - } - - d[0] = 0.0; - e[0] = 0.0; - - for (i = 0; i < n; i++) - { - l = i - 1; - - if (d[i] != 0.0) - { - for (j = 0; j < l; j++) - { - g = 0.0; - - for (k = 0; k < l; k++) - { - g += (value[i][k] * value[k][j]); - } - - for (k = 0; k < l; k++) - { - value[k][j] -= (g * value[k][i]); - } - } - } - - d[i] = value[i][i]; - value[i][i] = 1.0; - - for (j = 0; j < l; j++) - { - value[j][i] = 0.0; - value[i][j] = 0.0; - } - } - } - - /** - * DOCUMENT ME! - */ - public void tqli2() - { - int n = rows; - - int m; - int l; - int iter; - int i; - int k; - double s; - double r; - double p; - ; - - double g; - double f; - double dd; - double c; - double b; - - for (i = 2; i <= n; i++) - { - e[i - 2] = e[i - 1]; - } - - e[n - 1] = 0.0; - - for (l = 1; l <= n; l++) - { - iter = 0; - - do - { - for (m = l; m <= (n - 1); m++) - { - dd = Math.abs(d[m - 1]) + Math.abs(d[m]); - - if ( (Math.abs(e[m - 1]) + dd) == dd) - { - break; - } - } - - if (m != l) - { - iter++; - - if (iter == 30) - { - System.err.print("Too many iterations in tqli"); - System.exit(0); // JBPNote - same as above - not a graceful exit! - } - else - { - // System.out.println("Iteration " + iter); - } - - g = (d[l] - d[l - 1]) / (2.0 * e[l - 1]); - r = Math.sqrt( (g * g) + 1.0); - g = d[m - 1] - d[l - 1] + (e[l - 1] / (g + sign(r, g))); - c = 1.0; - s = c; - p = 0.0; - - for (i = m - 1; i >= l; i--) - { - f = s * e[i - 1]; - b = c * e[i - 1]; - - if (Math.abs(f) >= Math.abs(g)) - { - c = g / f; - r = Math.sqrt( (c * c) + 1.0); - e[i] = f * r; - s = 1.0 / r; - c *= s; - } - else - { - s = f / g; - r = Math.sqrt( (s * s) + 1.0); - e[i] = g * r; - c = 1.0 / r; - s *= c; - } - - g = d[i] - p; - r = ( (d[i - 1] - g) * s) + (2.0 * c * b); - p = s * r; - d[i] = g + p; - g = (c * r) - b; - - for (k = 1; k <= n; k++) - { - f = value[k - 1][i]; - value[k - 1][i] = (s * value[k - 1][i - 1]) + - (c * f); - value[k - 1][i - 1] = (c * value[k - 1][i - 1]) - - (s * f); - } - } - - d[l - 1] = d[l - 1] - p; - e[l - 1] = g; - e[m - 1] = 0.0; - } - } - while (m != l); - } - } - - /** - * DOCUMENT ME! - * - * @param a DOCUMENT ME! - * @param b DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public double sign(double a, double b) - { - if (b < 0) - { - return -Math.abs(a); - } - else - { - return Math.abs(a); - } - } - - /** - * DOCUMENT ME! - * - * @param n DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public double[] getColumn(int n) - { - double[] out = new double[rows]; - - for (int i = 0; i < rows; i++) - { - out[i] = value[i][n]; - } - - return out; - } - - /** - * DOCUMENT ME! - * - * @param ps DOCUMENT ME! - */ - public void printD(PrintStream ps) - { - for (int j = 0; j < rows; j++) - { - Format.print(ps, "%15.4e", d[j]); - } - } - - /** - * DOCUMENT ME! - * - * @param ps DOCUMENT ME! - */ - public void printE(PrintStream ps) - { - for (int j = 0; j < rows; j++) - { - Format.print(ps, "%15.4e", e[j]); - } - } - - /** - * DOCUMENT ME! - * - * @param args DOCUMENT ME! - */ - public static void main(String[] args) - { - int n = Integer.parseInt(args[0]); - double[][] in = new double[n][n]; - - for (int i = 0; i < n; i++) - { - for (int j = 0; j < n; j++) - { - in[i][j] = (double) Math.random(); - } - } - - Matrix origmat = new Matrix(in, n, n); - - // System.out.println(" --- Original matrix ---- "); - /// origmat.print(System.out); - //System.out.println(); - //System.out.println(" --- transpose matrix ---- "); - Matrix trans = origmat.transpose(); - - //trans.print(System.out); - //System.out.println(); - //System.out.println(" --- OrigT * Orig ---- "); - Matrix symm = trans.postMultiply(origmat); - - //symm.print(System.out); - //System.out.println(); - // Copy the symmetric matrix for later - //Matrix origsymm = symm.copy(); - - // This produces the tridiagonal transformation matrix - //long tstart = System.currentTimeMillis(); - symm.tred(); - - //long tend = System.currentTimeMillis(); - - //System.out.println("Time take for tred = " + (tend-tstart) + "ms"); - //System.out.println(" ---Tridiag transform matrix ---"); - //symm.print(System.out); - //System.out.println(); - //System.out.println(" --- D vector ---"); - //symm.printD(System.out); - //System.out.println(); - //System.out.println(" --- E vector ---"); - //symm.printE(System.out); - //System.out.println(); - // Now produce the diagonalization matrix - //tstart = System.currentTimeMillis(); - symm.tqli(); - //tend = System.currentTimeMillis(); - - //System.out.println("Time take for tqli = " + (tend-tstart) + " ms"); - //System.out.println(" --- New diagonalization matrix ---"); - //symm.print(System.out); - //System.out.println(); - //System.out.println(" --- D vector ---"); - //symm.printD(System.out); - //System.out.println(); - //System.out.println(" --- E vector ---"); - //symm.printE(System.out); - //System.out.println(); - //System.out.println(" --- First eigenvector --- "); - //double[] eigenv = symm.getColumn(0); - //for (int i=0; i < eigenv.length;i++) { - // Format.print(System.out,"%15.4f",eigenv[i]); - // } - //System.out.println(); - //double[] neigenv = origsymm.vectorPostMultiply(eigenv); - //for (int i=0; i < neigenv.length;i++) { - // Format.print(System.out,"%15.4f",neigenv[i]/symm.d[0]); - //} - //System.out.println(); - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.math; + +import java.io.*; + +import jalview.util.*; + +/** + * DOCUMENT ME! + * + * @author $author$ + * @version $Revision$ + */ +public class Matrix +{ + /** + * SMJSPUBLIC + */ + public double[][] value; + + /** DOCUMENT ME!! */ + public int rows; + + /** DOCUMENT ME!! */ + public int cols; + + /** DOCUMENT ME!! */ + public double[] d; // Diagonal + + /** DOCUMENT ME!! */ + public double[] e; // off diagonal + + /** + * Creates a new Matrix object. + * + * @param value DOCUMENT ME! + * @param rows DOCUMENT ME! + * @param cols DOCUMENT ME! + */ + public Matrix(double[][] value, int rows, int cols) + { + this.rows = rows; + this.cols = cols; + this.value = value; + } + + /** + * DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public Matrix transpose() + { + double[][] out = new double[cols][rows]; + + for (int i = 0; i < cols; i++) + { + for (int j = 0; j < rows; j++) + { + out[i][j] = value[j][i]; + } + } + + return new Matrix(out, cols, rows); + } + + /** + * DOCUMENT ME! + * + * @param ps DOCUMENT ME! + */ + public void print(PrintStream ps) + { + for (int i = 0; i < rows; i++) + { + for (int j = 0; j < cols; j++) + { + Format.print(ps, "%8.2f", value[i][j]); + } + + ps.println(); + } + } + + /** + * DOCUMENT ME! + * + * @param in DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public Matrix preMultiply(Matrix in) + { + double[][] tmp = new double[in.rows][this.cols]; + + for (int i = 0; i < in.rows; i++) + { + for (int j = 0; j < this.cols; j++) + { + tmp[i][j] = 0.0; + + for (int k = 0; k < in.cols; k++) + { + tmp[i][j] += (in.value[i][k] * this.value[k][j]); + } + } + } + + return new Matrix(tmp, in.rows, this.cols); + } + + /** + * DOCUMENT ME! + * + * @param in DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public double[] vectorPostMultiply(double[] in) + { + double[] out = new double[in.length]; + + for (int i = 0; i < in.length; i++) + { + out[i] = 0.0; + + for (int k = 0; k < in.length; k++) + { + out[i] += (value[i][k] * in[k]); + } + } + + return out; + } + + /** + * DOCUMENT ME! + * + * @param in DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public Matrix postMultiply(Matrix in) + { + double[][] out = new double[this.rows][in.cols]; + + for (int i = 0; i < this.rows; i++) + { + for (int j = 0; j < in.cols; j++) + { + out[i][j] = 0.0; + + for (int k = 0; k < rows; k++) + { + out[i][j] = out[i][j] + (value[i][k] * in.value[k][j]); + } + } + } + + return new Matrix(out, this.cols, in.rows); + } + + /** + * DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public Matrix copy() + { + double[][] newmat = new double[rows][cols]; + + for (int i = 0; i < rows; i++) + { + for (int j = 0; j < cols; j++) + { + newmat[i][j] = value[i][j]; + } + } + + return new Matrix(newmat, rows, cols); + } + + /** + * DOCUMENT ME! + */ + public void tred() + { + int n = rows; + int l; + int k; + int j; + int i; + + double scale; + double hh; + double h; + double g; + double f; + + this.d = new double[rows]; + this.e = new double[rows]; + + for (i = n; i >= 2; i--) + { + l = i - 1; + h = 0.0; + scale = 0.0; + + if (l > 1) + { + for (k = 1; k <= l; k++) + { + scale += Math.abs(value[i - 1][k - 1]); + } + + if (scale == 0.0) + { + e[i - 1] = value[i - 1][l - 1]; + } + else + { + for (k = 1; k <= l; k++) + { + value[i - 1][k - 1] /= scale; + h += (value[i - 1][k - 1] * value[i - 1][k - 1]); + } + + f = value[i - 1][l - 1]; + + if (f > 0) + { + g = -1.0 * Math.sqrt(h); + } + else + { + g = Math.sqrt(h); + } + + e[i - 1] = scale * g; + h -= (f * g); + value[i - 1][l - 1] = f - g; + f = 0.0; + + for (j = 1; j <= l; j++) + { + value[j - 1][i - 1] = value[i - 1][j - 1] / h; + g = 0.0; + + for (k = 1; k <= j; k++) + { + g += (value[j - 1][k - 1] * value[i - 1][k - 1]); + } + + for (k = j + 1; k <= l; k++) + { + g += (value[k - 1][j - 1] * value[i - 1][k - 1]); + } + + e[j - 1] = g / h; + f += (e[j - 1] * value[i - 1][j - 1]); + } + + hh = f / (h + h); + + for (j = 1; j <= l; j++) + { + f = value[i - 1][j - 1]; + g = e[j - 1] - (hh * f); + e[j - 1] = g; + + for (k = 1; k <= j; k++) + { + value[j - 1][k - 1] -= ( (f * e[k - 1]) + + (g * value[i - 1][k - 1])); + } + } + } + } + else + { + e[i - 1] = value[i - 1][l - 1]; + } + + d[i - 1] = h; + } + + d[0] = 0.0; + e[0] = 0.0; + + for (i = 1; i <= n; i++) + { + l = i - 1; + + if (d[i - 1] != 0.0) + { + for (j = 1; j <= l; j++) + { + g = 0.0; + + for (k = 1; k <= l; k++) + { + g += (value[i - 1][k - 1] * value[k - 1][j - 1]); + } + + for (k = 1; k <= l; k++) + { + value[k - 1][j - 1] -= (g * value[k - 1][i - 1]); + } + } + } + + d[i - 1] = value[i - 1][i - 1]; + value[i - 1][i - 1] = 1.0; + + for (j = 1; j <= l; j++) + { + value[j - 1][i - 1] = 0.0; + value[i - 1][j - 1] = 0.0; + } + } + } + + /** + * DOCUMENT ME! + */ + public void tqli() + { + int n = rows; + + int m; + int l; + int iter; + int i; + int k; + double s; + double r; + double p; + ; + + double g; + double f; + double dd; + double c; + double b; + + for (i = 2; i <= n; i++) + { + e[i - 2] = e[i - 1]; + } + + e[n - 1] = 0.0; + + for (l = 1; l <= n; l++) + { + iter = 0; + + do + { + for (m = l; m <= (n - 1); m++) + { + dd = Math.abs(d[m - 1]) + Math.abs(d[m]); + + if ( (Math.abs(e[m - 1]) + dd) == dd) + { + break; + } + } + + if (m != l) + { + iter++; + + if (iter == 30) + { + System.err.print("Too many iterations in tqli"); + System.exit(0); // JBPNote - should this really be here ??? + } + else + { + // System.out.println("Iteration " + iter); + } + + g = (d[l] - d[l - 1]) / (2.0 * e[l - 1]); + r = Math.sqrt( (g * g) + 1.0); + g = d[m - 1] - d[l - 1] + (e[l - 1] / (g + sign(r, g))); + c = 1.0; + s = c; + p = 0.0; + + for (i = m - 1; i >= l; i--) + { + f = s * e[i - 1]; + b = c * e[i - 1]; + + if (Math.abs(f) >= Math.abs(g)) + { + c = g / f; + r = Math.sqrt( (c * c) + 1.0); + e[i] = f * r; + s = 1.0 / r; + c *= s; + } + else + { + s = f / g; + r = Math.sqrt( (s * s) + 1.0); + e[i] = g * r; + c = 1.0 / r; + s *= c; + } + + g = d[i] - p; + r = ( (d[i - 1] - g) * s) + (2.0 * c * b); + p = s * r; + d[i] = g + p; + g = (c * r) - b; + + for (k = 1; k <= n; k++) + { + f = value[k - 1][i]; + value[k - 1][i] = (s * value[k - 1][i - 1]) + + (c * f); + value[k - 1][i - 1] = (c * value[k - 1][i - 1]) - + (s * f); + } + } + + d[l - 1] = d[l - 1] - p; + e[l - 1] = g; + e[m - 1] = 0.0; + } + } + while (m != l); + } + } + + /** + * DOCUMENT ME! + */ + public void tred2() + { + int n = rows; + int l; + int k; + int j; + int i; + + double scale; + double hh; + double h; + double g; + double f; + + this.d = new double[rows]; + this.e = new double[rows]; + + for (i = n - 1; i >= 1; i--) + { + l = i - 1; + h = 0.0; + scale = 0.0; + + if (l > 0) + { + for (k = 0; k < l; k++) + { + scale += Math.abs(value[i][k]); + } + + if (scale == 0.0) + { + e[i] = value[i][l]; + } + else + { + for (k = 0; k < l; k++) + { + value[i][k] /= scale; + h += (value[i][k] * value[i][k]); + } + + f = value[i][l]; + + if (f > 0) + { + g = -1.0 * Math.sqrt(h); + } + else + { + g = Math.sqrt(h); + } + + e[i] = scale * g; + h -= (f * g); + value[i][l] = f - g; + f = 0.0; + + for (j = 0; j < l; j++) + { + value[j][i] = value[i][j] / h; + g = 0.0; + + for (k = 0; k < j; k++) + { + g += (value[j][k] * value[i][k]); + } + + for (k = j; k < l; k++) + { + g += (value[k][j] * value[i][k]); + } + + e[j] = g / h; + f += (e[j] * value[i][j]); + } + + hh = f / (h + h); + + for (j = 0; j < l; j++) + { + f = value[i][j]; + g = e[j] - (hh * f); + e[j] = g; + + for (k = 0; k < j; k++) + { + value[j][k] -= ( (f * e[k]) + (g * value[i][k])); + } + } + } + } + else + { + e[i] = value[i][l]; + } + + d[i] = h; + } + + d[0] = 0.0; + e[0] = 0.0; + + for (i = 0; i < n; i++) + { + l = i - 1; + + if (d[i] != 0.0) + { + for (j = 0; j < l; j++) + { + g = 0.0; + + for (k = 0; k < l; k++) + { + g += (value[i][k] * value[k][j]); + } + + for (k = 0; k < l; k++) + { + value[k][j] -= (g * value[k][i]); + } + } + } + + d[i] = value[i][i]; + value[i][i] = 1.0; + + for (j = 0; j < l; j++) + { + value[j][i] = 0.0; + value[i][j] = 0.0; + } + } + } + + /** + * DOCUMENT ME! + */ + public void tqli2() + { + int n = rows; + + int m; + int l; + int iter; + int i; + int k; + double s; + double r; + double p; + ; + + double g; + double f; + double dd; + double c; + double b; + + for (i = 2; i <= n; i++) + { + e[i - 2] = e[i - 1]; + } + + e[n - 1] = 0.0; + + for (l = 1; l <= n; l++) + { + iter = 0; + + do + { + for (m = l; m <= (n - 1); m++) + { + dd = Math.abs(d[m - 1]) + Math.abs(d[m]); + + if ( (Math.abs(e[m - 1]) + dd) == dd) + { + break; + } + } + + if (m != l) + { + iter++; + + if (iter == 30) + { + System.err.print("Too many iterations in tqli"); + System.exit(0); // JBPNote - same as above - not a graceful exit! + } + else + { + // System.out.println("Iteration " + iter); + } + + g = (d[l] - d[l - 1]) / (2.0 * e[l - 1]); + r = Math.sqrt( (g * g) + 1.0); + g = d[m - 1] - d[l - 1] + (e[l - 1] / (g + sign(r, g))); + c = 1.0; + s = c; + p = 0.0; + + for (i = m - 1; i >= l; i--) + { + f = s * e[i - 1]; + b = c * e[i - 1]; + + if (Math.abs(f) >= Math.abs(g)) + { + c = g / f; + r = Math.sqrt( (c * c) + 1.0); + e[i] = f * r; + s = 1.0 / r; + c *= s; + } + else + { + s = f / g; + r = Math.sqrt( (s * s) + 1.0); + e[i] = g * r; + c = 1.0 / r; + s *= c; + } + + g = d[i] - p; + r = ( (d[i - 1] - g) * s) + (2.0 * c * b); + p = s * r; + d[i] = g + p; + g = (c * r) - b; + + for (k = 1; k <= n; k++) + { + f = value[k - 1][i]; + value[k - 1][i] = (s * value[k - 1][i - 1]) + + (c * f); + value[k - 1][i - 1] = (c * value[k - 1][i - 1]) - + (s * f); + } + } + + d[l - 1] = d[l - 1] - p; + e[l - 1] = g; + e[m - 1] = 0.0; + } + } + while (m != l); + } + } + + /** + * DOCUMENT ME! + * + * @param a DOCUMENT ME! + * @param b DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public double sign(double a, double b) + { + if (b < 0) + { + return -Math.abs(a); + } + else + { + return Math.abs(a); + } + } + + /** + * DOCUMENT ME! + * + * @param n DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public double[] getColumn(int n) + { + double[] out = new double[rows]; + + for (int i = 0; i < rows; i++) + { + out[i] = value[i][n]; + } + + return out; + } + + /** + * DOCUMENT ME! + * + * @param ps DOCUMENT ME! + */ + public void printD(PrintStream ps) + { + for (int j = 0; j < rows; j++) + { + Format.print(ps, "%15.4e", d[j]); + } + } + + /** + * DOCUMENT ME! + * + * @param ps DOCUMENT ME! + */ + public void printE(PrintStream ps) + { + for (int j = 0; j < rows; j++) + { + Format.print(ps, "%15.4e", e[j]); + } + } + + /** + * DOCUMENT ME! + * + * @param args DOCUMENT ME! + */ + public static void main(String[] args) + { + int n = Integer.parseInt(args[0]); + double[][] in = new double[n][n]; + + for (int i = 0; i < n; i++) + { + for (int j = 0; j < n; j++) + { + in[i][j] = (double) Math.random(); + } + } + + Matrix origmat = new Matrix(in, n, n); + + // System.out.println(" --- Original matrix ---- "); + /// origmat.print(System.out); + //System.out.println(); + //System.out.println(" --- transpose matrix ---- "); + Matrix trans = origmat.transpose(); + + //trans.print(System.out); + //System.out.println(); + //System.out.println(" --- OrigT * Orig ---- "); + Matrix symm = trans.postMultiply(origmat); + + //symm.print(System.out); + //System.out.println(); + // Copy the symmetric matrix for later + //Matrix origsymm = symm.copy(); + + // This produces the tridiagonal transformation matrix + //long tstart = System.currentTimeMillis(); + symm.tred(); + + //long tend = System.currentTimeMillis(); + + //System.out.println("Time take for tred = " + (tend-tstart) + "ms"); + //System.out.println(" ---Tridiag transform matrix ---"); + //symm.print(System.out); + //System.out.println(); + //System.out.println(" --- D vector ---"); + //symm.printD(System.out); + //System.out.println(); + //System.out.println(" --- E vector ---"); + //symm.printE(System.out); + //System.out.println(); + // Now produce the diagonalization matrix + //tstart = System.currentTimeMillis(); + symm.tqli(); + //tend = System.currentTimeMillis(); + + //System.out.println("Time take for tqli = " + (tend-tstart) + " ms"); + //System.out.println(" --- New diagonalization matrix ---"); + //symm.print(System.out); + //System.out.println(); + //System.out.println(" --- D vector ---"); + //symm.printD(System.out); + //System.out.println(); + //System.out.println(" --- E vector ---"); + //symm.printE(System.out); + //System.out.println(); + //System.out.println(" --- First eigenvector --- "); + //double[] eigenv = symm.getColumn(0); + //for (int i=0; i < eigenv.length;i++) { + // Format.print(System.out,"%15.4f",eigenv[i]); + // } + //System.out.println(); + //double[] neigenv = origsymm.vectorPostMultiply(eigenv); + //for (int i=0; i < neigenv.length;i++) { + // Format.print(System.out,"%15.4f",neigenv[i]/symm.d[0]); + //} + //System.out.println(); + } +} diff --git a/src/jalview/math/RotatableMatrix.java b/src/jalview/math/RotatableMatrix.java index eff8dea..e752618 100755 --- a/src/jalview/math/RotatableMatrix.java +++ b/src/jalview/math/RotatableMatrix.java @@ -1,331 +1,331 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.math; - -/** - * DOCUMENT ME! - * - * @author $author$ - * @version $Revision$ - */ -public class RotatableMatrix -{ - float[][] matrix; - float[] temp; - float[][] rot; - - /** - * Creates a new RotatableMatrix object. - * - * @param rows DOCUMENT ME! - * @param cols DOCUMENT ME! - */ - public RotatableMatrix(int rows, int cols) - { - matrix = new float[rows][cols]; - - temp = new float[3]; - - rot = new float[3][3]; - } - - /** - * DOCUMENT ME! - * - * @param i DOCUMENT ME! - * @param j DOCUMENT ME! - * @param value DOCUMENT ME! - */ - public void addElement(int i, int j, float value) - { - matrix[i][j] = value; - } - - /** - * DOCUMENT ME! - */ - public void print() - { - System.out.println(matrix[0][0] + " " + matrix[0][1] + " " + - matrix[0][2]); - - System.out.println(matrix[1][0] + " " + matrix[1][1] + " " + - matrix[1][2]); - - System.out.println(matrix[2][0] + " " + matrix[2][1] + " " + - matrix[2][2]); - } - - /** - * DOCUMENT ME! - * - * @param degrees DOCUMENT ME! - * @param axis DOCUMENT ME! - */ - public void rotate(float degrees, char axis) - { - float costheta = (float) Math.cos( (degrees * Math.PI) / (float) 180.0); - - float sintheta = (float) Math.sin( (degrees * Math.PI) / (float) 180.0); - - if (axis == 'z') - { - rot[0][0] = (float) costheta; - - rot[0][1] = (float) - sintheta; - - rot[0][2] = (float) 0.0; - - rot[1][0] = (float) sintheta; - - rot[1][1] = (float) costheta; - - rot[1][2] = (float) 0.0; - - rot[2][0] = (float) 0.0; - - rot[2][1] = (float) 0.0; - - rot[2][2] = (float) 1.0; - - preMultiply(rot); - } - - if (axis == 'x') - { - rot[0][0] = (float) 1.0; - - rot[0][1] = (float) 0.0; - - rot[0][2] = (float) 0.0; - - rot[1][0] = (float) 0.0; - - rot[1][1] = (float) costheta; - - rot[1][2] = (float) sintheta; - - rot[2][0] = (float) 0.0; - - rot[2][1] = (float) - sintheta; - - rot[2][2] = (float) costheta; - - preMultiply(rot); - } - - if (axis == 'y') - { - rot[0][0] = (float) costheta; - - rot[0][1] = (float) 0.0; - - rot[0][2] = (float) - sintheta; - - rot[1][0] = (float) 0.0; - - rot[1][1] = (float) 1.0; - - rot[1][2] = (float) 0.0; - - rot[2][0] = (float) sintheta; - - rot[2][1] = (float) 0.0; - - rot[2][2] = (float) costheta; - - preMultiply(rot); - } - } - - /** - * DOCUMENT ME! - * - * @param vect DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public float[] vectorMultiply(float[] vect) - { - temp[0] = vect[0]; - - temp[1] = vect[1]; - - temp[2] = vect[2]; - - for (int i = 0; i < 3; i++) - { - temp[i] = (matrix[i][0] * vect[0]) + (matrix[i][1] * vect[1]) + - (matrix[i][2] * vect[2]); - } - - vect[0] = temp[0]; - - vect[1] = temp[1]; - - vect[2] = temp[2]; - - return vect; - } - - /** - * DOCUMENT ME! - * - * @param mat DOCUMENT ME! - */ - public void preMultiply(float[][] mat) - { - float[][] tmp = new float[3][3]; - - for (int i = 0; i < 3; i++) - { - for (int j = 0; j < 3; j++) - { - tmp[i][j] = (mat[i][0] * matrix[0][j]) + - (mat[i][1] * matrix[1][j]) + (mat[i][2] * matrix[2][j]); - } - } - - for (int i = 0; i < 3; i++) - { - for (int j = 0; j < 3; j++) - { - matrix[i][j] = tmp[i][j]; - } - } - } - - /** - * DOCUMENT ME! - * - * @param mat DOCUMENT ME! - */ - public void postMultiply(float[][] mat) - { - float[][] tmp = new float[3][3]; - - for (int i = 0; i < 3; i++) - { - for (int j = 0; j < 3; j++) - { - tmp[i][j] = (matrix[i][0] * mat[0][j]) + - (matrix[i][1] * mat[1][j]) + (matrix[i][2] * mat[2][j]); - } - } - - for (int i = 0; i < 3; i++) - { - for (int j = 0; j < 3; j++) - { - matrix[i][j] = tmp[i][j]; - } - } - } - - /** - * DOCUMENT ME! - * - * @param args DOCUMENT ME! - */ - public static void main(String[] args) - { - RotatableMatrix m = new RotatableMatrix(3, 3); - - m.addElement(0, 0, 1); - - m.addElement(0, 1, 0); - - m.addElement(0, 2, 0); - - m.addElement(1, 0, 0); - - m.addElement(1, 1, 2); - - m.addElement(1, 2, 0); - - m.addElement(2, 0, 0); - - m.addElement(2, 1, 0); - - m.addElement(2, 2, 1); - - m.print(); - - RotatableMatrix n = new RotatableMatrix(3, 3); - - n.addElement(0, 0, 2); - - n.addElement(0, 1, 1); - - n.addElement(0, 2, 1); - - n.addElement(1, 0, 2); - - n.addElement(1, 1, 1); - - n.addElement(1, 2, 1); - - n.addElement(2, 0, 2); - - n.addElement(2, 1, 1); - - n.addElement(2, 2, 1); - - n.print(); - - //m.postMultiply(n.matrix); - //m.print(); - // m.rotate(45,'z',new RotatableMatrix(3,3)); - float[] vect = new float[3]; - - vect[0] = 2; - - vect[1] = 4; - - vect[2] = 6; - - vect = m.vectorMultiply(vect); - - System.out.println(vect[0] + " " + vect[1] + " " + vect[2]); - } - - /** - * DOCUMENT ME! - */ - public void setIdentity() - { - matrix[0][0] = (float) 1.0; - - matrix[1][1] = (float) 1.0; - - matrix[2][2] = (float) 1.0; - - matrix[0][1] = (float) 0.0; - - matrix[0][2] = (float) 0.0; - - matrix[1][0] = (float) 0.0; - - matrix[1][2] = (float) 0.0; - - matrix[2][0] = (float) 0.0; - - matrix[2][1] = (float) 0.0; - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.math; + +/** + * DOCUMENT ME! + * + * @author $author$ + * @version $Revision$ + */ +public class RotatableMatrix +{ + float[][] matrix; + float[] temp; + float[][] rot; + + /** + * Creates a new RotatableMatrix object. + * + * @param rows DOCUMENT ME! + * @param cols DOCUMENT ME! + */ + public RotatableMatrix(int rows, int cols) + { + matrix = new float[rows][cols]; + + temp = new float[3]; + + rot = new float[3][3]; + } + + /** + * DOCUMENT ME! + * + * @param i DOCUMENT ME! + * @param j DOCUMENT ME! + * @param value DOCUMENT ME! + */ + public void addElement(int i, int j, float value) + { + matrix[i][j] = value; + } + + /** + * DOCUMENT ME! + */ + public void print() + { + System.out.println(matrix[0][0] + " " + matrix[0][1] + " " + + matrix[0][2]); + + System.out.println(matrix[1][0] + " " + matrix[1][1] + " " + + matrix[1][2]); + + System.out.println(matrix[2][0] + " " + matrix[2][1] + " " + + matrix[2][2]); + } + + /** + * DOCUMENT ME! + * + * @param degrees DOCUMENT ME! + * @param axis DOCUMENT ME! + */ + public void rotate(float degrees, char axis) + { + float costheta = (float) Math.cos( (degrees * Math.PI) / (float) 180.0); + + float sintheta = (float) Math.sin( (degrees * Math.PI) / (float) 180.0); + + if (axis == 'z') + { + rot[0][0] = (float) costheta; + + rot[0][1] = (float) - sintheta; + + rot[0][2] = (float) 0.0; + + rot[1][0] = (float) sintheta; + + rot[1][1] = (float) costheta; + + rot[1][2] = (float) 0.0; + + rot[2][0] = (float) 0.0; + + rot[2][1] = (float) 0.0; + + rot[2][2] = (float) 1.0; + + preMultiply(rot); + } + + if (axis == 'x') + { + rot[0][0] = (float) 1.0; + + rot[0][1] = (float) 0.0; + + rot[0][2] = (float) 0.0; + + rot[1][0] = (float) 0.0; + + rot[1][1] = (float) costheta; + + rot[1][2] = (float) sintheta; + + rot[2][0] = (float) 0.0; + + rot[2][1] = (float) - sintheta; + + rot[2][2] = (float) costheta; + + preMultiply(rot); + } + + if (axis == 'y') + { + rot[0][0] = (float) costheta; + + rot[0][1] = (float) 0.0; + + rot[0][2] = (float) - sintheta; + + rot[1][0] = (float) 0.0; + + rot[1][1] = (float) 1.0; + + rot[1][2] = (float) 0.0; + + rot[2][0] = (float) sintheta; + + rot[2][1] = (float) 0.0; + + rot[2][2] = (float) costheta; + + preMultiply(rot); + } + } + + /** + * DOCUMENT ME! + * + * @param vect DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public float[] vectorMultiply(float[] vect) + { + temp[0] = vect[0]; + + temp[1] = vect[1]; + + temp[2] = vect[2]; + + for (int i = 0; i < 3; i++) + { + temp[i] = (matrix[i][0] * vect[0]) + (matrix[i][1] * vect[1]) + + (matrix[i][2] * vect[2]); + } + + vect[0] = temp[0]; + + vect[1] = temp[1]; + + vect[2] = temp[2]; + + return vect; + } + + /** + * DOCUMENT ME! + * + * @param mat DOCUMENT ME! + */ + public void preMultiply(float[][] mat) + { + float[][] tmp = new float[3][3]; + + for (int i = 0; i < 3; i++) + { + for (int j = 0; j < 3; j++) + { + tmp[i][j] = (mat[i][0] * matrix[0][j]) + + (mat[i][1] * matrix[1][j]) + (mat[i][2] * matrix[2][j]); + } + } + + for (int i = 0; i < 3; i++) + { + for (int j = 0; j < 3; j++) + { + matrix[i][j] = tmp[i][j]; + } + } + } + + /** + * DOCUMENT ME! + * + * @param mat DOCUMENT ME! + */ + public void postMultiply(float[][] mat) + { + float[][] tmp = new float[3][3]; + + for (int i = 0; i < 3; i++) + { + for (int j = 0; j < 3; j++) + { + tmp[i][j] = (matrix[i][0] * mat[0][j]) + + (matrix[i][1] * mat[1][j]) + (matrix[i][2] * mat[2][j]); + } + } + + for (int i = 0; i < 3; i++) + { + for (int j = 0; j < 3; j++) + { + matrix[i][j] = tmp[i][j]; + } + } + } + + /** + * DOCUMENT ME! + * + * @param args DOCUMENT ME! + */ + public static void main(String[] args) + { + RotatableMatrix m = new RotatableMatrix(3, 3); + + m.addElement(0, 0, 1); + + m.addElement(0, 1, 0); + + m.addElement(0, 2, 0); + + m.addElement(1, 0, 0); + + m.addElement(1, 1, 2); + + m.addElement(1, 2, 0); + + m.addElement(2, 0, 0); + + m.addElement(2, 1, 0); + + m.addElement(2, 2, 1); + + m.print(); + + RotatableMatrix n = new RotatableMatrix(3, 3); + + n.addElement(0, 0, 2); + + n.addElement(0, 1, 1); + + n.addElement(0, 2, 1); + + n.addElement(1, 0, 2); + + n.addElement(1, 1, 1); + + n.addElement(1, 2, 1); + + n.addElement(2, 0, 2); + + n.addElement(2, 1, 1); + + n.addElement(2, 2, 1); + + n.print(); + + //m.postMultiply(n.matrix); + //m.print(); + // m.rotate(45,'z',new RotatableMatrix(3,3)); + float[] vect = new float[3]; + + vect[0] = 2; + + vect[1] = 4; + + vect[2] = 6; + + vect = m.vectorMultiply(vect); + + System.out.println(vect[0] + " " + vect[1] + " " + vect[2]); + } + + /** + * DOCUMENT ME! + */ + public void setIdentity() + { + matrix[0][0] = (float) 1.0; + + matrix[1][1] = (float) 1.0; + + matrix[2][2] = (float) 1.0; + + matrix[0][1] = (float) 0.0; + + matrix[0][2] = (float) 0.0; + + matrix[1][0] = (float) 0.0; + + matrix[1][2] = (float) 0.0; + + matrix[2][0] = (float) 0.0; + + matrix[2][1] = (float) 0.0; + } +} diff --git a/src/jalview/schemabinding/version2/AlcodMap.java b/src/jalview/schemabinding/version2/AlcodMap.java index f43acd6..70f1c8f 100644 --- a/src/jalview/schemabinding/version2/AlcodMap.java +++ b/src/jalview/schemabinding/version2/AlcodMap.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/Alcodon.java b/src/jalview/schemabinding/version2/Alcodon.java index cffbd9a..2e8cf54 100644 --- a/src/jalview/schemabinding/version2/Alcodon.java +++ b/src/jalview/schemabinding/version2/Alcodon.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/AlcodonFrame.java b/src/jalview/schemabinding/version2/AlcodonFrame.java index b8b2a41..c368681 100644 --- a/src/jalview/schemabinding/version2/AlcodonFrame.java +++ b/src/jalview/schemabinding/version2/AlcodonFrame.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/Annotation.java b/src/jalview/schemabinding/version2/Annotation.java index 9ee76e3..8e4d632 100755 --- a/src/jalview/schemabinding/version2/Annotation.java +++ b/src/jalview/schemabinding/version2/Annotation.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/AnnotationColours.java b/src/jalview/schemabinding/version2/AnnotationColours.java index 36f9f93..047817a 100755 --- a/src/jalview/schemabinding/version2/AnnotationColours.java +++ b/src/jalview/schemabinding/version2/AnnotationColours.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/AnnotationElement.java b/src/jalview/schemabinding/version2/AnnotationElement.java index eca3e6a..52a6a44 100755 --- a/src/jalview/schemabinding/version2/AnnotationElement.java +++ b/src/jalview/schemabinding/version2/AnnotationElement.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/Colour.java b/src/jalview/schemabinding/version2/Colour.java index 54d64ff..c14411a 100755 --- a/src/jalview/schemabinding/version2/Colour.java +++ b/src/jalview/schemabinding/version2/Colour.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/DBRef.java b/src/jalview/schemabinding/version2/DBRef.java index 4d67250..3c4146e 100644 --- a/src/jalview/schemabinding/version2/DBRef.java +++ b/src/jalview/schemabinding/version2/DBRef.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/Feature.java b/src/jalview/schemabinding/version2/Feature.java index 109ec6e..bda2674 100755 --- a/src/jalview/schemabinding/version2/Feature.java +++ b/src/jalview/schemabinding/version2/Feature.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/FeatureSettings.java b/src/jalview/schemabinding/version2/FeatureSettings.java index 5ce4054..0f0922e 100755 --- a/src/jalview/schemabinding/version2/FeatureSettings.java +++ b/src/jalview/schemabinding/version2/FeatureSettings.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/Features.java b/src/jalview/schemabinding/version2/Features.java index 47b28a3..b7b5728 100755 --- a/src/jalview/schemabinding/version2/Features.java +++ b/src/jalview/schemabinding/version2/Features.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/Group.java b/src/jalview/schemabinding/version2/Group.java index 826667e..8f4f37f 100644 --- a/src/jalview/schemabinding/version2/Group.java +++ b/src/jalview/schemabinding/version2/Group.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/HiddenColumns.java b/src/jalview/schemabinding/version2/HiddenColumns.java index 716bfbc..5765abd 100644 --- a/src/jalview/schemabinding/version2/HiddenColumns.java +++ b/src/jalview/schemabinding/version2/HiddenColumns.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/JGroup.java b/src/jalview/schemabinding/version2/JGroup.java index ca77ed2..b69f9fc 100755 --- a/src/jalview/schemabinding/version2/JGroup.java +++ b/src/jalview/schemabinding/version2/JGroup.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/JSeq.java b/src/jalview/schemabinding/version2/JSeq.java index a5dc2f7..d07b686 100755 --- a/src/jalview/schemabinding/version2/JSeq.java +++ b/src/jalview/schemabinding/version2/JSeq.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/JalviewModel.java b/src/jalview/schemabinding/version2/JalviewModel.java index f7e049a..c2f8601 100755 --- a/src/jalview/schemabinding/version2/JalviewModel.java +++ b/src/jalview/schemabinding/version2/JalviewModel.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/JalviewModelSequence.java b/src/jalview/schemabinding/version2/JalviewModelSequence.java index cb66b37..85fbf6f 100755 --- a/src/jalview/schemabinding/version2/JalviewModelSequence.java +++ b/src/jalview/schemabinding/version2/JalviewModelSequence.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/JalviewUserColours.java b/src/jalview/schemabinding/version2/JalviewUserColours.java index 7c059da..6daaf33 100755 --- a/src/jalview/schemabinding/version2/JalviewUserColours.java +++ b/src/jalview/schemabinding/version2/JalviewUserColours.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/MapListFrom.java b/src/jalview/schemabinding/version2/MapListFrom.java index acfe18e..cc987e7 100644 --- a/src/jalview/schemabinding/version2/MapListFrom.java +++ b/src/jalview/schemabinding/version2/MapListFrom.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/MapListTo.java b/src/jalview/schemabinding/version2/MapListTo.java index 8c3a7e0..7362b73 100644 --- a/src/jalview/schemabinding/version2/MapListTo.java +++ b/src/jalview/schemabinding/version2/MapListTo.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/MapListType.java b/src/jalview/schemabinding/version2/MapListType.java index 21d56e7..e808a6c 100644 --- a/src/jalview/schemabinding/version2/MapListType.java +++ b/src/jalview/schemabinding/version2/MapListType.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/Mapping.java b/src/jalview/schemabinding/version2/Mapping.java index 8dbc12f..bf89ce6 100644 --- a/src/jalview/schemabinding/version2/Mapping.java +++ b/src/jalview/schemabinding/version2/Mapping.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/MappingChoice.java b/src/jalview/schemabinding/version2/MappingChoice.java index 5f1930d..952234f 100644 --- a/src/jalview/schemabinding/version2/MappingChoice.java +++ b/src/jalview/schemabinding/version2/MappingChoice.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/OtherData.java b/src/jalview/schemabinding/version2/OtherData.java index 94a5566..2a62c88 100644 --- a/src/jalview/schemabinding/version2/OtherData.java +++ b/src/jalview/schemabinding/version2/OtherData.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/Pdbentry.java b/src/jalview/schemabinding/version2/Pdbentry.java index 6ff1819..d06ffb9 100755 --- a/src/jalview/schemabinding/version2/Pdbentry.java +++ b/src/jalview/schemabinding/version2/Pdbentry.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/PdbentryItem.java b/src/jalview/schemabinding/version2/PdbentryItem.java index 3dbc99c..c9881c9 100755 --- a/src/jalview/schemabinding/version2/PdbentryItem.java +++ b/src/jalview/schemabinding/version2/PdbentryItem.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2; /** diff --git a/src/jalview/schemabinding/version2/Pdbids.java b/src/jalview/schemabinding/version2/Pdbids.java index 04685b9..cc32063 100755 --- a/src/jalview/schemabinding/version2/Pdbids.java +++ b/src/jalview/schemabinding/version2/Pdbids.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/Property.java b/src/jalview/schemabinding/version2/Property.java index bfc4dde..3476fb2 100755 --- a/src/jalview/schemabinding/version2/Property.java +++ b/src/jalview/schemabinding/version2/Property.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/Sequence.java b/src/jalview/schemabinding/version2/Sequence.java index e606eeb..5a8fce9 100755 --- a/src/jalview/schemabinding/version2/Sequence.java +++ b/src/jalview/schemabinding/version2/Sequence.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/SequenceSet.java b/src/jalview/schemabinding/version2/SequenceSet.java index 481c37f..890da6d 100755 --- a/src/jalview/schemabinding/version2/SequenceSet.java +++ b/src/jalview/schemabinding/version2/SequenceSet.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/SequenceSetProperties.java b/src/jalview/schemabinding/version2/SequenceSetProperties.java index a078c78..5dc9880 100644 --- a/src/jalview/schemabinding/version2/SequenceSetProperties.java +++ b/src/jalview/schemabinding/version2/SequenceSetProperties.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/SequenceType.java b/src/jalview/schemabinding/version2/SequenceType.java index 0d07812..41a75f7 100755 --- a/src/jalview/schemabinding/version2/SequenceType.java +++ b/src/jalview/schemabinding/version2/SequenceType.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/Setting.java b/src/jalview/schemabinding/version2/Setting.java index 5cd78bd..57c375c 100755 --- a/src/jalview/schemabinding/version2/Setting.java +++ b/src/jalview/schemabinding/version2/Setting.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/StructureState.java b/src/jalview/schemabinding/version2/StructureState.java index 968a559..ce76b38 100644 --- a/src/jalview/schemabinding/version2/StructureState.java +++ b/src/jalview/schemabinding/version2/StructureState.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/ThresholdLine.java b/src/jalview/schemabinding/version2/ThresholdLine.java index 4e3f124..b3c2207 100755 --- a/src/jalview/schemabinding/version2/ThresholdLine.java +++ b/src/jalview/schemabinding/version2/ThresholdLine.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/Tree.java b/src/jalview/schemabinding/version2/Tree.java index 3bbc231..3e844f0 100755 --- a/src/jalview/schemabinding/version2/Tree.java +++ b/src/jalview/schemabinding/version2/Tree.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/UserColourScheme.java b/src/jalview/schemabinding/version2/UserColourScheme.java index 3cb65e0..d1b0045 100755 --- a/src/jalview/schemabinding/version2/UserColourScheme.java +++ b/src/jalview/schemabinding/version2/UserColourScheme.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/UserColours.java b/src/jalview/schemabinding/version2/UserColours.java index 062024f..8304664 100755 --- a/src/jalview/schemabinding/version2/UserColours.java +++ b/src/jalview/schemabinding/version2/UserColours.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/VAMSAS.java b/src/jalview/schemabinding/version2/VAMSAS.java index ae8e17f..0d23a50 100755 --- a/src/jalview/schemabinding/version2/VAMSAS.java +++ b/src/jalview/schemabinding/version2/VAMSAS.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/VamsasModel.java b/src/jalview/schemabinding/version2/VamsasModel.java index 26814dc..bbb13d9 100755 --- a/src/jalview/schemabinding/version2/VamsasModel.java +++ b/src/jalview/schemabinding/version2/VamsasModel.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/Viewport.java b/src/jalview/schemabinding/version2/Viewport.java index aa97a95..84383ff 100755 --- a/src/jalview/schemabinding/version2/Viewport.java +++ b/src/jalview/schemabinding/version2/Viewport.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/AlcodMapDescriptor.java b/src/jalview/schemabinding/version2/descriptors/AlcodMapDescriptor.java index fbc56a3..23e7ce7 100644 --- a/src/jalview/schemabinding/version2/descriptors/AlcodMapDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/AlcodMapDescriptor.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/AlcodonDescriptor.java b/src/jalview/schemabinding/version2/descriptors/AlcodonDescriptor.java index cd87309..f8688f2 100644 --- a/src/jalview/schemabinding/version2/descriptors/AlcodonDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/AlcodonDescriptor.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/AlcodonFrameDescriptor.java b/src/jalview/schemabinding/version2/descriptors/AlcodonFrameDescriptor.java index 5341376..f7941c2 100644 --- a/src/jalview/schemabinding/version2/descriptors/AlcodonFrameDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/AlcodonFrameDescriptor.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/AnnotationColoursDescriptor.java b/src/jalview/schemabinding/version2/descriptors/AnnotationColoursDescriptor.java index 3d32ff6..7751b64 100644 --- a/src/jalview/schemabinding/version2/descriptors/AnnotationColoursDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/AnnotationColoursDescriptor.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/AnnotationDescriptor.java b/src/jalview/schemabinding/version2/descriptors/AnnotationDescriptor.java index 44576ee..b2c9b26 100644 --- a/src/jalview/schemabinding/version2/descriptors/AnnotationDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/AnnotationDescriptor.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/AnnotationElementDescriptor.java b/src/jalview/schemabinding/version2/descriptors/AnnotationElementDescriptor.java index 61221a1..aceaa70 100644 --- a/src/jalview/schemabinding/version2/descriptors/AnnotationElementDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/AnnotationElementDescriptor.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/ColourDescriptor.java b/src/jalview/schemabinding/version2/descriptors/ColourDescriptor.java index bdd9739..ac4c781 100644 --- a/src/jalview/schemabinding/version2/descriptors/ColourDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/ColourDescriptor.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/DBRefDescriptor.java b/src/jalview/schemabinding/version2/descriptors/DBRefDescriptor.java index 1a55978..4d03443 100644 --- a/src/jalview/schemabinding/version2/descriptors/DBRefDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/DBRefDescriptor.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/FeatureDescriptor.java b/src/jalview/schemabinding/version2/descriptors/FeatureDescriptor.java index 92c919e..ae22bf6 100644 --- a/src/jalview/schemabinding/version2/descriptors/FeatureDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/FeatureDescriptor.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/FeatureSettingsDescriptor.java b/src/jalview/schemabinding/version2/descriptors/FeatureSettingsDescriptor.java index 930aac9..fd56535 100644 --- a/src/jalview/schemabinding/version2/descriptors/FeatureSettingsDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/FeatureSettingsDescriptor.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/FeaturesDescriptor.java b/src/jalview/schemabinding/version2/descriptors/FeaturesDescriptor.java index 380d46e..eda2f2d 100644 --- a/src/jalview/schemabinding/version2/descriptors/FeaturesDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/FeaturesDescriptor.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/GroupDescriptor.java b/src/jalview/schemabinding/version2/descriptors/GroupDescriptor.java index 417dbbb..bda2658 100644 --- a/src/jalview/schemabinding/version2/descriptors/GroupDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/GroupDescriptor.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/HiddenColumnsDescriptor.java b/src/jalview/schemabinding/version2/descriptors/HiddenColumnsDescriptor.java index f307ee4..f90651a 100644 --- a/src/jalview/schemabinding/version2/descriptors/HiddenColumnsDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/HiddenColumnsDescriptor.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/JGroupDescriptor.java b/src/jalview/schemabinding/version2/descriptors/JGroupDescriptor.java index 21b3b67..553e571 100644 --- a/src/jalview/schemabinding/version2/descriptors/JGroupDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/JGroupDescriptor.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/JSeqDescriptor.java b/src/jalview/schemabinding/version2/descriptors/JSeqDescriptor.java index 427702d..5c6393c 100644 --- a/src/jalview/schemabinding/version2/descriptors/JSeqDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/JSeqDescriptor.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/JalviewModelDescriptor.java b/src/jalview/schemabinding/version2/descriptors/JalviewModelDescriptor.java index 9aad95c..9825926 100644 --- a/src/jalview/schemabinding/version2/descriptors/JalviewModelDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/JalviewModelDescriptor.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/JalviewModelSequenceDescriptor.java b/src/jalview/schemabinding/version2/descriptors/JalviewModelSequenceDescriptor.java index d6fd0ba..977ce86 100644 --- a/src/jalview/schemabinding/version2/descriptors/JalviewModelSequenceDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/JalviewModelSequenceDescriptor.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/JalviewUserColoursDescriptor.java b/src/jalview/schemabinding/version2/descriptors/JalviewUserColoursDescriptor.java index dd155dd..77247fd 100644 --- a/src/jalview/schemabinding/version2/descriptors/JalviewUserColoursDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/JalviewUserColoursDescriptor.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/MapListFromDescriptor.java b/src/jalview/schemabinding/version2/descriptors/MapListFromDescriptor.java index f39b18f..4660bc3 100644 --- a/src/jalview/schemabinding/version2/descriptors/MapListFromDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/MapListFromDescriptor.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/MapListToDescriptor.java b/src/jalview/schemabinding/version2/descriptors/MapListToDescriptor.java index 4de1738..655fa14 100644 --- a/src/jalview/schemabinding/version2/descriptors/MapListToDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/MapListToDescriptor.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/MapListTypeDescriptor.java b/src/jalview/schemabinding/version2/descriptors/MapListTypeDescriptor.java index 7dc7bc5..6ccd7c0 100644 --- a/src/jalview/schemabinding/version2/descriptors/MapListTypeDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/MapListTypeDescriptor.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/MappingChoiceDescriptor.java b/src/jalview/schemabinding/version2/descriptors/MappingChoiceDescriptor.java index 63543d7..8d0dec6 100644 --- a/src/jalview/schemabinding/version2/descriptors/MappingChoiceDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/MappingChoiceDescriptor.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/MappingDescriptor.java b/src/jalview/schemabinding/version2/descriptors/MappingDescriptor.java index 95e1a87..6d66576 100644 --- a/src/jalview/schemabinding/version2/descriptors/MappingDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/MappingDescriptor.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/OtherDataDescriptor.java b/src/jalview/schemabinding/version2/descriptors/OtherDataDescriptor.java index 46f6682..84040b4 100644 --- a/src/jalview/schemabinding/version2/descriptors/OtherDataDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/OtherDataDescriptor.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/PdbentryDescriptor.java b/src/jalview/schemabinding/version2/descriptors/PdbentryDescriptor.java index dbf0c3a..58108ec 100644 --- a/src/jalview/schemabinding/version2/descriptors/PdbentryDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/PdbentryDescriptor.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/PdbentryItemDescriptor.java b/src/jalview/schemabinding/version2/descriptors/PdbentryItemDescriptor.java index 693ad61..1ffbb1e 100644 --- a/src/jalview/schemabinding/version2/descriptors/PdbentryItemDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/PdbentryItemDescriptor.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/PdbidsDescriptor.java b/src/jalview/schemabinding/version2/descriptors/PdbidsDescriptor.java index 2547f1d..79499fc 100644 --- a/src/jalview/schemabinding/version2/descriptors/PdbidsDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/PdbidsDescriptor.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/PropertyDescriptor.java b/src/jalview/schemabinding/version2/descriptors/PropertyDescriptor.java index 15f2e37..78bbbed 100644 --- a/src/jalview/schemabinding/version2/descriptors/PropertyDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/PropertyDescriptor.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/SequenceDescriptor.java b/src/jalview/schemabinding/version2/descriptors/SequenceDescriptor.java index 4dfd168..5777dd7 100644 --- a/src/jalview/schemabinding/version2/descriptors/SequenceDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/SequenceDescriptor.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/SequenceSetDescriptor.java b/src/jalview/schemabinding/version2/descriptors/SequenceSetDescriptor.java index aa0c798..177c4c4 100644 --- a/src/jalview/schemabinding/version2/descriptors/SequenceSetDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/SequenceSetDescriptor.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/SequenceSetPropertiesDescriptor.java b/src/jalview/schemabinding/version2/descriptors/SequenceSetPropertiesDescriptor.java index 9c3c578..a46e119 100644 --- a/src/jalview/schemabinding/version2/descriptors/SequenceSetPropertiesDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/SequenceSetPropertiesDescriptor.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/SequenceTypeDescriptor.java b/src/jalview/schemabinding/version2/descriptors/SequenceTypeDescriptor.java index fa73621..a7198ad 100644 --- a/src/jalview/schemabinding/version2/descriptors/SequenceTypeDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/SequenceTypeDescriptor.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/SettingDescriptor.java b/src/jalview/schemabinding/version2/descriptors/SettingDescriptor.java index 23783bb..c89f9f5 100644 --- a/src/jalview/schemabinding/version2/descriptors/SettingDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/SettingDescriptor.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/StructureStateDescriptor.java b/src/jalview/schemabinding/version2/descriptors/StructureStateDescriptor.java index 8584429..b23af9f 100644 --- a/src/jalview/schemabinding/version2/descriptors/StructureStateDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/StructureStateDescriptor.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/ThresholdLineDescriptor.java b/src/jalview/schemabinding/version2/descriptors/ThresholdLineDescriptor.java index 951e7ca..98226fa 100644 --- a/src/jalview/schemabinding/version2/descriptors/ThresholdLineDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/ThresholdLineDescriptor.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/TreeDescriptor.java b/src/jalview/schemabinding/version2/descriptors/TreeDescriptor.java index 9d508a4..36d300c 100644 --- a/src/jalview/schemabinding/version2/descriptors/TreeDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/TreeDescriptor.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/UserColourSchemeDescriptor.java b/src/jalview/schemabinding/version2/descriptors/UserColourSchemeDescriptor.java index be7012a..2215d02 100644 --- a/src/jalview/schemabinding/version2/descriptors/UserColourSchemeDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/UserColourSchemeDescriptor.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/UserColoursDescriptor.java b/src/jalview/schemabinding/version2/descriptors/UserColoursDescriptor.java index bda1c5e..f21230b 100644 --- a/src/jalview/schemabinding/version2/descriptors/UserColoursDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/UserColoursDescriptor.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/VAMSASDescriptor.java b/src/jalview/schemabinding/version2/descriptors/VAMSASDescriptor.java index 375f435..8528c16 100644 --- a/src/jalview/schemabinding/version2/descriptors/VAMSASDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/VAMSASDescriptor.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/VamsasModelDescriptor.java b/src/jalview/schemabinding/version2/descriptors/VamsasModelDescriptor.java index bc14cfd..b235ab2 100644 --- a/src/jalview/schemabinding/version2/descriptors/VamsasModelDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/VamsasModelDescriptor.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/ViewportDescriptor.java b/src/jalview/schemabinding/version2/descriptors/ViewportDescriptor.java index 4faa6c1..580f17c 100644 --- a/src/jalview/schemabinding/version2/descriptors/ViewportDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/ViewportDescriptor.java @@ -1,10 +1,21 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemes/AnnotationColourGradient.java b/src/jalview/schemes/AnnotationColourGradient.java index 6a7a3cf..d4baa86 100755 --- a/src/jalview/schemes/AnnotationColourGradient.java +++ b/src/jalview/schemes/AnnotationColourGradient.java @@ -1,230 +1,230 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.schemes; - -import java.awt.*; - -import jalview.datamodel.*; - -public class AnnotationColourGradient - extends ResidueColourScheme -{ - public static int NO_THRESHOLD = -1; - public static int BELOW_THRESHOLD = 0; - public static int ABOVE_THRESHOLD = 1; - - public AlignmentAnnotation annotation; - int aboveAnnotationThreshold = -1; - public boolean thresholdIsMinMax = false; - - GraphLine annotationThreshold; - - float r1, g1, b1, rr, gg, bb, dr, dg, db; - - ColourSchemeI colourScheme; - - public boolean predefinedColours = false; - - /** - * Creates a new AnnotationColourGradient object. - */ - public AnnotationColourGradient(AlignmentAnnotation annotation, - ColourSchemeI originalColour, - int aboveThreshold) - { - if (originalColour instanceof AnnotationColourGradient) - { - colourScheme = ( (AnnotationColourGradient) originalColour).colourScheme; - } - else - { - colourScheme = originalColour; - } - - this.annotation = annotation; - - aboveAnnotationThreshold = aboveThreshold; - - if (aboveThreshold != NO_THRESHOLD && annotation.threshold != null) - { - annotationThreshold = annotation.threshold; - } - } - - /** - * Creates a new AnnotationColourGradient object. - */ - public AnnotationColourGradient(AlignmentAnnotation annotation, - Color minColour, Color maxColour, - int aboveThreshold) - { - this.annotation = annotation; - - aboveAnnotationThreshold = aboveThreshold; - - if (aboveThreshold != NO_THRESHOLD && annotation.threshold != null) - { - annotationThreshold = annotation.threshold; - } - - r1 = minColour.getRed(); - g1 = minColour.getGreen(); - b1 = minColour.getBlue(); - - rr = maxColour.getRed() - r1; - gg = maxColour.getGreen() - g1; - bb = maxColour.getBlue() - b1; - } - - public String getAnnotation() - { - return annotation.label; - } - - public int getAboveThreshold() - { - return aboveAnnotationThreshold; - } - - public float getAnnotationThreshold() - { - if (annotationThreshold == null) - { - return 0; - } - else - { - return annotationThreshold.value; - } - } - - public ColourSchemeI getBaseColour() - { - return colourScheme; - } - - public Color getMinColour() - { - return new Color( (int) r1, (int) g1, (int) b1); - } - - public Color getMaxColour() - { - return new Color( (int) (r1 + rr), (int) (g1 + gg), (int) (b1 + bb)); - } - - /** - * DOCUMENT ME! - * - * @param n DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public Color findColour(char c) - { - return Color.red; - } - - /** - * DOCUMENT ME! - * - * @param n DOCUMENT ME! - * @param j DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public Color findColour(char c, int j) - { - Color currentColour = Color.white; - - if ( (threshold == 0) || aboveThreshold(c, j)) - { - if (j < annotation.annotations.length - && annotation.annotations[j] != null - && !jalview.util.Comparison.isGap(c)) - { - - if (predefinedColours) - { - if(annotation.annotations[j].colour != null) - return annotation.annotations[j].colour; - else - return currentColour; - } - - if (aboveAnnotationThreshold == NO_THRESHOLD - || - (annotationThreshold != null && aboveAnnotationThreshold == ABOVE_THRESHOLD && - annotation.annotations[j].value >= annotationThreshold.value) - || - (annotationThreshold != null && aboveAnnotationThreshold == BELOW_THRESHOLD && - annotation.annotations[j].value <= annotationThreshold.value)) - { - - float range=1f; - if (thresholdIsMinMax - && annotation.threshold != null - && aboveAnnotationThreshold == ABOVE_THRESHOLD - && annotation.annotations[j].value>annotation.threshold.value) - { - range = - (annotation.annotations[j].value - annotation.threshold.value) / - (annotation.graphMax - annotation.threshold.value); - } - else if (thresholdIsMinMax - && annotation.threshold != null - && aboveAnnotationThreshold == BELOW_THRESHOLD - && annotation.annotations[j].value > annotation.graphMin) - { - range = - ( annotation.annotations[j].value - annotation.graphMin ) / - (annotation.threshold.value - annotation.graphMin ); - } - else - { - range = (annotation.annotations[j].value - - annotation.graphMin) / - (annotation.graphMax - annotation.graphMin); - } - - - if (colourScheme != null) - { - currentColour = colourScheme.findColour(c, j); - } - else if (range != 0) - { - dr = rr * range + r1; - dg = gg * range + g1; - db = bb * range + b1; - - currentColour = new Color( (int) dr, (int) dg, (int) db); - } - } - } - } - - if (conservationColouring) - { - currentColour = applyConservation(currentColour, j); - } - - return currentColour; - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.schemes; + +import java.awt.*; + +import jalview.datamodel.*; + +public class AnnotationColourGradient + extends ResidueColourScheme +{ + public static int NO_THRESHOLD = -1; + public static int BELOW_THRESHOLD = 0; + public static int ABOVE_THRESHOLD = 1; + + public AlignmentAnnotation annotation; + int aboveAnnotationThreshold = -1; + public boolean thresholdIsMinMax = false; + + GraphLine annotationThreshold; + + float r1, g1, b1, rr, gg, bb, dr, dg, db; + + ColourSchemeI colourScheme; + + public boolean predefinedColours = false; + + /** + * Creates a new AnnotationColourGradient object. + */ + public AnnotationColourGradient(AlignmentAnnotation annotation, + ColourSchemeI originalColour, + int aboveThreshold) + { + if (originalColour instanceof AnnotationColourGradient) + { + colourScheme = ( (AnnotationColourGradient) originalColour).colourScheme; + } + else + { + colourScheme = originalColour; + } + + this.annotation = annotation; + + aboveAnnotationThreshold = aboveThreshold; + + if (aboveThreshold != NO_THRESHOLD && annotation.threshold != null) + { + annotationThreshold = annotation.threshold; + } + } + + /** + * Creates a new AnnotationColourGradient object. + */ + public AnnotationColourGradient(AlignmentAnnotation annotation, + Color minColour, Color maxColour, + int aboveThreshold) + { + this.annotation = annotation; + + aboveAnnotationThreshold = aboveThreshold; + + if (aboveThreshold != NO_THRESHOLD && annotation.threshold != null) + { + annotationThreshold = annotation.threshold; + } + + r1 = minColour.getRed(); + g1 = minColour.getGreen(); + b1 = minColour.getBlue(); + + rr = maxColour.getRed() - r1; + gg = maxColour.getGreen() - g1; + bb = maxColour.getBlue() - b1; + } + + public String getAnnotation() + { + return annotation.label; + } + + public int getAboveThreshold() + { + return aboveAnnotationThreshold; + } + + public float getAnnotationThreshold() + { + if (annotationThreshold == null) + { + return 0; + } + else + { + return annotationThreshold.value; + } + } + + public ColourSchemeI getBaseColour() + { + return colourScheme; + } + + public Color getMinColour() + { + return new Color( (int) r1, (int) g1, (int) b1); + } + + public Color getMaxColour() + { + return new Color( (int) (r1 + rr), (int) (g1 + gg), (int) (b1 + bb)); + } + + /** + * DOCUMENT ME! + * + * @param n DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public Color findColour(char c) + { + return Color.red; + } + + /** + * DOCUMENT ME! + * + * @param n DOCUMENT ME! + * @param j DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public Color findColour(char c, int j) + { + Color currentColour = Color.white; + + if ( (threshold == 0) || aboveThreshold(c, j)) + { + if (j < annotation.annotations.length + && annotation.annotations[j] != null + && !jalview.util.Comparison.isGap(c)) + { + + if (predefinedColours) + { + if(annotation.annotations[j].colour != null) + return annotation.annotations[j].colour; + else + return currentColour; + } + + if (aboveAnnotationThreshold == NO_THRESHOLD + || + (annotationThreshold != null && aboveAnnotationThreshold == ABOVE_THRESHOLD && + annotation.annotations[j].value >= annotationThreshold.value) + || + (annotationThreshold != null && aboveAnnotationThreshold == BELOW_THRESHOLD && + annotation.annotations[j].value <= annotationThreshold.value)) + { + + float range=1f; + if (thresholdIsMinMax + && annotation.threshold != null + && aboveAnnotationThreshold == ABOVE_THRESHOLD + && annotation.annotations[j].value>annotation.threshold.value) + { + range = + (annotation.annotations[j].value - annotation.threshold.value) / + (annotation.graphMax - annotation.threshold.value); + } + else if (thresholdIsMinMax + && annotation.threshold != null + && aboveAnnotationThreshold == BELOW_THRESHOLD + && annotation.annotations[j].value > annotation.graphMin) + { + range = + ( annotation.annotations[j].value - annotation.graphMin ) / + (annotation.threshold.value - annotation.graphMin ); + } + else + { + range = (annotation.annotations[j].value - + annotation.graphMin) / + (annotation.graphMax - annotation.graphMin); + } + + + if (colourScheme != null) + { + currentColour = colourScheme.findColour(c, j); + } + else if (range != 0) + { + dr = rr * range + r1; + dg = gg * range + g1; + db = bb * range + b1; + + currentColour = new Color( (int) dr, (int) dg, (int) db); + } + } + } + } + + if (conservationColouring) + { + currentColour = applyConservation(currentColour, j); + } + + return currentColour; + } +} diff --git a/src/jalview/schemes/Blosum62ColourScheme.java b/src/jalview/schemes/Blosum62ColourScheme.java index 0db55c0..afca132 100755 --- a/src/jalview/schemes/Blosum62ColourScheme.java +++ b/src/jalview/schemes/Blosum62ColourScheme.java @@ -1,94 +1,94 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.schemes; - -import java.awt.*; - -import jalview.analysis.*; - -public class Blosum62ColourScheme - extends ResidueColourScheme -{ - public Blosum62ColourScheme() - { - super(); - } - - public Color findColour(char res, int j) - { - if ('a' <= res && res <= 'z') - { - // TO UPPERCASE !!! - res -= ('a' - 'A'); - } - - if (consensus == null || - j >= consensus.length || - consensus[j] == null || - (threshold != 0 && !aboveThreshold(res, j))) - { - return Color.white; - } - - Color currentColour; - - if (!jalview.util.Comparison.isGap(res)) - { - String max = (String) consensus[j].get(AAFrequency.MAXRESIDUE); - - if (max.indexOf(res) > -1) - { - currentColour = new Color(154, 154, 255); - } - else - { - int c = 0; - int max_aa = 0; - int n = max.length(); - - do - { - c += ResidueProperties.getBLOSUM62( - max.charAt(max_aa), res); - } - while (++max_aa < n); - - if (c > 0) - { - currentColour = new Color(204, 204, 255); - } - else - { - currentColour = Color.white; - } - } - - if (conservationColouring) - { - currentColour = applyConservation(currentColour, j); - } - } - else - { - return Color.white; - } - - return currentColour; - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.schemes; + +import java.awt.*; + +import jalview.analysis.*; + +public class Blosum62ColourScheme + extends ResidueColourScheme +{ + public Blosum62ColourScheme() + { + super(); + } + + public Color findColour(char res, int j) + { + if ('a' <= res && res <= 'z') + { + // TO UPPERCASE !!! + res -= ('a' - 'A'); + } + + if (consensus == null || + j >= consensus.length || + consensus[j] == null || + (threshold != 0 && !aboveThreshold(res, j))) + { + return Color.white; + } + + Color currentColour; + + if (!jalview.util.Comparison.isGap(res)) + { + String max = (String) consensus[j].get(AAFrequency.MAXRESIDUE); + + if (max.indexOf(res) > -1) + { + currentColour = new Color(154, 154, 255); + } + else + { + int c = 0; + int max_aa = 0; + int n = max.length(); + + do + { + c += ResidueProperties.getBLOSUM62( + max.charAt(max_aa), res); + } + while (++max_aa < n); + + if (c > 0) + { + currentColour = new Color(204, 204, 255); + } + else + { + currentColour = Color.white; + } + } + + if (conservationColouring) + { + currentColour = applyConservation(currentColour, j); + } + } + else + { + return Color.white; + } + + return currentColour; + } +} diff --git a/src/jalview/schemes/BuriedColourScheme.java b/src/jalview/schemes/BuriedColourScheme.java index c973035..a1b3ba4 100755 --- a/src/jalview/schemes/BuriedColourScheme.java +++ b/src/jalview/schemes/BuriedColourScheme.java @@ -1,52 +1,52 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.schemes; - -import java.awt.*; - -/** - * DOCUMENT ME! - * - * @author $author$ - * @version $Revision$ - */ -public class BuriedColourScheme - extends ScoreColourScheme -{ - /** - * Creates a new BuriedColourScheme object. - */ - public BuriedColourScheme() - { - super(ResidueProperties.buried, ResidueProperties.buriedmin, - ResidueProperties.buriedmax); - } - - /** - * DOCUMENT ME! - * - * @param c DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public Color makeColour(float c) - { - return new Color(0, (float) (1.0 - c), c); - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.schemes; + +import java.awt.*; + +/** + * DOCUMENT ME! + * + * @author $author$ + * @version $Revision$ + */ +public class BuriedColourScheme + extends ScoreColourScheme +{ + /** + * Creates a new BuriedColourScheme object. + */ + public BuriedColourScheme() + { + super(ResidueProperties.buried, ResidueProperties.buriedmin, + ResidueProperties.buriedmax); + } + + /** + * DOCUMENT ME! + * + * @param c DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public Color makeColour(float c) + { + return new Color(0, (float) (1.0 - c), c); + } +} diff --git a/src/jalview/schemes/ClustalxColourScheme.java b/src/jalview/schemes/ClustalxColourScheme.java index bc2f9ea..5e7ebb8 100755 --- a/src/jalview/schemes/ClustalxColourScheme.java +++ b/src/jalview/schemes/ClustalxColourScheme.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/schemes/ColourSchemeI.java b/src/jalview/schemes/ColourSchemeI.java index 96699c6..8deb556 100755 --- a/src/jalview/schemes/ColourSchemeI.java +++ b/src/jalview/schemes/ColourSchemeI.java @@ -1,43 +1,43 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.schemes; - -import java.awt.*; - -public interface ColourSchemeI -{ - public Color findColour(char c); - - public Color findColour(char c, int j); - - public void setConsensus(java.util.Hashtable[] h); - - public void setConservation(jalview.analysis.Conservation c); - - public boolean conservationApplied(); - - public void setConservationInc(int i); - - public int getConservationInc(); - - public int getThreshold(); - - public void setThreshold(int ct, boolean ignoreGaps); - -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.schemes; + +import java.awt.*; + +public interface ColourSchemeI +{ + public Color findColour(char c); + + public Color findColour(char c, int j); + + public void setConsensus(java.util.Hashtable[] h); + + public void setConservation(jalview.analysis.Conservation c); + + public boolean conservationApplied(); + + public void setConservationInc(int i); + + public int getConservationInc(); + + public int getThreshold(); + + public void setThreshold(int ct, boolean ignoreGaps); + +} diff --git a/src/jalview/schemes/ColourSchemeProperty.java b/src/jalview/schemes/ColourSchemeProperty.java index 2f81d13..9acadda 100755 --- a/src/jalview/schemes/ColourSchemeProperty.java +++ b/src/jalview/schemes/ColourSchemeProperty.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/schemes/Consensus.java b/src/jalview/schemes/Consensus.java index 5cd7b52..5d34eff 100755 --- a/src/jalview/schemes/Consensus.java +++ b/src/jalview/schemes/Consensus.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/schemes/HelixColourScheme.java b/src/jalview/schemes/HelixColourScheme.java index 7894965..c6ecd28 100755 --- a/src/jalview/schemes/HelixColourScheme.java +++ b/src/jalview/schemes/HelixColourScheme.java @@ -1,36 +1,36 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.schemes; - -import java.awt.*; - -public class HelixColourScheme - extends ScoreColourScheme -{ - public HelixColourScheme() - { - super(ResidueProperties.helix, ResidueProperties.helixmin, - ResidueProperties.helixmax); - } - - public Color makeColour(float c) - { - return new Color(c, (float) 1.0 - c, c); - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.schemes; + +import java.awt.*; + +public class HelixColourScheme + extends ScoreColourScheme +{ + public HelixColourScheme() + { + super(ResidueProperties.helix, ResidueProperties.helixmin, + ResidueProperties.helixmax); + } + + public Color makeColour(float c) + { + return new Color(c, (float) 1.0 - c, c); + } +} diff --git a/src/jalview/schemes/HydrophobicColourScheme.java b/src/jalview/schemes/HydrophobicColourScheme.java index 9af174d..548b176 100755 --- a/src/jalview/schemes/HydrophobicColourScheme.java +++ b/src/jalview/schemes/HydrophobicColourScheme.java @@ -1,52 +1,52 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.schemes; - -import java.awt.*; - -/** - * DOCUMENT ME! - * - * @author $author$ - * @version $Revision$ - */ -public class HydrophobicColourScheme - extends ScoreColourScheme -{ - /** - * Creates a new HydrophobicColourScheme object. - */ - public HydrophobicColourScheme() - { - super(ResidueProperties.hyd, ResidueProperties.hydmin, - ResidueProperties.hydmax); - } - - /** - * DOCUMENT ME! - * - * @param c DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public Color makeColour(float c) - { - return new Color(c, (float) 0.0, (float) 1.0 - c); - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.schemes; + +import java.awt.*; + +/** + * DOCUMENT ME! + * + * @author $author$ + * @version $Revision$ + */ +public class HydrophobicColourScheme + extends ScoreColourScheme +{ + /** + * Creates a new HydrophobicColourScheme object. + */ + public HydrophobicColourScheme() + { + super(ResidueProperties.hyd, ResidueProperties.hydmin, + ResidueProperties.hydmax); + } + + /** + * DOCUMENT ME! + * + * @param c DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public Color makeColour(float c) + { + return new Color(c, (float) 0.0, (float) 1.0 - c); + } +} diff --git a/src/jalview/schemes/NucleotideColourScheme.java b/src/jalview/schemes/NucleotideColourScheme.java index 4e14202..d83d913 100755 --- a/src/jalview/schemes/NucleotideColourScheme.java +++ b/src/jalview/schemes/NucleotideColourScheme.java @@ -1,87 +1,87 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.schemes; - -import java.awt.*; - -/** - * DOCUMENT ME! - * - * @author $author$ - * @version $Revision$ - */ -public class NucleotideColourScheme - extends ResidueColourScheme -{ - /** - * Creates a new NucleotideColourScheme object. - */ - public NucleotideColourScheme() - { - super(ResidueProperties.nucleotide, 0); - } - - /** - * DOCUMENT ME! - * - * @param n DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public Color findColour(char c) - { - // System.out.println("called"); log.debug - return colors[ResidueProperties.nucleotideIndex[c]]; - } - - /** - * DOCUMENT ME! - * - * @param n DOCUMENT ME! - * @param j DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public Color findColour(char c, int j) - { - Color currentColour; - if ( (threshold == 0) || aboveThreshold(c, j)) - { - try - { - currentColour = colors[ResidueProperties.nucleotideIndex[c]]; - } - catch (Exception ex) - { - return Color.white; - } - } - else - { - return Color.white; - } - - if (conservationColouring) - { - currentColour = applyConservation(currentColour, j); - } - - return currentColour; - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.schemes; + +import java.awt.*; + +/** + * DOCUMENT ME! + * + * @author $author$ + * @version $Revision$ + */ +public class NucleotideColourScheme + extends ResidueColourScheme +{ + /** + * Creates a new NucleotideColourScheme object. + */ + public NucleotideColourScheme() + { + super(ResidueProperties.nucleotide, 0); + } + + /** + * DOCUMENT ME! + * + * @param n DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public Color findColour(char c) + { + // System.out.println("called"); log.debug + return colors[ResidueProperties.nucleotideIndex[c]]; + } + + /** + * DOCUMENT ME! + * + * @param n DOCUMENT ME! + * @param j DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public Color findColour(char c, int j) + { + Color currentColour; + if ( (threshold == 0) || aboveThreshold(c, j)) + { + try + { + currentColour = colors[ResidueProperties.nucleotideIndex[c]]; + } + catch (Exception ex) + { + return Color.white; + } + } + else + { + return Color.white; + } + + if (conservationColouring) + { + currentColour = applyConservation(currentColour, j); + } + + return currentColour; + } +} diff --git a/src/jalview/schemes/PIDColourScheme.java b/src/jalview/schemes/PIDColourScheme.java index e1dbf46..0ab66e6 100755 --- a/src/jalview/schemes/PIDColourScheme.java +++ b/src/jalview/schemes/PIDColourScheme.java @@ -1,94 +1,94 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.schemes; - -import java.awt.*; - -import jalview.analysis.*; -import jalview.datamodel.*; - -public class PIDColourScheme - extends ResidueColourScheme -{ - public Color[] pidColours; - public float[] thresholds; - SequenceGroup group; - - public PIDColourScheme() - { - this.pidColours = ResidueProperties.pidColours; - this.thresholds = ResidueProperties.pidThresholds; - } - - public Color findColour(char c, int j) - { - if ('a' <= c && c <= 'z') - { - c -= ('a' - 'A'); - } - - if (consensus == null - || j >= consensus.length - || consensus[j] == null) - { - return Color.white; - } - - if ( (threshold != 0) && !aboveThreshold(c, j)) - { - return Color.white; - } - - Color currentColour = Color.white; - - double sc = 0; - - if (consensus.length <= j) - { - return Color.white; - } - - if ( (Integer.parseInt(consensus[j].get(AAFrequency.MAXCOUNT).toString()) != - -1) && - consensus[j].contains(String.valueOf(c))) - { - sc = ( (Float) consensus[j].get(ignoreGaps)).floatValue(); - - if (!jalview.util.Comparison.isGap(c)) - { - for (int i = 0; i < thresholds.length; i++) - { - if (sc > thresholds[i]) - { - currentColour = pidColours[i]; - - break; - } - } - } - } - - if (conservationColouring) - { - currentColour = applyConservation(currentColour, j); - } - - return currentColour; - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.schemes; + +import java.awt.*; + +import jalview.analysis.*; +import jalview.datamodel.*; + +public class PIDColourScheme + extends ResidueColourScheme +{ + public Color[] pidColours; + public float[] thresholds; + SequenceGroup group; + + public PIDColourScheme() + { + this.pidColours = ResidueProperties.pidColours; + this.thresholds = ResidueProperties.pidThresholds; + } + + public Color findColour(char c, int j) + { + if ('a' <= c && c <= 'z') + { + c -= ('a' - 'A'); + } + + if (consensus == null + || j >= consensus.length + || consensus[j] == null) + { + return Color.white; + } + + if ( (threshold != 0) && !aboveThreshold(c, j)) + { + return Color.white; + } + + Color currentColour = Color.white; + + double sc = 0; + + if (consensus.length <= j) + { + return Color.white; + } + + if ( (Integer.parseInt(consensus[j].get(AAFrequency.MAXCOUNT).toString()) != + -1) && + consensus[j].contains(String.valueOf(c))) + { + sc = ( (Float) consensus[j].get(ignoreGaps)).floatValue(); + + if (!jalview.util.Comparison.isGap(c)) + { + for (int i = 0; i < thresholds.length; i++) + { + if (sc > thresholds[i]) + { + currentColour = pidColours[i]; + + break; + } + } + } + } + + if (conservationColouring) + { + currentColour = applyConservation(currentColour, j); + } + + return currentColour; + } +} diff --git a/src/jalview/schemes/ResidueColourScheme.java b/src/jalview/schemes/ResidueColourScheme.java index f43aa02..417e31c 100755 --- a/src/jalview/schemes/ResidueColourScheme.java +++ b/src/jalview/schemes/ResidueColourScheme.java @@ -1,271 +1,271 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.schemes; - -import java.util.*; - -import java.awt.*; - -import jalview.analysis.*; - -/** - * DOCUMENT ME! - * - * @author $author$ - * @version $Revision$ - */ -public class ResidueColourScheme - implements ColourSchemeI -{ - - boolean conservationColouring = false; - - Color[] colors; - int threshold = 0; - - /* Set when threshold colouring to either pid_gaps or pid_nogaps*/ - protected String ignoreGaps = AAFrequency.PID_GAPS; - - /** Consenus as a hashtable array */ - Hashtable[] consensus; - - /** Conservation string as a char array */ - char[] conservation; - int conservationLength=0; - - /** DOCUMENT ME!! */ - int inc = 30; - - /** - * Creates a new ResidueColourScheme object. - * - * @param colors DOCUMENT ME! - * @param threshold DOCUMENT ME! - */ - public ResidueColourScheme(Color[] colours, int threshold) - { - this.colors = colours; - this.threshold = threshold; - } - - /** - * Creates a new ResidueColourScheme object. - */ - public ResidueColourScheme() - { - } - - /** - * Find a colour without an index in a sequence - */ - public Color findColour(char c) - { - return colors[ResidueProperties.aaIndex[c]]; - } - - public Color findColour(char c, int j) - { - Color currentColour; - - if ( (threshold == 0) || aboveThreshold(c, j)) - { - currentColour = colors[ResidueProperties.aaIndex[c]]; - } - else - { - currentColour = Color.white; - } - - if (conservationColouring) - { - currentColour = applyConservation(currentColour, j); - } - - return currentColour; - } - - /** - * Get the percentage threshold for this colour scheme - * - * @return Returns the percentage threshold - */ - public int getThreshold() - { - return threshold; - } - - /** - * DOCUMENT ME! - * - * @param ct DOCUMENT ME! - */ - public void setThreshold(int ct, boolean ignoreGaps) - { - threshold = ct; - if (ignoreGaps) - { - this.ignoreGaps = AAFrequency.PID_NOGAPS; - } - else - { - this.ignoreGaps = AAFrequency.PID_GAPS; - } - } - - /** - * DOCUMENT ME! - * - * @param s DOCUMENT ME! - * @param j DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public boolean aboveThreshold(char c, int j) - { - if ('a' <= c && c <= 'z') - { - // TO UPPERCASE !!! - //Faster than toUpperCase - c -= ('a' - 'A'); - } - - if (consensus == null || consensus.length= threshold) - { - return true; - } - } - - return false; - } - - public boolean conservationApplied() - { - return conservationColouring; - } - - public void setConservationInc(int i) - { - inc = i; - } - - public int getConservationInc() - { - return inc; - } - - /** - * DOCUMENT ME! - * - * @param consensus DOCUMENT ME! - */ - public void setConsensus(Hashtable[] consensus) - { - if (consensus == null) - { - return; - } - - this.consensus = consensus; - } - - public void setConservation(Conservation cons) - { - if (cons == null) - { - conservationColouring = false; - conservation = null; - } - else - { - conservationColouring = true; - int i, iSize = cons.getConsSequence().getLength(); - conservation = new char[iSize]; - for (i = 0; i < iSize; i++) - { - conservation[i] = cons.getConsSequence().getCharAt(i); - } - conservationLength = conservation.length; - } - - } - - /** - * DOCUMENT ME! - * - * @param s DOCUMENT ME! - * @param i DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - - Color applyConservation(Color currentColour, int i) - { - - if ((conservationLength>i) && (conservation[i] != '*') && (conservation[i] != '+')) - { - if ( jalview.util.Comparison.isGap(conservation[i])) - { - currentColour = Color.white; - } - else - { - float t = 11 - (conservation[i] - '0'); - if (t == 0) - { - return Color.white; - } - - int red = currentColour.getRed(); - int green = currentColour.getGreen(); - int blue = currentColour.getBlue(); - - int dr = 255 - red; - int dg = 255 - green; - int db = 255 - blue; - - dr *= t / 10f; - dg *= t / 10f; - db *= t / 10f; - - red += (inc / 20f) * dr; - green += (inc / 20f) * dg; - blue += (inc / 20f) * db; - - if (red > 255 || green > 255 || blue > 255) - { - currentColour = Color.white; - } - else - { - currentColour = new Color(red, green, blue); - } - } - } - return currentColour; - } - -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.schemes; + +import java.util.*; + +import java.awt.*; + +import jalview.analysis.*; + +/** + * DOCUMENT ME! + * + * @author $author$ + * @version $Revision$ + */ +public class ResidueColourScheme + implements ColourSchemeI +{ + + boolean conservationColouring = false; + + Color[] colors; + int threshold = 0; + + /* Set when threshold colouring to either pid_gaps or pid_nogaps*/ + protected String ignoreGaps = AAFrequency.PID_GAPS; + + /** Consenus as a hashtable array */ + Hashtable[] consensus; + + /** Conservation string as a char array */ + char[] conservation; + int conservationLength=0; + + /** DOCUMENT ME!! */ + int inc = 30; + + /** + * Creates a new ResidueColourScheme object. + * + * @param colors DOCUMENT ME! + * @param threshold DOCUMENT ME! + */ + public ResidueColourScheme(Color[] colours, int threshold) + { + this.colors = colours; + this.threshold = threshold; + } + + /** + * Creates a new ResidueColourScheme object. + */ + public ResidueColourScheme() + { + } + + /** + * Find a colour without an index in a sequence + */ + public Color findColour(char c) + { + return colors[ResidueProperties.aaIndex[c]]; + } + + public Color findColour(char c, int j) + { + Color currentColour; + + if ( (threshold == 0) || aboveThreshold(c, j)) + { + currentColour = colors[ResidueProperties.aaIndex[c]]; + } + else + { + currentColour = Color.white; + } + + if (conservationColouring) + { + currentColour = applyConservation(currentColour, j); + } + + return currentColour; + } + + /** + * Get the percentage threshold for this colour scheme + * + * @return Returns the percentage threshold + */ + public int getThreshold() + { + return threshold; + } + + /** + * DOCUMENT ME! + * + * @param ct DOCUMENT ME! + */ + public void setThreshold(int ct, boolean ignoreGaps) + { + threshold = ct; + if (ignoreGaps) + { + this.ignoreGaps = AAFrequency.PID_NOGAPS; + } + else + { + this.ignoreGaps = AAFrequency.PID_GAPS; + } + } + + /** + * DOCUMENT ME! + * + * @param s DOCUMENT ME! + * @param j DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public boolean aboveThreshold(char c, int j) + { + if ('a' <= c && c <= 'z') + { + // TO UPPERCASE !!! + //Faster than toUpperCase + c -= ('a' - 'A'); + } + + if (consensus == null || consensus.length= threshold) + { + return true; + } + } + + return false; + } + + public boolean conservationApplied() + { + return conservationColouring; + } + + public void setConservationInc(int i) + { + inc = i; + } + + public int getConservationInc() + { + return inc; + } + + /** + * DOCUMENT ME! + * + * @param consensus DOCUMENT ME! + */ + public void setConsensus(Hashtable[] consensus) + { + if (consensus == null) + { + return; + } + + this.consensus = consensus; + } + + public void setConservation(Conservation cons) + { + if (cons == null) + { + conservationColouring = false; + conservation = null; + } + else + { + conservationColouring = true; + int i, iSize = cons.getConsSequence().getLength(); + conservation = new char[iSize]; + for (i = 0; i < iSize; i++) + { + conservation[i] = cons.getConsSequence().getCharAt(i); + } + conservationLength = conservation.length; + } + + } + + /** + * DOCUMENT ME! + * + * @param s DOCUMENT ME! + * @param i DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + + Color applyConservation(Color currentColour, int i) + { + + if ((conservationLength>i) && (conservation[i] != '*') && (conservation[i] != '+')) + { + if ( jalview.util.Comparison.isGap(conservation[i])) + { + currentColour = Color.white; + } + else + { + float t = 11 - (conservation[i] - '0'); + if (t == 0) + { + return Color.white; + } + + int red = currentColour.getRed(); + int green = currentColour.getGreen(); + int blue = currentColour.getBlue(); + + int dr = 255 - red; + int dg = 255 - green; + int db = 255 - blue; + + dr *= t / 10f; + dg *= t / 10f; + db *= t / 10f; + + red += (inc / 20f) * dr; + green += (inc / 20f) * dg; + blue += (inc / 20f) * db; + + if (red > 255 || green > 255 || blue > 255) + { + currentColour = Color.white; + } + else + { + currentColour = new Color(red, green, blue); + } + } + } + return currentColour; + } + +} diff --git a/src/jalview/schemes/ResidueProperties.java b/src/jalview/schemes/ResidueProperties.java index 98868d2..421e1cd 100755 --- a/src/jalview/schemes/ResidueProperties.java +++ b/src/jalview/schemes/ResidueProperties.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/schemes/ScoreColourScheme.java b/src/jalview/schemes/ScoreColourScheme.java index 134ed4c..b55189b 100755 --- a/src/jalview/schemes/ScoreColourScheme.java +++ b/src/jalview/schemes/ScoreColourScheme.java @@ -1,121 +1,121 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.schemes; - -import java.awt.*; - -/** - * DOCUMENT ME! - * - * @author $author$ - * @version $Revision$ - */ -public class ScoreColourScheme - extends ResidueColourScheme -{ - /** DOCUMENT ME!! */ - public double min; - - /** DOCUMENT ME!! */ - public double max; - - /** DOCUMENT ME!! */ - public double[] scores; - - /** - * Creates a new ScoreColourScheme object. - * - * @param scores DOCUMENT ME! - * @param min DOCUMENT ME! - * @param max DOCUMENT ME! - */ - public ScoreColourScheme(double[] scores, double min, double max) - { - super(); - - this.scores = scores; - this.min = min; - this.max = max; - - // Make colours in constructor - // Why wasn't this done earlier? - int i, iSize = scores.length; - colors = new Color[scores.length]; - for (i = 0; i < iSize; i++) - { - float red = (float) (scores[i] - (float) min) / (float) (max - min); - - if (red > 1.0f) - { - red = 1.0f; - } - - if (red < 0.0f) - { - red = 0.0f; - } - colors[i] = makeColour(red); - } - } - - /** - * DOCUMENT ME! - * - * @param s DOCUMENT ME! - * @param j DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public Color findColour(char c, int j) - { - if (threshold > 0) - { - if (!aboveThreshold(c, j)) - { - return Color.white; - } - } - - if (jalview.util.Comparison.isGap(c)) - { - return Color.white; - } - - Color currentColour = colors[ResidueProperties.aaIndex[c]]; - - if (conservationColouring) - { - currentColour = applyConservation(currentColour, j); - } - - return currentColour; - } - - /** - * DOCUMENT ME! - * - * @param c DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public Color makeColour(float c) - { - return new Color(c, (float) 0.0, (float) 1.0 - c); - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.schemes; + +import java.awt.*; + +/** + * DOCUMENT ME! + * + * @author $author$ + * @version $Revision$ + */ +public class ScoreColourScheme + extends ResidueColourScheme +{ + /** DOCUMENT ME!! */ + public double min; + + /** DOCUMENT ME!! */ + public double max; + + /** DOCUMENT ME!! */ + public double[] scores; + + /** + * Creates a new ScoreColourScheme object. + * + * @param scores DOCUMENT ME! + * @param min DOCUMENT ME! + * @param max DOCUMENT ME! + */ + public ScoreColourScheme(double[] scores, double min, double max) + { + super(); + + this.scores = scores; + this.min = min; + this.max = max; + + // Make colours in constructor + // Why wasn't this done earlier? + int i, iSize = scores.length; + colors = new Color[scores.length]; + for (i = 0; i < iSize; i++) + { + float red = (float) (scores[i] - (float) min) / (float) (max - min); + + if (red > 1.0f) + { + red = 1.0f; + } + + if (red < 0.0f) + { + red = 0.0f; + } + colors[i] = makeColour(red); + } + } + + /** + * DOCUMENT ME! + * + * @param s DOCUMENT ME! + * @param j DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public Color findColour(char c, int j) + { + if (threshold > 0) + { + if (!aboveThreshold(c, j)) + { + return Color.white; + } + } + + if (jalview.util.Comparison.isGap(c)) + { + return Color.white; + } + + Color currentColour = colors[ResidueProperties.aaIndex[c]]; + + if (conservationColouring) + { + currentColour = applyConservation(currentColour, j); + } + + return currentColour; + } + + /** + * DOCUMENT ME! + * + * @param c DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public Color makeColour(float c) + { + return new Color(c, (float) 0.0, (float) 1.0 - c); + } +} diff --git a/src/jalview/schemes/ScoreMatrix.java b/src/jalview/schemes/ScoreMatrix.java index 69a0922..0a976ea 100644 --- a/src/jalview/schemes/ScoreMatrix.java +++ b/src/jalview/schemes/ScoreMatrix.java @@ -1,3 +1,21 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ package jalview.schemes; public class ScoreMatrix diff --git a/src/jalview/schemes/StrandColourScheme.java b/src/jalview/schemes/StrandColourScheme.java index ec57d50..c64af1b 100755 --- a/src/jalview/schemes/StrandColourScheme.java +++ b/src/jalview/schemes/StrandColourScheme.java @@ -1,52 +1,52 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.schemes; - -import java.awt.*; - -/** - * DOCUMENT ME! - * - * @author $author$ - * @version $Revision$ - */ -public class StrandColourScheme - extends ScoreColourScheme -{ - /** - * Creates a new StrandColourScheme object. - */ - public StrandColourScheme() - { - super(ResidueProperties.strand, ResidueProperties.strandmin, - ResidueProperties.strandmax); - } - - /** - * DOCUMENT ME! - * - * @param c DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public Color makeColour(float c) - { - return new Color(c, c, (float) 1.0 - c); - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.schemes; + +import java.awt.*; + +/** + * DOCUMENT ME! + * + * @author $author$ + * @version $Revision$ + */ +public class StrandColourScheme + extends ScoreColourScheme +{ + /** + * Creates a new StrandColourScheme object. + */ + public StrandColourScheme() + { + super(ResidueProperties.strand, ResidueProperties.strandmin, + ResidueProperties.strandmax); + } + + /** + * DOCUMENT ME! + * + * @param c DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public Color makeColour(float c) + { + return new Color(c, c, (float) 1.0 - c); + } +} diff --git a/src/jalview/schemes/TaylorColourScheme.java b/src/jalview/schemes/TaylorColourScheme.java index 3a5c4da..f3ac31e 100755 --- a/src/jalview/schemes/TaylorColourScheme.java +++ b/src/jalview/schemes/TaylorColourScheme.java @@ -1,28 +1,28 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.schemes; - -public class TaylorColourScheme - extends ResidueColourScheme -{ - public TaylorColourScheme() - { - super(ResidueProperties.taylor, 0); - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.schemes; + +public class TaylorColourScheme + extends ResidueColourScheme +{ + public TaylorColourScheme() + { + super(ResidueProperties.taylor, 0); + } +} diff --git a/src/jalview/schemes/TurnColourScheme.java b/src/jalview/schemes/TurnColourScheme.java index 2bd779b..c2f06fd 100755 --- a/src/jalview/schemes/TurnColourScheme.java +++ b/src/jalview/schemes/TurnColourScheme.java @@ -1,52 +1,52 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.schemes; - -import java.awt.*; - -/** - * DOCUMENT ME! - * - * @author $author$ - * @version $Revision$ - */ -public class TurnColourScheme - extends ScoreColourScheme -{ - /** - * Creates a new TurnColourScheme object. - */ - public TurnColourScheme() - { - super(ResidueProperties.turn, ResidueProperties.turnmin, - ResidueProperties.turnmax); - } - - /** - * DOCUMENT ME! - * - * @param c DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public Color makeColour(float c) - { - return new Color(c, 1 - c, 1 - c); - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.schemes; + +import java.awt.*; + +/** + * DOCUMENT ME! + * + * @author $author$ + * @version $Revision$ + */ +public class TurnColourScheme + extends ScoreColourScheme +{ + /** + * Creates a new TurnColourScheme object. + */ + public TurnColourScheme() + { + super(ResidueProperties.turn, ResidueProperties.turnmin, + ResidueProperties.turnmax); + } + + /** + * DOCUMENT ME! + * + * @param c DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public Color makeColour(float c) + { + return new Color(c, 1 - c, 1 - c); + } +} diff --git a/src/jalview/schemes/UserColourScheme.java b/src/jalview/schemes/UserColourScheme.java index ab9ad2f..140b06e 100755 --- a/src/jalview/schemes/UserColourScheme.java +++ b/src/jalview/schemes/UserColourScheme.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/schemes/ZappoColourScheme.java b/src/jalview/schemes/ZappoColourScheme.java index f674a51..327f9e2 100755 --- a/src/jalview/schemes/ZappoColourScheme.java +++ b/src/jalview/schemes/ZappoColourScheme.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/structure/SequenceListener.java b/src/jalview/structure/SequenceListener.java index 5370e12..7021f95 100644 --- a/src/jalview/structure/SequenceListener.java +++ b/src/jalview/structure/SequenceListener.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/structure/StructureListener.java b/src/jalview/structure/StructureListener.java index 5436eae..15225d7 100644 --- a/src/jalview/structure/StructureListener.java +++ b/src/jalview/structure/StructureListener.java @@ -1,32 +1,32 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.structure; - -public interface StructureListener -{ - public String getPdbFile(); - - public void mouseOverStructure(int atomIndex, String strInfo); - - public void highlightAtom(int atomIndex, int pdbResNum, String chain, String pdbId); - - public void updateColours(Object source); - - public java.awt.Color getColour(int atomIndex, int pdbResNum, String chain, String pdbId); -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.structure; + +public interface StructureListener +{ + public String getPdbFile(); + + public void mouseOverStructure(int atomIndex, String strInfo); + + public void highlightAtom(int atomIndex, int pdbResNum, String chain, String pdbId); + + public void updateColours(Object source); + + public java.awt.Color getColour(int atomIndex, int pdbResNum, String chain, String pdbId); +} diff --git a/src/jalview/structure/StructureMapping.java b/src/jalview/structure/StructureMapping.java index 06e6bc3..9a238b4 100644 --- a/src/jalview/structure/StructureMapping.java +++ b/src/jalview/structure/StructureMapping.java @@ -1,100 +1,99 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -package jalview.structure; - -import jalview.datamodel.*; - -public class StructureMapping -{ - String mappingDetails; - SequenceI sequence; - String pdbfile; - String pdbid; - String pdbchain; - - //Mapping index 0 is resNum, index 1 is atomNo - int[][] mapping; - - public StructureMapping(SequenceI seq, - String pdbfile, - String pdbid, - String chain, - int[][] mapping, - String mappingDetails) - { - sequence = seq; - this.pdbfile = pdbfile; - this.pdbid = pdbid; - this.pdbchain = chain; - this.mapping = mapping; - this.mappingDetails = mappingDetails; - } - - public SequenceI getSequence() - { - return sequence; - } - - public String getChain() - { - return pdbchain; - } - - public String getPdbId() - { - return pdbid; - } - - public int getAtomNum(int seqpos) - { - if (mapping.length > seqpos) - { - return mapping[seqpos][1]; - } - else - { - return 0; - } - } - - public int getPDBResNum(int seqpos) - { - if (mapping.length > seqpos) - { - return mapping[seqpos][0]; - } - else - { - return 0; - } - } - - public int getSeqPos(int pdbResNum) - { - for (int i = 0; i < mapping.length; i++) - { - if (mapping[i][0] == pdbResNum) - { - return i; - } - } - return -1; - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.structure; + +import jalview.datamodel.*; + +public class StructureMapping +{ + String mappingDetails; + SequenceI sequence; + String pdbfile; + String pdbid; + String pdbchain; + + //Mapping index 0 is resNum, index 1 is atomNo + int[][] mapping; + + public StructureMapping(SequenceI seq, + String pdbfile, + String pdbid, + String chain, + int[][] mapping, + String mappingDetails) + { + sequence = seq; + this.pdbfile = pdbfile; + this.pdbid = pdbid; + this.pdbchain = chain; + this.mapping = mapping; + this.mappingDetails = mappingDetails; + } + + public SequenceI getSequence() + { + return sequence; + } + + public String getChain() + { + return pdbchain; + } + + public String getPdbId() + { + return pdbid; + } + + public int getAtomNum(int seqpos) + { + if (mapping.length > seqpos) + { + return mapping[seqpos][1]; + } + else + { + return 0; + } + } + + public int getPDBResNum(int seqpos) + { + if (mapping.length > seqpos) + { + return mapping[seqpos][0]; + } + else + { + return 0; + } + } + + public int getSeqPos(int pdbResNum) + { + for (int i = 0; i < mapping.length; i++) + { + if (mapping[i][0] == pdbResNum) + { + return i; + } + } + return -1; + } +} diff --git a/src/jalview/structure/StructureSelectionManager.java b/src/jalview/structure/StructureSelectionManager.java index e12e3ab..52195a3 100644 --- a/src/jalview/structure/StructureSelectionManager.java +++ b/src/jalview/structure/StructureSelectionManager.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/structure/VamsasListener.java b/src/jalview/structure/VamsasListener.java index 1bf3931..962c928 100644 --- a/src/jalview/structure/VamsasListener.java +++ b/src/jalview/structure/VamsasListener.java @@ -1,3 +1,21 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ package jalview.structure; import jalview.datamodel.SequenceI; diff --git a/src/jalview/util/BrowserLauncher.java b/src/jalview/util/BrowserLauncher.java index 2b8a4bd..05f2fc3 100755 --- a/src/jalview/util/BrowserLauncher.java +++ b/src/jalview/util/BrowserLauncher.java @@ -1,931 +1,931 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.util; - -import java.io.*; -import java.lang.reflect.*; - -/** - * BrowserLauncher is a class that provides one static method, openURL, which opens the default - * web browser for the current user of the system to the given URL. It may support other - * protocols depending on the system -- mailto, ftp, etc. -- but that has not been rigorously - * tested and is not guaranteed to work. - *

- * Yes, this is platform-specific code, and yes, it may rely on classes on certain platforms - * that are not part of the standard JDK. What we're trying to do, though, is to take something - * that's frequently desirable but inherently platform-specific -- opening a default browser -- - * and allow programmers (you, for example) to do so without worrying about dropping into native - * code or doing anything else similarly evil. - *

- * Anyway, this code is completely in Java and will run on all JDK 1.1-compliant systems without - * modification or a need for additional libraries. All classes that are required on certain - * platforms to allow this to run are dynamically loaded at runtime via reflection and, if not - * found, will not cause this to do anything other than returning an error when opening the - * browser. - *

- * There are certain system requirements for this class, as it's running through Runtime.exec(), - * which is Java's way of making a native system call. Currently, this requires that a Macintosh - * have a Finder which supports the GURL event, which is true for Mac OS 8.0 and 8.1 systems that - * have the Internet Scripting AppleScript dictionary installed in the Scripting Additions folder - * in the Extensions folder (which is installed by default as far as I know under Mac OS 8.0 and - * 8.1), and for all Mac OS 8.5 and later systems. On Windows, it only runs under Win32 systems - * (Windows 95, 98, and NT 4.0, as well as later versions of all). On other systems, this drops - * back from the inherently platform-sensitive concept of a default browser and simply attempts - * to launch Netscape via a shell command. - *

- * This code is Copyright 1999-2001 by Eric Albert (ejalbert\@cs.stanford.edu) and may be - * redistributed or modified in any form without restrictions as long as the portion of this - * comment from this paragraph through the end of the comment is not removed. The author - * requests that he be notified of any application, applet, or other binary that makes use of - * this code, but that's more out of curiosity than anything and is not required. This software - * includes no warranty. The author is not repsonsible for any loss of data or functionality - * or any adverse or unexpected effects of using this software. - *

- * Credits: - *
Steven Spencer, JavaWorld magazine (Java Tip 66) - *
Thanks also to Ron B. Yeh, Eric Shapiro, Ben Engber, Paul Teitlebaum, Andrea Cantatore, - * Larry Barowski, Trevor Bedzek, Frank Miedrich, and Ron Rabakukk - * - * @author Eric Albert (ejalbert@cs.stanford.edu) - * @version 1.4b1 (Released June 20, 2001) - */ -public class BrowserLauncher -{ - /** - * The Java virtual machine that we are running on. Actually, in most cases we only care - * about the operating system, but some operating systems require us to switch on the VM. */ - private static int jvm; - - /** The browser for the system */ - private static Object browser; - - /** - * Caches whether any classes, methods, and fields that are not part of the JDK and need to - * be dynamically loaded at runtime loaded successfully. - *

- * Note that if this is false, openURL() will always return an - * IOException. - */ - private static boolean loadedWithoutErrors; - - /** The com.apple.mrj.MRJFileUtils class */ - private static Class mrjFileUtilsClass; - - /** The com.apple.mrj.MRJOSType class */ - private static Class mrjOSTypeClass; - - /** The com.apple.MacOS.AEDesc class */ - private static Class aeDescClass; - - /** The <init>(int) method of com.apple.MacOS.AETarget */ - private static Constructor aeTargetConstructor; - - /** The <init>(int, int, int) method of com.apple.MacOS.AppleEvent */ - private static Constructor appleEventConstructor; - - /** The <init>(String) method of com.apple.MacOS.AEDesc */ - private static Constructor aeDescConstructor; - - /** The findFolder method of com.apple.mrj.MRJFileUtils */ - private static Method findFolder; - - /** The getFileCreator method of com.apple.mrj.MRJFileUtils */ - private static Method getFileCreator; - - /** The getFileType method of com.apple.mrj.MRJFileUtils */ - private static Method getFileType; - - /** The openURL method of com.apple.mrj.MRJFileUtils */ - private static Method openURL; - - /** The makeOSType method of com.apple.MacOS.OSUtils */ - private static Method makeOSType; - - /** The putParameter method of com.apple.MacOS.AppleEvent */ - private static Method putParameter; - - /** The sendNoReply method of com.apple.MacOS.AppleEvent */ - private static Method sendNoReply; - - /** Actually an MRJOSType pointing to the System Folder on a Macintosh */ - private static Object kSystemFolderType; - - /** The keyDirectObject AppleEvent parameter type */ - private static Integer keyDirectObject; - - /** The kAutoGenerateReturnID AppleEvent code */ - private static Integer kAutoGenerateReturnID; - - /** The kAnyTransactionID AppleEvent code */ - private static Integer kAnyTransactionID; - - /** The linkage object required for JDirect 3 on Mac OS X. */ - private static Object linkage; - - /** The framework to reference on Mac OS X */ - private static final String JDirect_MacOSX = "/System/Library/Frameworks/Carbon.framework/Frameworks/HIToolbox.framework/HIToolbox"; - - /** JVM constant for MRJ 2.0 */ - private static final int MRJ_2_0 = 0; - - /** JVM constant for MRJ 2.1 or later */ - private static final int MRJ_2_1 = 1; - - /** JVM constant for Java on Mac OS X 10.0 (MRJ 3.0) */ - private static final int MRJ_3_0 = 3; - - /** JVM constant for MRJ 3.1 */ - private static final int MRJ_3_1 = 4; - - /** JVM constant for any Windows NT JVM */ - private static final int WINDOWS_NT = 5; - - /** JVM constant for any Windows 9x JVM */ - private static final int WINDOWS_9x = 6; - - /** JVM constant for any other platform */ - private static final int OTHER = -1; - - /** - * The file type of the Finder on a Macintosh. Hardcoding "Finder" would keep non-U.S. English - * systems from working properly. - */ - private static final String FINDER_TYPE = "FNDR"; - - /** - * The creator code of the Finder on a Macintosh, which is needed to send AppleEvents to the - * application. - */ - private static final String FINDER_CREATOR = "MACS"; - - /** The name for the AppleEvent type corresponding to a GetURL event. */ - private static final String GURL_EVENT = "GURL"; - - /** - * The first parameter that needs to be passed into Runtime.exec() to open the default web - * browser on Windows. - */ - private static final String FIRST_WINDOWS_PARAMETER = "/c"; - - /** The second parameter for Runtime.exec() on Windows. */ - private static final String SECOND_WINDOWS_PARAMETER = "start"; - - /** - * The third parameter for Runtime.exec() on Windows. This is a "title" - * parameter that the command line expects. Setting this parameter allows - * URLs containing spaces to work. - */ - private static final String THIRD_WINDOWS_PARAMETER = "\"\""; - - /** - * The shell parameters for Netscape that opens a given URL in an already-open copy of Netscape - * on many command-line systems. - */ - private static final String NETSCAPE_REMOTE_PARAMETER = "-remote"; - private static final String NETSCAPE_OPEN_PARAMETER_START = "openURL("; - private static final String NETSCAPE_OPEN_NEW_WINDOW = ", new-window"; - private static final String NETSCAPE_OPEN_PARAMETER_END = ")"; - - /** - * The message from any exception thrown throughout the initialization process. - */ - private static String errorMessage; - - /** - * An initialization block that determines the operating system and loads the necessary - * runtime data. - */ - static - { - loadedWithoutErrors = true; - - String osName = System.getProperty("os.name"); - - if (osName.startsWith("Mac OS")) - { - String mrjVersion = System.getProperty("mrj.version"); - String majorMRJVersion = mrjVersion.substring(0, 3); - - try - { - double version = Double.valueOf(majorMRJVersion).doubleValue(); - - if (version == 2) - { - jvm = MRJ_2_0; - } - else if ( (version >= 2.1) && (version < 3)) - { - // Assume that all 2.x versions of MRJ work the same. MRJ 2.1 actually - // works via Runtime.exec() and 2.2 supports that but has an openURL() method - // as well that we currently ignore. - jvm = MRJ_2_1; - } - else if (version == 3.0) - { - jvm = MRJ_3_0; - } - else if (version >= 3.1) - { - // Assume that all 3.1 and later versions of MRJ work the same. - jvm = MRJ_3_1; - } - else - { - loadedWithoutErrors = false; - errorMessage = "Unsupported MRJ version: " + version; - } - } - catch (NumberFormatException nfe) - { - loadedWithoutErrors = false; - errorMessage = "Invalid MRJ version: " + mrjVersion; - } - } - else if (osName.startsWith("Windows")) - { - if (osName.indexOf("9") != -1) - { - jvm = WINDOWS_9x; - } - else - { - jvm = WINDOWS_NT; - } - } - else - { - jvm = OTHER; - } - - if (loadedWithoutErrors) - { // if we haven't hit any errors yet - loadedWithoutErrors = loadClasses(); - } - } - - /** - * This class should be never be instantiated; this just ensures so. - */ - private BrowserLauncher() - { - } - - /** - * Called by a static initializer to load any classes, fields, and methods required at runtime - * to locate the user's web browser. - * @return true if all intialization succeeded - * false if any portion of the initialization failed - */ - private static boolean loadClasses() - { - switch (jvm) - { - case MRJ_2_0: - - try - { - Class aeTargetClass = Class.forName("com.apple.MacOS.AETarget"); - Class osUtilsClass = Class.forName("com.apple.MacOS.OSUtils"); - Class appleEventClass = Class.forName( - "com.apple.MacOS.AppleEvent"); - Class aeClass = Class.forName("com.apple.MacOS.ae"); - aeDescClass = Class.forName("com.apple.MacOS.AEDesc"); - - aeTargetConstructor = aeTargetClass.getDeclaredConstructor(new Class[] - { - int.class - }); - appleEventConstructor = appleEventClass.getDeclaredConstructor(new - Class[] - { - int.class, int.class, aeTargetClass, int.class, - int.class - }); - aeDescConstructor = aeDescClass.getDeclaredConstructor(new Class[] - { - String.class - }); - - makeOSType = osUtilsClass.getDeclaredMethod("makeOSType", - new Class[] - {String.class}); - putParameter = appleEventClass.getDeclaredMethod("putParameter", - new Class[] - {int.class, aeDescClass}); - sendNoReply = appleEventClass.getDeclaredMethod("sendNoReply", - new Class[] - {}); - - Field keyDirectObjectField = aeClass.getDeclaredField( - "keyDirectObject"); - keyDirectObject = (Integer) keyDirectObjectField.get(null); - - Field autoGenerateReturnIDField = appleEventClass.getDeclaredField( - "kAutoGenerateReturnID"); - kAutoGenerateReturnID = (Integer) autoGenerateReturnIDField.get(null); - - Field anyTransactionIDField = appleEventClass.getDeclaredField( - "kAnyTransactionID"); - kAnyTransactionID = (Integer) anyTransactionIDField.get(null); - } - catch (ClassNotFoundException cnfe) - { - errorMessage = cnfe.getMessage(); - - return false; - } - catch (NoSuchMethodException nsme) - { - errorMessage = nsme.getMessage(); - - return false; - } - catch (NoSuchFieldException nsfe) - { - errorMessage = nsfe.getMessage(); - - return false; - } - catch (IllegalAccessException iae) - { - errorMessage = iae.getMessage(); - - return false; - } - - break - ; - - case MRJ_2_1: - - try - { - mrjFileUtilsClass = Class.forName("com.apple.mrj.MRJFileUtils"); - mrjOSTypeClass = Class.forName("com.apple.mrj.MRJOSType"); - - Field systemFolderField = mrjFileUtilsClass.getDeclaredField( - "kSystemFolderType"); - kSystemFolderType = systemFolderField.get(null); - findFolder = mrjFileUtilsClass.getDeclaredMethod("findFolder", - new Class[] - {mrjOSTypeClass}); - getFileCreator = mrjFileUtilsClass.getDeclaredMethod("getFileCreator", - new Class[] - {File.class}); - getFileType = mrjFileUtilsClass.getDeclaredMethod("getFileType", - new Class[] - {File.class}); - } - catch (ClassNotFoundException cnfe) - { - errorMessage = cnfe.getMessage(); - - return false; - } - catch (NoSuchFieldException nsfe) - { - errorMessage = nsfe.getMessage(); - - return false; - } - catch (NoSuchMethodException nsme) - { - errorMessage = nsme.getMessage(); - - return false; - } - catch (SecurityException se) - { - errorMessage = se.getMessage(); - - return false; - } - catch (IllegalAccessException iae) - { - errorMessage = iae.getMessage(); - - return false; - } - - break - ; - - case MRJ_3_0: - - try - { - Class linker = Class.forName("com.apple.mrj.jdirect.Linker"); - Constructor constructor = linker.getConstructor(new Class[] - { - Class.class - }); - linkage = constructor.newInstance(new Object[] - { - BrowserLauncher.class - }); - } - catch (ClassNotFoundException cnfe) - { - errorMessage = cnfe.getMessage(); - - return false; - } - catch (NoSuchMethodException nsme) - { - errorMessage = nsme.getMessage(); - - return false; - } - catch (InvocationTargetException ite) - { - errorMessage = ite.getMessage(); - - return false; - } - catch (InstantiationException ie) - { - errorMessage = ie.getMessage(); - - return false; - } - catch (IllegalAccessException iae) - { - errorMessage = iae.getMessage(); - - return false; - } - - break - ; - - case MRJ_3_1: - - try - { - mrjFileUtilsClass = Class.forName("com.apple.mrj.MRJFileUtils"); - openURL = mrjFileUtilsClass.getDeclaredMethod("openURL", - new Class[] - {String.class}); - } - catch (ClassNotFoundException cnfe) - { - errorMessage = cnfe.getMessage(); - - return false; - } - catch (NoSuchMethodException nsme) - { - errorMessage = nsme.getMessage(); - - return false; - } - - break - ; - - default: - break; - } - - return true; - } - - /** - * Attempts to locate the default web browser on the local system. s results so it - * only locates the browser once for each use of this class per JVM instance. - * @return The browser for the system. Note that this may not be what you would consider - * to be a standard web browser; instead, it's the application that gets called to - * open the default web browser. In some cases, this will be a non-String object - * that provides the means of calling the default browser. - */ - private static Object locateBrowser() - { - if (browser != null) - { - return browser; - } - - switch (jvm) - { - case MRJ_2_0: - - try - { - Integer finderCreatorCode = (Integer) makeOSType.invoke(null, - new Object[] - {FINDER_CREATOR}); - Object aeTarget = aeTargetConstructor.newInstance(new Object[] - { - finderCreatorCode - }); - Integer gurlType = (Integer) makeOSType.invoke(null, - new Object[] - {GURL_EVENT}); - Object appleEvent = appleEventConstructor.newInstance(new Object[] - { - gurlType, gurlType, aeTarget, kAutoGenerateReturnID, - kAnyTransactionID - }); - - // Don't set browser = appleEvent because then the next time we call - // locateBrowser(), we'll get the same AppleEvent, to which we'll already have - // added the relevant parameter. Instead, regenerate the AppleEvent every time. - // There's probably a way to do this better; if any has any ideas, please let - // me know. - return appleEvent; - } - catch (IllegalAccessException iae) - { - browser = null; - errorMessage = iae.getMessage(); - - return browser; - } - catch (InstantiationException ie) - { - browser = null; - errorMessage = ie.getMessage(); - - return browser; - } - catch (InvocationTargetException ite) - { - browser = null; - errorMessage = ite.getMessage(); - - return browser; - } - - case MRJ_2_1: - - File systemFolder; - - try - { - systemFolder = (File) findFolder.invoke(null, - new Object[] - {kSystemFolderType}); - } - catch (IllegalArgumentException iare) - { - browser = null; - errorMessage = iare.getMessage(); - - return browser; - } - catch (IllegalAccessException iae) - { - browser = null; - errorMessage = iae.getMessage(); - - return browser; - } - catch (InvocationTargetException ite) - { - browser = null; - errorMessage = ite.getTargetException().getClass() + ": " + - ite.getTargetException().getMessage(); - - return browser; - } - - String[] systemFolderFiles = systemFolder.list(); - - // Avoid a FilenameFilter because that can't be stopped mid-list - for (int i = 0; i < systemFolderFiles.length; i++) - { - try - { - File file = new File(systemFolder, systemFolderFiles[i]); - - if (!file.isFile()) - { - continue; - } - - // We're looking for a file with a creator code of 'MACS' and - // a type of 'FNDR'. Only requiring the type results in non-Finder - // applications being picked up on certain Mac OS 9 systems, - // especially German ones, and sending a GURL event to those - // applications results in a logout under Multiple Users. - Object fileType = getFileType.invoke(null, - new Object[] - {file}); - - if (FINDER_TYPE.equals(fileType.toString())) - { - Object fileCreator = getFileCreator.invoke(null, - new Object[] - {file}); - - if (FINDER_CREATOR.equals(fileCreator.toString())) - { - browser = file.toString(); // Actually the Finder, but that's OK - - return browser; - } - } - } - catch (IllegalArgumentException iare) - { - errorMessage = iare.getMessage(); - - return null; - } - catch (IllegalAccessException iae) - { - browser = null; - errorMessage = iae.getMessage(); - - return browser; - } - catch (InvocationTargetException ite) - { - browser = null; - errorMessage = ite.getTargetException().getClass() + ": " + - ite.getTargetException().getMessage(); - - return browser; - } - } - - browser = null; - - break; - - case MRJ_3_0: - case MRJ_3_1: - browser = ""; // Return something non-null - - break; - - case WINDOWS_NT: - browser = "cmd.exe"; - - break; - - case WINDOWS_9x: - browser = "command.com"; - - break; - - case OTHER: - default: - browser = jalview.bin.Cache.getDefault("DEFAULT_BROWSER", "firefox"); - - break; - } - - return browser; - } - - /** - * used to ensure that browser is up-to-date after a configuration - * change (Unix DEFAULT_BROWSER property change). - */ - public static void resetBrowser() - { - browser = null; - } - - /** - * Attempts to open the default web browser to the given URL. - * @param url The URL to open - * @throws IOException If the web browser could not be located or does not run - */ - public static void openURL(String url) - throws IOException - { - if (!loadedWithoutErrors) - { - throw new IOException("Exception in finding browser: " + - errorMessage); - } - - Object browser = locateBrowser(); - - if (browser == null) - { - throw new IOException("Unable to locate browser: " + errorMessage); - } - - switch (jvm) - { - case MRJ_2_0: - - Object aeDesc = null; - - try - { - aeDesc = aeDescConstructor.newInstance(new Object[] - {url}); - putParameter.invoke(browser, - new Object[] - {keyDirectObject, aeDesc}); - sendNoReply.invoke(browser, new Object[] - {}); - } - catch (InvocationTargetException ite) - { - throw new IOException( - "InvocationTargetException while creating AEDesc: " + - ite.getMessage()); - } - catch (IllegalAccessException iae) - { - throw new IOException( - "IllegalAccessException while building AppleEvent: " + - iae.getMessage()); - } - catch (InstantiationException ie) - { - throw new IOException( - "InstantiationException while creating AEDesc: " + - ie.getMessage()); - } - finally - { - aeDesc = null; // Encourage it to get disposed if it was created - browser = null; // Ditto - } - - break; - - case MRJ_2_1: - Runtime.getRuntime().exec(new String[] - { (String) browser, url}); - - break; - - case MRJ_3_0: - - int[] instance = new int[1]; - int result = ICStart(instance, 0); - - if (result == 0) - { - int[] selectionStart = new int[] - { - 0}; - byte[] urlBytes = url.getBytes(); - int[] selectionEnd = new int[] - { - urlBytes.length}; - result = ICLaunchURL(instance[0], new byte[] - {0}, urlBytes, - urlBytes.length, selectionStart, selectionEnd); - - if (result == 0) - { - // Ignore the return value; the URL was launched successfully - // regardless of what happens here. - ICStop(instance); - } - else - { - throw new IOException("Unable to launch URL: " + result); - } - } - else - { - throw new IOException( - "Unable to create an Internet Config instance: " + result); - } - - break; - - case MRJ_3_1: - - try - { - openURL.invoke(null, new Object[] - {url}); - } - catch (InvocationTargetException ite) - { - throw new IOException( - "InvocationTargetException while calling openURL: " + - ite.getMessage()); - } - catch (IllegalAccessException iae) - { - throw new IOException( - "IllegalAccessException while calling openURL: " + - iae.getMessage()); - } - - break - ; - - case WINDOWS_NT: - case WINDOWS_9x: - - // Add quotes around the URL to allow ampersands and other special - // characters to work. - Process process = Runtime.getRuntime().exec(new String[] - { - (String) browser, FIRST_WINDOWS_PARAMETER, - SECOND_WINDOWS_PARAMETER, THIRD_WINDOWS_PARAMETER, - '"' + url + '"' - }); - - // This avoids a memory leak on some versions of Java on Windows. - // That's hinted at in . - try - { - process.waitFor(); - process.exitValue(); - } - catch (InterruptedException ie) - { - throw new IOException( - "InterruptedException while launching browser: " + - ie.getMessage()); - } - - break - ; - - case OTHER: - - // Assume that we're on Unix and that Netscape (actually Firefox) is installed - // First, attempt to open the URL in a currently running session of Netscape - // JBPNote log debug - - /* System.out.println("Executing : "+browser+" "+ - NETSCAPE_REMOTE_PARAMETER+" "+ - NETSCAPE_OPEN_PARAMETER_START + - url + - NETSCAPE_OPEN_NEW_WINDOW + - NETSCAPE_OPEN_PARAMETER_END); - */ - process = Runtime.getRuntime().exec(new String[] - { - (String) browser, - NETSCAPE_REMOTE_PARAMETER, - - NETSCAPE_OPEN_PARAMETER_START + url + - NETSCAPE_OPEN_NEW_WINDOW + - NETSCAPE_OPEN_PARAMETER_END - }); - - try - { - int exitCode = process.waitFor(); - - if (exitCode != 0) - { // if Netscape was not open - Runtime.getRuntime().exec(new String[] - { (String) browser, url}); - } - } - catch (InterruptedException ie) - { - throw new IOException( - "InterruptedException while launching browser: " + - ie.getMessage()); - } - - break - ; - - default: - - // This should never occur, but if it does, we'll try the simplest thing possible - Runtime.getRuntime().exec(new String[] - { (String) browser, url}); - - break; - } - } - - /** - * Methods required for Mac OS X. The presence of native methods does not cause - * any problems on other platforms. - */ - private native static int ICStart(int[] instance, int signature); - - private native static int ICStop(int[] instance); - - private native static int ICLaunchURL(int instance, byte[] hint, - byte[] data, int len, - int[] selectionStart, - int[] selectionEnd); -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.util; + +import java.io.*; +import java.lang.reflect.*; + +/** + * BrowserLauncher is a class that provides one static method, openURL, which opens the default + * web browser for the current user of the system to the given URL. It may support other + * protocols depending on the system -- mailto, ftp, etc. -- but that has not been rigorously + * tested and is not guaranteed to work. + *

+ * Yes, this is platform-specific code, and yes, it may rely on classes on certain platforms + * that are not part of the standard JDK. What we're trying to do, though, is to take something + * that's frequently desirable but inherently platform-specific -- opening a default browser -- + * and allow programmers (you, for example) to do so without worrying about dropping into native + * code or doing anything else similarly evil. + *

+ * Anyway, this code is completely in Java and will run on all JDK 1.1-compliant systems without + * modification or a need for additional libraries. All classes that are required on certain + * platforms to allow this to run are dynamically loaded at runtime via reflection and, if not + * found, will not cause this to do anything other than returning an error when opening the + * browser. + *

+ * There are certain system requirements for this class, as it's running through Runtime.exec(), + * which is Java's way of making a native system call. Currently, this requires that a Macintosh + * have a Finder which supports the GURL event, which is true for Mac OS 8.0 and 8.1 systems that + * have the Internet Scripting AppleScript dictionary installed in the Scripting Additions folder + * in the Extensions folder (which is installed by default as far as I know under Mac OS 8.0 and + * 8.1), and for all Mac OS 8.5 and later systems. On Windows, it only runs under Win32 systems + * (Windows 95, 98, and NT 4.0, as well as later versions of all). On other systems, this drops + * back from the inherently platform-sensitive concept of a default browser and simply attempts + * to launch Netscape via a shell command. + *

+ * This code is Copyright 1999-2001 by Eric Albert (ejalbert\@cs.stanford.edu) and may be + * redistributed or modified in any form without restrictions as long as the portion of this + * comment from this paragraph through the end of the comment is not removed. The author + * requests that he be notified of any application, applet, or other binary that makes use of + * this code, but that's more out of curiosity than anything and is not required. This software + * includes no warranty. The author is not repsonsible for any loss of data or functionality + * or any adverse or unexpected effects of using this software. + *

+ * Credits: + *
Steven Spencer, JavaWorld magazine (Java Tip 66) + *
Thanks also to Ron B. Yeh, Eric Shapiro, Ben Engber, Paul Teitlebaum, Andrea Cantatore, + * Larry Barowski, Trevor Bedzek, Frank Miedrich, and Ron Rabakukk + * + * @author Eric Albert (ejalbert@cs.stanford.edu) + * @version 1.4b1 (Released June 20, 2001) + */ +public class BrowserLauncher +{ + /** + * The Java virtual machine that we are running on. Actually, in most cases we only care + * about the operating system, but some operating systems require us to switch on the VM. */ + private static int jvm; + + /** The browser for the system */ + private static Object browser; + + /** + * Caches whether any classes, methods, and fields that are not part of the JDK and need to + * be dynamically loaded at runtime loaded successfully. + *

+ * Note that if this is false, openURL() will always return an + * IOException. + */ + private static boolean loadedWithoutErrors; + + /** The com.apple.mrj.MRJFileUtils class */ + private static Class mrjFileUtilsClass; + + /** The com.apple.mrj.MRJOSType class */ + private static Class mrjOSTypeClass; + + /** The com.apple.MacOS.AEDesc class */ + private static Class aeDescClass; + + /** The <init>(int) method of com.apple.MacOS.AETarget */ + private static Constructor aeTargetConstructor; + + /** The <init>(int, int, int) method of com.apple.MacOS.AppleEvent */ + private static Constructor appleEventConstructor; + + /** The <init>(String) method of com.apple.MacOS.AEDesc */ + private static Constructor aeDescConstructor; + + /** The findFolder method of com.apple.mrj.MRJFileUtils */ + private static Method findFolder; + + /** The getFileCreator method of com.apple.mrj.MRJFileUtils */ + private static Method getFileCreator; + + /** The getFileType method of com.apple.mrj.MRJFileUtils */ + private static Method getFileType; + + /** The openURL method of com.apple.mrj.MRJFileUtils */ + private static Method openURL; + + /** The makeOSType method of com.apple.MacOS.OSUtils */ + private static Method makeOSType; + + /** The putParameter method of com.apple.MacOS.AppleEvent */ + private static Method putParameter; + + /** The sendNoReply method of com.apple.MacOS.AppleEvent */ + private static Method sendNoReply; + + /** Actually an MRJOSType pointing to the System Folder on a Macintosh */ + private static Object kSystemFolderType; + + /** The keyDirectObject AppleEvent parameter type */ + private static Integer keyDirectObject; + + /** The kAutoGenerateReturnID AppleEvent code */ + private static Integer kAutoGenerateReturnID; + + /** The kAnyTransactionID AppleEvent code */ + private static Integer kAnyTransactionID; + + /** The linkage object required for JDirect 3 on Mac OS X. */ + private static Object linkage; + + /** The framework to reference on Mac OS X */ + private static final String JDirect_MacOSX = "/System/Library/Frameworks/Carbon.framework/Frameworks/HIToolbox.framework/HIToolbox"; + + /** JVM constant for MRJ 2.0 */ + private static final int MRJ_2_0 = 0; + + /** JVM constant for MRJ 2.1 or later */ + private static final int MRJ_2_1 = 1; + + /** JVM constant for Java on Mac OS X 10.0 (MRJ 3.0) */ + private static final int MRJ_3_0 = 3; + + /** JVM constant for MRJ 3.1 */ + private static final int MRJ_3_1 = 4; + + /** JVM constant for any Windows NT JVM */ + private static final int WINDOWS_NT = 5; + + /** JVM constant for any Windows 9x JVM */ + private static final int WINDOWS_9x = 6; + + /** JVM constant for any other platform */ + private static final int OTHER = -1; + + /** + * The file type of the Finder on a Macintosh. Hardcoding "Finder" would keep non-U.S. English + * systems from working properly. + */ + private static final String FINDER_TYPE = "FNDR"; + + /** + * The creator code of the Finder on a Macintosh, which is needed to send AppleEvents to the + * application. + */ + private static final String FINDER_CREATOR = "MACS"; + + /** The name for the AppleEvent type corresponding to a GetURL event. */ + private static final String GURL_EVENT = "GURL"; + + /** + * The first parameter that needs to be passed into Runtime.exec() to open the default web + * browser on Windows. + */ + private static final String FIRST_WINDOWS_PARAMETER = "/c"; + + /** The second parameter for Runtime.exec() on Windows. */ + private static final String SECOND_WINDOWS_PARAMETER = "start"; + + /** + * The third parameter for Runtime.exec() on Windows. This is a "title" + * parameter that the command line expects. Setting this parameter allows + * URLs containing spaces to work. + */ + private static final String THIRD_WINDOWS_PARAMETER = "\"\""; + + /** + * The shell parameters for Netscape that opens a given URL in an already-open copy of Netscape + * on many command-line systems. + */ + private static final String NETSCAPE_REMOTE_PARAMETER = "-remote"; + private static final String NETSCAPE_OPEN_PARAMETER_START = "openURL("; + private static final String NETSCAPE_OPEN_NEW_WINDOW = ", new-window"; + private static final String NETSCAPE_OPEN_PARAMETER_END = ")"; + + /** + * The message from any exception thrown throughout the initialization process. + */ + private static String errorMessage; + + /** + * An initialization block that determines the operating system and loads the necessary + * runtime data. + */ + static + { + loadedWithoutErrors = true; + + String osName = System.getProperty("os.name"); + + if (osName.startsWith("Mac OS")) + { + String mrjVersion = System.getProperty("mrj.version"); + String majorMRJVersion = mrjVersion.substring(0, 3); + + try + { + double version = Double.valueOf(majorMRJVersion).doubleValue(); + + if (version == 2) + { + jvm = MRJ_2_0; + } + else if ( (version >= 2.1) && (version < 3)) + { + // Assume that all 2.x versions of MRJ work the same. MRJ 2.1 actually + // works via Runtime.exec() and 2.2 supports that but has an openURL() method + // as well that we currently ignore. + jvm = MRJ_2_1; + } + else if (version == 3.0) + { + jvm = MRJ_3_0; + } + else if (version >= 3.1) + { + // Assume that all 3.1 and later versions of MRJ work the same. + jvm = MRJ_3_1; + } + else + { + loadedWithoutErrors = false; + errorMessage = "Unsupported MRJ version: " + version; + } + } + catch (NumberFormatException nfe) + { + loadedWithoutErrors = false; + errorMessage = "Invalid MRJ version: " + mrjVersion; + } + } + else if (osName.startsWith("Windows")) + { + if (osName.indexOf("9") != -1) + { + jvm = WINDOWS_9x; + } + else + { + jvm = WINDOWS_NT; + } + } + else + { + jvm = OTHER; + } + + if (loadedWithoutErrors) + { // if we haven't hit any errors yet + loadedWithoutErrors = loadClasses(); + } + } + + /** + * This class should be never be instantiated; this just ensures so. + */ + private BrowserLauncher() + { + } + + /** + * Called by a static initializer to load any classes, fields, and methods required at runtime + * to locate the user's web browser. + * @return true if all intialization succeeded + * false if any portion of the initialization failed + */ + private static boolean loadClasses() + { + switch (jvm) + { + case MRJ_2_0: + + try + { + Class aeTargetClass = Class.forName("com.apple.MacOS.AETarget"); + Class osUtilsClass = Class.forName("com.apple.MacOS.OSUtils"); + Class appleEventClass = Class.forName( + "com.apple.MacOS.AppleEvent"); + Class aeClass = Class.forName("com.apple.MacOS.ae"); + aeDescClass = Class.forName("com.apple.MacOS.AEDesc"); + + aeTargetConstructor = aeTargetClass.getDeclaredConstructor(new Class[] + { + int.class + }); + appleEventConstructor = appleEventClass.getDeclaredConstructor(new + Class[] + { + int.class, int.class, aeTargetClass, int.class, + int.class + }); + aeDescConstructor = aeDescClass.getDeclaredConstructor(new Class[] + { + String.class + }); + + makeOSType = osUtilsClass.getDeclaredMethod("makeOSType", + new Class[] + {String.class}); + putParameter = appleEventClass.getDeclaredMethod("putParameter", + new Class[] + {int.class, aeDescClass}); + sendNoReply = appleEventClass.getDeclaredMethod("sendNoReply", + new Class[] + {}); + + Field keyDirectObjectField = aeClass.getDeclaredField( + "keyDirectObject"); + keyDirectObject = (Integer) keyDirectObjectField.get(null); + + Field autoGenerateReturnIDField = appleEventClass.getDeclaredField( + "kAutoGenerateReturnID"); + kAutoGenerateReturnID = (Integer) autoGenerateReturnIDField.get(null); + + Field anyTransactionIDField = appleEventClass.getDeclaredField( + "kAnyTransactionID"); + kAnyTransactionID = (Integer) anyTransactionIDField.get(null); + } + catch (ClassNotFoundException cnfe) + { + errorMessage = cnfe.getMessage(); + + return false; + } + catch (NoSuchMethodException nsme) + { + errorMessage = nsme.getMessage(); + + return false; + } + catch (NoSuchFieldException nsfe) + { + errorMessage = nsfe.getMessage(); + + return false; + } + catch (IllegalAccessException iae) + { + errorMessage = iae.getMessage(); + + return false; + } + + break + ; + + case MRJ_2_1: + + try + { + mrjFileUtilsClass = Class.forName("com.apple.mrj.MRJFileUtils"); + mrjOSTypeClass = Class.forName("com.apple.mrj.MRJOSType"); + + Field systemFolderField = mrjFileUtilsClass.getDeclaredField( + "kSystemFolderType"); + kSystemFolderType = systemFolderField.get(null); + findFolder = mrjFileUtilsClass.getDeclaredMethod("findFolder", + new Class[] + {mrjOSTypeClass}); + getFileCreator = mrjFileUtilsClass.getDeclaredMethod("getFileCreator", + new Class[] + {File.class}); + getFileType = mrjFileUtilsClass.getDeclaredMethod("getFileType", + new Class[] + {File.class}); + } + catch (ClassNotFoundException cnfe) + { + errorMessage = cnfe.getMessage(); + + return false; + } + catch (NoSuchFieldException nsfe) + { + errorMessage = nsfe.getMessage(); + + return false; + } + catch (NoSuchMethodException nsme) + { + errorMessage = nsme.getMessage(); + + return false; + } + catch (SecurityException se) + { + errorMessage = se.getMessage(); + + return false; + } + catch (IllegalAccessException iae) + { + errorMessage = iae.getMessage(); + + return false; + } + + break + ; + + case MRJ_3_0: + + try + { + Class linker = Class.forName("com.apple.mrj.jdirect.Linker"); + Constructor constructor = linker.getConstructor(new Class[] + { + Class.class + }); + linkage = constructor.newInstance(new Object[] + { + BrowserLauncher.class + }); + } + catch (ClassNotFoundException cnfe) + { + errorMessage = cnfe.getMessage(); + + return false; + } + catch (NoSuchMethodException nsme) + { + errorMessage = nsme.getMessage(); + + return false; + } + catch (InvocationTargetException ite) + { + errorMessage = ite.getMessage(); + + return false; + } + catch (InstantiationException ie) + { + errorMessage = ie.getMessage(); + + return false; + } + catch (IllegalAccessException iae) + { + errorMessage = iae.getMessage(); + + return false; + } + + break + ; + + case MRJ_3_1: + + try + { + mrjFileUtilsClass = Class.forName("com.apple.mrj.MRJFileUtils"); + openURL = mrjFileUtilsClass.getDeclaredMethod("openURL", + new Class[] + {String.class}); + } + catch (ClassNotFoundException cnfe) + { + errorMessage = cnfe.getMessage(); + + return false; + } + catch (NoSuchMethodException nsme) + { + errorMessage = nsme.getMessage(); + + return false; + } + + break + ; + + default: + break; + } + + return true; + } + + /** + * Attempts to locate the default web browser on the local system. s results so it + * only locates the browser once for each use of this class per JVM instance. + * @return The browser for the system. Note that this may not be what you would consider + * to be a standard web browser; instead, it's the application that gets called to + * open the default web browser. In some cases, this will be a non-String object + * that provides the means of calling the default browser. + */ + private static Object locateBrowser() + { + if (browser != null) + { + return browser; + } + + switch (jvm) + { + case MRJ_2_0: + + try + { + Integer finderCreatorCode = (Integer) makeOSType.invoke(null, + new Object[] + {FINDER_CREATOR}); + Object aeTarget = aeTargetConstructor.newInstance(new Object[] + { + finderCreatorCode + }); + Integer gurlType = (Integer) makeOSType.invoke(null, + new Object[] + {GURL_EVENT}); + Object appleEvent = appleEventConstructor.newInstance(new Object[] + { + gurlType, gurlType, aeTarget, kAutoGenerateReturnID, + kAnyTransactionID + }); + + // Don't set browser = appleEvent because then the next time we call + // locateBrowser(), we'll get the same AppleEvent, to which we'll already have + // added the relevant parameter. Instead, regenerate the AppleEvent every time. + // There's probably a way to do this better; if any has any ideas, please let + // me know. + return appleEvent; + } + catch (IllegalAccessException iae) + { + browser = null; + errorMessage = iae.getMessage(); + + return browser; + } + catch (InstantiationException ie) + { + browser = null; + errorMessage = ie.getMessage(); + + return browser; + } + catch (InvocationTargetException ite) + { + browser = null; + errorMessage = ite.getMessage(); + + return browser; + } + + case MRJ_2_1: + + File systemFolder; + + try + { + systemFolder = (File) findFolder.invoke(null, + new Object[] + {kSystemFolderType}); + } + catch (IllegalArgumentException iare) + { + browser = null; + errorMessage = iare.getMessage(); + + return browser; + } + catch (IllegalAccessException iae) + { + browser = null; + errorMessage = iae.getMessage(); + + return browser; + } + catch (InvocationTargetException ite) + { + browser = null; + errorMessage = ite.getTargetException().getClass() + ": " + + ite.getTargetException().getMessage(); + + return browser; + } + + String[] systemFolderFiles = systemFolder.list(); + + // Avoid a FilenameFilter because that can't be stopped mid-list + for (int i = 0; i < systemFolderFiles.length; i++) + { + try + { + File file = new File(systemFolder, systemFolderFiles[i]); + + if (!file.isFile()) + { + continue; + } + + // We're looking for a file with a creator code of 'MACS' and + // a type of 'FNDR'. Only requiring the type results in non-Finder + // applications being picked up on certain Mac OS 9 systems, + // especially German ones, and sending a GURL event to those + // applications results in a logout under Multiple Users. + Object fileType = getFileType.invoke(null, + new Object[] + {file}); + + if (FINDER_TYPE.equals(fileType.toString())) + { + Object fileCreator = getFileCreator.invoke(null, + new Object[] + {file}); + + if (FINDER_CREATOR.equals(fileCreator.toString())) + { + browser = file.toString(); // Actually the Finder, but that's OK + + return browser; + } + } + } + catch (IllegalArgumentException iare) + { + errorMessage = iare.getMessage(); + + return null; + } + catch (IllegalAccessException iae) + { + browser = null; + errorMessage = iae.getMessage(); + + return browser; + } + catch (InvocationTargetException ite) + { + browser = null; + errorMessage = ite.getTargetException().getClass() + ": " + + ite.getTargetException().getMessage(); + + return browser; + } + } + + browser = null; + + break; + + case MRJ_3_0: + case MRJ_3_1: + browser = ""; // Return something non-null + + break; + + case WINDOWS_NT: + browser = "cmd.exe"; + + break; + + case WINDOWS_9x: + browser = "command.com"; + + break; + + case OTHER: + default: + browser = jalview.bin.Cache.getDefault("DEFAULT_BROWSER", "firefox"); + + break; + } + + return browser; + } + + /** + * used to ensure that browser is up-to-date after a configuration + * change (Unix DEFAULT_BROWSER property change). + */ + public static void resetBrowser() + { + browser = null; + } + + /** + * Attempts to open the default web browser to the given URL. + * @param url The URL to open + * @throws IOException If the web browser could not be located or does not run + */ + public static void openURL(String url) + throws IOException + { + if (!loadedWithoutErrors) + { + throw new IOException("Exception in finding browser: " + + errorMessage); + } + + Object browser = locateBrowser(); + + if (browser == null) + { + throw new IOException("Unable to locate browser: " + errorMessage); + } + + switch (jvm) + { + case MRJ_2_0: + + Object aeDesc = null; + + try + { + aeDesc = aeDescConstructor.newInstance(new Object[] + {url}); + putParameter.invoke(browser, + new Object[] + {keyDirectObject, aeDesc}); + sendNoReply.invoke(browser, new Object[] + {}); + } + catch (InvocationTargetException ite) + { + throw new IOException( + "InvocationTargetException while creating AEDesc: " + + ite.getMessage()); + } + catch (IllegalAccessException iae) + { + throw new IOException( + "IllegalAccessException while building AppleEvent: " + + iae.getMessage()); + } + catch (InstantiationException ie) + { + throw new IOException( + "InstantiationException while creating AEDesc: " + + ie.getMessage()); + } + finally + { + aeDesc = null; // Encourage it to get disposed if it was created + browser = null; // Ditto + } + + break; + + case MRJ_2_1: + Runtime.getRuntime().exec(new String[] + { (String) browser, url}); + + break; + + case MRJ_3_0: + + int[] instance = new int[1]; + int result = ICStart(instance, 0); + + if (result == 0) + { + int[] selectionStart = new int[] + { + 0}; + byte[] urlBytes = url.getBytes(); + int[] selectionEnd = new int[] + { + urlBytes.length}; + result = ICLaunchURL(instance[0], new byte[] + {0}, urlBytes, + urlBytes.length, selectionStart, selectionEnd); + + if (result == 0) + { + // Ignore the return value; the URL was launched successfully + // regardless of what happens here. + ICStop(instance); + } + else + { + throw new IOException("Unable to launch URL: " + result); + } + } + else + { + throw new IOException( + "Unable to create an Internet Config instance: " + result); + } + + break; + + case MRJ_3_1: + + try + { + openURL.invoke(null, new Object[] + {url}); + } + catch (InvocationTargetException ite) + { + throw new IOException( + "InvocationTargetException while calling openURL: " + + ite.getMessage()); + } + catch (IllegalAccessException iae) + { + throw new IOException( + "IllegalAccessException while calling openURL: " + + iae.getMessage()); + } + + break + ; + + case WINDOWS_NT: + case WINDOWS_9x: + + // Add quotes around the URL to allow ampersands and other special + // characters to work. + Process process = Runtime.getRuntime().exec(new String[] + { + (String) browser, FIRST_WINDOWS_PARAMETER, + SECOND_WINDOWS_PARAMETER, THIRD_WINDOWS_PARAMETER, + '"' + url + '"' + }); + + // This avoids a memory leak on some versions of Java on Windows. + // That's hinted at in . + try + { + process.waitFor(); + process.exitValue(); + } + catch (InterruptedException ie) + { + throw new IOException( + "InterruptedException while launching browser: " + + ie.getMessage()); + } + + break + ; + + case OTHER: + + // Assume that we're on Unix and that Netscape (actually Firefox) is installed + // First, attempt to open the URL in a currently running session of Netscape + // JBPNote log debug + + /* System.out.println("Executing : "+browser+" "+ + NETSCAPE_REMOTE_PARAMETER+" "+ + NETSCAPE_OPEN_PARAMETER_START + + url + + NETSCAPE_OPEN_NEW_WINDOW + + NETSCAPE_OPEN_PARAMETER_END); + */ + process = Runtime.getRuntime().exec(new String[] + { + (String) browser, + NETSCAPE_REMOTE_PARAMETER, + + NETSCAPE_OPEN_PARAMETER_START + url + + NETSCAPE_OPEN_NEW_WINDOW + + NETSCAPE_OPEN_PARAMETER_END + }); + + try + { + int exitCode = process.waitFor(); + + if (exitCode != 0) + { // if Netscape was not open + Runtime.getRuntime().exec(new String[] + { (String) browser, url}); + } + } + catch (InterruptedException ie) + { + throw new IOException( + "InterruptedException while launching browser: " + + ie.getMessage()); + } + + break + ; + + default: + + // This should never occur, but if it does, we'll try the simplest thing possible + Runtime.getRuntime().exec(new String[] + { (String) browser, url}); + + break; + } + } + + /** + * Methods required for Mac OS X. The presence of native methods does not cause + * any problems on other platforms. + */ + private native static int ICStart(int[] instance, int signature); + + private native static int ICStop(int[] instance); + + private native static int ICLaunchURL(int instance, byte[] hint, + byte[] data, int len, + int[] selectionStart, + int[] selectionEnd); +} diff --git a/src/jalview/util/Comparison.java b/src/jalview/util/Comparison.java index 67a668a..aad9667 100755 --- a/src/jalview/util/Comparison.java +++ b/src/jalview/util/Comparison.java @@ -1,226 +1,226 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.util; - -import jalview.datamodel.*; - -/** - * DOCUMENT ME! - * - * @author $author$ - * @version $Revision$ - */ -public class Comparison -{ - /** DOCUMENT ME!! */ - public static final String GapChars = " .-"; - - /** - * DOCUMENT ME! - * - * @param ii DOCUMENT ME! - * @param jj DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public static final float compare(SequenceI ii, SequenceI jj) - { - return Comparison.compare(ii, jj, 0, ii.getLength() - 1); - } - - /** - * this was supposed to be an ungapped pid calculation - * @param ii SequenceI - * @param jj SequenceI - * @param start int - * @param end int - * @return float - */ - public static float compare(SequenceI ii, SequenceI jj, int start, int end) - { - String si = ii.getSequenceAsString(); - String sj = jj.getSequenceAsString(); - - int ilen = si.length() - 1; - int jlen = sj.length() - 1; - - while (jalview.util.Comparison.isGap(si.charAt(start + ilen))) - { - ilen--; - } - - while (jalview.util.Comparison.isGap(sj.charAt(start + jlen))) - { - jlen--; - } - - int count = 0; - int match = 0; - float pid = -1; - - if (ilen > jlen) - { - for (int j = 0; j < jlen; j++) - { - if (si.substring(start + j, start + j + 1).equals(sj.substring(start + - j, start + j + 1))) - { - match++; - } - - count++; - } - - pid = (float) match / (float) ilen * 100; - } - else - { - for (int j = 0; j < jlen; j++) - { - if (si.substring(start + j, start + j + 1).equals(sj.substring(start + - j, start + j + 1))) - { - match++; - } - - count++; - } - - pid = (float) match / (float) jlen * 100; - } - - return pid; - } - - /** - * this is a gapped PID calculation - * - * @param s1 SequenceI - * @param s2 SequenceI - * @return float - */ - public final static float PID(String seq1, String seq2) - { - return PID(seq1, seq2, 0, seq1.length()); - } - - static final int caseShift = 'a' - 'A'; - - // Another pid with region specification - public final static float PID(String seq1, String seq2, int start, int end) - { - - int s1len = seq1.length(); - int s2len = seq2.length(); - - int len = Math.min(s1len, s2len); - - if (end < len) - { - len = end; - } - - if (len < start) - { - start = len - 1; // we just use a single residue for the difference - } - - int bad = 0; - char chr1; - char chr2; - - for (int i = start; i < len; i++) - { - chr1 = seq1.charAt(i); - - chr2 = seq2.charAt(i); - - if ('a' <= chr1 && chr1 <= 'z') - { - // TO UPPERCASE !!! - //Faster than toUpperCase - chr1 -= caseShift; - } - if ('a' <= chr2 && chr2 <= 'z') - { - // TO UPPERCASE !!! - //Faster than toUpperCase - chr2 -= caseShift; - } - - if (chr1 != chr2 && !isGap(chr1) && !isGap(chr2)) - { - bad++; - } - } - - return ( (float) 100 * (len - bad)) / len; - } - - /** - * DOCUMENT ME! - * - * @param c DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public static final boolean isGap(char c) - { - return (c == '-' || c == '.' || c == ' ') ? true : false; - } - - public static final boolean isNucleotide(SequenceI[] seqs) - { - int i = 0, iSize = seqs.length, j, jSize; - float nt = 0, aa = 0; - char c; - while (i < iSize) - { - jSize = seqs[i].getLength(); - for (j = 0; j < jSize; j++) - { - c = seqs[i].getCharAt(j); - if ('a' <= c && c <= 'z') - { - c -= ('a' - 'A'); - } - - if (c == 'A' || c == 'G' || c == 'C' || c == 'T' || c == 'U') - { - nt++; - } - else if (!jalview.util.Comparison.isGap(seqs[i].getCharAt(j))) - { - aa++; - } - } - i++; - } - - if ( (nt / (nt + aa)) > 0.85f) - { - return true; - } - else - { - return false; - } - - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.util; + +import jalview.datamodel.*; + +/** + * DOCUMENT ME! + * + * @author $author$ + * @version $Revision$ + */ +public class Comparison +{ + /** DOCUMENT ME!! */ + public static final String GapChars = " .-"; + + /** + * DOCUMENT ME! + * + * @param ii DOCUMENT ME! + * @param jj DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public static final float compare(SequenceI ii, SequenceI jj) + { + return Comparison.compare(ii, jj, 0, ii.getLength() - 1); + } + + /** + * this was supposed to be an ungapped pid calculation + * @param ii SequenceI + * @param jj SequenceI + * @param start int + * @param end int + * @return float + */ + public static float compare(SequenceI ii, SequenceI jj, int start, int end) + { + String si = ii.getSequenceAsString(); + String sj = jj.getSequenceAsString(); + + int ilen = si.length() - 1; + int jlen = sj.length() - 1; + + while (jalview.util.Comparison.isGap(si.charAt(start + ilen))) + { + ilen--; + } + + while (jalview.util.Comparison.isGap(sj.charAt(start + jlen))) + { + jlen--; + } + + int count = 0; + int match = 0; + float pid = -1; + + if (ilen > jlen) + { + for (int j = 0; j < jlen; j++) + { + if (si.substring(start + j, start + j + 1).equals(sj.substring(start + + j, start + j + 1))) + { + match++; + } + + count++; + } + + pid = (float) match / (float) ilen * 100; + } + else + { + for (int j = 0; j < jlen; j++) + { + if (si.substring(start + j, start + j + 1).equals(sj.substring(start + + j, start + j + 1))) + { + match++; + } + + count++; + } + + pid = (float) match / (float) jlen * 100; + } + + return pid; + } + + /** + * this is a gapped PID calculation + * + * @param s1 SequenceI + * @param s2 SequenceI + * @return float + */ + public final static float PID(String seq1, String seq2) + { + return PID(seq1, seq2, 0, seq1.length()); + } + + static final int caseShift = 'a' - 'A'; + + // Another pid with region specification + public final static float PID(String seq1, String seq2, int start, int end) + { + + int s1len = seq1.length(); + int s2len = seq2.length(); + + int len = Math.min(s1len, s2len); + + if (end < len) + { + len = end; + } + + if (len < start) + { + start = len - 1; // we just use a single residue for the difference + } + + int bad = 0; + char chr1; + char chr2; + + for (int i = start; i < len; i++) + { + chr1 = seq1.charAt(i); + + chr2 = seq2.charAt(i); + + if ('a' <= chr1 && chr1 <= 'z') + { + // TO UPPERCASE !!! + //Faster than toUpperCase + chr1 -= caseShift; + } + if ('a' <= chr2 && chr2 <= 'z') + { + // TO UPPERCASE !!! + //Faster than toUpperCase + chr2 -= caseShift; + } + + if (chr1 != chr2 && !isGap(chr1) && !isGap(chr2)) + { + bad++; + } + } + + return ( (float) 100 * (len - bad)) / len; + } + + /** + * DOCUMENT ME! + * + * @param c DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public static final boolean isGap(char c) + { + return (c == '-' || c == '.' || c == ' ') ? true : false; + } + + public static final boolean isNucleotide(SequenceI[] seqs) + { + int i = 0, iSize = seqs.length, j, jSize; + float nt = 0, aa = 0; + char c; + while (i < iSize) + { + jSize = seqs[i].getLength(); + for (j = 0; j < jSize; j++) + { + c = seqs[i].getCharAt(j); + if ('a' <= c && c <= 'z') + { + c -= ('a' - 'A'); + } + + if (c == 'A' || c == 'G' || c == 'C' || c == 'T' || c == 'U') + { + nt++; + } + else if (!jalview.util.Comparison.isGap(seqs[i].getCharAt(j))) + { + aa++; + } + } + i++; + } + + if ( (nt / (nt + aa)) > 0.85f) + { + return true; + } + else + { + return false; + } + + } +} diff --git a/src/jalview/util/DBRefUtils.java b/src/jalview/util/DBRefUtils.java index 7592748..0208453 100755 --- a/src/jalview/util/DBRefUtils.java +++ b/src/jalview/util/DBRefUtils.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/util/Format.java b/src/jalview/util/Format.java index 7c9b585..5786ed2 100755 --- a/src/jalview/util/Format.java +++ b/src/jalview/util/Format.java @@ -1,867 +1,864 @@ -/* - * Cay S. Horstmann & Gary Cornell, Core Java - * Published By Sun Microsystems Press/Prentice-Hall - * Copyright (C) 1997 Sun Microsystems Inc. - * All Rights Reserved. - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for NON-COMMERCIAL purposes - * and without fee is hereby granted provided that this - * copyright notice appears in all copies. - * - * THE AUTHORS AND PUBLISHER MAKE NO REPRESENTATIONS OR - * WARRANTIES ABOUT THE SUITABILITY OF THE SOFTWARE, EITHER - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE - * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. THE AUTHORS - * AND PUBLISHER SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED - * BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING - * THIS SOFTWARE OR ITS DERIVATIVES. - */ - -/** - * A class for formatting numbers that follows printf conventions. - * Also implements C-like atoi and atof functions - * @version 1.03 25 Oct 1997 - * @author Cay Horstmann - */ -package jalview.util; - -/** - * DOCUMENT ME! - * - * @author $author$ - * @version $Revision$ - */ -public class Format -{ - private int width; - private int precision; - private String pre; - private String post; - private boolean leading_zeroes; - private boolean show_plus; - private boolean alternate; - private boolean show_space; - private boolean left_align; - private char fmt; // one of cdeEfgGiosxXos - - /** - * Creates a new Format object. - * - * @param s DOCUMENT ME! - */ - public Format(String s) - { - width = 0; - precision = -1; - pre = ""; - post = ""; - leading_zeroes = false; - show_plus = false; - alternate = false; - show_space = false; - left_align = false; - fmt = ' '; - - int length = s.length(); - int parse_state = 0; - - // 0 = prefix, 1 = flags, 2 = width, 3 = precision, - // 4 = format, 5 = end - int i = 0; - - while (parse_state == 0) - { - if (i >= length) - { - parse_state = 5; - } - else if (s.charAt(i) == '%') - { - if (i < (length - 1)) - { - if (s.charAt(i + 1) == '%') - { - pre = pre + '%'; - i++; - } - else - { - parse_state = 1; - } - } - else - { - throw new java.lang.IllegalArgumentException(); - } - } - else - { - pre = pre + s.charAt(i); - } - - i++; - } - - while (parse_state == 1) - { - if (i >= length) - { - parse_state = 5; - } - else if (s.charAt(i) == ' ') - { - show_space = true; - } - else if (s.charAt(i) == '-') - { - left_align = true; - } - else if (s.charAt(i) == '+') - { - show_plus = true; - } - else if (s.charAt(i) == '0') - { - leading_zeroes = true; - } - else if (s.charAt(i) == '#') - { - alternate = true; - } - else - { - parse_state = 2; - i--; - } - - i++; - } - - while (parse_state == 2) - { - if (i >= length) - { - parse_state = 5; - } - else if ( ('0' <= s.charAt(i)) && (s.charAt(i) <= '9')) - { - width = ( (width * 10) + s.charAt(i)) - '0'; - i++; - } - else if (s.charAt(i) == '.') - { - parse_state = 3; - precision = 0; - i++; - } - else - { - parse_state = 4; - } - } - - while (parse_state == 3) - { - if (i >= length) - { - parse_state = 5; - } - else if ( ('0' <= s.charAt(i)) && (s.charAt(i) <= '9')) - { - precision = ( (precision * 10) + s.charAt(i)) - '0'; - i++; - } - else - { - parse_state = 4; - } - } - - if (parse_state == 4) - { - if (i >= length) - { - parse_state = 5; - } - else - { - fmt = s.charAt(i); - } - - i++; - } - - if (i < length) - { - post = s.substring(i, length); - } - } - - /** - * Formats the number following printf conventions. - * Main limitation: Can only handle one format parameter at a time - * Use multiple Format objects to format more than one number - * @param s the format string following printf conventions - * The string has a prefix, a format code and a suffix. The prefix and suffix - * become part of the formatted output. The format code directs the - * formatting of the (single) parameter to be formatted. The code has the - * following structure - *

    - *
  • a % (required) - *
  • a modifier (optional) - *
    - *
    +
    forces display of + for positive numbers - *
    0
    show leading zeroes - *
    -
    align left in the field - *
    space
    prepend a space in front of positive numbers - *
    #
    use "alternate" format. Add 0 or 0x for octal or hexadecimal numbers. Don't suppress trailing zeroes in general floating point format. - *
    - *
  • an integer denoting field width (optional) - *
  • a period followed by an integer denoting precision (optional) - *
  • a format descriptor (required) - *
    - *
    f
    floating point number in fixed format - *
    e, E
    floating point number in exponential notation (scientific format). The E format results in an uppercase E for the exponent (1.14130E+003), the e format in a lowercase e. - *
    g, G
    floating point number in general format (fixed format for small numbers, exponential format for large numbers). Trailing zeroes are suppressed. The G format results in an uppercase E for the exponent (if any), the g format in a lowercase e. - *
    d, i
    integer in decimal - *
    x
    integer in hexadecimal - *
    o
    integer in octal - *
    s
    string - *
    c
    character - *
    - *
- * @exception IllegalArgumentException if bad format - * - */ - public static String getHexString(java.awt.Color color) - { - String r; - String g; - String b; - r = Integer.toHexString(color.getRed()); - - if (r.length() < 2) - { - r = "0" + r; - } - - g = Integer.toHexString(color.getGreen()); - - if (g.length() < 2) - { - g = "0" + g; - } - - b = Integer.toHexString(color.getBlue()); - - if (b.length() < 2) - { - b = "0" + b; - } - - return r + g + b; - } - - /** - * prints a formatted number following printf conventions - * @param s a PrintStream - * @param fmt the format string - * @param x the double to print - */ - public static void print(java.io.PrintStream s, String fmt, double x) - { - s.print(new Format(fmt).form(x)); - } - - /** - * prints a formatted number following printf conventions - * @param s a PrintStream - * @param fmt the format string - * @param x the long to print - */ - public static void print(java.io.PrintStream s, String fmt, long x) - { - s.print(new Format(fmt).form(x)); - } - - /** - * prints a formatted number following printf conventions - * @param s a PrintStream - * @param fmt the format string - * @param x the character to - */ - public static void print(java.io.PrintStream s, String fmt, char x) - { - s.print(new Format(fmt).form(x)); - } - - /** - * prints a formatted number following printf conventions - * @param s a PrintStream, fmt the format string - * @param x a string that represents the digits to print - */ - public static void print(java.io.PrintStream s, String fmt, String x) - { - s.print(new Format(fmt).form(x)); - } - - /** - * Converts a string of digits (decimal, octal or hex) to an integer - * @param s a string - * @return the numeric value of the prefix of s representing a base 10 integer - */ - public static int atoi(String s) - { - return (int) atol(s); - } - - /** - * Converts a string of digits (decimal, octal or hex) to a long integer - * @param s a string - * @return the numeric value of the prefix of s representing a base 10 integer - */ - public static long atol(String s) - { - int i = 0; - - while ( (i < s.length()) && Character.isWhitespace(s.charAt(i))) - { - i++; - } - - if ( (i < s.length()) && (s.charAt(i) == '0')) - { - if ( ( (i + 1) < s.length()) && - ( (s.charAt(i + 1) == 'x') || (s.charAt(i + 1) == 'X'))) - { - return parseLong(s.substring(i + 2), 16); - } - else - { - return parseLong(s, 8); - } - } - else - { - return parseLong(s, 10); - } - } - - /** - * DOCUMENT ME! - * - * @param s DOCUMENT ME! - * @param base DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - private static long parseLong(String s, int base) - { - int i = 0; - int sign = 1; - long r = 0; - - while ( (i < s.length()) && Character.isWhitespace(s.charAt(i))) - { - i++; - } - - if ( (i < s.length()) && (s.charAt(i) == '-')) - { - sign = -1; - i++; - } - else if ( (i < s.length()) && (s.charAt(i) == '+')) - { - i++; - } - - while (i < s.length()) - { - char ch = s.charAt(i); - - if ( ('0' <= ch) && (ch < ('0' + base))) - { - r = ( (r * base) + ch) - '0'; - } - else if ( ('A' <= ch) && (ch < ( ('A' + base) - 10))) - { - r = ( (r * base) + ch) - 'A' + 10; - } - else if ( ('a' <= ch) && (ch < ( ('a' + base) - 10))) - { - r = ( (r * base) + ch) - 'a' + 10; - } - else - { - return r * sign; - } - - i++; - } - - return r * sign; - } - - /** - * Converts a string of digits to an double - * @param s a string - */ - public static double atof(String s) - { - int i = 0; - int sign = 1; - double r = 0; // integer part - //double f = 0; // fractional part - double p = 1; // exponent of fractional part - int state = 0; // 0 = int part, 1 = frac part - - while ( (i < s.length()) && Character.isWhitespace(s.charAt(i))) - { - i++; - } - - if ( (i < s.length()) && (s.charAt(i) == '-')) - { - sign = -1; - i++; - } - else if ( (i < s.length()) && (s.charAt(i) == '+')) - { - i++; - } - - while (i < s.length()) - { - char ch = s.charAt(i); - - if ( ('0' <= ch) && (ch <= '9')) - { - if (state == 0) - { - r = ( (r * 10) + ch) - '0'; - } - else if (state == 1) - { - p = p / 10; - r = r + (p * (ch - '0')); - } - } - else if (ch == '.') - { - if (state == 0) - { - state = 1; - } - else - { - return sign * r; - } - } - else if ( (ch == 'e') || (ch == 'E')) - { - long e = (int) parseLong(s.substring(i + 1), 10); - - return sign * r * Math.pow(10, e); - } - else - { - return sign * r; - } - - i++; - } - - return sign * r; - } - - /** - * Formats a double into a string (like sprintf in C) - * @param x the number to format - * @return the formatted string - * @exception IllegalArgumentException if bad argument - */ - public String form(double x) - { - String r; - - if (precision < 0) - { - precision = 6; - } - - int s = 1; - - if (x < 0) - { - x = -x; - s = -1; - } - - if (fmt == 'f') - { - r = fixed_format(x); - } - else if ( (fmt == 'e') || (fmt == 'E') || (fmt == 'g') || (fmt == 'G')) - { - r = exp_format(x); - } - else - { - throw new java.lang.IllegalArgumentException(); - } - - return pad(sign(s, r)); - } - - /** - * Formats a long integer into a string (like sprintf in C) - * @param x the number to format - * @return the formatted string - */ - public String form(long x) - { - String r; - int s = 0; - - if ( (fmt == 'd') || (fmt == 'i')) - { - if (x < 0) - { - r = ("" + x).substring(1); - s = -1; - } - else - { - r = "" + x; - s = 1; - } - } - else if (fmt == 'o') - { - r = convert(x, 3, 7, "01234567"); - } - else if (fmt == 'x') - { - r = convert(x, 4, 15, "0123456789abcdef"); - } - else if (fmt == 'X') - { - r = convert(x, 4, 15, "0123456789ABCDEF"); - } - else - { - throw new java.lang.IllegalArgumentException(); - } - - return pad(sign(s, r)); - } - - /** - * Formats a character into a string (like sprintf in C) - * @param x the value to format - * @return the formatted string - */ - public String form(char c) - { - if (fmt != 'c') - { - throw new java.lang.IllegalArgumentException(); - } - - String r = "" + c; - - return pad(r); - } - - /** - * Formats a string into a larger string (like sprintf in C) - * @param x the value to format - * @return the formatted string - */ - public String form(String s) - { - if (fmt != 's') - { - throw new java.lang.IllegalArgumentException(); - } - - if (precision >= 0) - { - s = s.substring(0, precision); - } - - return pad(s); - } - - /** - * DOCUMENT ME! - * - * @param c DOCUMENT ME! - * @param n DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - private static String repeat(char c, int n) - { - if (n <= 0) - { - return ""; - } - - StringBuffer s = new StringBuffer(n); - - for (int i = 0; i < n; i++) - { - s.append(c); - } - - return s.toString(); - } - - /** - * DOCUMENT ME! - * - * @param x DOCUMENT ME! - * @param n DOCUMENT ME! - * @param m DOCUMENT ME! - * @param d DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - private static String convert(long x, int n, int m, String d) - { - if (x == 0) - { - return "0"; - } - - String r = ""; - - while (x != 0) - { - r = d.charAt( (int) (x & m)) + r; - x = x >>> n; - } - - return r; - } - - /** - * DOCUMENT ME! - * - * @param r DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - private String pad(String r) - { - String p = repeat(' ', width - r.length()); - - if (left_align) - { - return pre + r + p + post; - } - else - { - return pre + p + r + post; - } - } - - /** - * DOCUMENT ME! - * - * @param s DOCUMENT ME! - * @param r DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - private String sign(int s, String r) - { - String p = ""; - - if (s < 0) - { - p = "-"; - } - else if (s > 0) - { - if (show_plus) - { - p = "+"; - } - else if (show_space) - { - p = " "; - } - } - else - { - if ( (fmt == 'o') && alternate && (r.length() > 0) && - (r.charAt(0) != '0')) - { - p = "0"; - } - else if ( (fmt == 'x') && alternate) - { - p = "0x"; - } - else if ( (fmt == 'X') && alternate) - { - p = "0X"; - } - } - - int w = 0; - - if (leading_zeroes) - { - w = width; - } - else if ( ( (fmt == 'd') || (fmt == 'i') || (fmt == 'x') || (fmt == 'X') || - (fmt == 'o')) && (precision > 0)) - { - w = precision; - } - - return p + repeat('0', w - p.length() - r.length()) + r; - } - - /** - * DOCUMENT ME! - * - * @param d DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - private String fixed_format(double d) - { - boolean removeTrailing = ( (fmt == 'G') || (fmt == 'g')) && !alternate; - - // remove trailing zeroes and decimal point - if (d > 0x7FFFFFFFFFFFFFFFL) - { - return exp_format(d); - } - - if (precision == 0) - { - return (long) (d + 0.5) + (removeTrailing ? "" : "."); - } - - long whole = (long) d; - double fr = d - whole; // fractional part - - if ( (fr >= 1) || (fr < 0)) - { - return exp_format(d); - } - - double factor = 1; - String leading_zeroes = ""; - - for (int i = 1; (i <= precision) && (factor <= 0x7FFFFFFFFFFFFFFFL); - i++) - { - factor *= 10; - leading_zeroes = leading_zeroes + "0"; - } - - long l = (long) ( (factor * fr) + 0.5); - - if (l >= factor) - { - l = 0; - whole++; - } - - // CSH 10-25-97 - String z = leading_zeroes + l; - z = "." + z.substring(z.length() - precision, z.length()); - - if (removeTrailing) - { - int t = z.length() - 1; - - while ( (t >= 0) && (z.charAt(t) == '0')) - { - t--; - } - - if ( (t >= 0) && (z.charAt(t) == '.')) - { - t--; - } - - z = z.substring(0, t + 1); - } - - return whole + z; - } - - /** - * DOCUMENT ME! - * - * @param d DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - private String exp_format(double d) - { - String f = ""; - int e = 0; - double dd = d; - double factor = 1; - - if (d != 0) - { - while (dd > 10) - { - e++; - factor /= 10; - dd = dd / 10; - } - - while (dd < 1) - { - e--; - factor *= 10; - dd = dd * 10; - } - } - - if ( ( (fmt == 'g') || (fmt == 'G')) && (e >= -4) && (e < precision)) - { - return fixed_format(d); - } - - d = d * factor; - f = f + fixed_format(d); - - if ( (fmt == 'e') || (fmt == 'g')) - { - f = f + "e"; - } - else - { - f = f + "E"; - } - - String p = "000"; - - if (e >= 0) - { - f = f + "+"; - p = p + e; - } - else - { - f = f + "-"; - p = p + ( -e); - } - - return f + p.substring(p.length() - 3, p.length()); - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +/** + * A class for formatting numbers that follows printf conventions. + * Also implements C-like atoi and atof functions + * @version 1.03 25 Oct 1997 + * @author Cay Horstmann + */ +package jalview.util; + +/** + * DOCUMENT ME! + * + * @author $author$ + * @version $Revision$ + */ +public class Format +{ + private int width; + private int precision; + private String pre; + private String post; + private boolean leading_zeroes; + private boolean show_plus; + private boolean alternate; + private boolean show_space; + private boolean left_align; + private char fmt; // one of cdeEfgGiosxXos + + /** + * Creates a new Format object. + * + * @param s DOCUMENT ME! + */ + public Format(String s) + { + width = 0; + precision = -1; + pre = ""; + post = ""; + leading_zeroes = false; + show_plus = false; + alternate = false; + show_space = false; + left_align = false; + fmt = ' '; + + int length = s.length(); + int parse_state = 0; + + // 0 = prefix, 1 = flags, 2 = width, 3 = precision, + // 4 = format, 5 = end + int i = 0; + + while (parse_state == 0) + { + if (i >= length) + { + parse_state = 5; + } + else if (s.charAt(i) == '%') + { + if (i < (length - 1)) + { + if (s.charAt(i + 1) == '%') + { + pre = pre + '%'; + i++; + } + else + { + parse_state = 1; + } + } + else + { + throw new java.lang.IllegalArgumentException(); + } + } + else + { + pre = pre + s.charAt(i); + } + + i++; + } + + while (parse_state == 1) + { + if (i >= length) + { + parse_state = 5; + } + else if (s.charAt(i) == ' ') + { + show_space = true; + } + else if (s.charAt(i) == '-') + { + left_align = true; + } + else if (s.charAt(i) == '+') + { + show_plus = true; + } + else if (s.charAt(i) == '0') + { + leading_zeroes = true; + } + else if (s.charAt(i) == '#') + { + alternate = true; + } + else + { + parse_state = 2; + i--; + } + + i++; + } + + while (parse_state == 2) + { + if (i >= length) + { + parse_state = 5; + } + else if ( ('0' <= s.charAt(i)) && (s.charAt(i) <= '9')) + { + width = ( (width * 10) + s.charAt(i)) - '0'; + i++; + } + else if (s.charAt(i) == '.') + { + parse_state = 3; + precision = 0; + i++; + } + else + { + parse_state = 4; + } + } + + while (parse_state == 3) + { + if (i >= length) + { + parse_state = 5; + } + else if ( ('0' <= s.charAt(i)) && (s.charAt(i) <= '9')) + { + precision = ( (precision * 10) + s.charAt(i)) - '0'; + i++; + } + else + { + parse_state = 4; + } + } + + if (parse_state == 4) + { + if (i >= length) + { + parse_state = 5; + } + else + { + fmt = s.charAt(i); + } + + i++; + } + + if (i < length) + { + post = s.substring(i, length); + } + } + + /** + * Formats the number following printf conventions. + * Main limitation: Can only handle one format parameter at a time + * Use multiple Format objects to format more than one number + * @param s the format string following printf conventions + * The string has a prefix, a format code and a suffix. The prefix and suffix + * become part of the formatted output. The format code directs the + * formatting of the (single) parameter to be formatted. The code has the + * following structure + *
    + *
  • a % (required) + *
  • a modifier (optional) + *
    + *
    +
    forces display of + for positive numbers + *
    0
    show leading zeroes + *
    -
    align left in the field + *
    space
    prepend a space in front of positive numbers + *
    #
    use "alternate" format. Add 0 or 0x for octal or hexadecimal numbers. Don't suppress trailing zeroes in general floating point format. + *
    + *
  • an integer denoting field width (optional) + *
  • a period followed by an integer denoting precision (optional) + *
  • a format descriptor (required) + *
    + *
    f
    floating point number in fixed format + *
    e, E
    floating point number in exponential notation (scientific format). The E format results in an uppercase E for the exponent (1.14130E+003), the e format in a lowercase e. + *
    g, G
    floating point number in general format (fixed format for small numbers, exponential format for large numbers). Trailing zeroes are suppressed. The G format results in an uppercase E for the exponent (if any), the g format in a lowercase e. + *
    d, i
    integer in decimal + *
    x
    integer in hexadecimal + *
    o
    integer in octal + *
    s
    string + *
    c
    character + *
    + *
+ * @exception IllegalArgumentException if bad format + * + */ + public static String getHexString(java.awt.Color color) + { + String r; + String g; + String b; + r = Integer.toHexString(color.getRed()); + + if (r.length() < 2) + { + r = "0" + r; + } + + g = Integer.toHexString(color.getGreen()); + + if (g.length() < 2) + { + g = "0" + g; + } + + b = Integer.toHexString(color.getBlue()); + + if (b.length() < 2) + { + b = "0" + b; + } + + return r + g + b; + } + + /** + * prints a formatted number following printf conventions + * @param s a PrintStream + * @param fmt the format string + * @param x the double to print + */ + public static void print(java.io.PrintStream s, String fmt, double x) + { + s.print(new Format(fmt).form(x)); + } + + /** + * prints a formatted number following printf conventions + * @param s a PrintStream + * @param fmt the format string + * @param x the long to print + */ + public static void print(java.io.PrintStream s, String fmt, long x) + { + s.print(new Format(fmt).form(x)); + } + + /** + * prints a formatted number following printf conventions + * @param s a PrintStream + * @param fmt the format string + * @param x the character to + */ + public static void print(java.io.PrintStream s, String fmt, char x) + { + s.print(new Format(fmt).form(x)); + } + + /** + * prints a formatted number following printf conventions + * @param s a PrintStream, fmt the format string + * @param x a string that represents the digits to print + */ + public static void print(java.io.PrintStream s, String fmt, String x) + { + s.print(new Format(fmt).form(x)); + } + + /** + * Converts a string of digits (decimal, octal or hex) to an integer + * @param s a string + * @return the numeric value of the prefix of s representing a base 10 integer + */ + public static int atoi(String s) + { + return (int) atol(s); + } + + /** + * Converts a string of digits (decimal, octal or hex) to a long integer + * @param s a string + * @return the numeric value of the prefix of s representing a base 10 integer + */ + public static long atol(String s) + { + int i = 0; + + while ( (i < s.length()) && Character.isWhitespace(s.charAt(i))) + { + i++; + } + + if ( (i < s.length()) && (s.charAt(i) == '0')) + { + if ( ( (i + 1) < s.length()) && + ( (s.charAt(i + 1) == 'x') || (s.charAt(i + 1) == 'X'))) + { + return parseLong(s.substring(i + 2), 16); + } + else + { + return parseLong(s, 8); + } + } + else + { + return parseLong(s, 10); + } + } + + /** + * DOCUMENT ME! + * + * @param s DOCUMENT ME! + * @param base DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + private static long parseLong(String s, int base) + { + int i = 0; + int sign = 1; + long r = 0; + + while ( (i < s.length()) && Character.isWhitespace(s.charAt(i))) + { + i++; + } + + if ( (i < s.length()) && (s.charAt(i) == '-')) + { + sign = -1; + i++; + } + else if ( (i < s.length()) && (s.charAt(i) == '+')) + { + i++; + } + + while (i < s.length()) + { + char ch = s.charAt(i); + + if ( ('0' <= ch) && (ch < ('0' + base))) + { + r = ( (r * base) + ch) - '0'; + } + else if ( ('A' <= ch) && (ch < ( ('A' + base) - 10))) + { + r = ( (r * base) + ch) - 'A' + 10; + } + else if ( ('a' <= ch) && (ch < ( ('a' + base) - 10))) + { + r = ( (r * base) + ch) - 'a' + 10; + } + else + { + return r * sign; + } + + i++; + } + + return r * sign; + } + + /** + * Converts a string of digits to an double + * @param s a string + */ + public static double atof(String s) + { + int i = 0; + int sign = 1; + double r = 0; // integer part + //double f = 0; // fractional part + double p = 1; // exponent of fractional part + int state = 0; // 0 = int part, 1 = frac part + + while ( (i < s.length()) && Character.isWhitespace(s.charAt(i))) + { + i++; + } + + if ( (i < s.length()) && (s.charAt(i) == '-')) + { + sign = -1; + i++; + } + else if ( (i < s.length()) && (s.charAt(i) == '+')) + { + i++; + } + + while (i < s.length()) + { + char ch = s.charAt(i); + + if ( ('0' <= ch) && (ch <= '9')) + { + if (state == 0) + { + r = ( (r * 10) + ch) - '0'; + } + else if (state == 1) + { + p = p / 10; + r = r + (p * (ch - '0')); + } + } + else if (ch == '.') + { + if (state == 0) + { + state = 1; + } + else + { + return sign * r; + } + } + else if ( (ch == 'e') || (ch == 'E')) + { + long e = (int) parseLong(s.substring(i + 1), 10); + + return sign * r * Math.pow(10, e); + } + else + { + return sign * r; + } + + i++; + } + + return sign * r; + } + + /** + * Formats a double into a string (like sprintf in C) + * @param x the number to format + * @return the formatted string + * @exception IllegalArgumentException if bad argument + */ + public String form(double x) + { + String r; + + if (precision < 0) + { + precision = 6; + } + + int s = 1; + + if (x < 0) + { + x = -x; + s = -1; + } + + if (fmt == 'f') + { + r = fixed_format(x); + } + else if ( (fmt == 'e') || (fmt == 'E') || (fmt == 'g') || (fmt == 'G')) + { + r = exp_format(x); + } + else + { + throw new java.lang.IllegalArgumentException(); + } + + return pad(sign(s, r)); + } + + /** + * Formats a long integer into a string (like sprintf in C) + * @param x the number to format + * @return the formatted string + */ + public String form(long x) + { + String r; + int s = 0; + + if ( (fmt == 'd') || (fmt == 'i')) + { + if (x < 0) + { + r = ("" + x).substring(1); + s = -1; + } + else + { + r = "" + x; + s = 1; + } + } + else if (fmt == 'o') + { + r = convert(x, 3, 7, "01234567"); + } + else if (fmt == 'x') + { + r = convert(x, 4, 15, "0123456789abcdef"); + } + else if (fmt == 'X') + { + r = convert(x, 4, 15, "0123456789ABCDEF"); + } + else + { + throw new java.lang.IllegalArgumentException(); + } + + return pad(sign(s, r)); + } + + /** + * Formats a character into a string (like sprintf in C) + * @param x the value to format + * @return the formatted string + */ + public String form(char c) + { + if (fmt != 'c') + { + throw new java.lang.IllegalArgumentException(); + } + + String r = "" + c; + + return pad(r); + } + + /** + * Formats a string into a larger string (like sprintf in C) + * @param x the value to format + * @return the formatted string + */ + public String form(String s) + { + if (fmt != 's') + { + throw new java.lang.IllegalArgumentException(); + } + + if (precision >= 0) + { + s = s.substring(0, precision); + } + + return pad(s); + } + + /** + * DOCUMENT ME! + * + * @param c DOCUMENT ME! + * @param n DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + private static String repeat(char c, int n) + { + if (n <= 0) + { + return ""; + } + + StringBuffer s = new StringBuffer(n); + + for (int i = 0; i < n; i++) + { + s.append(c); + } + + return s.toString(); + } + + /** + * DOCUMENT ME! + * + * @param x DOCUMENT ME! + * @param n DOCUMENT ME! + * @param m DOCUMENT ME! + * @param d DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + private static String convert(long x, int n, int m, String d) + { + if (x == 0) + { + return "0"; + } + + String r = ""; + + while (x != 0) + { + r = d.charAt( (int) (x & m)) + r; + x = x >>> n; + } + + return r; + } + + /** + * DOCUMENT ME! + * + * @param r DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + private String pad(String r) + { + String p = repeat(' ', width - r.length()); + + if (left_align) + { + return pre + r + p + post; + } + else + { + return pre + p + r + post; + } + } + + /** + * DOCUMENT ME! + * + * @param s DOCUMENT ME! + * @param r DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + private String sign(int s, String r) + { + String p = ""; + + if (s < 0) + { + p = "-"; + } + else if (s > 0) + { + if (show_plus) + { + p = "+"; + } + else if (show_space) + { + p = " "; + } + } + else + { + if ( (fmt == 'o') && alternate && (r.length() > 0) && + (r.charAt(0) != '0')) + { + p = "0"; + } + else if ( (fmt == 'x') && alternate) + { + p = "0x"; + } + else if ( (fmt == 'X') && alternate) + { + p = "0X"; + } + } + + int w = 0; + + if (leading_zeroes) + { + w = width; + } + else if ( ( (fmt == 'd') || (fmt == 'i') || (fmt == 'x') || (fmt == 'X') || + (fmt == 'o')) && (precision > 0)) + { + w = precision; + } + + return p + repeat('0', w - p.length() - r.length()) + r; + } + + /** + * DOCUMENT ME! + * + * @param d DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + private String fixed_format(double d) + { + boolean removeTrailing = ( (fmt == 'G') || (fmt == 'g')) && !alternate; + + // remove trailing zeroes and decimal point + if (d > 0x7FFFFFFFFFFFFFFFL) + { + return exp_format(d); + } + + if (precision == 0) + { + return (long) (d + 0.5) + (removeTrailing ? "" : "."); + } + + long whole = (long) d; + double fr = d - whole; // fractional part + + if ( (fr >= 1) || (fr < 0)) + { + return exp_format(d); + } + + double factor = 1; + String leading_zeroes = ""; + + for (int i = 1; (i <= precision) && (factor <= 0x7FFFFFFFFFFFFFFFL); + i++) + { + factor *= 10; + leading_zeroes = leading_zeroes + "0"; + } + + long l = (long) ( (factor * fr) + 0.5); + + if (l >= factor) + { + l = 0; + whole++; + } + + // CSH 10-25-97 + String z = leading_zeroes + l; + z = "." + z.substring(z.length() - precision, z.length()); + + if (removeTrailing) + { + int t = z.length() - 1; + + while ( (t >= 0) && (z.charAt(t) == '0')) + { + t--; + } + + if ( (t >= 0) && (z.charAt(t) == '.')) + { + t--; + } + + z = z.substring(0, t + 1); + } + + return whole + z; + } + + /** + * DOCUMENT ME! + * + * @param d DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + private String exp_format(double d) + { + String f = ""; + int e = 0; + double dd = d; + double factor = 1; + + if (d != 0) + { + while (dd > 10) + { + e++; + factor /= 10; + dd = dd / 10; + } + + while (dd < 1) + { + e--; + factor *= 10; + dd = dd * 10; + } + } + + if ( ( (fmt == 'g') || (fmt == 'G')) && (e >= -4) && (e < precision)) + { + return fixed_format(d); + } + + d = d * factor; + f = f + fixed_format(d); + + if ( (fmt == 'e') || (fmt == 'g')) + { + f = f + "e"; + } + else + { + f = f + "E"; + } + + String p = "000"; + + if (e >= 0) + { + f = f + "+"; + p = p + e; + } + else + { + f = f + "-"; + p = p + ( -e); + } + + return f + p.substring(p.length() - 3, p.length()); + } +} diff --git a/src/jalview/util/ImageMaker.java b/src/jalview/util/ImageMaker.java index 632c2ad..cec6cc3 100755 --- a/src/jalview/util/ImageMaker.java +++ b/src/jalview/util/ImageMaker.java @@ -1,190 +1,190 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.util; - -import java.io.*; -import javax.imageio.*; - -import java.awt.*; -import java.awt.image.*; - -import org.jibble.epsgraphics.*; -import jalview.gui.*; -import jalview.io.*; - -public class ImageMaker -{ - public static final int EPS = 0; - public static final int PNG = 1; - int type = -1; - - EpsGraphics2D pg; - Graphics graphics; - FileOutputStream out; - BufferedImage bi; - - public ImageMaker(Component parent, int type, String title, - int width, int height, File file, String EPStitle) - { - this.type = type; - - if (file == null) - { - JalviewFileChooser chooser; - chooser = type == EPS ? getEPSChooser() : getPNGChooser(); - - chooser.setFileView(new jalview.io.JalviewFileView()); - chooser.setDialogTitle(title); - chooser.setToolTipText("Save"); - - int value = chooser.showSaveDialog(parent); - - if (value == jalview.io.JalviewFileChooser.APPROVE_OPTION) - { - jalview.bin.Cache.setProperty("LAST_DIRECTORY", - chooser.getSelectedFile().getParent()); - - file = chooser.getSelectedFile(); - } - } - - if (file != null) - { - try - { - out = new FileOutputStream(file); - - if (type == EPS) - { - setupEPS(width, height, EPStitle); - } - else - { - setupPNG(width, height); - } - } - catch (Exception ex) - { - System.out.println("Error creating " + (type == EPS ? "EPS" : "PNG") + - " file."); - } - } - } - - public Graphics getGraphics() - { - return graphics; - } - - void setupPNG(int width, int height) - { - bi = new BufferedImage(width, height, - BufferedImage.TYPE_INT_RGB); - graphics = bi.getGraphics(); - Graphics2D ig2 = (Graphics2D) graphics; - ig2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, - RenderingHints.VALUE_ANTIALIAS_ON); - } - - public void writeImage() - { - try - { - switch (type) - { - case EPS: - pg.flush(); - pg.close(); - break; - case PNG: - ImageIO.write(bi, "png", out); - out.close(); - break; - } - } - catch (Exception ex) - { - ex.printStackTrace(); - } - } - - void setupEPS(int width, int height, String title) - { - boolean accurateText = true; - - String renderStyle = jalview.bin.Cache.getDefault("EPS_RENDERING", - "Prompt each time"); - - // If we need to prompt, and if the GUI is visible then - // Prompt for EPS rendering style - if (renderStyle.equalsIgnoreCase("Prompt each time") - && ! - (System.getProperty("java.awt.headless") != null - && System.getProperty("java.awt.headless").equals("true"))) - { - EPSOptions eps = new EPSOptions(); - renderStyle = eps.getValue(); - - if (renderStyle == null || eps.cancelled) - { - return; - } - } - - if (renderStyle.equalsIgnoreCase("text")) - { - accurateText = false; - } - - try - { - pg = new EpsGraphics2D(title, out, 0, 0, width, - height); - Graphics2D ig2 = (Graphics2D) pg; - ig2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, - RenderingHints.VALUE_ANTIALIAS_ON); - - pg.setAccurateTextMode(accurateText); - - graphics = pg; - } - catch (Exception ex) - {} - } - - JalviewFileChooser getPNGChooser() - { - return new jalview.io.JalviewFileChooser(jalview.bin.Cache.getProperty( - "LAST_DIRECTORY"), new String[] - {"png"}, - new String[] - {"Portable network graphics"}, - "Portable network graphics"); - } - - JalviewFileChooser getEPSChooser() - { - return new jalview.io.JalviewFileChooser(jalview.bin.Cache.getProperty( - "LAST_DIRECTORY"), new String[] - {"eps"}, - new String[] - {"Encapsulated Postscript"}, - "Encapsulated Postscript"); - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.util; + +import java.io.*; +import javax.imageio.*; + +import java.awt.*; +import java.awt.image.*; + +import org.jibble.epsgraphics.*; +import jalview.gui.*; +import jalview.io.*; + +public class ImageMaker +{ + public static final int EPS = 0; + public static final int PNG = 1; + int type = -1; + + EpsGraphics2D pg; + Graphics graphics; + FileOutputStream out; + BufferedImage bi; + + public ImageMaker(Component parent, int type, String title, + int width, int height, File file, String EPStitle) + { + this.type = type; + + if (file == null) + { + JalviewFileChooser chooser; + chooser = type == EPS ? getEPSChooser() : getPNGChooser(); + + chooser.setFileView(new jalview.io.JalviewFileView()); + chooser.setDialogTitle(title); + chooser.setToolTipText("Save"); + + int value = chooser.showSaveDialog(parent); + + if (value == jalview.io.JalviewFileChooser.APPROVE_OPTION) + { + jalview.bin.Cache.setProperty("LAST_DIRECTORY", + chooser.getSelectedFile().getParent()); + + file = chooser.getSelectedFile(); + } + } + + if (file != null) + { + try + { + out = new FileOutputStream(file); + + if (type == EPS) + { + setupEPS(width, height, EPStitle); + } + else + { + setupPNG(width, height); + } + } + catch (Exception ex) + { + System.out.println("Error creating " + (type == EPS ? "EPS" : "PNG") + + " file."); + } + } + } + + public Graphics getGraphics() + { + return graphics; + } + + void setupPNG(int width, int height) + { + bi = new BufferedImage(width, height, + BufferedImage.TYPE_INT_RGB); + graphics = bi.getGraphics(); + Graphics2D ig2 = (Graphics2D) graphics; + ig2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, + RenderingHints.VALUE_ANTIALIAS_ON); + } + + public void writeImage() + { + try + { + switch (type) + { + case EPS: + pg.flush(); + pg.close(); + break; + case PNG: + ImageIO.write(bi, "png", out); + out.close(); + break; + } + } + catch (Exception ex) + { + ex.printStackTrace(); + } + } + + void setupEPS(int width, int height, String title) + { + boolean accurateText = true; + + String renderStyle = jalview.bin.Cache.getDefault("EPS_RENDERING", + "Prompt each time"); + + // If we need to prompt, and if the GUI is visible then + // Prompt for EPS rendering style + if (renderStyle.equalsIgnoreCase("Prompt each time") + && ! + (System.getProperty("java.awt.headless") != null + && System.getProperty("java.awt.headless").equals("true"))) + { + EPSOptions eps = new EPSOptions(); + renderStyle = eps.getValue(); + + if (renderStyle == null || eps.cancelled) + { + return; + } + } + + if (renderStyle.equalsIgnoreCase("text")) + { + accurateText = false; + } + + try + { + pg = new EpsGraphics2D(title, out, 0, 0, width, + height); + Graphics2D ig2 = (Graphics2D) pg; + ig2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, + RenderingHints.VALUE_ANTIALIAS_ON); + + pg.setAccurateTextMode(accurateText); + + graphics = pg; + } + catch (Exception ex) + {} + } + + JalviewFileChooser getPNGChooser() + { + return new jalview.io.JalviewFileChooser(jalview.bin.Cache.getProperty( + "LAST_DIRECTORY"), new String[] + {"png"}, + new String[] + {"Portable network graphics"}, + "Portable network graphics"); + } + + JalviewFileChooser getEPSChooser() + { + return new jalview.io.JalviewFileChooser(jalview.bin.Cache.getProperty( + "LAST_DIRECTORY"), new String[] + {"eps"}, + new String[] + {"Encapsulated Postscript"}, + "Encapsulated Postscript"); + } +} diff --git a/src/jalview/util/MapList.java b/src/jalview/util/MapList.java index 90dfc8c..31c02e8 100644 --- a/src/jalview/util/MapList.java +++ b/src/jalview/util/MapList.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/util/Platform.java b/src/jalview/util/Platform.java index 71ad6f7..b68dd40 100644 --- a/src/jalview/util/Platform.java +++ b/src/jalview/util/Platform.java @@ -1,3 +1,21 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ package jalview.util; /** diff --git a/src/jalview/util/QuickSort.java b/src/jalview/util/QuickSort.java index 017921f..8c3b933 100755 --- a/src/jalview/util/QuickSort.java +++ b/src/jalview/util/QuickSort.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/util/ShiftList.java b/src/jalview/util/ShiftList.java index 8885e2c..9e14172 100644 --- a/src/jalview/util/ShiftList.java +++ b/src/jalview/util/ShiftList.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/util/TableSorter.java b/src/jalview/util/TableSorter.java index 469bd7f..f51417f 100755 --- a/src/jalview/util/TableSorter.java +++ b/src/jalview/util/TableSorter.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/util/UrlLink.java b/src/jalview/util/UrlLink.java index 21dee38..ac70ae2 100644 --- a/src/jalview/util/UrlLink.java +++ b/src/jalview/util/UrlLink.java @@ -1,3 +1,21 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ package jalview.util; import java.util.Vector; diff --git a/src/jalview/ws/DBRefFetcher.java b/src/jalview/ws/DBRefFetcher.java index 82b411a..a67599b 100644 --- a/src/jalview/ws/DBRefFetcher.java +++ b/src/jalview/ws/DBRefFetcher.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/ws/DasSequenceFeatureFetcher.java b/src/jalview/ws/DasSequenceFeatureFetcher.java index e3f7478..815ecda 100644 --- a/src/jalview/ws/DasSequenceFeatureFetcher.java +++ b/src/jalview/ws/DasSequenceFeatureFetcher.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/ws/Discoverer.java b/src/jalview/ws/Discoverer.java index 61b8ba1..5508eef 100755 --- a/src/jalview/ws/Discoverer.java +++ b/src/jalview/ws/Discoverer.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/ws/JPredClient.java b/src/jalview/ws/JPredClient.java index e14816c..49a7567 100755 --- a/src/jalview/ws/JPredClient.java +++ b/src/jalview/ws/JPredClient.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/ws/JPredThread.java b/src/jalview/ws/JPredThread.java index 106bb53..418e45e 100644 --- a/src/jalview/ws/JPredThread.java +++ b/src/jalview/ws/JPredThread.java @@ -1,3 +1,21 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ package jalview.ws; import java.util.*; diff --git a/src/jalview/ws/MsaWSClient.java b/src/jalview/ws/MsaWSClient.java index 63e60d7..a461abb 100755 --- a/src/jalview/ws/MsaWSClient.java +++ b/src/jalview/ws/MsaWSClient.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/ws/MsaWSThread.java b/src/jalview/ws/MsaWSThread.java index 8d373ac..9706c18 100644 --- a/src/jalview/ws/MsaWSThread.java +++ b/src/jalview/ws/MsaWSThread.java @@ -1,721 +1,721 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.ws; - -import java.util.*; - -import jalview.analysis.*; -import jalview.bin.*; -import jalview.datamodel.*; -import jalview.datamodel.Alignment; -import jalview.gui.*; -import vamsas.objects.simple.MsaResult; - -/** - *

- * Title: - *

- * - *

- * Description: - *

- * - *

- * Copyright: Copyright (c) 2004 - *

- * - *

- * Company: Dundee University - *

- * - * @author not attributable - * @version 1.0 - */ -class MsaWSThread - extends WSThread implements WSClientI -{ - boolean submitGaps = false; // pass sequences including gaps to alignment - - // service - - boolean preserveOrder = true; // and always store and recover sequence - - // order - - class MsaWSJob - extends WSThread.WSJob - { - // hold special input for this - vamsas.objects.simple.SequenceSet seqs = new vamsas.objects.simple. - SequenceSet(); - - /** - * MsaWSJob - * - * @param jobNum - * int - * @param jobId - * String - */ - public MsaWSJob(int jobNum, SequenceI[] inSeqs) - { - this.jobnum = jobNum; - if (!prepareInput(inSeqs, 2)) - { - submitted = true; - subjobComplete = true; - result = new MsaResult(); - result.setFinished(true); - result.setStatus("Job never ran - input returned to user."); - } - - } - - Hashtable SeqNames = new Hashtable(); - Vector emptySeqs = new Vector(); - /** - * prepare input sequences for MsaWS service - * @param seqs jalview sequences to be prepared - * @param minlen minimum number of residues required for this MsaWS service - * @return true if seqs contains sequences to be submitted to service. - */ - private boolean prepareInput(SequenceI[] seqs, int minlen) - { - int nseqs = 0; - if (minlen < 0) - { - throw new Error("Implementation error: minlen must be zero or more."); - } - for (int i = 0; i < seqs.length; i++) - { - if (seqs[i].getEnd() - seqs[i].getStart() > minlen - 1) - { - nseqs++; - } - } - boolean valid = nseqs > 1; // need at least two seqs - vamsas.objects.simple.Sequence[] seqarray = - (valid) - ? new vamsas.objects.simple.Sequence[nseqs] - : null; - for (int i = 0, n = 0; i < seqs.length; i++) - { - - String newname = jalview.analysis.SeqsetUtils.unique_name(i); // same - // for - // any - // subjob - SeqNames.put(newname, jalview.analysis.SeqsetUtils - .SeqCharacterHash(seqs[i])); - if (valid && seqs[i].getEnd() - seqs[i].getStart() > minlen - 1) - { - seqarray[n] = new vamsas.objects.simple.Sequence(); - seqarray[n].setId(newname); - seqarray[n++].setSeq( (submitGaps) ? seqs[i].getSequenceAsString() - : AlignSeq.extractGaps( - jalview.util.Comparison.GapChars, seqs[i] - .getSequenceAsString())); - } - else - { - String empty = null; - if (seqs[i].getEnd() >= seqs[i].getStart()) - { - empty = (submitGaps) ? seqs[i].getSequenceAsString() - : AlignSeq.extractGaps( - jalview.util.Comparison.GapChars, seqs[i] - .getSequenceAsString()); - } - emptySeqs.add(new String[] - {newname, empty}); - } - } - this.seqs = new vamsas.objects.simple.SequenceSet(); - this.seqs.setSeqs(seqarray); - return valid; - } - - /** - * - * @return true if getAlignment will return a valid alignment result. - */ - public boolean hasResults() - { - if (subjobComplete && result != null && result.isFinished() - && ( (MsaResult) result).getMsa() != null && - ( (MsaResult) result).getMsa().getSeqs() != null) - { - return true; - } - return false; - } - - public Object[] getAlignment() - { - - if (result != null && result.isFinished()) - { - SequenceI[] alseqs = null; - char alseq_gapchar = '-'; - int alseq_l = 0; - if ( ( (MsaResult) result).getMsa() != null) - { - alseqs = getVamsasAlignment( ( (MsaResult) result).getMsa()); - alseq_gapchar = ( (MsaResult) result).getMsa().getGapchar().charAt(0); - alseq_l = alseqs.length; - } - if (emptySeqs.size() > 0) - { - SequenceI[] t_alseqs = new SequenceI[alseq_l + emptySeqs.size()]; - // get width - int i, w = 0; - if (alseq_l > 0) - { - for (i = 0, w = alseqs[0].getLength(); i < alseq_l; i++) - { - if (w < alseqs[i].getLength()) - { - w = alseqs[i].getLength(); - } - t_alseqs[i] = alseqs[i]; - alseqs[i] = null; - } - } - // check that aligned width is at least as wide as emptySeqs width. - int ow = w, nw = w; - for (i = 0, w = emptySeqs.size(); i < w; i++) - { - String[] es = (String[]) emptySeqs.get(i); - if (es != null && es[1] != null) - { - int sw = es[1].length(); - if (nw < sw) - { - nw = sw; - } - } - } - // make a gapped string. - StringBuffer insbuff = new StringBuffer(w); - for (i = 0; i < nw; i++) - { - insbuff.append(alseq_gapchar); - } - if (ow < nw) - { - for (i = 0; i < alseq_l; i++) - { - int sw = t_alseqs[i].getLength(); - if (nw > sw) - { - // pad at end - alseqs[i].setSequence(t_alseqs[i].getSequenceAsString() + - insbuff.substring(0, sw - nw)); - } - } - } - for (i = 0, w = emptySeqs.size(); i < w; i++) - { - String[] es = (String[]) emptySeqs.get(i); - if (es[1] == null) - { - t_alseqs[i + - alseq_l] = new jalview.datamodel.Sequence(es[0], - insbuff.toString(), 1, 0); - } - else - { - if (es[1].length() < nw) - { - t_alseqs[i + - alseq_l] = new jalview.datamodel.Sequence(es[0], - es[1] + insbuff.substring(0, nw - es[1].length()), 1, - 1 + es[1].length()); - } - else - { - t_alseqs[i + - alseq_l] = new jalview.datamodel.Sequence(es[0], es[1]); - } - } - } - alseqs = t_alseqs; - } - AlignmentOrder msaorder = new AlignmentOrder(alseqs); - // always recover the order - makes parseResult()'s life easier. - jalview.analysis.AlignmentSorter.recoverOrder(alseqs); - // account for any missing sequences - jalview.analysis.SeqsetUtils.deuniquify(SeqNames, alseqs); - return new Object[] - { - alseqs, msaorder}; - } - return null; - } - - /** - * mark subjob as cancelled and set result object appropriatly - */ - void cancel() - { - cancelled = true; - subjobComplete = true; - result = null; - } - - /** - * - * @return boolean true if job can be submitted. - */ - boolean hasValidInput() - { - if (seqs.getSeqs() != null) - { - return true; - } - return false; - } - } - - String alTitle; // name which will be used to form new alignment window. - Alignment dataset; // dataset to which the new alignment will be - - // associated. - - ext.vamsas.MuscleWS server = null; - /** - * set basic options for this (group) of Msa jobs - * - * @param subgaps - * boolean - * @param presorder - * boolean - */ - MsaWSThread(ext.vamsas.MuscleWS server, String wsUrl, - WebserviceInfo wsinfo, jalview.gui.AlignFrame alFrame, - AlignmentView alview, - String wsname, boolean subgaps, boolean presorder) - { - super(alFrame, wsinfo, alview, wsname, wsUrl); - this.server = server; - this.submitGaps = subgaps; - this.preserveOrder = presorder; - } - - /** - * create one or more Msa jobs to align visible seuqences in _msa - * - * @param title - * String - * @param _msa - * AlignmentView - * @param subgaps - * boolean - * @param presorder - * boolean - * @param seqset - * Alignment - */ - MsaWSThread(ext.vamsas.MuscleWS server, String wsUrl, - WebserviceInfo wsinfo, jalview.gui.AlignFrame alFrame, - String wsname, String title, AlignmentView _msa, boolean subgaps, - boolean presorder, Alignment seqset) - { - this(server, wsUrl, wsinfo, alFrame, _msa, wsname, subgaps, presorder); - OutputHeader = wsInfo.getProgressText(); - alTitle = title; - dataset = seqset; - - SequenceI[][] conmsa = _msa.getVisibleContigs('-'); - if (conmsa != null) - { - int njobs = conmsa.length; - jobs = new MsaWSJob[njobs]; - for (int j = 0; j < njobs; j++) - { - if (j != 0) - { - jobs[j] = new MsaWSJob(wsinfo.addJobPane(), conmsa[j]); - } - else - { - jobs[j] = new MsaWSJob(0, conmsa[j]); - } - if (njobs > 0) - { - wsinfo.setProgressName("region " + jobs[j].jobnum, jobs[j].jobnum); - } - wsinfo.setProgressText(jobs[j].jobnum, OutputHeader); - } - } - } - - public boolean isCancellable() - { - return true; - } - - public void cancelJob() - { - if (!jobComplete && jobs != null) - { - boolean cancelled = true; - for (int job = 0; job < jobs.length; job++) - { - if (jobs[job].submitted && !jobs[job].subjobComplete) - { - String cancelledMessage = ""; - try - { - vamsas.objects.simple.WsJobId cancelledJob = server - .cancel(jobs[job].jobId); - if (cancelledJob.getStatus() == 2) - { - // CANCELLED_JOB - cancelledMessage = "Job cancelled."; - ( (MsaWSJob) jobs[job]).cancel(); - wsInfo.setStatus(jobs[job].jobnum, - WebserviceInfo.STATE_CANCELLED_OK); - } - else if (cancelledJob.getStatus() == 3) - { - // VALID UNSTOPPABLE JOB - cancelledMessage += - "Server cannot cancel this job. just close the window.\n"; - cancelled = false; - // wsInfo.setStatus(jobs[job].jobnum, - // WebserviceInfo.STATE_RUNNING); - } - - if (cancelledJob.getJobId() != null) - { - cancelledMessage += ("[" + cancelledJob.getJobId() + "]"); - } - - cancelledMessage += "\n"; - } - catch (Exception exc) - { - cancelledMessage += - ("\nProblems cancelling the job : Exception received...\n" - + exc + "\n"); - Cache.log.warn("Exception whilst cancelling " + jobs[job].jobId, - exc); - } - wsInfo.setProgressText(jobs[job].jobnum, OutputHeader - + cancelledMessage + "\n"); - } - } - if (cancelled) - { - wsInfo.setStatus(WebserviceInfo.STATE_CANCELLED_OK); - jobComplete = true; - } - this.interrupt(); // kick thread to update job states. - } - else - { - if (!jobComplete) - { - wsInfo - .setProgressText(OutputHeader - + "Server cannot cancel this job because it has not been submitted properly. just close the window.\n"); - } - } - } - - void pollJob(WSJob job) - throws Exception - { - ( (MsaWSJob) job).result = server.getResult( ( (MsaWSJob) job).jobId); - } - - void StartJob(WSJob job) - { - if (! (job instanceof MsaWSJob)) - { - throw new Error("StartJob(MsaWSJob) called on a WSJobInstance " + - job.getClass()); - } - MsaWSJob j = (MsaWSJob) job; - if (j.submitted) - { - if (Cache.log.isDebugEnabled()) - { - Cache.log.debug("Tried to submit an already submitted job " + j.jobId); - } - return; - } - if (j.seqs.getSeqs() == null) - { - // special case - selection consisted entirely of empty sequences... - j.submitted = true; - j.result = new MsaResult(); - j.result.setFinished(true); - j.result.setStatus("Empty Alignment Job"); - ( (MsaResult) j.result).setMsa(null); - } - try - { - vamsas.objects.simple.WsJobId jobsubmit = server.align(j.seqs); - - if ( (jobsubmit != null) && (jobsubmit.getStatus() == 1)) - { - j.jobId = jobsubmit.getJobId(); - j.submitted = true; - j.subjobComplete = false; - // System.out.println(WsURL + " Job Id '" + jobId + "'"); - } - else - { - if (jobsubmit == null) - { - throw new Exception( - "Server at " - + WsUrl - + - " returned null object, it probably cannot be contacted. Try again later ?"); - } - - throw new Exception(jobsubmit.getJobId()); - } - } - catch (Exception e) - { - // TODO: JBPNote catch timeout or other fault types explicitly - // For unexpected errors - System.err - .println(WebServiceName - + "Client: Failed to submit the sequences for alignment (probably a server side problem)\n" - + "When contacting Server:" + WsUrl + "\n" - + e.toString() + "\n"); - j.allowedServerExceptions = 0; - wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_SERVERERROR); - wsInfo.setStatus(j.jobnum, WebserviceInfo.STATE_STOPPED_SERVERERROR); - wsInfo - .appendProgressText( - j.jobnum, - "Failed to submit sequences for alignment.\n" - + "It is most likely that there is a problem with the server.\n" - + "Just close the window\n"); - - // e.printStackTrace(); // TODO: JBPNote DEBUG - } - } - - private jalview.datamodel.Sequence[] getVamsasAlignment( - vamsas.objects.simple.Alignment valign) - { - // TODO: refactor to helper class for vamsas.objects.simple objects - vamsas.objects.simple.Sequence[] seqs = valign.getSeqs().getSeqs(); - jalview.datamodel.Sequence[] msa = new jalview.datamodel.Sequence[seqs. - length]; - - for (int i = 0, j = seqs.length; i < j; i++) - { - msa[i] = new jalview.datamodel.Sequence(seqs[i].getId(), seqs[i] - .getSeq()); - } - - return msa; - } - - void parseResult() - { - int results = 0; // number of result sets received - JobStateSummary finalState = new JobStateSummary(); - try - { - for (int j = 0; j < jobs.length; j++) - { - finalState.updateJobPanelState(wsInfo, OutputHeader, jobs[j]); - if (jobs[j].submitted && jobs[j].subjobComplete && jobs[j].hasResults()) - { - results++; - vamsas.objects.simple.Alignment valign = ( (MsaResult) jobs[j].result). - getMsa(); - if (valign != null) - { - wsInfo.appendProgressText(jobs[j].jobnum, - "\nAlignment Object Method Notes\n"); - String[] lines = valign.getMethod(); - for (int line = 0; line < lines.length; line++) - { - wsInfo.appendProgressText(jobs[j].jobnum, lines[line] + "\n"); - } - // JBPNote The returned files from a webservice could be - // hidden behind icons in the monitor window that, - // when clicked, pop up their corresponding data - } - } - } - } - catch (Exception ex) - { - - Cache.log.error("Unexpected exception when processing results for " + - alTitle, ex); - wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR); - } - if (results > 0) - { - wsInfo.showResultsNewFrame - .addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed( - java.awt.event.ActionEvent evt) - { - displayResults(true); - } - }); - wsInfo.mergeResults - .addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed( - java.awt.event.ActionEvent evt) - { - displayResults(false); - } - }); - wsInfo.setResultsReady(); - } - else - { - wsInfo.setFinishedNoResults(); - } - } - - void displayResults(boolean newFrame) - { - // view input or result data for each block - Vector alorders = new Vector(); - SequenceI[][] results = new SequenceI[jobs.length][]; - AlignmentOrder[] orders = new AlignmentOrder[jobs.length]; - for (int j = 0; j < jobs.length; j++) - { - if (jobs[j].hasResults()) - { - Object[] res = ( (MsaWSJob) jobs[j]).getAlignment(); - alorders.add(res[1]); - results[j] = (SequenceI[]) res[0]; - orders[j] = (AlignmentOrder) res[1]; - -// SequenceI[] alignment = input.getUpdated - } - else - { - results[j] = null; - } - } - Object[] newview = input.getUpdatedView(results, orders, getGapChar()); - // trash references to original result data - for (int j = 0; j < jobs.length; j++) - { - results[j] = null; - orders[j] = null; - } - SequenceI[] alignment = (SequenceI[]) newview[0]; - ColumnSelection columnselection = (ColumnSelection) newview[1]; - Alignment al = new Alignment(alignment); - // TODO: add 'provenance' property to alignment from the method notes accompanying each subjob - if (dataset != null) - { - al.setDataset(dataset); - } - - propagateDatasetMappings(al); - // JBNote- TODO: warn user if a block is input rather than aligned data ? - - if (newFrame) - { - AlignFrame af = new AlignFrame(al, columnselection, - AlignFrame.DEFAULT_WIDTH, - AlignFrame.DEFAULT_HEIGHT); - - // initialise with same renderer settings as in parent alignframe. - af.getFeatureRenderer().transferSettings( - this.featureSettings); - // update orders - if (alorders.size() > 0) - { - if (alorders.size() == 1) - { - af.addSortByOrderMenuItem(WebServiceName + " Ordering", - (AlignmentOrder) alorders.get(0)); - } - else - { - // construct a non-redundant ordering set - Vector names = new Vector(); - for (int i = 0, l = alorders.size(); i < l; i++) - { - String orderName = new String(" Region " + i); - int j = i + 1; - - while (j < l) - { - if ( ( (AlignmentOrder) alorders.get(i)).equals( ( ( - AlignmentOrder) alorders.get(j)))) - { - alorders.remove(j); - l--; - orderName += "," + j; - } - else - { - j++; - } - } - - if (i == 0 && j == 1) - { - names.add(new String("")); - } - else - { - names.add(orderName); - } - } - for (int i = 0, l = alorders.size(); i < l; i++) - { - af.addSortByOrderMenuItem(WebServiceName - + ( (String) names.get(i)) + - " Ordering", - (AlignmentOrder) alorders.get(i)); - } - } - } - - Desktop.addInternalFrame(af, alTitle, - AlignFrame.DEFAULT_WIDTH, - AlignFrame.DEFAULT_HEIGHT); - - } - else - { - System.out.println("MERGE WITH OLD FRAME"); - // TODO: modify alignment in original frame, replacing old for new alignment using the commands.EditCommand model to ensure the update can be undone - } - } - - public boolean canMergeResults() - { - return false; - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.ws; + +import java.util.*; + +import jalview.analysis.*; +import jalview.bin.*; +import jalview.datamodel.*; +import jalview.datamodel.Alignment; +import jalview.gui.*; +import vamsas.objects.simple.MsaResult; + +/** + *

+ * Title: + *

+ * + *

+ * Description: + *

+ * + *

+ * Copyright: Copyright (c) 2004 + *

+ * + *

+ * Company: Dundee University + *

+ * + * @author not attributable + * @version 1.0 + */ +class MsaWSThread + extends WSThread implements WSClientI +{ + boolean submitGaps = false; // pass sequences including gaps to alignment + + // service + + boolean preserveOrder = true; // and always store and recover sequence + + // order + + class MsaWSJob + extends WSThread.WSJob + { + // hold special input for this + vamsas.objects.simple.SequenceSet seqs = new vamsas.objects.simple. + SequenceSet(); + + /** + * MsaWSJob + * + * @param jobNum + * int + * @param jobId + * String + */ + public MsaWSJob(int jobNum, SequenceI[] inSeqs) + { + this.jobnum = jobNum; + if (!prepareInput(inSeqs, 2)) + { + submitted = true; + subjobComplete = true; + result = new MsaResult(); + result.setFinished(true); + result.setStatus("Job never ran - input returned to user."); + } + + } + + Hashtable SeqNames = new Hashtable(); + Vector emptySeqs = new Vector(); + /** + * prepare input sequences for MsaWS service + * @param seqs jalview sequences to be prepared + * @param minlen minimum number of residues required for this MsaWS service + * @return true if seqs contains sequences to be submitted to service. + */ + private boolean prepareInput(SequenceI[] seqs, int minlen) + { + int nseqs = 0; + if (minlen < 0) + { + throw new Error("Implementation error: minlen must be zero or more."); + } + for (int i = 0; i < seqs.length; i++) + { + if (seqs[i].getEnd() - seqs[i].getStart() > minlen - 1) + { + nseqs++; + } + } + boolean valid = nseqs > 1; // need at least two seqs + vamsas.objects.simple.Sequence[] seqarray = + (valid) + ? new vamsas.objects.simple.Sequence[nseqs] + : null; + for (int i = 0, n = 0; i < seqs.length; i++) + { + + String newname = jalview.analysis.SeqsetUtils.unique_name(i); // same + // for + // any + // subjob + SeqNames.put(newname, jalview.analysis.SeqsetUtils + .SeqCharacterHash(seqs[i])); + if (valid && seqs[i].getEnd() - seqs[i].getStart() > minlen - 1) + { + seqarray[n] = new vamsas.objects.simple.Sequence(); + seqarray[n].setId(newname); + seqarray[n++].setSeq( (submitGaps) ? seqs[i].getSequenceAsString() + : AlignSeq.extractGaps( + jalview.util.Comparison.GapChars, seqs[i] + .getSequenceAsString())); + } + else + { + String empty = null; + if (seqs[i].getEnd() >= seqs[i].getStart()) + { + empty = (submitGaps) ? seqs[i].getSequenceAsString() + : AlignSeq.extractGaps( + jalview.util.Comparison.GapChars, seqs[i] + .getSequenceAsString()); + } + emptySeqs.add(new String[] + {newname, empty}); + } + } + this.seqs = new vamsas.objects.simple.SequenceSet(); + this.seqs.setSeqs(seqarray); + return valid; + } + + /** + * + * @return true if getAlignment will return a valid alignment result. + */ + public boolean hasResults() + { + if (subjobComplete && result != null && result.isFinished() + && ( (MsaResult) result).getMsa() != null && + ( (MsaResult) result).getMsa().getSeqs() != null) + { + return true; + } + return false; + } + + public Object[] getAlignment() + { + + if (result != null && result.isFinished()) + { + SequenceI[] alseqs = null; + char alseq_gapchar = '-'; + int alseq_l = 0; + if ( ( (MsaResult) result).getMsa() != null) + { + alseqs = getVamsasAlignment( ( (MsaResult) result).getMsa()); + alseq_gapchar = ( (MsaResult) result).getMsa().getGapchar().charAt(0); + alseq_l = alseqs.length; + } + if (emptySeqs.size() > 0) + { + SequenceI[] t_alseqs = new SequenceI[alseq_l + emptySeqs.size()]; + // get width + int i, w = 0; + if (alseq_l > 0) + { + for (i = 0, w = alseqs[0].getLength(); i < alseq_l; i++) + { + if (w < alseqs[i].getLength()) + { + w = alseqs[i].getLength(); + } + t_alseqs[i] = alseqs[i]; + alseqs[i] = null; + } + } + // check that aligned width is at least as wide as emptySeqs width. + int ow = w, nw = w; + for (i = 0, w = emptySeqs.size(); i < w; i++) + { + String[] es = (String[]) emptySeqs.get(i); + if (es != null && es[1] != null) + { + int sw = es[1].length(); + if (nw < sw) + { + nw = sw; + } + } + } + // make a gapped string. + StringBuffer insbuff = new StringBuffer(w); + for (i = 0; i < nw; i++) + { + insbuff.append(alseq_gapchar); + } + if (ow < nw) + { + for (i = 0; i < alseq_l; i++) + { + int sw = t_alseqs[i].getLength(); + if (nw > sw) + { + // pad at end + alseqs[i].setSequence(t_alseqs[i].getSequenceAsString() + + insbuff.substring(0, sw - nw)); + } + } + } + for (i = 0, w = emptySeqs.size(); i < w; i++) + { + String[] es = (String[]) emptySeqs.get(i); + if (es[1] == null) + { + t_alseqs[i + + alseq_l] = new jalview.datamodel.Sequence(es[0], + insbuff.toString(), 1, 0); + } + else + { + if (es[1].length() < nw) + { + t_alseqs[i + + alseq_l] = new jalview.datamodel.Sequence(es[0], + es[1] + insbuff.substring(0, nw - es[1].length()), 1, + 1 + es[1].length()); + } + else + { + t_alseqs[i + + alseq_l] = new jalview.datamodel.Sequence(es[0], es[1]); + } + } + } + alseqs = t_alseqs; + } + AlignmentOrder msaorder = new AlignmentOrder(alseqs); + // always recover the order - makes parseResult()'s life easier. + jalview.analysis.AlignmentSorter.recoverOrder(alseqs); + // account for any missing sequences + jalview.analysis.SeqsetUtils.deuniquify(SeqNames, alseqs); + return new Object[] + { + alseqs, msaorder}; + } + return null; + } + + /** + * mark subjob as cancelled and set result object appropriatly + */ + void cancel() + { + cancelled = true; + subjobComplete = true; + result = null; + } + + /** + * + * @return boolean true if job can be submitted. + */ + boolean hasValidInput() + { + if (seqs.getSeqs() != null) + { + return true; + } + return false; + } + } + + String alTitle; // name which will be used to form new alignment window. + Alignment dataset; // dataset to which the new alignment will be + + // associated. + + ext.vamsas.MuscleWS server = null; + /** + * set basic options for this (group) of Msa jobs + * + * @param subgaps + * boolean + * @param presorder + * boolean + */ + MsaWSThread(ext.vamsas.MuscleWS server, String wsUrl, + WebserviceInfo wsinfo, jalview.gui.AlignFrame alFrame, + AlignmentView alview, + String wsname, boolean subgaps, boolean presorder) + { + super(alFrame, wsinfo, alview, wsname, wsUrl); + this.server = server; + this.submitGaps = subgaps; + this.preserveOrder = presorder; + } + + /** + * create one or more Msa jobs to align visible seuqences in _msa + * + * @param title + * String + * @param _msa + * AlignmentView + * @param subgaps + * boolean + * @param presorder + * boolean + * @param seqset + * Alignment + */ + MsaWSThread(ext.vamsas.MuscleWS server, String wsUrl, + WebserviceInfo wsinfo, jalview.gui.AlignFrame alFrame, + String wsname, String title, AlignmentView _msa, boolean subgaps, + boolean presorder, Alignment seqset) + { + this(server, wsUrl, wsinfo, alFrame, _msa, wsname, subgaps, presorder); + OutputHeader = wsInfo.getProgressText(); + alTitle = title; + dataset = seqset; + + SequenceI[][] conmsa = _msa.getVisibleContigs('-'); + if (conmsa != null) + { + int njobs = conmsa.length; + jobs = new MsaWSJob[njobs]; + for (int j = 0; j < njobs; j++) + { + if (j != 0) + { + jobs[j] = new MsaWSJob(wsinfo.addJobPane(), conmsa[j]); + } + else + { + jobs[j] = new MsaWSJob(0, conmsa[j]); + } + if (njobs > 0) + { + wsinfo.setProgressName("region " + jobs[j].jobnum, jobs[j].jobnum); + } + wsinfo.setProgressText(jobs[j].jobnum, OutputHeader); + } + } + } + + public boolean isCancellable() + { + return true; + } + + public void cancelJob() + { + if (!jobComplete && jobs != null) + { + boolean cancelled = true; + for (int job = 0; job < jobs.length; job++) + { + if (jobs[job].submitted && !jobs[job].subjobComplete) + { + String cancelledMessage = ""; + try + { + vamsas.objects.simple.WsJobId cancelledJob = server + .cancel(jobs[job].jobId); + if (cancelledJob.getStatus() == 2) + { + // CANCELLED_JOB + cancelledMessage = "Job cancelled."; + ( (MsaWSJob) jobs[job]).cancel(); + wsInfo.setStatus(jobs[job].jobnum, + WebserviceInfo.STATE_CANCELLED_OK); + } + else if (cancelledJob.getStatus() == 3) + { + // VALID UNSTOPPABLE JOB + cancelledMessage += + "Server cannot cancel this job. just close the window.\n"; + cancelled = false; + // wsInfo.setStatus(jobs[job].jobnum, + // WebserviceInfo.STATE_RUNNING); + } + + if (cancelledJob.getJobId() != null) + { + cancelledMessage += ("[" + cancelledJob.getJobId() + "]"); + } + + cancelledMessage += "\n"; + } + catch (Exception exc) + { + cancelledMessage += + ("\nProblems cancelling the job : Exception received...\n" + + exc + "\n"); + Cache.log.warn("Exception whilst cancelling " + jobs[job].jobId, + exc); + } + wsInfo.setProgressText(jobs[job].jobnum, OutputHeader + + cancelledMessage + "\n"); + } + } + if (cancelled) + { + wsInfo.setStatus(WebserviceInfo.STATE_CANCELLED_OK); + jobComplete = true; + } + this.interrupt(); // kick thread to update job states. + } + else + { + if (!jobComplete) + { + wsInfo + .setProgressText(OutputHeader + + "Server cannot cancel this job because it has not been submitted properly. just close the window.\n"); + } + } + } + + void pollJob(WSJob job) + throws Exception + { + ( (MsaWSJob) job).result = server.getResult( ( (MsaWSJob) job).jobId); + } + + void StartJob(WSJob job) + { + if (! (job instanceof MsaWSJob)) + { + throw new Error("StartJob(MsaWSJob) called on a WSJobInstance " + + job.getClass()); + } + MsaWSJob j = (MsaWSJob) job; + if (j.submitted) + { + if (Cache.log.isDebugEnabled()) + { + Cache.log.debug("Tried to submit an already submitted job " + j.jobId); + } + return; + } + if (j.seqs.getSeqs() == null) + { + // special case - selection consisted entirely of empty sequences... + j.submitted = true; + j.result = new MsaResult(); + j.result.setFinished(true); + j.result.setStatus("Empty Alignment Job"); + ( (MsaResult) j.result).setMsa(null); + } + try + { + vamsas.objects.simple.WsJobId jobsubmit = server.align(j.seqs); + + if ( (jobsubmit != null) && (jobsubmit.getStatus() == 1)) + { + j.jobId = jobsubmit.getJobId(); + j.submitted = true; + j.subjobComplete = false; + // System.out.println(WsURL + " Job Id '" + jobId + "'"); + } + else + { + if (jobsubmit == null) + { + throw new Exception( + "Server at " + + WsUrl + + + " returned null object, it probably cannot be contacted. Try again later ?"); + } + + throw new Exception(jobsubmit.getJobId()); + } + } + catch (Exception e) + { + // TODO: JBPNote catch timeout or other fault types explicitly + // For unexpected errors + System.err + .println(WebServiceName + + "Client: Failed to submit the sequences for alignment (probably a server side problem)\n" + + "When contacting Server:" + WsUrl + "\n" + + e.toString() + "\n"); + j.allowedServerExceptions = 0; + wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_SERVERERROR); + wsInfo.setStatus(j.jobnum, WebserviceInfo.STATE_STOPPED_SERVERERROR); + wsInfo + .appendProgressText( + j.jobnum, + "Failed to submit sequences for alignment.\n" + + "It is most likely that there is a problem with the server.\n" + + "Just close the window\n"); + + // e.printStackTrace(); // TODO: JBPNote DEBUG + } + } + + private jalview.datamodel.Sequence[] getVamsasAlignment( + vamsas.objects.simple.Alignment valign) + { + // TODO: refactor to helper class for vamsas.objects.simple objects + vamsas.objects.simple.Sequence[] seqs = valign.getSeqs().getSeqs(); + jalview.datamodel.Sequence[] msa = new jalview.datamodel.Sequence[seqs. + length]; + + for (int i = 0, j = seqs.length; i < j; i++) + { + msa[i] = new jalview.datamodel.Sequence(seqs[i].getId(), seqs[i] + .getSeq()); + } + + return msa; + } + + void parseResult() + { + int results = 0; // number of result sets received + JobStateSummary finalState = new JobStateSummary(); + try + { + for (int j = 0; j < jobs.length; j++) + { + finalState.updateJobPanelState(wsInfo, OutputHeader, jobs[j]); + if (jobs[j].submitted && jobs[j].subjobComplete && jobs[j].hasResults()) + { + results++; + vamsas.objects.simple.Alignment valign = ( (MsaResult) jobs[j].result). + getMsa(); + if (valign != null) + { + wsInfo.appendProgressText(jobs[j].jobnum, + "\nAlignment Object Method Notes\n"); + String[] lines = valign.getMethod(); + for (int line = 0; line < lines.length; line++) + { + wsInfo.appendProgressText(jobs[j].jobnum, lines[line] + "\n"); + } + // JBPNote The returned files from a webservice could be + // hidden behind icons in the monitor window that, + // when clicked, pop up their corresponding data + } + } + } + } + catch (Exception ex) + { + + Cache.log.error("Unexpected exception when processing results for " + + alTitle, ex); + wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR); + } + if (results > 0) + { + wsInfo.showResultsNewFrame + .addActionListener(new java.awt.event.ActionListener() + { + public void actionPerformed( + java.awt.event.ActionEvent evt) + { + displayResults(true); + } + }); + wsInfo.mergeResults + .addActionListener(new java.awt.event.ActionListener() + { + public void actionPerformed( + java.awt.event.ActionEvent evt) + { + displayResults(false); + } + }); + wsInfo.setResultsReady(); + } + else + { + wsInfo.setFinishedNoResults(); + } + } + + void displayResults(boolean newFrame) + { + // view input or result data for each block + Vector alorders = new Vector(); + SequenceI[][] results = new SequenceI[jobs.length][]; + AlignmentOrder[] orders = new AlignmentOrder[jobs.length]; + for (int j = 0; j < jobs.length; j++) + { + if (jobs[j].hasResults()) + { + Object[] res = ( (MsaWSJob) jobs[j]).getAlignment(); + alorders.add(res[1]); + results[j] = (SequenceI[]) res[0]; + orders[j] = (AlignmentOrder) res[1]; + +// SequenceI[] alignment = input.getUpdated + } + else + { + results[j] = null; + } + } + Object[] newview = input.getUpdatedView(results, orders, getGapChar()); + // trash references to original result data + for (int j = 0; j < jobs.length; j++) + { + results[j] = null; + orders[j] = null; + } + SequenceI[] alignment = (SequenceI[]) newview[0]; + ColumnSelection columnselection = (ColumnSelection) newview[1]; + Alignment al = new Alignment(alignment); + // TODO: add 'provenance' property to alignment from the method notes accompanying each subjob + if (dataset != null) + { + al.setDataset(dataset); + } + + propagateDatasetMappings(al); + // JBNote- TODO: warn user if a block is input rather than aligned data ? + + if (newFrame) + { + AlignFrame af = new AlignFrame(al, columnselection, + AlignFrame.DEFAULT_WIDTH, + AlignFrame.DEFAULT_HEIGHT); + + // initialise with same renderer settings as in parent alignframe. + af.getFeatureRenderer().transferSettings( + this.featureSettings); + // update orders + if (alorders.size() > 0) + { + if (alorders.size() == 1) + { + af.addSortByOrderMenuItem(WebServiceName + " Ordering", + (AlignmentOrder) alorders.get(0)); + } + else + { + // construct a non-redundant ordering set + Vector names = new Vector(); + for (int i = 0, l = alorders.size(); i < l; i++) + { + String orderName = new String(" Region " + i); + int j = i + 1; + + while (j < l) + { + if ( ( (AlignmentOrder) alorders.get(i)).equals( ( ( + AlignmentOrder) alorders.get(j)))) + { + alorders.remove(j); + l--; + orderName += "," + j; + } + else + { + j++; + } + } + + if (i == 0 && j == 1) + { + names.add(new String("")); + } + else + { + names.add(orderName); + } + } + for (int i = 0, l = alorders.size(); i < l; i++) + { + af.addSortByOrderMenuItem(WebServiceName + + ( (String) names.get(i)) + + " Ordering", + (AlignmentOrder) alorders.get(i)); + } + } + } + + Desktop.addInternalFrame(af, alTitle, + AlignFrame.DEFAULT_WIDTH, + AlignFrame.DEFAULT_HEIGHT); + + } + else + { + System.out.println("MERGE WITH OLD FRAME"); + // TODO: modify alignment in original frame, replacing old for new alignment using the commands.EditCommand model to ensure the update can be undone + } + } + + public boolean canMergeResults() + { + return false; + } +} diff --git a/src/jalview/ws/SeqSearchWSClient.java b/src/jalview/ws/SeqSearchWSClient.java index e52cefd..6da2ebb 100644 --- a/src/jalview/ws/SeqSearchWSClient.java +++ b/src/jalview/ws/SeqSearchWSClient.java @@ -1,294 +1,294 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.ws; - -import java.awt.Component; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.StringTokenizer; -import java.util.Vector; - -import javax.swing.*; - -import ext.vamsas.*; -import jalview.datamodel.*; -import jalview.gui.*; - -/** - * DOCUMENT ME! - * - * @author $author$ - * @version $Revision$ - */ -public class SeqSearchWSClient - extends WSClient -{ - /** - * server is a WSDL2Java generated stub for an archetypal MsaWSI service. - */ - ext.vamsas.SeqSearchI server; - AlignFrame alignFrame; - - /** - * Creates a new MsaWSClient object that uses a service - * given by an externally retrieved ServiceHandle - * - * @param sh service handle of type AbstractName(MsaWS) - * @param altitle DOCUMENT ME! - * @param msa DOCUMENT ME! - * @param submitGaps DOCUMENT ME! - * @param preserveOrder DOCUMENT ME! - */ - - public SeqSearchWSClient(ext.vamsas.ServiceHandle sh, String altitle, - jalview.datamodel.AlignmentView msa, String db, - Alignment seqdataset, - AlignFrame _alignFrame) - { - super(); - alignFrame = _alignFrame; - // can generalise the two errors below for metadata mapping from interface name to service client name - if (!sh.getAbstractName().equals(this.getServiceActionKey())) - { - JOptionPane.showMessageDialog(Desktop.desktop, - "The Service called \n" + sh.getName() + - "\nis not a \nSequence Search Service !", - "Internal Jalview Error", - JOptionPane.WARNING_MESSAGE); - - return; - } - - if ( (wsInfo = setWebService(sh)) == null) - { - JOptionPane.showMessageDialog(Desktop.desktop, - "The Sequence Search Service named " + - sh.getName() + - " is unknown", "Internal Jalview Error", - JOptionPane.WARNING_MESSAGE); - - return; - } - startSeqSearchClient(altitle, msa, db, seqdataset); - - } - /** - * non-process web service interaction - use this for calling HEADLESS synchronous service methods - * @param sh - */ - public SeqSearchWSClient(ServiceHandle sh) - { - setWebService(sh, true); - } - - public SeqSearchWSClient() - { - - super(); - // add a class reference to the list - } - private void startSeqSearchClient(String altitle, AlignmentView msa, - String db, - Alignment seqdataset) - { - if (!locateWebService()) - { - return; - } - String visdb = (db==null || db == "") ? "default" : db; // need a visible name for a sequence db - boolean profileSearch = msa.getSequences().length>2 ? true : false; - // single sequence or profile from alignment view - wsInfo.setProgressText( "Searching "+visdb+(!profileSearch ? " with sequence "+msa.getSequences()[0].getRefSeq().getName() - : " with profile") + - " from " + altitle + "\nJob details\n"); - - String jobtitle = WebServiceName+((WebServiceName.indexOf("earch")>-1) ? " " : " search ")+" of "+visdb+(!profileSearch ? " with sequence "+msa.getSequences()[0].getRefSeq().getName() - : " with profile") + - " from " + altitle; - SeqSearchWSThread ssthread = new SeqSearchWSThread(server, WsURL, wsInfo, alignFrame, - WebServiceName, - jobtitle, - msa, - db, - seqdataset); - wsInfo.setthisService(ssthread); - ssthread.start(); - } - - /** - * Initializes the server field with a valid service implementation. - * - * @return true if service was located. - */ - private boolean locateWebService() - { - // this can be abstracted using reflection - // TODO: MuscleWS transmuted to generic MsaWS client - SeqSearchServiceLocator loc = new SeqSearchServiceLocator(); // Default - - try - { - this.server = (SeqSearchI) loc.getSeqSearchService(new java.net.URL(WsURL)); - ( (SeqSearchServiceSoapBindingStub)this.server).setTimeout(60000); // One minute timeout - } - catch (Exception ex) - { - wsInfo.setProgressText("Serious! " + WebServiceName + - " Service location failed\nfor URL :" + WsURL + - "\n" + - ex.getMessage()); - wsInfo.setStatus(WebserviceInfo.ERROR); - ex.printStackTrace(); - - return false; - } - - loc.getEngine().setOption("axis", "1"); - - return true; - } - - protected String getServiceActionKey() - { - return "SeqSearch"; - } - - protected String getServiceActionDescription() - { - return "Sequence Database Search"; - } - // simple caching of db parameters for each service endpoint - private static Hashtable dbParamsForEndpoint; - static { - dbParamsForEndpoint = new Hashtable(); - } - public String[] getSupportedDatabases() throws Exception - { - - // check that we haven't already been to this service endpoint - if (dbParamsForEndpoint.containsKey(WsURL)) - { - return (String[]) dbParamsForEndpoint.get(WsURL); - } - if (!locateWebService()) - { - throw new Exception("Cannot contact service endpoint at "+WsURL); - } - String database = server.getDatabase(); - if (database==null) - { - dbParamsForEndpoint.put(WsURL, new String[] {}); - return null; - } - StringTokenizer en = new StringTokenizer(database.trim(), ",| "); - String[] dbs = new String[en.countTokens()]; - for (int i=0; i2 ? true : false; + // single sequence or profile from alignment view + wsInfo.setProgressText( "Searching "+visdb+(!profileSearch ? " with sequence "+msa.getSequences()[0].getRefSeq().getName() + : " with profile") + + " from " + altitle + "\nJob details\n"); + + String jobtitle = WebServiceName+((WebServiceName.indexOf("earch")>-1) ? " " : " search ")+" of "+visdb+(!profileSearch ? " with sequence "+msa.getSequences()[0].getRefSeq().getName() + : " with profile") + + " from " + altitle; + SeqSearchWSThread ssthread = new SeqSearchWSThread(server, WsURL, wsInfo, alignFrame, + WebServiceName, + jobtitle, + msa, + db, + seqdataset); + wsInfo.setthisService(ssthread); + ssthread.start(); + } + + /** + * Initializes the server field with a valid service implementation. + * + * @return true if service was located. + */ + private boolean locateWebService() + { + // this can be abstracted using reflection + // TODO: MuscleWS transmuted to generic MsaWS client + SeqSearchServiceLocator loc = new SeqSearchServiceLocator(); // Default + + try + { + this.server = (SeqSearchI) loc.getSeqSearchService(new java.net.URL(WsURL)); + ( (SeqSearchServiceSoapBindingStub)this.server).setTimeout(60000); // One minute timeout + } + catch (Exception ex) + { + wsInfo.setProgressText("Serious! " + WebServiceName + + " Service location failed\nfor URL :" + WsURL + + "\n" + + ex.getMessage()); + wsInfo.setStatus(WebserviceInfo.ERROR); + ex.printStackTrace(); + + return false; + } + + loc.getEngine().setOption("axis", "1"); + + return true; + } + + protected String getServiceActionKey() + { + return "SeqSearch"; + } + + protected String getServiceActionDescription() + { + return "Sequence Database Search"; + } + // simple caching of db parameters for each service endpoint + private static Hashtable dbParamsForEndpoint; + static { + dbParamsForEndpoint = new Hashtable(); + } + public String[] getSupportedDatabases() throws Exception + { + + // check that we haven't already been to this service endpoint + if (dbParamsForEndpoint.containsKey(WsURL)) + { + return (String[]) dbParamsForEndpoint.get(WsURL); + } + if (!locateWebService()) + { + throw new Exception("Cannot contact service endpoint at "+WsURL); + } + String database = server.getDatabase(); + if (database==null) + { + dbParamsForEndpoint.put(WsURL, new String[] {}); + return null; + } + StringTokenizer en = new StringTokenizer(database.trim(), ",| "); + String[] dbs = new String[en.countTokens()]; + for (int i=0; i - * Title: - *

- * - *

- * Description: - *

- * - *

- * Copyright: Copyright (c) 2004 - *

- * - *

- * Company: Dundee University - *

- * - * @author not attributable - * @version 1.0 - */ -class SeqSearchWSThread - extends WSThread implements WSClientI -{ - String dbs=null; - boolean profile=false; - - class SeqSearchWSJob - extends WSThread.WSJob - { - // hold special input for this - vamsas.objects.simple.SequenceSet seqs = new vamsas.objects.simple. - SequenceSet(); - - /** - * MsaWSJob - * - * @param jobNum - * int - * @param jobId - * String - */ - public SeqSearchWSJob(int jobNum, SequenceI[] inSeqs) - { - this.jobnum = jobNum; - if (!prepareInput(inSeqs, 2)) - { - submitted = true; - subjobComplete = true; - result = new MsaResult(); - result.setFinished(true); - result.setStatus("Job never ran - input returned to user."); - } - - } - - Hashtable SeqNames = new Hashtable(); - Vector emptySeqs = new Vector(); - /** - * prepare input sequences for service - * @param seqs jalview sequences to be prepared - * @param minlen minimum number of residues required for this MsaWS service - * @return true if seqs contains sequences to be submitted to service. - */ - private boolean prepareInput(SequenceI[] seqs, int minlen) - { - int nseqs = 0; - if (minlen < 0) - { - throw new Error("Implementation error: minlen must be zero or more."); - } - for (int i = 0; i < seqs.length; i++) - { - if (seqs[i].getEnd() - seqs[i].getStart() > minlen - 1) - { - nseqs++; - } - } - boolean valid = nseqs >= 1; // need at least one sequence for valid input TODO: generalise - vamsas.objects.simple.Sequence[] seqarray = - (valid) - ? new vamsas.objects.simple.Sequence[nseqs] - : null; - boolean submitGaps = (nseqs==1) ? false : true; // profile is submitted with gaps - for (int i = 0, n = 0; i < seqs.length; i++) - { - - String newname = jalview.analysis.SeqsetUtils.unique_name(i); // same - // for - // any - // subjob - SeqNames.put(newname, jalview.analysis.SeqsetUtils - .SeqCharacterHash(seqs[i])); - if (valid && seqs[i].getEnd() - seqs[i].getStart() > minlen - 1) - { - seqarray[n] = new vamsas.objects.simple.Sequence(); - seqarray[n].setId(newname); - seqarray[n++].setSeq( (submitGaps) ? seqs[i].getSequenceAsString() - : AlignSeq.extractGaps( - jalview.util.Comparison.GapChars, seqs[i] - .getSequenceAsString())); - } - else - { - String empty = null; - if (seqs[i].getEnd() >= seqs[i].getStart()) - { - empty = (submitGaps) ? seqs[i].getSequenceAsString() - : AlignSeq.extractGaps( - jalview.util.Comparison.GapChars, seqs[i] - .getSequenceAsString()); - } - emptySeqs.add(new String[] - {newname, empty}); - } - } - if (submitGaps) - { - // almost certainly have to remove gapped columns here - } - this.seqs = new vamsas.objects.simple.SequenceSet(); - this.seqs.setSeqs(seqarray); - return valid; - } - - /** - * - * @return true if getAlignment will return a valid alignment result. - */ - public boolean hasResults() - { - if (subjobComplete && result != null && result.isFinished() - && ( (SeqSearchResult) result).getAlignment() != null && - ( (SeqSearchResult) result).getAlignment().getSeqs() != null) - { - return true; - } - return false; - } - - /** - * return sequence search results for display - * @return null or { Alignment(+features and annotation), NewickFile)} - */ - public Object[] getAlignment(Alignment dataset, Hashtable featureColours) - { - - if (result != null && result.isFinished()) - { - SequenceI[] alseqs = null; - //char alseq_gapchar = '-'; - //int alseq_l = 0; - if ( ( (SeqSearchResult) result).getAlignment() != null) - { - alseqs = getVamsasAlignment( ( (SeqSearchResult) result).getAlignment()); - //alseq_gapchar = ( (SeqSearchResult) result).getAlignment().getGapchar().charAt(0); - //alseq_l = alseqs.length; - } - /** - * what has to be done. 1 - annotate returned alignment with annotation file and sequence features file, and associate any tree-nodes. - * 2. connect alignment back to any associated dataset: 2.a. deuniquify recovers sequence information - but additionally, - * relocations must be made from the returned aligned sequence back to the dataset. - */ - // construct annotated alignment as it would be done by the jalview applet - jalview.datamodel.Alignment al = new Alignment(alseqs); - // al.setDataset(dataset); - // make dataset - String inFile=null; - try { - inFile = ((SeqSearchResult) result).getAnnotation(); - if (inFile!=null && inFile.length()>0) - { - new jalview.io.AnnotationFile().readAnnotationFile(al, inFile, jalview.io.AppletFormatAdapter.PASTE); - } - } - catch (Exception e) - { - System.err.println("Failed to parse the annotation file associated with the alignment."); - System.err.println(">>>EOF"+inFile+"\n<<0) - { - jalview.io.FeaturesFile ff = new jalview.io.FeaturesFile(inFile, jalview.io.AppletFormatAdapter.PASTE); - ff.parse(al, featureColours, false); - } - } - catch (Exception e) - { - System.err.println("Failed to parse the Features file associated with the alignment."); - System.err.println(">>>EOF"+inFile+"\n<<0) - { - nf = new jalview.io.NewickFile(inFile, jalview.io.AppletFormatAdapter.PASTE); - if (!nf.isValid()) { - nf.close(); - nf = null; - } - } - } - catch (Exception e) - { - System.err.println("Failed to parse the treeFile associated with the alignment."); - System.err.println(">>>EOF"+inFile+"\n<< 0) - { - wsinfo.setProgressName("region " + jobs[j].jobnum, jobs[j].jobnum); - } - wsinfo.setProgressText(jobs[j].jobnum, OutputHeader); - } - } - } - - public boolean isCancellable() - { - return true; - } - - public void cancelJob() - { - if (!jobComplete && jobs != null) - { - boolean cancelled = true; - for (int job = 0; job < jobs.length; job++) - { - if (jobs[job].submitted && !jobs[job].subjobComplete) - { - String cancelledMessage = ""; - try - { - vamsas.objects.simple.WsJobId cancelledJob = server - .cancel(jobs[job].jobId); - if (cancelledJob.getStatus() == 2) - { - // CANCELLED_JOB - cancelledMessage = "Job cancelled."; - ( (SeqSearchWSJob) jobs[job]).cancel(); - wsInfo.setStatus(jobs[job].jobnum, - WebserviceInfo.STATE_CANCELLED_OK); - } - else if (cancelledJob.getStatus() == 3) - { - // VALID UNSTOPPABLE JOB - cancelledMessage += - "Server cannot cancel this job. just close the window.\n"; - cancelled = false; - // wsInfo.setStatus(jobs[job].jobnum, - // WebserviceInfo.STATE_RUNNING); - } - - if (cancelledJob.getJobId() != null) - { - cancelledMessage += ("[" + cancelledJob.getJobId() + "]"); - } - - cancelledMessage += "\n"; - } - catch (Exception exc) - { - cancelledMessage += - ("\nProblems cancelling the job : Exception received...\n" - + exc + "\n"); - Cache.log.warn("Exception whilst cancelling " + jobs[job].jobId, - exc); - } - wsInfo.setProgressText(jobs[job].jobnum, OutputHeader - + cancelledMessage + "\n"); - } - } - if (cancelled) - { - wsInfo.setStatus(WebserviceInfo.STATE_CANCELLED_OK); - jobComplete = true; - } - this.interrupt(); // kick thread to update job states. - } - else - { - if (!jobComplete) - { - wsInfo - .setProgressText(OutputHeader - + "Server cannot cancel this job because it has not been submitted properly. just close the window.\n"); - } - } - } - - void pollJob(WSJob job) - throws Exception - { - ( (SeqSearchWSJob) job).result = server.getResult( ( (SeqSearchWSJob) job).jobId); - } - - void StartJob(WSJob job) - { - if (! (job instanceof SeqSearchWSJob)) - { - throw new Error("StartJob(MsaWSJob) called on a WSJobInstance " + - job.getClass()); - } - SeqSearchWSJob j = (SeqSearchWSJob) job; - if (j.submitted) - { - if (Cache.log.isDebugEnabled()) - { - Cache.log.debug("Tried to submit an already submitted job " + j.jobId); - } - return; - } - if (j.seqs.getSeqs() == null) - { - // special case - selection consisted entirely of empty sequences... - j.submitted = true; - j.result = new MsaResult(); - j.result.setFinished(true); - j.result.setStatus("Empty Alignment Job"); - ( (MsaResult) j.result).setMsa(null); - } - try - { - vamsas.objects.simple.WsJobId jobsubmit = server.search(j.seqs.getSeqs()[0], dbArg); - - if ( (jobsubmit != null) && (jobsubmit.getStatus() == 1)) - { - j.jobId = jobsubmit.getJobId(); - j.submitted = true; - j.subjobComplete = false; - // System.out.println(WsURL + " Job Id '" + jobId + "'"); - } - else - { - if (jobsubmit == null) - { - throw new Exception( - "Server at " - + WsUrl - + - " returned null object, it probably cannot be contacted. Try again later ?"); - } - - throw new Exception(jobsubmit.getJobId()); - } - } - catch (Exception e) - { - // TODO: JBPNote catch timeout or other fault types explicitly - // For unexpected errors - System.err - .println(WebServiceName - + "Client: Failed to submit the sequences for alignment (probably a server side problem)\n" - + "When contacting Server:" + WsUrl + "\n" - + e.toString() + "\n"); - j.allowedServerExceptions = 0; - wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_SERVERERROR); - wsInfo.setStatus(j.jobnum, WebserviceInfo.STATE_STOPPED_SERVERERROR); - wsInfo - .appendProgressText( - j.jobnum, - "Failed to submit sequences for alignment.\n" - + "It is most likely that there is a problem with the server.\n" - + "Just close the window\n"); - - // e.printStackTrace(); // TODO: JBPNote DEBUG - } - } - - private jalview.datamodel.Sequence[] getVamsasAlignment( - vamsas.objects.simple.Alignment valign) - { - vamsas.objects.simple.Sequence[] seqs = valign.getSeqs().getSeqs(); - jalview.datamodel.Sequence[] msa = new jalview.datamodel.Sequence[seqs. - length]; - - for (int i = 0, j = seqs.length; i < j; i++) - { - msa[i] = new jalview.datamodel.Sequence(seqs[i].getId(), seqs[i] - .getSeq()); - } - - return msa; - } - - void parseResult() - { - int results = 0; // number of result sets received - JobStateSummary finalState = new JobStateSummary(); - try - { - for (int j = 0; j < jobs.length; j++) - { - finalState.updateJobPanelState(wsInfo, OutputHeader, jobs[j]); - if (jobs[j].submitted && jobs[j].subjobComplete && jobs[j].hasResults()) - { - results++; - vamsas.objects.simple.Alignment valign = ( (SeqSearchResult) jobs[j].result). - getAlignment(); - if (valign != null) - { - wsInfo.appendProgressText(jobs[j].jobnum, - "\nAlignment Object Method Notes\n"); - String[] lines = valign.getMethod(); - for (int line = 0; line < lines.length; line++) - { - wsInfo.appendProgressText(jobs[j].jobnum, lines[line] + "\n"); - } - // JBPNote The returned files from a webservice could be - // hidden behind icons in the monitor window that, - // when clicked, pop up their corresponding data - } - } - } - } - catch (Exception ex) - { - - Cache.log.error("Unexpected exception when processing results for " + - alTitle, ex); - wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR); - } - if (results > 0) - { - wsInfo.showResultsNewFrame - .addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed( - java.awt.event.ActionEvent evt) - { - displayResults(true); - } - }); - wsInfo.mergeResults - .addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed( - java.awt.event.ActionEvent evt) - { - displayResults(false); - } - }); - wsInfo.setResultsReady(); - } - else - { - wsInfo.setFinishedNoResults(); - } - } - - void displayResults(boolean newFrame) - { - if (!newFrame) - { - System.err.println("MERGE WITH OLD FRAME NOT IMPLEMENTED"); - return; - } - // each subjob is an independent alignment for the moment - //Alignment al[] = new Alignment[jobs.length]; - //NewickFile nf[] = new NewickFile[jobs.length]; - for (int j = 0; j < jobs.length; j++) - { - Hashtable featureColours = new Hashtable(); - Alignment al=null; - NewickFile nf = null; - if (jobs[j].hasResults()) - { - Object[] res = ( (SeqSearchWSJob) jobs[j]).getAlignment(dataset, featureColours); - if (res==null) { continue; }; - al = (Alignment) res[0]; - nf = (NewickFile) res[1]; - } - else - { - al = null; - nf = null; - continue; - } - /* - * We can't map new alignment back with insertions from input's hidden regions until dataset mapping is sorted out... - * but basically it goes like this: - 1. Merge each domain hit back onto the visible segments in the same way as a Jnet prediction is mapped back - - Object[] newview = input.getUpdatedView(results, orders, getGapChar()); - // trash references to original result data - for (int j = 0; j < jobs.length; j++) - { - results[j] = null; - orders[j] = null; - } - SequenceI[] alignment = (SequenceI[]) newview[0]; - ColumnSelection columnselection = (ColumnSelection) newview[1]; - Alignment al = new Alignment(alignment); - - if (dataset != null) - { - al.setDataset(dataset); - } - - propagateDatasetMappings(al); - } - */ - - AlignFrame af = new AlignFrame(al,// columnselection, - AlignFrame.DEFAULT_WIDTH, - AlignFrame.DEFAULT_HEIGHT); - if (nf!=null) - { - af.ShowNewickTree(nf, "Tree from "+this.alTitle); - } - // initialise with same renderer settings as in parent alignframe. - af.getFeatureRenderer().transferSettings( - this.featureSettings); - Desktop.addInternalFrame(af, alTitle, - AlignFrame.DEFAULT_WIDTH, - AlignFrame.DEFAULT_HEIGHT); - } - } - - public boolean canMergeResults() - { - return false; - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.ws; + +import java.util.*; + +import jalview.analysis.*; +import jalview.bin.*; +import jalview.datamodel.*; +import jalview.gui.*; +import jalview.io.NewickFile; +import vamsas.objects.simple.MsaResult; +import vamsas.objects.simple.SeqSearchResult; + +/** + *

+ * Title: + *

+ * + *

+ * Description: + *

+ * + *

+ * Copyright: Copyright (c) 2004 + *

+ * + *

+ * Company: Dundee University + *

+ * + * @author not attributable + * @version 1.0 + */ +class SeqSearchWSThread + extends WSThread implements WSClientI +{ + String dbs=null; + boolean profile=false; + + class SeqSearchWSJob + extends WSThread.WSJob + { + // hold special input for this + vamsas.objects.simple.SequenceSet seqs = new vamsas.objects.simple. + SequenceSet(); + + /** + * MsaWSJob + * + * @param jobNum + * int + * @param jobId + * String + */ + public SeqSearchWSJob(int jobNum, SequenceI[] inSeqs) + { + this.jobnum = jobNum; + if (!prepareInput(inSeqs, 2)) + { + submitted = true; + subjobComplete = true; + result = new MsaResult(); + result.setFinished(true); + result.setStatus("Job never ran - input returned to user."); + } + + } + + Hashtable SeqNames = new Hashtable(); + Vector emptySeqs = new Vector(); + /** + * prepare input sequences for service + * @param seqs jalview sequences to be prepared + * @param minlen minimum number of residues required for this MsaWS service + * @return true if seqs contains sequences to be submitted to service. + */ + private boolean prepareInput(SequenceI[] seqs, int minlen) + { + int nseqs = 0; + if (minlen < 0) + { + throw new Error("Implementation error: minlen must be zero or more."); + } + for (int i = 0; i < seqs.length; i++) + { + if (seqs[i].getEnd() - seqs[i].getStart() > minlen - 1) + { + nseqs++; + } + } + boolean valid = nseqs >= 1; // need at least one sequence for valid input TODO: generalise + vamsas.objects.simple.Sequence[] seqarray = + (valid) + ? new vamsas.objects.simple.Sequence[nseqs] + : null; + boolean submitGaps = (nseqs==1) ? false : true; // profile is submitted with gaps + for (int i = 0, n = 0; i < seqs.length; i++) + { + + String newname = jalview.analysis.SeqsetUtils.unique_name(i); // same + // for + // any + // subjob + SeqNames.put(newname, jalview.analysis.SeqsetUtils + .SeqCharacterHash(seqs[i])); + if (valid && seqs[i].getEnd() - seqs[i].getStart() > minlen - 1) + { + seqarray[n] = new vamsas.objects.simple.Sequence(); + seqarray[n].setId(newname); + seqarray[n++].setSeq( (submitGaps) ? seqs[i].getSequenceAsString() + : AlignSeq.extractGaps( + jalview.util.Comparison.GapChars, seqs[i] + .getSequenceAsString())); + } + else + { + String empty = null; + if (seqs[i].getEnd() >= seqs[i].getStart()) + { + empty = (submitGaps) ? seqs[i].getSequenceAsString() + : AlignSeq.extractGaps( + jalview.util.Comparison.GapChars, seqs[i] + .getSequenceAsString()); + } + emptySeqs.add(new String[] + {newname, empty}); + } + } + if (submitGaps) + { + // almost certainly have to remove gapped columns here + } + this.seqs = new vamsas.objects.simple.SequenceSet(); + this.seqs.setSeqs(seqarray); + return valid; + } + + /** + * + * @return true if getAlignment will return a valid alignment result. + */ + public boolean hasResults() + { + if (subjobComplete && result != null && result.isFinished() + && ( (SeqSearchResult) result).getAlignment() != null && + ( (SeqSearchResult) result).getAlignment().getSeqs() != null) + { + return true; + } + return false; + } + + /** + * return sequence search results for display + * @return null or { Alignment(+features and annotation), NewickFile)} + */ + public Object[] getAlignment(Alignment dataset, Hashtable featureColours) + { + + if (result != null && result.isFinished()) + { + SequenceI[] alseqs = null; + //char alseq_gapchar = '-'; + //int alseq_l = 0; + if ( ( (SeqSearchResult) result).getAlignment() != null) + { + alseqs = getVamsasAlignment( ( (SeqSearchResult) result).getAlignment()); + //alseq_gapchar = ( (SeqSearchResult) result).getAlignment().getGapchar().charAt(0); + //alseq_l = alseqs.length; + } + /** + * what has to be done. 1 - annotate returned alignment with annotation file and sequence features file, and associate any tree-nodes. + * 2. connect alignment back to any associated dataset: 2.a. deuniquify recovers sequence information - but additionally, + * relocations must be made from the returned aligned sequence back to the dataset. + */ + // construct annotated alignment as it would be done by the jalview applet + jalview.datamodel.Alignment al = new Alignment(alseqs); + // al.setDataset(dataset); + // make dataset + String inFile=null; + try { + inFile = ((SeqSearchResult) result).getAnnotation(); + if (inFile!=null && inFile.length()>0) + { + new jalview.io.AnnotationFile().readAnnotationFile(al, inFile, jalview.io.AppletFormatAdapter.PASTE); + } + } + catch (Exception e) + { + System.err.println("Failed to parse the annotation file associated with the alignment."); + System.err.println(">>>EOF"+inFile+"\n<<0) + { + jalview.io.FeaturesFile ff = new jalview.io.FeaturesFile(inFile, jalview.io.AppletFormatAdapter.PASTE); + ff.parse(al, featureColours, false); + } + } + catch (Exception e) + { + System.err.println("Failed to parse the Features file associated with the alignment."); + System.err.println(">>>EOF"+inFile+"\n<<0) + { + nf = new jalview.io.NewickFile(inFile, jalview.io.AppletFormatAdapter.PASTE); + if (!nf.isValid()) { + nf.close(); + nf = null; + } + } + } + catch (Exception e) + { + System.err.println("Failed to parse the treeFile associated with the alignment."); + System.err.println(">>>EOF"+inFile+"\n<< 0) + { + wsinfo.setProgressName("region " + jobs[j].jobnum, jobs[j].jobnum); + } + wsinfo.setProgressText(jobs[j].jobnum, OutputHeader); + } + } + } + + public boolean isCancellable() + { + return true; + } + + public void cancelJob() + { + if (!jobComplete && jobs != null) + { + boolean cancelled = true; + for (int job = 0; job < jobs.length; job++) + { + if (jobs[job].submitted && !jobs[job].subjobComplete) + { + String cancelledMessage = ""; + try + { + vamsas.objects.simple.WsJobId cancelledJob = server + .cancel(jobs[job].jobId); + if (cancelledJob.getStatus() == 2) + { + // CANCELLED_JOB + cancelledMessage = "Job cancelled."; + ( (SeqSearchWSJob) jobs[job]).cancel(); + wsInfo.setStatus(jobs[job].jobnum, + WebserviceInfo.STATE_CANCELLED_OK); + } + else if (cancelledJob.getStatus() == 3) + { + // VALID UNSTOPPABLE JOB + cancelledMessage += + "Server cannot cancel this job. just close the window.\n"; + cancelled = false; + // wsInfo.setStatus(jobs[job].jobnum, + // WebserviceInfo.STATE_RUNNING); + } + + if (cancelledJob.getJobId() != null) + { + cancelledMessage += ("[" + cancelledJob.getJobId() + "]"); + } + + cancelledMessage += "\n"; + } + catch (Exception exc) + { + cancelledMessage += + ("\nProblems cancelling the job : Exception received...\n" + + exc + "\n"); + Cache.log.warn("Exception whilst cancelling " + jobs[job].jobId, + exc); + } + wsInfo.setProgressText(jobs[job].jobnum, OutputHeader + + cancelledMessage + "\n"); + } + } + if (cancelled) + { + wsInfo.setStatus(WebserviceInfo.STATE_CANCELLED_OK); + jobComplete = true; + } + this.interrupt(); // kick thread to update job states. + } + else + { + if (!jobComplete) + { + wsInfo + .setProgressText(OutputHeader + + "Server cannot cancel this job because it has not been submitted properly. just close the window.\n"); + } + } + } + + void pollJob(WSJob job) + throws Exception + { + ( (SeqSearchWSJob) job).result = server.getResult( ( (SeqSearchWSJob) job).jobId); + } + + void StartJob(WSJob job) + { + if (! (job instanceof SeqSearchWSJob)) + { + throw new Error("StartJob(MsaWSJob) called on a WSJobInstance " + + job.getClass()); + } + SeqSearchWSJob j = (SeqSearchWSJob) job; + if (j.submitted) + { + if (Cache.log.isDebugEnabled()) + { + Cache.log.debug("Tried to submit an already submitted job " + j.jobId); + } + return; + } + if (j.seqs.getSeqs() == null) + { + // special case - selection consisted entirely of empty sequences... + j.submitted = true; + j.result = new MsaResult(); + j.result.setFinished(true); + j.result.setStatus("Empty Alignment Job"); + ( (MsaResult) j.result).setMsa(null); + } + try + { + vamsas.objects.simple.WsJobId jobsubmit = server.search(j.seqs.getSeqs()[0], dbArg); + + if ( (jobsubmit != null) && (jobsubmit.getStatus() == 1)) + { + j.jobId = jobsubmit.getJobId(); + j.submitted = true; + j.subjobComplete = false; + // System.out.println(WsURL + " Job Id '" + jobId + "'"); + } + else + { + if (jobsubmit == null) + { + throw new Exception( + "Server at " + + WsUrl + + + " returned null object, it probably cannot be contacted. Try again later ?"); + } + + throw new Exception(jobsubmit.getJobId()); + } + } + catch (Exception e) + { + // TODO: JBPNote catch timeout or other fault types explicitly + // For unexpected errors + System.err + .println(WebServiceName + + "Client: Failed to submit the sequences for alignment (probably a server side problem)\n" + + "When contacting Server:" + WsUrl + "\n" + + e.toString() + "\n"); + j.allowedServerExceptions = 0; + wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_SERVERERROR); + wsInfo.setStatus(j.jobnum, WebserviceInfo.STATE_STOPPED_SERVERERROR); + wsInfo + .appendProgressText( + j.jobnum, + "Failed to submit sequences for alignment.\n" + + "It is most likely that there is a problem with the server.\n" + + "Just close the window\n"); + + // e.printStackTrace(); // TODO: JBPNote DEBUG + } + } + + private jalview.datamodel.Sequence[] getVamsasAlignment( + vamsas.objects.simple.Alignment valign) + { + vamsas.objects.simple.Sequence[] seqs = valign.getSeqs().getSeqs(); + jalview.datamodel.Sequence[] msa = new jalview.datamodel.Sequence[seqs. + length]; + + for (int i = 0, j = seqs.length; i < j; i++) + { + msa[i] = new jalview.datamodel.Sequence(seqs[i].getId(), seqs[i] + .getSeq()); + } + + return msa; + } + + void parseResult() + { + int results = 0; // number of result sets received + JobStateSummary finalState = new JobStateSummary(); + try + { + for (int j = 0; j < jobs.length; j++) + { + finalState.updateJobPanelState(wsInfo, OutputHeader, jobs[j]); + if (jobs[j].submitted && jobs[j].subjobComplete && jobs[j].hasResults()) + { + results++; + vamsas.objects.simple.Alignment valign = ( (SeqSearchResult) jobs[j].result). + getAlignment(); + if (valign != null) + { + wsInfo.appendProgressText(jobs[j].jobnum, + "\nAlignment Object Method Notes\n"); + String[] lines = valign.getMethod(); + for (int line = 0; line < lines.length; line++) + { + wsInfo.appendProgressText(jobs[j].jobnum, lines[line] + "\n"); + } + // JBPNote The returned files from a webservice could be + // hidden behind icons in the monitor window that, + // when clicked, pop up their corresponding data + } + } + } + } + catch (Exception ex) + { + + Cache.log.error("Unexpected exception when processing results for " + + alTitle, ex); + wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR); + } + if (results > 0) + { + wsInfo.showResultsNewFrame + .addActionListener(new java.awt.event.ActionListener() + { + public void actionPerformed( + java.awt.event.ActionEvent evt) + { + displayResults(true); + } + }); + wsInfo.mergeResults + .addActionListener(new java.awt.event.ActionListener() + { + public void actionPerformed( + java.awt.event.ActionEvent evt) + { + displayResults(false); + } + }); + wsInfo.setResultsReady(); + } + else + { + wsInfo.setFinishedNoResults(); + } + } + + void displayResults(boolean newFrame) + { + if (!newFrame) + { + System.err.println("MERGE WITH OLD FRAME NOT IMPLEMENTED"); + return; + } + // each subjob is an independent alignment for the moment + //Alignment al[] = new Alignment[jobs.length]; + //NewickFile nf[] = new NewickFile[jobs.length]; + for (int j = 0; j < jobs.length; j++) + { + Hashtable featureColours = new Hashtable(); + Alignment al=null; + NewickFile nf = null; + if (jobs[j].hasResults()) + { + Object[] res = ( (SeqSearchWSJob) jobs[j]).getAlignment(dataset, featureColours); + if (res==null) { continue; }; + al = (Alignment) res[0]; + nf = (NewickFile) res[1]; + } + else + { + al = null; + nf = null; + continue; + } + /* + * We can't map new alignment back with insertions from input's hidden regions until dataset mapping is sorted out... + * but basically it goes like this: + 1. Merge each domain hit back onto the visible segments in the same way as a Jnet prediction is mapped back + + Object[] newview = input.getUpdatedView(results, orders, getGapChar()); + // trash references to original result data + for (int j = 0; j < jobs.length; j++) + { + results[j] = null; + orders[j] = null; + } + SequenceI[] alignment = (SequenceI[]) newview[0]; + ColumnSelection columnselection = (ColumnSelection) newview[1]; + Alignment al = new Alignment(alignment); + + if (dataset != null) + { + al.setDataset(dataset); + } + + propagateDatasetMappings(al); + } + */ + + AlignFrame af = new AlignFrame(al,// columnselection, + AlignFrame.DEFAULT_WIDTH, + AlignFrame.DEFAULT_HEIGHT); + if (nf!=null) + { + af.ShowNewickTree(nf, "Tree from "+this.alTitle); + } + // initialise with same renderer settings as in parent alignframe. + af.getFeatureRenderer().transferSettings( + this.featureSettings); + Desktop.addInternalFrame(af, alTitle, + AlignFrame.DEFAULT_WIDTH, + AlignFrame.DEFAULT_HEIGHT); + } + } + + public boolean canMergeResults() + { + return false; + } +} diff --git a/src/jalview/ws/SequenceFetcher.java b/src/jalview/ws/SequenceFetcher.java index 0d93cb8..8bd8423 100644 --- a/src/jalview/ws/SequenceFetcher.java +++ b/src/jalview/ws/SequenceFetcher.java @@ -1,3 +1,21 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ package jalview.ws; import java.util.ArrayList; diff --git a/src/jalview/ws/WSClient.java b/src/jalview/ws/WSClient.java index 91fd4b0..df52803 100755 --- a/src/jalview/ws/WSClient.java +++ b/src/jalview/ws/WSClient.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/ws/WSClientI.java b/src/jalview/ws/WSClientI.java index 92b7bb3..8fa4ecb 100755 --- a/src/jalview/ws/WSClientI.java +++ b/src/jalview/ws/WSClientI.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/src/jalview/ws/WSThread.java b/src/jalview/ws/WSThread.java index a9e9b0b..3ad9690 100644 --- a/src/jalview/ws/WSThread.java +++ b/src/jalview/ws/WSThread.java @@ -1,449 +1,449 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package jalview.ws; - -import javax.swing.*; - -import jalview.bin.*; -import jalview.datamodel.*; -import jalview.gui.*; -import jalview.gui.FeatureRenderer.FeatureRendererSettings; - -public abstract class WSThread - extends Thread -{ - /** - * Generic properties for Web Service Client threads. - */ - /** - * view that this job was associated with - */ - AlignmentI currentView = null; - /** - * feature settings from view that job was associated with - */ - FeatureRendererSettings featureSettings = null; - /** - * metadata about this web service - */ - WebserviceInfo wsInfo = null; - /** - * original input data for this job - */ - AlignmentView input = null; - /** - * dataset sequence relationships to be propagated onto new results - */ - AlignedCodonFrame[] codonframe = null; - /** - * are there jobs still running in this thread. - */ - boolean jobComplete = false; - - abstract class WSJob - { - /** - * Generic properties for an individual job within a Web Service Client thread - */ - int jobnum = 0; // WebServiceInfo pane for this job - String jobId; // ws job ticket - /** - * has job been cancelled - */ - boolean cancelled = false; - /** - * number of exceptions left before job dies - */ - int allowedServerExceptions = 3; - /** - * has job been submitted - */ - boolean submitted = false; - /** - * are all sub-jobs complete - */ - boolean subjobComplete = false; - /** - * - * @return true if job has completed and valid results are available - */ - abstract boolean hasResults(); - - /** - * - * @return boolean true if job can be submitted. - */ - abstract boolean hasValidInput(); - - /** - * The last result object returned by the service. - */ - vamsas.objects.simple.Result result; - } - - class JobStateSummary - { - /** - * number of jobs running - */ - int running = 0; - /** - * number of jobs queued - */ - int queuing = 0; - /** - * number of jobs finished - */ - int finished = 0; - /** - * number of jobs failed - */ - int error = 0; - /** - * number of jobs stopped due to server error - */ - int serror = 0; - /** - * number of jobs cancelled - */ - int cancelled = 0; - /** - * number of jobs finished with results - */ - int results = 0; - /** - * processes WSJob and updates job status counters and WebService status displays - * @param wsInfo - * @param OutputHeader - * @param j - */ - void updateJobPanelState(WebserviceInfo wsInfo, String OutputHeader, - WSJob j) - { - if (j.result != null) - { - String progheader = ""; - // Parse state of job[j] - if (j.result.isRunning()) - { - running++; - wsInfo.setStatus(j.jobnum, WebserviceInfo.STATE_RUNNING); - } - else if (j.result.isQueued()) - { - queuing++; - wsInfo.setStatus(j.jobnum, WebserviceInfo.STATE_QUEUING); - } - else if (j.result.isFinished()) - { - finished++; - j.subjobComplete = true; - if (j.hasResults()) - { - results++; - } - wsInfo.setStatus(j.jobnum, WebserviceInfo.STATE_STOPPED_OK); - } - else if (j.result.isFailed()) - { - progheader += "Job failed.\n"; - j.subjobComplete = true; - wsInfo.setStatus(j.jobnum, WebserviceInfo.STATE_STOPPED_ERROR); - error++; - } - else if (j.result.isServerError()) - { - serror++; - j.subjobComplete = true; - wsInfo.setStatus(j.jobnum, - WebserviceInfo.STATE_STOPPED_SERVERERROR); - } - else if (j.result.isBroken() || j.result.isFailed()) - { - error++; - j.subjobComplete = true; - wsInfo.setStatus(j.jobnum, WebserviceInfo.STATE_STOPPED_ERROR); - } - // and pass on any sub-job messages to the user - wsInfo.setProgressText(j.jobnum, OutputHeader); - wsInfo.appendProgressText(j.jobnum, progheader); - if (j.result.getStatus() != null) - { - wsInfo.appendProgressText(j.jobnum, j.result.getStatus()); - } - } - else - { - if (j.submitted && j.subjobComplete) - { - if (j.allowedServerExceptions == 0) - { - serror++; - } - else if (j.result == null) - { - error++; - } - } - } - } - } - /** - * one or more jobs being managed by this thread. - */ - WSJob jobs[] = null; - /** - * full name of service - */ - String WebServiceName = null; - String OutputHeader; - String WsUrl = null; - /** - * query web service for status of job. - * on return, job.result must not be null - if it is then it will be - * assumed that the job status query timed out and a server exception - * will be logged. - * @param job - * @throws Exception will be logged as a server exception for this job - */ - abstract void pollJob(WSJob job) - throws Exception; - - public void run() - { - JobStateSummary jstate = null; - if (jobs == null) - { - jobComplete = true; - } - while (!jobComplete) - { - jstate = new JobStateSummary(); - for (int j = 0; j < jobs.length; j++) - { - - if (!jobs[j].submitted && jobs[j].hasValidInput()) - { - StartJob(jobs[j]); - } - - if (jobs[j].submitted && !jobs[j].subjobComplete) - { - try - { - pollJob(jobs[j]); - if (jobs[j].result == null) - { - throw (new Exception( - "Timed out when communicating with server\nTry again later.\n")); - } - jalview.bin.Cache.log.debug("Job " + j + " Result state " + - jobs[j].result.getState() - + "(ServerError=" + - jobs[j].result.isServerError() + ")"); - } - catch (Exception ex) - { - // Deal with Transaction exceptions - wsInfo.appendProgressText(jobs[j].jobnum, "\n" + WebServiceName - + " Server exception!\n" + ex.getMessage()); - Cache.log.warn(WebServiceName + " job(" + jobs[j].jobnum - + ") Server exception: " + ex.getMessage()); - - if (jobs[j].allowedServerExceptions > 0) - { - jobs[j].allowedServerExceptions--; - Cache.log.debug("Sleeping after a server exception."); - try - { - Thread.sleep(5000); - } - catch (InterruptedException ex1) - { - } - } - else - { - Cache.log.warn("Dropping job " + j + " " + jobs[j].jobId); - jobs[j].subjobComplete = true; - wsInfo.setStatus(jobs[j].jobnum, - WebserviceInfo.STATE_STOPPED_SERVERERROR); - } - } - catch (OutOfMemoryError er) - { - jobComplete = true; - jobs[j].subjobComplete = true; - jobs[j].result = null; // may contain out of date result object - wsInfo.setStatus(jobs[j].jobnum, - WebserviceInfo.STATE_STOPPED_ERROR); - JOptionPane - .showInternalMessageDialog( - Desktop.desktop, - "Out of memory handling result for job !!" - + - "\nSee help files for increasing Java Virtual Machine memory.", - "Out of memory", JOptionPane.WARNING_MESSAGE); - Cache.log.error("Out of memory when retrieving Job " + j + " id:" + - WsUrl + "/" + jobs[j].jobId, er); - System.gc(); - } - } - jstate.updateJobPanelState(wsInfo, OutputHeader, jobs[j]); - } - // Decide on overall state based on collected jobs[] states - if (jstate.running > 0) - { - wsInfo.setStatus(WebserviceInfo.STATE_RUNNING); - } - else if (jstate.queuing > 0) - { - wsInfo.setStatus(WebserviceInfo.STATE_QUEUING); - } - else - { - jobComplete = true; - if (jstate.finished > 0) - { - wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_OK); - } - else if (jstate.error > 0) - { - wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR); - } - else if (jstate.serror > 0) - { - wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_SERVERERROR); - } - } - if (!jobComplete) - { - try - { - Thread.sleep(5000); - } - catch (InterruptedException e) - { - Cache.log.debug("Interrupted sleep waiting for next job poll.", e); - } - // System.out.println("I'm alive "+alTitle); - } - } - if (jobComplete && jobs != null) - { - parseResult(); // tidy up and make results available to user - } - else - { - Cache.log.debug("WebServiceJob poll loop finished with no jobs created."); - wsInfo.setFinishedNoResults(); - } - } - - /** - * submit job to web service - * @param job - */ - abstract void StartJob(WSJob job); - - /** - * process the set of WSJob objects into a set of results, and tidy up. - */ - abstract void parseResult(); - - /** - * helper function to conserve dataset references to sequence objects returned from web services - * 1. Propagates AlCodonFrame data from codonframe to al - * @param al - */ - protected void propagateDatasetMappings(Alignment al) - { - if (codonframe!=null) - { - SequenceI[] alignment = al.getSequencesArray(); - for (int sq = 0; sq 0) + { + jobs[j].allowedServerExceptions--; + Cache.log.debug("Sleeping after a server exception."); + try + { + Thread.sleep(5000); + } + catch (InterruptedException ex1) + { + } + } + else + { + Cache.log.warn("Dropping job " + j + " " + jobs[j].jobId); + jobs[j].subjobComplete = true; + wsInfo.setStatus(jobs[j].jobnum, + WebserviceInfo.STATE_STOPPED_SERVERERROR); + } + } + catch (OutOfMemoryError er) + { + jobComplete = true; + jobs[j].subjobComplete = true; + jobs[j].result = null; // may contain out of date result object + wsInfo.setStatus(jobs[j].jobnum, + WebserviceInfo.STATE_STOPPED_ERROR); + JOptionPane + .showInternalMessageDialog( + Desktop.desktop, + "Out of memory handling result for job !!" + + + "\nSee help files for increasing Java Virtual Machine memory.", + "Out of memory", JOptionPane.WARNING_MESSAGE); + Cache.log.error("Out of memory when retrieving Job " + j + " id:" + + WsUrl + "/" + jobs[j].jobId, er); + System.gc(); + } + } + jstate.updateJobPanelState(wsInfo, OutputHeader, jobs[j]); + } + // Decide on overall state based on collected jobs[] states + if (jstate.running > 0) + { + wsInfo.setStatus(WebserviceInfo.STATE_RUNNING); + } + else if (jstate.queuing > 0) + { + wsInfo.setStatus(WebserviceInfo.STATE_QUEUING); + } + else + { + jobComplete = true; + if (jstate.finished > 0) + { + wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_OK); + } + else if (jstate.error > 0) + { + wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR); + } + else if (jstate.serror > 0) + { + wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_SERVERERROR); + } + } + if (!jobComplete) + { + try + { + Thread.sleep(5000); + } + catch (InterruptedException e) + { + Cache.log.debug("Interrupted sleep waiting for next job poll.", e); + } + // System.out.println("I'm alive "+alTitle); + } + } + if (jobComplete && jobs != null) + { + parseResult(); // tidy up and make results available to user + } + else + { + Cache.log.debug("WebServiceJob poll loop finished with no jobs created."); + wsInfo.setFinishedNoResults(); + } + } + + /** + * submit job to web service + * @param job + */ + abstract void StartJob(WSJob job); + + /** + * process the set of WSJob objects into a set of results, and tidy up. + */ + abstract void parseResult(); + + /** + * helper function to conserve dataset references to sequence objects returned from web services + * 1. Propagates AlCodonFrame data from codonframe to al + * @param al + */ + protected void propagateDatasetMappings(Alignment al) + { + if (codonframe!=null) + { + SequenceI[] alignment = al.getSequencesArray(); + for (int sq = 0; sq -1) - { - db = query.substring(0, p); - query = query.substring(p + 1); - } - if (querystring == null) - { - querystring = new StringBuffer(query); - } - else - { - querystring.append("," + query); - } - } - if (db == null) - { - System.err.println("Invalid Query string : '" + ids + - "'\nShould be of form 'dbname:q1;q2;q3;q4'"); - } - return fetchBatch(querystring.toString(), db, f, s); - } - - public String[] fetchBatch(String ids, String db, String f, String s) - { - // max 50 ids can be added at one time - try - { - //call.setOperationName(new QName("urn:Dbfetch", "fetchData")); - call.setOperationName(new QName("urn:Dbfetch", "fetchBatch")); - call.addParameter("ids", XMLType.XSD_STRING, ParameterMode.IN); - call.addParameter("db", XMLType.XSD_STRING, ParameterMode.IN); - call.addParameter("format", XMLType.XSD_STRING, ParameterMode.IN); - call.addParameter("style", XMLType.XSD_STRING, ParameterMode.IN); - call.setReturnType(XMLType.SOAP_ARRAY); - - if (f != null) - { - format = f; - } - - if (s != null) - { - style = s; - } - - try - { - return (String[]) call.invoke(new Object[] - {ids.toLowerCase(), db.toLowerCase(), - format, style}); - } - catch (OutOfMemoryError er) - { - System.out.println("OUT OF MEMORY DOWNLOADING QUERY FROM " + db + ":\n" + - ids); - } - return null; - } - catch (Exception ex) - { - if (ex.getMessage().startsWith( - "uk.ac.ebi.jdbfetch.exceptions.DbfNoEntryFoundException")) - { - return null; - } - System.err.println("Unexpected exception when retrieving from " + db + - "\nQuery was : '" + ids + "'"); - ex.printStackTrace(System.err); - return null; - } - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.ws.ebi; + +import java.io.*; +import java.util.*; +import javax.xml.namespace.*; +import javax.xml.rpc.*; + +import org.apache.axis.client.Call; +import org.apache.axis.client.Service; +import org.apache.axis.encoding.*; + +/** + * DOCUMENT ME! + * + * @author $author$ + * @version $Revision$ + */ +public class EBIFetchClient +{ + Call call; + String format = "default"; + String style = "raw"; + + /** + * Creates a new EBIFetchClient object. + */ + public EBIFetchClient() + { + try + { + call = (Call)new Service().createCall(); + call.setTargetEndpointAddress(new java.net.URL( + "http://www.ebi.ac.uk/ws/services/Dbfetch")); + } + catch (Exception ex) + { + } + } + + /** + * DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public String[] getSupportedDBs() + { + try + { + call.setOperationName(new QName("urn:Dbfetch", "getSupportedDBs")); + call.setReturnType(XMLType.SOAP_ARRAY); + + return (String[]) call.invoke(new Object[] + {}); + } + catch (Exception ex) + { + return null; + } + } + + /** + * DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public String[] getSupportedFormats() + { + try + { + call.setOperationName(new QName("urn:Dbfetch", "getSupportedFormats")); + call.setReturnType(XMLType.SOAP_ARRAY); + + return (String[]) call.invoke(new Object[] + {}); + } + catch (Exception ex) + { + return null; + } + } + + /** + * DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public String[] getSupportedStyles() + { + try + { + call.setOperationName(new QName("urn:Dbfetch", "getSupportedStyles")); + call.setReturnType(XMLType.SOAP_ARRAY); + + return (String[]) call.invoke(new Object[] + {}); + } + catch (Exception ex) + { + return null; + } + } + + + public File fetchDataAsFile(String ids, String f, String s) + { + String[] data = fetchData(ids, f, s); + File outFile = null; + try + { + outFile = File.createTempFile("jalview", ".xml"); + outFile.deleteOnExit(); + PrintWriter out = new PrintWriter(new FileOutputStream(outFile)); + int index = 0; + while (index < data.length) + { + out.println(data[index]); + index++; + } + out.close(); + } + catch (Exception ex) + {} + return outFile; + } + + /** + * Single DB multiple record retrieval + * + * @param ids db:query1;query2;query3 + * @param f raw/xml + * @param s ? + * + * @return Raw string array result of query set + */ + public String[] fetchData(String ids, String f, String s) + { + // Need to split + // ids of the form uniprot:25KD_SARPE;ADHR_DROPS; + StringTokenizer queries = new StringTokenizer(ids, ";"); + String db = null; + StringBuffer querystring = null; + while (queries.hasMoreTokens()) + { + String query = queries.nextToken(); + int p; + if ( (p = query.indexOf(':')) > -1) + { + db = query.substring(0, p); + query = query.substring(p + 1); + } + if (querystring == null) + { + querystring = new StringBuffer(query); + } + else + { + querystring.append("," + query); + } + } + if (db == null) + { + System.err.println("Invalid Query string : '" + ids + + "'\nShould be of form 'dbname:q1;q2;q3;q4'"); + } + return fetchBatch(querystring.toString(), db, f, s); + } + + public String[] fetchBatch(String ids, String db, String f, String s) + { + // max 50 ids can be added at one time + try + { + //call.setOperationName(new QName("urn:Dbfetch", "fetchData")); + call.setOperationName(new QName("urn:Dbfetch", "fetchBatch")); + call.addParameter("ids", XMLType.XSD_STRING, ParameterMode.IN); + call.addParameter("db", XMLType.XSD_STRING, ParameterMode.IN); + call.addParameter("format", XMLType.XSD_STRING, ParameterMode.IN); + call.addParameter("style", XMLType.XSD_STRING, ParameterMode.IN); + call.setReturnType(XMLType.SOAP_ARRAY); + + if (f != null) + { + format = f; + } + + if (s != null) + { + style = s; + } + + try + { + return (String[]) call.invoke(new Object[] + {ids.toLowerCase(), db.toLowerCase(), + format, style}); + } + catch (OutOfMemoryError er) + { + System.out.println("OUT OF MEMORY DOWNLOADING QUERY FROM " + db + ":\n" + + ids); + } + return null; + } + catch (Exception ex) + { + if (ex.getMessage().startsWith( + "uk.ac.ebi.jdbfetch.exceptions.DbfNoEntryFoundException")) + { + return null; + } + System.err.println("Unexpected exception when retrieving from " + db + + "\nQuery was : '" + ids + "'"); + ex.printStackTrace(System.err); + return null; + } + } +} diff --git a/src/jalview/ws/seqfetcher/ASequenceFetcher.java b/src/jalview/ws/seqfetcher/ASequenceFetcher.java index 0785ea2..3a167e5 100644 --- a/src/jalview/ws/seqfetcher/ASequenceFetcher.java +++ b/src/jalview/ws/seqfetcher/ASequenceFetcher.java @@ -1,3 +1,21 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ package jalview.ws.seqfetcher; import jalview.datamodel.AlignmentI; @@ -275,4 +293,4 @@ public class ASequenceFetcher return false; } -} \ No newline at end of file +} diff --git a/src/jalview/ws/seqfetcher/DbSourceProxy.java b/src/jalview/ws/seqfetcher/DbSourceProxy.java index f0e81fa..1b347f3 100644 --- a/src/jalview/ws/seqfetcher/DbSourceProxy.java +++ b/src/jalview/ws/seqfetcher/DbSourceProxy.java @@ -1,3 +1,21 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ package jalview.ws.seqfetcher; import jalview.datamodel.AlignmentI; diff --git a/src/jalview/ws/seqfetcher/DbSourceProxyImpl.java b/src/jalview/ws/seqfetcher/DbSourceProxyImpl.java index 21272be..ad05073 100644 --- a/src/jalview/ws/seqfetcher/DbSourceProxyImpl.java +++ b/src/jalview/ws/seqfetcher/DbSourceProxyImpl.java @@ -1,3 +1,21 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ package jalview.ws.seqfetcher; import jalview.datamodel.Alignment; diff --git a/src/vamsas/IMsaWS.java b/src/vamsas/IMsaWS.java index 7d02a94..b245155 100755 --- a/src/vamsas/IMsaWS.java +++ b/src/vamsas/IMsaWS.java @@ -1,22 +1,21 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package vamsas; import vamsas.objects.simple.*; diff --git a/src/vamsas/objects/simple/Alignment.java b/src/vamsas/objects/simple/Alignment.java index 18fa20c..41c3308 100755 --- a/src/vamsas/objects/simple/Alignment.java +++ b/src/vamsas/objects/simple/Alignment.java @@ -1,10 +1,21 @@ -/** - * Alignment.java - * - * This file was auto-generated from WSDL - * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter. +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package vamsas.objects.simple; public class Alignment extends vamsas.objects.simple.Object implements java.io.Serializable { diff --git a/src/vamsas/objects/simple/Alignment_Helper.java b/src/vamsas/objects/simple/Alignment_Helper.java index 5a54fe0..b8d76c4 100755 --- a/src/vamsas/objects/simple/Alignment_Helper.java +++ b/src/vamsas/objects/simple/Alignment_Helper.java @@ -1,10 +1,21 @@ -/** - * Alignment_Helper.java - * - * This file was auto-generated from WSDL - * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter. +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package vamsas.objects.simple; public class Alignment_Helper { diff --git a/src/vamsas/objects/simple/JpredResult.java b/src/vamsas/objects/simple/JpredResult.java index 26eb6b7..3f815fd 100755 --- a/src/vamsas/objects/simple/JpredResult.java +++ b/src/vamsas/objects/simple/JpredResult.java @@ -1,10 +1,21 @@ -/** - * JpredResult.java - * - * This file was auto-generated from WSDL - * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter. +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package vamsas.objects.simple; public class JpredResult diff --git a/src/vamsas/objects/simple/JpredResult_Helper.java b/src/vamsas/objects/simple/JpredResult_Helper.java index 12dff09..61e8e28 100755 --- a/src/vamsas/objects/simple/JpredResult_Helper.java +++ b/src/vamsas/objects/simple/JpredResult_Helper.java @@ -1,10 +1,21 @@ -/** - * JpredResult_Helper.java - * - * This file was auto-generated from WSDL - * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter. +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package vamsas.objects.simple; public class JpredResult_Helper diff --git a/src/vamsas/objects/simple/MsaResult.java b/src/vamsas/objects/simple/MsaResult.java index c8327dd..8229475 100755 --- a/src/vamsas/objects/simple/MsaResult.java +++ b/src/vamsas/objects/simple/MsaResult.java @@ -1,119 +1,130 @@ -/** - * MsaResult.java - * - * This file was auto-generated from WSDL - * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter. - */ - -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package vamsas.objects.simple; - -public class MsaResult - extends vamsas.objects.simple.Result implements java.io.Serializable -{ - private vamsas.objects.simple.Alignment msa; - private java.lang.Object __equalsCalc = null; - private boolean __hashCodeCalc = false; - - public MsaResult() - { - } - - public MsaResult(vamsas.objects.simple.Alignment msa) - { - this.msa = msa; - } - - /** - * Gets the msa value for this MsaResult. - * - * @return msa - */ - public vamsas.objects.simple.Alignment getMsa() - { - return msa; - } - - /** - * Sets the msa value for this MsaResult. - * - * @param msa - */ - public void setMsa(vamsas.objects.simple.Alignment msa) - { - this.msa = msa; - } - - public synchronized boolean equals(java.lang.Object obj) - { - if (! (obj instanceof MsaResult)) - { - return false; - } - - MsaResult other = (MsaResult) obj; - - if (obj == null) - { - return false; - } - - if (this == obj) - { - return true; - } - - if (__equalsCalc != null) - { - return (__equalsCalc == obj); - } - - __equalsCalc = obj; - - boolean _equals; - _equals = super.equals(obj) && - ( ( (this.msa == null) && (other.getMsa() == null)) || - ( (this.msa != null) && this.msa.equals(other.getMsa()))); - __equalsCalc = null; - - return _equals; - } - - public synchronized int hashCode() - { - if (__hashCodeCalc) - { - return 0; - } - - __hashCodeCalc = true; - - int _hashCode = super.hashCode(); - - if (getMsa() != null) - { - _hashCode += getMsa().hashCode(); - } - - __hashCodeCalc = false; - - return _hashCode; - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +/* + * Jalview - A Sequence Alignment Editor and Viewer + * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package vamsas.objects.simple; + +public class MsaResult + extends vamsas.objects.simple.Result implements java.io.Serializable +{ + private vamsas.objects.simple.Alignment msa; + private java.lang.Object __equalsCalc = null; + private boolean __hashCodeCalc = false; + + public MsaResult() + { + } + + public MsaResult(vamsas.objects.simple.Alignment msa) + { + this.msa = msa; + } + + /** + * Gets the msa value for this MsaResult. + * + * @return msa + */ + public vamsas.objects.simple.Alignment getMsa() + { + return msa; + } + + /** + * Sets the msa value for this MsaResult. + * + * @param msa + */ + public void setMsa(vamsas.objects.simple.Alignment msa) + { + this.msa = msa; + } + + public synchronized boolean equals(java.lang.Object obj) + { + if (! (obj instanceof MsaResult)) + { + return false; + } + + MsaResult other = (MsaResult) obj; + + if (obj == null) + { + return false; + } + + if (this == obj) + { + return true; + } + + if (__equalsCalc != null) + { + return (__equalsCalc == obj); + } + + __equalsCalc = obj; + + boolean _equals; + _equals = super.equals(obj) && + ( ( (this.msa == null) && (other.getMsa() == null)) || + ( (this.msa != null) && this.msa.equals(other.getMsa()))); + __equalsCalc = null; + + return _equals; + } + + public synchronized int hashCode() + { + if (__hashCodeCalc) + { + return 0; + } + + __hashCodeCalc = true; + + int _hashCode = super.hashCode(); + + if (getMsa() != null) + { + _hashCode += getMsa().hashCode(); + } + + __hashCodeCalc = false; + + return _hashCode; + } +} diff --git a/src/vamsas/objects/simple/MsaResult_Helper.java b/src/vamsas/objects/simple/MsaResult_Helper.java index b43e05b..f9d0924 100755 --- a/src/vamsas/objects/simple/MsaResult_Helper.java +++ b/src/vamsas/objects/simple/MsaResult_Helper.java @@ -1,78 +1,89 @@ -/** - * MsaResult_Helper.java - * - * This file was auto-generated from WSDL - * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter. - */ - -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package vamsas.objects.simple; - -public class MsaResult_Helper -{ - // Type metadata - private static org.apache.axis.description.TypeDesc typeDesc = new org.apache. - axis.description.TypeDesc(MsaResult.class, - true); - - static - { - typeDesc.setXmlType(new javax.xml.namespace.QName( - "simple.objects.vamsas", "MsaResult")); - - org.apache.axis.description.ElementDesc elemField = new org.apache.axis. - description.ElementDesc(); - elemField.setFieldName("msa"); - elemField.setXmlName(new javax.xml.namespace.QName("", "msa")); - elemField.setXmlType(new javax.xml.namespace.QName( - "simple.objects.vamsas", "Alignment")); - typeDesc.addFieldDesc(elemField); - } - - /** - * Return type metadata object - */ - public static org.apache.axis.description.TypeDesc getTypeDesc() - { - return typeDesc; - } - - /** - * Get Custom Serializer - */ - public static org.apache.axis.encoding.Serializer getSerializer( - java.lang.String mechType, java.lang.Class _javaType, - javax.xml.namespace.QName _xmlType) - { - return new org.apache.axis.encoding.ser.BeanSerializer(_javaType, - _xmlType, typeDesc); - } - - /** - * Get Custom Deserializer - */ - public static org.apache.axis.encoding.Deserializer getDeserializer( - java.lang.String mechType, java.lang.Class _javaType, - javax.xml.namespace.QName _xmlType) - { - return new org.apache.axis.encoding.ser.BeanDeserializer(_javaType, - _xmlType, typeDesc); - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +/* + * Jalview - A Sequence Alignment Editor and Viewer + * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package vamsas.objects.simple; + +public class MsaResult_Helper +{ + // Type metadata + private static org.apache.axis.description.TypeDesc typeDesc = new org.apache. + axis.description.TypeDesc(MsaResult.class, + true); + + static + { + typeDesc.setXmlType(new javax.xml.namespace.QName( + "simple.objects.vamsas", "MsaResult")); + + org.apache.axis.description.ElementDesc elemField = new org.apache.axis. + description.ElementDesc(); + elemField.setFieldName("msa"); + elemField.setXmlName(new javax.xml.namespace.QName("", "msa")); + elemField.setXmlType(new javax.xml.namespace.QName( + "simple.objects.vamsas", "Alignment")); + typeDesc.addFieldDesc(elemField); + } + + /** + * Return type metadata object + */ + public static org.apache.axis.description.TypeDesc getTypeDesc() + { + return typeDesc; + } + + /** + * Get Custom Serializer + */ + public static org.apache.axis.encoding.Serializer getSerializer( + java.lang.String mechType, java.lang.Class _javaType, + javax.xml.namespace.QName _xmlType) + { + return new org.apache.axis.encoding.ser.BeanSerializer(_javaType, + _xmlType, typeDesc); + } + + /** + * Get Custom Deserializer + */ + public static org.apache.axis.encoding.Deserializer getDeserializer( + java.lang.String mechType, java.lang.Class _javaType, + javax.xml.namespace.QName _xmlType) + { + return new org.apache.axis.encoding.ser.BeanDeserializer(_javaType, + _xmlType, typeDesc); + } +} diff --git a/src/vamsas/objects/simple/Msfalignment.java b/src/vamsas/objects/simple/Msfalignment.java index 242b14f..58c5f87 100755 --- a/src/vamsas/objects/simple/Msfalignment.java +++ b/src/vamsas/objects/simple/Msfalignment.java @@ -1,10 +1,21 @@ -/** - * Msfalignment.java - * - * This file was auto-generated from WSDL - * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter. +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package vamsas.objects.simple; public class Msfalignment diff --git a/src/vamsas/objects/simple/Msfalignment_Helper.java b/src/vamsas/objects/simple/Msfalignment_Helper.java index 9b9288d..5c7483d 100755 --- a/src/vamsas/objects/simple/Msfalignment_Helper.java +++ b/src/vamsas/objects/simple/Msfalignment_Helper.java @@ -1,10 +1,21 @@ -/** - * Msfalignment_Helper.java - * - * This file was auto-generated from WSDL - * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter. +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package vamsas.objects.simple; public class Msfalignment_Helper diff --git a/src/vamsas/objects/simple/Object.java b/src/vamsas/objects/simple/Object.java index 4bf69bd..7757079 100755 --- a/src/vamsas/objects/simple/Object.java +++ b/src/vamsas/objects/simple/Object.java @@ -1,10 +1,21 @@ -/** - * Object.java - * - * This file was auto-generated from WSDL - * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter. +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package vamsas.objects.simple; public abstract class Object implements java.io.Serializable { diff --git a/src/vamsas/objects/simple/Object_Helper.java b/src/vamsas/objects/simple/Object_Helper.java index a1b944c..42a6066 100755 --- a/src/vamsas/objects/simple/Object_Helper.java +++ b/src/vamsas/objects/simple/Object_Helper.java @@ -1,10 +1,21 @@ -/** - * Object_Helper.java - * - * This file was auto-generated from WSDL - * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter. +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package vamsas.objects.simple; public class Object_Helper { diff --git a/src/vamsas/objects/simple/Result.java b/src/vamsas/objects/simple/Result.java index b349019..f761c5a 100755 --- a/src/vamsas/objects/simple/Result.java +++ b/src/vamsas/objects/simple/Result.java @@ -1,10 +1,21 @@ -/** - * Result.java - * - * This file was auto-generated from WSDL - * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter. +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package vamsas.objects.simple; public class Result implements java.io.Serializable { diff --git a/src/vamsas/objects/simple/Result_Helper.java b/src/vamsas/objects/simple/Result_Helper.java index 14ed2b5..966c0bf 100755 --- a/src/vamsas/objects/simple/Result_Helper.java +++ b/src/vamsas/objects/simple/Result_Helper.java @@ -1,10 +1,21 @@ -/** - * Result_Helper.java - * - * This file was auto-generated from WSDL - * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter. +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package vamsas.objects.simple; public class Result_Helper { diff --git a/src/vamsas/objects/simple/Secstructpred.java b/src/vamsas/objects/simple/Secstructpred.java index 8b334f4..f3b7e45 100755 --- a/src/vamsas/objects/simple/Secstructpred.java +++ b/src/vamsas/objects/simple/Secstructpred.java @@ -1,10 +1,21 @@ -/** - * Secstructpred.java - * - * This file was auto-generated from WSDL - * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter. +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package vamsas.objects.simple; public class Secstructpred diff --git a/src/vamsas/objects/simple/Secstructpred_Helper.java b/src/vamsas/objects/simple/Secstructpred_Helper.java index 7e2ef3d..2ce035c 100755 --- a/src/vamsas/objects/simple/Secstructpred_Helper.java +++ b/src/vamsas/objects/simple/Secstructpred_Helper.java @@ -1,10 +1,21 @@ -/** - * Secstructpred_Helper.java - * - * This file was auto-generated from WSDL - * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter. +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package vamsas.objects.simple; public class Secstructpred_Helper diff --git a/src/vamsas/objects/simple/SeqSearchResult.java b/src/vamsas/objects/simple/SeqSearchResult.java index 4d75aad..2f2a956 100644 --- a/src/vamsas/objects/simple/SeqSearchResult.java +++ b/src/vamsas/objects/simple/SeqSearchResult.java @@ -1,10 +1,21 @@ -/** - * SeqSearchResult.java - * - * This file was auto-generated from WSDL - * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter. +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package vamsas.objects.simple; public class SeqSearchResult extends vamsas.objects.simple.Result implements java.io.Serializable { diff --git a/src/vamsas/objects/simple/SeqSearchResult_Helper.java b/src/vamsas/objects/simple/SeqSearchResult_Helper.java index 3f6e30d..abb877a 100644 --- a/src/vamsas/objects/simple/SeqSearchResult_Helper.java +++ b/src/vamsas/objects/simple/SeqSearchResult_Helper.java @@ -1,10 +1,21 @@ -/** - * SeqSearchResult_Helper.java - * - * This file was auto-generated from WSDL - * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter. +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package vamsas.objects.simple; public class SeqSearchResult_Helper { diff --git a/src/vamsas/objects/simple/Sequence.java b/src/vamsas/objects/simple/Sequence.java index d2eccb0..2fa032e 100755 --- a/src/vamsas/objects/simple/Sequence.java +++ b/src/vamsas/objects/simple/Sequence.java @@ -1,10 +1,21 @@ -/** - * Sequence.java - * - * This file was auto-generated from WSDL - * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter. +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package vamsas.objects.simple; public class Sequence implements java.io.Serializable { diff --git a/src/vamsas/objects/simple/SequenceSet.java b/src/vamsas/objects/simple/SequenceSet.java index 62e58b4..7e9ea5b 100755 --- a/src/vamsas/objects/simple/SequenceSet.java +++ b/src/vamsas/objects/simple/SequenceSet.java @@ -1,10 +1,21 @@ -/** - * SequenceSet.java - * - * This file was auto-generated from WSDL - * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter. +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package vamsas.objects.simple; public class SequenceSet implements java.io.Serializable { diff --git a/src/vamsas/objects/simple/SequenceSet_Helper.java b/src/vamsas/objects/simple/SequenceSet_Helper.java index 77586ba..5e8a99f 100755 --- a/src/vamsas/objects/simple/SequenceSet_Helper.java +++ b/src/vamsas/objects/simple/SequenceSet_Helper.java @@ -1,10 +1,21 @@ -/** - * SequenceSet_Helper.java - * - * This file was auto-generated from WSDL - * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter. +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package vamsas.objects.simple; public class SequenceSet_Helper { diff --git a/src/vamsas/objects/simple/Sequence_Helper.java b/src/vamsas/objects/simple/Sequence_Helper.java index f675384..a74115a 100755 --- a/src/vamsas/objects/simple/Sequence_Helper.java +++ b/src/vamsas/objects/simple/Sequence_Helper.java @@ -1,10 +1,21 @@ -/** - * Sequence_Helper.java - * - * This file was auto-generated from WSDL - * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter. +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package vamsas.objects.simple; public class Sequence_Helper { diff --git a/src/vamsas/objects/simple/WsJobId.java b/src/vamsas/objects/simple/WsJobId.java index 4bc1f2e..a40f29e 100755 --- a/src/vamsas/objects/simple/WsJobId.java +++ b/src/vamsas/objects/simple/WsJobId.java @@ -1,10 +1,21 @@ -/** - * WsJobId.java - * - * This file was auto-generated from WSDL - * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter. +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package vamsas.objects.simple; public class WsJobId implements java.io.Serializable { diff --git a/src/vamsas/objects/simple/WsJobId_Helper.java b/src/vamsas/objects/simple/WsJobId_Helper.java index 3988ce9..23fa516 100755 --- a/src/vamsas/objects/simple/WsJobId_Helper.java +++ b/src/vamsas/objects/simple/WsJobId_Helper.java @@ -1,10 +1,21 @@ -/** - * WsJobId_Helper.java - * - * This file was auto-generated from WSDL - * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter. +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package vamsas.objects.simple; public class WsJobId_Helper { diff --git a/utils/help2Website.java b/utils/help2Website.java index 7a666ad..6bb4dfc 100755 --- a/utils/help2Website.java +++ b/utils/help2Website.java @@ -1,95 +1,113 @@ -import java.io.*; -import java.util.*; - -public class help2Website -{ - - public static void main(String [] args) - { - String line = ""; - try{ - Hashtable targets = new Hashtable(); - - File toc = new File("helpTOC.xml"); - File jhm = new File("help.jhm"); - - BufferedReader in = new BufferedReader(new FileReader(jhm)); - - PrintWriter out = new PrintWriter(new FileWriter("helpTOC.html")); - out.println("Jalview - Help \n" - +"\n" - +"

Contents

\n"); - - - StringTokenizer st; - StringBuffer indent = new StringBuffer(); - String target, url, text; - while( (line = in.readLine()) != null) - { - if(line.indexOf("target")==-1) - continue; - - - st = new StringTokenizer(line, "\""); - st.nextToken(); //")!=-1) - indent.setLength(indent.length()-18); - - if(line.indexOf(""+indent+"" - +text - +""); - else - out.println("
"+indent+text); - - - if(line.indexOf("/>")==-1) - indent.append("   "); - - } - - out.println("\n"); - - - out.close(); - - } - - catch(Exception ex) - { - - ex.printStackTrace(); - - System.out.println("\n"+line+"\n"); - - System.out.println("Usage: move to Help directory. help2Website will read" - +"\nhelpTOC.xml and help.jhm producing output helpTOC.html"); - } - } - - -} \ No newline at end of file +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +import java.io.*; +import java.util.*; + +public class help2Website +{ + + public static void main(String [] args) + { + String line = ""; + try{ + Hashtable targets = new Hashtable(); + + File toc = new File("helpTOC.xml"); + File jhm = new File("help.jhm"); + + BufferedReader in = new BufferedReader(new FileReader(jhm)); + + PrintWriter out = new PrintWriter(new FileWriter("helpTOC.html")); + out.println("Jalview - Help \n" + +"\n" + +"

Contents

\n"); + + + StringTokenizer st; + StringBuffer indent = new StringBuffer(); + String target, url, text; + while( (line = in.readLine()) != null) + { + if(line.indexOf("target")==-1) + continue; + + + st = new StringTokenizer(line, "\""); + st.nextToken(); //")!=-1) + indent.setLength(indent.length()-18); + + if(line.indexOf(""+indent+"" + +text + +""); + else + out.println("
"+indent+text); + + + if(line.indexOf("/>")==-1) + indent.append("   "); + + } + + out.println("\n"); + + + out.close(); + + } + + catch(Exception ex) + { + + ex.printStackTrace(); + + System.out.println("\n"+line+"\n"); + + System.out.println("Usage: move to Help directory. help2Website will read" + +"\nhelpTOC.xml and help.jhm producing output helpTOC.html"); + } + } + + +} -- 1.7.10.2