From: tcofoegbu Date: Tue, 28 Jul 2015 09:27:35 +0000 (+0100) Subject: JAL-857 merge from develop X-Git-Tag: Release_2_10_0~479^2~1 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=165e5fdcd9704bfd15243fbd41d33ca100383762;hp=0fac2de2be3358820e141165c5b6b020fe965193;p=jalview.git JAL-857 merge from develop --- diff --git a/.classpath b/.classpath index 3fac886..473d937 100644 --- a/.classpath +++ b/.classpath @@ -36,8 +36,6 @@ - - @@ -48,7 +46,7 @@ - + @@ -66,6 +64,7 @@ + diff --git a/TESTNG b/TESTNG new file mode 100644 index 0000000..f18885f --- /dev/null +++ b/TESTNG @@ -0,0 +1,2 @@ +# Summary of TestNG for this branch +"Functional" Tests: 242 ran, 121 failed. diff --git a/THIRDPARTYLIBS b/THIRDPARTYLIBS index bbef868..3094939 100644 --- a/THIRDPARTYLIBS +++ b/THIRDPARTYLIBS @@ -10,8 +10,8 @@ ext.edu.ucsf.rbvi.strucviz2 includes sources originally developed by Scooter Mor Licencing information for each library is given below: JGoogleAnalytics_0.3.jar APL 2.0 License - http://code.google.com/p/jgoogleanalytics/ -Jmol-12.1.13.jar GPL/LGPLv2 http://sourceforge.net/projects/jmol/files/ -VARNAv3-91.jar GPL licenced software by Kévin Darty, Alain Denise and Yann Ponty. http://varna.lri.fr +Jmol-14.2.14_2015.06.11.jar GPL/LGPLv2 http://sourceforge.net/projects/jmol/files/ +VARNAv3-93.jar GPL licenced software by K�vin Darty, Alain Denise and Yann Ponty. http://varna.lri.fr activation.jar apache-mime4j-0.6.jar axis.jar diff --git a/appletlib/JmolApplet-12.2.4.jar b/appletlib/JmolApplet-12.2.4.jar deleted file mode 100644 index e17c4ac..0000000 Binary files a/appletlib/JmolApplet-12.2.4.jar and /dev/null differ diff --git a/appletlib/JmolApplet-14.2.14_2015.06.11.jar b/appletlib/JmolApplet-14.2.14_2015.06.11.jar new file mode 100644 index 0000000..5d6338c Binary files /dev/null and b/appletlib/JmolApplet-14.2.14_2015.06.11.jar differ diff --git a/build.xml b/build.xml index 02e8253..d0aad96 100755 --- a/build.xml +++ b/build.xml @@ -112,8 +112,8 @@ - - + + @@ -547,7 +547,7 @@ + excludes="ext/**,gui/**,jbgui/**,MCview/**,org/**,vamsas/**,jalview/ext/rbvi/**,jalview/ext/paradise/**" /> diff --git a/examples/biojson-doc/.gitignore b/examples/biojson-doc/.gitignore new file mode 100755 index 0000000..0736b15 --- /dev/null +++ b/examples/biojson-doc/.gitignore @@ -0,0 +1,3 @@ +.idea +docson.iml +/nbproject diff --git a/examples/biojson-doc/LICENSE b/examples/biojson-doc/LICENSE new file mode 100755 index 0000000..e06d208 --- /dev/null +++ b/examples/biojson-doc/LICENSE @@ -0,0 +1,202 @@ +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/examples/biojson-doc/README.md b/examples/biojson-doc/README.md new file mode 100755 index 0000000..2b1de69 --- /dev/null +++ b/examples/biojson-doc/README.md @@ -0,0 +1,114 @@ +

A swisspush project

+Docson +====== + +Documentation for your JSON types. + +Give Docson a JSON schema and it will generate a [beautiful documentation](http://lbovet.github.io/docson/index.html#/docson/examples/example.json). + +## Features +* [JSON schema](http://json-schema.org/) v4 keywords. +* Runs entirely in the browser. +* Render schema descriptions with markdown + +## Installation + +* Place the Docson distribution on the web server serving the schemas (to avoid cross-origin issues). + +## Usage + +* Open [index.html](http://lbovet.github.io/docson/index.html) and enter the schema path in the form field. +* Or give the schema path directly as hash parameter: [index.html#/docson/examples/example.json](http://lbovet.github.io/docson/index.html#/docson/examples/example.json) + +Note that you can refer to a sub-schema by adding a json-pointer path as 'dollar-parameter': [index.html#/docson/examples/example.json$items](http://lbovet.github.io/docson/index.html#/docson/examples/example.json$items) + +## Typson + +You can directly reference your JSON types defined as TypeScript interfaces. If the path ends with `.ts`, Docson will use [Typson](https://github.com/lbovet/typson) to convert the Type Scripts to schema in order to generate the documentation. + +For example, [index.html#/typson/example/invoice/line.ts$InvoiceLine](http://lbovet.github.io/docson/index.html#/typson/example/invoice/line.ts$InvoiceLine) is the documentation of [line.ts](https://github.com/lbovet/typson/blob/master/example/invoice/line.ts). + +You need to install [Typson](https://github.com/lbovet/typson) by yourself on your server. It must be in a directory named `typson` located at the same level as the `docson` directory. + +## Widget + +To include a Docson schema documentations on any page (wiki, ...) without worrying about messing up with javascript libraries and cross-origin issues: + +* Install Docson somewhere as described above. +* Place the following `script` tags in the including page, nothing else is needed: + +``` + +``` + +See the [widget example](http://jsfiddle.net/3kXu2/3/) on jsfiddle. + +## Swagger + +You can adapt [Swagger UI](https://github.com/wordnik/swagger-ui) to display Docson-generated model documentation instead of the builtin signatures. + +See how it looks like in the [Swagger Docson example](http://lbovet.github.io/swagger-ui/dist/index.html) + +In Swagger UI's `index.html`, include the [Swagger integration script after other script tags](https://github.com/lbovet/swagger-ui/blob/3f37722b03db6c48cc2a8460df26dda5f4d6f8e4/src/main/html/index.html#L19): +``` + +``` + +Also, you will need a patched version of [Swagger Client](https://github.com/lbovet/swagger-js/blob/models-exposed/lib/swagger.js) so that the raw json-schema model is visible from Docson. Either replace the `swagger.js` file in your Swagger UI disctribution or take it directly from github by replacing + +``` + +``` + +with + +``` + +``` + +For a better layout of parameter models, you may [want to change the width of some elements](https://github.com/lbovet/swagger-ui/blob/3f37722b03db6c48cc2a8460df26dda5f4d6f8e4/src/main/html/index.html#L20-L27): + +``` + +``` + +## Integration + +You can also integrate Docson in your application and use its javascript API: + +```javascript +docson.doc(element, schema, ref) +``` + +* `element` is the element which will host the documentation. Either a DOM element (id or object) or jQuery element. +* `schema` is the URI or path to the schema or a string containing the schema source itself. +* `ref` is an optional json-pointer path to a sub-schema. + +Examples: +* [Simple integration example](http://lbovet.github.io/docson/examples/example.html) +* [See it in action](http://lbovet.github.io/typson-demo/) with its buddy [typson](https://github.com/lbovet/typson). + +## Limitations + +* Mixing unrelated keywords can lead to unexpected results. + +Not implemented: +* Non-primitive values in enums and default values +* dependencies, additionalItems, patternProperties + +## Development + +* [All tests](http://lbovet.github.io/docson/tests/test.html) + +Please pull-request your failing schemas in the `tests/` folder and open an issue describing the expected result. + +[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/lbovet/docson/trend.png)](https://bitdeli.com/free "Bitdeli Badge") + diff --git a/examples/biojson-doc/biojsonschema.json b/examples/biojson-doc/biojsonschema.json new file mode 100644 index 0000000..e6670d2 --- /dev/null +++ b/examples/biojson-doc/biojsonschema.json @@ -0,0 +1 @@ +{"$schema":"http://json-schema.org/draft-04/schema#","id":"http://jsonschema.net","type":"object","properties":{"seqs":{"id":"http://jsonschema.net/seqs","type":"array","items":{"id":"http://jsonschema.net/seqs/0","type":"object","properties":{"name":{"id":"http://jsonschema.net/seqs/0/name","type":"string","description":"Sequence name"},"start":{"id":"http://jsonschema.net/seqs/0/start","type":"integer","description":"Start residue position"},"svid":{"id":"http://jsonschema.net/seqs/0/svid","type":"string","description":"Serial version id for sequence object"},"end":{"id":"http://jsonschema.net/seqs/0/end","type":"integer","description":"End residue position"},"id":{"id":"http://jsonschema.net/seqs/0/id","type":"string","description":"Sequence unique identifier"},"seq":{"id":"http://jsonschema.net/seqs/0/seq","type":"string","description":"Sequence Residues"},"order":{"id":"http://jsonschema.net/seqs/0/order","type":"integer","description":"Sequence order in an alignment space"}},"required":["name","start","svid","end","id","seq"]},"required":["0"],"description":"Sequences in the Alignemnt","minItems":"1","maxItems":"*"},"appSettings":{"id":"http://jsonschema.net/appSettings","type":"object","properties":{"globalColorScheme":{"id":"http://jsonschema.net/appSettings/globalColorScheme","type":"string","description":"Global colour schem for the alignment"},"webStartUrl":{"id":"http://jsonschema.net/appSettings/webStartUrl","type":"string","description":"Jalview specific setting which points to a url for launching Jalview"},"application":{"id":"http://jsonschema.net/appSettings/application","type":"string","description":"Application which generated the Json"},"showSeqFeatures":{"id":"http://jsonschema.net/appSettings/showSeqFeatures","type":"string","description":"Determines if sequence features are visible or not"},"version":{"id":"http://jsonschema.net/appSettings/version","type":"string","description":"Verion of the application which generated the JSON"},"hiddenCols":{"id":"http://jsonschema.net/appSettings/hiddenCols","type":"string","description":"Delimited lists of hidden colums ranges i.e [2-3,5-5,11-23]"}},"description":"Application specific settings"},"seqGroups":{"id":"http://jsonschema.net/seqGroups","type":"array","items":[{"id":"http://jsonschema.net/seqGroups/0","type":"object","properties":{"displayText":{"id":"http://jsonschema.net/seqGroups/0/displayText","type":"boolean","description":"Determines if the texts of the group is displayed or not"},"startRes":{"id":"http://jsonschema.net/seqGroups/0/startRes","type":"integer","description":"Start residue position for a given group"},"groupName":{"id":"http://jsonschema.net/seqGroups/0/groupName","type":"string","description":"Group name"},"endRes":{"id":"http://jsonschema.net/seqGroups/0/endRes","type":"integer","description":"End residue position for a given group"},"colourText":{"id":"http://jsonschema.net/seqGroups/0/colourText","type":"boolean","description":"Determines if the Residues text for the group is coloured"},"seqsHash":{"id":"http://jsonschema.net/seqGroups/0/seqsHash","type":"array","items":[],"minItems":"0","maxItems":"*","description":"The id's of the sequences which belongs to the group"},"svid":{"id":"http://jsonschema.net/seqGroups/0/svid","type":"string","description":"Serial version id for a given group"},"showNonconserved":{"id":"http://jsonschema.net/seqGroups/0/showNonconserved","type":"boolean","description":"Determines if non conserved regions of a group is shown or not"},"colourScheme":{"id":"http://jsonschema.net/seqGroups/0/colourScheme","type":"string","description":"Colour Scheme for the sequence group"},"displayBoxes":{"id":"http://jsonschema.net/seqGroups/0/displayBoxes","type":"boolean","description":"Determines if the group border should be visible or not"}}}],"description":"Sequence groups in the Alignment","minItems":"0","maxItems":"*"},"alignAnnotation":{"id":"http://jsonschema.net/alignAnnotation","type":"array","items":{"id":"http://jsonschema.net/alignAnnotation/0","type":"object","properties":{"svid":{"id":"http://jsonschema.net/alignAnnotation/0/svid","type":"string","description":"Serial version id for the annotation object"},"annotations":{"id":"http://jsonschema.net/alignAnnotation/0/annotations","type":"array","items":[{"id":"http://jsonschema.net/alignAnnotation/0/annotations/0","type":"object","properties":{"displayCharacter":{"id":"http://jsonschema.net/alignAnnotation/0/annotations/0/displayCharacter","type":"string","description":"Display character to denote the given annotation"},"value":{"id":"http://jsonschema.net/alignAnnotation/0/annotations/0/value","type":"integer","description":"Value of the annotation"},"secondaryStructure":{"id":"http://jsonschema.net/alignAnnotation/0/annotations/0/secondaryStructure","type":"string","description":"Secondary structure symbol for the given annotation"}}},{"id":"http://jsonschema.net/alignAnnotation/0/annotations/1","type":"object","properties":{"displayCharacter":{"id":"http://jsonschema.net/alignAnnotation/0/annotations/1/displayCharacter","type":"string"},"value":{"id":"http://jsonschema.net/alignAnnotation/0/annotations/1/value","type":"integer"},"secondaryStructure":{"id":"http://jsonschema.net/alignAnnotation/0/annotations/1/secondaryStructure","type":"string"}}},{"id":"http://jsonschema.net/alignAnnotation/0/annotations/2","type":"object","properties":{"displayCharacter":{"id":"http://jsonschema.net/alignAnnotation/0/annotations/2/displayCharacter","type":"string"},"value":{"id":"http://jsonschema.net/alignAnnotation/0/annotations/2/value","type":"integer"},"secondaryStructure":{"id":"http://jsonschema.net/alignAnnotation/0/annotations/2/secondaryStructure","type":"string"}}}]},"description":{"id":"http://jsonschema.net/alignAnnotation/0/description","type":"string","description":"Description of the Alignment Annotation"},"label":{"id":"http://jsonschema.net/alignAnnotation/0/label","type":"string","description":"Label for the Annotation"}}},"description":"Alignment Annotations","minItems":"0","maxItems":"*"},"svid":{"id":"http://jsonschema.net/svid","type":"string","description":"Serial version id"},"seqFeatures":{"id":"http://jsonschema.net/seqFeatures","type":"array","items":{"id":"http://jsonschema.net/seqFeatures/0","type":"object","properties":{"fillColor":{"id":"http://jsonschema.net/seqFeatures/0/fillColor","type":"string","description":"Fill colour"},"score":{"id":"http://jsonschema.net/seqFeatures/0/score","type":"integer","description":"Score"},"sequenceRef":{"id":"http://jsonschema.net/seqFeatures/0/sequenceRef","type":"string","description":"Reference to the Sequence in the alignement (More like a foreign key)"},"featureGroup":{"id":"http://jsonschema.net/seqFeatures/0/featureGroup","type":"string","description":"Feature Group"},"svid":{"id":"http://jsonschema.net/seqFeatures/0/svid","type":"string","description":"Serial version id for the SeqFeature object"},"description":{"id":"http://jsonschema.net/seqFeatures/0/description","type":"string","description":"Description of Feature"},"xStart":{"id":"http://jsonschema.net/seqFeatures/0/xStart","type":"integer","description":"Start residue position for the sequence feature"},"xEnd":{"id":"http://jsonschema.net/seqFeatures/0/xEnd","type":"integer","description":"End residue position for the sequence feature"},"type":{"id":"http://jsonschema.net/seqFeatures/0/type","type":"string","description":"The name of the SequenceFeature"}}},"minItems":"0","maxItems":"*","description":"Sequence Features within the alignment"}},"required":["seqs","appSettings","seqGroups","alignAnnotation","svid","seqFeatures"]} \ No newline at end of file diff --git a/examples/biojson-doc/bower.json b/examples/biojson-doc/bower.json new file mode 100755 index 0000000..847e758 --- /dev/null +++ b/examples/biojson-doc/bower.json @@ -0,0 +1,25 @@ +{ + "name": "docson", + "main": "docson.js", + "version": "0.1.0", + "homepage": "https://github.com/lbovet/docson", + "authors": [ + "Laurent Bovet " + ], + "description": "Documentation for your JSON types", + "moduleType": [ + "amd" + ], + "keywords": [ + "docson", + "json" + ], + "license": "http://www.apache.org/licenses/LICENSE-2.0", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ] +} diff --git a/examples/biojson-doc/css/docson.css b/examples/biojson-doc/css/docson.css new file mode 100755 index 0000000..1627e74 --- /dev/null +++ b/examples/biojson-doc/css/docson.css @@ -0,0 +1,476 @@ +/* + * Copyright 2013 Laurent Bovet + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +.docson { + font-family: 'Droid Sans',verdana,helvetica; + font-size: 13px; + padding: 6px 6px 6px 6px; +} + +.docson .box { + position: relative; + float: left; + background-color:rgba(255, 255, 255, 0.2); + border: 1px solid lightgrey; + border-radius: 4px; + -moz-border-radius: 4px; + -webkit-border-radius: 4px; + padding-bottom: 10px; + -moz-box-shadow: 1px 1px 1px darkgray; + -webkit-box-shadow: 1px 1px 1px darkgray; + box-shadow: 1px 1px 1px darkgray; +} + +.docson .expand-button { + position: absolute; + margin-top: 15px; + padding: 2px; + right: 2px; + float: right; + width: 18px; + text-align: center; + cursor: pointer; + font-weight: bold; + font-family: "Lucida Console", Monaco, monospace; + font-size: 15px; + color: darkgray; + display: none; +} + +.docson .source-button { + position: absolute; + padding: 2px; + margin-top: 3px; + right: 2px; + width: 18px; + text-align: center; + cursor: pointer; + font-weight: bold; + font-family: "Lucida Console", Monaco, monospace; + font-size: 10px; + color: darkgray; + display: none; +} + +.docson .box-header { + padding: 6px; + border-top-left-radius: 4px; + border-top-right-radius: 4px; + border-bottom: 1px solid lightgrey; + background: whitesmoke; + /* background: -webkit-linear-gradient(ghostwhite, whitesmoke, whitesmoke, gainsboro); + background: -moz-linear-gradient(ghostwhite, whitesmoke, whitesmoke, gainsboro);*/ +} + +.docson .box-name { + color: darkblue; + padding: 5px 40px 2px 3px; + float: left; +} + +.docson .title { + margin-top: -3px; + font-size: 120%; +} + +.docson .link { + text-decoration: underline; +} + +.docson .box-description { + color: dimgray; + float: left; + max-width: 600px; +} + +.docson .end { + clear: both; +} + +.docson .error { + color: red; +} + +.docson .box-body { + padding-left: 10px; + padding-right: 28px; + clear: both; +} + +.docson .box-1 { + background: whitesmoke;/* + background: -webkit-linear-gradient(ghostwhite, whitesmoke, whitesmoke, gainsboro); + background: -moz-linear-gradient(ghostwhite, whitesmoke, whitesmoke, gainsboro);*/ +} + +.docson .box-2 { + background: beige; + background: -webkit-linear-gradient(white, beige, beige, gainsboro); + background: -moz-linear-gradient(white, beige, beige, gainsboro); +} + +.docson .box-3 { + background: azure; + background: -webkit-linear-gradient(white, azure, azure, gainsboro); + background: -moz-linear-gradient(white, azure, azure, gainsboro); +} + +.docson .box-4 { + background: mistyrose; + background: -webkit-linear-gradient(white, mistyrose, mistyrose, gainsboro); + background: -moz-linear-gradient(white, mistyrose, mistyrose, gainsboro); +} + +.docson .box-5 { + background: #ddffee; + background: -webkit-linear-gradient(white, #ddffee, #ddffee, gainsboro); + background: -moz-linear-gradient(white, #ddffee, #ddffee, gainsboro); +} + +.docson .box-6 { + background: ghostwhite; + background: -webkit-linear-gradient(white, ghostwhite, ghostwhite, gainsboro); + background: -moz-linear-gradient(white, ghostwhite, ghostwhite, gainsboro); +} + +.docson .box-7 { + background: lavenderblush; + background: -webkit-linear-gradient(white, lavenderblush, lavenderblush, gainsboro); + background: -moz-linear-gradient(white, lavenderblush, lavenderblush, gainsboro); +} + +.docson .box-8 { + background: aliceblue; + background: -webkit-linear-gradient(white, aliceblue, aliceblue, gainsboro); + background: -moz-linear-gradient(white, aliceblue, aliceblue, gainsboro); +} + +.docson .signature { + padding-top: 5px; + clear: left; +} + +.docson .signature-header { + padding-top: 3px; + height: 20px; + line-height: 24px; +} + +.docson .property-name { + float: left; + font-family: "Lucida Console", Monaco, monospace; + min-width: 130px; +} + +.docson .required { + font-weight: bold; +} + +.docson .type-keyword { + font-size: 80%; + color: dimgray; +} + +.docson .type-pattern { + font-size: 80%; + color: darkolivegreen; +} + +.docson .type-enum { + color: purple; + font-family: "Lucida Console", Monaco, monospace; + font-size: 90%; + padding-left: 2px; +} + +.docson .type-default { + color: darkslategrey; + font-family: "Lucida Console", Monaco, monospace; +} + +.docson .signature-type { + padding-left: 6px; + float: left; + min-width: 160px; + max-width: 320px; +} + +.docson .signature-type-any { + font-style: italic; +} + +.docson .signature-type-string { + color: green; +} + +.docson .signature-type-number { + color: blue; +} + +.docson .signature-type-integer { + color: blueviolet; +} + +.docson .signature-type-boolean { + color: orangered; +} + +.docson .signature-type-null { + font-family: "Lucida Console", Monaco, monospace; + color: red; +} + +.docson .signature-type-date-time { + color: #224466; +} + +.docson .signature-type-email { + color: cornflowerblue; +} + +.docson .signature-type-hostname { + color: darkolivegreen; +} + +.docson .signature-type-ipv6 { + color: darkslateblue; +} + +.docson .signature-type-ipv4 { + color: indigo; +} + +.docson .signature-type-uri { + color: saddlebrown; +} + +.docson .signature-button { + cursor: pointer; + padding: 4px; + border-radius: 4px; + border: 1px solid lightgrey; + -moz-border-radius: 4px; +} + +.docson .signature-type-ref { + color: darkblue; +} + +.docson .signature-type-expanded { + padding: 5px 3px 3px 5px; + vertical-align: -1px; + opacity: 0.6; + -moz-box-shadow: inset 1px 1px 1px darkgray; + -webkit-box-shadow: inset 1px 1px 1px darkgray; + box-shadow: inset 1px 1px 1px darkgray; +} + +.docson .signature-description { + padding-left: 6px; + padding-bottom: 3px; + color: dimgray; + float: left; + max-width: 600px; +} + +.docson .signature-box-container { + clear: both; +} + +.docson .box-container { + float: left; + padding-top: 4px; + padding-left: 8px; + display: none; +} + +.docson .button { + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.docson .button:hover { + color: darkred; +} + +@media all and (min-width: 20px) and (max-width: 500px) { + .docson .property-name { + min-width: 0px; + } + .docson .signature-type { + min-width: 0px; + } + .docson .source { + width: 100%; + } + .docson .box-container, .box { + width: 100%; + } +} + +.docson .desc { + padding-left: 6px; + line-height: 17px; +} + +.docson .desc p { + margin: 0; + margin-top: 3px; +} + +.docson .desc code { + color: purple; + font-size: 90%; +} + + +.docson .desc table { + margin-top: 4px; + margin-bottom: 4px; + border-collapse:collapse; +} + +.docson .desc th { + padding: 0px; + font-size: 80%; + font-weight: normal; + background: rgba(231, 231, 231, 0.5); +} + +.docson .desc table, +.docson .desc th, +.docson .desc td { + border: 1px solid lightgrey; +} + +.docson .desc tr > td { + padding: 2px 6px 2px 6px; +} + +.docson .desc h1 { + font-size: 120%; + margin-top: 0px; + margin-bottom: 3px; +} + +.docson .desc h2 { + font-size: 115%; + margin-top: 0px; + margin-bottom: 3px; +} + +.docson .desc h3 { + font-size: 110%; + margin-top: 0px; + margin-bottom: 3px; +} + +.docson .desc h4 { + font-size: 100%; + margin-top: 0px; + margin-bottom: 3px; +} + +.docson .desc pre { + border: 1px solid lightgray; + border-radius: 4px; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + padding: 4px; + margin: 3px 0px; +} + +.docson .desc ul { + padding-left: 16px; + margin: 3px 0px; +} + +.docson .desc ol { + padding-left: 16px; + margin: 3px 0px; +} + +.docson .desc blockquote { + margin: 3px 0px 3px 10px; + padding-left: 6px; + border-left: 1px solid lightgray; +} + +.docson .desc img { + vertical-align: middle; +} + +.docson .desc hr { + border: 0; + height: 1px; + background: lightgrey; + color: lightgrey; + width: 50%; +} + +.docson .source { + display: none; + padding-left: 16px; + padding-right: 30px; +} + +.docson .json, .json-schema { + font-family: "Lucida Console", Monaco, monospace; +} + +.docson .json-punctuation { + font-weight: bold; +} + +.docson .json-null, .json-true, .json-false { + font-weight: bold; +} + +.docson .json-true { + color: #080; +} + +.docson .json-false { + color: #800; +} + +.docson .json-object-key { + color: #246; +} + +.docson .json-keyword { + font-weight: bold; + color: #036; +} + +.docson .json-number { + font-weight: bold; + color: #660; +} + +.docson .json-string { + color: #800; +} + +.docson .json-schema-map > .json-object-key { + color: #080; + font-style: italic; +} + diff --git a/examples/biojson-doc/docson-swagger.js b/examples/biojson-doc/docson-swagger.js new file mode 100755 index 0000000..80ffaaf --- /dev/null +++ b/examples/biojson-doc/docson-swagger.js @@ -0,0 +1,67 @@ +/* + * Copyright 2013 Laurent Bovet + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var allDefinitions; +var counter = 0; + +function createDoc(definitions, type) { + counter++; + var docson = "/docson/index.html"; + if(!allDefinitions) { + allDefinitions = {}; + function receiveMessage(event) { + if (event.data.id && event.data.id == "docson") { + var frame = $("#docson-"+event.data.url.split("$")[2]); + if (event.data.action == "resized") { + frame.get(0).width = event.data.width + 18; + frame.get(0).height = event.data.height + 36; + frame.parents("td").width(event.data.width + 24) + } + if (event.data.action == "ready") { + frame.get(0).contentWindow.postMessage({ id: "docson", action: "load", definitions: allDefinitions, type: event.data.url.split("$")[1]}, "*"); + } + } + } + window.addEventListener("message", receiveMessage, false); + } + $.extend(allDefinitions, definitions); + return "" +} + +SwaggerOperation.prototype.getSignature = function(type, models) { + var collectionType, isPrimitive; + if(this.isCollectionType) { + collectionType = this.isCollectionType(type); + } else { + collectionType = this.isListType(type); + } + isPrimitive = ((collectionType != null) && models[collectionType]) || (models[type] != null) ? false : true; + if (isPrimitive) { + return type; + } else { + if (collectionType != null) { + return "

" + type + "

" + createDoc(this.resource.rawModels, collectionType); + } else { + return createDoc(this.resource.rawModels, type); + } + } +}; + +$(document).on("click", ".toggleOperation", function() { + $(this).parents(".operations").find(".docson-frame").each(function(k, frame) { + frame.contentWindow.postMessage({id: "docson", action: "resize"}, "*"); + }); +}); diff --git a/examples/biojson-doc/docson.js b/examples/biojson-doc/docson.js new file mode 100755 index 0000000..93d7d09 --- /dev/null +++ b/examples/biojson-doc/docson.js @@ -0,0 +1,512 @@ +/* + * Copyright 2013 Laurent Bovet + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var docson = docson || {}; + +docson.templateBaseUrl="templates"; + +define(["lib/jquery", "lib/handlebars", "lib/highlight", "lib/jsonpointer", "lib/marked", "lib/traverse"], function(jquery, handlebars, highlight, jsonpointer, marked) { + + var ready = $.Deferred(); + var boxTemplate; + var signatureTemplate; + var source; + var stack = []; + var boxes=[]; + + Handlebars.registerHelper('scope', function(schema, options) { + var result; + boxes.push([]); + if(schema && (schema.id || schema.root)) { + stack.push( schema ); + result = options.fn(this); + stack.pop(); + } else { + result = options.fn(this); + } + boxes.pop(); + return result; + }); + + Handlebars.registerHelper('source', function(schema) { + delete schema.root; + delete schema.__boxId; + delete schema.__name; + delete schema.__ref; + return JSON.stringify(schema, null, 2); + }); + + Handlebars.registerHelper('desc', function(schema) { + var description = schema.description; + + if( !description ) return ""; + var text = description; + if(marked) { + marked.setOptions({gfm: true, breaks: true}) + return new Handlebars.SafeString(marked(text)); + } else { + return text; + } + }); + + Handlebars.registerHelper('equals', function(lvalue, rvalue, options) { + if (arguments.length < 3) + throw new Error("Handlebars Helper equals needs 2 parameters"); + if( lvalue!=rvalue ) { + return options.inverse(this); + } else { + return options.fn(this); + } + }); + + Handlebars.registerHelper('contains', function(arr, item, options) {; + if(arr && arr instanceof Array && arr.indexOf(item) != -1) { + return options.fn(this); + } + }); + + Handlebars.registerHelper('primitive', function(schema, options) { + if(schema.type && schema.type != "object" && schema.type != "array" || schema.enum) { + return withType(this, options, true) + } + }); + + Handlebars.registerHelper('exists', function(value, options) { + if(value !== undefined) { + value = value === null ? "null": value; + value = value === true ? "true": value; + value = value === false ? "false": value; + value = typeof value === "object" ? JSON.stringify(value): value; + this.__default = value; + var result = options.fn(this); + delete this.__default; + return result; + } + }); + + Handlebars.registerHelper('range', function(from, to, replFrom, replTo, exclFrom, exclTo, sep) { + var result = ""; + if(from !== undefined || to !== undefined) { + result += exclFrom ? "]" : "["; + result += from !== undefined ? from : replFrom; + if( (from || replFrom) !== (to || replTo)) { + result += (from !== undefined || replFrom !== null) && (to !== undefined || replTo !== null) ? sep : ""; + result += to !== undefined ? to : replTo; + } + result += exclTo ? "[" : "]"; + return result; + } + }); + + var sub = function(schema) { + return schema.type == "array" || schema.allOf || schema.anyOf || schema.oneOf || schema.not; + } + + Handlebars.registerHelper('sub', function(schema, options) { + if(sub(schema) || (schema.type && schema.type != "object" && schema.type != "array") || schema.enum) { + return options.fn(this); + } + }); + + Handlebars.registerHelper('main', function(schema, options) { + if(!sub(schema)) { + return options.fn(this); + } + }); + + var simpleSchema = function(schema) { + var result = schema.description===undefined && schema.title===undefined && schema.id===undefined; + result &= schema.properties===undefined; + return result; + }; + + Handlebars.registerHelper('simple', function(schema, options) { + if(simpleSchema(schema) && !schema.$ref) { + return withType(schema, options, true); + } + }); + + var withType = function(schema, options, hideAny) { + schema.__type = schema.type; + if(!schema.type && !hideAny) { + schema.__type="any"; + } + if(schema.format) { + schema.__type=schema.format; + } + if( (schema.__type == "any" || schema.__type == "object") && schema.title) { + schema.__type = schema.title; + } + var result = options.fn(schema); + delete schema.__type; + return result; + } + + Handlebars.registerHelper('complex', function(schema, options) { + if(!simpleSchema(schema) && !schema.$ref || schema.properties) { + return withType(schema, options); + } + }); + + Handlebars.registerHelper('enum', function(schema) { + if(schema.enum) { + return (schema.enum.length > 1) ? "enum": "constant"; + } + }); + + Handlebars.registerHelper('obj', function(schema, options) { + if(schema.properties || schema.type == "object") { + return withType(schema, options); + } + }); + + var pushBox = function(schema) { + boxes[boxes.length-1].push(schema); + } + + Handlebars.registerHelper('box', function(schema, options) { + if(schema) { + pushBox(schema); + return options.fn(schema); + } + }); + + Handlebars.registerHelper('boxId', function() { + return boxes[boxes.length-1].length + }); + + Handlebars.registerHelper('boxes', function(options) { + var result=""; + $.each(boxes[boxes.length-1], function(k, box) { + box.__boxId = k+1; + result=result+options.fn(box); + }); + boxes[boxes.length-1] = [] + return result; + }); + + var resolveIdRef = function(ref) { + if(stack) { + var i; + for(i=stack.length-1; i>=0; i--) { + if(stack[i][ref]) { + return stack[i][ref]; + } + } + } + return null; + } + + var resolvePointerRef = function(ref) { + var root = stack[1]; + if(ref=="#") { + return root; + } + try { + return jsonpointer.get(stack[1], ref); + } catch(e) { + console.log(e); + return null; + } + } + + var resolveRef = function(ref) { + if(ref.indexOf("#") == 0) { + return resolvePointerRef(ref); + } else { + return resolveIdRef(ref); + } + } + + var getName = function(schema) { + if(!schema) { + return ""; + } + var name = schema.title; + name = !name && schema.id ? schema.id: name; + name = !name ? schema.__name: name; + return name; + } + + Handlebars.registerHelper('name', function(schema, options) { + schema.__name = getName(schema); + if(schema.__name) { + return options.fn(schema); + } + }); + + var refName = function(ref) { + var name = getName(resolveRef(ref)); + if(!name) { + if(ref == "#") { + name = ""; + } else { + name = ref.replace("#", "/") + } + } + var segments = name.split("/"); + name = segments[segments.length-1]; + return name; + } + + function renderSchema(schema) { + if(stack.indexOf(schema) == -1) { // avoid recursion + stack.push(schema); + var ret = new Handlebars.SafeString(boxTemplate(schema)); + stack.pop(); + return ret; + } else { + return new Handlebars.SafeString(boxTemplate({"description": "_circular reference_"})); + } + } + + Handlebars.registerHelper('ref', function(schema, options) { + if(schema.$ref) { + var target = resolveRef(schema.$ref); + if(target) { + target.__name = refName(schema.$ref); + target.__ref = schema.$ref.replace("#", ""); + } + var result; + if(target) { + result = options.fn(target); + } else { + result = new Handlebars.SafeString(""+schema.$ref+""); + } + if(target) { + delete target.__ref; + } + return result; + } + }); + + Handlebars.registerHelper('schema', function(schema) { + return renderSchema(schema); + }); + + Handlebars.registerHelper('signature', function(schema, keyword, schemas) { + if(!schemas) { + schemas = [] + } + schemas = schemas instanceof Array ? schemas : [schemas]; + return new Handlebars.SafeString(signatureTemplate({ schema: schema, keyword: keyword, schemas: schemas})); + }); + + Handlebars.registerHelper('l', function(context) { + console.log(context); + }); + + function init() { + $.when( $.get(docson.templateBaseUrl+"/box.html").done(function(content) { + source = content + boxTemplate = Handlebars.compile(source); + }), $.get(docson.templateBaseUrl+"/signature.html").done(function(content) { + source = content + signatureTemplate = Handlebars.compile(source); + })).always(function() { + ready.resolve(); + }); + }; + + docson.doc = function(element, schema, ref, baseUrl) { + var d = $.Deferred(); + if(baseUrl === undefined) baseUrl=''; + init(); + ready.done(function() { + if(typeof element == "string") { + element = $("#"+element); + } + if(typeof schema == "string") { + schema = JSON.parse(schema); + } + + var refsPromise = $.Deferred().resolve().promise(); + var refs = {}; + + + var renderBox = function() { + stack.push(refs); + var target = schema; + if(ref) { + ref = ref[0] !== '/' ? '/'+ref : ref; + target = jsonpointer.get(schema, ref); + stack.push( schema ); + } + target.root = true; + target.__ref = ""; + var html = boxTemplate(target); + + if(ref) { + stack.pop(); + } + stack.pop(); + + element.addClass("docson").html(html); + + var resizeHandler = element.get(0).onresize; + function resized() { + if(resizeHandler) { + var box = element.find(".box").first(); + element.get(0).onresize(box.outerWidth(), box.outerHeight()); + } + } + element.get(0).resized = resized; + resized(); + + if(highlight) { + element.find(".json-schema").each(function(k, schemaElement) { + highlight.highlightSchema(schemaElement); + }); + } + element.find(".box-title").each(function() { + var ref = $(this).attr("ref"); + if(ref) { + if(window.location.href.indexOf("docson/index.html") > -1) { + $(this).find(".box-name").css("cursor", "pointer").attr("title", "Open in new window") + .hover( + function(){ $(this).addClass('link') }, + function(){ $(this).removeClass('link') }) + .click(function() { + var url = window.location.href+"$$expand"; + if(ref !=="") { + url = url.replace(/(docson\/index.html#[^\$]*).*/, "$1$"+ref+"$$expand"); + } + var w; + function receiveMessage(event) { + if (event.data.id && event.data.id == "docson" && event.data.action == "ready") { + w.postMessage({ id: "docson", action: "load", definitions: schema, type: event.data.url.split("$")[1], expand: true}, "*"); + } + } + window.addEventListener("message", receiveMessage, false); + w = window.open(url, "_blank"); + }); + } + } + }); + element.find(".box").mouseenter(function() { + $(this).children(".source-button").fadeIn(300); + $(this).children(".box-body").children(".expand-button").fadeIn(300); + }); + element.find(".box").mouseleave(function() { + $(this).children(".source-button").fadeOut(300); + $(this).children(".box-body").children(".expand-button").fadeOut(300); + }); + element.find(".signature-type-expandable").click(function() { + var boxId = $(this).attr("boxid"); + $(this).toggleClass("signature-type-expanded"); + $(this).parent().parent().parent().children(".signature-box-container"). + children("[boxid='"+boxId+"']").toggle(resizeHandler ? 0 : 300); + resized(); + }); + element.find(".expand-button").click(function() { + if($(this).attr("expanded")) { + $(this).parent().parent().find(".expand-button").html(" + ").attr("title", "Expand all"); + $(this).parent().parent().find(".signature-type-expandable").removeClass("signature-type-expanded"); + $(this).parent().parent().find(".box-container").hide( resizeHandler ? 0 : 300); + $(this).parent().parent().find(".expand-button").removeAttr("expanded"); + resized(); + } else { + $(this).parent().parent().find(".expand-button").html(" - ").attr("title", "Collapse all"); + $(this).parent().parent().find(".signature-type-expandable").addClass("signature-type-expanded"); + $(this).parent().parent().find(".box-container").show(resizeHandler ? 0 : 300); + $(this).parent().parent().find(".expand-button").attr("expanded", true); + resized(); + } + }); + element.find(".source-button").click(function() { + $(this).parent().children(".box-body").toggle(); + $(this).parent().children(".source").toggle(); + resized(); + }); + }; + + var resolveRefsReentrant = function(schema){ + traverse(schema).forEach(function(item) { + // Fix Swagger weird generation for array. + if(item && item.$ref == "array") { + delete item.$ref; + item.type ="array"; + } + + // Fetch external schema + if(this.key === "$ref") { + var external = false; + //Local meaning local to this server, but not in this file. + var local = false; + if((/^https?:\/\//).test(item)) { + external = true; + } + else if((/^[^#]/).test(item)) { + local = true; + } else if(item.indexOf('#') > 0) { + //Internal reference + //Turning relative refs to absolute ones + external = true; + item = baseUrl + item; + this.update(item); + } + if(external){ + //External reference, fetch it. + var segments = item.split("#"); + refs[item] = null; + var p = $.get(segments[0]).then(function(content) { + if(typeof content != "object") { + try { + content = JSON.parse(content); + } catch(e) { + console.error("Unable to parse "+segments[0], e); + } + } + if(content) { + refs[item] = content; + renderBox(); + resolveRefsReentrant(content); + } + }); + } + else if(local) { + //Local to this server, fetch relative + var segments = item.split("#"); + refs[item] = null; + var p = $.get(baseUrl + segments[0]).then(function(content) { + if(typeof content != "object") { + try { + content = JSON.parse(content); + } catch(e) { + console.error("Unable to parse "+segments[0], e); + } + } + if(content) { + refs[item] = content; + renderBox(); + resolveRefsReentrant(content); + } + }); + } + } + }); + }; + + resolveRefsReentrant(schema); + renderBox(); + + d.resolve(); + }) + return d.promise(); + } + + return docson; +}); diff --git a/examples/biojson-doc/index.html b/examples/biojson-doc/index.html new file mode 100755 index 0000000..7c82aaf --- /dev/null +++ b/examples/biojson-doc/index.html @@ -0,0 +1,22 @@ + + + + Docson Example + + + + +
+ + + diff --git a/examples/biojson-doc/lib/handlebars.js b/examples/biojson-doc/lib/handlebars.js new file mode 100755 index 0000000..ba71792 --- /dev/null +++ b/examples/biojson-doc/lib/handlebars.js @@ -0,0 +1,2595 @@ +/*! + + handlebars v1.1.2 + +Copyright (C) 2011 by Yehuda Katz + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +@license +*/ +var Handlebars = (function() { +// handlebars/safe-string.js +var __module4__ = (function() { + "use strict"; + var __exports__; + // Build out our basic SafeString type + function SafeString(string) { + this.string = string; + } + + SafeString.prototype.toString = function() { + return "" + this.string; + }; + + __exports__ = SafeString; + return __exports__; +})(); + +// handlebars/utils.js +var __module3__ = (function(__dependency1__) { + "use strict"; + var __exports__ = {}; + var SafeString = __dependency1__; + + var escape = { + "&": "&", + "<": "<", + ">": ">", + '"': """, + "'": "'", + "`": "`" + }; + + var badChars = /[&<>"'`]/g; + var possible = /[&<>"'`]/; + + function escapeChar(chr) { + return escape[chr] || "&"; + } + + function extend(obj, value) { + for(var key in value) { + if(value.hasOwnProperty(key)) { + obj[key] = value[key]; + } + } + } + + __exports__.extend = extend;var toString = Object.prototype.toString; + __exports__.toString = toString; + // Sourced from lodash + // https://github.com/bestiejs/lodash/blob/master/LICENSE.txt + var isFunction = function(value) { + return typeof value === 'function'; + }; + // fallback for older versions of Chrome and Safari + if (isFunction(/x/)) { + isFunction = function(value) { + return typeof value === 'function' && toString.call(value) === '[object Function]'; + }; + } + var isFunction; + __exports__.isFunction = isFunction; + var isArray = Array.isArray || function(value) { + return (value && typeof value === 'object') ? toString.call(value) === '[object Array]' : false; + }; + __exports__.isArray = isArray; + + function escapeExpression(string) { + // don't escape SafeStrings, since they're already safe + if (string instanceof SafeString) { + return string.toString(); + } else if (!string && string !== 0) { + return ""; + } + + // Force a string conversion as this will be done by the append regardless and + // the regex test will do this transparently behind the scenes, causing issues if + // an object's to string has escaped characters in it. + string = "" + string; + + if(!possible.test(string)) { return string; } + return string.replace(badChars, escapeChar); + } + + __exports__.escapeExpression = escapeExpression;function isEmpty(value) { + if (!value && value !== 0) { + return true; + } else if (isArray(value) && value.length === 0) { + return true; + } else { + return false; + } + } + + __exports__.isEmpty = isEmpty; + return __exports__; +})(__module4__); + +// handlebars/exception.js +var __module5__ = (function() { + "use strict"; + var __exports__; + + var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack']; + + function Exception(/* message */) { + var tmp = Error.prototype.constructor.apply(this, arguments); + + // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work. + for (var idx = 0; idx < errorProps.length; idx++) { + this[errorProps[idx]] = tmp[errorProps[idx]]; + } + } + + Exception.prototype = new Error(); + + __exports__ = Exception; + return __exports__; +})(); + +// handlebars/base.js +var __module2__ = (function(__dependency1__, __dependency2__) { + "use strict"; + var __exports__ = {}; + /*globals Exception, Utils */ + var Utils = __dependency1__; + var Exception = __dependency2__; + + var VERSION = "1.1.2"; + __exports__.VERSION = VERSION;var COMPILER_REVISION = 4; + __exports__.COMPILER_REVISION = COMPILER_REVISION; + var REVISION_CHANGES = { + 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it + 2: '== 1.0.0-rc.3', + 3: '== 1.0.0-rc.4', + 4: '>= 1.0.0' + }; + __exports__.REVISION_CHANGES = REVISION_CHANGES; + var isArray = Utils.isArray, + isFunction = Utils.isFunction, + toString = Utils.toString, + objectType = '[object Object]'; + + function HandlebarsEnvironment(helpers, partials) { + this.helpers = helpers || {}; + this.partials = partials || {}; + + registerDefaultHelpers(this); + } + + __exports__.HandlebarsEnvironment = HandlebarsEnvironment;HandlebarsEnvironment.prototype = { + constructor: HandlebarsEnvironment, + + logger: logger, + log: log, + + registerHelper: function(name, fn, inverse) { + if (toString.call(name) === objectType) { + if (inverse || fn) { throw new Exception('Arg not supported with multiple helpers'); } + Utils.extend(this.helpers, name); + } else { + if (inverse) { fn.not = inverse; } + this.helpers[name] = fn; + } + }, + + registerPartial: function(name, str) { + if (toString.call(name) === objectType) { + Utils.extend(this.partials, name); + } else { + this.partials[name] = str; + } + } + }; + + function registerDefaultHelpers(instance) { + instance.registerHelper('helperMissing', function(arg) { + if(arguments.length === 2) { + return undefined; + } else { + throw new Error("Missing helper: '" + arg + "'"); + } + }); + + instance.registerHelper('blockHelperMissing', function(context, options) { + var inverse = options.inverse || function() {}, fn = options.fn; + + if (isFunction(context)) { context = context.call(this); } + + if(context === true) { + return fn(this); + } else if(context === false || context == null) { + return inverse(this); + } else if (isArray(context)) { + if(context.length > 0) { + return instance.helpers.each(context, options); + } else { + return inverse(this); + } + } else { + return fn(context); + } + }); + + instance.registerHelper('each', function(context, options) { + var fn = options.fn, inverse = options.inverse; + var i = 0, ret = "", data; + + if (isFunction(context)) { context = context.call(this); } + + if (options.data) { + data = createFrame(options.data); + } + + if(context && typeof context === 'object') { + if (isArray(context)) { + for(var j = context.length; i 0) { throw new Exception("Invalid path: " + original); } + else if (part === "..") { depth++; } + else { this.isScoped = true; } + } + else { dig.push(part); } + } + + this.original = original; + this.parts = dig; + this.string = dig.join('.'); + this.depth = depth; + + // an ID is simple if it only has one part, and that part is not + // `..` or `this`. + this.isSimple = parts.length === 1 && !this.isScoped && depth === 0; + + this.stringModeValue = this.string; + } + + __exports__.IdNode = IdNode;function PartialNameNode(name) { + this.type = "PARTIAL_NAME"; + this.name = name.original; + } + + __exports__.PartialNameNode = PartialNameNode;function DataNode(id) { + this.type = "DATA"; + this.id = id; + } + + __exports__.DataNode = DataNode;function StringNode(string) { + this.type = "STRING"; + this.original = + this.string = + this.stringModeValue = string; + } + + __exports__.StringNode = StringNode;function IntegerNode(integer) { + this.type = "INTEGER"; + this.original = + this.integer = integer; + this.stringModeValue = Number(integer); + } + + __exports__.IntegerNode = IntegerNode;function BooleanNode(bool) { + this.type = "BOOLEAN"; + this.bool = bool; + this.stringModeValue = bool === "true"; + } + + __exports__.BooleanNode = BooleanNode;function CommentNode(comment) { + this.type = "comment"; + this.comment = comment; + } + + __exports__.CommentNode = CommentNode; + return __exports__; +})(__module5__); + +// handlebars/compiler/parser.js +var __module9__ = (function() { + "use strict"; + var __exports__; + /* Jison generated parser */ + var handlebars = (function(){ + var parser = {trace: function trace() { }, + yy: {}, + symbols_: {"error":2,"root":3,"statements":4,"EOF":5,"program":6,"simpleInverse":7,"statement":8,"openInverse":9,"closeBlock":10,"openBlock":11,"mustache":12,"partial":13,"CONTENT":14,"COMMENT":15,"OPEN_BLOCK":16,"inMustache":17,"CLOSE":18,"OPEN_INVERSE":19,"OPEN_ENDBLOCK":20,"path":21,"OPEN":22,"OPEN_UNESCAPED":23,"CLOSE_UNESCAPED":24,"OPEN_PARTIAL":25,"partialName":26,"partial_option0":27,"inMustache_repetition0":28,"inMustache_option0":29,"dataName":30,"param":31,"STRING":32,"INTEGER":33,"BOOLEAN":34,"hash":35,"hash_repetition_plus0":36,"hashSegment":37,"ID":38,"EQUALS":39,"DATA":40,"pathSegments":41,"SEP":42,"$accept":0,"$end":1}, + terminals_: {2:"error",5:"EOF",14:"CONTENT",15:"COMMENT",16:"OPEN_BLOCK",18:"CLOSE",19:"OPEN_INVERSE",20:"OPEN_ENDBLOCK",22:"OPEN",23:"OPEN_UNESCAPED",24:"CLOSE_UNESCAPED",25:"OPEN_PARTIAL",32:"STRING",33:"INTEGER",34:"BOOLEAN",38:"ID",39:"EQUALS",40:"DATA",42:"SEP"}, + productions_: [0,[3,2],[3,1],[6,2],[6,3],[6,2],[6,1],[6,1],[6,0],[4,1],[4,2],[8,3],[8,3],[8,1],[8,1],[8,1],[8,1],[11,3],[9,3],[10,3],[12,3],[12,3],[13,4],[7,2],[17,3],[17,1],[31,1],[31,1],[31,1],[31,1],[31,1],[35,1],[37,3],[26,1],[26,1],[26,1],[30,2],[21,1],[41,3],[41,1],[27,0],[27,1],[28,0],[28,2],[29,0],[29,1],[36,1],[36,2]], + performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) { + + var $0 = $$.length - 1; + switch (yystate) { + case 1: return new yy.ProgramNode($$[$0-1]); + break; + case 2: return new yy.ProgramNode([]); + break; + case 3:this.$ = new yy.ProgramNode([], $$[$0-1], $$[$0]); + break; + case 4:this.$ = new yy.ProgramNode($$[$0-2], $$[$0-1], $$[$0]); + break; + case 5:this.$ = new yy.ProgramNode($$[$0-1], $$[$0], []); + break; + case 6:this.$ = new yy.ProgramNode($$[$0]); + break; + case 7:this.$ = new yy.ProgramNode([]); + break; + case 8:this.$ = new yy.ProgramNode([]); + break; + case 9:this.$ = [$$[$0]]; + break; + case 10: $$[$0-1].push($$[$0]); this.$ = $$[$0-1]; + break; + case 11:this.$ = new yy.BlockNode($$[$0-2], $$[$0-1].inverse, $$[$0-1], $$[$0]); + break; + case 12:this.$ = new yy.BlockNode($$[$0-2], $$[$0-1], $$[$0-1].inverse, $$[$0]); + break; + case 13:this.$ = $$[$0]; + break; + case 14:this.$ = $$[$0]; + break; + case 15:this.$ = new yy.ContentNode($$[$0]); + break; + case 16:this.$ = new yy.CommentNode($$[$0]); + break; + case 17:this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1], $$[$0-2], stripFlags($$[$0-2], $$[$0])); + break; + case 18:this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1], $$[$0-2], stripFlags($$[$0-2], $$[$0])); + break; + case 19:this.$ = {path: $$[$0-1], strip: stripFlags($$[$0-2], $$[$0])}; + break; + case 20:this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1], $$[$0-2], stripFlags($$[$0-2], $$[$0])); + break; + case 21:this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1], $$[$0-2], stripFlags($$[$0-2], $$[$0])); + break; + case 22:this.$ = new yy.PartialNode($$[$0-2], $$[$0-1], stripFlags($$[$0-3], $$[$0])); + break; + case 23:this.$ = stripFlags($$[$0-1], $$[$0]); + break; + case 24:this.$ = [[$$[$0-2]].concat($$[$0-1]), $$[$0]]; + break; + case 25:this.$ = [[$$[$0]], null]; + break; + case 26:this.$ = $$[$0]; + break; + case 27:this.$ = new yy.StringNode($$[$0]); + break; + case 28:this.$ = new yy.IntegerNode($$[$0]); + break; + case 29:this.$ = new yy.BooleanNode($$[$0]); + break; + case 30:this.$ = $$[$0]; + break; + case 31:this.$ = new yy.HashNode($$[$0]); + break; + case 32:this.$ = [$$[$0-2], $$[$0]]; + break; + case 33:this.$ = new yy.PartialNameNode($$[$0]); + break; + case 34:this.$ = new yy.PartialNameNode(new yy.StringNode($$[$0])); + break; + case 35:this.$ = new yy.PartialNameNode(new yy.IntegerNode($$[$0])); + break; + case 36:this.$ = new yy.DataNode($$[$0]); + break; + case 37:this.$ = new yy.IdNode($$[$0]); + break; + case 38: $$[$0-2].push({part: $$[$0], separator: $$[$0-1]}); this.$ = $$[$0-2]; + break; + case 39:this.$ = [{part: $$[$0]}]; + break; + case 42:this.$ = []; + break; + case 43:$$[$0-1].push($$[$0]); + break; + case 46:this.$ = [$$[$0]]; + break; + case 47:$$[$0-1].push($$[$0]); + break; + } + }, + table: [{3:1,4:2,5:[1,3],8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],25:[1,15]},{1:[3]},{5:[1,16],8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],25:[1,15]},{1:[2,2]},{5:[2,9],14:[2,9],15:[2,9],16:[2,9],19:[2,9],20:[2,9],22:[2,9],23:[2,9],25:[2,9]},{4:20,6:18,7:19,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,21],20:[2,8],22:[1,13],23:[1,14],25:[1,15]},{4:20,6:22,7:19,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,21],20:[2,8],22:[1,13],23:[1,14],25:[1,15]},{5:[2,13],14:[2,13],15:[2,13],16:[2,13],19:[2,13],20:[2,13],22:[2,13],23:[2,13],25:[2,13]},{5:[2,14],14:[2,14],15:[2,14],16:[2,14],19:[2,14],20:[2,14],22:[2,14],23:[2,14],25:[2,14]},{5:[2,15],14:[2,15],15:[2,15],16:[2,15],19:[2,15],20:[2,15],22:[2,15],23:[2,15],25:[2,15]},{5:[2,16],14:[2,16],15:[2,16],16:[2,16],19:[2,16],20:[2,16],22:[2,16],23:[2,16],25:[2,16]},{17:23,21:24,30:25,38:[1,28],40:[1,27],41:26},{17:29,21:24,30:25,38:[1,28],40:[1,27],41:26},{17:30,21:24,30:25,38:[1,28],40:[1,27],41:26},{17:31,21:24,30:25,38:[1,28],40:[1,27],41:26},{21:33,26:32,32:[1,34],33:[1,35],38:[1,28],41:26},{1:[2,1]},{5:[2,10],14:[2,10],15:[2,10],16:[2,10],19:[2,10],20:[2,10],22:[2,10],23:[2,10],25:[2,10]},{10:36,20:[1,37]},{4:38,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,7],22:[1,13],23:[1,14],25:[1,15]},{7:39,8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,21],20:[2,6],22:[1,13],23:[1,14],25:[1,15]},{17:23,18:[1,40],21:24,30:25,38:[1,28],40:[1,27],41:26},{10:41,20:[1,37]},{18:[1,42]},{18:[2,42],24:[2,42],28:43,32:[2,42],33:[2,42],34:[2,42],38:[2,42],40:[2,42]},{18:[2,25],24:[2,25]},{18:[2,37],24:[2,37],32:[2,37],33:[2,37],34:[2,37],38:[2,37],40:[2,37],42:[1,44]},{21:45,38:[1,28],41:26},{18:[2,39],24:[2,39],32:[2,39],33:[2,39],34:[2,39],38:[2,39],40:[2,39],42:[2,39]},{18:[1,46]},{18:[1,47]},{24:[1,48]},{18:[2,40],21:50,27:49,38:[1,28],41:26},{18:[2,33],38:[2,33]},{18:[2,34],38:[2,34]},{18:[2,35],38:[2,35]},{5:[2,11],14:[2,11],15:[2,11],16:[2,11],19:[2,11],20:[2,11],22:[2,11],23:[2,11],25:[2,11]},{21:51,38:[1,28],41:26},{8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,3],22:[1,13],23:[1,14],25:[1,15]},{4:52,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,5],22:[1,13],23:[1,14],25:[1,15]},{14:[2,23],15:[2,23],16:[2,23],19:[2,23],20:[2,23],22:[2,23],23:[2,23],25:[2,23]},{5:[2,12],14:[2,12],15:[2,12],16:[2,12],19:[2,12],20:[2,12],22:[2,12],23:[2,12],25:[2,12]},{14:[2,18],15:[2,18],16:[2,18],19:[2,18],20:[2,18],22:[2,18],23:[2,18],25:[2,18]},{18:[2,44],21:56,24:[2,44],29:53,30:60,31:54,32:[1,57],33:[1,58],34:[1,59],35:55,36:61,37:62,38:[1,63],40:[1,27],41:26},{38:[1,64]},{18:[2,36],24:[2,36],32:[2,36],33:[2,36],34:[2,36],38:[2,36],40:[2,36]},{14:[2,17],15:[2,17],16:[2,17],19:[2,17],20:[2,17],22:[2,17],23:[2,17],25:[2,17]},{5:[2,20],14:[2,20],15:[2,20],16:[2,20],19:[2,20],20:[2,20],22:[2,20],23:[2,20],25:[2,20]},{5:[2,21],14:[2,21],15:[2,21],16:[2,21],19:[2,21],20:[2,21],22:[2,21],23:[2,21],25:[2,21]},{18:[1,65]},{18:[2,41]},{18:[1,66]},{8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],25:[1,15]},{18:[2,24],24:[2,24]},{18:[2,43],24:[2,43],32:[2,43],33:[2,43],34:[2,43],38:[2,43],40:[2,43]},{18:[2,45],24:[2,45]},{18:[2,26],24:[2,26],32:[2,26],33:[2,26],34:[2,26],38:[2,26],40:[2,26]},{18:[2,27],24:[2,27],32:[2,27],33:[2,27],34:[2,27],38:[2,27],40:[2,27]},{18:[2,28],24:[2,28],32:[2,28],33:[2,28],34:[2,28],38:[2,28],40:[2,28]},{18:[2,29],24:[2,29],32:[2,29],33:[2,29],34:[2,29],38:[2,29],40:[2,29]},{18:[2,30],24:[2,30],32:[2,30],33:[2,30],34:[2,30],38:[2,30],40:[2,30]},{18:[2,31],24:[2,31],37:67,38:[1,68]},{18:[2,46],24:[2,46],38:[2,46]},{18:[2,39],24:[2,39],32:[2,39],33:[2,39],34:[2,39],38:[2,39],39:[1,69],40:[2,39],42:[2,39]},{18:[2,38],24:[2,38],32:[2,38],33:[2,38],34:[2,38],38:[2,38],40:[2,38],42:[2,38]},{5:[2,22],14:[2,22],15:[2,22],16:[2,22],19:[2,22],20:[2,22],22:[2,22],23:[2,22],25:[2,22]},{5:[2,19],14:[2,19],15:[2,19],16:[2,19],19:[2,19],20:[2,19],22:[2,19],23:[2,19],25:[2,19]},{18:[2,47],24:[2,47],38:[2,47]},{39:[1,69]},{21:56,30:60,31:70,32:[1,57],33:[1,58],34:[1,59],38:[1,28],40:[1,27],41:26},{18:[2,32],24:[2,32],38:[2,32]}], + defaultActions: {3:[2,2],16:[2,1],50:[2,41]}, + parseError: function parseError(str, hash) { + throw new Error(str); + }, + parse: function parse(input) { + var self = this, stack = [0], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1; + this.lexer.setInput(input); + this.lexer.yy = this.yy; + this.yy.lexer = this.lexer; + this.yy.parser = this; + if (typeof this.lexer.yylloc == "undefined") + this.lexer.yylloc = {}; + var yyloc = this.lexer.yylloc; + lstack.push(yyloc); + var ranges = this.lexer.options && this.lexer.options.ranges; + if (typeof this.yy.parseError === "function") + this.parseError = this.yy.parseError; + function popStack(n) { + stack.length = stack.length - 2 * n; + vstack.length = vstack.length - n; + lstack.length = lstack.length - n; + } + function lex() { + var token; + token = self.lexer.lex() || 1; + if (typeof token !== "number") { + token = self.symbols_[token] || token; + } + return token; + } + var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected; + while (true) { + state = stack[stack.length - 1]; + if (this.defaultActions[state]) { + action = this.defaultActions[state]; + } else { + if (symbol === null || typeof symbol == "undefined") { + symbol = lex(); + } + action = table[state] && table[state][symbol]; + } + if (typeof action === "undefined" || !action.length || !action[0]) { + var errStr = ""; + if (!recovering) { + expected = []; + for (p in table[state]) + if (this.terminals_[p] && p > 2) { + expected.push("'" + this.terminals_[p] + "'"); + } + if (this.lexer.showPosition) { + errStr = "Parse error on line " + (yylineno + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; + } else { + errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == 1?"end of input":"'" + (this.terminals_[symbol] || symbol) + "'"); + } + this.parseError(errStr, {text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected}); + } + } + if (action[0] instanceof Array && action.length > 1) { + throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol); + } + switch (action[0]) { + case 1: + stack.push(symbol); + vstack.push(this.lexer.yytext); + lstack.push(this.lexer.yylloc); + stack.push(action[1]); + symbol = null; + if (!preErrorSymbol) { + yyleng = this.lexer.yyleng; + yytext = this.lexer.yytext; + yylineno = this.lexer.yylineno; + yyloc = this.lexer.yylloc; + if (recovering > 0) + recovering--; + } else { + symbol = preErrorSymbol; + preErrorSymbol = null; + } + break; + case 2: + len = this.productions_[action[1]][1]; + yyval.$ = vstack[vstack.length - len]; + yyval._$ = {first_line: lstack[lstack.length - (len || 1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len || 1)].first_column, last_column: lstack[lstack.length - 1].last_column}; + if (ranges) { + yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]]; + } + r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack); + if (typeof r !== "undefined") { + return r; + } + if (len) { + stack = stack.slice(0, -1 * len * 2); + vstack = vstack.slice(0, -1 * len); + lstack = lstack.slice(0, -1 * len); + } + stack.push(this.productions_[action[1]][0]); + vstack.push(yyval.$); + lstack.push(yyval._$); + newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; + stack.push(newState); + break; + case 3: + return true; + } + } + return true; + } + }; + + + function stripFlags(open, close) { + return { + left: open[2] === '~', + right: close[0] === '~' || close[1] === '~' + }; + } + + /* Jison generated lexer */ + var lexer = (function(){ + var lexer = ({EOF:1, + parseError:function parseError(str, hash) { + if (this.yy.parser) { + this.yy.parser.parseError(str, hash); + } else { + throw new Error(str); + } + }, + setInput:function (input) { + this._input = input; + this._more = this._less = this.done = false; + this.yylineno = this.yyleng = 0; + this.yytext = this.matched = this.match = ''; + this.conditionStack = ['INITIAL']; + this.yylloc = {first_line:1,first_column:0,last_line:1,last_column:0}; + if (this.options.ranges) this.yylloc.range = [0,0]; + this.offset = 0; + return this; + }, + input:function () { + var ch = this._input[0]; + this.yytext += ch; + this.yyleng++; + this.offset++; + this.match += ch; + this.matched += ch; + var lines = ch.match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno++; + this.yylloc.last_line++; + } else { + this.yylloc.last_column++; + } + if (this.options.ranges) this.yylloc.range[1]++; + + this._input = this._input.slice(1); + return ch; + }, + unput:function (ch) { + var len = ch.length; + var lines = ch.split(/(?:\r\n?|\n)/g); + + this._input = ch + this._input; + this.yytext = this.yytext.substr(0, this.yytext.length-len-1); + //this.yyleng -= len; + this.offset -= len; + var oldLines = this.match.split(/(?:\r\n?|\n)/g); + this.match = this.match.substr(0, this.match.length-1); + this.matched = this.matched.substr(0, this.matched.length-1); + + if (lines.length-1) this.yylineno -= lines.length-1; + var r = this.yylloc.range; + + this.yylloc = {first_line: this.yylloc.first_line, + last_line: this.yylineno+1, + first_column: this.yylloc.first_column, + last_column: lines ? + (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length: + this.yylloc.first_column - len + }; + + if (this.options.ranges) { + this.yylloc.range = [r[0], r[0] + this.yyleng - len]; + } + return this; + }, + more:function () { + this._more = true; + return this; + }, + less:function (n) { + this.unput(this.match.slice(n)); + }, + pastInput:function () { + var past = this.matched.substr(0, this.matched.length - this.match.length); + return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, ""); + }, + upcomingInput:function () { + var next = this.match; + if (next.length < 20) { + next += this._input.substr(0, 20-next.length); + } + return (next.substr(0,20)+(next.length > 20 ? '...':'')).replace(/\n/g, ""); + }, + showPosition:function () { + var pre = this.pastInput(); + var c = new Array(pre.length + 1).join("-"); + return pre + this.upcomingInput() + "\n" + c+"^"; + }, + next:function () { + if (this.done) { + return this.EOF; + } + if (!this._input) this.done = true; + + var token, + match, + tempMatch, + index, + col, + lines; + if (!this._more) { + this.yytext = ''; + this.match = ''; + } + var rules = this._currentRules(); + for (var i=0;i < rules.length; i++) { + tempMatch = this._input.match(this.rules[rules[i]]); + if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { + match = tempMatch; + index = i; + if (!this.options.flex) break; + } + } + if (match) { + lines = match[0].match(/(?:\r\n?|\n).*/g); + if (lines) this.yylineno += lines.length; + this.yylloc = {first_line: this.yylloc.last_line, + last_line: this.yylineno+1, + first_column: this.yylloc.last_column, + last_column: lines ? lines[lines.length-1].length-lines[lines.length-1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length}; + this.yytext += match[0]; + this.match += match[0]; + this.matches = match; + this.yyleng = this.yytext.length; + if (this.options.ranges) { + this.yylloc.range = [this.offset, this.offset += this.yyleng]; + } + this._more = false; + this._input = this._input.slice(match[0].length); + this.matched += match[0]; + token = this.performAction.call(this, this.yy, this, rules[index],this.conditionStack[this.conditionStack.length-1]); + if (this.done && this._input) this.done = false; + if (token) return token; + else return; + } + if (this._input === "") { + return this.EOF; + } else { + return this.parseError('Lexical error on line '+(this.yylineno+1)+'. Unrecognized text.\n'+this.showPosition(), + {text: "", token: null, line: this.yylineno}); + } + }, + lex:function lex() { + var r = this.next(); + if (typeof r !== 'undefined') { + return r; + } else { + return this.lex(); + } + }, + begin:function begin(condition) { + this.conditionStack.push(condition); + }, + popState:function popState() { + return this.conditionStack.pop(); + }, + _currentRules:function _currentRules() { + return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules; + }, + topState:function () { + return this.conditionStack[this.conditionStack.length-2]; + }, + pushState:function begin(condition) { + this.begin(condition); + }}); + lexer.options = {}; + lexer.performAction = function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) { + + + function strip(start, end) { + return yy_.yytext = yy_.yytext.substr(start, yy_.yyleng-end); + } + + + var YYSTATE=YY_START + switch($avoiding_name_collisions) { + case 0: + if(yy_.yytext.slice(-2) === "\\\\") { + strip(0,1); + this.begin("mu"); + } else if(yy_.yytext.slice(-1) === "\\") { + strip(0,1); + this.begin("emu"); + } else { + this.begin("mu"); + } + if(yy_.yytext) return 14; + + break; + case 1:return 14; + break; + case 2: + if(yy_.yytext.slice(-1) !== "\\") this.popState(); + if(yy_.yytext.slice(-1) === "\\") strip(0,1); + return 14; + + break; + case 3:strip(0,4); this.popState(); return 15; + break; + case 4:return 25; + break; + case 5:return 16; + break; + case 6:return 20; + break; + case 7:return 19; + break; + case 8:return 19; + break; + case 9:return 23; + break; + case 10:return 22; + break; + case 11:this.popState(); this.begin('com'); + break; + case 12:strip(3,5); this.popState(); return 15; + break; + case 13:return 22; + break; + case 14:return 39; + break; + case 15:return 38; + break; + case 16:return 38; + break; + case 17:return 42; + break; + case 18:/*ignore whitespace*/ + break; + case 19:this.popState(); return 24; + break; + case 20:this.popState(); return 18; + break; + case 21:yy_.yytext = strip(1,2).replace(/\\"/g,'"'); return 32; + break; + case 22:yy_.yytext = strip(1,2).replace(/\\'/g,"'"); return 32; + break; + case 23:return 40; + break; + case 24:return 34; + break; + case 25:return 34; + break; + case 26:return 33; + break; + case 27:return 38; + break; + case 28:yy_.yytext = strip(1,2); return 38; + break; + case 29:return 'INVALID'; + break; + case 30:return 5; + break; + } + }; + lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|$)))/,/^(?:[\s\S]*?--\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{!--)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{(~)?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s])))/,/^(?:false(?=([~}\s])))/,/^(?:-?[0-9]+(?=([~}\s])))/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.]))))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/]; + lexer.conditions = {"mu":{"rules":[4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30],"inclusive":false},"emu":{"rules":[2],"inclusive":false},"com":{"rules":[3],"inclusive":false},"INITIAL":{"rules":[0,1,30],"inclusive":true}}; + return lexer;})() + parser.lexer = lexer; + function Parser () { this.yy = {}; }Parser.prototype = parser;parser.Parser = Parser; + return new Parser; + })();__exports__ = handlebars; + return __exports__; +})(); + +// handlebars/compiler/base.js +var __module8__ = (function(__dependency1__, __dependency2__) { + "use strict"; + var __exports__ = {}; + var parser = __dependency1__; + var AST = __dependency2__; + + __exports__.parser = parser; + + function parse(input) { + // Just return if an already-compile AST was passed in. + if(input.constructor === AST.ProgramNode) { return input; } + + parser.yy = AST; + return parser.parse(input); + } + + __exports__.parse = parse; + return __exports__; +})(__module9__, __module7__); + +// handlebars/compiler/javascript-compiler.js +var __module11__ = (function(__dependency1__) { + "use strict"; + var __exports__; + var COMPILER_REVISION = __dependency1__.COMPILER_REVISION; + var REVISION_CHANGES = __dependency1__.REVISION_CHANGES; + var log = __dependency1__.log; + + function Literal(value) { + this.value = value; + } + + function JavaScriptCompiler() {} + + JavaScriptCompiler.prototype = { + // PUBLIC API: You can override these methods in a subclass to provide + // alternative compiled forms for name lookup and buffering semantics + nameLookup: function(parent, name /* , type*/) { + var wrap, + ret; + if (parent.indexOf('depth') === 0) { + wrap = true; + } + + if (/^[0-9]+$/.test(name)) { + ret = parent + "[" + name + "]"; + } else if (JavaScriptCompiler.isValidJavaScriptVariableName(name)) { + ret = parent + "." + name; + } + else { + ret = parent + "['" + name + "']"; + } + + if (wrap) { + return '(' + parent + ' && ' + ret + ')'; + } else { + return ret; + } + }, + + appendToBuffer: function(string) { + if (this.environment.isSimple) { + return "return " + string + ";"; + } else { + return { + appendToBuffer: true, + content: string, + toString: function() { return "buffer += " + string + ";"; } + }; + } + }, + + initializeBuffer: function() { + return this.quotedString(""); + }, + + namespace: "Handlebars", + // END PUBLIC API + + compile: function(environment, options, context, asObject) { + this.environment = environment; + this.options = options || {}; + + log('debug', this.environment.disassemble() + "\n\n"); + + this.name = this.environment.name; + this.isChild = !!context; + this.context = context || { + programs: [], + environments: [], + aliases: { } + }; + + this.preamble(); + + this.stackSlot = 0; + this.stackVars = []; + this.registers = { list: [] }; + this.compileStack = []; + this.inlineStack = []; + + this.compileChildren(environment, options); + + var opcodes = environment.opcodes, opcode; + + this.i = 0; + + for(var l=opcodes.length; this.i 0) { + this.source[1] = this.source[1] + ", " + locals.join(", "); + } + + // Generate minimizer alias mappings + if (!this.isChild) { + for (var alias in this.context.aliases) { + if (this.context.aliases.hasOwnProperty(alias)) { + this.source[1] = this.source[1] + ', ' + alias + '=' + this.context.aliases[alias]; + } + } + } + + if (this.source[1]) { + this.source[1] = "var " + this.source[1].substring(2) + ";"; + } + + // Merge children + if (!this.isChild) { + this.source[1] += '\n' + this.context.programs.join('\n') + '\n'; + } + + if (!this.environment.isSimple) { + this.pushSource("return buffer;"); + } + + var params = this.isChild ? ["depth0", "data"] : ["Handlebars", "depth0", "helpers", "partials", "data"]; + + for(var i=0, l=this.environment.depths.list.length; i this.stackVars.length) { this.stackVars.push("stack" + this.stackSlot); } + return this.topStackName(); + }, + topStackName: function() { + return "stack" + this.stackSlot; + }, + flushInline: function() { + var inlineStack = this.inlineStack; + if (inlineStack.length) { + this.inlineStack = []; + for (var i = 0, len = inlineStack.length; i < len; i++) { + var entry = inlineStack[i]; + if (entry instanceof Literal) { + this.compileStack.push(entry); + } else { + this.pushStack(entry); + } + } + } + }, + isInline: function() { + return this.inlineStack.length; + }, + + popStack: function(wrapped) { + var inline = this.isInline(), + item = (inline ? this.inlineStack : this.compileStack).pop(); + + if (!wrapped && (item instanceof Literal)) { + return item.value; + } else { + if (!inline) { + this.stackSlot--; + } + return item; + } + }, + + topStack: function(wrapped) { + var stack = (this.isInline() ? this.inlineStack : this.compileStack), + item = stack[stack.length - 1]; + + if (!wrapped && (item instanceof Literal)) { + return item.value; + } else { + return item; + } + }, + + quotedString: function(str) { + return '"' + str + .replace(/\\/g, '\\\\') + .replace(/"/g, '\\"') + .replace(/\n/g, '\\n') + .replace(/\r/g, '\\r') + .replace(/\u2028/g, '\\u2028') // Per Ecma-262 7.3 + 7.8.4 + .replace(/\u2029/g, '\\u2029') + '"'; + }, + + setupHelper: function(paramSize, name, missingParams) { + var params = []; + this.setupParams(paramSize, params, missingParams); + var foundHelper = this.nameLookup('helpers', name, 'helper'); + + return { + params: params, + name: foundHelper, + callParams: ["depth0"].concat(params).join(", "), + helperMissingParams: missingParams && ["depth0", this.quotedString(name)].concat(params).join(", ") + }; + }, + + // the params and contexts arguments are passed in arrays + // to fill in + setupParams: function(paramSize, params, useRegister) { + var options = [], contexts = [], types = [], param, inverse, program; + + options.push("hash:" + this.popStack()); + + inverse = this.popStack(); + program = this.popStack(); + + // Avoid setting fn and inverse if neither are set. This allows + // helpers to do a check for `if (options.fn)` + if (program || inverse) { + if (!program) { + this.context.aliases.self = "this"; + program = "self.noop"; + } + + if (!inverse) { + this.context.aliases.self = "this"; + inverse = "self.noop"; + } + + options.push("inverse:" + inverse); + options.push("fn:" + program); + } + + for(var i=0; i + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +define(function() { + + var highlight = {}; + + var REGEX = { + whitespace: /^([ \r\n\t]| )*/, + number: /^-?[0-9]+(\.[0-9]+)?([eE][+\-]?[0-9]+)?/ + }; + + function Highlighter(stringData) { + this.remaining = stringData; + this.html = ""; + } + Highlighter.prototype = { + unshift: function (next) { + this.remaining = next + this.remaining; + }, + next: function () { + this.whitespace(); + return this.nextCharacter(); + }, + nextCharacter: function () { + if (this.remaining.length == 0) { + throw new Error("Unexpected end of input"); + } + if (this.remaining[0] == "&") { + var endIndex = this.remaining.indexOf(";") + 1; + if (endIndex == -1) { + endIndex = 1; + } + var result = this.remaining.substring(0, endIndex); + this.remaining = this.remaining.substring(endIndex); + return result; + } + var result = this.remaining[0]; + this.remaining = this.remaining.substring(1); + return result; + }, + whitespace: function () { + var ws = this.remaining.match(REGEX.whitespace)[0]; + this.html += ws; + this.remaining = this.remaining.substring(ws.length); + }, + highlightJson: function (keywords) { + if (keywords != undefined) { + this.html += keywords.wrapper[0]; + } + this.whitespace(); + var next = this.next(); + if (next == "{") { + this.highlightObject(keywords); + } else if (next == '[') { + this.highlightArray(keywords); + } else if (next == '"' || next == """) { + this.highlightString(); + } else if ((next + this.remaining).match(REGEX.number)) { + var numberString = (next + this.remaining).match(REGEX.number)[0]; + this.html += '' + numberString + ''; + this.remaining = this.remaining.substring(numberString.length - 1); + } else if (next == "n" && this.remaining.substring(0, 3) == "ull") { + this.remaining = this.remaining.substring(3); + this.html += 'null'; + } else if (next == "t" && this.remaining.substring(0, 3) == "rue") { + this.remaining = this.remaining.substring(3); + this.html += 'true'; + } else if (next == "f" && this.remaining.substring(0, 4) == "alse") { + this.remaining = this.remaining.substring(4); + this.html += 'false'; + } else { + this.html += next; + this.highlightJson(keywords); + } + if (keywords != undefined) { + this.html += keywords.wrapper[1]; + } + }, + highlightObject: function (keywords) { + this.html += '{'; + var next = this.next(); + while (next != "}") { + if (next == '"' || next == """) { + var keyHtml = ""; + next = this.next(); + while (next != '"' && next != '"') { + if (next == "\\") { + keyHtml += next; + next = this.nextCharacter(); + } + keyHtml += next; + next = this.next(); + } + if (keywords != undefined && keywords.isKeyword(keyHtml)) { + this.html += '"' + + keyHtml + + '"'; + } else { + this.html += '"' + + keyHtml + + '"'; + } + next = this.next(); + while (next != ":") { + this.html += next; + next = this.next(); + } + this.html += ':'; + var nextKeywords = null; + if (keywords != undefined) { + nextKeywords = keywords.forKey(keyHtml); + } + this.highlightJson(nextKeywords); + next = this.next(); + if (next == ",") { + this.html += ','; + next = this.next(); + continue; + } else while (next != "}") { + this.html += next; + next = this.next(); + } + } else { + this.html += next; + next = this.next(); + } + } + this.html += '}'; + }, + highlightArray: function (keywords) { + this.html += '['; + var next = this.next(); + var i = 0; + while (next != "]") { + this.unshift(next); + this.highlightJson(keywords != undefined ? keywords.forItem(i) : null); + next = this.next(); + if (next == ",") { + this.html += ','; + next = this.next(); + i++; + continue; + } else while (next != "]") { + this.html += next; + next = this.next(); + } + } + this.html += ']'; + }, + highlightString: function () { + this.html += '"'; + next = this.next(); + while (next != '"' && next != '"') { + if (next == "\\") { + this.html += next; + next = this.nextCharacter(); + } + this.html += next; + next = this.next(); + } + this.html += '"'; + } + }; + + function KeywordMap() { + } + KeywordMap.prototype = { + wrapper: ["", ""], + keywords: {}, + isKeyword: function (keyHtml) { + return this.keywords[keyHtml] !== undefined; + }, + forKey: function (keyHtml) { + return this.keywords[keyHtml]; + }, + forItem: function (keyHtml) { + return null; + } + }; + var schema = new KeywordMap(); + var schemaMedia = new KeywordMap(); + var mapToSchemas = new KeywordMap(); + var links = new KeywordMap(); + schema.keywords = { + // from v3 + type: null, + properties: mapToSchemas, + patternProperties: mapToSchemas, + additionalProperties: schema, + items: schema, + additionalItems: schema, + required: null, + dependencies: mapToSchemas, + minimum: null, + maximum: null, + exclusiveMinimum: null, + exclusiveMaximum: null, + minItems: null, + maxItems: null, + uniqueItems: null, + pattern: null, + minLength: null, + maxLength: null, + "enum": null, + "default": null, + title: null, + description: null, + format: null, + divisibleBy: null, + disallow: schema, + "extends": schema, + "id": null, + "$ref": null, + "$schema": null, + // from v4 core + multipleOf: null, + maxProperties: null, + minProperties: null, + allOf: schema, + anyOf: schema, + oneOf: schema, + not: schema, + definitions: mapToSchemas, + // from v4 hyper-schema + media: schemaMedia, + links: links, + pathStart: null, + fragmentResolution: null + }; + schema.forItem = function () { + return schema; + }; + schemaMedia.keywords = { + binaryEncoding: null, + type: null + }; + mapToSchemas.wrapper = ['', '']; + mapToSchemas.forKey = function () { + return schema; + }; + links.keywords = { + rel: null, + href:null, + method: null, + encType: null, + pathStart: null, + schema: schema, + targetSchema: schema + }; + links.forItem = function () { + return links; + }; + + function highlightElement(element, keywords) { + var highlighter = new Highlighter(element.innerHTML); + try { + highlighter.highlightJson(keywords); + } catch (e) { + throw e; + } + element.innerHTML = highlighter.html + highlighter.remaining; + } + + if (document.getElementsByClassName == undefined) { + document.getElementsByClassName = function(className) + { + var hasClassName = new RegExp("(?:^|\\s)" + className + "(?:$|\\s)"); + var allElements = document.getElementsByTagName("*"); + var results = []; + + var element; + for (var i = 0; (element = allElements[i]) != null; i++) { + var elementClass = element.className; + if (elementClass && elementClass.indexOf(className) != -1 && hasClassName.test(elementClass)) + results.push(element); + } + + return results; + } + } + + highlight.highlightSchema = function(element) { + highlightElement(element, schema); + } + + return highlight; +}); diff --git a/examples/biojson-doc/lib/jquery.js b/examples/biojson-doc/lib/jquery.js new file mode 100755 index 0000000..da41706 --- /dev/null +++ b/examples/biojson-doc/lib/jquery.js @@ -0,0 +1,6 @@ +/*! jQuery v1.10.2 | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license +//@ sourceMappingURL=jquery-1.10.2.min.map +*/ +(function(e,t){var n,r,i=typeof t,o=e.location,a=e.document,s=a.documentElement,l=e.jQuery,u=e.$,c={},p=[],f="1.10.2",d=p.concat,h=p.push,g=p.slice,m=p.indexOf,y=c.toString,v=c.hasOwnProperty,b=f.trim,x=function(e,t){return new x.fn.init(e,t,r)},w=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=/\S+/g,C=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,N=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,k=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,E=/^[\],:{}\s]*$/,S=/(?:^|:|,)(?:\s*\[)+/g,A=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,j=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,D=/^-ms-/,L=/-([\da-z])/gi,H=function(e,t){return t.toUpperCase()},q=function(e){(a.addEventListener||"load"===e.type||"complete"===a.readyState)&&(_(),x.ready())},_=function(){a.addEventListener?(a.removeEventListener("DOMContentLoaded",q,!1),e.removeEventListener("load",q,!1)):(a.detachEvent("onreadystatechange",q),e.detachEvent("onload",q))};x.fn=x.prototype={jquery:f,constructor:x,init:function(e,n,r){var i,o;if(!e)return this;if("string"==typeof e){if(i="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:N.exec(e),!i||!i[1]&&n)return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e);if(i[1]){if(n=n instanceof x?n[0]:n,x.merge(this,x.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:a,!0)),k.test(i[1])&&x.isPlainObject(n))for(i in n)x.isFunction(this[i])?this[i](n[i]):this.attr(i,n[i]);return this}if(o=a.getElementById(i[2]),o&&o.parentNode){if(o.id!==i[2])return r.find(e);this.length=1,this[0]=o}return this.context=a,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):x.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),x.makeArray(e,this))},selector:"",length:0,toArray:function(){return g.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=x.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return x.each(this,e,t)},ready:function(e){return x.ready.promise().done(e),this},slice:function(){return this.pushStack(g.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(x.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:h,sort:[].sort,splice:[].splice},x.fn.init.prototype=x.fn,x.extend=x.fn.extend=function(){var e,n,r,i,o,a,s=arguments[0]||{},l=1,u=arguments.length,c=!1;for("boolean"==typeof s&&(c=s,s=arguments[1]||{},l=2),"object"==typeof s||x.isFunction(s)||(s={}),u===l&&(s=this,--l);u>l;l++)if(null!=(o=arguments[l]))for(i in o)e=s[i],r=o[i],s!==r&&(c&&r&&(x.isPlainObject(r)||(n=x.isArray(r)))?(n?(n=!1,a=e&&x.isArray(e)?e:[]):a=e&&x.isPlainObject(e)?e:{},s[i]=x.extend(c,a,r)):r!==t&&(s[i]=r));return s},x.extend({expando:"jQuery"+(f+Math.random()).replace(/\D/g,""),noConflict:function(t){return e.$===x&&(e.$=u),t&&e.jQuery===x&&(e.jQuery=l),x},isReady:!1,readyWait:1,holdReady:function(e){e?x.readyWait++:x.ready(!0)},ready:function(e){if(e===!0?!--x.readyWait:!x.isReady){if(!a.body)return setTimeout(x.ready);x.isReady=!0,e!==!0&&--x.readyWait>0||(n.resolveWith(a,[x]),x.fn.trigger&&x(a).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===x.type(e)},isArray:Array.isArray||function(e){return"array"===x.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?c[y.call(e)]||"object":typeof e},isPlainObject:function(e){var n;if(!e||"object"!==x.type(e)||e.nodeType||x.isWindow(e))return!1;try{if(e.constructor&&!v.call(e,"constructor")&&!v.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(r){return!1}if(x.support.ownLast)for(n in e)return v.call(e,n);for(n in e);return n===t||v.call(e,n)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||a;var r=k.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=x.buildFragment([e],t,i),i&&x(i).remove(),x.merge([],r.childNodes))},parseJSON:function(n){return e.JSON&&e.JSON.parse?e.JSON.parse(n):null===n?n:"string"==typeof n&&(n=x.trim(n),n&&E.test(n.replace(A,"@").replace(j,"]").replace(S,"")))?Function("return "+n)():(x.error("Invalid JSON: "+n),t)},parseXML:function(n){var r,i;if(!n||"string"!=typeof n)return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(o){r=t}return r&&r.documentElement&&!r.getElementsByTagName("parsererror").length||x.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&x.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(D,"ms-").replace(L,H)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,a=M(e);if(n){if(a){for(;o>i;i++)if(r=t.apply(e[i],n),r===!1)break}else for(i in e)if(r=t.apply(e[i],n),r===!1)break}else if(a){for(;o>i;i++)if(r=t.call(e[i],i,e[i]),r===!1)break}else for(i in e)if(r=t.call(e[i],i,e[i]),r===!1)break;return e},trim:b&&!b.call("\ufeff\u00a0")?function(e){return null==e?"":b.call(e)}:function(e){return null==e?"":(e+"").replace(C,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(M(Object(e))?x.merge(n,"string"==typeof e?[e]:e):h.call(n,e)),n},inArray:function(e,t,n){var r;if(t){if(m)return m.call(t,e,n);for(r=t.length,n=n?0>n?Math.max(0,r+n):n:0;r>n;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,o=0;if("number"==typeof r)for(;r>o;o++)e[i++]=n[o];else while(n[o]!==t)e[i++]=n[o++];return e.length=i,e},grep:function(e,t,n){var r,i=[],o=0,a=e.length;for(n=!!n;a>o;o++)r=!!t(e[o],o),n!==r&&i.push(e[o]);return i},map:function(e,t,n){var r,i=0,o=e.length,a=M(e),s=[];if(a)for(;o>i;i++)r=t(e[i],i,n),null!=r&&(s[s.length]=r);else for(i in e)r=t(e[i],i,n),null!=r&&(s[s.length]=r);return d.apply([],s)},guid:1,proxy:function(e,n){var r,i,o;return"string"==typeof n&&(o=e[n],n=e,e=o),x.isFunction(e)?(r=g.call(arguments,2),i=function(){return e.apply(n||this,r.concat(g.call(arguments)))},i.guid=e.guid=e.guid||x.guid++,i):t},access:function(e,n,r,i,o,a,s){var l=0,u=e.length,c=null==r;if("object"===x.type(r)){o=!0;for(l in r)x.access(e,n,l,r[l],!0,a,s)}else if(i!==t&&(o=!0,x.isFunction(i)||(s=!0),c&&(s?(n.call(e,i),n=null):(c=n,n=function(e,t,n){return c.call(x(e),n)})),n))for(;u>l;l++)n(e[l],r,s?i:i.call(e[l],l,n(e[l],r)));return o?e:c?n.call(e):u?n(e[0],r):a},now:function(){return(new Date).getTime()},swap:function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i}}),x.ready.promise=function(t){if(!n)if(n=x.Deferred(),"complete"===a.readyState)setTimeout(x.ready);else if(a.addEventListener)a.addEventListener("DOMContentLoaded",q,!1),e.addEventListener("load",q,!1);else{a.attachEvent("onreadystatechange",q),e.attachEvent("onload",q);var r=!1;try{r=null==e.frameElement&&a.documentElement}catch(i){}r&&r.doScroll&&function o(){if(!x.isReady){try{r.doScroll("left")}catch(e){return setTimeout(o,50)}_(),x.ready()}}()}return n.promise(t)},x.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){c["[object "+t+"]"]=t.toLowerCase()});function M(e){var t=e.length,n=x.type(e);return x.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}r=x(a),function(e,t){var n,r,i,o,a,s,l,u,c,p,f,d,h,g,m,y,v,b="sizzle"+-new Date,w=e.document,T=0,C=0,N=st(),k=st(),E=st(),S=!1,A=function(e,t){return e===t?(S=!0,0):0},j=typeof t,D=1<<31,L={}.hasOwnProperty,H=[],q=H.pop,_=H.push,M=H.push,O=H.slice,F=H.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++)if(this[t]===e)return t;return-1},B="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",P="[\\x20\\t\\r\\n\\f]",R="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",W=R.replace("w","w#"),$="\\["+P+"*("+R+")"+P+"*(?:([*^$|!~]?=)"+P+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+W+")|)|)"+P+"*\\]",I=":("+R+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+$.replace(3,8)+")*)|.*)\\)|)",z=RegExp("^"+P+"+|((?:^|[^\\\\])(?:\\\\.)*)"+P+"+$","g"),X=RegExp("^"+P+"*,"+P+"*"),U=RegExp("^"+P+"*([>+~]|"+P+")"+P+"*"),V=RegExp(P+"*[+~]"),Y=RegExp("="+P+"*([^\\]'\"]*)"+P+"*\\]","g"),J=RegExp(I),G=RegExp("^"+W+"$"),Q={ID:RegExp("^#("+R+")"),CLASS:RegExp("^\\.("+R+")"),TAG:RegExp("^("+R.replace("w","w*")+")"),ATTR:RegExp("^"+$),PSEUDO:RegExp("^"+I),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+P+"*(even|odd|(([+-]|)(\\d*)n|)"+P+"*(?:([+-]|)"+P+"*(\\d+)|))"+P+"*\\)|)","i"),bool:RegExp("^(?:"+B+")$","i"),needsContext:RegExp("^"+P+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+P+"*((?:-\\d)?\\d*)"+P+"*\\)|)(?=[^-]|$)","i")},K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,et=/^(?:input|select|textarea|button)$/i,tt=/^h\d$/i,nt=/'|\\/g,rt=RegExp("\\\\([\\da-f]{1,6}"+P+"?|("+P+")|.)","ig"),it=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:0>r?String.fromCharCode(r+65536):String.fromCharCode(55296|r>>10,56320|1023&r)};try{M.apply(H=O.call(w.childNodes),w.childNodes),H[w.childNodes.length].nodeType}catch(ot){M={apply:H.length?function(e,t){_.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function at(e,t,n,i){var o,a,s,l,u,c,d,m,y,x;if((t?t.ownerDocument||t:w)!==f&&p(t),t=t||f,n=n||[],!e||"string"!=typeof e)return n;if(1!==(l=t.nodeType)&&9!==l)return[];if(h&&!i){if(o=Z.exec(e))if(s=o[1]){if(9===l){if(a=t.getElementById(s),!a||!a.parentNode)return n;if(a.id===s)return n.push(a),n}else if(t.ownerDocument&&(a=t.ownerDocument.getElementById(s))&&v(t,a)&&a.id===s)return n.push(a),n}else{if(o[2])return M.apply(n,t.getElementsByTagName(e)),n;if((s=o[3])&&r.getElementsByClassName&&t.getElementsByClassName)return M.apply(n,t.getElementsByClassName(s)),n}if(r.qsa&&(!g||!g.test(e))){if(m=d=b,y=t,x=9===l&&e,1===l&&"object"!==t.nodeName.toLowerCase()){c=mt(e),(d=t.getAttribute("id"))?m=d.replace(nt,"\\$&"):t.setAttribute("id",m),m="[id='"+m+"'] ",u=c.length;while(u--)c[u]=m+yt(c[u]);y=V.test(e)&&t.parentNode||t,x=c.join(",")}if(x)try{return M.apply(n,y.querySelectorAll(x)),n}catch(T){}finally{d||t.removeAttribute("id")}}}return kt(e.replace(z,"$1"),t,n,i)}function st(){var e=[];function t(n,r){return e.push(n+=" ")>o.cacheLength&&delete t[e.shift()],t[n]=r}return t}function lt(e){return e[b]=!0,e}function ut(e){var t=f.createElement("div");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function ct(e,t){var n=e.split("|"),r=e.length;while(r--)o.attrHandle[n[r]]=t}function pt(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||D)-(~e.sourceIndex||D);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function ft(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function dt(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function ht(e){return lt(function(t){return t=+t,lt(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}s=at.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},r=at.support={},p=at.setDocument=function(e){var n=e?e.ownerDocument||e:w,i=n.defaultView;return n!==f&&9===n.nodeType&&n.documentElement?(f=n,d=n.documentElement,h=!s(n),i&&i.attachEvent&&i!==i.top&&i.attachEvent("onbeforeunload",function(){p()}),r.attributes=ut(function(e){return e.className="i",!e.getAttribute("className")}),r.getElementsByTagName=ut(function(e){return e.appendChild(n.createComment("")),!e.getElementsByTagName("*").length}),r.getElementsByClassName=ut(function(e){return e.innerHTML="
",e.firstChild.className="i",2===e.getElementsByClassName("i").length}),r.getById=ut(function(e){return d.appendChild(e).id=b,!n.getElementsByName||!n.getElementsByName(b).length}),r.getById?(o.find.ID=function(e,t){if(typeof t.getElementById!==j&&h){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},o.filter.ID=function(e){var t=e.replace(rt,it);return function(e){return e.getAttribute("id")===t}}):(delete o.find.ID,o.filter.ID=function(e){var t=e.replace(rt,it);return function(e){var n=typeof e.getAttributeNode!==j&&e.getAttributeNode("id");return n&&n.value===t}}),o.find.TAG=r.getElementsByTagName?function(e,n){return typeof n.getElementsByTagName!==j?n.getElementsByTagName(e):t}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},o.find.CLASS=r.getElementsByClassName&&function(e,n){return typeof n.getElementsByClassName!==j&&h?n.getElementsByClassName(e):t},m=[],g=[],(r.qsa=K.test(n.querySelectorAll))&&(ut(function(e){e.innerHTML="",e.querySelectorAll("[selected]").length||g.push("\\["+P+"*(?:value|"+B+")"),e.querySelectorAll(":checked").length||g.push(":checked")}),ut(function(e){var t=n.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("t",""),e.querySelectorAll("[t^='']").length&&g.push("[*^$]="+P+"*(?:''|\"\")"),e.querySelectorAll(":enabled").length||g.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),g.push(",.*:")})),(r.matchesSelector=K.test(y=d.webkitMatchesSelector||d.mozMatchesSelector||d.oMatchesSelector||d.msMatchesSelector))&&ut(function(e){r.disconnectedMatch=y.call(e,"div"),y.call(e,"[s!='']:x"),m.push("!=",I)}),g=g.length&&RegExp(g.join("|")),m=m.length&&RegExp(m.join("|")),v=K.test(d.contains)||d.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},A=d.compareDocumentPosition?function(e,t){if(e===t)return S=!0,0;var i=t.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(t);return i?1&i||!r.sortDetached&&t.compareDocumentPosition(e)===i?e===n||v(w,e)?-1:t===n||v(w,t)?1:c?F.call(c,e)-F.call(c,t):0:4&i?-1:1:e.compareDocumentPosition?-1:1}:function(e,t){var r,i=0,o=e.parentNode,a=t.parentNode,s=[e],l=[t];if(e===t)return S=!0,0;if(!o||!a)return e===n?-1:t===n?1:o?-1:a?1:c?F.call(c,e)-F.call(c,t):0;if(o===a)return pt(e,t);r=e;while(r=r.parentNode)s.unshift(r);r=t;while(r=r.parentNode)l.unshift(r);while(s[i]===l[i])i++;return i?pt(s[i],l[i]):s[i]===w?-1:l[i]===w?1:0},n):f},at.matches=function(e,t){return at(e,null,null,t)},at.matchesSelector=function(e,t){if((e.ownerDocument||e)!==f&&p(e),t=t.replace(Y,"='$1']"),!(!r.matchesSelector||!h||m&&m.test(t)||g&&g.test(t)))try{var n=y.call(e,t);if(n||r.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(i){}return at(t,f,null,[e]).length>0},at.contains=function(e,t){return(e.ownerDocument||e)!==f&&p(e),v(e,t)},at.attr=function(e,n){(e.ownerDocument||e)!==f&&p(e);var i=o.attrHandle[n.toLowerCase()],a=i&&L.call(o.attrHandle,n.toLowerCase())?i(e,n,!h):t;return a===t?r.attributes||!h?e.getAttribute(n):(a=e.getAttributeNode(n))&&a.specified?a.value:null:a},at.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},at.uniqueSort=function(e){var t,n=[],i=0,o=0;if(S=!r.detectDuplicates,c=!r.sortStable&&e.slice(0),e.sort(A),S){while(t=e[o++])t===e[o]&&(i=n.push(o));while(i--)e.splice(n[i],1)}return e},a=at.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=a(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r];r++)n+=a(t);return n},o=at.selectors={cacheLength:50,createPseudo:lt,match:Q,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(rt,it),e[3]=(e[4]||e[5]||"").replace(rt,it),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||at.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&at.error(e[0]),e},PSEUDO:function(e){var n,r=!e[5]&&e[2];return Q.CHILD.test(e[0])?null:(e[3]&&e[4]!==t?e[2]=e[4]:r&&J.test(r)&&(n=mt(r,!0))&&(n=r.indexOf(")",r.length-n)-r.length)&&(e[0]=e[0].slice(0,n),e[2]=r.slice(0,n)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(rt,it).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=N[e+" "];return t||(t=RegExp("(^|"+P+")"+e+"("+P+"|$)"))&&N(e,function(e){return t.test("string"==typeof e.className&&e.className||typeof e.getAttribute!==j&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=at.attr(r,e);return null==i?"!="===t:t?(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i+" ").indexOf(n)>-1:"|="===t?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,l){var u,c,p,f,d,h,g=o!==a?"nextSibling":"previousSibling",m=t.parentNode,y=s&&t.nodeName.toLowerCase(),v=!l&&!s;if(m){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===y:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?m.firstChild:m.lastChild],a&&v){c=m[b]||(m[b]={}),u=c[e]||[],d=u[0]===T&&u[1],f=u[0]===T&&u[2],p=d&&m.childNodes[d];while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if(1===p.nodeType&&++f&&p===t){c[e]=[T,d,f];break}}else if(v&&(u=(t[b]||(t[b]={}))[e])&&u[0]===T)f=u[1];else while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===y:1===p.nodeType)&&++f&&(v&&((p[b]||(p[b]={}))[e]=[T,f]),p===t))break;return f-=i,f===r||0===f%r&&f/r>=0}}},PSEUDO:function(e,t){var n,r=o.pseudos[e]||o.setFilters[e.toLowerCase()]||at.error("unsupported pseudo: "+e);return r[b]?r(t):r.length>1?(n=[e,e,"",t],o.setFilters.hasOwnProperty(e.toLowerCase())?lt(function(e,n){var i,o=r(e,t),a=o.length;while(a--)i=F.call(e,o[a]),e[i]=!(n[i]=o[a])}):function(e){return r(e,0,n)}):r}},pseudos:{not:lt(function(e){var t=[],n=[],r=l(e.replace(z,"$1"));return r[b]?lt(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),!n.pop()}}),has:lt(function(e){return function(t){return at(e,t).length>0}}),contains:lt(function(e){return function(t){return(t.textContent||t.innerText||a(t)).indexOf(e)>-1}}),lang:lt(function(e){return G.test(e||"")||at.error("unsupported lang: "+e),e=e.replace(rt,it).toLowerCase(),function(t){var n;do if(n=h?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===d},focus:function(e){return e===f.activeElement&&(!f.hasFocus||f.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!o.pseudos.empty(e)},header:function(e){return tt.test(e.nodeName)},input:function(e){return et.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:ht(function(){return[0]}),last:ht(function(e,t){return[t-1]}),eq:ht(function(e,t,n){return[0>n?n+t:n]}),even:ht(function(e,t){var n=0;for(;t>n;n+=2)e.push(n);return e}),odd:ht(function(e,t){var n=1;for(;t>n;n+=2)e.push(n);return e}),lt:ht(function(e,t,n){var r=0>n?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:ht(function(e,t,n){var r=0>n?n+t:n;for(;t>++r;)e.push(r);return e})}},o.pseudos.nth=o.pseudos.eq;for(n in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})o.pseudos[n]=ft(n);for(n in{submit:!0,reset:!0})o.pseudos[n]=dt(n);function gt(){}gt.prototype=o.filters=o.pseudos,o.setFilters=new gt;function mt(e,t){var n,r,i,a,s,l,u,c=k[e+" "];if(c)return t?0:c.slice(0);s=e,l=[],u=o.preFilter;while(s){(!n||(r=X.exec(s)))&&(r&&(s=s.slice(r[0].length)||s),l.push(i=[])),n=!1,(r=U.exec(s))&&(n=r.shift(),i.push({value:n,type:r[0].replace(z," ")}),s=s.slice(n.length));for(a in o.filter)!(r=Q[a].exec(s))||u[a]&&!(r=u[a](r))||(n=r.shift(),i.push({value:n,type:a,matches:r}),s=s.slice(n.length));if(!n)break}return t?s.length:s?at.error(e):k(e,l).slice(0)}function yt(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}function vt(e,t,n){var r=t.dir,o=n&&"parentNode"===r,a=C++;return t.first?function(t,n,i){while(t=t[r])if(1===t.nodeType||o)return e(t,n,i)}:function(t,n,s){var l,u,c,p=T+" "+a;if(s){while(t=t[r])if((1===t.nodeType||o)&&e(t,n,s))return!0}else while(t=t[r])if(1===t.nodeType||o)if(c=t[b]||(t[b]={}),(u=c[r])&&u[0]===p){if((l=u[1])===!0||l===i)return l===!0}else if(u=c[r]=[p],u[1]=e(t,n,s)||i,u[1]===!0)return!0}}function bt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function xt(e,t,n,r,i){var o,a=[],s=0,l=e.length,u=null!=t;for(;l>s;s++)(o=e[s])&&(!n||n(o,r,i))&&(a.push(o),u&&t.push(s));return a}function wt(e,t,n,r,i,o){return r&&!r[b]&&(r=wt(r)),i&&!i[b]&&(i=wt(i,o)),lt(function(o,a,s,l){var u,c,p,f=[],d=[],h=a.length,g=o||Nt(t||"*",s.nodeType?[s]:s,[]),m=!e||!o&&t?g:xt(g,f,e,s,l),y=n?i||(o?e:h||r)?[]:a:m;if(n&&n(m,y,s,l),r){u=xt(y,d),r(u,[],s,l),c=u.length;while(c--)(p=u[c])&&(y[d[c]]=!(m[d[c]]=p))}if(o){if(i||e){if(i){u=[],c=y.length;while(c--)(p=y[c])&&u.push(m[c]=p);i(null,y=[],u,l)}c=y.length;while(c--)(p=y[c])&&(u=i?F.call(o,p):f[c])>-1&&(o[u]=!(a[u]=p))}}else y=xt(y===a?y.splice(h,y.length):y),i?i(null,a,y,l):M.apply(a,y)})}function Tt(e){var t,n,r,i=e.length,a=o.relative[e[0].type],s=a||o.relative[" "],l=a?1:0,c=vt(function(e){return e===t},s,!0),p=vt(function(e){return F.call(t,e)>-1},s,!0),f=[function(e,n,r){return!a&&(r||n!==u)||((t=n).nodeType?c(e,n,r):p(e,n,r))}];for(;i>l;l++)if(n=o.relative[e[l].type])f=[vt(bt(f),n)];else{if(n=o.filter[e[l].type].apply(null,e[l].matches),n[b]){for(r=++l;i>r;r++)if(o.relative[e[r].type])break;return wt(l>1&&bt(f),l>1&&yt(e.slice(0,l-1).concat({value:" "===e[l-2].type?"*":""})).replace(z,"$1"),n,r>l&&Tt(e.slice(l,r)),i>r&&Tt(e=e.slice(r)),i>r&&yt(e))}f.push(n)}return bt(f)}function Ct(e,t){var n=0,r=t.length>0,a=e.length>0,s=function(s,l,c,p,d){var h,g,m,y=[],v=0,b="0",x=s&&[],w=null!=d,C=u,N=s||a&&o.find.TAG("*",d&&l.parentNode||l),k=T+=null==C?1:Math.random()||.1;for(w&&(u=l!==f&&l,i=n);null!=(h=N[b]);b++){if(a&&h){g=0;while(m=e[g++])if(m(h,l,c)){p.push(h);break}w&&(T=k,i=++n)}r&&((h=!m&&h)&&v--,s&&x.push(h))}if(v+=b,r&&b!==v){g=0;while(m=t[g++])m(x,y,l,c);if(s){if(v>0)while(b--)x[b]||y[b]||(y[b]=q.call(p));y=xt(y)}M.apply(p,y),w&&!s&&y.length>0&&v+t.length>1&&at.uniqueSort(p)}return w&&(T=k,u=C),x};return r?lt(s):s}l=at.compile=function(e,t){var n,r=[],i=[],o=E[e+" "];if(!o){t||(t=mt(e)),n=t.length;while(n--)o=Tt(t[n]),o[b]?r.push(o):i.push(o);o=E(e,Ct(i,r))}return o};function Nt(e,t,n){var r=0,i=t.length;for(;i>r;r++)at(e,t[r],n);return n}function kt(e,t,n,i){var a,s,u,c,p,f=mt(e);if(!i&&1===f.length){if(s=f[0]=f[0].slice(0),s.length>2&&"ID"===(u=s[0]).type&&r.getById&&9===t.nodeType&&h&&o.relative[s[1].type]){if(t=(o.find.ID(u.matches[0].replace(rt,it),t)||[])[0],!t)return n;e=e.slice(s.shift().value.length)}a=Q.needsContext.test(e)?0:s.length;while(a--){if(u=s[a],o.relative[c=u.type])break;if((p=o.find[c])&&(i=p(u.matches[0].replace(rt,it),V.test(s[0].type)&&t.parentNode||t))){if(s.splice(a,1),e=i.length&&yt(s),!e)return M.apply(n,i),n;break}}}return l(e,f)(i,t,!h,n,V.test(e)),n}r.sortStable=b.split("").sort(A).join("")===b,r.detectDuplicates=S,p(),r.sortDetached=ut(function(e){return 1&e.compareDocumentPosition(f.createElement("div"))}),ut(function(e){return e.innerHTML="","#"===e.firstChild.getAttribute("href")})||ct("type|href|height|width",function(e,n,r){return r?t:e.getAttribute(n,"type"===n.toLowerCase()?1:2)}),r.attributes&&ut(function(e){return e.innerHTML="",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||ct("value",function(e,n,r){return r||"input"!==e.nodeName.toLowerCase()?t:e.defaultValue}),ut(function(e){return null==e.getAttribute("disabled")})||ct(B,function(e,n,r){var i;return r?t:(i=e.getAttributeNode(n))&&i.specified?i.value:e[n]===!0?n.toLowerCase():null}),x.find=at,x.expr=at.selectors,x.expr[":"]=x.expr.pseudos,x.unique=at.uniqueSort,x.text=at.getText,x.isXMLDoc=at.isXML,x.contains=at.contains}(e);var O={};function F(e){var t=O[e]={};return x.each(e.match(T)||[],function(e,n){t[n]=!0}),t}x.Callbacks=function(e){e="string"==typeof e?O[e]||F(e):x.extend({},e);var n,r,i,o,a,s,l=[],u=!e.once&&[],c=function(t){for(r=e.memory&&t,i=!0,a=s||0,s=0,o=l.length,n=!0;l&&o>a;a++)if(l[a].apply(t[0],t[1])===!1&&e.stopOnFalse){r=!1;break}n=!1,l&&(u?u.length&&c(u.shift()):r?l=[]:p.disable())},p={add:function(){if(l){var t=l.length;(function i(t){x.each(t,function(t,n){var r=x.type(n);"function"===r?e.unique&&p.has(n)||l.push(n):n&&n.length&&"string"!==r&&i(n)})})(arguments),n?o=l.length:r&&(s=t,c(r))}return this},remove:function(){return l&&x.each(arguments,function(e,t){var r;while((r=x.inArray(t,l,r))>-1)l.splice(r,1),n&&(o>=r&&o--,a>=r&&a--)}),this},has:function(e){return e?x.inArray(e,l)>-1:!(!l||!l.length)},empty:function(){return l=[],o=0,this},disable:function(){return l=u=r=t,this},disabled:function(){return!l},lock:function(){return u=t,r||p.disable(),this},locked:function(){return!u},fireWith:function(e,t){return!l||i&&!u||(t=t||[],t=[e,t.slice?t.slice():t],n?u.push(t):c(t)),this},fire:function(){return p.fireWith(this,arguments),this},fired:function(){return!!i}};return p},x.extend({Deferred:function(e){var t=[["resolve","done",x.Callbacks("once memory"),"resolved"],["reject","fail",x.Callbacks("once memory"),"rejected"],["notify","progress",x.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return x.Deferred(function(n){x.each(t,function(t,o){var a=o[0],s=x.isFunction(e[t])&&e[t];i[o[1]](function(){var e=s&&s.apply(this,arguments);e&&x.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[a+"With"](this===r?n.promise():this,s?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?x.extend(e,r):r}},i={};return r.pipe=r.then,x.each(t,function(e,o){var a=o[2],s=o[3];r[o[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=a.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=g.call(arguments),r=n.length,i=1!==r||e&&x.isFunction(e.promise)?r:0,o=1===i?e:x.Deferred(),a=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?g.call(arguments):r,n===s?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},s,l,u;if(r>1)for(s=Array(r),l=Array(r),u=Array(r);r>t;t++)n[t]&&x.isFunction(n[t].promise)?n[t].promise().done(a(t,u,n)).fail(o.reject).progress(a(t,l,s)):--i;return i||o.resolveWith(u,n),o.promise()}}),x.support=function(t){var n,r,o,s,l,u,c,p,f,d=a.createElement("div");if(d.setAttribute("className","t"),d.innerHTML="
a",n=d.getElementsByTagName("*")||[],r=d.getElementsByTagName("a")[0],!r||!r.style||!n.length)return t;s=a.createElement("select"),u=s.appendChild(a.createElement("option")),o=d.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t.getSetAttribute="t"!==d.className,t.leadingWhitespace=3===d.firstChild.nodeType,t.tbody=!d.getElementsByTagName("tbody").length,t.htmlSerialize=!!d.getElementsByTagName("link").length,t.style=/top/.test(r.getAttribute("style")),t.hrefNormalized="/a"===r.getAttribute("href"),t.opacity=/^0.5/.test(r.style.opacity),t.cssFloat=!!r.style.cssFloat,t.checkOn=!!o.value,t.optSelected=u.selected,t.enctype=!!a.createElement("form").enctype,t.html5Clone="<:nav>"!==a.createElement("nav").cloneNode(!0).outerHTML,t.inlineBlockNeedsLayout=!1,t.shrinkWrapBlocks=!1,t.pixelPosition=!1,t.deleteExpando=!0,t.noCloneEvent=!0,t.reliableMarginRight=!0,t.boxSizingReliable=!0,o.checked=!0,t.noCloneChecked=o.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!u.disabled;try{delete d.test}catch(h){t.deleteExpando=!1}o=a.createElement("input"),o.setAttribute("value",""),t.input=""===o.getAttribute("value"),o.value="t",o.setAttribute("type","radio"),t.radioValue="t"===o.value,o.setAttribute("checked","t"),o.setAttribute("name","t"),l=a.createDocumentFragment(),l.appendChild(o),t.appendChecked=o.checked,t.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,d.attachEvent&&(d.attachEvent("onclick",function(){t.noCloneEvent=!1}),d.cloneNode(!0).click());for(f in{submit:!0,change:!0,focusin:!0})d.setAttribute(c="on"+f,"t"),t[f+"Bubbles"]=c in e||d.attributes[c].expando===!1;d.style.backgroundClip="content-box",d.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===d.style.backgroundClip;for(f in x(t))break;return t.ownLast="0"!==f,x(function(){var n,r,o,s="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",l=a.getElementsByTagName("body")[0];l&&(n=a.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",l.appendChild(n).appendChild(d),d.innerHTML="
t
",o=d.getElementsByTagName("td"),o[0].style.cssText="padding:0;margin:0;border:0;display:none",p=0===o[0].offsetHeight,o[0].style.display="",o[1].style.display="none",t.reliableHiddenOffsets=p&&0===o[0].offsetHeight,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",x.swap(l,null!=l.style.zoom?{zoom:1}:{},function(){t.boxSizing=4===d.offsetWidth}),e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(d,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(d,null)||{width:"4px"}).width,r=d.appendChild(a.createElement("div")),r.style.cssText=d.style.cssText=s,r.style.marginRight=r.style.width="0",d.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)),typeof d.style.zoom!==i&&(d.innerHTML="",d.style.cssText=s+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=3===d.offsetWidth,d.style.display="block",d.innerHTML="
",d.firstChild.style.width="5px",t.shrinkWrapBlocks=3!==d.offsetWidth,t.inlineBlockNeedsLayout&&(l.style.zoom=1)),l.removeChild(n),n=d=o=r=null)}),n=s=l=u=r=o=null,t +}({});var B=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,P=/([A-Z])/g;function R(e,n,r,i){if(x.acceptData(e)){var o,a,s=x.expando,l=e.nodeType,u=l?x.cache:e,c=l?e[s]:e[s]&&s;if(c&&u[c]&&(i||u[c].data)||r!==t||"string"!=typeof n)return c||(c=l?e[s]=p.pop()||x.guid++:s),u[c]||(u[c]=l?{}:{toJSON:x.noop}),("object"==typeof n||"function"==typeof n)&&(i?u[c]=x.extend(u[c],n):u[c].data=x.extend(u[c].data,n)),a=u[c],i||(a.data||(a.data={}),a=a.data),r!==t&&(a[x.camelCase(n)]=r),"string"==typeof n?(o=a[n],null==o&&(o=a[x.camelCase(n)])):o=a,o}}function W(e,t,n){if(x.acceptData(e)){var r,i,o=e.nodeType,a=o?x.cache:e,s=o?e[x.expando]:x.expando;if(a[s]){if(t&&(r=n?a[s]:a[s].data)){x.isArray(t)?t=t.concat(x.map(t,x.camelCase)):t in r?t=[t]:(t=x.camelCase(t),t=t in r?[t]:t.split(" ")),i=t.length;while(i--)delete r[t[i]];if(n?!I(r):!x.isEmptyObject(r))return}(n||(delete a[s].data,I(a[s])))&&(o?x.cleanData([e],!0):x.support.deleteExpando||a!=a.window?delete a[s]:a[s]=null)}}}x.extend({cache:{},noData:{applet:!0,embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(e){return e=e.nodeType?x.cache[e[x.expando]]:e[x.expando],!!e&&!I(e)},data:function(e,t,n){return R(e,t,n)},removeData:function(e,t){return W(e,t)},_data:function(e,t,n){return R(e,t,n,!0)},_removeData:function(e,t){return W(e,t,!0)},acceptData:function(e){if(e.nodeType&&1!==e.nodeType&&9!==e.nodeType)return!1;var t=e.nodeName&&x.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),x.fn.extend({data:function(e,n){var r,i,o=null,a=0,s=this[0];if(e===t){if(this.length&&(o=x.data(s),1===s.nodeType&&!x._data(s,"parsedAttrs"))){for(r=s.attributes;r.length>a;a++)i=r[a].name,0===i.indexOf("data-")&&(i=x.camelCase(i.slice(5)),$(s,i,o[i]));x._data(s,"parsedAttrs",!0)}return o}return"object"==typeof e?this.each(function(){x.data(this,e)}):arguments.length>1?this.each(function(){x.data(this,e,n)}):s?$(s,e,x.data(s,e)):null},removeData:function(e){return this.each(function(){x.removeData(this,e)})}});function $(e,n,r){if(r===t&&1===e.nodeType){var i="data-"+n.replace(P,"-$1").toLowerCase();if(r=e.getAttribute(i),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:B.test(r)?x.parseJSON(r):r}catch(o){}x.data(e,n,r)}else r=t}return r}function I(e){var t;for(t in e)if(("data"!==t||!x.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}x.extend({queue:function(e,n,r){var i;return e?(n=(n||"fx")+"queue",i=x._data(e,n),r&&(!i||x.isArray(r)?i=x._data(e,n,x.makeArray(r)):i.push(r)),i||[]):t},dequeue:function(e,t){t=t||"fx";var n=x.queue(e,t),r=n.length,i=n.shift(),o=x._queueHooks(e,t),a=function(){x.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return x._data(e,n)||x._data(e,n,{empty:x.Callbacks("once memory").add(function(){x._removeData(e,t+"queue"),x._removeData(e,n)})})}}),x.fn.extend({queue:function(e,n){var r=2;return"string"!=typeof e&&(n=e,e="fx",r--),r>arguments.length?x.queue(this[0],e):n===t?this:this.each(function(){var t=x.queue(this,e,n);x._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&x.dequeue(this,e)})},dequeue:function(e){return this.each(function(){x.dequeue(this,e)})},delay:function(e,t){return e=x.fx?x.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,o=x.Deferred(),a=this,s=this.length,l=function(){--i||o.resolveWith(a,[a])};"string"!=typeof e&&(n=e,e=t),e=e||"fx";while(s--)r=x._data(a[s],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(l));return l(),o.promise(n)}});var z,X,U=/[\t\r\n\f]/g,V=/\r/g,Y=/^(?:input|select|textarea|button|object)$/i,J=/^(?:a|area)$/i,G=/^(?:checked|selected)$/i,Q=x.support.getSetAttribute,K=x.support.input;x.fn.extend({attr:function(e,t){return x.access(this,x.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){x.removeAttr(this,e)})},prop:function(e,t){return x.access(this,x.prop,e,t,arguments.length>1)},removeProp:function(e){return e=x.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,o,a=0,s=this.length,l="string"==typeof e&&e;if(x.isFunction(e))return this.each(function(t){x(this).addClass(e.call(this,t,this.className))});if(l)for(t=(e||"").match(T)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(U," "):" ")){o=0;while(i=t[o++])0>r.indexOf(" "+i+" ")&&(r+=i+" ");n.className=x.trim(r)}return this},removeClass:function(e){var t,n,r,i,o,a=0,s=this.length,l=0===arguments.length||"string"==typeof e&&e;if(x.isFunction(e))return this.each(function(t){x(this).removeClass(e.call(this,t,this.className))});if(l)for(t=(e||"").match(T)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(U," "):"")){o=0;while(i=t[o++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");n.className=e?x.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e;return"boolean"==typeof t&&"string"===n?t?this.addClass(e):this.removeClass(e):x.isFunction(e)?this.each(function(n){x(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n){var t,r=0,o=x(this),a=e.match(T)||[];while(t=a[r++])o.hasClass(t)?o.removeClass(t):o.addClass(t)}else(n===i||"boolean"===n)&&(this.className&&x._data(this,"__className__",this.className),this.className=this.className||e===!1?"":x._data(this,"__className__")||"")})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(U," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,o=this[0];{if(arguments.length)return i=x.isFunction(e),this.each(function(n){var o;1===this.nodeType&&(o=i?e.call(this,n,x(this).val()):e,null==o?o="":"number"==typeof o?o+="":x.isArray(o)&&(o=x.map(o,function(e){return null==e?"":e+""})),r=x.valHooks[this.type]||x.valHooks[this.nodeName.toLowerCase()],r&&"set"in r&&r.set(this,o,"value")!==t||(this.value=o))});if(o)return r=x.valHooks[o.type]||x.valHooks[o.nodeName.toLowerCase()],r&&"get"in r&&(n=r.get(o,"value"))!==t?n:(n=o.value,"string"==typeof n?n.replace(V,""):null==n?"":n)}}}),x.extend({valHooks:{option:{get:function(e){var t=x.find.attr(e,"value");return null!=t?t:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||0>i,a=o?null:[],s=o?i+1:r.length,l=0>i?s:o?i:0;for(;s>l;l++)if(n=r[l],!(!n.selected&&l!==i||(x.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&x.nodeName(n.parentNode,"optgroup"))){if(t=x(n).val(),o)return t;a.push(t)}return a},set:function(e,t){var n,r,i=e.options,o=x.makeArray(t),a=i.length;while(a--)r=i[a],(r.selected=x.inArray(x(r).val(),o)>=0)&&(n=!0);return n||(e.selectedIndex=-1),o}}},attr:function(e,n,r){var o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return typeof e.getAttribute===i?x.prop(e,n,r):(1===s&&x.isXMLDoc(e)||(n=n.toLowerCase(),o=x.attrHooks[n]||(x.expr.match.bool.test(n)?X:z)),r===t?o&&"get"in o&&null!==(a=o.get(e,n))?a:(a=x.find.attr(e,n),null==a?t:a):null!==r?o&&"set"in o&&(a=o.set(e,r,n))!==t?a:(e.setAttribute(n,r+""),r):(x.removeAttr(e,n),t))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(T);if(o&&1===e.nodeType)while(n=o[i++])r=x.propFix[n]||n,x.expr.match.bool.test(n)?K&&Q||!G.test(n)?e[r]=!1:e[x.camelCase("default-"+n)]=e[r]=!1:x.attr(e,n,""),e.removeAttribute(Q?n:r)},attrHooks:{type:{set:function(e,t){if(!x.support.radioValue&&"radio"===t&&x.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{"for":"htmlFor","class":"className"},prop:function(e,n,r){var i,o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return a=1!==s||!x.isXMLDoc(e),a&&(n=x.propFix[n]||n,o=x.propHooks[n]),r!==t?o&&"set"in o&&(i=o.set(e,r,n))!==t?i:e[n]=r:o&&"get"in o&&null!==(i=o.get(e,n))?i:e[n]},propHooks:{tabIndex:{get:function(e){var t=x.find.attr(e,"tabindex");return t?parseInt(t,10):Y.test(e.nodeName)||J.test(e.nodeName)&&e.href?0:-1}}}}),X={set:function(e,t,n){return t===!1?x.removeAttr(e,n):K&&Q||!G.test(n)?e.setAttribute(!Q&&x.propFix[n]||n,n):e[x.camelCase("default-"+n)]=e[n]=!0,n}},x.each(x.expr.match.bool.source.match(/\w+/g),function(e,n){var r=x.expr.attrHandle[n]||x.find.attr;x.expr.attrHandle[n]=K&&Q||!G.test(n)?function(e,n,i){var o=x.expr.attrHandle[n],a=i?t:(x.expr.attrHandle[n]=t)!=r(e,n,i)?n.toLowerCase():null;return x.expr.attrHandle[n]=o,a}:function(e,n,r){return r?t:e[x.camelCase("default-"+n)]?n.toLowerCase():null}}),K&&Q||(x.attrHooks.value={set:function(e,n,r){return x.nodeName(e,"input")?(e.defaultValue=n,t):z&&z.set(e,n,r)}}),Q||(z={set:function(e,n,r){var i=e.getAttributeNode(r);return i||e.setAttributeNode(i=e.ownerDocument.createAttribute(r)),i.value=n+="","value"===r||n===e.getAttribute(r)?n:t}},x.expr.attrHandle.id=x.expr.attrHandle.name=x.expr.attrHandle.coords=function(e,n,r){var i;return r?t:(i=e.getAttributeNode(n))&&""!==i.value?i.value:null},x.valHooks.button={get:function(e,n){var r=e.getAttributeNode(n);return r&&r.specified?r.value:t},set:z.set},x.attrHooks.contenteditable={set:function(e,t,n){z.set(e,""===t?!1:t,n)}},x.each(["width","height"],function(e,n){x.attrHooks[n]={set:function(e,r){return""===r?(e.setAttribute(n,"auto"),r):t}}})),x.support.hrefNormalized||x.each(["href","src"],function(e,t){x.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}}),x.support.style||(x.attrHooks.style={get:function(e){return e.style.cssText||t},set:function(e,t){return e.style.cssText=t+""}}),x.support.optSelected||(x.propHooks.selected={get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}}),x.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){x.propFix[this.toLowerCase()]=this}),x.support.enctype||(x.propFix.enctype="encoding"),x.each(["radio","checkbox"],function(){x.valHooks[this]={set:function(e,n){return x.isArray(n)?e.checked=x.inArray(x(e).val(),n)>=0:t}},x.support.checkOn||(x.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var Z=/^(?:input|select|textarea)$/i,et=/^key/,tt=/^(?:mouse|contextmenu)|click/,nt=/^(?:focusinfocus|focusoutblur)$/,rt=/^([^.]*)(?:\.(.+)|)$/;function it(){return!0}function ot(){return!1}function at(){try{return a.activeElement}catch(e){}}x.event={global:{},add:function(e,n,r,o,a){var s,l,u,c,p,f,d,h,g,m,y,v=x._data(e);if(v){r.handler&&(c=r,r=c.handler,a=c.selector),r.guid||(r.guid=x.guid++),(l=v.events)||(l=v.events={}),(f=v.handle)||(f=v.handle=function(e){return typeof x===i||e&&x.event.triggered===e.type?t:x.event.dispatch.apply(f.elem,arguments)},f.elem=e),n=(n||"").match(T)||[""],u=n.length;while(u--)s=rt.exec(n[u])||[],g=y=s[1],m=(s[2]||"").split(".").sort(),g&&(p=x.event.special[g]||{},g=(a?p.delegateType:p.bindType)||g,p=x.event.special[g]||{},d=x.extend({type:g,origType:y,data:o,handler:r,guid:r.guid,selector:a,needsContext:a&&x.expr.match.needsContext.test(a),namespace:m.join(".")},c),(h=l[g])||(h=l[g]=[],h.delegateCount=0,p.setup&&p.setup.call(e,o,m,f)!==!1||(e.addEventListener?e.addEventListener(g,f,!1):e.attachEvent&&e.attachEvent("on"+g,f))),p.add&&(p.add.call(e,d),d.handler.guid||(d.handler.guid=r.guid)),a?h.splice(h.delegateCount++,0,d):h.push(d),x.event.global[g]=!0);e=null}},remove:function(e,t,n,r,i){var o,a,s,l,u,c,p,f,d,h,g,m=x.hasData(e)&&x._data(e);if(m&&(c=m.events)){t=(t||"").match(T)||[""],u=t.length;while(u--)if(s=rt.exec(t[u])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){p=x.event.special[d]||{},d=(r?p.delegateType:p.bindType)||d,f=c[d]||[],s=s[2]&&RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),l=o=f.length;while(o--)a=f[o],!i&&g!==a.origType||n&&n.guid!==a.guid||s&&!s.test(a.namespace)||r&&r!==a.selector&&("**"!==r||!a.selector)||(f.splice(o,1),a.selector&&f.delegateCount--,p.remove&&p.remove.call(e,a));l&&!f.length&&(p.teardown&&p.teardown.call(e,h,m.handle)!==!1||x.removeEvent(e,d,m.handle),delete c[d])}else for(d in c)x.event.remove(e,d+t[u],n,r,!0);x.isEmptyObject(c)&&(delete m.handle,x._removeData(e,"events"))}},trigger:function(n,r,i,o){var s,l,u,c,p,f,d,h=[i||a],g=v.call(n,"type")?n.type:n,m=v.call(n,"namespace")?n.namespace.split("."):[];if(u=f=i=i||a,3!==i.nodeType&&8!==i.nodeType&&!nt.test(g+x.event.triggered)&&(g.indexOf(".")>=0&&(m=g.split("."),g=m.shift(),m.sort()),l=0>g.indexOf(":")&&"on"+g,n=n[x.expando]?n:new x.Event(g,"object"==typeof n&&n),n.isTrigger=o?2:3,n.namespace=m.join("."),n.namespace_re=n.namespace?RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,n.result=t,n.target||(n.target=i),r=null==r?[n]:x.makeArray(r,[n]),p=x.event.special[g]||{},o||!p.trigger||p.trigger.apply(i,r)!==!1)){if(!o&&!p.noBubble&&!x.isWindow(i)){for(c=p.delegateType||g,nt.test(c+g)||(u=u.parentNode);u;u=u.parentNode)h.push(u),f=u;f===(i.ownerDocument||a)&&h.push(f.defaultView||f.parentWindow||e)}d=0;while((u=h[d++])&&!n.isPropagationStopped())n.type=d>1?c:p.bindType||g,s=(x._data(u,"events")||{})[n.type]&&x._data(u,"handle"),s&&s.apply(u,r),s=l&&u[l],s&&x.acceptData(u)&&s.apply&&s.apply(u,r)===!1&&n.preventDefault();if(n.type=g,!o&&!n.isDefaultPrevented()&&(!p._default||p._default.apply(h.pop(),r)===!1)&&x.acceptData(i)&&l&&i[g]&&!x.isWindow(i)){f=i[l],f&&(i[l]=null),x.event.triggered=g;try{i[g]()}catch(y){}x.event.triggered=t,f&&(i[l]=f)}return n.result}},dispatch:function(e){e=x.event.fix(e);var n,r,i,o,a,s=[],l=g.call(arguments),u=(x._data(this,"events")||{})[e.type]||[],c=x.event.special[e.type]||{};if(l[0]=e,e.delegateTarget=this,!c.preDispatch||c.preDispatch.call(this,e)!==!1){s=x.event.handlers.call(this,e,u),n=0;while((o=s[n++])&&!e.isPropagationStopped()){e.currentTarget=o.elem,a=0;while((i=o.handlers[a++])&&!e.isImmediatePropagationStopped())(!e.namespace_re||e.namespace_re.test(i.namespace))&&(e.handleObj=i,e.data=i.data,r=((x.event.special[i.origType]||{}).handle||i.handler).apply(o.elem,l),r!==t&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,e),e.result}},handlers:function(e,n){var r,i,o,a,s=[],l=n.delegateCount,u=e.target;if(l&&u.nodeType&&(!e.button||"click"!==e.type))for(;u!=this;u=u.parentNode||this)if(1===u.nodeType&&(u.disabled!==!0||"click"!==e.type)){for(o=[],a=0;l>a;a++)i=n[a],r=i.selector+" ",o[r]===t&&(o[r]=i.needsContext?x(r,this).index(u)>=0:x.find(r,this,null,[u]).length),o[r]&&o.push(i);o.length&&s.push({elem:u,handlers:o})}return n.length>l&&s.push({elem:this,handlers:n.slice(l)}),s},fix:function(e){if(e[x.expando])return e;var t,n,r,i=e.type,o=e,s=this.fixHooks[i];s||(this.fixHooks[i]=s=tt.test(i)?this.mouseHooks:et.test(i)?this.keyHooks:{}),r=s.props?this.props.concat(s.props):this.props,e=new x.Event(o),t=r.length;while(t--)n=r[t],e[n]=o[n];return e.target||(e.target=o.srcElement||a),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,o):e},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,i,o,s=n.button,l=n.fromElement;return null==e.pageX&&null!=n.clientX&&(i=e.target.ownerDocument||a,o=i.documentElement,r=i.body,e.pageX=n.clientX+(o&&o.scrollLeft||r&&r.scrollLeft||0)-(o&&o.clientLeft||r&&r.clientLeft||0),e.pageY=n.clientY+(o&&o.scrollTop||r&&r.scrollTop||0)-(o&&o.clientTop||r&&r.clientTop||0)),!e.relatedTarget&&l&&(e.relatedTarget=l===e.target?n.toElement:l),e.which||s===t||(e.which=1&s?1:2&s?3:4&s?2:0),e}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==at()&&this.focus)try{return this.focus(),!1}catch(e){}},delegateType:"focusin"},blur:{trigger:function(){return this===at()&&this.blur?(this.blur(),!1):t},delegateType:"focusout"},click:{trigger:function(){return x.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):t},_default:function(e){return x.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){e.result!==t&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=x.extend(new x.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?x.event.trigger(i,null,t):x.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},x.removeEvent=a.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]===i&&(e[r]=null),e.detachEvent(r,n))},x.Event=function(e,n){return this instanceof x.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?it:ot):this.type=e,n&&x.extend(this,n),this.timeStamp=e&&e.timeStamp||x.now(),this[x.expando]=!0,t):new x.Event(e,n)},x.Event.prototype={isDefaultPrevented:ot,isPropagationStopped:ot,isImmediatePropagationStopped:ot,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=it,e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=it,e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=it,this.stopPropagation()}},x.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){x.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;return(!i||i!==r&&!x.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),x.support.submitBubbles||(x.event.special.submit={setup:function(){return x.nodeName(this,"form")?!1:(x.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=x.nodeName(n,"input")||x.nodeName(n,"button")?n.form:t;r&&!x._data(r,"submitBubbles")&&(x.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),x._data(r,"submitBubbles",!0))}),t)},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&x.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return x.nodeName(this,"form")?!1:(x.event.remove(this,"._submit"),t)}}),x.support.changeBubbles||(x.event.special.change={setup:function(){return Z.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(x.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),x.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),x.event.simulate("change",this,e,!0)})),!1):(x.event.add(this,"beforeactivate._change",function(e){var t=e.target;Z.test(t.nodeName)&&!x._data(t,"changeBubbles")&&(x.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||x.event.simulate("change",this.parentNode,e,!0)}),x._data(t,"changeBubbles",!0))}),t)},handle:function(e){var n=e.target;return this!==n||e.isSimulated||e.isTrigger||"radio"!==n.type&&"checkbox"!==n.type?e.handleObj.handler.apply(this,arguments):t},teardown:function(){return x.event.remove(this,"._change"),!Z.test(this.nodeName)}}),x.support.focusinBubbles||x.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){x.event.simulate(t,e.target,x.event.fix(e),!0)};x.event.special[t]={setup:function(){0===n++&&a.addEventListener(e,r,!0)},teardown:function(){0===--n&&a.removeEventListener(e,r,!0)}}}),x.fn.extend({on:function(e,n,r,i,o){var a,s;if("object"==typeof e){"string"!=typeof n&&(r=r||n,n=t);for(a in e)this.on(a,n,r,e[a],o);return this}if(null==r&&null==i?(i=n,r=n=t):null==i&&("string"==typeof n?(i=r,r=t):(i=r,r=n,n=t)),i===!1)i=ot;else if(!i)return this;return 1===o&&(s=i,i=function(e){return x().off(e),s.apply(this,arguments)},i.guid=s.guid||(s.guid=x.guid++)),this.each(function(){x.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,o;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,x(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof e){for(o in e)this.off(o,n,e[o]);return this}return(n===!1||"function"==typeof n)&&(r=n,n=t),r===!1&&(r=ot),this.each(function(){x.event.remove(this,e,r,n)})},trigger:function(e,t){return this.each(function(){x.event.trigger(e,t,this)})},triggerHandler:function(e,n){var r=this[0];return r?x.event.trigger(e,n,r,!0):t}});var st=/^.[^:#\[\.,]*$/,lt=/^(?:parents|prev(?:Until|All))/,ut=x.expr.match.needsContext,ct={children:!0,contents:!0,next:!0,prev:!0};x.fn.extend({find:function(e){var t,n=[],r=this,i=r.length;if("string"!=typeof e)return this.pushStack(x(e).filter(function(){for(t=0;i>t;t++)if(x.contains(r[t],this))return!0}));for(t=0;i>t;t++)x.find(e,r[t],n);return n=this.pushStack(i>1?x.unique(n):n),n.selector=this.selector?this.selector+" "+e:e,n},has:function(e){var t,n=x(e,this),r=n.length;return this.filter(function(){for(t=0;r>t;t++)if(x.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(ft(this,e||[],!0))},filter:function(e){return this.pushStack(ft(this,e||[],!1))},is:function(e){return!!ft(this,"string"==typeof e&&ut.test(e)?x(e):e||[],!1).length},closest:function(e,t){var n,r=0,i=this.length,o=[],a=ut.test(e)||"string"!=typeof e?x(e,t||this.context):0;for(;i>r;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(11>n.nodeType&&(a?a.index(n)>-1:1===n.nodeType&&x.find.matchesSelector(n,e))){n=o.push(n);break}return this.pushStack(o.length>1?x.unique(o):o)},index:function(e){return e?"string"==typeof e?x.inArray(this[0],x(e)):x.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?x(e,t):x.makeArray(e&&e.nodeType?[e]:e),r=x.merge(this.get(),n);return this.pushStack(x.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}});function pt(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}x.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return x.dir(e,"parentNode")},parentsUntil:function(e,t,n){return x.dir(e,"parentNode",n)},next:function(e){return pt(e,"nextSibling")},prev:function(e){return pt(e,"previousSibling")},nextAll:function(e){return x.dir(e,"nextSibling")},prevAll:function(e){return x.dir(e,"previousSibling")},nextUntil:function(e,t,n){return x.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return x.dir(e,"previousSibling",n)},siblings:function(e){return x.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return x.sibling(e.firstChild)},contents:function(e){return x.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:x.merge([],e.childNodes)}},function(e,t){x.fn[e]=function(n,r){var i=x.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=x.filter(r,i)),this.length>1&&(ct[e]||(i=x.unique(i)),lt.test(e)&&(i=i.reverse())),this.pushStack(i)}}),x.extend({filter:function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?x.find.matchesSelector(r,e)?[r]:[]:x.find.matches(e,x.grep(t,function(e){return 1===e.nodeType}))},dir:function(e,n,r){var i=[],o=e[n];while(o&&9!==o.nodeType&&(r===t||1!==o.nodeType||!x(o).is(r)))1===o.nodeType&&i.push(o),o=o[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});function ft(e,t,n){if(x.isFunction(t))return x.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return x.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(st.test(t))return x.filter(t,e,n);t=x.filter(t,e)}return x.grep(e,function(e){return x.inArray(e,t)>=0!==n})}function dt(e){var t=ht.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}var ht="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",gt=/ jQuery\d+="(?:null|\d+)"/g,mt=RegExp("<(?:"+ht+")[\\s/>]","i"),yt=/^\s+/,vt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bt=/<([\w:]+)/,xt=/\s*$/g,At={option:[1,""],legend:[1,"
","
"],area:[1,"",""],param:[1,"",""],thead:[1,"","
"],tr:[2,"","
"],col:[2,"","
"],td:[3,"","
"],_default:x.support.htmlSerialize?[0,"",""]:[1,"X
","
"]},jt=dt(a),Dt=jt.appendChild(a.createElement("div"));At.optgroup=At.option,At.tbody=At.tfoot=At.colgroup=At.caption=At.thead,At.th=At.td,x.fn.extend({text:function(e){return x.access(this,function(e){return e===t?x.text(this):this.empty().append((this[0]&&this[0].ownerDocument||a).createTextNode(e))},null,e,arguments.length)},append:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Lt(this,e);t.appendChild(e)}})},prepend:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Lt(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=e?x.filter(e,this):this,i=0;for(;null!=(n=r[i]);i++)t||1!==n.nodeType||x.cleanData(Ft(n)),n.parentNode&&(t&&x.contains(n.ownerDocument,n)&&_t(Ft(n,"script")),n.parentNode.removeChild(n));return this},empty:function(){var e,t=0;for(;null!=(e=this[t]);t++){1===e.nodeType&&x.cleanData(Ft(e,!1));while(e.firstChild)e.removeChild(e.firstChild);e.options&&x.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return x.clone(this,e,t)})},html:function(e){return x.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return 1===n.nodeType?n.innerHTML.replace(gt,""):t;if(!("string"!=typeof e||Tt.test(e)||!x.support.htmlSerialize&&mt.test(e)||!x.support.leadingWhitespace&&yt.test(e)||At[(bt.exec(e)||["",""])[1].toLowerCase()])){e=e.replace(vt,"<$1>");try{for(;i>r;r++)n=this[r]||{},1===n.nodeType&&(x.cleanData(Ft(n,!1)),n.innerHTML=e);n=0}catch(o){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=x.map(this,function(e){return[e.nextSibling,e.parentNode]}),t=0;return this.domManip(arguments,function(n){var r=e[t++],i=e[t++];i&&(r&&r.parentNode!==i&&(r=this.nextSibling),x(this).remove(),i.insertBefore(n,r))},!0),t?this:this.remove()},detach:function(e){return this.remove(e,!0)},domManip:function(e,t,n){e=d.apply([],e);var r,i,o,a,s,l,u=0,c=this.length,p=this,f=c-1,h=e[0],g=x.isFunction(h);if(g||!(1>=c||"string"!=typeof h||x.support.checkClone)&&Nt.test(h))return this.each(function(r){var i=p.eq(r);g&&(e[0]=h.call(this,r,i.html())),i.domManip(e,t,n)});if(c&&(l=x.buildFragment(e,this[0].ownerDocument,!1,!n&&this),r=l.firstChild,1===l.childNodes.length&&(l=r),r)){for(a=x.map(Ft(l,"script"),Ht),o=a.length;c>u;u++)i=l,u!==f&&(i=x.clone(i,!0,!0),o&&x.merge(a,Ft(i,"script"))),t.call(this[u],i,u);if(o)for(s=a[a.length-1].ownerDocument,x.map(a,qt),u=0;o>u;u++)i=a[u],kt.test(i.type||"")&&!x._data(i,"globalEval")&&x.contains(s,i)&&(i.src?x._evalUrl(i.src):x.globalEval((i.text||i.textContent||i.innerHTML||"").replace(St,"")));l=r=null}return this}});function Lt(e,t){return x.nodeName(e,"table")&&x.nodeName(1===t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function Ht(e){return e.type=(null!==x.find.attr(e,"type"))+"/"+e.type,e}function qt(e){var t=Et.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function _t(e,t){var n,r=0;for(;null!=(n=e[r]);r++)x._data(n,"globalEval",!t||x._data(t[r],"globalEval"))}function Mt(e,t){if(1===t.nodeType&&x.hasData(e)){var n,r,i,o=x._data(e),a=x._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,i=s[n].length;i>r;r++)x.event.add(t,n,s[n][r])}a.data&&(a.data=x.extend({},a.data))}}function Ot(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!x.support.noCloneEvent&&t[x.expando]){i=x._data(t);for(r in i.events)x.removeEvent(t,r,i.handle);t.removeAttribute(x.expando)}"script"===n&&t.text!==e.text?(Ht(t).text=e.text,qt(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),x.support.html5Clone&&e.innerHTML&&!x.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&Ct.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.defaultSelected=t.selected=e.defaultSelected:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}}x.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){x.fn[e]=function(e){var n,r=0,i=[],o=x(e),a=o.length-1;for(;a>=r;r++)n=r===a?this:this.clone(!0),x(o[r])[t](n),h.apply(i,n.get());return this.pushStack(i)}});function Ft(e,n){var r,o,a=0,s=typeof e.getElementsByTagName!==i?e.getElementsByTagName(n||"*"):typeof e.querySelectorAll!==i?e.querySelectorAll(n||"*"):t;if(!s)for(s=[],r=e.childNodes||e;null!=(o=r[a]);a++)!n||x.nodeName(o,n)?s.push(o):x.merge(s,Ft(o,n));return n===t||n&&x.nodeName(e,n)?x.merge([e],s):s}function Bt(e){Ct.test(e.type)&&(e.defaultChecked=e.checked)}x.extend({clone:function(e,t,n){var r,i,o,a,s,l=x.contains(e.ownerDocument,e);if(x.support.html5Clone||x.isXMLDoc(e)||!mt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(Dt.innerHTML=e.outerHTML,Dt.removeChild(o=Dt.firstChild)),!(x.support.noCloneEvent&&x.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||x.isXMLDoc(e)))for(r=Ft(o),s=Ft(e),a=0;null!=(i=s[a]);++a)r[a]&&Ot(i,r[a]);if(t)if(n)for(s=s||Ft(e),r=r||Ft(o),a=0;null!=(i=s[a]);a++)Mt(i,r[a]);else Mt(e,o);return r=Ft(o,"script"),r.length>0&&_t(r,!l&&Ft(e,"script")),r=s=i=null,o},buildFragment:function(e,t,n,r){var i,o,a,s,l,u,c,p=e.length,f=dt(t),d=[],h=0;for(;p>h;h++)if(o=e[h],o||0===o)if("object"===x.type(o))x.merge(d,o.nodeType?[o]:o);else if(wt.test(o)){s=s||f.appendChild(t.createElement("div")),l=(bt.exec(o)||["",""])[1].toLowerCase(),c=At[l]||At._default,s.innerHTML=c[1]+o.replace(vt,"<$1>")+c[2],i=c[0];while(i--)s=s.lastChild;if(!x.support.leadingWhitespace&&yt.test(o)&&d.push(t.createTextNode(yt.exec(o)[0])),!x.support.tbody){o="table"!==l||xt.test(o)?""!==c[1]||xt.test(o)?0:s:s.firstChild,i=o&&o.childNodes.length;while(i--)x.nodeName(u=o.childNodes[i],"tbody")&&!u.childNodes.length&&o.removeChild(u)}x.merge(d,s.childNodes),s.textContent="";while(s.firstChild)s.removeChild(s.firstChild);s=f.lastChild}else d.push(t.createTextNode(o));s&&f.removeChild(s),x.support.appendChecked||x.grep(Ft(d,"input"),Bt),h=0;while(o=d[h++])if((!r||-1===x.inArray(o,r))&&(a=x.contains(o.ownerDocument,o),s=Ft(f.appendChild(o),"script"),a&&_t(s),n)){i=0;while(o=s[i++])kt.test(o.type||"")&&n.push(o)}return s=null,f},cleanData:function(e,t){var n,r,o,a,s=0,l=x.expando,u=x.cache,c=x.support.deleteExpando,f=x.event.special;for(;null!=(n=e[s]);s++)if((t||x.acceptData(n))&&(o=n[l],a=o&&u[o])){if(a.events)for(r in a.events)f[r]?x.event.remove(n,r):x.removeEvent(n,r,a.handle); +u[o]&&(delete u[o],c?delete n[l]:typeof n.removeAttribute!==i?n.removeAttribute(l):n[l]=null,p.push(o))}},_evalUrl:function(e){return x.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})}}),x.fn.extend({wrapAll:function(e){if(x.isFunction(e))return this.each(function(t){x(this).wrapAll(e.call(this,t))});if(this[0]){var t=x(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&1===e.firstChild.nodeType)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return x.isFunction(e)?this.each(function(t){x(this).wrapInner(e.call(this,t))}):this.each(function(){var t=x(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=x.isFunction(e);return this.each(function(n){x(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){x.nodeName(this,"body")||x(this).replaceWith(this.childNodes)}).end()}});var Pt,Rt,Wt,$t=/alpha\([^)]*\)/i,It=/opacity\s*=\s*([^)]*)/,zt=/^(top|right|bottom|left)$/,Xt=/^(none|table(?!-c[ea]).+)/,Ut=/^margin/,Vt=RegExp("^("+w+")(.*)$","i"),Yt=RegExp("^("+w+")(?!px)[a-z%]+$","i"),Jt=RegExp("^([+-])=("+w+")","i"),Gt={BODY:"block"},Qt={position:"absolute",visibility:"hidden",display:"block"},Kt={letterSpacing:0,fontWeight:400},Zt=["Top","Right","Bottom","Left"],en=["Webkit","O","Moz","ms"];function tn(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=en.length;while(i--)if(t=en[i]+n,t in e)return t;return r}function nn(e,t){return e=t||e,"none"===x.css(e,"display")||!x.contains(e.ownerDocument,e)}function rn(e,t){var n,r,i,o=[],a=0,s=e.length;for(;s>a;a++)r=e[a],r.style&&(o[a]=x._data(r,"olddisplay"),n=r.style.display,t?(o[a]||"none"!==n||(r.style.display=""),""===r.style.display&&nn(r)&&(o[a]=x._data(r,"olddisplay",ln(r.nodeName)))):o[a]||(i=nn(r),(n&&"none"!==n||!i)&&x._data(r,"olddisplay",i?n:x.css(r,"display"))));for(a=0;s>a;a++)r=e[a],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[a]||"":"none"));return e}x.fn.extend({css:function(e,n){return x.access(this,function(e,n,r){var i,o,a={},s=0;if(x.isArray(n)){for(o=Rt(e),i=n.length;i>s;s++)a[n[s]]=x.css(e,n[s],!1,o);return a}return r!==t?x.style(e,n,r):x.css(e,n)},e,n,arguments.length>1)},show:function(){return rn(this,!0)},hide:function(){return rn(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){nn(this)?x(this).show():x(this).hide()})}}),x.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Wt(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":x.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,a,s,l=x.camelCase(n),u=e.style;if(n=x.cssProps[l]||(x.cssProps[l]=tn(u,l)),s=x.cssHooks[n]||x.cssHooks[l],r===t)return s&&"get"in s&&(o=s.get(e,!1,i))!==t?o:u[n];if(a=typeof r,"string"===a&&(o=Jt.exec(r))&&(r=(o[1]+1)*o[2]+parseFloat(x.css(e,n)),a="number"),!(null==r||"number"===a&&isNaN(r)||("number"!==a||x.cssNumber[l]||(r+="px"),x.support.clearCloneStyle||""!==r||0!==n.indexOf("background")||(u[n]="inherit"),s&&"set"in s&&(r=s.set(e,r,i))===t)))try{u[n]=r}catch(c){}}},css:function(e,n,r,i){var o,a,s,l=x.camelCase(n);return n=x.cssProps[l]||(x.cssProps[l]=tn(e.style,l)),s=x.cssHooks[n]||x.cssHooks[l],s&&"get"in s&&(a=s.get(e,!0,r)),a===t&&(a=Wt(e,n,i)),"normal"===a&&n in Kt&&(a=Kt[n]),""===r||r?(o=parseFloat(a),r===!0||x.isNumeric(o)?o||0:a):a}}),e.getComputedStyle?(Rt=function(t){return e.getComputedStyle(t,null)},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),l=s?s.getPropertyValue(n)||s[n]:t,u=e.style;return s&&(""!==l||x.contains(e.ownerDocument,e)||(l=x.style(e,n)),Yt.test(l)&&Ut.test(n)&&(i=u.width,o=u.minWidth,a=u.maxWidth,u.minWidth=u.maxWidth=u.width=l,l=s.width,u.width=i,u.minWidth=o,u.maxWidth=a)),l}):a.documentElement.currentStyle&&(Rt=function(e){return e.currentStyle},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),l=s?s[n]:t,u=e.style;return null==l&&u&&u[n]&&(l=u[n]),Yt.test(l)&&!zt.test(n)&&(i=u.left,o=e.runtimeStyle,a=o&&o.left,a&&(o.left=e.currentStyle.left),u.left="fontSize"===n?"1em":l,l=u.pixelLeft+"px",u.left=i,a&&(o.left=a)),""===l?"auto":l});function on(e,t,n){var r=Vt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function an(e,t,n,r,i){var o=n===(r?"border":"content")?4:"width"===t?1:0,a=0;for(;4>o;o+=2)"margin"===n&&(a+=x.css(e,n+Zt[o],!0,i)),r?("content"===n&&(a-=x.css(e,"padding"+Zt[o],!0,i)),"margin"!==n&&(a-=x.css(e,"border"+Zt[o]+"Width",!0,i))):(a+=x.css(e,"padding"+Zt[o],!0,i),"padding"!==n&&(a+=x.css(e,"border"+Zt[o]+"Width",!0,i)));return a}function sn(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=Rt(e),a=x.support.boxSizing&&"border-box"===x.css(e,"boxSizing",!1,o);if(0>=i||null==i){if(i=Wt(e,t,o),(0>i||null==i)&&(i=e.style[t]),Yt.test(i))return i;r=a&&(x.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+an(e,t,n||(a?"border":"content"),r,o)+"px"}function ln(e){var t=a,n=Gt[e];return n||(n=un(e,t),"none"!==n&&n||(Pt=(Pt||x(""); + function receiveMessage(event) { + console.log("<", event) + if (event.data.id && event.data.id == "docson") { + var frame = document.getElementById(event.data.url); + if(event.data.action == "resized") { + frame.height = event.data.height + 18; + } + if(event.data.action == "ready") { + console.log(frame.parentNode) + frame.contentWindow.postMessage({ id: "docson", font: window.getComputedStyle(frame.parentNode).fontFamily}, "*"); + } + } + + } + window.addEventListener("message", receiveMessage, false); +} else { + alert("

Missing data-schema (url to schema)

") +} diff --git a/examples/biojsonschema.json b/examples/biojsonschema.json new file mode 100644 index 0000000..e6670d2 --- /dev/null +++ b/examples/biojsonschema.json @@ -0,0 +1 @@ +{"$schema":"http://json-schema.org/draft-04/schema#","id":"http://jsonschema.net","type":"object","properties":{"seqs":{"id":"http://jsonschema.net/seqs","type":"array","items":{"id":"http://jsonschema.net/seqs/0","type":"object","properties":{"name":{"id":"http://jsonschema.net/seqs/0/name","type":"string","description":"Sequence name"},"start":{"id":"http://jsonschema.net/seqs/0/start","type":"integer","description":"Start residue position"},"svid":{"id":"http://jsonschema.net/seqs/0/svid","type":"string","description":"Serial version id for sequence object"},"end":{"id":"http://jsonschema.net/seqs/0/end","type":"integer","description":"End residue position"},"id":{"id":"http://jsonschema.net/seqs/0/id","type":"string","description":"Sequence unique identifier"},"seq":{"id":"http://jsonschema.net/seqs/0/seq","type":"string","description":"Sequence Residues"},"order":{"id":"http://jsonschema.net/seqs/0/order","type":"integer","description":"Sequence order in an alignment space"}},"required":["name","start","svid","end","id","seq"]},"required":["0"],"description":"Sequences in the Alignemnt","minItems":"1","maxItems":"*"},"appSettings":{"id":"http://jsonschema.net/appSettings","type":"object","properties":{"globalColorScheme":{"id":"http://jsonschema.net/appSettings/globalColorScheme","type":"string","description":"Global colour schem for the alignment"},"webStartUrl":{"id":"http://jsonschema.net/appSettings/webStartUrl","type":"string","description":"Jalview specific setting which points to a url for launching Jalview"},"application":{"id":"http://jsonschema.net/appSettings/application","type":"string","description":"Application which generated the Json"},"showSeqFeatures":{"id":"http://jsonschema.net/appSettings/showSeqFeatures","type":"string","description":"Determines if sequence features are visible or not"},"version":{"id":"http://jsonschema.net/appSettings/version","type":"string","description":"Verion of the application which generated the JSON"},"hiddenCols":{"id":"http://jsonschema.net/appSettings/hiddenCols","type":"string","description":"Delimited lists of hidden colums ranges i.e [2-3,5-5,11-23]"}},"description":"Application specific settings"},"seqGroups":{"id":"http://jsonschema.net/seqGroups","type":"array","items":[{"id":"http://jsonschema.net/seqGroups/0","type":"object","properties":{"displayText":{"id":"http://jsonschema.net/seqGroups/0/displayText","type":"boolean","description":"Determines if the texts of the group is displayed or not"},"startRes":{"id":"http://jsonschema.net/seqGroups/0/startRes","type":"integer","description":"Start residue position for a given group"},"groupName":{"id":"http://jsonschema.net/seqGroups/0/groupName","type":"string","description":"Group name"},"endRes":{"id":"http://jsonschema.net/seqGroups/0/endRes","type":"integer","description":"End residue position for a given group"},"colourText":{"id":"http://jsonschema.net/seqGroups/0/colourText","type":"boolean","description":"Determines if the Residues text for the group is coloured"},"seqsHash":{"id":"http://jsonschema.net/seqGroups/0/seqsHash","type":"array","items":[],"minItems":"0","maxItems":"*","description":"The id's of the sequences which belongs to the group"},"svid":{"id":"http://jsonschema.net/seqGroups/0/svid","type":"string","description":"Serial version id for a given group"},"showNonconserved":{"id":"http://jsonschema.net/seqGroups/0/showNonconserved","type":"boolean","description":"Determines if non conserved regions of a group is shown or not"},"colourScheme":{"id":"http://jsonschema.net/seqGroups/0/colourScheme","type":"string","description":"Colour Scheme for the sequence group"},"displayBoxes":{"id":"http://jsonschema.net/seqGroups/0/displayBoxes","type":"boolean","description":"Determines if the group border should be visible or not"}}}],"description":"Sequence groups in the Alignment","minItems":"0","maxItems":"*"},"alignAnnotation":{"id":"http://jsonschema.net/alignAnnotation","type":"array","items":{"id":"http://jsonschema.net/alignAnnotation/0","type":"object","properties":{"svid":{"id":"http://jsonschema.net/alignAnnotation/0/svid","type":"string","description":"Serial version id for the annotation object"},"annotations":{"id":"http://jsonschema.net/alignAnnotation/0/annotations","type":"array","items":[{"id":"http://jsonschema.net/alignAnnotation/0/annotations/0","type":"object","properties":{"displayCharacter":{"id":"http://jsonschema.net/alignAnnotation/0/annotations/0/displayCharacter","type":"string","description":"Display character to denote the given annotation"},"value":{"id":"http://jsonschema.net/alignAnnotation/0/annotations/0/value","type":"integer","description":"Value of the annotation"},"secondaryStructure":{"id":"http://jsonschema.net/alignAnnotation/0/annotations/0/secondaryStructure","type":"string","description":"Secondary structure symbol for the given annotation"}}},{"id":"http://jsonschema.net/alignAnnotation/0/annotations/1","type":"object","properties":{"displayCharacter":{"id":"http://jsonschema.net/alignAnnotation/0/annotations/1/displayCharacter","type":"string"},"value":{"id":"http://jsonschema.net/alignAnnotation/0/annotations/1/value","type":"integer"},"secondaryStructure":{"id":"http://jsonschema.net/alignAnnotation/0/annotations/1/secondaryStructure","type":"string"}}},{"id":"http://jsonschema.net/alignAnnotation/0/annotations/2","type":"object","properties":{"displayCharacter":{"id":"http://jsonschema.net/alignAnnotation/0/annotations/2/displayCharacter","type":"string"},"value":{"id":"http://jsonschema.net/alignAnnotation/0/annotations/2/value","type":"integer"},"secondaryStructure":{"id":"http://jsonschema.net/alignAnnotation/0/annotations/2/secondaryStructure","type":"string"}}}]},"description":{"id":"http://jsonschema.net/alignAnnotation/0/description","type":"string","description":"Description of the Alignment Annotation"},"label":{"id":"http://jsonschema.net/alignAnnotation/0/label","type":"string","description":"Label for the Annotation"}}},"description":"Alignment Annotations","minItems":"0","maxItems":"*"},"svid":{"id":"http://jsonschema.net/svid","type":"string","description":"Serial version id"},"seqFeatures":{"id":"http://jsonschema.net/seqFeatures","type":"array","items":{"id":"http://jsonschema.net/seqFeatures/0","type":"object","properties":{"fillColor":{"id":"http://jsonschema.net/seqFeatures/0/fillColor","type":"string","description":"Fill colour"},"score":{"id":"http://jsonschema.net/seqFeatures/0/score","type":"integer","description":"Score"},"sequenceRef":{"id":"http://jsonschema.net/seqFeatures/0/sequenceRef","type":"string","description":"Reference to the Sequence in the alignement (More like a foreign key)"},"featureGroup":{"id":"http://jsonschema.net/seqFeatures/0/featureGroup","type":"string","description":"Feature Group"},"svid":{"id":"http://jsonschema.net/seqFeatures/0/svid","type":"string","description":"Serial version id for the SeqFeature object"},"description":{"id":"http://jsonschema.net/seqFeatures/0/description","type":"string","description":"Description of Feature"},"xStart":{"id":"http://jsonschema.net/seqFeatures/0/xStart","type":"integer","description":"Start residue position for the sequence feature"},"xEnd":{"id":"http://jsonschema.net/seqFeatures/0/xEnd","type":"integer","description":"End residue position for the sequence feature"},"type":{"id":"http://jsonschema.net/seqFeatures/0/type","type":"string","description":"The name of the SequenceFeature"}}},"minItems":"0","maxItems":"*","description":"Sequence Features within the alignment"}},"required":["seqs","appSettings","seqGroups","alignAnnotation","svid","seqFeatures"]} \ No newline at end of file diff --git a/examples/example.json b/examples/example.json index 47ea429..92d691b 100644 --- a/examples/example.json +++ b/examples/example.json @@ -1 +1 @@ -{"seqs":[{"name":"FER_CAPAN/3-34","start":3,"end":34,"id":"FER_CAPAN_1580333149","seq":"SVSATMISTSFMPRKPAVTSL-KPIPNVGE--ALF","order":1},{"name":"FER1_SOLLC/3-34","start":3,"end":34,"id":"FER1_SOLLC_1952300006","seq":"SISGTMISTSFLPRKPAVTSL-KAISNVGE--ALF","order":2},{"name":"Q93XJ9_SOLTU/3-34","start":3,"end":34,"id":"Q93XJ9_SOLTU_1274067508","seq":"SISGTMISTSFLPRKPVVTSL-KAISNVGE--ALF","order":3},{"name":"FER1_PEA/6-37","start":6,"end":37,"id":"FER1_PEA_1823806146","seq":"ALYGTAVSTSFLRTQPMPMSV-TTTKAFSN--GFL","order":4},{"name":"Q7XA98_TRIPR/6-39","start":6,"end":39,"id":"Q7XA98_TRIPR_1024982041","seq":"ALYGTAVSTSFMRRQPVPMSV-ATTTTTKAFPSGF","order":5}],"seqGroups":[{"displayText":true,"startRes":21,"groupName":"JGroup:1883305585","endRes":29,"colourText":false,"seqsHash":["FER1_SOLLC_1952300006","Q93XJ9_SOLTU_1274067508","FER1_PEA_1823806146","Q7XA98_TRIPR_1024982041"],"showNonconserved":false,"colourScheme":"Zappo","displayBoxes":true}],"alignAnnotation":[{"annotations":[{"displayCharacter":"","value":0,"secondaryStructure":"\u0000"},{"displayCharacter":"","value":0,"secondaryStructure":"\u0000"},{"displayCharacter":"α","value":0,"secondaryStructure":"H"},{"displayCharacter":"α","value":0,"secondaryStructure":"H"},{"displayCharacter":"α","value":0,"secondaryStructure":"H"},{"displayCharacter":"","value":0,"secondaryStructure":"\u0000"},{"displayCharacter":"","value":0,"secondaryStructure":"\u0000"},{"displayCharacter":"","value":0,"secondaryStructure":"\u0000"},{"displayCharacter":"β","value":0,"secondaryStructure":"E"},{"displayCharacter":"β","value":0,"secondaryStructure":"E"},{"displayCharacter":"β","value":0,"secondaryStructure":"E"},{"displayCharacter":"β","value":0,"secondaryStructure":"E"},{"displayCharacter":"β","value":0,"secondaryStructure":"E"},{"displayCharacter":"β","value":0,"secondaryStructure":"E"},{"displayCharacter":"β","value":0,"secondaryStructure":"E"},{"displayCharacter":"β","value":0,"secondaryStructure":"E"},{"displayCharacter":"","value":0,"secondaryStructure":"\u0000"},{"displayCharacter":"","value":0,"secondaryStructure":"\u0000"},{"displayCharacter":"","value":0,"secondaryStructure":"\u0000"},{"displayCharacter":"","value":0,"secondaryStructure":"\u0000"},{"displayCharacter":"","value":0,"secondaryStructure":"\u0000"},{"displayCharacter":"","value":0,"secondaryStructure":"\u0000"},{"displayCharacter":"","value":0,"secondaryStructure":"\u0000"},{"displayCharacter":"","value":0,"secondaryStructure":"\u0000"},{"displayCharacter":"","value":0,"secondaryStructure":"\u0000"},{"displayCharacter":"","value":0,"secondaryStructure":"\u0000"},{"displayCharacter":"α","value":0,"secondaryStructure":"H"},{"displayCharacter":"α","value":0,"secondaryStructure":"H"},{"displayCharacter":"α","value":0,"secondaryStructure":"H"},{"displayCharacter":"α","value":0,"secondaryStructure":"H"},{"displayCharacter":"α","value":0,"secondaryStructure":"H"},{"displayCharacter":"","value":0,"secondaryStructure":"\u0000"},{"displayCharacter":"","value":0,"secondaryStructure":"\u0000"},{"displayCharacter":"","value":0,"secondaryStructure":"\u0000"},{"displayCharacter":"","value":0,"secondaryStructure":"\u0000"}],"description":"New description","label":"Secondary Structure"}],"jalviewSettings":{"globalColorScheme":"foo","jalviewVersion":"Test","webStartUrl":"http://www.jalview.org/services/launchApp","showSeqFeatures":true,"wrapModeEnabled":false},"seqFeatures":[{"fillColor":"#ff0033","score":0,"sequenceRef":"Q93XJ9_SOLTU_1274067508","featureGroup":"Jalview","description":"desciption","xStart":3,"xEnd":13,"type":"feature_x"},{"fillColor":"#ff0033","score":0,"sequenceRef":"FER1_PEA_1823806146","featureGroup":"Jalview","description":"desciption","xStart":3,"xEnd":13,"type":"feature_x"},{"fillColor":"#ff0033","score":0,"sequenceRef":"Q7XA98_TRIPR_1024982041","featureGroup":"Jalview","description":"desciption","xStart":3,"xEnd":13,"type":"feature_x"}]} \ No newline at end of file +{"seqs":[{"name":"FER_CAPAN/3-34","start":3,"svid":"1.0","end":34,"id":"1665704504","seq":"SVSATMISTSFMPRKPAVTSL-KPIPNVGE--ALF","order":1},{"name":"FER1_SOLLC/3-34","start":3,"svid":"1.0","end":34,"id":"1003594867","seq":"SISGTMISTSFLPRKPAVTSL-KAISNVGE--ALF","order":2},{"name":"Q93XJ9_SOLTU/3-34","start":3,"svid":"1.0","end":34,"id":"1332961135","seq":"SISGTMISTSFLPRKPVVTSL-KAISNVGE--ALF","order":3},{"name":"FER1_PEA/6-37","start":6,"svid":"1.0","end":37,"id":"1335040546","seq":"ALYGTAVSTSFLRTQPMPMSV-TTTKAFSN--GFL","order":4},{"name":"Q7XA98_TRIPR/6-39","start":6,"svid":"1.0","end":39,"id":"1777084554","seq":"ALYGTAVSTSFMRRQPVPMSV-ATTTTTKAFPSGF","order":5},{"name":"FER_TOCH/3-34","start":3,"svid":"1.0","end":34,"id":"823528539","seq":"FILGTMISKSFLFRKPAVTSL-KAISNVGE--ALF","order":6}],"appSettings":{"globalColorScheme":"zappo","webStartUrl":"www.jalview.org/services/launchApp","application":"Jalview","hiddenSeqs":"823528539","showSeqFeatures":"true","version":"2.9","hiddenCols":"32-33;34-34"},"seqGroups":[{"displayText":true,"startRes":21,"groupName":"JGroup:1883305585","endRes":29,"colourText":false,"seqsHash":["1003594867","1332961135","1335040546","1777084554"],"svid":"1.0","showNonconserved":false,"colourScheme":"Zappo","displayBoxes":true}],"alignAnnotation":[{"svid":"1.0","annotations":[{"displayCharacter":"","value":0,"secondaryStructure":"\u0000"},{"displayCharacter":"","value":0,"secondaryStructure":"\u0000"},{"displayCharacter":"α","value":0,"secondaryStructure":"H"},{"displayCharacter":"α","value":0,"secondaryStructure":"H"},{"displayCharacter":"α","value":0,"secondaryStructure":"H"},{"displayCharacter":"","value":0,"secondaryStructure":"\u0000"},{"displayCharacter":"","value":0,"secondaryStructure":"\u0000"},{"displayCharacter":"","value":0,"secondaryStructure":"\u0000"},{"displayCharacter":"β","value":0,"secondaryStructure":"E"},{"displayCharacter":"β","value":0,"secondaryStructure":"E"},{"displayCharacter":"β","value":0,"secondaryStructure":"E"},{"displayCharacter":"β","value":0,"secondaryStructure":"E"},{"displayCharacter":"β","value":0,"secondaryStructure":"E"},{"displayCharacter":"β","value":0,"secondaryStructure":"E"},{"displayCharacter":"β","value":0,"secondaryStructure":"E"},{"displayCharacter":"β","value":0,"secondaryStructure":"E"},{"displayCharacter":"","value":0,"secondaryStructure":"\u0000"},{"displayCharacter":"","value":0,"secondaryStructure":"\u0000"},{"displayCharacter":"","value":0,"secondaryStructure":"\u0000"},{"displayCharacter":"","value":0,"secondaryStructure":"\u0000"},{"displayCharacter":"","value":0,"secondaryStructure":"\u0000"},{"displayCharacter":"","value":0,"secondaryStructure":"\u0000"},{"displayCharacter":"","value":0,"secondaryStructure":"\u0000"},{"displayCharacter":"","value":0,"secondaryStructure":"\u0000"},{"displayCharacter":"","value":0,"secondaryStructure":"\u0000"},{"displayCharacter":"","value":0,"secondaryStructure":"\u0000"},{"displayCharacter":"α","value":0,"secondaryStructure":"H"},{"displayCharacter":"α","value":0,"secondaryStructure":"H"},{"displayCharacter":"α","value":0,"secondaryStructure":"H"},{"displayCharacter":"α","value":0,"secondaryStructure":"H"},{"displayCharacter":"α","value":0,"secondaryStructure":"H"},{"displayCharacter":"","value":0,"secondaryStructure":"\u0000"},{"displayCharacter":"","value":0,"secondaryStructure":"\u0000"},{"displayCharacter":"","value":0,"secondaryStructure":"\u0000"},{"displayCharacter":"","value":0,"secondaryStructure":"\u0000"}],"description":"New description","label":"Secondary Structure"}],"svid":"1.0","seqFeatures":[{"fillColor":"#7d1633","score":0,"sequenceRef":"1332961135","featureGroup":"Jalview","svid":"1.0","description":"desciption","xStart":3,"xEnd":13,"type":"feature_x"},{"fillColor":"#7d1633","score":0,"sequenceRef":"1335040546","featureGroup":"Jalview","svid":"1.0","description":"desciption","xStart":3,"xEnd":13,"type":"feature_x"},{"fillColor":"#7d1633","score":0,"sequenceRef":"1777084554","featureGroup":"Jalview","svid":"1.0","description":"desciption","xStart":3,"xEnd":13,"type":"feature_x"}]} \ No newline at end of file diff --git a/examples/testdata/test.aln b/examples/testdata/test.aln new file mode 100644 index 0000000..08a7ac3 --- /dev/null +++ b/examples/testdata/test.aln @@ -0,0 +1,53 @@ +CLUSTAL + +FER_CAPAA/1-97 -----------------------------------------------------------A +FER_CAPAN/1-144 MA------SVSATMISTSFMPRKPAVTSL-KPIPNVGE--ALFGLKS-A--NGGKVTCMA +FER1_SOLLC/1-144 MA------SISGTMISTSFLPRKPAVTSL-KAISNVGE--ALFGLKS-G--RNGRITCMA +Q93XJ9_SOLTU/1-144 MA------SISGTMISTSFLPRKPVVTSL-KAISNVGE--ALFGLKS-G--RNGRITCMA +FER1_PEA/1-149 MATT---PALYGTAVSTSFLRTQPMPMSV-TTTKAFSN--GFLGLKT-SLKRGDLAVAMA +Q7XA98_TRIPR/1-152 MATT---PALYGTAVSTSFMRRQPVPMSV-ATTTTTKAFPSGFGLKSVSTKRGDLAVAMA +FER1_MESCR/1-148 MAAT--TAALSGATMSTAFAPK--TPPMTAALPTNVGR--ALFGLKS-SASR-GRVTAMA +FER1_SPIOL/1-147 MAAT--TTTMMG--MATTFVPKPQAPPMMAALPSNTGR--SLFGLKT-GSR--GGRMTMA +FER3_RAPSA/1-96 -----------------------------------------------------------A +FER1_ARATH/1-148 MAST----ALSSAIVGTSFIRRSPAPISLRSLPSANTQ--SLFGLKS-GTARGGRVTAMA +FER_BRANA/1-96 -----------------------------------------------------------A +FER2_ARATH/1-148 MAST----ALSSAIVSTSFLRRQQTPISLRSLPFANTQ--SLFGLKS-STARGGRVTAMA +Q93Z60_ARATH/1-118 MAST----ALSSAIVSTSFLRRQQTPISLRSLPFANTQ--SLFGLKS-STARGGRVTAMA +FER1_MAIZE/1-150 MATVLGSPRAPAFFFSSSSLRAAPAPTAV--ALPAAKV--GIMGRSA-SSRR--RLRAQA +O80429_MAIZE/1-140 MAAT---------ALSMSILR---APPPCFSSPLRLRV--AVAKPLA-APMRRQLLRAQA +1A70|/1-97 -----------------------------------------------------------A + +FER_CAPAA/1-97 SYKVKLITPDGPIEFDCPDDVYILDQAEEAGHDLPYSCRAGSCSSCAGKIAGGAVDQTDG +FER_CAPAN/1-144 SYKVKLITPDGPIEFDCPDNVYILDQAEEAGHDLPYSCRAGSCSSCAGKIAGGAVDQTDG +FER1_SOLLC/1-144 SYKVKLITPEGPIEFECPDDVYILDQAEEEGHDLPYSCRAGSCSSCAGKVTAGSVDQSDG +Q93XJ9_SOLTU/1-144 SYKVKLITPDGPIEFECPDDVYILDQAEEEGHDLPYSCRAGSCSSCAGKVTAGTVDQSDG +FER1_PEA/1-149 SYKVKLVTPDGTQEFECPSDVYILDHAEEVGIDLPYSCRAGSCSSCAGKVVGGEVDQSDG +Q7XA98_TRIPR/1-152 TYKVKLITPEGPQEFDCPDDVYILDHAEEVGIELPYSCRAGSCSSCAGKVVNGNVNQEDG +FER1_MESCR/1-148 AYKVTLVTPEGKQELECPDDVYILDAAEEAGIDLPYSCRAGSCSSCAGKVTSGSVNQDDG +FER1_SPIOL/1-147 AYKVTLVTPTGNVEFQCPDDVYILDAAEEEGIDLPYSCRAGSCSSCAGKLKTGSLNQDDQ +FER3_RAPSA/1-96 TYKVKFITPEGEQEVECDDDVYVLDAAEEAGIDLPYSCRAGSCSSCAGKVVSGSVDQSDQ +FER1_ARATH/1-148 TYKVKFITPEGELEVECDDDVYVLDAAEEAGIDLPYSCRAGSCSSCAGKVVSGSVDQSDQ +FER_BRANA/1-96 TYKVKFITPEGEQEVECDDDVYVLDAAEEAGIDLPYSCRAGSCSSCAGKVVSGFVDQSDE +FER2_ARATH/1-148 TYKVKFITPEGEQEVECEEDVYVLDAAEEAGLDLPYSCRAGSCSSCAGKVVSGSIDQSDQ +Q93Z60_ARATH/1-118 TYKVKFITPEGEQEVECEEDVYVLDAAEEAGLDLPYSCRAGSCSSCAGKVVSGSIDQSDQ +FER1_MAIZE/1-150 TYNVKLITPEGEVELQVPDDVYILDQAEEDGIDLPYSCRAGSCSSCAGKVVSGSVDQSDQ +O80429_MAIZE/1-140 TYNVKLITPEGEVELQVPDDVYILDFAEEEGIDLPFSCRAGSCSSCAGKVVSGSVDQSDQ +1A70|/1-97 AYKVTLVTPTGNVEFQCPDDVYILDAAEEEGIDLPYSCRAGSCSSCAGKLKTGSLNQDDQ + +FER_CAPAA/1-97 NFLDDDQLEEGWVLTCVAYPQSDVTIETHKEAELVG- +FER_CAPAN/1-144 NFLDDDQLEEGWVLTCVAYPQSDVTIETHKEAELVG- +FER1_SOLLC/1-144 NFLDEDQEAAGFVLTCVAYPKGDVTIETHKEEELTA- +Q93XJ9_SOLTU/1-144 KFLDDDQEAAGFVLTCVAYPKCDVTIETHKEEELTA- +FER1_PEA/1-149 SFLDDEQIEAGFVLTCVAYPTSDVVIETHKEEDLTA- +Q7XA98_TRIPR/1-152 SFLDDEQIEGGWVLTCVAFPTSDVTIETHKEEELTA- +FER1_MESCR/1-148 SFLDDDQIKEGWVLTCVAYPTGDVTIETHKEEELTA- +FER1_SPIOL/1-147 SFLDDDQIDEGWVLTCAAYPVSDVTIETHKEEELTA- +FER3_RAPSA/1-96 SFLDDDQIAEGFVLTCAAYPTSDVTIETHREEDMV-- +FER1_ARATH/1-148 SFLDDEQIGEGFVLTCAAYPTSDVTIETHKEEDIV-- +FER_BRANA/1-96 SFLDDDQIAEGFVLTCAAYPTSDVTIETHKEEELV-- +FER2_ARATH/1-148 SFLDDEQMSEGYVLTCVAYPTSDVVIETHKEEAIM-- +Q93Z60_ARATH/1-118 SFLDD-------------------------------- +FER1_MAIZE/1-150 SYLDDGQIADGWVLTCHAYPTSDVVIETHKEEELTGA +O80429_MAIZE/1-140 SFLNDNQVADGWVLTCAAYPTSDVVIETHKEDDLL-- +1A70|/1-97 SFLDDDQIDEGWVLTCAAYPVSDVTIETHKKEELTA + diff --git a/examples/testdata/test.amsa b/examples/testdata/test.amsa new file mode 100644 index 0000000..be456bf --- /dev/null +++ b/examples/testdata/test.amsa @@ -0,0 +1,72 @@ +>FER_CAPAA Ferredoxin +-----------------------------------------------------------ASYKVKLITPDGP +IEFDCPDDVYILDQAEEAGHDLPYSCRAGSCSSCAGKIAGGAVDQTDGNFLDDDQLEEGWVLTCVAYPQSDV +TIETHKEAELVG- +>FER_CAPAN Ferredoxin, chloroplast precursor +MA------SVSATMISTSFMPRKPAVTSL-KPIPNVGE--ALFGLKS-A--NGGKVTCMASYKVKLITPDGP +IEFDCPDNVYILDQAEEAGHDLPYSCRAGSCSSCAGKIAGGAVDQTDGNFLDDDQLEEGWVLTCVAYPQSDV +TIETHKEAELVG- +>FER1_SOLLC Ferredoxin-1, chloroplast precursor +MA------SISGTMISTSFLPRKPAVTSL-KAISNVGE--ALFGLKS-G--RNGRITCMASYKVKLITPEGP +IEFECPDDVYILDQAEEEGHDLPYSCRAGSCSSCAGKVTAGSVDQSDGNFLDEDQEAAGFVLTCVAYPKGDV +TIETHKEEELTA- +>Q93XJ9_SOLTU Ferredoxin I precursor +MA------SISGTMISTSFLPRKPVVTSL-KAISNVGE--ALFGLKS-G--RNGRITCMASYKVKLITPDGP +IEFECPDDVYILDQAEEEGHDLPYSCRAGSCSSCAGKVTAGTVDQSDGKFLDDDQEAAGFVLTCVAYPKCDV +TIETHKEEELTA- +>FER1_PEA Ferredoxin-1, chloroplast precursor +MATT---PALYGTAVSTSFLRTQPMPMSV-TTTKAFSN--GFLGLKT-SLKRGDLAVAMASYKVKLVTPDGT +QEFECPSDVYILDHAEEVGIDLPYSCRAGSCSSCAGKVVGGEVDQSDGSFLDDEQIEAGFVLTCVAYPTSDV +VIETHKEEDLTA- +>Q7XA98_TRIPR Ferredoxin I +MATT---PALYGTAVSTSFMRRQPVPMSV-ATTTTTKAFPSGFGLKSVSTKRGDLAVAMATYKVKLITPEGP +QEFDCPDDVYILDHAEEVGIELPYSCRAGSCSSCAGKVVNGNVNQEDGSFLDDEQIEGGWVLTCVAFPTSDV +TIETHKEEELTA- +>FER1_MESCR Ferredoxin-1, chloroplast precursor +MAAT--TAALSGATMSTAFAPK--TPPMTAALPTNVGR--ALFGLKS-SASR-GRVTAMAAYKVTLVTPEGK +QELECPDDVYILDAAEEAGIDLPYSCRAGSCSSCAGKVTSGSVNQDDGSFLDDDQIKEGWVLTCVAYPTGDV +TIETHKEEELTA- +>FER1_SPIOL Ferredoxin-1, chloroplast precursor +MAAT--TTTMMG--MATTFVPKPQAPPMMAALPSNTGR--SLFGLKT-GSR--GGRMTMAAYKVTLVTPTGN +VEFQCPDDVYILDAAEEEGIDLPYSCRAGSCSSCAGKLKTGSLNQDDQSFLDDDQIDEGWVLTCAAYPVSDV +TIETHKEEELTA- +>FER3_RAPSA Ferredoxin, leaf L-A +-----------------------------------------------------------ATYKVKFITPEGE +QEVECDDDVYVLDAAEEAGIDLPYSCRAGSCSSCAGKVVSGSVDQSDQSFLDDDQIAEGFVLTCAAYPTSDV +TIETHREEDMV-- +>FER1_ARATH Ferredoxin-1, chloroplast precursor +MAST----ALSSAIVGTSFIRRSPAPISLRSLPSANTQ--SLFGLKS-GTARGGRVTAMATYKVKFITPEGE +LEVECDDDVYVLDAAEEAGIDLPYSCRAGSCSSCAGKVVSGSVDQSDQSFLDDEQIGEGFVLTCAAYPTSDV +TIETHKEEDIV-- +>FER_BRANA Ferredoxin +-----------------------------------------------------------ATYKVKFITPEGE +QEVECDDDVYVLDAAEEAGIDLPYSCRAGSCSSCAGKVVSGFVDQSDESFLDDDQIAEGFVLTCAAYPTSDV +TIETHKEEELV-- +>FER2_ARATH Ferredoxin-2, chloroplast precursor +MAST----ALSSAIVSTSFLRRQQTPISLRSLPFANTQ--SLFGLKS-STARGGRVTAMATYKVKFITPEGE +QEVECEEDVYVLDAAEEAGLDLPYSCRAGSCSSCAGKVVSGSIDQSDQSFLDDEQMSEGYVLTCVAYPTSDV +VIETHKEEAIM-- +>Q93Z60_ARATH At1g10960/T19D16_12 +MAST----ALSSAIVSTSFLRRQQTPISLRSLPFANTQ--SLFGLKS-STARGGRVTAMATYKVKFITPEGE +QEVECEEDVYVLDAAEEAGLDLPYSCRAGSCSSCAGKVVSGSIDQSDQSFLDD------------------- +------------- +>FER1_MAIZE Ferredoxin-1, chloroplast precursor +MATVLGSPRAPAFFFSSSSLRAAPAPTAV--ALPAAKV--GIMGRSA-SSRR--RLRAQATYNVKLITPEGE +VELQVPDDVYILDQAEEDGIDLPYSCRAGSCSSCAGKVVSGSVDQSDQSYLDDGQIADGWVLTCHAYPTSDV +VIETHKEEELTGA +>O80429_MAIZE Ferredoxin +MAAT---------ALSMSILR---APPPCFSSPLRLRV--AVAKPLA-APMRRQLLRAQATYNVKLITPEGE +VELQVPDDVYILDFAEEEGIDLPFSCRAGSCSSCAGKVVSGSVDQSDQSFLNDNQVADGWVLTCAAYPTSDV +VIETHKEDDLL-- +>1A70| +-----------------------------------------------------------AAYKVTLVTPTGN +VEFQCPDDVYILDAAEEEGIDLPYSCRAGSCSSCAGKLKTGSLNQDDQSFLDDDQIDEGWVLTCAAYPVSDV +TIETHKKEELTA +>#_Secondary Structure New description + 1 2 + 3 F F F 4 5 6 7 F 9 + +>#_Iron Sulphur Contacts New description + + F F F F + diff --git a/examples/testdata/test.blc b/examples/testdata/test.blc new file mode 100644 index 0000000..f419862 --- /dev/null +++ b/examples/testdata/test.blc @@ -0,0 +1,175 @@ +>FER_CAPAA/1-97 Ferredoxin +>FER_CAPAN/1-144 Ferredoxin, chloroplast precursor +>FER1_SOLLC/1-144 Ferredoxin-1, chloroplast precursor +>Q93XJ9_SOLTU/1-144 Ferredoxin I precursor +>FER1_PEA/1-149 Ferredoxin-1, chloroplast precursor +>Q7XA98_TRIPR/1-152 Ferredoxin I +>FER1_MESCR/1-148 Ferredoxin-1, chloroplast precursor +>FER1_SPIOL/1-147 Ferredoxin-1, chloroplast precursor +>FER3_RAPSA/1-96 Ferredoxin, leaf L-A +>FER1_ARATH/1-148 Ferredoxin-1, chloroplast precursor +>FER_BRANA/1-96 Ferredoxin +>FER2_ARATH/1-148 Ferredoxin-2, chloroplast precursor +>Q93Z60_ARATH/1-118 At1g10960/T19D16_12 +>FER1_MAIZE/1-150 Ferredoxin-1, chloroplast precursor +>O80429_MAIZE/1-140 Ferredoxin +>1A70|/1-97 +* iteration 1 +-MMMMMMM-M-MMMM- +-AAAAAAA-A-AAAA- +----TTAA-S-SSTA- +----TTTT-T-TTVT- +-------------L-- +-------------G-- +------TT-----S-- +----PPAT-----P-- +-SSSAAAT-A-AAR-- +-VIILLLM-L-LLA-- +-SSSYYSM-S-SSP-- +-AGGGGGG-S-SSA-- +-TTTTTA--A-AAF-- +-MMMAAT--I-IIFA- +-IIIVVMM-V-VVFL- +-SSSSSSA-G-SSSS- +-TTTTTTT-T-TTSM- +-SSSSSAT-S-SSSS- +-FFFFFFF-F-FFSI- +-MLLLMAV-I-LLLL- +-PPPRRPP-R-RRRR- +-RRRTRKK-R-RRA-- +-KKKQQ-P-S-QQA-- +-PPPPP-Q-P-QQP-- +-AAVMVTA-A-TTAA- +-VVVPPPP-P-PPPP- +-TTTMMPP-I-IITP- +-SSSSSMM-S-SSAP- +-LLLVVTM-L-LLVC- +------AA-R-RR-F- +-KKKTAAA-S-SS-S- +-PAATTLL-L-LLAS- +-IIITTPP-P-PPLP- +-PSSKTTS-S-FFPL- +-NNNATNN-A-AAAR- +-VVVFTVT-N-NNAL- +-GGGSKGG-T-TTKR- +-EEENARR-Q-QQVV- +-----F---------- +-----P---------- +-AAAGSAS-S-SSGA- +-LLLFGLL-L-LLIV- +-FFFLFFF-F-FFMA- +-GGGGGGG-G-GGGK- +-LLLLLLL-L-LLRP- +-KKKKKKK-K-KKSL- +-SSSTSST-S-SSAA- +-----V---------- +-AGGSSSG-G-SSSA- +----LTAS-T-TTSP- +----KKSR-A-AARM- +-NRRRRR--R-RRRR- +-GNNGG---G-GG-R- +-GGGDDGG-G-GG-Q- +-KRRLLRG-R-RRRL- +-VIIAAVR-V-VVLL- +-TTTVVTM-T-TTRR- +-CCCAAAT-A-AAAA- +-MMMMMMM-M-MMQQ- +AAAAAAAAAAAAAAAA +SSSSSTAATTTTTTTA +YYYYYYYYYYYYYYYY +KKKKKKKKKKKKKNNK +VVVVVVVVVVVVVVVV +KKKKKKTTKKKKKKKT +LLLLLLLLFFFFFLLL +IIIIVIVVIIIIIIIV +TTTTTTTTTTTTTTTT +PPPPPPPPPPPPPPPP +DDEDDEETEEEEEEET +GGGGGGGGGGGGGGGG +PPPPTPKNEEEEEEEN +IIIIQQQVQLQQQVVV +EEEEEEEEEEEEEEEE +FFFFFFLFVVVVVLLF +DDEEEDEQEEEEEQQQ +CCCCCCCCCCCCCVVC +PPPPPPPPDDDEEPPP +DDDDSDDDDDDEEDDD +DNDDDDDDDDDDDDDD +VVVVVVVVVVVVVVVV +YYYYYYYYYYYYYYYY +IIIIIIIIVVVVVIII +LLLLLLLLLLLLLLLL +DDDDDDDDDDDDDDDD +QQQQHHAAAAAAAQFA +AAAAAAAAAAAAAAAA +EEEEEEEEEEEEEEEE +EEEEEEEEEEEEEEEE +AAEEVVAEAAAAADEE +GGGGGGGGGGGGGGGG +HHHHIIIIIIILLIII +DDDDDEDDDDDDDDDD +LLLLLLLLLLLLLLLL +PPPPPPPPPPPPPPPP +YYYYYYYYYYYYYYFY +SSSSSSSSSSSSSSSS +CCCCCCCCCCCCCCCC +RRRRRRRRRRRRRRRR +AAAAAAAAAAAAAAAA +GGGGGGGGGGGGGGGG +SSSSSSSSSSSSSSSS +CCCCCCCCCCCCCCCC +SSSSSSSSSSSSSSSS +SSSSSSSSSSSSSSSS +CCCCCCCCCCCCCCCC +AAAAAAAAAAAAAAAA +GGGGGGGGGGGGGGGG +KKKKKKKKKKKKKKKK +IIVVVVVLVVVVVVVL +AATTVVTKVVVVVVVK +GGAAGNSTSSSSSSST +GGGGGGGGGGGGGGGG +AASTENSSSSFSSSSS +VVVVVVVLVVVIIVVL +DDDDDNNNDDDDDDDN +QQQQQQQQQQQQQQQQ +TTSSSEDDSSSSSSSD +DDDDDDDDDDDDDDDD +GGGGGGGQQQEQQQQQ +NNNKSSSSSSSSSSSS +FFFFFFFFFFFFFYFF +LLLLLLLLLLLLLLLL +DDDDDDDDDDDDDDND +DDEDDDDDDDDDDDDD +DDDDEEDDDEDE-GND +QQQQQQQQQQQQ-QQQ +LLEEIIIIIIIM-IVI +EEAAEEKDAGAS-AAD +EEAAAGEEEEEE-DDE +GGGGGGGGGGGG-GGG +WWFFFWWWFFFY-WWW +VVVVVVVVVVVV-VVV +LLLLLLLLLLLL-LLL +TTTTTTTTTTTT-TTT +CCCCCCCCCCCC-CCC +VVVVVVVAAAAV-HAA +AAAAAAAAAAAA-AAA +YYYYYFYYYYYY-YYY +PPPPPPPPPPPP-PPP +QQKKTTTVTTTT-TTV +SSGCSSGSSSSS-SSS +DDDDDDDDDDDD-DDD +VVVVVVVVVVVV-VVV +TTTTVTTTTTTV-VVT +IIIIIIIIIIII-III +EEEEEEEEEEEE-EEE +TTTTTTTTTTTT-TTT +HHHHHHHHHHHH-HHH +KKKKKKKKRKKK-KKK +EEEEEEEEEEEE-EEK +AAEEEEEEEEEE-EDE +EEEEDEEEDDEA-EDE +LLLLLLLLMILI-LLL +VVTTTTTTVVVM-TLT +GGAAAAAA-----G-A +-------------A-- +* diff --git a/examples/testdata/test.html b/examples/testdata/test.html new file mode 100644 index 0000000..229596c --- /dev/null +++ b/examples/testdata/test.html @@ -0,0 +1,29 @@ + + +
+ + + + +
+ + + +
+ + + + +
+ + \ No newline at end of file diff --git a/examples/testdata/test.jvp b/examples/testdata/test.jvp new file mode 100644 index 0000000..f4eecc5 Binary files /dev/null and b/examples/testdata/test.jvp differ diff --git a/examples/testdata/test.msf b/examples/testdata/test.msf new file mode 100644 index 0000000..8a476aa --- /dev/null +++ b/examples/testdata/test.msf @@ -0,0 +1,93 @@ +!!AA_MULTIPLE_ALIGNMENT 1.0 + + MSF: 157 Type: P Check: 4683 .. + + + Name: FER_CAPAA/1-157 Len: 157 Check: 3320 Weight: 1.00 + Name: FER_CAPAN/1-145 Len: 157 Check: 2597 Weight: 1.00 + Name: FER1_SOLLC/1-145 Len: 157 Check: 3815 Weight: 1.00 + Name: Q93XJ9_SOLTU/1-145 Len: 157 Check: 4240 Weight: 1.00 + Name: FER1_PEA/1-150 Len: 157 Check: 9547 Weight: 1.00 + Name: Q7XA98_TRIPR/1-153 Len: 157 Check: 4969 Weight: 1.00 + Name: FER1_MESCR/1-149 Len: 157 Check: 7664 Weight: 1.00 + Name: FER1_SPIOL/1-148 Len: 157 Check: 5892 Weight: 1.00 + Name: FER3_RAPSA/1-157 Len: 157 Check: 8715 Weight: 1.00 + Name: FER1_ARATH/1-150 Len: 157 Check: 3201 Weight: 1.00 + Name: FER_BRANA/1-157 Len: 157 Check: 7649 Weight: 1.00 + Name: FER2_ARATH/1-150 Len: 157 Check: 4904 Weight: 1.00 + Name: Q93Z60_ARATH/1-150 Len: 157 Check: 4436 Weight: 1.00 + Name: FER1_MAIZE/1-150 Len: 157 Check: 4392 Weight: 1.00 + Name: O80429_MAIZE/1-142 Len: 157 Check: 8858 Weight: 1.00 + Name: 1A70|/1-156 Len: 156 Check: 484 Weight: 1.00 + + +// + +FER_CAPAA/1-157 ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ +FER_CAPAN/1-145 MA......SV SATMISTSFM PRKPAVTSL. KPIPNVGE.. ALFGLKS.A. +FER1_SOLLC/1-145 MA......SI SGTMISTSFL PRKPAVTSL. KAISNVGE.. ALFGLKS.G. +Q93XJ9_SOLTU/1-145 MA......SI SGTMISTSFL PRKPVVTSL. KAISNVGE.. ALFGLKS.G. +FER1_PEA/1-150 MATT...PAL YGTAVSTSFL RTQPMPMSV. TTTKAFSN.. GFLGLKT.SL +Q7XA98_TRIPR/1-153 MATT...PAL YGTAVSTSFM RRQPVPMSV. ATTTTTKAFP SGFGLKSVST +FER1_MESCR/1-149 MAAT..TAAL SGATMSTAFA PK..TPPMTA ALPTNVGR.. ALFGLKS.SA +FER1_SPIOL/1-148 MAAT..TTTM MG..MATTFV PKPQAPPMMA ALPSNTGR.. SLFGLKT.GS +FER3_RAPSA/1-157 ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ +FER1_ARATH/1-150 MAST....AL SSAIVGTSFI RRSPAPISLR SLPSANTQ.. SLFGLKS.GT +FER_BRANA/1-157 ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ +FER2_ARATH/1-150 MAST....AL SSAIVSTSFL RRQQTPISLR SLPFANTQ.. SLFGLKS.ST +Q93Z60_ARATH/1-150 MAST....AL SSAIVSTSFL RRQQTPISLR SLPFANTQ.. SLFGLKS.ST +FER1_MAIZE/1-150 MATVLGSPRA PAFFFSSSSL RAAPAPTAV. .ALPAAKV.. GIMGRSA.SS +O80429_MAIZE/1-142 MAAT...... ...ALSMSIL R...APPPCF SSPLRLRV.. AVAKPLA.AP +1A70|/1-156 ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ + +FER_CAPAA/1-157 ~~~~~~~~~A SYKVKLITPD GPIEFDCPDD VYILDQAEEA GHDLPYSCRA +FER_CAPAN/1-145 .NGGKVTCMA SYKVKLITPD GPIEFDCPDN VYILDQAEEA GHDLPYSCRA +FER1_SOLLC/1-145 .RNGRITCMA SYKVKLITPE GPIEFECPDD VYILDQAEEE GHDLPYSCRA +Q93XJ9_SOLTU/1-145 .RNGRITCMA SYKVKLITPD GPIEFECPDD VYILDQAEEE GHDLPYSCRA +FER1_PEA/1-150 KRGDLAVAMA SYKVKLVTPD GTQEFECPSD VYILDHAEEV GIDLPYSCRA +Q7XA98_TRIPR/1-153 KRGDLAVAMA TYKVKLITPE GPQEFDCPDD VYILDHAEEV GIELPYSCRA +FER1_MESCR/1-149 SR.GRVTAMA AYKVTLVTPE GKQELECPDD VYILDAAEEA GIDLPYSCRA +FER1_SPIOL/1-148 R..GGRMTMA AYKVTLVTPT GNVEFQCPDD VYILDAAEEE GIDLPYSCRA +FER3_RAPSA/1-157 ~~~~~~~~~A TYKVKFITPE GEQEVECDDD VYVLDAAEEA GIDLPYSCRA +FER1_ARATH/1-150 ARGGRVTAMA TYKVKFITPE GELEVECDDD VYVLDAAEEA GIDLPYSCRA +FER_BRANA/1-157 ~~~~~~~~~A TYKVKFITPE GEQEVECDDD VYVLDAAEEA GIDLPYSCRA +FER2_ARATH/1-150 ARGGRVTAMA TYKVKFITPE GEQEVECEED VYVLDAAEEA GLDLPYSCRA +Q93Z60_ARATH/1-150 ARGGRVTAMA TYKVKFITPE GEQEVECEED VYVLDAAEEA GLDLPYSCRA +FER1_MAIZE/1-150 RR..RLRAQA TYNVKLITPE GEVELQVPDD VYILDQAEED GIDLPYSCRA +O80429_MAIZE/1-142 MRRQLLRAQA TYNVKLITPE GEVELQVPDD VYILDFAEEE GIDLPFSCRA +1A70|/1-156 ~~~~~~~~~A AYKVTLVTPT GNVEFQCPDD VYILDAAEEE GIDLPYSCRA + +FER_CAPAA/1-157 GSCSSCAGKI AGGAVDQTDG NFLDDDQLEE GWVLTCVAYP QSDVTIETHK +FER_CAPAN/1-145 GSCSSCAGKI AGGAVDQTDG NFLDDDQLEE GWVLTCVAYP QSDVTIETHK +FER1_SOLLC/1-145 GSCSSCAGKV TAGSVDQSDG NFLDEDQEAA GFVLTCVAYP KGDVTIETHK +Q93XJ9_SOLTU/1-145 GSCSSCAGKV TAGTVDQSDG KFLDDDQEAA GFVLTCVAYP KCDVTIETHK +FER1_PEA/1-150 GSCSSCAGKV VGGEVDQSDG SFLDDEQIEA GFVLTCVAYP TSDVVIETHK +Q7XA98_TRIPR/1-153 GSCSSCAGKV VNGNVNQEDG SFLDDEQIEG GWVLTCVAFP TSDVTIETHK +FER1_MESCR/1-149 GSCSSCAGKV TSGSVNQDDG SFLDDDQIKE GWVLTCVAYP TGDVTIETHK +FER1_SPIOL/1-148 GSCSSCAGKL KTGSLNQDDQ SFLDDDQIDE GWVLTCAAYP VSDVTIETHK +FER3_RAPSA/1-157 GSCSSCAGKV VSGSVDQSDQ SFLDDDQIAE GFVLTCAAYP TSDVTIETHR +FER1_ARATH/1-150 GSCSSCAGKV VSGSVDQSDQ SFLDDEQIGE GFVLTCAAYP TSDVTIETHK +FER_BRANA/1-157 GSCSSCAGKV VSGFVDQSDE SFLDDDQIAE GFVLTCAAYP TSDVTIETHK +FER2_ARATH/1-150 GSCSSCAGKV VSGSIDQSDQ SFLDDEQMSE GYVLTCVAYP TSDVVIETHK +Q93Z60_ARATH/1-150 GSCSSCAGKV VSGSIDQSDQ SFLDD~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ +FER1_MAIZE/1-150 GSCSSCAGKV VSGSVDQSDQ SYLDDGQIAD GWVLTCHAYP TSDVVIETHK +O80429_MAIZE/1-142 GSCSSCAGKV VSGSVDQSDQ SFLNDNQVAD GWVLTCAAYP TSDVVIETHK +1A70|/1-156 GSCSSCAGKL KTGSLNQDDQ SFLDDDQIDE GWVLTCAAYP VSDVTIETHK + +FER_CAPAA/1-157 EAELVG~ +FER_CAPAN/1-145 EAELVG~ +FER1_SOLLC/1-145 EEELTA~ +Q93XJ9_SOLTU/1-145 EEELTA~ +FER1_PEA/1-150 EEDLTA~ +Q7XA98_TRIPR/1-153 EEELTA~ +FER1_MESCR/1-149 EEELTA~ +FER1_SPIOL/1-148 EEELTA~ +FER3_RAPSA/1-157 EEDMV~~ +FER1_ARATH/1-150 EEDIV~~ +FER_BRANA/1-157 EEELV~~ +FER2_ARATH/1-150 EEAIM~~ +Q93Z60_ARATH/1-150 ~~~~~~~ +FER1_MAIZE/1-150 EEELTGA +O80429_MAIZE/1-142 EDDLL~~ +1A70|/1-156 KEELTA + diff --git a/examples/testdata/test.pfam b/examples/testdata/test.pfam new file mode 100644 index 0000000..dfaadf7 --- /dev/null +++ b/examples/testdata/test.pfam @@ -0,0 +1,17 @@ +FER_CAPAA/1-97 -----------------------------------------------------------ASYKVKLITPDGPIEFDCPDDVYILDQAEEAGHDLPYSCRAGSCSSCAGKIAGGAVDQTDGNFLDDDQLEEGWVLTCVAYPQSDVTIETHKEAELVG- +FER_CAPAN/1-144 MA------SVSATMISTSFMPRKPAVTSL-KPIPNVGE--ALFGLKS-A--NGGKVTCMASYKVKLITPDGPIEFDCPDNVYILDQAEEAGHDLPYSCRAGSCSSCAGKIAGGAVDQTDGNFLDDDQLEEGWVLTCVAYPQSDVTIETHKEAELVG- +FER1_SOLLC/1-144 MA------SISGTMISTSFLPRKPAVTSL-KAISNVGE--ALFGLKS-G--RNGRITCMASYKVKLITPEGPIEFECPDDVYILDQAEEEGHDLPYSCRAGSCSSCAGKVTAGSVDQSDGNFLDEDQEAAGFVLTCVAYPKGDVTIETHKEEELTA- +Q93XJ9_SOLTU/1-144 MA------SISGTMISTSFLPRKPVVTSL-KAISNVGE--ALFGLKS-G--RNGRITCMASYKVKLITPDGPIEFECPDDVYILDQAEEEGHDLPYSCRAGSCSSCAGKVTAGTVDQSDGKFLDDDQEAAGFVLTCVAYPKCDVTIETHKEEELTA- +FER1_PEA/1-149 MATT---PALYGTAVSTSFLRTQPMPMSV-TTTKAFSN--GFLGLKT-SLKRGDLAVAMASYKVKLVTPDGTQEFECPSDVYILDHAEEVGIDLPYSCRAGSCSSCAGKVVGGEVDQSDGSFLDDEQIEAGFVLTCVAYPTSDVVIETHKEEDLTA- +Q7XA98_TRIPR/1-152 MATT---PALYGTAVSTSFMRRQPVPMSV-ATTTTTKAFPSGFGLKSVSTKRGDLAVAMATYKVKLITPEGPQEFDCPDDVYILDHAEEVGIELPYSCRAGSCSSCAGKVVNGNVNQEDGSFLDDEQIEGGWVLTCVAFPTSDVTIETHKEEELTA- +FER1_MESCR/1-148 MAAT--TAALSGATMSTAFAPK--TPPMTAALPTNVGR--ALFGLKS-SASR-GRVTAMAAYKVTLVTPEGKQELECPDDVYILDAAEEAGIDLPYSCRAGSCSSCAGKVTSGSVNQDDGSFLDDDQIKEGWVLTCVAYPTGDVTIETHKEEELTA- +FER1_SPIOL/1-147 MAAT--TTTMMG--MATTFVPKPQAPPMMAALPSNTGR--SLFGLKT-GSR--GGRMTMAAYKVTLVTPTGNVEFQCPDDVYILDAAEEEGIDLPYSCRAGSCSSCAGKLKTGSLNQDDQSFLDDDQIDEGWVLTCAAYPVSDVTIETHKEEELTA- +FER3_RAPSA/1-96 -----------------------------------------------------------ATYKVKFITPEGEQEVECDDDVYVLDAAEEAGIDLPYSCRAGSCSSCAGKVVSGSVDQSDQSFLDDDQIAEGFVLTCAAYPTSDVTIETHREEDMV-- +FER1_ARATH/1-148 MAST----ALSSAIVGTSFIRRSPAPISLRSLPSANTQ--SLFGLKS-GTARGGRVTAMATYKVKFITPEGELEVECDDDVYVLDAAEEAGIDLPYSCRAGSCSSCAGKVVSGSVDQSDQSFLDDEQIGEGFVLTCAAYPTSDVTIETHKEEDIV-- +FER_BRANA/1-96 -----------------------------------------------------------ATYKVKFITPEGEQEVECDDDVYVLDAAEEAGIDLPYSCRAGSCSSCAGKVVSGFVDQSDESFLDDDQIAEGFVLTCAAYPTSDVTIETHKEEELV-- +FER2_ARATH/1-148 MAST----ALSSAIVSTSFLRRQQTPISLRSLPFANTQ--SLFGLKS-STARGGRVTAMATYKVKFITPEGEQEVECEEDVYVLDAAEEAGLDLPYSCRAGSCSSCAGKVVSGSIDQSDQSFLDDEQMSEGYVLTCVAYPTSDVVIETHKEEAIM-- +Q93Z60_ARATH/1-118 MAST----ALSSAIVSTSFLRRQQTPISLRSLPFANTQ--SLFGLKS-STARGGRVTAMATYKVKFITPEGEQEVECEEDVYVLDAAEEAGLDLPYSCRAGSCSSCAGKVVSGSIDQSDQSFLDD-------------------------------- +FER1_MAIZE/1-150 MATVLGSPRAPAFFFSSSSLRAAPAPTAV--ALPAAKV--GIMGRSA-SSRR--RLRAQATYNVKLITPEGEVELQVPDDVYILDQAEEDGIDLPYSCRAGSCSSCAGKVVSGSVDQSDQSYLDDGQIADGWVLTCHAYPTSDVVIETHKEEELTGA +O80429_MAIZE/1-140 MAAT---------ALSMSILR---APPPCFSSPLRLRV--AVAKPLA-APMRRQLLRAQATYNVKLITPEGEVELQVPDDVYILDFAEEEGIDLPFSCRAGSCSSCAGKVVSGSVDQSDQSFLNDNQVADGWVLTCAAYPTSDVVIETHKEDDLL-- +1A70|/1-97 -----------------------------------------------------------AAYKVTLVTPTGNVEFQCPDDVYILDAAEEEGIDLPYSCRAGSCSSCAGKLKTGSLNQDDQSFLDDDQIDEGWVLTCAAYPVSDVTIETHKKEELTA + diff --git a/examples/testdata/test.pileup b/examples/testdata/test.pileup new file mode 100644 index 0000000..d191e4b --- /dev/null +++ b/examples/testdata/test.pileup @@ -0,0 +1,93 @@ +PileUp + + MSF: 157 Type: P Check: 1935 .. + + + Name: FER_CAPAA/1-97 oo Len: 157 Check: 5701 Weight: 1.00 + Name: FER_CAPAN/1-144 oo Len: 157 Check: 8823 Weight: 1.00 + Name: FER1_SOLLC/1-144 oo Len: 157 Check: 41 Weight: 1.00 + Name: Q93XJ9_SOLTU/1-144 oo Len: 157 Check: 466 Weight: 1.00 + Name: FER1_PEA/1-149 oo Len: 157 Check: 5889 Weight: 1.00 + Name: Q7XA98_TRIPR/1-152 oo Len: 157 Check: 1438 Weight: 1.00 + Name: FER1_MESCR/1-148 oo Len: 157 Check: 3943 Weight: 1.00 + Name: FER1_SPIOL/1-147 oo Len: 157 Check: 2139 Weight: 1.00 + Name: FER3_RAPSA/1-96 oo Len: 157 Check: 7694 Weight: 1.00 + Name: FER1_ARATH/1-148 oo Len: 157 Check: 6163 Weight: 1.00 + Name: FER_BRANA/1-96 oo Len: 157 Check: 6628 Weight: 1.00 + Name: FER2_ARATH/1-148 oo Len: 157 Check: 7866 Weight: 1.00 + Name: Q93Z60_ARATH/1-118 oo Len: 157 Check: 3003 Weight: 1.00 + Name: FER1_MAIZE/1-150 oo Len: 157 Check: 4097 Weight: 1.00 + Name: O80429_MAIZE/1-140 oo Len: 157 Check: 1696 Weight: 1.00 + Name: 1A70|/1-97 oo Len: 156 Check: 6348 Weight: 1.00 + + +// + +FER_CAPAA/1-97 ---------- ---------- ---------- ---------- ---------- +FER_CAPAN/1-144 MA------SV SATMISTSFM PRKPAVTSL- KPIPNVGE-- ALFGLKS-A- +FER1_SOLLC/1-144 MA------SI SGTMISTSFL PRKPAVTSL- KAISNVGE-- ALFGLKS-G- +Q93XJ9_SOLTU/1-144 MA------SI SGTMISTSFL PRKPVVTSL- KAISNVGE-- ALFGLKS-G- +FER1_PEA/1-149 MATT---PAL YGTAVSTSFL RTQPMPMSV- TTTKAFSN-- GFLGLKT-SL +Q7XA98_TRIPR/1-152 MATT---PAL YGTAVSTSFM RRQPVPMSV- ATTTTTKAFP SGFGLKSVST +FER1_MESCR/1-148 MAAT--TAAL SGATMSTAFA PK--TPPMTA ALPTNVGR-- ALFGLKS-SA +FER1_SPIOL/1-147 MAAT--TTTM MG--MATTFV PKPQAPPMMA ALPSNTGR-- SLFGLKT-GS +FER3_RAPSA/1-96 ---------- ---------- ---------- ---------- ---------- +FER1_ARATH/1-148 MAST----AL SSAIVGTSFI RRSPAPISLR SLPSANTQ-- SLFGLKS-GT +FER_BRANA/1-96 ---------- ---------- ---------- ---------- ---------- +FER2_ARATH/1-148 MAST----AL SSAIVSTSFL RRQQTPISLR SLPFANTQ-- SLFGLKS-ST +Q93Z60_ARATH/1-118 MAST----AL SSAIVSTSFL RRQQTPISLR SLPFANTQ-- SLFGLKS-ST +FER1_MAIZE/1-150 MATVLGSPRA PAFFFSSSSL RAAPAPTAV- -ALPAAKV-- GIMGRSA-SS +O80429_MAIZE/1-140 MAAT------ ---ALSMSIL R---APPPCF SSPLRLRV-- AVAKPLA-AP +1A70|/1-97 ---------- ---------- ---------- ---------- ---------- + +FER_CAPAA/1-97 ---------A SYKVKLITPD GPIEFDCPDD VYILDQAEEA GHDLPYSCRA +FER_CAPAN/1-144 -NGGKVTCMA SYKVKLITPD GPIEFDCPDN VYILDQAEEA GHDLPYSCRA +FER1_SOLLC/1-144 -RNGRITCMA SYKVKLITPE GPIEFECPDD VYILDQAEEE GHDLPYSCRA +Q93XJ9_SOLTU/1-144 -RNGRITCMA SYKVKLITPD GPIEFECPDD VYILDQAEEE GHDLPYSCRA +FER1_PEA/1-149 KRGDLAVAMA SYKVKLVTPD GTQEFECPSD VYILDHAEEV GIDLPYSCRA +Q7XA98_TRIPR/1-152 KRGDLAVAMA TYKVKLITPE GPQEFDCPDD VYILDHAEEV GIELPYSCRA +FER1_MESCR/1-148 SR-GRVTAMA AYKVTLVTPE GKQELECPDD VYILDAAEEA GIDLPYSCRA +FER1_SPIOL/1-147 R--GGRMTMA AYKVTLVTPT GNVEFQCPDD VYILDAAEEE GIDLPYSCRA +FER3_RAPSA/1-96 ---------A TYKVKFITPE GEQEVECDDD VYVLDAAEEA GIDLPYSCRA +FER1_ARATH/1-148 ARGGRVTAMA TYKVKFITPE GELEVECDDD VYVLDAAEEA GIDLPYSCRA +FER_BRANA/1-96 ---------A TYKVKFITPE GEQEVECDDD VYVLDAAEEA GIDLPYSCRA +FER2_ARATH/1-148 ARGGRVTAMA TYKVKFITPE GEQEVECEED VYVLDAAEEA GLDLPYSCRA +Q93Z60_ARATH/1-118 ARGGRVTAMA TYKVKFITPE GEQEVECEED VYVLDAAEEA GLDLPYSCRA +FER1_MAIZE/1-150 RR--RLRAQA TYNVKLITPE GEVELQVPDD VYILDQAEED GIDLPYSCRA +O80429_MAIZE/1-140 MRRQLLRAQA TYNVKLITPE GEVELQVPDD VYILDFAEEE GIDLPFSCRA +1A70|/1-97 ---------A AYKVTLVTPT GNVEFQCPDD VYILDAAEEE GIDLPYSCRA + +FER_CAPAA/1-97 GSCSSCAGKI AGGAVDQTDG NFLDDDQLEE GWVLTCVAYP QSDVTIETHK +FER_CAPAN/1-144 GSCSSCAGKI AGGAVDQTDG NFLDDDQLEE GWVLTCVAYP QSDVTIETHK +FER1_SOLLC/1-144 GSCSSCAGKV TAGSVDQSDG NFLDEDQEAA GFVLTCVAYP KGDVTIETHK +Q93XJ9_SOLTU/1-144 GSCSSCAGKV TAGTVDQSDG KFLDDDQEAA GFVLTCVAYP KCDVTIETHK +FER1_PEA/1-149 GSCSSCAGKV VGGEVDQSDG SFLDDEQIEA GFVLTCVAYP TSDVVIETHK +Q7XA98_TRIPR/1-152 GSCSSCAGKV VNGNVNQEDG SFLDDEQIEG GWVLTCVAFP TSDVTIETHK +FER1_MESCR/1-148 GSCSSCAGKV TSGSVNQDDG SFLDDDQIKE GWVLTCVAYP TGDVTIETHK +FER1_SPIOL/1-147 GSCSSCAGKL KTGSLNQDDQ SFLDDDQIDE GWVLTCAAYP VSDVTIETHK +FER3_RAPSA/1-96 GSCSSCAGKV VSGSVDQSDQ SFLDDDQIAE GFVLTCAAYP TSDVTIETHR +FER1_ARATH/1-148 GSCSSCAGKV VSGSVDQSDQ SFLDDEQIGE GFVLTCAAYP TSDVTIETHK +FER_BRANA/1-96 GSCSSCAGKV VSGFVDQSDE SFLDDDQIAE GFVLTCAAYP TSDVTIETHK +FER2_ARATH/1-148 GSCSSCAGKV VSGSIDQSDQ SFLDDEQMSE GYVLTCVAYP TSDVVIETHK +Q93Z60_ARATH/1-118 GSCSSCAGKV VSGSIDQSDQ SFLDD----- ---------- ---------- +FER1_MAIZE/1-150 GSCSSCAGKV VSGSVDQSDQ SYLDDGQIAD GWVLTCHAYP TSDVVIETHK +O80429_MAIZE/1-140 GSCSSCAGKV VSGSVDQSDQ SFLNDNQVAD GWVLTCAAYP TSDVVIETHK +1A70|/1-97 GSCSSCAGKL KTGSLNQDDQ SFLDDDQIDE GWVLTCAAYP VSDVTIETHK + +FER_CAPAA/1-97 EAELVG- +FER_CAPAN/1-144 EAELVG- +FER1_SOLLC/1-144 EEELTA- +Q93XJ9_SOLTU/1-144 EEELTA- +FER1_PEA/1-149 EEDLTA- +Q7XA98_TRIPR/1-152 EEELTA- +FER1_MESCR/1-148 EEELTA- +FER1_SPIOL/1-147 EEELTA- +FER3_RAPSA/1-96 EEDMV-- +FER1_ARATH/1-148 EEDIV-- +FER_BRANA/1-96 EEELV-- +FER2_ARATH/1-148 EEAIM-- +Q93Z60_ARATH/1-118 ------- +FER1_MAIZE/1-150 EEELTGA +O80429_MAIZE/1-140 EDDLL-- +1A70|/1-97 KEELTA + diff --git a/examples/testdata/test.pir b/examples/testdata/test.pir new file mode 100644 index 0000000..689561f --- /dev/null +++ b/examples/testdata/test.pir @@ -0,0 +1,80 @@ +>P1;FER_CAPAA/1-97 +Ferredoxin +-----------------------------------------------------------ASYKVKLITPDGP +IEFDCPDDVYILDQAEEAGHDLPYSCRAGSCSSCAGKIAGGAVDQTDGNFLDDDQLEEGWVLTCVAYPQSDV +TIETHKEAELVG-* +>P1;FER_CAPAN/1-144 +Ferredoxin, chloroplast precursor +MA------SVSATMISTSFMPRKPAVTSL-KPIPNVGE--ALFGLKS-A--NGGKVTCMASYKVKLITPDGP +IEFDCPDNVYILDQAEEAGHDLPYSCRAGSCSSCAGKIAGGAVDQTDGNFLDDDQLEEGWVLTCVAYPQSDV +TIETHKEAELVG-* +>P1;FER1_SOLLC/1-144 +Ferredoxin-1, chloroplast precursor +MA------SISGTMISTSFLPRKPAVTSL-KAISNVGE--ALFGLKS-G--RNGRITCMASYKVKLITPEGP +IEFECPDDVYILDQAEEEGHDLPYSCRAGSCSSCAGKVTAGSVDQSDGNFLDEDQEAAGFVLTCVAYPKGDV +TIETHKEEELTA-* +>P1;Q93XJ9_SOLTU/1-144 +Ferredoxin I precursor +MA------SISGTMISTSFLPRKPVVTSL-KAISNVGE--ALFGLKS-G--RNGRITCMASYKVKLITPDGP +IEFECPDDVYILDQAEEEGHDLPYSCRAGSCSSCAGKVTAGTVDQSDGKFLDDDQEAAGFVLTCVAYPKCDV +TIETHKEEELTA-* +>P1;FER1_PEA/1-149 +Ferredoxin-1, chloroplast precursor +MATT---PALYGTAVSTSFLRTQPMPMSV-TTTKAFSN--GFLGLKT-SLKRGDLAVAMASYKVKLVTPDGT +QEFECPSDVYILDHAEEVGIDLPYSCRAGSCSSCAGKVVGGEVDQSDGSFLDDEQIEAGFVLTCVAYPTSDV +VIETHKEEDLTA-* +>P1;Q7XA98_TRIPR/1-152 +Ferredoxin I +MATT---PALYGTAVSTSFMRRQPVPMSV-ATTTTTKAFPSGFGLKSVSTKRGDLAVAMATYKVKLITPEGP +QEFDCPDDVYILDHAEEVGIELPYSCRAGSCSSCAGKVVNGNVNQEDGSFLDDEQIEGGWVLTCVAFPTSDV +TIETHKEEELTA-* +>P1;FER1_MESCR/1-148 +Ferredoxin-1, chloroplast precursor +MAAT--TAALSGATMSTAFAPK--TPPMTAALPTNVGR--ALFGLKS-SASR-GRVTAMAAYKVTLVTPEGK +QELECPDDVYILDAAEEAGIDLPYSCRAGSCSSCAGKVTSGSVNQDDGSFLDDDQIKEGWVLTCVAYPTGDV +TIETHKEEELTA-* +>P1;FER1_SPIOL/1-147 +Ferredoxin-1, chloroplast precursor +MAAT--TTTMMG--MATTFVPKPQAPPMMAALPSNTGR--SLFGLKT-GSR--GGRMTMAAYKVTLVTPTGN +VEFQCPDDVYILDAAEEEGIDLPYSCRAGSCSSCAGKLKTGSLNQDDQSFLDDDQIDEGWVLTCAAYPVSDV +TIETHKEEELTA-* +>P1;FER3_RAPSA/1-96 +Ferredoxin, leaf L-A +-----------------------------------------------------------ATYKVKFITPEGE +QEVECDDDVYVLDAAEEAGIDLPYSCRAGSCSSCAGKVVSGSVDQSDQSFLDDDQIAEGFVLTCAAYPTSDV +TIETHREEDMV--* +>P1;FER1_ARATH/1-148 +Ferredoxin-1, chloroplast precursor +MAST----ALSSAIVGTSFIRRSPAPISLRSLPSANTQ--SLFGLKS-GTARGGRVTAMATYKVKFITPEGE +LEVECDDDVYVLDAAEEAGIDLPYSCRAGSCSSCAGKVVSGSVDQSDQSFLDDEQIGEGFVLTCAAYPTSDV +TIETHKEEDIV--* +>P1;FER_BRANA/1-96 +Ferredoxin +-----------------------------------------------------------ATYKVKFITPEGE +QEVECDDDVYVLDAAEEAGIDLPYSCRAGSCSSCAGKVVSGFVDQSDESFLDDDQIAEGFVLTCAAYPTSDV +TIETHKEEELV--* +>P1;FER2_ARATH/1-148 +Ferredoxin-2, chloroplast precursor +MAST----ALSSAIVSTSFLRRQQTPISLRSLPFANTQ--SLFGLKS-STARGGRVTAMATYKVKFITPEGE +QEVECEEDVYVLDAAEEAGLDLPYSCRAGSCSSCAGKVVSGSIDQSDQSFLDDEQMSEGYVLTCVAYPTSDV +VIETHKEEAIM--* +>P1;Q93Z60_ARATH/1-118 +At1g10960/T19D16_12 +MAST----ALSSAIVSTSFLRRQQTPISLRSLPFANTQ--SLFGLKS-STARGGRVTAMATYKVKFITPEGE +QEVECEEDVYVLDAAEEAGLDLPYSCRAGSCSSCAGKVVSGSIDQSDQSFLDD------------------- +-------------* +>P1;FER1_MAIZE/1-150 +Ferredoxin-1, chloroplast precursor +MATVLGSPRAPAFFFSSSSLRAAPAPTAV--ALPAAKV--GIMGRSA-SSRR--RLRAQATYNVKLITPEGE +VELQVPDDVYILDQAEEDGIDLPYSCRAGSCSSCAGKVVSGSVDQSDQSYLDDGQIADGWVLTCHAYPTSDV +VIETHKEEELTGA* +>P1;O80429_MAIZE/1-140 +Ferredoxin +MAAT---------ALSMSILR---APPPCFSSPLRLRV--AVAKPLA-APMRRQLLRAQATYNVKLITPEGE +VELQVPDDVYILDFAEEEGIDLPFSCRAGSCSSCAGKVVSGSVDQSDQSFLNDNQVADGWVLTCAAYPTSDV +VIETHKEDDLL--* +>P1;1A70|/1-97 +1A70| 97 residues +-----------------------------------------------------------AAYKVTLVTPTGN +VEFQCPDDVYILDAAEEEGIDLPYSCRAGSCSSCAGKLKTGSLNQDDQSFLDDDQIDEGWVLTCAAYPVSDV +TIETHKKEELTA* diff --git a/examples/testdata/test.rnaml b/examples/testdata/test.rnaml new file mode 100644 index 0000000..0c716f9 --- /dev/null +++ b/examples/testdata/test.rnaml @@ -0,0 +1,2200 @@ + + + + + + + + + + 1 + 89 + + + + 1 2 3 4 5 6 7 8 9 10 + 11 12 13 14 15 16 17 18 19 20 + 21 22 23 24 25 26 27 28 29 30 + 31 32 33 34 35 36 37 38 39 40 + 41 42 43 44 45 46 47 48 49 50 + 51 52 53 54 55 56 57 58 59 60 + 61 62 63 64 65 66 67 68 69 70 + 71 72 73 74 75 76 77 78 79 80 + 81 82 83 84 85 86 87 88 89 + + + GGAGAGUAGA UGAUUCGCGU UAAGCGUGUG UGAAUGGGAU GUCGUCACAC AACGAAGCGA + GAGCGCGGUG AAUCAUUGCA UCCGCUCCA + + + + LOOP1 + 60 + 61 + + + + + + + Crystallography ? + ? Angstroms + + + 1 + G + + P + 39.406 -40.727 -8.772 + + + O3' + 35.728 -40.286 -12.682 + + + + 2 + G + + P + 34.946 -38.900 -12.475 + + + O3' + 30.080 -38.122 -13.566 + + + + 3 + A + + P + 29.830 -36.592 -13.144 + + + O3' + 25.299 -34.832 -11.157 + + + + 4 + G + + P + 25.525 -33.291 -10.748 + + + O3' + 22.725 -31.357 -6.447 + + + + 5 + A + + P + 23.004 -29.821 -6.080 + + + O3' + 21.811 -28.069 -1.298 + + + + 6 + G + + P + 21.792 -26.530 -1.767 + + + O3' + 24.489 -23.234 1.411 + + + + 7 + U + + P + 24.494 -21.833 0.618 + + + O3' + 26.796 -17.886 2.729 + + + + 8 + A + + P + 25.940 -16.593 2.288 + + + O3' + 27.995 -11.947 1.918 + + + + 9 + G + + P + 26.631 -11.127 1.714 + + + O3' + 25.187 -8.816 -3.450 + + + + 10 + A + + P + 23.765 -8.232 -3.892 + + + O3' + 22.114 -8.019 -8.607 + + + + 11 + U + + P + 20.793 -7.127 -8.411 + + + O3' + 16.589 -7.608 -11.167 + + + + 12 + G + + P + 15.563 -6.541 -10.537 + + + O3' + 10.446 -7.534 -10.495 + + + + 13 + A + + P + 9.719 -6.369 -9.662 + + + O3' + 5.301 -7.413 -7.169 + + + + 14 + U + + P + 4.913 -6.043 -6.428 + + + O3' + 2.471 -6.216 -1.841 + + + + 15 + U + + P + 2.306 -4.695 -1.355 + + + O3' + 2.523 -3.519 3.678 + + + + 16 + C + + P + 2.410 -1.916 3.716 + + + O3' + 4.861 0.478 7.750 + + + + 17 + G + + P + 5.097 2.068 7.705 + + + O3' + 9.837 5.342 8.056 + + + + 18 + C + + P + 9.957 6.906 7.713 + + + O3' + 14.285 9.278 6.633 + + + + 19 + G + + P + 13.701 10.760 6.394 + + + O3' + 16.027 13.756 2.831 + + + + 20 + U + + P + 15.167 15.091 3.070 + + + O3' + 13.625 17.842 -0.910 + + + + 21 + U + + P + 12.758 18.952 -0.136 + + + O3' + 18.055 19.867 1.942 + + + + 22 + A + + P + 19.169 19.634 0.806 + + + O3' + 21.578 14.723 -0.062 + + + + 23 + A + + P + 23.185 14.817 -0.069 + + + O3' + 24.197 10.234 2.787 + + + + 24 + G + + P + 25.187 9.332 1.904 + + + O3' + 23.533 4.428 0.543 + + + + 25 + C + + P + 24.698 3.762 -0.344 + + + O3' + 23.832 1.164 -4.830 + + + + 26 + G + + P + 25.358 0.687 -5.012 + + + O3' + 27.639 1.163 -9.624 + + + + 27 + U + + P + 29.215 0.976 -9.386 + + + O3' + 32.967 2.977 -11.808 + + + + 28 + G + + P + 34.192 2.205 -11.110 + + + O3' + 38.926 3.986 -11.102 + + + + 29 + U + + P + 39.673 2.760 -10.388 + + + O3' + 43.897 3.593 -7.402 + + + + 30 + G + + P + 44.247 2.191 -6.693 + + + O3' + 46.005 2.102 -1.916 + + + + 31 + U + + P + 46.082 0.594 -1.358 + + + O3' + 46.014 -0.378 3.660 + + + + 32 + G + + P + 46.093 -1.940 4.026 + + + O3' + 42.541 -5.286 7.182 + + + + 33 + A + + P + 42.384 -6.877 7.063 + + + O3' + 38.307 -9.190 8.881 + + + + 34 + A + + P + 38.548 -10.772 8.689 + + + O3' + 34.569 -13.953 8.211 + + + + 35 + U + + P + 34.833 -15.458 7.714 + + + O3' + 32.606 -18.340 3.220 + + + + 36 + G + + P + 33.272 -19.727 3.692 + + + O3' + 29.146 -23.892 4.012 + + + + 37 + G + + P + 29.023 -23.774 5.611 + + + O3' + 32.904 -25.203 8.677 + + + + 38 + G + + P + 34.031 -24.091 8.410 + + + O3' + 38.938 -24.200 8.769 + + + + 39 + A + + P + 39.341 -22.721 8.285 + + + O3' + 43.751 -21.471 6.096 + + + + 40 + U + + P + 43.479 -19.903 5.856 + + + O3' + 45.395 -17.759 1.488 + + + + 41 + G + + P + 44.930 -16.222 1.586 + + + O3' + 43.506 -13.581 -2.651 + + + + 42 + U + + P + 42.831 -12.121 -2.591 + + + O3' + 41.294 -10.286 -7.932 + + + + 43 + C + + P + 42.354 -9.284 -8.602 + + + O3' + 37.101 -8.296 -10.514 + + + + 44 + G + + P + 36.225 -7.381 -9.523 + + + O3' + 31.469 -8.612 -8.166 + + + + 45 + U + + P + 31.072 -7.255 -7.406 + + + O3' + 28.607 -6.549 -3.172 + + + + 46 + C + + P + 28.715 -4.958 -2.980 + + + O3' + 28.390 -3.209 1.978 + + + + 47 + A + + P + 28.521 -1.606 2.045 + + + O3' + 30.414 1.118 5.980 + + + + 48 + C + + P + 30.264 2.613 5.413 + + + O3' + 33.914 6.098 6.836 + + + + 49 + A + + P + 33.658 7.488 6.071 + + + O3' + 37.349 10.868 4.871 + + + + 50 + C + + P + 36.440 12.000 4.175 + + + O3' + 38.419 14.513 0.075 + + + + 51 + A + + P + 37.256 15.394 -0.597 + + + O3' + 37.356 16.350 -5.434 + + + + 52 + A + + P + 36.109 17.208 -5.963 + + + O3' + 32.771 16.782 -10.663 + + + + 53 + C + + P + 31.552 17.777 -10.378 + + + O3' + 27.305 16.113 -12.908 + + + + 54 + G + + P + 26.189 17.220 -12.567 + + + O3' + 21.401 15.463 -11.735 + + + + 55 + A + + P + 20.593 16.847 -11.641 + + + O3' + 14.995 15.270 -10.886 + + + + 56 + A + + P + 14.099 15.609 -12.176 + + + O3' + 11.604 16.216 -7.225 + + + + 57 + G + + P + 12.080 17.523 -6.429 + + + O3' + 7.183 20.279 -7.550 + + + + 58 + C + + P + 5.983 21.146 -6.947 + + + O3' + 0.457 20.033 -6.497 + + + + 59 + G + + P + -0.544 20.976 -5.664 + + + O3' + -5.064 19.435 -4.069 + + + + 60 + A + + P + -5.376 20.880 -3.446 + + + O3' + -4.674 20.226 1.852 + + + + 61 + G + + P + -3.473 19.173 1.806 + + + O3' + -4.399 14.900 5.084 + + + + 62 + A + + P + -3.268 13.764 4.956 + + + O3' + -4.326 8.891 5.778 + + + + 63 + G + + P + -2.954 8.206 5.320 + + + O3' + -2.345 6.516 -0.228 + + + + 64 + C + + P + -1.075 5.830 -0.928 + + + O3' + -0.362 6.130 -5.741 + + + + 65 + G + + P + 0.975 5.389 -6.226 + + + O3' + 5.254 7.641 -9.385 + + + + 66 + C + + P + 6.414 6.540 -9.525 + + + O3' + 11.228 8.547 -10.401 + + + + 67 + G + + P + 12.262 7.325 -10.276 + + + O3' + 17.393 8.076 -7.688 + + + + 68 + G + + P + 18.588 8.450 -8.699 + + + O3' + 17.674 3.102 -7.969 + + + + 69 + U + + P + 17.676 1.931 -6.877 + + + O3' + 19.344 2.058 -2.233 + + + + 70 + G + + P + 19.325 0.478 -1.917 + + + O3' + 20.086 -1.464 2.724 + + + + 71 + A + + P + 20.065 -3.053 2.482 + + + O3' + 18.093 -6.084 6.331 + + + + 72 + A + + P + 18.058 -7.629 5.887 + + + O3' + 14.491 -10.888 7.635 + + + + 73 + U + + P + 14.861 -12.252 6.871 + + + O3' + 11.261 -15.468 5.182 + + + + 74 + C + + P + 12.050 -16.617 4.382 + + + O3' + 9.736 -18.950 0.360 + + + + 75 + A + + P + 10.800 -19.899 -0.381 + + + O3' + 10.831 -20.869 -5.373 + + + + 76 + U + + P + 12.149 -21.782 -5.481 + + + O3' + 15.150 -21.466 -9.686 + + + + 77 + U + + P + 16.383 -22.407 -9.255 + + + O3' + 21.158 -21.098 -10.643 + + + + 78 + G + + P + 22.003 -22.328 -10.053 + + + O3' + 26.870 -21.574 -8.157 + + + + 79 + C + + P + 27.394 -22.916 -7.439 + + + O3' + 32.738 -22.221 -7.672 + + + + 80 + A + + P + 33.094 -23.432 -8.669 + + + O3' + 37.970 -23.709 -10.290 + + + + 81 + U + + P + 38.180 -25.262 -9.938 + + + O3' + 42.343 -27.512 -8.310 + + + + 82 + C + + P + 41.594 -28.924 -8.148 + + + O3' + 42.976 -31.766 -3.839 + + + + 83 + C + + P + 41.983 -33.022 -3.698 + + + O3' + 40.724 -35.051 0.999 + + + + 84 + G + + P + 39.499 -36.072 0.803 + + + O3' + 35.976 -36.466 4.801 + + + + 85 + C + + P + 34.990 -37.680 4.429 + + + O3' + 30.031 -37.549 5.509 + + + + 86 + U + + P + 29.628 -39.018 5.001 + + + O3' + 25.142 -40.312 3.037 + + + + 87 + C + + P + 25.378 -41.854 2.656 + + + O3' + 22.860 -43.926 -1.490 + + + + 88 + C + + P + 23.430 -45.414 -1.686 + + + O3' + 24.098 -47.533 -6.370 + + + + 89 + A + + P + 24.738 -48.976 -6.070 + + + O3' + 28.245 -51.062 -9.390 + + + + + 22 + syn + + + 68 + syn + + + + 1 + + + 88 + + + + + + c + + + + 2 + + + 87 + + + + + + c + + + + 3 + + + 86 + + - + - + c + + + + 4 + + + 85 + + + + + + c + + + + 5 + + + 84 + + W + W + c + + + + 6 + + + 37 + + S + H + c + + + + 8 + + + 44 + + S + S + t + + + + 8 + + + 78 + + H + S + t + + + + 9 + + + 77 + + W + W + c + + + + 10 + + + 76 + + - + - + c + + + + 11 + + + 75 + + - + - + c + + + + 12 + + + 74 + + + + + + c + + + + 13 + + + 73 + + - + - + c + + + + 14 + + + 72 + + - + - + c + + + + 15 + + + 71 + + - + - + c + + + + 16 + + + 70 + + + + + + c + + + + 17 + + + 69 + + W + W + c + + + + 18 + + + 67 + + + + + + c + + + + 19 + + + 22 + + S + S + c + + + + 19 + + + 66 + + + + + + c + + + + 20 + + + 65 + + W + W + c + + + + 23 + + + 55 + + H + W + t + + + + 23 + + + 67 + + W + S + t + + + + 24 + + + 54 + + H + S + t + + + + 26 + + + 52 + + W + W + c + + + + 27 + + + 51 + + - + - + c + + + + 28 + + + 50 + + + + + + c + + + + 29 + + + 49 + + - + - + c + + + + 30 + + + 48 + + + + + + c + + + + 31 + + + 47 + + - + - + c + + + + 32 + + + 46 + + + + + + c + + + + 33 + + + 45 + + - + - + c + + + + 34 + + + 44 + + W + W + c + + + + 35 + + + 42 + + W + H + t + + + + 37 + + + 83 + + + + + + c + + + + 38 + + + 82 + + + + + + c + + + + 39 + + + 81 + + - + - + c + + + + 40 + + + 80 + + - + - + c + + + + 41 + + + 79 + + W + W + c + + + + 56 + + + 65 + + S + S + t + + + + 57 + + + 64 + + + + + + c + + + + 58 + + + 63 + + + + + + c + + + + 59 + + + 62 + + W + H + t + + + + 7 + + + 35 + + ! + ! + ! + + + + 8 + + + 35 + + ! + ! + ! + + + + 23 + + + 54 + + ! + ! + ! + + + + 24 + + + 69 + + ! + ! + ! + + + + 35 + + + 79 + + ! + ! + ! + + + + 43 + + + 44 + + ! + ! + ! + + + + 54 + + + 55 + + ! + ! + ! + + + + 56 + + + 57 + + ! + ! + ! + + + + 68 + + + 69 + + ! + ! + ! + + + + 1 + + + 88 + + 5 + + + + 37 + + + 83 + + 5 + + + + 26 + + + 52 + + 9 + + + + 23 + + + 55 + + 2 + + + + 57 + + + 64 + + 3 + + + + 19 + + + 66 + + 2 + + + + 8 + + + 78 + + 10 + + + + SG1 + 6 + 7 + + + + + SG2 + 18 + 18 + + + + + SG3 + 21 + 22 + + + + + SG4 + 25 + 25 + + + + + SG5 + 35 + 36 + + + + + SG6 + 42 + 43 + + + + + SG7 + 53 + 53 + + + + + SG8 + 56 + 56 + + + + + SG9 + 60 + 61 + + + + + SG10 + 67 + 68 + + + + + SG11 + 89 + 89 + + + + + + 1 + 264.792 11.342 + + + 2 + 264.792 30.246 + + + 3 + 264.792 49.149 + + + 4 + 264.792 68.053 + + + 5 + 264.792 86.957 + + + 6 + 276.134 86.957 + + + 7 + 287.476 86.957 + + + 8 + 148.757 221.618 + + + 9 + 143.395 239.745 + + + 10 + 138.033 257.872 + + + 11 + 132.670 275.999 + + + 12 + 127.308 294.126 + + + 13 + 121.946 312.254 + + + 14 + 116.584 330.381 + + + 15 + 111.221 348.508 + + + 16 + 105.859 366.635 + + + 17 + 100.497 384.762 + + + 18 + 53.294 416.207 + + + 19 + 48.034 426.256 + + + 20 + 39.267 443.003 + + + 21 + 219.423 487.713 + + + 22 + 219.423 476.370 + + + 23 + 219.423 465.028 + + + 24 + 219.423 446.125 + + + 25 + 219.423 427.221 + + + 26 + 219.423 389.414 + + + 27 + 219.423 370.510 + + + 28 + 219.423 351.607 + + + 29 + 219.423 332.703 + + + 30 + 219.423 313.800 + + + 31 + 219.423 294.896 + + + 32 + 219.423 275.992 + + + 33 + 219.423 257.089 + + + 34 + 219.423 238.185 + + + 35 + 287.476 124.764 + + + 36 + 276.134 124.764 + + + 37 + 264.792 124.764 + + + 38 + 264.792 143.667 + + + 39 + 264.792 162.571 + + + 40 + 264.792 181.474 + + + 41 + 264.792 200.378 + + + 42 + 276.134 200.378 + + + 43 + 287.476 200.378 + + + 44 + 264.792 238.185 + + + 45 + 264.792 257.089 + + + 46 + 264.792 275.992 + + + 47 + 264.792 294.896 + + + 48 + 264.792 313.800 + + + 49 + 264.792 332.703 + + + 50 + 264.792 351.607 + + + 51 + 264.792 370.510 + + + 52 + 264.792 389.414 + + + 53 + 264.792 408.318 + + + 54 + 264.792 446.125 + + + 55 + 264.792 465.028 + + + 56 + 264.792 476.370 + + + 57 + 21.732 476.499 + + + 58 + 12.965 493.246 + + + 59 + 4.198 509.994 + + + 60 + 0.000 537.223 + + + 61 + 24.408 550.000 + + + 62 + 44.392 531.035 + + + 63 + 53.159 514.288 + + + 64 + 61.927 497.540 + + + 65 + 79.461 464.045 + + + 66 + 88.228 447.297 + + + 67 + 93.488 437.249 + + + 68 + 98.749 427.200 + + + 69 + 56.992 371.893 + + + 70 + 62.354 353.766 + + + 71 + 67.716 335.638 + + + 72 + 73.079 317.511 + + + 73 + 78.441 299.384 + + + 74 + 83.803 281.257 + + + 75 + 89.165 263.130 + + + 76 + 94.527 245.003 + + + 77 + 99.890 226.876 + + + 78 + 105.252 208.749 + + + 79 + 219.423 200.378 + + + 80 + 219.423 181.474 + + + 81 + 219.423 162.571 + + + 82 + 219.423 143.667 + + + 83 + 219.423 124.764 + + + 84 + 219.423 86.957 + + + 85 + 219.423 68.053 + + + 86 + 219.423 49.149 + + + 87 + 219.423 30.246 + + + 88 + 219.423 11.342 + + + 89 + 219.423 0.000 + + + + + + + + + + + + \ No newline at end of file diff --git a/examples/testdata/uniref50_test_tree b/examples/testdata/uniref50_test_tree new file mode 100644 index 0000000..585b68b --- /dev/null +++ b/examples/testdata/uniref50_test_tree @@ -0,0 +1 @@ +(((FER_BRANA:112.15387,FER3_RAPSA:110.84613):46.4375,FER_CAPAA:144.0625):177.2998,(O80429_MAIZE:184.40039,(FER1_MAIZE:195.79102,(((FER1_SPIOL:111.687515,FER1_MESCR:84.312485):51.929688,((Q93Z60_ARATH:398.14285,(FER2_ARATH:53.65625,FER1_ARATH:48.34375):0.0):86.725006,(Q7XA98_TRIPR:78.65277,FER1_PEA:68.34723):63.774994):7.7578125):0.58332825,((Q93XJ9_SOLTU:23.647736,FER1_SOLLC:20.352264):31.71875,FER_CAPAN:52.28125):101.7448):41.498047):37.208984):177.2998); diff --git a/help/html/calculations/columnFilterByAnnotation.html b/help/html/calculations/columnFilterByAnnotation.html index c5f42df..1ece1cc 100644 --- a/help/html/calculations/columnFilterByAnnotation.html +++ b/help/html/calculations/columnFilterByAnnotation.html @@ -20,42 +20,39 @@ * The Jalview Authors are detailed in the 'AUTHORS' file. --> -Filter Columns by Annotation +Select/Hide Columns by Annotation

- Filter Columns by Annotation + Select/Hide Columns by Annotation

-

Jalview allows the columns of an alignment to be filtered using - any annotation rows added to that alignment.

- From "Select" menu - "Select by Annotation..." to bring - up the Select by Annotation window. The filter options vary depending +

From Jalview 2.9 columns of an alignment can be filtered using + any annotation row added to that alignment.

+ To carry out this operation, navigate to "SelectSelect/Hide Columns by Annotation..." to bring + up the 'Select/Hide by Annotation' window. The filter options vary depending on the type of annotation selected. If an annotation that has a numeric values is selected, the threshold filter option is activated as seen in the - figure on the right below. + figure on the right below, otherwise the dialog will exclude the threshold filter option as seen in the figure on the left.
-
+
+
+ + + + +
-
- -
-
- -
-
 
    -
  • Select which annotation to base the filtering on using the - top-most selection box.
  • +
  • The target annotation row can be selected using the drop-down option menu in the top-most part of the window.
  • Search Filter
      -
    • When a text is entered in the textfield on the search - filter section, the "Display Label" and "Description" - checkboxes becomes selectable.
    • -
    • On selecting any of the checkboxes, a regular expresion +
    • When a text is entered in the text box within the Search + Filter section, the 'Display Label' and 'Description' + options becomes enabled for selection.
    • +
    • On selecting any of the options, a regular expression search (RegEx) is executed on the specified field of the current annotation row selected, and the matching columns will be highlighted in the alignment.
    • @@ -63,7 +60,7 @@
    • Structure Filter
      • Alignment columns can also be filtered by the type of - secondary structure present in a choosen annotation row.
      • + secondary structure present in a target annotation row.
      • This can be achieved by ticking the type of structure you wish to filter by under the structures filter section.
      @@ -71,7 +68,7 @@
      • This filter is only activated for annotation which contain numeric values
      • -
      • Select whether to Filter the alignment above or below an +
      • Select whether to filter the alignment above or below an adjustable threshold with the selection box within the threshold filter section.
      • Change the threshold value with the slider, or enter the @@ -79,15 +76,15 @@
    • Actions
        -
      • The "Select" and "Hide" radio buttons +
      • The 'Select' and 'Hide' radio buttons determines the action that will be carried out on the matching columns in the alignment during the filtering process.
      • -
      • The default option is "Select" and this simply +
      • The default option is 'Select' and this simply enables column selection on the matching alignment column.
      • -
      • While the "Hide" option enables the matching columns to +
      • While the 'Hide' option enables the matching columns to be hidden automatically during the filtering process.
      • -
      • The "Ok" button applies the filter when clicked.
      • -
      • And finally, The "Cancel" button restores the alignment to its previous state before the filtering when clicked. +
      • The 'Ok' button applies the filter when clicked.
      • +
      • And finally, the 'Cancel' button restores the alignment to its previous state before any filtering was applied.
    diff --git a/help/html/features/bioJsonFormat.html b/help/html/features/bioJsonFormat.html new file mode 100644 index 0000000..a91955b --- /dev/null +++ b/help/html/features/bioJsonFormat.html @@ -0,0 +1,52 @@ + + + +BioJSON-1.0 + + +

    BioJSON

    + BioJSON is a standardise JavaScript Object Notation (JSON) format for exchange of Bio-informatics Sequence Alignment data. + BioJSON-1.0 schema/documentation is available at http://www.jalview.org/builds/develop/examples/biojson-doc/. + You can keep up to date with BioJSON development and latest news at https://github.com/jalview/biojson/wiki. + +

    Features supported

    + Export/Import of the following alignment elements are supported in BioJSON-1.0: +
      +
    • Alignment Annotations
    • +
    • Alignment Features
    • +
    • Alignment Sequences
    • +
    • Color Scheme
    • +
    • Hidden Columns
    • +
    • Hidden Sequences
    • +
    • Sequence Groups
    • +
    + +

    Features not yet supported

    + Export/Import of the following alignment elements are not supported in BioJSON-1.0: +
      +
    • Reference sequence
    • +
    • Representative sequence
    • +
    • Trees
    • +
    • 3D Structures
    • +
    + + diff --git a/help/html/features/clarguments.html b/help/html/features/clarguments.html index 8a72d4d..16b0dc0 100644 --- a/help/html/features/clarguments.html +++ b/help/html/features/clarguments.html @@ -182,6 +182,10 @@
    -blc FILE
    Create alignment file FILE in BLC format.
    + +
    -json FILE
    +
    Create alignment file FILE in JSON format.
    +
    -jalview FILE
    diff --git a/help/html/features/pdbsequencefetcher.html b/help/html/features/pdbsequencefetcher.html index 15dc2c6..ce7d96e 100644 --- a/help/html/features/pdbsequencefetcher.html +++ b/help/html/features/pdbsequencefetcher.html @@ -25,32 +25,31 @@ PDB Sequence Fetcher -

    From Jalview 2.x.x a speciliased interface was introduced for +

    From Jalview 2.9, a specialised interface was introduced for fast and efficient discovery/retrieval of sequence data from the PDB database. The introduced interface enables live querying of PDB data on-the-fly thereby eliminating the need to memorise database accession - or to cross-reference other bioinformatics websites before retrieving - a sequence data in jalview. The underlying technology is provided by + or to manually cross-reference other bioinformatics websites before retrieving + sequence data in Jalview. The underlying infrastructure is provided by EBI and is based on Apache Solr which is a text based search engine.

    - The PDB Sequence Fetcher interface can be opened by selecting PDB - as the choice database from the 'Select Database - Retrieval Source' interface of Sequence - Fetcher. + The PDB Sequence Fetcher interface can be accessed from "File →Fetch Sequence(s) →Select Database →PDB" click the ok button after selecting PDB from the 'Select Database + Retrieval Source' interface.

    PDB sequence fetcher (introduced in Jalview 2.x.x) + alt="PDB sequence fetcher (introduced in Jalview 2.9)">

    - Searching the PDB Database -
    Once the interface is opened, typing in the search text box - will execute a live query to the PDB database and display the results - on-the-fly as seen in the screen-shot above. Use the drop-down menu to - select a specific field to search by in the PDB database, the default - option is - 'ALL'. Furthermore, the PDB search interface also - provides the following functionalities: +

    Searching the PDB Database

    +

    When the interface is opened, a live query to the PDB database is + executed every time a character is typed into the search text box, and + a result is displayed on-the-fly as seen in the screenshot above.

    + +

    Use the drop-down menu to select a specific field to search by in the PDB database, the default + option is 'ALL'.

    + +

    Furthermore, the PDB search interface also provides the following functionalities:

    • Retrieving a unique chain for a PDB entry:
      To retrieve a specific chain for a PDB entry, append the PDB ID with a @@ -75,18 +74,18 @@

    Customising displayed meta-data
    To change - the displayed meta-data in the search result, click the 'Configure - Displayed Columns' tab, then tick off the options wanted. + the displayed meta-data in the search result, click the 'Configure + Displayed Columns' tab, then tick off the options wanted.

    Importing Sequence
    After querying the PDB database, to import the found data into Jalview, select the entries - you wish to import then click the ok button at the bottom of the + you wish to import then click the 'Ok' button at the bottom of the interface.

    The PDB Sequence Fetcher interface was introduced in Jalview - 2.x.x. + 2.9

    \ No newline at end of file diff --git a/help/html/features/seqfetch.html b/help/html/features/seqfetch.html index 68c5520..2516f3f 100755 --- a/help/html/features/seqfetch.html +++ b/help/html/features/seqfetch.html @@ -49,7 +49,7 @@ WSDBFetch service provided by the European Bioinformatics Institute, or, since J one or more accession ids (as a semi-colon separated list), or press the "Example" button to paste the example accession for the currently selected database into the retrieval box. Finally, press "OK" to initiate the retrieval.

    -

    Since Jalview 2.x.x if PDB is selected as the sequence database, a specialised interface - PDB Sequence Fetcher is used for discovering and retrieving the sequenec data.

    +

    Since Jalview 2.9 if PDB is selected as the sequence database, a specialised interface - PDB Sequence Fetcher is used for discovering and retrieving the sequenec data.

    Specifying chains for PDB IDs If you are retrieving sequences from the PDB, you can retrieve specific chains by appending a colon and the chain id to the PDB diff --git a/help/html/features/structurechooser.html b/help/html/features/structurechooser.html index 7dd69c1..1bf9f32 100644 --- a/help/html/features/structurechooser.html +++ b/help/html/features/structurechooser.html @@ -55,22 +55,22 @@ Associating PDB files with Sequences
    - Discovery/Association of PDB entries to a sequence happens + Discovery/Association of PDB entries to a sequence now happens automatically during the initialisation of the Structure Chooser - Interface. Jalview uses the sequence's ID to query the PDB Rest API, + Interface. Jalview uses the sequence's ID to query the PDB Rest API provided by the EBI to discover PDB Ids associated with the sequence.

    Configuring displayed meta-data for Structures
    - To configure the visible meta-data displayed for the discovered structures, click the 'Configure Displayed Columns' tab, then tick the options which you intend to make visible. + To configure the visible meta-data displayed for the discovered structures, click the 'Configure Displayed Columns' tab, then tick the options which you intend to make visible.

    Auto-selection of best Structures
    Jalview can automatically filter and select the best structures using various metric categories avaialble from the meta-data of the structures. To perform this simply select any of the following options from the drop-down menu in the Structure Chooser interface: Best Uniprot coverage, Higest Resolution, - - Best Quality, Highest Protein Chain etc. When the 'Invert' option is selected, Jalview returns an inverse result for the current selected option in the drop-down menu.

    + Best Quality, Highest Protein Chain etc. When the 'Invert' option is selected, Jalview returns an inverse result for the current selected option in the drop-down menu.

    + - - - - + + + + + @@ -30,28 +30,22 @@ - - + + - + - - - - - + + + + additional @@ -110,9 +104,8 @@ - + Flag @@ -141,9 +134,8 @@ - + Flag @@ -174,9 +166,8 @@ - + Flag @@ -207,8 +198,17 @@ use="optional"> - An identifier for the viewer type, currently either - JMOL or CHIMERA + An + identifier + for + the + viewer + type, + currently + either + JMOL + or + CHIMERA @@ -222,24 +222,82 @@ - + + + + Reference to a viewer showing RNA structure + for this sequence. Schema supports one viewer showing multiple + annotations for multiple sequences, though currently only one + annotation for one sequence (gapped or trimmed) is used + + + + + + + + + + id attribute of Annotation in + vamsasModel for + the secondary structure annotation shown + in the viewer + + + + + + if true the RNA structure is shown with gaps, if false without + + + + + + name of the project jar entry that holds + the VARNA viewer state for the structure + + + + + + + + + + + An id unique to the RNA viewer panel + + + + + + horizontal position of split pane divider + + + + + + Index of the selected structure in the + viewer panel + + + + + - - - - + + + + - + - + @@ -248,150 +306,142 @@ - + - - - - + + + + - - - - - - - + + + + + + + Optional sequence group ID (only - needs to be unique for this + needs to be + unique for this alignment) - + - - + - - + + - - - - - - - handle for the calculation which uses this parameter set - - - should the calculation be performed immediately after loading in order to refresh results - - - should the calculation be automatically performed on edits - - - - + + + + + + + handle for the calculation which uses + this parameter set + + + + + + should the calculation be performed + immediately after loading in order to refresh results + + + + + + should the calculation be automatically + performed on edits + + + + + + - - + + - + - - + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - + + - - + + unique id used by jalview to - synchronize between stored and + synchronize + between stored and instantiated views @@ -400,24 +450,22 @@ use="optional"> - The viewport id of this viewport's (cdna/protein) coding complement, if any + The viewport id of this viewport's + (cdna/protein) coding complement, if any - + - + - + @@ -427,22 +475,17 @@ - - - - - - + + + + + + Tree ID added for binding tree - visualization settings to vamsas + visualization + settings to vamsas document trees in jalview 2.4.1 @@ -453,29 +496,25 @@ - + - - - - - + + + + + Optional minimum colour - for graduated feature + for graduated + feature colour - + threshold value for @@ -483,8 +522,8 @@ - + threshold type for @@ -492,23 +531,19 @@ - - - - + + + + - + - - + + @@ -521,65 +556,60 @@ - - + + - - - - - - - + + + + + + + - - + + - - - + + + - + + + + base attributes for windows displayed in Jalview + desktop. + + + + + + + + + + + + + + + + - --> - - - - base attributes for windows displayed in Jalview desktop. - - - - - - - - - - - - - - - - - - + diff --git a/src/ext/edu/ucsf/rbvi/strucviz2/ChimeraManager.java b/src/ext/edu/ucsf/rbvi/strucviz2/ChimeraManager.java index b66778c..7cc72cf 100644 --- a/src/ext/edu/ucsf/rbvi/strucviz2/ChimeraManager.java +++ b/src/ext/edu/ucsf/rbvi/strucviz2/ChimeraManager.java @@ -1,5 +1,7 @@ package ext.edu.ucsf.rbvi.strucviz2; +import jalview.ws.HttpClientUtils; + import java.awt.Color; import java.io.BufferedReader; import java.io.File; @@ -20,8 +22,6 @@ import org.slf4j.LoggerFactory; import ext.edu.ucsf.rbvi.strucviz2.StructureManager.ModelType; import ext.edu.ucsf.rbvi.strucviz2.port.ListenerThreads; -import jalview.ws.HttpClientUtils; - /** * This object maintains the Chimera communication information. */ @@ -554,8 +554,8 @@ public class ChimeraManager for (String chimeraPath : chimeraPaths) { File path = new File(chimeraPath); - // enable the next line to simulate Chimera not installed - // File path = new File(chimeraPath + "x"); + // uncomment the next line to simulate Chimera not installed + // path = new File(chimeraPath + "x"); if (!path.canExecute()) { error += "File '" + path + "' does not exist.\n"; @@ -565,6 +565,8 @@ public class ChimeraManager { List args = new ArrayList(); args.add(chimeraPath); + // shows Chimera output window but suppresses REST responses: + // args.add("--debug"); args.add("--start"); args.add("RESTServer"); ProcessBuilder pb = new ProcessBuilder(args); @@ -589,7 +591,7 @@ public class ChimeraManager // TODO: [Optional] Check Chimera version and show a warning if below 1.8 // Ask Chimera to give us updates // startListening(); // later - see ChimeraListener - return true; + return (chimeraRestPort > 0); } // Tell the user that Chimera could not be started because of an error @@ -606,20 +608,29 @@ public class ChimeraManager InputStream readChan = chimera.getInputStream(); BufferedReader lineReader = new BufferedReader(new InputStreamReader( readChan)); - String response = null; + StringBuilder responses = new StringBuilder(); try { - // expect: REST server on host 127.0.0.1 port port_number - response = lineReader.readLine(); - String [] tokens = response.split(" "); - if (tokens.length == 7 && "port".equals(tokens[5])) { - port = Integer.parseInt(tokens[6]); - logger.info("Chimera REST service listening on port " - + chimeraRestPort); + String response = lineReader.readLine(); + while (response != null) + { + responses.append("\n" + response); + // expect: REST server on host 127.0.0.1 port port_number + if (response.startsWith("REST server")) + { + String[] tokens = response.split(" "); + if (tokens.length == 7 && "port".equals(tokens[5])) + { + port = Integer.parseInt(tokens[6]); + break; + } + } + response = lineReader.readLine(); } } catch (Exception e) { - logger.error("Failed to get REST port number from " + response + ": " + logger.error("Failed to get REST port number from " + responses + + ": " + e.getMessage()); } finally { @@ -630,6 +641,13 @@ public class ChimeraManager { } } + if (port == 0) + { + System.err + .println("Failed to start Chimera with REST service, response was: " + + responses); + } + logger.info("Chimera REST service listening on port " + chimeraRestPort); return port; } diff --git a/src/jalview/analysis/AAFrequency.java b/src/jalview/analysis/AAFrequency.java index 69c39df..50045dc 100755 --- a/src/jalview/analysis/AAFrequency.java +++ b/src/jalview/analysis/AAFrequency.java @@ -596,7 +596,6 @@ public class AAFrequency // array holds #seqs, #ungapped, then codon counts indexed by codon final int[] codonCounts = (int[]) hci.get(PROFILE); int totalCount = 0; - StringBuilder mouseOver = new StringBuilder(32); /* * First pass - get total count and find the highest @@ -636,26 +635,56 @@ public class AAFrequency */ /* - * Scan sorted array backwards for most frequent values first. + * Scan sorted array backwards for most frequent values first. Show + * repeated values compactly. */ + StringBuilder mouseOver = new StringBuilder(32); + StringBuilder samePercent = new StringBuilder(); + String percent = null; + String lastPercent = null; + Format fmt = getPercentageFormat(nseqs); + for (int j = codons.length - 1; j >= 0; j--) { int codonCount = sortedCodonCounts[j]; if (codonCount == 0) { + /* + * remaining codons are 0% - ignore, but finish off the last one if + * necessary + */ + if (samePercent.length() > 0) + { + mouseOver.append(samePercent).append(": ").append(percent) + .append("% "); + } break; } int codonEncoded = codons[j]; final int pct = codonCount * 100 / totalCount; String codon = String .valueOf(CodingUtils.decodeCodon(codonEncoded)); - Format fmt = getPercentageFormat(nseqs); - String formatted = fmt == null ? Integer.toString(pct) : fmt + percent = fmt == null ? Integer.toString(pct) : fmt .form(pct); if (showProfileLogo || codonCount == modalCodonCount) { - mouseOver.append(codon).append(": ").append(formatted) - .append("% "); + if (percent.equals(lastPercent) && j > 0) + { + samePercent.append(samePercent.length() == 0 ? "" : ", "); + samePercent.append(codon); + } + else + { + if (samePercent.length() > 0) + { + mouseOver.append(samePercent).append(": ") + .append(lastPercent) + .append("% "); + } + samePercent.setLength(0); + samePercent.append(codon); + } + lastPercent = percent; } } diff --git a/src/jalview/analysis/AlignmentSorter.java b/src/jalview/analysis/AlignmentSorter.java index 2fad332..0022af6 100755 --- a/src/jalview/analysis/AlignmentSorter.java +++ b/src/jalview/analysis/AlignmentSorter.java @@ -820,7 +820,7 @@ public class AlignmentSorter else { // or, also take a look at the scores if necessary. - if (!ignoreScore && sf[f].getScore() != Float.NaN) + if (!ignoreScore && !Float.isNaN(sf[f].getScore())) { if (seqScores[i] == 0) { diff --git a/src/jalview/api/AlignExportSettingI.java b/src/jalview/api/AlignExportSettingI.java index cf56bf3..9b67cf5 100644 --- a/src/jalview/api/AlignExportSettingI.java +++ b/src/jalview/api/AlignExportSettingI.java @@ -68,10 +68,4 @@ public interface AlignExportSettingI */ public boolean isExportGroups(); - /** - * Checks if settings/export process is cancelled - * - * @return - */ - public boolean isCancelled(); } diff --git a/src/jalview/api/ComplexAlignFile.java b/src/jalview/api/ComplexAlignFile.java index 133a739..c699b54 100644 --- a/src/jalview/api/ComplexAlignFile.java +++ b/src/jalview/api/ComplexAlignFile.java @@ -40,4 +40,10 @@ public interface ComplexAlignFile */ public SequenceI[] getHiddenSequences(); + /** + * Retrieves displayed features from a complex file parser + * + * @return + */ + public FeaturesDisplayedI getDisplayedFeatures(); } diff --git a/src/jalview/appletgui/AlignFrame.java b/src/jalview/appletgui/AlignFrame.java index ca1d158..0225dc7 100644 --- a/src/jalview/appletgui/AlignFrame.java +++ b/src/jalview/appletgui/AlignFrame.java @@ -106,6 +106,8 @@ import java.util.Map; import java.util.StringTokenizer; import java.util.Vector; +import org.jmol.viewer.Viewer; + public class AlignFrame extends EmbmenuFrame implements ActionListener, ItemListener, KeyListener, AlignViewControllerGuiI { @@ -927,7 +929,9 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, : showForSequences); aa.visible = visible; } - alignPanel.validateAnnotationDimensions(false); + alignPanel.validateAnnotationDimensions(true); + validate(); + repaint(); } private void setAnnotationSortOrder(SequenceAnnotationOrder order) @@ -3870,10 +3874,10 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, public SequenceStructureBinding addStructureViewInstance( Object jmolviewer, String[] sequenceIds) { - org.jmol.api.JmolViewer viewer = null; + Viewer viewer = null; try { - viewer = (org.jmol.api.JmolViewer) jmolviewer; + viewer = (Viewer) jmolviewer; } catch (ClassCastException ex) { System.err.println("Unsupported viewer object :" diff --git a/src/jalview/appletgui/AlignmentPanel.java b/src/jalview/appletgui/AlignmentPanel.java index 0516533..463c6c3 100644 --- a/src/jalview/appletgui/AlignmentPanel.java +++ b/src/jalview/appletgui/AlignmentPanel.java @@ -20,6 +20,15 @@ */ package jalview.appletgui; +import jalview.analysis.AnnotationSorter; +import jalview.api.AlignViewportI; +import jalview.api.AlignmentViewPanel; +import jalview.bin.JalviewLite; +import jalview.datamodel.AlignmentI; +import jalview.datamodel.SearchResults; +import jalview.datamodel.SequenceI; +import jalview.structure.StructureSelectionManager; + import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; @@ -34,15 +43,6 @@ import java.awt.event.ComponentAdapter; import java.awt.event.ComponentEvent; import java.util.List; -import jalview.analysis.AnnotationSorter; -import jalview.api.AlignViewportI; -import jalview.api.AlignmentViewPanel; -import jalview.bin.JalviewLite; -import jalview.datamodel.AlignmentI; -import jalview.datamodel.SearchResults; -import jalview.datamodel.SequenceI; -import jalview.structure.StructureSelectionManager; - public class AlignmentPanel extends Panel implements AdjustmentListener, AlignmentViewPanel { @@ -552,70 +552,60 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, } /** - * calculate the annotation dimensions and refresh slider values accordingly. - * need to do repaints/notifys afterwards. + * Calculate the annotation dimensions and refresh slider values accordingly. + * Need to do repaints/notifys afterwards. */ protected void validateAnnotationDimensions(boolean adjustPanelHeight) { - boolean modified = false; - int height = av.calcPanelHeight(); - int minsize = 0; - if (hscroll.isVisible()) - { - height += (minsize = hscroll.getPreferredSize().height); - } - if (apvscroll.isVisible()) - { - minsize += apvscroll.getPreferredSize().height; - } - int mheight = height; - Dimension d = sequenceHolderPanel.getSize(), e = idPanel.getSize(); - int seqandannot = d.height - scalePanelHolder.getSize().height; + int rowHeight = av.getCharHeight(); + int alignmentHeight = rowHeight * av.getAlignment().getHeight(); + int annotationHeight = av.calcPanelHeight(); + + int mheight = annotationHeight; + Dimension d = sequenceHolderPanel.getSize(); + + int availableHeight = d.height - scalePanelHolder.getHeight(); if (adjustPanelHeight) { - // NOTE: this logic is different in the application. Need a better - // algorithm to define behaviour - // sets initial preferred height - // try and set height according to alignment - float sscaling = (float) ((av.getCharHeight() * av.getAlignment() - .getHeight()) / (1.0 * mheight)); - if (sscaling > 0.5) - { - // if the alignment is too big then - // default is 0.5 split - height = seqandannot / 2; - } - else + /* + * If not enough vertical space, maximize annotation height while keeping + * at least two rows of alignment visible + */ + if (annotationHeight + alignmentHeight > availableHeight) { - // otherwise just set the panel so that one row of sequence is visible - height = -av.getCharHeight() * 1 - + (int) (seqandannot * (1 - sscaling)); + annotationHeight = Math.min(annotationHeight, availableHeight - 2 + * rowHeight); } } else { // maintain same window layout whilst updating sliders - height = annotationPanelHolder.getSize().height; + annotationHeight = annotationPanelHolder.getSize().height; } - if (seqandannot - height < 5) + if (availableHeight - annotationHeight < 5) { - height = seqandannot; + annotationHeight = availableHeight; } - annotationPanel.setSize(new Dimension(d.width, height)); - alabels.setSize(new Dimension(e.width, height)); - annotationSpaceFillerHolder.setSize(new Dimension(e.width, height)); - annotationPanelHolder.setSize(new Dimension(d.width, height)); + + annotationPanel.setSize(new Dimension(d.width, annotationHeight)); + annotationPanelHolder.setSize(new Dimension(d.width, annotationHeight)); // seqPanelHolder.setSize(d.width, seqandannot - height); seqPanel.seqCanvas .setSize(d.width, seqPanel.seqCanvas.getSize().height); + + Dimension e = idPanel.getSize(); + alabels.setSize(new Dimension(e.width, annotationHeight)); + annotationSpaceFillerHolder.setSize(new Dimension(e.width, + annotationHeight)); + int s = apvscroll.getValue(); - if (s > mheight - height) + if (s > mheight - annotationHeight) { s = 0; } - apvscroll.setValues(s, height, 0, mheight); + apvscroll.setValues(s, annotationHeight, 0, mheight); annotationPanel.setScrollOffset(apvscroll.getValue(), false); alabels.setScrollOffset(apvscroll.getValue(), false); } diff --git a/src/jalview/appletgui/AppletJmol.java b/src/jalview/appletgui/AppletJmol.java index f54717d..e889467 100644 --- a/src/jalview/appletgui/AppletJmol.java +++ b/src/jalview/appletgui/AppletJmol.java @@ -20,6 +20,23 @@ */ package jalview.appletgui; +import jalview.datamodel.AlignmentI; +import jalview.datamodel.PDBEntry; +import jalview.datamodel.SequenceI; +import jalview.io.AppletFormatAdapter; +import jalview.io.FileParse; +import jalview.schemes.BuriedColourScheme; +import jalview.schemes.HelixColourScheme; +import jalview.schemes.HydrophobicColourScheme; +import jalview.schemes.PurinePyrimidineColourScheme; +import jalview.schemes.StrandColourScheme; +import jalview.schemes.TaylorColourScheme; +import jalview.schemes.TurnColourScheme; +import jalview.schemes.UserColourScheme; +import jalview.schemes.ZappoColourScheme; +import jalview.structure.StructureSelectionManager; +import jalview.util.MessageManager; + import java.awt.BorderLayout; import java.awt.CheckboxMenuItem; import java.awt.Color; @@ -31,7 +48,6 @@ import java.awt.Menu; import java.awt.MenuBar; import java.awt.MenuItem; import java.awt.Panel; -import java.awt.Rectangle; import java.awt.TextArea; import java.awt.TextField; import java.awt.event.ActionEvent; @@ -44,25 +60,9 @@ import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.util.ArrayList; import java.util.Hashtable; +import java.util.List; import java.util.Vector; -import jalview.datamodel.AlignmentI; -import jalview.datamodel.PDBEntry; -import jalview.datamodel.SequenceI; -import jalview.io.AppletFormatAdapter; -import jalview.io.FileParse; -import jalview.schemes.BuriedColourScheme; -import jalview.schemes.HelixColourScheme; -import jalview.schemes.HydrophobicColourScheme; -import jalview.schemes.PurinePyrimidineColourScheme; -import jalview.schemes.StrandColourScheme; -import jalview.schemes.TaylorColourScheme; -import jalview.schemes.TurnColourScheme; -import jalview.schemes.UserColourScheme; -import jalview.schemes.ZappoColourScheme; -import jalview.structure.StructureSelectionManager; -import jalview.util.MessageManager; - public class AppletJmol extends EmbmenuFrame implements // StructureListener, KeyListener, ActionListener, ItemListener @@ -130,7 +130,8 @@ public class AppletJmol extends EmbmenuFrame implements AlignmentPanel ap; - ArrayList _aps = new ArrayList(); + List _aps = new ArrayList(); // remove? never + // added to String fileLoadingError; @@ -280,7 +281,7 @@ public class AppletJmol extends EmbmenuFrame implements dispose(); return; } - jmb.newJmolPopup(true, "Jmol", true); + // jmb.newJmolPopup(true, "Jmol", true); this.addWindowListener(new WindowAdapter() { @@ -370,7 +371,7 @@ public class AppletJmol extends EmbmenuFrame implements jmb.loadInline(string); } - void setChainMenuItems(Vector chains) + void setChainMenuItems(Vector chains) { chainMenu.removeAll(); @@ -380,10 +381,9 @@ public class AppletJmol extends EmbmenuFrame implements chainMenu.add(menuItem); CheckboxMenuItem menuItemCB; - for (int c = 0; c < chains.size(); c++) + for (String ch : chains) { - menuItemCB = new CheckboxMenuItem(chains.elementAt(c).toString(), - true); + menuItemCB = new CheckboxMenuItem(ch, true); menuItemCB.addItemListener(this); chainMenu.add(menuItemCB); } @@ -393,9 +393,7 @@ public class AppletJmol extends EmbmenuFrame implements void centerViewer() { - Vector toshow = new Vector(); - String lbl; - int mlength, p, mnum; + Vector toshow = new Vector(); for (int i = 0; i < chainMenu.getItemCount(); i++) { if (chainMenu.getItem(i) instanceof CheckboxMenuItem) @@ -547,7 +545,7 @@ public class AppletJmol extends EmbmenuFrame implements else if (evt.getSource() == seqColour) { setEnabled(seqColour); - jmb.colourBySequence(ap.av.isShowSequenceFeatures(), ap); + jmb.colourBySequence(ap); } else if (!allChainsSelected) { @@ -576,8 +574,8 @@ public class AppletJmol extends EmbmenuFrame implements public void updateColours(Object source) { - AlignmentPanel ap = (AlignmentPanel) source; - jmb.colourBySequence(ap.av.isShowSequenceFeatures(), ap); + AlignmentPanel panel = (AlignmentPanel) source; + jmb.colourBySequence(panel); } public void updateTitleAndMenus() @@ -588,7 +586,7 @@ public class AppletJmol extends EmbmenuFrame implements return; } setChainMenuItems(jmb.chainNames); - jmb.colourBySequence(ap.av.isShowSequenceFeatures(), ap); + jmb.colourBySequence(ap); setTitle(jmb.getViewerTitle()); } @@ -643,8 +641,6 @@ public class AppletJmol extends EmbmenuFrame implements { Dimension currentSize = new Dimension(); - Rectangle rectClip = new Rectangle(); - public void update(Graphics g) { paint(g); @@ -653,7 +649,6 @@ public class AppletJmol extends EmbmenuFrame implements public void paint(Graphics g) { currentSize = this.getSize(); - rectClip = g.getClipBounds(); if (jmb.viewer == null) { @@ -666,7 +661,8 @@ public class AppletJmol extends EmbmenuFrame implements } else { - jmb.viewer.renderScreenImage(g, currentSize, rectClip); + jmb.viewer.renderScreenImage(g, currentSize.width, + currentSize.height); } } } @@ -698,9 +694,9 @@ public class AppletJmol extends EmbmenuFrame implements { for (int i = 0; i < _aps.size(); i++) { - if (((AlignmentPanel) _aps.get(i)).av.getAlignment() == alignment) + if (_aps.get(i).av.getAlignment() == alignment) { - return ((AlignmentPanel) _aps.get(i)); + return (_aps.get(i)); } } return ap; diff --git a/src/jalview/appletgui/AppletJmolBinding.java b/src/jalview/appletgui/AppletJmolBinding.java index 80fafe3..7035058 100644 --- a/src/jalview/appletgui/AppletJmolBinding.java +++ b/src/jalview/appletgui/AppletJmolBinding.java @@ -23,16 +23,19 @@ package jalview.appletgui; import jalview.api.AlignmentViewPanel; import jalview.datamodel.PDBEntry; import jalview.datamodel.SequenceI; +import jalview.ext.jmol.JalviewJmolBinding; import jalview.structure.StructureSelectionManager; import java.awt.Container; -import java.util.BitSet; +import java.util.Map; + +import javajs.awt.Dimension; import org.jmol.api.JmolAppConsoleInterface; -import org.jmol.api.JmolViewer; -import org.jmol.popup.JmolPopup; +import org.jmol.console.AppletConsole; +import org.jmol.java.BS; -class AppletJmolBinding extends jalview.ext.jmol.JalviewJmolBinding +class AppletJmolBinding extends JalviewJmolBinding { /** @@ -48,6 +51,7 @@ class AppletJmolBinding extends jalview.ext.jmol.JalviewJmolBinding appletJmolBinding = appletJmol; } + @Override public jalview.api.FeatureRenderer getFeatureRenderer( AlignmentViewPanel alignment) { @@ -68,12 +72,14 @@ class AppletJmolBinding extends jalview.ext.jmol.JalviewJmolBinding return appletJmolBinding.fr; } + @Override public jalview.api.SequenceRenderer getSequenceRenderer( AlignmentViewPanel alignment) { return new SequenceRenderer(((AlignmentPanel) alignment).av); } + @Override public void sendConsoleEcho(String strEcho) { if (appletJmolBinding.scriptWindow == null) @@ -84,6 +90,7 @@ class AppletJmolBinding extends jalview.ext.jmol.JalviewJmolBinding appletJmolBinding.history.append("\n" + strEcho); } + @Override public void sendConsoleMessage(String strStatus) { if (appletJmolBinding.history != null && strStatus != null @@ -93,12 +100,14 @@ class AppletJmolBinding extends jalview.ext.jmol.JalviewJmolBinding } } + @Override public void showUrl(String url, String target) { appletJmolBinding.ap.alignFrame.showURL(url, target); } + @Override public void refreshGUI() { appletJmolBinding.updateTitleAndMenus(); @@ -107,7 +116,7 @@ class AppletJmolBinding extends jalview.ext.jmol.JalviewJmolBinding public void updateColours(Object source) { AlignmentPanel ap = (AlignmentPanel) source; - colourBySequence(ap.av.isShowSequenceFeatures(), ap); + colourBySequence(ap); } public void showUrl(String url) @@ -124,17 +133,17 @@ class AppletJmolBinding extends jalview.ext.jmol.JalviewJmolBinding public void newJmolPopup(boolean translateLocale, String menuName, boolean asPopup) { - - jmolpopup = new JmolPopup(); - jmolpopup.initialize(viewer, translateLocale, menuName, asPopup); + // jmolpopup = new JmolAwtPopup(); // is this used? + // jmolpopup.jpiInitialize((viewer), menuName); } + @Override public void notifyScriptTermination(String strStatus, int msWalltime) { // do nothing. } - public void selectionChanged(BitSet arg0) + public void selectionChanged(BS arg0) { // TODO Auto-generated method stub @@ -153,12 +162,11 @@ class AppletJmolBinding extends jalview.ext.jmol.JalviewJmolBinding } @Override - protected JmolAppConsoleInterface createJmolConsole(JmolViewer viewer2, + protected JmolAppConsoleInterface createJmolConsole( Container consolePanel, String buttonsToShow) { - // return new org.jmol.console.AppletConsole(viewer2, consolePanel); - JmolAppConsoleInterface appc = new org.jmol.console.AppletConsole() - .getAppConsole(viewer2); + JmolAppConsoleInterface appc = new AppletConsole(); + appc.start(viewer); return appc; } @@ -175,9 +183,16 @@ class AppletJmolBinding extends jalview.ext.jmol.JalviewJmolBinding } @Override - public void resizeInnerPanel(String data) + public Dimension resizeInnerPanel(String data) { // TODO Auto-generated method stub + return null; + } + @Override + public Map getJSpecViewProperty(String arg0) + { + // TODO Auto-generated method stub + return null; } } diff --git a/src/jalview/appletgui/ExtJmol.java b/src/jalview/appletgui/ExtJmol.java index cec77d2..c1035bd 100644 --- a/src/jalview/appletgui/ExtJmol.java +++ b/src/jalview/appletgui/ExtJmol.java @@ -29,12 +29,13 @@ import jalview.ext.jmol.JalviewJmolBinding; import java.awt.Container; import java.util.ArrayList; -import java.util.BitSet; import java.util.List; +import java.util.Map; import java.util.Vector; import org.jmol.api.JmolAppConsoleInterface; -import org.jmol.api.JmolViewer; +import org.jmol.java.BS; +import org.jmol.viewer.Viewer; /** * bind an alignment view to an external Jmol instance. @@ -55,7 +56,7 @@ public class ExtJmol extends JalviewJmolBinding chains, protocol); } - public ExtJmol(JmolViewer viewer, AlignmentPanel alignPanel, + public ExtJmol(Viewer viewer, AlignmentPanel alignPanel, SequenceI[][] seqs) { super(alignPanel.getStructureSelectionManager(), seqs, viewer); @@ -75,6 +76,7 @@ public class ExtJmol extends JalviewJmolBinding showUrl(arg0, "jmol"); } + @Override public FeatureRenderer getFeatureRenderer(AlignmentViewPanel alignment) { AlignmentPanel ap = (AlignmentPanel) alignment; @@ -88,41 +90,48 @@ public class ExtJmol extends JalviewJmolBinding } } + @Override public SequenceRenderer getSequenceRenderer(AlignmentViewPanel alignment) { return ((AlignmentPanel) alignment).getSequenceRenderer(); } + @Override public void notifyScriptTermination(String strStatus, int msWalltime) { // ignore } + @Override public void sendConsoleEcho(String strEcho) { // ignore } + @Override public void sendConsoleMessage(String strStatus) { // ignore } + @Override public void showUrl(String url, String target) { ap.alignFrame.showURL(url, target); } + @Override public void refreshGUI() { // ignore } - public void selectionChanged(BitSet arg0) + public void selectionChanged(BS arg0) { System.out.println(arg0); } + @Override public void refreshPdbEntries() { List pdbe = new ArrayList(); @@ -130,12 +139,12 @@ public class ExtJmol extends JalviewJmolBinding SequenceI[] sq = ap.av.getAlignment().getSequencesArray(); for (int s = 0; s < sq.length; s++) { - Vector pdbids = sq[s].getPDBId(); + Vector pdbids = sq[s].getPDBId(); if (pdbids != null) { for (int pe = 0, peSize = pdbids.size(); pe < peSize; pe++) { - PDBEntry pentry = (PDBEntry) pdbids.elementAt(pe); + PDBEntry pentry = pdbids.elementAt(pe); if (!fileids.contains(pentry.getId())) { pdbe.add(pentry); @@ -166,7 +175,7 @@ public class ExtJmol extends JalviewJmolBinding } @Override - protected JmolAppConsoleInterface createJmolConsole(JmolViewer viewer2, + protected JmolAppConsoleInterface createJmolConsole( Container consolePanel, String buttonsToShow) { // TODO Auto-generated method stub @@ -188,4 +197,11 @@ public class ExtJmol extends JalviewJmolBinding } + @Override + public Map getJSpecViewProperty(String arg0) + { + // TODO Auto-generated method stub + return null; + } + } diff --git a/src/jalview/appletgui/IdPanel.java b/src/jalview/appletgui/IdPanel.java index 258b8b6..8f24f11 100755 --- a/src/jalview/appletgui/IdPanel.java +++ b/src/jalview/appletgui/IdPanel.java @@ -20,6 +20,13 @@ */ package jalview.appletgui; +import jalview.datamodel.Sequence; +import jalview.datamodel.SequenceFeature; +import jalview.datamodel.SequenceGroup; +import jalview.datamodel.SequenceI; +import jalview.util.UrlLink; +import jalview.viewmodel.AlignmentViewport; + import java.awt.BorderLayout; import java.awt.Panel; import java.awt.event.InputEvent; @@ -29,13 +36,6 @@ import java.awt.event.MouseMotionListener; import java.util.List; import java.util.Vector; -import jalview.datamodel.Sequence; -import jalview.datamodel.SequenceFeature; -import jalview.datamodel.SequenceGroup; -import jalview.datamodel.SequenceI; -import jalview.util.UrlLink; -import jalview.viewmodel.AlignmentViewport; - public class IdPanel extends Panel implements MouseListener, MouseMotionListener { @@ -142,7 +142,7 @@ public class IdPanel extends Panel implements MouseListener, nl = true; } ; - if (sf[sl].getScore() != Float.NaN && sf[sl].getScore() != 0f) + if (!Float.isNaN(sf[sl].getScore()) && sf[sl].getScore() != 0f) { tooltiptext.append(" Score = "); tooltiptext.append(sf[sl].getScore()); diff --git a/src/jalview/bin/Jalview.java b/src/jalview/bin/Jalview.java index 00a042d..177d56f 100755 --- a/src/jalview/bin/Jalview.java +++ b/src/jalview/bin/Jalview.java @@ -109,7 +109,14 @@ public class Jalview System.setProperty("java.awt.headless", "true"); headless = true; } - Cache.loadProperties(aparser.getValue("props")); // must do this before + String usrPropsFile = aparser.getValue("props"); + Cache.loadProperties(usrPropsFile); // must do this before + if (usrPropsFile != null) + { + System.out.println("CMD [-props " + usrPropsFile + + "] executed successfully!"); + } + // anything else! final String jabawsUrl = aparser.getValue("jabaws"); @@ -118,6 +125,8 @@ public class Jalview try { Jws2Discoverer.getDiscoverer().setPreferredUrl(jabawsUrl); + System.out.println("CMD [-jabaws " + jabawsUrl + + "] executed successfully!"); } catch (MalformedURLException e) { System.err.println("Invalid jabaws parameter: " + jabawsUrl @@ -195,6 +204,11 @@ public class Jalview { startUsageStats(desktop); } + else + { + System.err.println("CMD [-nousagestats] executed successfully!"); + } + if (!aparser.contains("noquestionnaire")) { String url = aparser.getValue("questionnaire"); @@ -204,6 +218,8 @@ public class Jalview // questionnaire Cache.log.debug("Starting questionnaire url at " + url); desktop.checkForQuestionnaire(url); + System.out.println("CMD questionnaire[-" + url + + "] executed successfully!"); } else { @@ -222,13 +238,21 @@ public class Jalview } } } + else + { + System.err +.println("CMD [-noquestionnaire] executed successfully!"); + } desktop.checkForNews(); } - BioJsHTMLOutput.updateBioJS(); + if (!isHeadlessMode()) + { + BioJsHTMLOutput.updateBioJS(); + } String file = null, protocol = null, format = null, data = null; - jalview.io.FileLoader fileLoader = new jalview.io.FileLoader(); + jalview.io.FileLoader fileLoader = new jalview.io.FileLoader(!headless); Vector getFeatures = null; // vector of das source nicknames to fetch // features from // loading is done. @@ -337,7 +361,7 @@ public class Jalview desktop.setProgressBar(MessageManager.getString("status.processing_commandline_args"), progress = System.currentTimeMillis()); } - System.out.println("Opening file: " + file); + System.out.println("CMD [-open " + file + "] executed successfully!"); if (!file.startsWith("http://")) { @@ -379,8 +403,11 @@ public class Jalview ucs.parseAppletParameter(data); cs = ucs; } - - System.out.println("colour is " + data); + else + { + System.out.println("CMD [-color " + data + + "] executed successfully!"); + } af.changeColour(cs); } @@ -390,34 +417,55 @@ public class Jalview { af.parseFeaturesFile(data, jalview.io.AppletFormatAdapter.checkProtocol(data)); - System.out.println("Added " + data); + // System.out.println("Added " + data); + System.out.println("CMD groups[-" + data + + "] executed successfully!"); } data = aparser.getValue("features", true); if (data != null) { af.parseFeaturesFile(data, jalview.io.AppletFormatAdapter.checkProtocol(data)); - System.out.println("Added " + data); + // System.out.println("Added " + data); + System.out.println("CMD [-features " + data + + "] executed successfully!"); } data = aparser.getValue("annotations", true); if (data != null) { af.loadJalviewDataFile(data, null, null, null); - System.out.println("Added " + data); + // System.out.println("Added " + data); + System.out.println("CMD [-annotations " + data + + "] executed successfully!"); } // set or clear the sortbytree flag. if (aparser.contains("sortbytree")) { af.getViewport().setSortByTree(true); + if (af.getViewport().getSortByTree()) + { + System.out +.println("CMD [-sortbytree] executed successfully!"); + } } if (aparser.contains("no-annotation")) { af.getViewport().setShowAnnotation(false); + if (!af.getViewport().isShowAnnotation()) + { + System.out +.println("CMD no-annotation executed successfully!"); + } } if (aparser.contains("nosortbytree")) { af.getViewport().setSortByTree(false); + if (!af.getViewport().getSortByTree()) + { + System.out + .println("CMD [-nosortbytree] executed successfully!"); + } } data = aparser.getValue("tree", true); if (data != null) @@ -425,13 +473,14 @@ public class Jalview jalview.io.NewickFile fin = null; try { + System.out.println("CMD [-tree " + data + + "] executed successfully!"); fin = new jalview.io.NewickFile(data, jalview.io.AppletFormatAdapter.checkProtocol(data)); if (fin != null) { af.getViewport().setCurrentTree( af.ShowNewickTree(fin, data).getTree()); - System.out.println("Added tree " + data); } } catch (IOException ex) { @@ -472,6 +521,9 @@ public class Jalview System.out.println("Executing script " + groovyscript); executeGroovyScript(groovyscript, new Object[] { desktop, af }); + + System.out.println("CMD groovy[" + groovyscript + + "] executed successfully!"); } else { @@ -518,8 +570,10 @@ public class Jalview } else if (format.equalsIgnoreCase("eps")) { - System.out.println("Creating EPS file: " + file); - af.createEPS(new java.io.File(file)); + File outputFile = new java.io.File(file); + System.out.println("Creating EPS file: " + + outputFile.getAbsolutePath()); + af.createEPS(outputFile); continue; } @@ -639,6 +693,7 @@ public class Jalview + "-pileup FILE\tCreate alignment file FILE in Pileup format\n" + "-pir FILE\tCreate alignment file FILE in PIR format.\n" + "-blc FILE\tCreate alignment file FILE in BLC format.\n" + + "-json FILE\tCreate alignment file FILE in JSON format.\n" + "-jalview FILE\tCreate alignment file FILE in Jalview format.\n" + "-png FILE\tCreate PNG image FILE from alignment.\n" + "-svg FILE\tCreate SVG image FILE from alignment.\n" @@ -925,6 +980,8 @@ public class Jalview } source.addElement(nickname); } + System.out.println("CMD [-dasserver " + data + + "] executed successfully!"); } // loop until no more server entries are found. if (locsources != null && locsources.indexOf('|') > -1) { @@ -963,6 +1020,16 @@ public class Jalview } return ff; } + + public static boolean isHeadlessMode() + { + String isheadless = System.getProperty("java.awt.headless"); + if (isheadless != null && isheadless.equalsIgnoreCase("true")) + { + return true; + } + return false; + } } /** @@ -1131,4 +1198,4 @@ class FeatureFetcher return queued == 0 && running == 0; } -}; +} diff --git a/src/jalview/bin/JalviewLite.java b/src/jalview/bin/JalviewLite.java index ae5c63f..8a9c54b 100644 --- a/src/jalview/bin/JalviewLite.java +++ b/src/jalview/bin/JalviewLite.java @@ -69,7 +69,6 @@ import java.util.List; import java.util.StringTokenizer; import java.util.Vector; -import netscape.javascript.JSException; import netscape.javascript.JSObject; /** @@ -1533,7 +1532,7 @@ public class JalviewLite extends Applet implements { notFailed = true; } - } catch (JSException jsex) + } catch (Exception jsex) { System.err.println("Attempt " + tries + " to access LiveConnect javascript failed."); diff --git a/src/jalview/binding/Alignment.java b/src/jalview/binding/Alignment.java index 0cc2514..5b107b5 100644 --- a/src/jalview/binding/Alignment.java +++ b/src/jalview/binding/Alignment.java @@ -1,27 +1,14 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) - * Copyright (C) $$Year-Rel$$ The Jalview Authors - * - * This file is part of Jalview. - * - * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. - * - * Jalview is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Jalview. If not, see . - * The Jalview Authors are detailed in the 'AUTHORS' file. + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ */ + package jalview.binding; -//---------------------------------/ -//- Imported classes and packages -/ + //---------------------------------/ + //- Imported classes and packages -/ //---------------------------------/ import org.exolab.castor.xml.Marshaller; @@ -32,162 +19,151 @@ import org.exolab.castor.xml.Unmarshaller; * * @version $Revision$ $Date$ */ -public class Alignment implements java.io.Serializable -{ - - // --------------------------/ - // - Class/Member Variables -/ - // --------------------------/ - - /** - * Field _annotation. - */ - private jalview.binding.Annotation _annotation; - - /** - * Field _sequenceSet. - */ - private jalview.binding.SequenceSet _sequenceSet; - - // ----------------/ - // - Constructors -/ - // ----------------/ - - public Alignment() - { - super(); - } - - // -----------/ - // - Methods -/ - // -----------/ - - /** - * Returns the value of field 'annotation'. - * - * @return the value of field 'Annotation'. - */ - public jalview.binding.Annotation getAnnotation() - { - return this._annotation; - } - - /** - * Returns the value of field 'sequenceSet'. - * - * @return the value of field 'SequenceSet'. - */ - public jalview.binding.SequenceSet getSequenceSet() - { - return this._sequenceSet; - } - - /** - * Method isValid. - * - * @return true if this object is valid according to the schema - */ - public boolean isValid() - { - try - { - validate(); - } catch (org.exolab.castor.xml.ValidationException vex) - { - return false; +public class Alignment implements java.io.Serializable { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field _annotation. + */ + private jalview.binding.Annotation _annotation; + + /** + * Field _sequenceSet. + */ + private jalview.binding.SequenceSet _sequenceSet; + + + //----------------/ + //- Constructors -/ + //----------------/ + + public Alignment() { + super(); + } + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Returns the value of field 'annotation'. + * + * @return the value of field 'Annotation'. + */ + public jalview.binding.Annotation getAnnotation( + ) { + return this._annotation; + } + + /** + * Returns the value of field 'sequenceSet'. + * + * @return the value of field 'SequenceSet'. + */ + public jalview.binding.SequenceSet getSequenceSet( + ) { + return this._sequenceSet; + } + + /** + * Method isValid. + * + * @return true if this object is valid according to the schema + */ + public boolean isValid( + ) { + try { + validate(); + } catch (org.exolab.castor.xml.ValidationException vex) { + return false; + } + return true; + } + + /** + * + * + * @param out + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void marshal( + final java.io.Writer out) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, out); + } + + /** + * + * + * @param handler + * @throws java.io.IOException if an IOException occurs during + * marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + */ + public void marshal( + final org.xml.sax.ContentHandler handler) + throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, handler); + } + + /** + * Sets the value of field 'annotation'. + * + * @param annotation the value of field 'annotation'. + */ + public void setAnnotation( + final jalview.binding.Annotation annotation) { + this._annotation = annotation; + } + + /** + * Sets the value of field 'sequenceSet'. + * + * @param sequenceSet the value of field 'sequenceSet'. + */ + public void setSequenceSet( + final jalview.binding.SequenceSet sequenceSet) { + this._sequenceSet = sequenceSet; + } + + /** + * Method unmarshal. + * + * @param reader + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @return the unmarshaled jalview.binding.Alignment + */ + public static jalview.binding.Alignment unmarshal( + final java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + return (jalview.binding.Alignment) Unmarshaller.unmarshal(jalview.binding.Alignment.class, reader); + } + + /** + * + * + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void validate( + ) + throws org.exolab.castor.xml.ValidationException { + org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); + validator.validate(this); } - return true; - } - - /** - * - * - * @param out - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - */ - public void marshal(final java.io.Writer out) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - Marshaller.marshal(this, out); - } - - /** - * - * - * @param handler - * @throws java.io.IOException - * if an IOException occurs during marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - */ - public void marshal(final org.xml.sax.ContentHandler handler) - throws java.io.IOException, - org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - Marshaller.marshal(this, handler); - } - - /** - * Sets the value of field 'annotation'. - * - * @param annotation - * the value of field 'annotation'. - */ - public void setAnnotation(final jalview.binding.Annotation annotation) - { - this._annotation = annotation; - } - - /** - * Sets the value of field 'sequenceSet'. - * - * @param sequenceSet - * the value of field 'sequenceSet'. - */ - public void setSequenceSet(final jalview.binding.SequenceSet sequenceSet) - { - this._sequenceSet = sequenceSet; - } - - /** - * Method unmarshal. - * - * @param reader - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - * @return the unmarshaled jalview.binding.Alignment - */ - public static jalview.binding.Alignment unmarshal( - final java.io.Reader reader) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - return (jalview.binding.Alignment) Unmarshaller.unmarshal( - jalview.binding.Alignment.class, reader); - } - - /** - * - * - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - */ - public void validate() throws org.exolab.castor.xml.ValidationException - { - org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); - validator.validate(this); - } } diff --git a/src/jalview/binding/Annotation.java b/src/jalview/binding/Annotation.java index 005adf0..108d3ad 100644 --- a/src/jalview/binding/Annotation.java +++ b/src/jalview/binding/Annotation.java @@ -1,30 +1,15 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) - * Copyright (C) $$Year-Rel$$ The Jalview Authors - * - * This file is part of Jalview. - * - * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. - * - * Jalview is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Jalview. If not, see . - * The Jalview Authors are detailed in the 'AUTHORS' file. + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ */ + package jalview.binding; + //---------------------------------/ + //- Imported classes and packages -/ //---------------------------------/ -//- Imported classes and packages -/ -//---------------------------------/ - -import jalview.util.MessageManager; import org.exolab.castor.xml.Marshaller; import org.exolab.castor.xml.Unmarshaller; @@ -34,443 +19,414 @@ import org.exolab.castor.xml.Unmarshaller; * * @version $Revision$ $Date$ */ -public class Annotation implements java.io.Serializable -{ - - // --------------------------/ - // - Class/Member Variables -/ - // --------------------------/ - - /** - * Field _graph. - */ - private boolean _graph; - - /** - * keeps track of state for field: _graph - */ - private boolean _has_graph; - - /** - * Field _graphType. - */ - private int _graphType; - - /** - * keeps track of state for field: _graphType - */ - private boolean _has_graphType; - - /** - * Field _annotationElementList. - */ - private java.util.Vector _annotationElementList; - - /** - * Field _label. - */ - private java.lang.String _label; - - /** - * Field _description. - */ - private java.lang.String _description; - - // ----------------/ - // - Constructors -/ - // ----------------/ - - public Annotation() - { - super(); - this._annotationElementList = new java.util.Vector(); - } - - // -----------/ - // - Methods -/ - // -----------/ - - /** - * - * - * @param vAnnotationElement - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void addAnnotationElement( - final jalview.binding.AnnotationElement vAnnotationElement) - throws java.lang.IndexOutOfBoundsException - { - this._annotationElementList.addElement(vAnnotationElement); - } - - /** - * - * - * @param index - * @param vAnnotationElement - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void addAnnotationElement(final int index, - final jalview.binding.AnnotationElement vAnnotationElement) - throws java.lang.IndexOutOfBoundsException - { - this._annotationElementList.add(index, vAnnotationElement); - } - - /** - */ - public void deleteGraph() - { - this._has_graph = false; - } - - /** - */ - public void deleteGraphType() - { - this._has_graphType = false; - } - - /** - * Method enumerateAnnotationElement. - * - * @return an Enumeration over all jalview.binding.AnnotationElement elements - */ - public java.util.Enumeration enumerateAnnotationElement() - { - return this._annotationElementList.elements(); - } - - /** - * Method getAnnotationElement. - * - * @param index - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - * @return the value of the jalview.binding.AnnotationElement at the given - * index - */ - public jalview.binding.AnnotationElement getAnnotationElement( - final int index) throws java.lang.IndexOutOfBoundsException - { - // check bounds for index - if (index < 0 || index >= this._annotationElementList.size()) - { - throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{ - "getAnnotationElement", - Integer.valueOf(index).toString(), - Integer.valueOf((this._annotationElementList.size() - 1)).toString() - })); +public class Annotation implements java.io.Serializable { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field _graph. + */ + private boolean _graph; + + /** + * keeps track of state for field: _graph + */ + private boolean _has_graph; + + /** + * Field _graphType. + */ + private int _graphType; + + /** + * keeps track of state for field: _graphType + */ + private boolean _has_graphType; + + /** + * Field _annotationElementList. + */ + private java.util.Vector _annotationElementList; + + /** + * Field _label. + */ + private java.lang.String _label; + + /** + * Field _description. + */ + private java.lang.String _description; + + + //----------------/ + //- Constructors -/ + //----------------/ + + public Annotation() { + super(); + this._annotationElementList = new java.util.Vector(); } - return (jalview.binding.AnnotationElement) _annotationElementList - .get(index); - } - - /** - * Method getAnnotationElement.Returns the contents of the collection in an - * Array. - *

    - * Note: Just in case the collection contents are changing in another thread, - * we pass a 0-length Array of the correct type into the API call. This way we - * know that the Array returned is of exactly the correct length. - * - * @return this collection as an Array - */ - public jalview.binding.AnnotationElement[] getAnnotationElement() - { - jalview.binding.AnnotationElement[] array = new jalview.binding.AnnotationElement[0]; - return (jalview.binding.AnnotationElement[]) this._annotationElementList - .toArray(array); - } - - /** - * Method getAnnotationElementCount. - * - * @return the size of this collection - */ - public int getAnnotationElementCount() - { - return this._annotationElementList.size(); - } - - /** - * Returns the value of field 'description'. - * - * @return the value of field 'Description'. - */ - public java.lang.String getDescription() - { - return this._description; - } - - /** - * Returns the value of field 'graph'. - * - * @return the value of field 'Graph'. - */ - public boolean getGraph() - { - return this._graph; - } - - /** - * Returns the value of field 'graphType'. - * - * @return the value of field 'GraphType'. - */ - public int getGraphType() - { - return this._graphType; - } - - /** - * Returns the value of field 'label'. - * - * @return the value of field 'Label'. - */ - public java.lang.String getLabel() - { - return this._label; - } - - /** - * Method hasGraph. - * - * @return true if at least one Graph has been added - */ - public boolean hasGraph() - { - return this._has_graph; - } - - /** - * Method hasGraphType. - * - * @return true if at least one GraphType has been added - */ - public boolean hasGraphType() - { - return this._has_graphType; - } - - /** - * Returns the value of field 'graph'. - * - * @return the value of field 'Graph'. - */ - public boolean isGraph() - { - return this._graph; - } - - /** - * Method isValid. - * - * @return true if this object is valid according to the schema - */ - public boolean isValid() - { - try - { - validate(); - } catch (org.exolab.castor.xml.ValidationException vex) - { - return false; + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * + * + * @param vAnnotationElement + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addAnnotationElement( + final jalview.binding.AnnotationElement vAnnotationElement) + throws java.lang.IndexOutOfBoundsException { + this._annotationElementList.addElement(vAnnotationElement); } - return true; - } - - /** - * - * - * @param out - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - */ - public void marshal(final java.io.Writer out) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - Marshaller.marshal(this, out); - } - - /** - * - * - * @param handler - * @throws java.io.IOException - * if an IOException occurs during marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - */ - public void marshal(final org.xml.sax.ContentHandler handler) - throws java.io.IOException, - org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - Marshaller.marshal(this, handler); - } - - /** - */ - public void removeAllAnnotationElement() - { - this._annotationElementList.clear(); - } - - /** - * Method removeAnnotationElement. - * - * @param vAnnotationElement - * @return true if the object was removed from the collection. - */ - public boolean removeAnnotationElement( - final jalview.binding.AnnotationElement vAnnotationElement) - { - boolean removed = _annotationElementList.remove(vAnnotationElement); - return removed; - } - - /** - * Method removeAnnotationElementAt. - * - * @param index - * @return the element removed from the collection - */ - public jalview.binding.AnnotationElement removeAnnotationElementAt( - final int index) - { - java.lang.Object obj = this._annotationElementList.remove(index); - return (jalview.binding.AnnotationElement) obj; - } - - /** - * - * - * @param index - * @param vAnnotationElement - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void setAnnotationElement(final int index, - final jalview.binding.AnnotationElement vAnnotationElement) - throws java.lang.IndexOutOfBoundsException - { - // check bounds for index - if (index < 0 || index >= this._annotationElementList.size()) - { - throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{ - "setAnnotationElement", - Integer.valueOf(index).toString(), - Integer.valueOf((this._annotationElementList.size() - 1)).toString() - })); + + /** + * + * + * @param index + * @param vAnnotationElement + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addAnnotationElement( + final int index, + final jalview.binding.AnnotationElement vAnnotationElement) + throws java.lang.IndexOutOfBoundsException { + this._annotationElementList.add(index, vAnnotationElement); + } + + /** + */ + public void deleteGraph( + ) { + this._has_graph= false; + } + + /** + */ + public void deleteGraphType( + ) { + this._has_graphType= false; + } + + /** + * Method enumerateAnnotationElement. + * + * @return an Enumeration over all + * jalview.binding.AnnotationElement elements + */ + public java.util.Enumeration enumerateAnnotationElement( + ) { + return this._annotationElementList.elements(); + } + + /** + * Method getAnnotationElement. + * + * @param index + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + * @return the value of the jalview.binding.AnnotationElement + * at the given index + */ + public jalview.binding.AnnotationElement getAnnotationElement( + final int index) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._annotationElementList.size()) { + throw new IndexOutOfBoundsException("getAnnotationElement: Index value '" + index + "' not in range [0.." + (this._annotationElementList.size() - 1) + "]"); + } + + return (jalview.binding.AnnotationElement) _annotationElementList.get(index); } - this._annotationElementList.set(index, vAnnotationElement); - } - - /** - * - * - * @param vAnnotationElementArray - */ - public void setAnnotationElement( - final jalview.binding.AnnotationElement[] vAnnotationElementArray) - { - // -- copy array - _annotationElementList.clear(); - - for (int i = 0; i < vAnnotationElementArray.length; i++) - { - this._annotationElementList.add(vAnnotationElementArray[i]); + /** + * Method getAnnotationElement.Returns the contents of the + * collection in an Array.

    Note: Just in case the + * collection contents are changing in another thread, we pass + * a 0-length Array of the correct type into the API call. + * This way we know that the Array returned is of + * exactly the correct length. + * + * @return this collection as an Array + */ + public jalview.binding.AnnotationElement[] getAnnotationElement( + ) { + jalview.binding.AnnotationElement[] array = new jalview.binding.AnnotationElement[0]; + return (jalview.binding.AnnotationElement[]) this._annotationElementList.toArray(array); + } + + /** + * Method getAnnotationElementCount. + * + * @return the size of this collection + */ + public int getAnnotationElementCount( + ) { + return this._annotationElementList.size(); + } + + /** + * Returns the value of field 'description'. + * + * @return the value of field 'Description'. + */ + public java.lang.String getDescription( + ) { + return this._description; + } + + /** + * Returns the value of field 'graph'. + * + * @return the value of field 'Graph'. + */ + public boolean getGraph( + ) { + return this._graph; + } + + /** + * Returns the value of field 'graphType'. + * + * @return the value of field 'GraphType'. + */ + public int getGraphType( + ) { + return this._graphType; + } + + /** + * Returns the value of field 'label'. + * + * @return the value of field 'Label'. + */ + public java.lang.String getLabel( + ) { + return this._label; + } + + /** + * Method hasGraph. + * + * @return true if at least one Graph has been added + */ + public boolean hasGraph( + ) { + return this._has_graph; + } + + /** + * Method hasGraphType. + * + * @return true if at least one GraphType has been added + */ + public boolean hasGraphType( + ) { + return this._has_graphType; + } + + /** + * Returns the value of field 'graph'. + * + * @return the value of field 'Graph'. + */ + public boolean isGraph( + ) { + return this._graph; + } + + /** + * Method isValid. + * + * @return true if this object is valid according to the schema + */ + public boolean isValid( + ) { + try { + validate(); + } catch (org.exolab.castor.xml.ValidationException vex) { + return false; + } + return true; + } + + /** + * + * + * @param out + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void marshal( + final java.io.Writer out) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, out); + } + + /** + * + * + * @param handler + * @throws java.io.IOException if an IOException occurs during + * marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + */ + public void marshal( + final org.xml.sax.ContentHandler handler) + throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, handler); + } + + /** + */ + public void removeAllAnnotationElement( + ) { + this._annotationElementList.clear(); + } + + /** + * Method removeAnnotationElement. + * + * @param vAnnotationElement + * @return true if the object was removed from the collection. + */ + public boolean removeAnnotationElement( + final jalview.binding.AnnotationElement vAnnotationElement) { + boolean removed = _annotationElementList.remove(vAnnotationElement); + return removed; + } + + /** + * Method removeAnnotationElementAt. + * + * @param index + * @return the element removed from the collection + */ + public jalview.binding.AnnotationElement removeAnnotationElementAt( + final int index) { + java.lang.Object obj = this._annotationElementList.remove(index); + return (jalview.binding.AnnotationElement) obj; + } + + /** + * + * + * @param index + * @param vAnnotationElement + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void setAnnotationElement( + final int index, + final jalview.binding.AnnotationElement vAnnotationElement) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._annotationElementList.size()) { + throw new IndexOutOfBoundsException("setAnnotationElement: Index value '" + index + "' not in range [0.." + (this._annotationElementList.size() - 1) + "]"); + } + + this._annotationElementList.set(index, vAnnotationElement); + } + + /** + * + * + * @param vAnnotationElementArray + */ + public void setAnnotationElement( + final jalview.binding.AnnotationElement[] vAnnotationElementArray) { + //-- copy array + _annotationElementList.clear(); + + for (int i = 0; i < vAnnotationElementArray.length; i++) { + this._annotationElementList.add(vAnnotationElementArray[i]); + } + } + + /** + * Sets the value of field 'description'. + * + * @param description the value of field 'description'. + */ + public void setDescription( + final java.lang.String description) { + this._description = description; + } + + /** + * Sets the value of field 'graph'. + * + * @param graph the value of field 'graph'. + */ + public void setGraph( + final boolean graph) { + this._graph = graph; + this._has_graph = true; + } + + /** + * Sets the value of field 'graphType'. + * + * @param graphType the value of field 'graphType'. + */ + public void setGraphType( + final int graphType) { + this._graphType = graphType; + this._has_graphType = true; + } + + /** + * Sets the value of field 'label'. + * + * @param label the value of field 'label'. + */ + public void setLabel( + final java.lang.String label) { + this._label = label; + } + + /** + * Method unmarshal. + * + * @param reader + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @return the unmarshaled jalview.binding.Annotation + */ + public static jalview.binding.Annotation unmarshal( + final java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + return (jalview.binding.Annotation) Unmarshaller.unmarshal(jalview.binding.Annotation.class, reader); + } + + /** + * + * + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void validate( + ) + throws org.exolab.castor.xml.ValidationException { + org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); + validator.validate(this); } - } - - /** - * Sets the value of field 'description'. - * - * @param description - * the value of field 'description'. - */ - public void setDescription(final java.lang.String description) - { - this._description = description; - } - - /** - * Sets the value of field 'graph'. - * - * @param graph - * the value of field 'graph'. - */ - public void setGraph(final boolean graph) - { - this._graph = graph; - this._has_graph = true; - } - - /** - * Sets the value of field 'graphType'. - * - * @param graphType - * the value of field 'graphType'. - */ - public void setGraphType(final int graphType) - { - this._graphType = graphType; - this._has_graphType = true; - } - - /** - * Sets the value of field 'label'. - * - * @param label - * the value of field 'label'. - */ - public void setLabel(final java.lang.String label) - { - this._label = label; - } - - /** - * Method unmarshal. - * - * @param reader - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - * @return the unmarshaled jalview.binding.Annotation - */ - public static jalview.binding.Annotation unmarshal( - final java.io.Reader reader) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - return (jalview.binding.Annotation) Unmarshaller.unmarshal( - jalview.binding.Annotation.class, reader); - } - - /** - * - * - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - */ - public void validate() throws org.exolab.castor.xml.ValidationException - { - org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); - validator.validate(this); - } } diff --git a/src/jalview/binding/AnnotationElement.java b/src/jalview/binding/AnnotationElement.java index 7bd3d43..d133fe0 100644 --- a/src/jalview/binding/AnnotationElement.java +++ b/src/jalview/binding/AnnotationElement.java @@ -1,27 +1,14 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) - * Copyright (C) $$Year-Rel$$ The Jalview Authors - * - * This file is part of Jalview. - * - * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. - * - * Jalview is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Jalview. If not, see . - * The Jalview Authors are detailed in the 'AUTHORS' file. + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ */ + package jalview.binding; -//---------------------------------/ -//- Imported classes and packages -/ + //---------------------------------/ + //- Imported classes and packages -/ //---------------------------------/ import org.exolab.castor.xml.Marshaller; @@ -32,287 +19,273 @@ import org.exolab.castor.xml.Unmarshaller; * * @version $Revision$ $Date$ */ -public class AnnotationElement implements java.io.Serializable -{ - - // --------------------------/ - // - Class/Member Variables -/ - // --------------------------/ - - /** - * Field _position. - */ - private int _position; - - /** - * keeps track of state for field: _position - */ - private boolean _has_position; - - /** - * Field _displayCharacter. - */ - private java.lang.String _displayCharacter; - - /** - * Field _description. - */ - private java.lang.String _description; - - /** - * Field _secondaryStructure. - */ - private java.lang.String _secondaryStructure; - - /** - * Field _value. - */ - private float _value; - - /** - * keeps track of state for field: _value - */ - private boolean _has_value; - - // ----------------/ - // - Constructors -/ - // ----------------/ - - public AnnotationElement() - { - super(); - } - - // -----------/ - // - Methods -/ - // -----------/ - - /** +public class AnnotationElement implements java.io.Serializable { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field _position. + */ + private int _position; + + /** + * keeps track of state for field: _position + */ + private boolean _has_position; + + /** + * Field _displayCharacter. + */ + private java.lang.String _displayCharacter; + + /** + * Field _description. + */ + private java.lang.String _description; + + /** + * Field _secondaryStructure. + */ + private java.lang.String _secondaryStructure; + + /** + * Field _value. + */ + private float _value; + + /** + * keeps track of state for field: _value + */ + private boolean _has_value; + + + //----------------/ + //- Constructors -/ + //----------------/ + + public AnnotationElement() { + super(); + } + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + */ + public void deletePosition( + ) { + this._has_position= false; + } + + /** + */ + public void deleteValue( + ) { + this._has_value= false; + } + + /** + * Returns the value of field 'description'. + * + * @return the value of field 'Description'. + */ + public java.lang.String getDescription( + ) { + return this._description; + } + + /** + * Returns the value of field 'displayCharacter'. + * + * @return the value of field 'DisplayCharacter'. + */ + public java.lang.String getDisplayCharacter( + ) { + return this._displayCharacter; + } + + /** + * Returns the value of field 'position'. + * + * @return the value of field 'Position'. */ - public void deletePosition() - { - this._has_position = false; - } + public int getPosition( + ) { + return this._position; + } + + /** + * Returns the value of field 'secondaryStructure'. + * + * @return the value of field 'SecondaryStructure'. + */ + public java.lang.String getSecondaryStructure( + ) { + return this._secondaryStructure; + } + + /** + * Returns the value of field 'value'. + * + * @return the value of field 'Value'. + */ + public float getValue( + ) { + return this._value; + } + + /** + * Method hasPosition. + * + * @return true if at least one Position has been added + */ + public boolean hasPosition( + ) { + return this._has_position; + } + + /** + * Method hasValue. + * + * @return true if at least one Value has been added + */ + public boolean hasValue( + ) { + return this._has_value; + } + + /** + * Method isValid. + * + * @return true if this object is valid according to the schema + */ + public boolean isValid( + ) { + try { + validate(); + } catch (org.exolab.castor.xml.ValidationException vex) { + return false; + } + return true; + } + + /** + * + * + * @param out + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void marshal( + final java.io.Writer out) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, out); + } + + /** + * + * + * @param handler + * @throws java.io.IOException if an IOException occurs during + * marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + */ + public void marshal( + final org.xml.sax.ContentHandler handler) + throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, handler); + } + + /** + * Sets the value of field 'description'. + * + * @param description the value of field 'description'. + */ + public void setDescription( + final java.lang.String description) { + this._description = description; + } + + /** + * Sets the value of field 'displayCharacter'. + * + * @param displayCharacter the value of field 'displayCharacter' + */ + public void setDisplayCharacter( + final java.lang.String displayCharacter) { + this._displayCharacter = displayCharacter; + } + + /** + * Sets the value of field 'position'. + * + * @param position the value of field 'position'. + */ + public void setPosition( + final int position) { + this._position = position; + this._has_position = true; + } + + /** + * Sets the value of field 'secondaryStructure'. + * + * @param secondaryStructure the value of field + * 'secondaryStructure'. + */ + public void setSecondaryStructure( + final java.lang.String secondaryStructure) { + this._secondaryStructure = secondaryStructure; + } + + /** + * Sets the value of field 'value'. + * + * @param value the value of field 'value'. + */ + public void setValue( + final float value) { + this._value = value; + this._has_value = true; + } + + /** + * Method unmarshal. + * + * @param reader + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @return the unmarshaled jalview.binding.AnnotationElement + */ + public static jalview.binding.AnnotationElement unmarshal( + final java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + return (jalview.binding.AnnotationElement) Unmarshaller.unmarshal(jalview.binding.AnnotationElement.class, reader); + } - /** + /** + * + * + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema */ - public void deleteValue() - { - this._has_value = false; - } - - /** - * Returns the value of field 'description'. - * - * @return the value of field 'Description'. - */ - public java.lang.String getDescription() - { - return this._description; - } - - /** - * Returns the value of field 'displayCharacter'. - * - * @return the value of field 'DisplayCharacter'. - */ - public java.lang.String getDisplayCharacter() - { - return this._displayCharacter; - } - - /** - * Returns the value of field 'position'. - * - * @return the value of field 'Position'. - */ - public int getPosition() - { - return this._position; - } - - /** - * Returns the value of field 'secondaryStructure'. - * - * @return the value of field 'SecondaryStructure'. - */ - public java.lang.String getSecondaryStructure() - { - return this._secondaryStructure; - } - - /** - * Returns the value of field 'value'. - * - * @return the value of field 'Value'. - */ - public float getValue() - { - return this._value; - } - - /** - * Method hasPosition. - * - * @return true if at least one Position has been added - */ - public boolean hasPosition() - { - return this._has_position; - } - - /** - * Method hasValue. - * - * @return true if at least one Value has been added - */ - public boolean hasValue() - { - return this._has_value; - } - - /** - * Method isValid. - * - * @return true if this object is valid according to the schema - */ - public boolean isValid() - { - try - { - validate(); - } catch (org.exolab.castor.xml.ValidationException vex) - { - return false; + public void validate( + ) + throws org.exolab.castor.xml.ValidationException { + org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); + validator.validate(this); } - return true; - } - - /** - * - * - * @param out - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - */ - public void marshal(final java.io.Writer out) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - Marshaller.marshal(this, out); - } - - /** - * - * - * @param handler - * @throws java.io.IOException - * if an IOException occurs during marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - */ - public void marshal(final org.xml.sax.ContentHandler handler) - throws java.io.IOException, - org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - Marshaller.marshal(this, handler); - } - - /** - * Sets the value of field 'description'. - * - * @param description - * the value of field 'description'. - */ - public void setDescription(final java.lang.String description) - { - this._description = description; - } - - /** - * Sets the value of field 'displayCharacter'. - * - * @param displayCharacter - * the value of field 'displayCharacter' - */ - public void setDisplayCharacter(final java.lang.String displayCharacter) - { - this._displayCharacter = displayCharacter; - } - - /** - * Sets the value of field 'position'. - * - * @param position - * the value of field 'position'. - */ - public void setPosition(final int position) - { - this._position = position; - this._has_position = true; - } - - /** - * Sets the value of field 'secondaryStructure'. - * - * @param secondaryStructure - * the value of field 'secondaryStructure'. - */ - public void setSecondaryStructure( - final java.lang.String secondaryStructure) - { - this._secondaryStructure = secondaryStructure; - } - - /** - * Sets the value of field 'value'. - * - * @param value - * the value of field 'value'. - */ - public void setValue(final float value) - { - this._value = value; - this._has_value = true; - } - - /** - * Method unmarshal. - * - * @param reader - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - * @return the unmarshaled jalview.binding.AnnotationElement - */ - public static jalview.binding.AnnotationElement unmarshal( - final java.io.Reader reader) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - return (jalview.binding.AnnotationElement) Unmarshaller.unmarshal( - jalview.binding.AnnotationElement.class, reader); - } - - /** - * - * - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - */ - public void validate() throws org.exolab.castor.xml.ValidationException - { - org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); - validator.validate(this); - } } diff --git a/src/jalview/binding/Colour.java b/src/jalview/binding/Colour.java index f761ac1..c041723 100644 --- a/src/jalview/binding/Colour.java +++ b/src/jalview/binding/Colour.java @@ -1,27 +1,14 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) - * Copyright (C) $$Year-Rel$$ The Jalview Authors - * - * This file is part of Jalview. - * - * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. - * - * Jalview is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Jalview. If not, see . - * The Jalview Authors are detailed in the 'AUTHORS' file. + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ */ + package jalview.binding; -//---------------------------------/ -//- Imported classes and packages -/ + //---------------------------------/ + //- Imported classes and packages -/ //---------------------------------/ import org.exolab.castor.xml.Marshaller; @@ -32,480 +19,465 @@ import org.exolab.castor.xml.Unmarshaller; * * @version $Revision$ $Date$ */ -public class Colour implements java.io.Serializable -{ - - // --------------------------/ - // - Class/Member Variables -/ - // --------------------------/ - - /** - * Field _name. - */ - private java.lang.String _name; - - /** - * Field _RGB. - */ - private java.lang.String _RGB; - - /** - * Field _minRGB. - */ - private java.lang.String _minRGB; - - /** - * loosely specified enumeration: NONE,ABOVE, or BELOW - */ - private java.lang.String _threshType; - - /** - * Field _threshold. - */ - private float _threshold; - - /** - * keeps track of state for field: _threshold - */ - private boolean _has_threshold; - - /** - * Field _max. - */ - private float _max; - - /** - * keeps track of state for field: _max - */ - private boolean _has_max; - - /** - * Field _min. - */ - private float _min; - - /** - * keeps track of state for field: _min - */ - private boolean _has_min; - - /** - * Field _colourByLabel. - */ - private boolean _colourByLabel; - - /** - * keeps track of state for field: _colourByLabel - */ - private boolean _has_colourByLabel; - - /** - * Field _autoScale. - */ - private boolean _autoScale; - - /** - * keeps track of state for field: _autoScale - */ - private boolean _has_autoScale; - - // ----------------/ - // - Constructors -/ - // ----------------/ - - public Colour() - { - super(); - } - - // -----------/ - // - Methods -/ - // -----------/ - - /** - */ - public void deleteAutoScale() - { - this._has_autoScale = false; - } - - /** - */ - public void deleteColourByLabel() - { - this._has_colourByLabel = false; - } - - /** - */ - public void deleteMax() - { - this._has_max = false; - } - - /** - */ - public void deleteMin() - { - this._has_min = false; - } - - /** - */ - public void deleteThreshold() - { - this._has_threshold = false; - } - - /** - * Returns the value of field 'autoScale'. - * - * @return the value of field 'AutoScale'. - */ - public boolean getAutoScale() - { - return this._autoScale; - } - - /** - * Returns the value of field 'colourByLabel'. - * - * @return the value of field 'ColourByLabel'. - */ - public boolean getColourByLabel() - { - return this._colourByLabel; - } - - /** - * Returns the value of field 'max'. - * - * @return the value of field 'Max'. - */ - public float getMax() - { - return this._max; - } - - /** - * Returns the value of field 'min'. - * - * @return the value of field 'Min'. - */ - public float getMin() - { - return this._min; - } - - /** - * Returns the value of field 'minRGB'. - * - * @return the value of field 'MinRGB'. - */ - public java.lang.String getMinRGB() - { - return this._minRGB; - } - - /** - * Returns the value of field 'name'. - * - * @return the value of field 'Name'. - */ - public java.lang.String getName() - { - return this._name; - } - - /** - * Returns the value of field 'RGB'. - * - * @return the value of field 'RGB'. - */ - public java.lang.String getRGB() - { - return this._RGB; - } - - /** - * Returns the value of field 'threshType'. The field 'threshType' has the - * following description: loosely specified enumeration: NONE,ABOVE, or BELOW - * - * @return the value of field 'ThreshType'. - */ - public java.lang.String getThreshType() - { - return this._threshType; - } - - /** - * Returns the value of field 'threshold'. - * - * @return the value of field 'Threshold'. - */ - public float getThreshold() - { - return this._threshold; - } - - /** - * Method hasAutoScale. - * - * @return true if at least one AutoScale has been added - */ - public boolean hasAutoScale() - { - return this._has_autoScale; - } - - /** - * Method hasColourByLabel. - * - * @return true if at least one ColourByLabel has been added - */ - public boolean hasColourByLabel() - { - return this._has_colourByLabel; - } - - /** - * Method hasMax. - * - * @return true if at least one Max has been added - */ - public boolean hasMax() - { - return this._has_max; - } - - /** - * Method hasMin. - * - * @return true if at least one Min has been added - */ - public boolean hasMin() - { - return this._has_min; - } - - /** - * Method hasThreshold. - * - * @return true if at least one Threshold has been added - */ - public boolean hasThreshold() - { - return this._has_threshold; - } - - /** - * Returns the value of field 'autoScale'. - * - * @return the value of field 'AutoScale'. - */ - public boolean isAutoScale() - { - return this._autoScale; - } - - /** - * Returns the value of field 'colourByLabel'. - * - * @return the value of field 'ColourByLabel'. - */ - public boolean isColourByLabel() - { - return this._colourByLabel; - } - - /** - * Method isValid. - * - * @return true if this object is valid according to the schema - */ - public boolean isValid() - { - try - { - validate(); - } catch (org.exolab.castor.xml.ValidationException vex) - { - return false; - } - return true; - } - - /** - * - * - * @param out - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - */ - public void marshal(final java.io.Writer out) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - Marshaller.marshal(this, out); - } - - /** - * - * - * @param handler - * @throws java.io.IOException - * if an IOException occurs during marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - */ - public void marshal(final org.xml.sax.ContentHandler handler) - throws java.io.IOException, - org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - Marshaller.marshal(this, handler); - } - - /** - * Sets the value of field 'autoScale'. - * - * @param autoScale - * the value of field 'autoScale'. - */ - public void setAutoScale(final boolean autoScale) - { - this._autoScale = autoScale; - this._has_autoScale = true; - } - - /** - * Sets the value of field 'colourByLabel'. - * - * @param colourByLabel - * the value of field 'colourByLabel'. - */ - public void setColourByLabel(final boolean colourByLabel) - { - this._colourByLabel = colourByLabel; - this._has_colourByLabel = true; - } - - /** - * Sets the value of field 'max'. - * - * @param max - * the value of field 'max'. - */ - public void setMax(final float max) - { - this._max = max; - this._has_max = true; - } - - /** - * Sets the value of field 'min'. - * - * @param min - * the value of field 'min'. - */ - public void setMin(final float min) - { - this._min = min; - this._has_min = true; - } - - /** - * Sets the value of field 'minRGB'. - * - * @param minRGB - * the value of field 'minRGB'. - */ - public void setMinRGB(final java.lang.String minRGB) - { - this._minRGB = minRGB; - } - - /** - * Sets the value of field 'name'. - * - * @param name - * the value of field 'name'. - */ - public void setName(final java.lang.String name) - { - this._name = name; - } - - /** - * Sets the value of field 'RGB'. - * - * @param RGB - * the value of field 'RGB'. - */ - public void setRGB(final java.lang.String RGB) - { - this._RGB = RGB; - } - - /** - * Sets the value of field 'threshType'. The field 'threshType' has the - * following description: loosely specified enumeration: NONE,ABOVE, or BELOW - * - * @param threshType - * the value of field 'threshType'. - */ - public void setThreshType(final java.lang.String threshType) - { - this._threshType = threshType; - } - - /** - * Sets the value of field 'threshold'. - * - * @param threshold - * the value of field 'threshold'. - */ - public void setThreshold(final float threshold) - { - this._threshold = threshold; - this._has_threshold = true; - } - - /** - * Method unmarshal. - * - * @param reader - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - * @return the unmarshaled jalview.binding.Colour - */ - public static jalview.binding.Colour unmarshal(final java.io.Reader reader) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - return (jalview.binding.Colour) Unmarshaller.unmarshal( - jalview.binding.Colour.class, reader); - } - - /** - * - * - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - */ - public void validate() throws org.exolab.castor.xml.ValidationException - { - org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); - validator.validate(this); - } +public class Colour implements java.io.Serializable { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field _name. + */ + private java.lang.String _name; + + /** + * Field _RGB. + */ + private java.lang.String _RGB; + + /** + * Field _minRGB. + */ + private java.lang.String _minRGB; + + /** + * loosely specified enumeration: NONE,ABOVE, or BELOW + */ + private java.lang.String _threshType; + + /** + * Field _threshold. + */ + private float _threshold; + + /** + * keeps track of state for field: _threshold + */ + private boolean _has_threshold; + + /** + * Field _max. + */ + private float _max; + + /** + * keeps track of state for field: _max + */ + private boolean _has_max; + + /** + * Field _min. + */ + private float _min; + + /** + * keeps track of state for field: _min + */ + private boolean _has_min; + + /** + * Field _colourByLabel. + */ + private boolean _colourByLabel; + + /** + * keeps track of state for field: _colourByLabel + */ + private boolean _has_colourByLabel; + + /** + * Field _autoScale. + */ + private boolean _autoScale; + + /** + * keeps track of state for field: _autoScale + */ + private boolean _has_autoScale; + + + //----------------/ + //- Constructors -/ + //----------------/ + + public Colour() { + super(); + } + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + */ + public void deleteAutoScale( + ) { + this._has_autoScale= false; + } + + /** + */ + public void deleteColourByLabel( + ) { + this._has_colourByLabel= false; + } + + /** + */ + public void deleteMax( + ) { + this._has_max= false; + } + + /** + */ + public void deleteMin( + ) { + this._has_min= false; + } + + /** + */ + public void deleteThreshold( + ) { + this._has_threshold= false; + } + + /** + * Returns the value of field 'autoScale'. + * + * @return the value of field 'AutoScale'. + */ + public boolean getAutoScale( + ) { + return this._autoScale; + } + + /** + * Returns the value of field 'colourByLabel'. + * + * @return the value of field 'ColourByLabel'. + */ + public boolean getColourByLabel( + ) { + return this._colourByLabel; + } + + /** + * Returns the value of field 'max'. + * + * @return the value of field 'Max'. + */ + public float getMax( + ) { + return this._max; + } + + /** + * Returns the value of field 'min'. + * + * @return the value of field 'Min'. + */ + public float getMin( + ) { + return this._min; + } + + /** + * Returns the value of field 'minRGB'. + * + * @return the value of field 'MinRGB'. + */ + public java.lang.String getMinRGB( + ) { + return this._minRGB; + } + + /** + * Returns the value of field 'name'. + * + * @return the value of field 'Name'. + */ + public java.lang.String getName( + ) { + return this._name; + } + + /** + * Returns the value of field 'RGB'. + * + * @return the value of field 'RGB'. + */ + public java.lang.String getRGB( + ) { + return this._RGB; + } + + /** + * Returns the value of field 'threshType'. The field + * 'threshType' has the following description: loosely + * specified enumeration: NONE,ABOVE, or BELOW + * + * @return the value of field 'ThreshType'. + */ + public java.lang.String getThreshType( + ) { + return this._threshType; + } + + /** + * Returns the value of field 'threshold'. + * + * @return the value of field 'Threshold'. + */ + public float getThreshold( + ) { + return this._threshold; + } + + /** + * Method hasAutoScale. + * + * @return true if at least one AutoScale has been added + */ + public boolean hasAutoScale( + ) { + return this._has_autoScale; + } + + /** + * Method hasColourByLabel. + * + * @return true if at least one ColourByLabel has been added + */ + public boolean hasColourByLabel( + ) { + return this._has_colourByLabel; + } + + /** + * Method hasMax. + * + * @return true if at least one Max has been added + */ + public boolean hasMax( + ) { + return this._has_max; + } + + /** + * Method hasMin. + * + * @return true if at least one Min has been added + */ + public boolean hasMin( + ) { + return this._has_min; + } + + /** + * Method hasThreshold. + * + * @return true if at least one Threshold has been added + */ + public boolean hasThreshold( + ) { + return this._has_threshold; + } + + /** + * Returns the value of field 'autoScale'. + * + * @return the value of field 'AutoScale'. + */ + public boolean isAutoScale( + ) { + return this._autoScale; + } + + /** + * Returns the value of field 'colourByLabel'. + * + * @return the value of field 'ColourByLabel'. + */ + public boolean isColourByLabel( + ) { + return this._colourByLabel; + } + + /** + * Method isValid. + * + * @return true if this object is valid according to the schema + */ + public boolean isValid( + ) { + try { + validate(); + } catch (org.exolab.castor.xml.ValidationException vex) { + return false; + } + return true; + } + + /** + * + * + * @param out + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void marshal( + final java.io.Writer out) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, out); + } + + /** + * + * + * @param handler + * @throws java.io.IOException if an IOException occurs during + * marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + */ + public void marshal( + final org.xml.sax.ContentHandler handler) + throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, handler); + } + + /** + * Sets the value of field 'autoScale'. + * + * @param autoScale the value of field 'autoScale'. + */ + public void setAutoScale( + final boolean autoScale) { + this._autoScale = autoScale; + this._has_autoScale = true; + } + + /** + * Sets the value of field 'colourByLabel'. + * + * @param colourByLabel the value of field 'colourByLabel'. + */ + public void setColourByLabel( + final boolean colourByLabel) { + this._colourByLabel = colourByLabel; + this._has_colourByLabel = true; + } + + /** + * Sets the value of field 'max'. + * + * @param max the value of field 'max'. + */ + public void setMax( + final float max) { + this._max = max; + this._has_max = true; + } + + /** + * Sets the value of field 'min'. + * + * @param min the value of field 'min'. + */ + public void setMin( + final float min) { + this._min = min; + this._has_min = true; + } + + /** + * Sets the value of field 'minRGB'. + * + * @param minRGB the value of field 'minRGB'. + */ + public void setMinRGB( + final java.lang.String minRGB) { + this._minRGB = minRGB; + } + + /** + * Sets the value of field 'name'. + * + * @param name the value of field 'name'. + */ + public void setName( + final java.lang.String name) { + this._name = name; + } + + /** + * Sets the value of field 'RGB'. + * + * @param RGB the value of field 'RGB'. + */ + public void setRGB( + final java.lang.String RGB) { + this._RGB = RGB; + } + + /** + * Sets the value of field 'threshType'. The field 'threshType' + * has the following description: loosely specified + * enumeration: NONE,ABOVE, or BELOW + * + * @param threshType the value of field 'threshType'. + */ + public void setThreshType( + final java.lang.String threshType) { + this._threshType = threshType; + } + + /** + * Sets the value of field 'threshold'. + * + * @param threshold the value of field 'threshold'. + */ + public void setThreshold( + final float threshold) { + this._threshold = threshold; + this._has_threshold = true; + } + + /** + * Method unmarshal. + * + * @param reader + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @return the unmarshaled jalview.binding.Colour + */ + public static jalview.binding.Colour unmarshal( + final java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + return (jalview.binding.Colour) Unmarshaller.unmarshal(jalview.binding.Colour.class, reader); + } + + /** + * + * + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void validate( + ) + throws org.exolab.castor.xml.ValidationException { + org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); + validator.validate(this); + } } diff --git a/src/jalview/binding/Feature.java b/src/jalview/binding/Feature.java index ccc0d82..d429df3 100644 --- a/src/jalview/binding/Feature.java +++ b/src/jalview/binding/Feature.java @@ -1,27 +1,14 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) - * Copyright (C) $$Year-Rel$$ The Jalview Authors - * - * This file is part of Jalview. - * - * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. - * - * Jalview is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Jalview. If not, see . - * The Jalview Authors are detailed in the 'AUTHORS' file. + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ */ + package jalview.binding; -//---------------------------------/ -//- Imported classes and packages -/ + //---------------------------------/ + //- Imported classes and packages -/ //---------------------------------/ import org.exolab.castor.xml.Marshaller; @@ -32,286 +19,272 @@ import org.exolab.castor.xml.Unmarshaller; * * @version $Revision$ $Date$ */ -public class Feature implements java.io.Serializable -{ - - // --------------------------/ - // - Class/Member Variables -/ - // --------------------------/ - - /** - * Field _begin. - */ - private int _begin; - - /** - * keeps track of state for field: _begin - */ - private boolean _has_begin; - - /** - * Field _end. - */ - private int _end; - - /** - * keeps track of state for field: _end - */ - private boolean _has_end; - - /** - * Field _type. - */ - private java.lang.String _type; - - /** - * Field _description. - */ - private java.lang.String _description; - - /** - * Field _status. - */ - private java.lang.String _status; - - // ----------------/ - // - Constructors -/ - // ----------------/ - - public Feature() - { - super(); - } - - // -----------/ - // - Methods -/ - // -----------/ - - /** +public class Feature implements java.io.Serializable { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field _begin. + */ + private int _begin; + + /** + * keeps track of state for field: _begin + */ + private boolean _has_begin; + + /** + * Field _end. + */ + private int _end; + + /** + * keeps track of state for field: _end + */ + private boolean _has_end; + + /** + * Field _type. + */ + private java.lang.String _type; + + /** + * Field _description. + */ + private java.lang.String _description; + + /** + * Field _status. + */ + private java.lang.String _status; + + + //----------------/ + //- Constructors -/ + //----------------/ + + public Feature() { + super(); + } + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + */ + public void deleteBegin( + ) { + this._has_begin= false; + } + + /** + */ + public void deleteEnd( + ) { + this._has_end= false; + } + + /** + * Returns the value of field 'begin'. + * + * @return the value of field 'Begin'. + */ + public int getBegin( + ) { + return this._begin; + } + + /** + * Returns the value of field 'description'. + * + * @return the value of field 'Description'. + */ + public java.lang.String getDescription( + ) { + return this._description; + } + + /** + * Returns the value of field 'end'. + * + * @return the value of field 'End'. */ - public void deleteBegin() - { - this._has_begin = false; - } + public int getEnd( + ) { + return this._end; + } + + /** + * Returns the value of field 'status'. + * + * @return the value of field 'Status'. + */ + public java.lang.String getStatus( + ) { + return this._status; + } + + /** + * Returns the value of field 'type'. + * + * @return the value of field 'Type'. + */ + public java.lang.String getType( + ) { + return this._type; + } + + /** + * Method hasBegin. + * + * @return true if at least one Begin has been added + */ + public boolean hasBegin( + ) { + return this._has_begin; + } + + /** + * Method hasEnd. + * + * @return true if at least one End has been added + */ + public boolean hasEnd( + ) { + return this._has_end; + } + + /** + * Method isValid. + * + * @return true if this object is valid according to the schema + */ + public boolean isValid( + ) { + try { + validate(); + } catch (org.exolab.castor.xml.ValidationException vex) { + return false; + } + return true; + } + + /** + * + * + * @param out + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void marshal( + final java.io.Writer out) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, out); + } + + /** + * + * + * @param handler + * @throws java.io.IOException if an IOException occurs during + * marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + */ + public void marshal( + final org.xml.sax.ContentHandler handler) + throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, handler); + } + + /** + * Sets the value of field 'begin'. + * + * @param begin the value of field 'begin'. + */ + public void setBegin( + final int begin) { + this._begin = begin; + this._has_begin = true; + } + + /** + * Sets the value of field 'description'. + * + * @param description the value of field 'description'. + */ + public void setDescription( + final java.lang.String description) { + this._description = description; + } + + /** + * Sets the value of field 'end'. + * + * @param end the value of field 'end'. + */ + public void setEnd( + final int end) { + this._end = end; + this._has_end = true; + } + + /** + * Sets the value of field 'status'. + * + * @param status the value of field 'status'. + */ + public void setStatus( + final java.lang.String status) { + this._status = status; + } + + /** + * Sets the value of field 'type'. + * + * @param type the value of field 'type'. + */ + public void setType( + final java.lang.String type) { + this._type = type; + } + + /** + * Method unmarshal. + * + * @param reader + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @return the unmarshaled jalview.binding.Feature + */ + public static jalview.binding.Feature unmarshal( + final java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + return (jalview.binding.Feature) Unmarshaller.unmarshal(jalview.binding.Feature.class, reader); + } - /** + /** + * + * + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema */ - public void deleteEnd() - { - this._has_end = false; - } - - /** - * Returns the value of field 'begin'. - * - * @return the value of field 'Begin'. - */ - public int getBegin() - { - return this._begin; - } - - /** - * Returns the value of field 'description'. - * - * @return the value of field 'Description'. - */ - public java.lang.String getDescription() - { - return this._description; - } - - /** - * Returns the value of field 'end'. - * - * @return the value of field 'End'. - */ - public int getEnd() - { - return this._end; - } - - /** - * Returns the value of field 'status'. - * - * @return the value of field 'Status'. - */ - public java.lang.String getStatus() - { - return this._status; - } - - /** - * Returns the value of field 'type'. - * - * @return the value of field 'Type'. - */ - public java.lang.String getType() - { - return this._type; - } - - /** - * Method hasBegin. - * - * @return true if at least one Begin has been added - */ - public boolean hasBegin() - { - return this._has_begin; - } - - /** - * Method hasEnd. - * - * @return true if at least one End has been added - */ - public boolean hasEnd() - { - return this._has_end; - } - - /** - * Method isValid. - * - * @return true if this object is valid according to the schema - */ - public boolean isValid() - { - try - { - validate(); - } catch (org.exolab.castor.xml.ValidationException vex) - { - return false; + public void validate( + ) + throws org.exolab.castor.xml.ValidationException { + org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); + validator.validate(this); } - return true; - } - - /** - * - * - * @param out - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - */ - public void marshal(final java.io.Writer out) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - Marshaller.marshal(this, out); - } - - /** - * - * - * @param handler - * @throws java.io.IOException - * if an IOException occurs during marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - */ - public void marshal(final org.xml.sax.ContentHandler handler) - throws java.io.IOException, - org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - Marshaller.marshal(this, handler); - } - - /** - * Sets the value of field 'begin'. - * - * @param begin - * the value of field 'begin'. - */ - public void setBegin(final int begin) - { - this._begin = begin; - this._has_begin = true; - } - - /** - * Sets the value of field 'description'. - * - * @param description - * the value of field 'description'. - */ - public void setDescription(final java.lang.String description) - { - this._description = description; - } - - /** - * Sets the value of field 'end'. - * - * @param end - * the value of field 'end'. - */ - public void setEnd(final int end) - { - this._end = end; - this._has_end = true; - } - - /** - * Sets the value of field 'status'. - * - * @param status - * the value of field 'status'. - */ - public void setStatus(final java.lang.String status) - { - this._status = status; - } - - /** - * Sets the value of field 'type'. - * - * @param type - * the value of field 'type'. - */ - public void setType(final java.lang.String type) - { - this._type = type; - } - - /** - * Method unmarshal. - * - * @param reader - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - * @return the unmarshaled jalview.binding.Feature - */ - public static jalview.binding.Feature unmarshal( - final java.io.Reader reader) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - return (jalview.binding.Feature) Unmarshaller.unmarshal( - jalview.binding.Feature.class, reader); - } - - /** - * - * - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - */ - public void validate() throws org.exolab.castor.xml.ValidationException - { - org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); - validator.validate(this); - } } diff --git a/src/jalview/binding/FeatureSettings.java b/src/jalview/binding/FeatureSettings.java index 0ce377c..f3d06be 100644 --- a/src/jalview/binding/FeatureSettings.java +++ b/src/jalview/binding/FeatureSettings.java @@ -1,31 +1,16 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) - * Copyright (C) $$Year-Rel$$ The Jalview Authors - * - * This file is part of Jalview. - * - * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. - * - * Jalview is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Jalview. If not, see . - * The Jalview Authors are detailed in the 'AUTHORS' file. + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ */ + package jalview.binding; -//---------------------------------/ -//- Imported classes and packages -/ + //---------------------------------/ + //- Imported classes and packages -/ //---------------------------------/ -import jalview.util.MessageManager; - import org.exolab.castor.xml.Marshaller; import org.exolab.castor.xml.Unmarshaller; @@ -34,275 +19,257 @@ import org.exolab.castor.xml.Unmarshaller; * * @version $Revision$ $Date$ */ -public class FeatureSettings implements java.io.Serializable -{ +public class FeatureSettings implements java.io.Serializable { - // --------------------------/ - // - Class/Member Variables -/ - // --------------------------/ - /** - * Field _settingList. - */ - private java.util.Vector _settingList; + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ - // ----------------/ - // - Constructors -/ - // ----------------/ + /** + * Field _settingList. + */ + private java.util.Vector _settingList; - public FeatureSettings() - { - super(); - this._settingList = new java.util.Vector(); - } - // -----------/ - // - Methods -/ - // -----------/ + //----------------/ + //- Constructors -/ + //----------------/ - /** - * - * - * @param vSetting - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void addSetting(final jalview.binding.Setting vSetting) - throws java.lang.IndexOutOfBoundsException - { - this._settingList.addElement(vSetting); - } + public FeatureSettings() { + super(); + this._settingList = new java.util.Vector(); + } - /** - * - * - * @param index - * @param vSetting - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void addSetting(final int index, - final jalview.binding.Setting vSetting) - throws java.lang.IndexOutOfBoundsException - { - this._settingList.add(index, vSetting); - } - /** - * Method enumerateSetting. - * - * @return an Enumeration over all jalview.binding.Setting elements - */ - public java.util.Enumeration enumerateSetting() - { - return this._settingList.elements(); - } + //-----------/ + //- Methods -/ + //-----------/ - /** - * Method getSetting. - * - * @param index - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - * @return the value of the jalview.binding.Setting at the given index - */ - public jalview.binding.Setting getSetting(final int index) - throws java.lang.IndexOutOfBoundsException - { - // check bounds for index - if (index < 0 || index >= this._settingList.size()) - { - throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{ - "getSetting", - Integer.valueOf(index).toString(), - Integer.valueOf((this._settingList.size() - 1)).toString() - })); + /** + * + * + * @param vSetting + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addSetting( + final jalview.binding.Setting vSetting) + throws java.lang.IndexOutOfBoundsException { + this._settingList.addElement(vSetting); } - return (jalview.binding.Setting) _settingList.get(index); - } + /** + * + * + * @param index + * @param vSetting + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addSetting( + final int index, + final jalview.binding.Setting vSetting) + throws java.lang.IndexOutOfBoundsException { + this._settingList.add(index, vSetting); + } - /** - * Method getSetting.Returns the contents of the collection in an Array. - *

    - * Note: Just in case the collection contents are changing in another thread, - * we pass a 0-length Array of the correct type into the API call. This way we - * know that the Array returned is of exactly the correct length. - * - * @return this collection as an Array - */ - public jalview.binding.Setting[] getSetting() - { - jalview.binding.Setting[] array = new jalview.binding.Setting[0]; - return (jalview.binding.Setting[]) this._settingList.toArray(array); - } + /** + * Method enumerateSetting. + * + * @return an Enumeration over all jalview.binding.Setting + * elements + */ + public java.util.Enumeration enumerateSetting( + ) { + return this._settingList.elements(); + } - /** - * Method getSettingCount. - * - * @return the size of this collection - */ - public int getSettingCount() - { - return this._settingList.size(); - } + /** + * Method getSetting. + * + * @param index + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + * @return the value of the jalview.binding.Setting at the + * given index + */ + public jalview.binding.Setting getSetting( + final int index) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._settingList.size()) { + throw new IndexOutOfBoundsException("getSetting: Index value '" + index + "' not in range [0.." + (this._settingList.size() - 1) + "]"); + } + + return (jalview.binding.Setting) _settingList.get(index); + } - /** - * Method isValid. - * - * @return true if this object is valid according to the schema - */ - public boolean isValid() - { - try - { - validate(); - } catch (org.exolab.castor.xml.ValidationException vex) - { - return false; + /** + * Method getSetting.Returns the contents of the collection in + * an Array.

    Note: Just in case the collection contents + * are changing in another thread, we pass a 0-length Array of + * the correct type into the API call. This way we know + * that the Array returned is of exactly the correct length. + * + * @return this collection as an Array + */ + public jalview.binding.Setting[] getSetting( + ) { + jalview.binding.Setting[] array = new jalview.binding.Setting[0]; + return (jalview.binding.Setting[]) this._settingList.toArray(array); } - return true; - } - /** - * - * - * @param out - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - */ - public void marshal(final java.io.Writer out) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - Marshaller.marshal(this, out); - } + /** + * Method getSettingCount. + * + * @return the size of this collection + */ + public int getSettingCount( + ) { + return this._settingList.size(); + } - /** - * - * - * @param handler - * @throws java.io.IOException - * if an IOException occurs during marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - */ - public void marshal(final org.xml.sax.ContentHandler handler) - throws java.io.IOException, - org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - Marshaller.marshal(this, handler); - } + /** + * Method isValid. + * + * @return true if this object is valid according to the schema + */ + public boolean isValid( + ) { + try { + validate(); + } catch (org.exolab.castor.xml.ValidationException vex) { + return false; + } + return true; + } - /** + /** + * + * + * @param out + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema */ - public void removeAllSetting() - { - this._settingList.clear(); - } + public void marshal( + final java.io.Writer out) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, out); + } - /** - * Method removeSetting. - * - * @param vSetting - * @return true if the object was removed from the collection. - */ - public boolean removeSetting(final jalview.binding.Setting vSetting) - { - boolean removed = _settingList.remove(vSetting); - return removed; - } + /** + * + * + * @param handler + * @throws java.io.IOException if an IOException occurs during + * marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + */ + public void marshal( + final org.xml.sax.ContentHandler handler) + throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, handler); + } - /** - * Method removeSettingAt. - * - * @param index - * @return the element removed from the collection - */ - public jalview.binding.Setting removeSettingAt(final int index) - { - java.lang.Object obj = this._settingList.remove(index); - return (jalview.binding.Setting) obj; - } + /** + */ + public void removeAllSetting( + ) { + this._settingList.clear(); + } - /** - * - * - * @param index - * @param vSetting - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void setSetting(final int index, - final jalview.binding.Setting vSetting) - throws java.lang.IndexOutOfBoundsException - { - // check bounds for index - if (index < 0 || index >= this._settingList.size()) - { - throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{ - "setSetting", - Integer.valueOf(index).toString(), - Integer.valueOf((this._settingList.size() - 1)).toString() - })); + /** + * Method removeSetting. + * + * @param vSetting + * @return true if the object was removed from the collection. + */ + public boolean removeSetting( + final jalview.binding.Setting vSetting) { + boolean removed = _settingList.remove(vSetting); + return removed; } - this._settingList.set(index, vSetting); - } + /** + * Method removeSettingAt. + * + * @param index + * @return the element removed from the collection + */ + public jalview.binding.Setting removeSettingAt( + final int index) { + java.lang.Object obj = this._settingList.remove(index); + return (jalview.binding.Setting) obj; + } - /** - * - * - * @param vSettingArray - */ - public void setSetting(final jalview.binding.Setting[] vSettingArray) - { - // -- copy array - _settingList.clear(); + /** + * + * + * @param index + * @param vSetting + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void setSetting( + final int index, + final jalview.binding.Setting vSetting) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._settingList.size()) { + throw new IndexOutOfBoundsException("setSetting: Index value '" + index + "' not in range [0.." + (this._settingList.size() - 1) + "]"); + } + + this._settingList.set(index, vSetting); + } - for (int i = 0; i < vSettingArray.length; i++) - { - this._settingList.add(vSettingArray[i]); + /** + * + * + * @param vSettingArray + */ + public void setSetting( + final jalview.binding.Setting[] vSettingArray) { + //-- copy array + _settingList.clear(); + + for (int i = 0; i < vSettingArray.length; i++) { + this._settingList.add(vSettingArray[i]); + } } - } - /** - * Method unmarshal. - * - * @param reader - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - * @return the unmarshaled jalview.binding.FeatureSettings - */ - public static jalview.binding.FeatureSettings unmarshal( - final java.io.Reader reader) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - return (jalview.binding.FeatureSettings) Unmarshaller.unmarshal( - jalview.binding.FeatureSettings.class, reader); - } + /** + * Method unmarshal. + * + * @param reader + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @return the unmarshaled jalview.binding.FeatureSettings + */ + public static jalview.binding.FeatureSettings unmarshal( + final java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + return (jalview.binding.FeatureSettings) Unmarshaller.unmarshal(jalview.binding.FeatureSettings.class, reader); + } - /** - * - * - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - */ - public void validate() throws org.exolab.castor.xml.ValidationException - { - org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); - validator.validate(this); - } + /** + * + * + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void validate( + ) + throws org.exolab.castor.xml.ValidationException { + org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); + validator.validate(this); + } } diff --git a/src/jalview/binding/Features.java b/src/jalview/binding/Features.java index 6d398c1..e50ae7c 100644 --- a/src/jalview/binding/Features.java +++ b/src/jalview/binding/Features.java @@ -1,27 +1,14 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) - * Copyright (C) $$Year-Rel$$ The Jalview Authors - * - * This file is part of Jalview. - * - * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. - * - * Jalview is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Jalview. If not, see . - * The Jalview Authors are detailed in the 'AUTHORS' file. + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ */ + package jalview.binding; -//---------------------------------/ -//- Imported classes and packages -/ + //---------------------------------/ + //- Imported classes and packages -/ //---------------------------------/ import org.exolab.castor.xml.Marshaller; @@ -32,106 +19,98 @@ import org.exolab.castor.xml.Unmarshaller; * * @version $Revision$ $Date$ */ -public class Features extends Feature implements java.io.Serializable +public class Features extends Feature +implements java.io.Serializable { - // ----------------/ - // - Constructors -/ - // ----------------/ - public Features() - { - super(); - } + //----------------/ + //- Constructors -/ + //----------------/ + + public Features() { + super(); + } + - // -----------/ - // - Methods -/ - // -----------/ + //-----------/ + //- Methods -/ + //-----------/ - /** - * Method isValid. - * - * @return true if this object is valid according to the schema - */ - public boolean isValid() - { - try - { - validate(); - } catch (org.exolab.castor.xml.ValidationException vex) - { - return false; + /** + * Method isValid. + * + * @return true if this object is valid according to the schema + */ + public boolean isValid( + ) { + try { + validate(); + } catch (org.exolab.castor.xml.ValidationException vex) { + return false; + } + return true; } - return true; - } - /** - * - * - * @param out - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - */ - public void marshal(final java.io.Writer out) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - Marshaller.marshal(this, out); - } + /** + * + * + * @param out + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void marshal( + final java.io.Writer out) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, out); + } - /** - * - * - * @param handler - * @throws java.io.IOException - * if an IOException occurs during marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - */ - public void marshal(final org.xml.sax.ContentHandler handler) - throws java.io.IOException, - org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - Marshaller.marshal(this, handler); - } + /** + * + * + * @param handler + * @throws java.io.IOException if an IOException occurs during + * marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + */ + public void marshal( + final org.xml.sax.ContentHandler handler) + throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, handler); + } - /** - * Method unmarshal. - * - * @param reader - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - * @return the unmarshaled jalview.binding.Feature - */ - public static jalview.binding.Feature unmarshal( - final java.io.Reader reader) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - return (jalview.binding.Feature) Unmarshaller.unmarshal( - jalview.binding.Features.class, reader); - } + /** + * Method unmarshal. + * + * @param reader + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @return the unmarshaled jalview.binding.Feature + */ + public static jalview.binding.Feature unmarshal( + final java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + return (jalview.binding.Feature) Unmarshaller.unmarshal(jalview.binding.Features.class, reader); + } - /** - * - * - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - */ - public void validate() throws org.exolab.castor.xml.ValidationException - { - org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); - validator.validate(this); - } + /** + * + * + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void validate( + ) + throws org.exolab.castor.xml.ValidationException { + org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); + validator.validate(this); + } } diff --git a/src/jalview/binding/JGroup.java b/src/jalview/binding/JGroup.java index c1f9cd3..862eebd 100644 --- a/src/jalview/binding/JGroup.java +++ b/src/jalview/binding/JGroup.java @@ -1,30 +1,15 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) - * Copyright (C) $$Year-Rel$$ The Jalview Authors - * - * This file is part of Jalview. - * - * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. - * - * Jalview is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Jalview. If not, see . - * The Jalview Authors are detailed in the 'AUTHORS' file. + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ */ + package jalview.binding; + //---------------------------------/ + //- Imported classes and packages -/ //---------------------------------/ -//- Imported classes and packages -/ -//---------------------------------/ - -import jalview.util.MessageManager; import org.exolab.castor.xml.Marshaller; import org.exolab.castor.xml.Unmarshaller; @@ -34,748 +19,721 @@ import org.exolab.castor.xml.Unmarshaller; * * @version $Revision$ $Date$ */ -public class JGroup implements java.io.Serializable -{ - - // --------------------------/ - // - Class/Member Variables -/ - // --------------------------/ - - /** - * Field _start. - */ - private int _start; - - /** - * keeps track of state for field: _start - */ - private boolean _has_start; - - /** - * Field _end. - */ - private int _end; - - /** - * keeps track of state for field: _end - */ - private boolean _has_end; - - /** - * Field _name. - */ - private java.lang.String _name; - - /** - * Field _colour. - */ - private java.lang.String _colour; - - /** - * Field _consThreshold. - */ - private int _consThreshold; - - /** - * keeps track of state for field: _consThreshold - */ - private boolean _has_consThreshold; - - /** - * Field _pidThreshold. - */ - private int _pidThreshold; - - /** - * keeps track of state for field: _pidThreshold - */ - private boolean _has_pidThreshold; - - /** - * Field _outlineColour. - */ - private int _outlineColour; - - /** - * keeps track of state for field: _outlineColour - */ - private boolean _has_outlineColour; - - /** - * Field _displayBoxes. - */ - private boolean _displayBoxes; - - /** - * keeps track of state for field: _displayBoxes - */ - private boolean _has_displayBoxes; - - /** - * Field _displayText. - */ - private boolean _displayText; - - /** - * keeps track of state for field: _displayText - */ - private boolean _has_displayText; - - /** - * Field _colourText. - */ - private boolean _colourText; - - /** - * keeps track of state for field: _colourText - */ - private boolean _has_colourText; - - /** - * Field _seqList. - */ - private java.util.Vector _seqList; - - // ----------------/ - // - Constructors -/ - // ----------------/ - - public JGroup() - { - super(); - this._seqList = new java.util.Vector(); - } - - // -----------/ - // - Methods -/ - // -----------/ - - /** - * - * - * @param vSeq - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void addSeq(final int vSeq) - throws java.lang.IndexOutOfBoundsException - { - this._seqList.addElement(new java.lang.Integer(vSeq)); - } - - /** - * - * - * @param index - * @param vSeq - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void addSeq(final int index, final int vSeq) - throws java.lang.IndexOutOfBoundsException - { - this._seqList.add(index, new java.lang.Integer(vSeq)); - } - - /** - */ - public void deleteColourText() - { - this._has_colourText = false; - } - - /** - */ - public void deleteConsThreshold() - { - this._has_consThreshold = false; - } - - /** - */ - public void deleteDisplayBoxes() - { - this._has_displayBoxes = false; - } - - /** - */ - public void deleteDisplayText() - { - this._has_displayText = false; - } - - /** - */ - public void deleteEnd() - { - this._has_end = false; - } - - /** - */ - public void deleteOutlineColour() - { - this._has_outlineColour = false; - } - - /** - */ - public void deletePidThreshold() - { - this._has_pidThreshold = false; - } - - /** - */ - public void deleteStart() - { - this._has_start = false; - } - - /** - * Method enumerateSeq. - * - * @return an Enumeration over all int elements - */ - public java.util.Enumeration enumerateSeq() - { - return this._seqList.elements(); - } - - /** - * Returns the value of field 'colour'. - * - * @return the value of field 'Colour'. - */ - public java.lang.String getColour() - { - return this._colour; - } - - /** - * Returns the value of field 'colourText'. - * - * @return the value of field 'ColourText'. - */ - public boolean getColourText() - { - return this._colourText; - } - - /** - * Returns the value of field 'consThreshold'. - * - * @return the value of field 'ConsThreshold'. - */ - public int getConsThreshold() - { - return this._consThreshold; - } - - /** - * Returns the value of field 'displayBoxes'. - * - * @return the value of field 'DisplayBoxes'. - */ - public boolean getDisplayBoxes() - { - return this._displayBoxes; - } - - /** - * Returns the value of field 'displayText'. - * - * @return the value of field 'DisplayText'. - */ - public boolean getDisplayText() - { - return this._displayText; - } - - /** - * Returns the value of field 'end'. - * - * @return the value of field 'End'. - */ - public int getEnd() - { - return this._end; - } - - /** - * Returns the value of field 'name'. - * - * @return the value of field 'Name'. - */ - public java.lang.String getName() - { - return this._name; - } - - /** - * Returns the value of field 'outlineColour'. - * - * @return the value of field 'OutlineColour'. - */ - public int getOutlineColour() - { - return this._outlineColour; - } - - /** - * Returns the value of field 'pidThreshold'. - * - * @return the value of field 'PidThreshold'. - */ - public int getPidThreshold() - { - return this._pidThreshold; - } - - /** - * Method getSeq. - * - * @param index - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - * @return the value of the int at the given index - */ - public int getSeq(final int index) - throws java.lang.IndexOutOfBoundsException - { - // check bounds for index - if (index < 0 || index >= this._seqList.size()) - { - throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{ - "getSeq", - Integer.valueOf(index).toString(), - Integer.valueOf((this._seqList.size() - 1)).toString() - })); - } - - return ((java.lang.Integer) _seqList.get(index)).intValue(); - } - - /** - * Method getSeq.Returns the contents of the collection in an Array. - * - * @return this collection as an Array - */ - public int[] getSeq() - { - int size = this._seqList.size(); - int[] array = new int[size]; - java.util.Iterator iter = _seqList.iterator(); - for (int index = 0; index < size; index++) - { - array[index] = ((java.lang.Integer) iter.next()).intValue(); - } - return array; - } - - /** - * Method getSeqCount. - * - * @return the size of this collection - */ - public int getSeqCount() - { - return this._seqList.size(); - } - - /** - * Returns the value of field 'start'. - * - * @return the value of field 'Start'. - */ - public int getStart() - { - return this._start; - } - - /** - * Method hasColourText. - * - * @return true if at least one ColourText has been added - */ - public boolean hasColourText() - { - return this._has_colourText; - } - - /** - * Method hasConsThreshold. - * - * @return true if at least one ConsThreshold has been added - */ - public boolean hasConsThreshold() - { - return this._has_consThreshold; - } - - /** - * Method hasDisplayBoxes. - * - * @return true if at least one DisplayBoxes has been added - */ - public boolean hasDisplayBoxes() - { - return this._has_displayBoxes; - } - - /** - * Method hasDisplayText. - * - * @return true if at least one DisplayText has been added - */ - public boolean hasDisplayText() - { - return this._has_displayText; - } - - /** - * Method hasEnd. - * - * @return true if at least one End has been added - */ - public boolean hasEnd() - { - return this._has_end; - } - - /** - * Method hasOutlineColour. - * - * @return true if at least one OutlineColour has been added - */ - public boolean hasOutlineColour() - { - return this._has_outlineColour; - } - - /** - * Method hasPidThreshold. - * - * @return true if at least one PidThreshold has been added - */ - public boolean hasPidThreshold() - { - return this._has_pidThreshold; - } - - /** - * Method hasStart. - * - * @return true if at least one Start has been added - */ - public boolean hasStart() - { - return this._has_start; - } - - /** - * Returns the value of field 'colourText'. - * - * @return the value of field 'ColourText'. - */ - public boolean isColourText() - { - return this._colourText; - } - - /** - * Returns the value of field 'displayBoxes'. - * - * @return the value of field 'DisplayBoxes'. - */ - public boolean isDisplayBoxes() - { - return this._displayBoxes; - } - - /** - * Returns the value of field 'displayText'. - * - * @return the value of field 'DisplayText'. - */ - public boolean isDisplayText() - { - return this._displayText; - } - - /** - * Method isValid. - * - * @return true if this object is valid according to the schema - */ - public boolean isValid() - { - try - { - validate(); - } catch (org.exolab.castor.xml.ValidationException vex) - { - return false; - } - return true; - } - - /** - * - * - * @param out - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - */ - public void marshal(final java.io.Writer out) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - Marshaller.marshal(this, out); - } - - /** - * - * - * @param handler - * @throws java.io.IOException - * if an IOException occurs during marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - */ - public void marshal(final org.xml.sax.ContentHandler handler) - throws java.io.IOException, - org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - Marshaller.marshal(this, handler); - } - - /** - */ - public void removeAllSeq() - { - this._seqList.clear(); - } - - /** - * Method removeSeq. - * - * @param vSeq - * @return true if the object was removed from the collection. - */ - public boolean removeSeq(final int vSeq) - { - boolean removed = _seqList.remove(new java.lang.Integer(vSeq)); - return removed; - } - - /** - * Method removeSeqAt. - * - * @param index - * @return the element removed from the collection - */ - public int removeSeqAt(final int index) - { - java.lang.Object obj = this._seqList.remove(index); - return ((java.lang.Integer) obj).intValue(); - } - - /** - * Sets the value of field 'colour'. - * - * @param colour - * the value of field 'colour'. - */ - public void setColour(final java.lang.String colour) - { - this._colour = colour; - } - - /** - * Sets the value of field 'colourText'. - * - * @param colourText - * the value of field 'colourText'. - */ - public void setColourText(final boolean colourText) - { - this._colourText = colourText; - this._has_colourText = true; - } - - /** - * Sets the value of field 'consThreshold'. - * - * @param consThreshold - * the value of field 'consThreshold'. - */ - public void setConsThreshold(final int consThreshold) - { - this._consThreshold = consThreshold; - this._has_consThreshold = true; - } - - /** - * Sets the value of field 'displayBoxes'. - * - * @param displayBoxes - * the value of field 'displayBoxes'. - */ - public void setDisplayBoxes(final boolean displayBoxes) - { - this._displayBoxes = displayBoxes; - this._has_displayBoxes = true; - } - - /** - * Sets the value of field 'displayText'. - * - * @param displayText - * the value of field 'displayText'. - */ - public void setDisplayText(final boolean displayText) - { - this._displayText = displayText; - this._has_displayText = true; - } - - /** - * Sets the value of field 'end'. - * - * @param end - * the value of field 'end'. - */ - public void setEnd(final int end) - { - this._end = end; - this._has_end = true; - } - - /** - * Sets the value of field 'name'. - * - * @param name - * the value of field 'name'. - */ - public void setName(final java.lang.String name) - { - this._name = name; - } - - /** - * Sets the value of field 'outlineColour'. - * - * @param outlineColour - * the value of field 'outlineColour'. - */ - public void setOutlineColour(final int outlineColour) - { - this._outlineColour = outlineColour; - this._has_outlineColour = true; - } - - /** - * Sets the value of field 'pidThreshold'. - * - * @param pidThreshold - * the value of field 'pidThreshold'. - */ - public void setPidThreshold(final int pidThreshold) - { - this._pidThreshold = pidThreshold; - this._has_pidThreshold = true; - } - - /** - * - * - * @param index - * @param vSeq - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void setSeq(final int index, final int vSeq) - throws java.lang.IndexOutOfBoundsException - { - // check bounds for index - if (index < 0 || index >= this._seqList.size()) - { - throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{ - "setSeq", - Integer.valueOf(index).toString(), - Integer.valueOf((this._seqList.size() - 1)).toString() - })); - } - - this._seqList.set(index, new java.lang.Integer(vSeq)); - } - - /** - * - * - * @param vSeqArray - */ - public void setSeq(final int[] vSeqArray) - { - // -- copy array - _seqList.clear(); - - for (int i = 0; i < vSeqArray.length; i++) - { - this._seqList.add(new java.lang.Integer(vSeqArray[i])); - } - } - - /** - * Sets the value of field 'start'. - * - * @param start - * the value of field 'start'. - */ - public void setStart(final int start) - { - this._start = start; - this._has_start = true; - } - - /** - * Method unmarshal. - * - * @param reader - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - * @return the unmarshaled jalview.binding.JGroup - */ - public static jalview.binding.JGroup unmarshal(final java.io.Reader reader) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - return (jalview.binding.JGroup) Unmarshaller.unmarshal( - jalview.binding.JGroup.class, reader); - } - - /** - * - * - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - */ - public void validate() throws org.exolab.castor.xml.ValidationException - { - org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); - validator.validate(this); - } +public class JGroup implements java.io.Serializable { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field _start. + */ + private int _start; + + /** + * keeps track of state for field: _start + */ + private boolean _has_start; + + /** + * Field _end. + */ + private int _end; + + /** + * keeps track of state for field: _end + */ + private boolean _has_end; + + /** + * Field _name. + */ + private java.lang.String _name; + + /** + * Field _colour. + */ + private java.lang.String _colour; + + /** + * Field _consThreshold. + */ + private int _consThreshold; + + /** + * keeps track of state for field: _consThreshold + */ + private boolean _has_consThreshold; + + /** + * Field _pidThreshold. + */ + private int _pidThreshold; + + /** + * keeps track of state for field: _pidThreshold + */ + private boolean _has_pidThreshold; + + /** + * Field _outlineColour. + */ + private int _outlineColour; + + /** + * keeps track of state for field: _outlineColour + */ + private boolean _has_outlineColour; + + /** + * Field _displayBoxes. + */ + private boolean _displayBoxes; + + /** + * keeps track of state for field: _displayBoxes + */ + private boolean _has_displayBoxes; + + /** + * Field _displayText. + */ + private boolean _displayText; + + /** + * keeps track of state for field: _displayText + */ + private boolean _has_displayText; + + /** + * Field _colourText. + */ + private boolean _colourText; + + /** + * keeps track of state for field: _colourText + */ + private boolean _has_colourText; + + /** + * Field _seqList. + */ + private java.util.Vector _seqList; + + + //----------------/ + //- Constructors -/ + //----------------/ + + public JGroup() { + super(); + this._seqList = new java.util.Vector(); + } + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * + * + * @param vSeq + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addSeq( + final int vSeq) + throws java.lang.IndexOutOfBoundsException { + this._seqList.addElement(new java.lang.Integer(vSeq)); + } + + /** + * + * + * @param index + * @param vSeq + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addSeq( + final int index, + final int vSeq) + throws java.lang.IndexOutOfBoundsException { + this._seqList.add(index, new java.lang.Integer(vSeq)); + } + + /** + */ + public void deleteColourText( + ) { + this._has_colourText= false; + } + + /** + */ + public void deleteConsThreshold( + ) { + this._has_consThreshold= false; + } + + /** + */ + public void deleteDisplayBoxes( + ) { + this._has_displayBoxes= false; + } + + /** + */ + public void deleteDisplayText( + ) { + this._has_displayText= false; + } + + /** + */ + public void deleteEnd( + ) { + this._has_end= false; + } + + /** + */ + public void deleteOutlineColour( + ) { + this._has_outlineColour= false; + } + + /** + */ + public void deletePidThreshold( + ) { + this._has_pidThreshold= false; + } + + /** + */ + public void deleteStart( + ) { + this._has_start= false; + } + + /** + * Method enumerateSeq. + * + * @return an Enumeration over all int elements + */ + public java.util.Enumeration enumerateSeq( + ) { + return this._seqList.elements(); + } + + /** + * Returns the value of field 'colour'. + * + * @return the value of field 'Colour'. + */ + public java.lang.String getColour( + ) { + return this._colour; + } + + /** + * Returns the value of field 'colourText'. + * + * @return the value of field 'ColourText'. + */ + public boolean getColourText( + ) { + return this._colourText; + } + + /** + * Returns the value of field 'consThreshold'. + * + * @return the value of field 'ConsThreshold'. + */ + public int getConsThreshold( + ) { + return this._consThreshold; + } + + /** + * Returns the value of field 'displayBoxes'. + * + * @return the value of field 'DisplayBoxes'. + */ + public boolean getDisplayBoxes( + ) { + return this._displayBoxes; + } + + /** + * Returns the value of field 'displayText'. + * + * @return the value of field 'DisplayText'. + */ + public boolean getDisplayText( + ) { + return this._displayText; + } + + /** + * Returns the value of field 'end'. + * + * @return the value of field 'End'. + */ + public int getEnd( + ) { + return this._end; + } + + /** + * Returns the value of field 'name'. + * + * @return the value of field 'Name'. + */ + public java.lang.String getName( + ) { + return this._name; + } + + /** + * Returns the value of field 'outlineColour'. + * + * @return the value of field 'OutlineColour'. + */ + public int getOutlineColour( + ) { + return this._outlineColour; + } + + /** + * Returns the value of field 'pidThreshold'. + * + * @return the value of field 'PidThreshold'. + */ + public int getPidThreshold( + ) { + return this._pidThreshold; + } + + /** + * Method getSeq. + * + * @param index + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + * @return the value of the int at the given index + */ + public int getSeq( + final int index) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._seqList.size()) { + throw new IndexOutOfBoundsException("getSeq: Index value '" + index + "' not in range [0.." + (this._seqList.size() - 1) + "]"); + } + + return ((java.lang.Integer) _seqList.get(index)).intValue(); + } + + /** + * Method getSeq.Returns the contents of the collection in an + * Array. + * + * @return this collection as an Array + */ + public int[] getSeq( + ) { + int size = this._seqList.size(); + int[] array = new int[size]; + java.util.Iterator iter = _seqList.iterator(); + for (int index = 0; index < size; index++) { + array[index] = ((java.lang.Integer) iter.next()).intValue(); + } + return array; + } + + /** + * Method getSeqCount. + * + * @return the size of this collection + */ + public int getSeqCount( + ) { + return this._seqList.size(); + } + + /** + * Returns the value of field 'start'. + * + * @return the value of field 'Start'. + */ + public int getStart( + ) { + return this._start; + } + + /** + * Method hasColourText. + * + * @return true if at least one ColourText has been added + */ + public boolean hasColourText( + ) { + return this._has_colourText; + } + + /** + * Method hasConsThreshold. + * + * @return true if at least one ConsThreshold has been added + */ + public boolean hasConsThreshold( + ) { + return this._has_consThreshold; + } + + /** + * Method hasDisplayBoxes. + * + * @return true if at least one DisplayBoxes has been added + */ + public boolean hasDisplayBoxes( + ) { + return this._has_displayBoxes; + } + + /** + * Method hasDisplayText. + * + * @return true if at least one DisplayText has been added + */ + public boolean hasDisplayText( + ) { + return this._has_displayText; + } + + /** + * Method hasEnd. + * + * @return true if at least one End has been added + */ + public boolean hasEnd( + ) { + return this._has_end; + } + + /** + * Method hasOutlineColour. + * + * @return true if at least one OutlineColour has been added + */ + public boolean hasOutlineColour( + ) { + return this._has_outlineColour; + } + + /** + * Method hasPidThreshold. + * + * @return true if at least one PidThreshold has been added + */ + public boolean hasPidThreshold( + ) { + return this._has_pidThreshold; + } + + /** + * Method hasStart. + * + * @return true if at least one Start has been added + */ + public boolean hasStart( + ) { + return this._has_start; + } + + /** + * Returns the value of field 'colourText'. + * + * @return the value of field 'ColourText'. + */ + public boolean isColourText( + ) { + return this._colourText; + } + + /** + * Returns the value of field 'displayBoxes'. + * + * @return the value of field 'DisplayBoxes'. + */ + public boolean isDisplayBoxes( + ) { + return this._displayBoxes; + } + + /** + * Returns the value of field 'displayText'. + * + * @return the value of field 'DisplayText'. + */ + public boolean isDisplayText( + ) { + return this._displayText; + } + + /** + * Method isValid. + * + * @return true if this object is valid according to the schema + */ + public boolean isValid( + ) { + try { + validate(); + } catch (org.exolab.castor.xml.ValidationException vex) { + return false; + } + return true; + } + + /** + * + * + * @param out + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void marshal( + final java.io.Writer out) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, out); + } + + /** + * + * + * @param handler + * @throws java.io.IOException if an IOException occurs during + * marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + */ + public void marshal( + final org.xml.sax.ContentHandler handler) + throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, handler); + } + + /** + */ + public void removeAllSeq( + ) { + this._seqList.clear(); + } + + /** + * Method removeSeq. + * + * @param vSeq + * @return true if the object was removed from the collection. + */ + public boolean removeSeq( + final int vSeq) { + boolean removed = _seqList.remove(new java.lang.Integer(vSeq)); + return removed; + } + + /** + * Method removeSeqAt. + * + * @param index + * @return the element removed from the collection + */ + public int removeSeqAt( + final int index) { + java.lang.Object obj = this._seqList.remove(index); + return ((java.lang.Integer) obj).intValue(); + } + + /** + * Sets the value of field 'colour'. + * + * @param colour the value of field 'colour'. + */ + public void setColour( + final java.lang.String colour) { + this._colour = colour; + } + + /** + * Sets the value of field 'colourText'. + * + * @param colourText the value of field 'colourText'. + */ + public void setColourText( + final boolean colourText) { + this._colourText = colourText; + this._has_colourText = true; + } + + /** + * Sets the value of field 'consThreshold'. + * + * @param consThreshold the value of field 'consThreshold'. + */ + public void setConsThreshold( + final int consThreshold) { + this._consThreshold = consThreshold; + this._has_consThreshold = true; + } + + /** + * Sets the value of field 'displayBoxes'. + * + * @param displayBoxes the value of field 'displayBoxes'. + */ + public void setDisplayBoxes( + final boolean displayBoxes) { + this._displayBoxes = displayBoxes; + this._has_displayBoxes = true; + } + + /** + * Sets the value of field 'displayText'. + * + * @param displayText the value of field 'displayText'. + */ + public void setDisplayText( + final boolean displayText) { + this._displayText = displayText; + this._has_displayText = true; + } + + /** + * Sets the value of field 'end'. + * + * @param end the value of field 'end'. + */ + public void setEnd( + final int end) { + this._end = end; + this._has_end = true; + } + + /** + * Sets the value of field 'name'. + * + * @param name the value of field 'name'. + */ + public void setName( + final java.lang.String name) { + this._name = name; + } + + /** + * Sets the value of field 'outlineColour'. + * + * @param outlineColour the value of field 'outlineColour'. + */ + public void setOutlineColour( + final int outlineColour) { + this._outlineColour = outlineColour; + this._has_outlineColour = true; + } + + /** + * Sets the value of field 'pidThreshold'. + * + * @param pidThreshold the value of field 'pidThreshold'. + */ + public void setPidThreshold( + final int pidThreshold) { + this._pidThreshold = pidThreshold; + this._has_pidThreshold = true; + } + + /** + * + * + * @param index + * @param vSeq + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void setSeq( + final int index, + final int vSeq) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._seqList.size()) { + throw new IndexOutOfBoundsException("setSeq: Index value '" + index + "' not in range [0.." + (this._seqList.size() - 1) + "]"); + } + + this._seqList.set(index, new java.lang.Integer(vSeq)); + } + + /** + * + * + * @param vSeqArray + */ + public void setSeq( + final int[] vSeqArray) { + //-- copy array + _seqList.clear(); + + for (int i = 0; i < vSeqArray.length; i++) { + this._seqList.add(new java.lang.Integer(vSeqArray[i])); + } + } + + /** + * Sets the value of field 'start'. + * + * @param start the value of field 'start'. + */ + public void setStart( + final int start) { + this._start = start; + this._has_start = true; + } + + /** + * Method unmarshal. + * + * @param reader + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @return the unmarshaled jalview.binding.JGroup + */ + public static jalview.binding.JGroup unmarshal( + final java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + return (jalview.binding.JGroup) Unmarshaller.unmarshal(jalview.binding.JGroup.class, reader); + } + + /** + * + * + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void validate( + ) + throws org.exolab.castor.xml.ValidationException { + org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); + validator.validate(this); + } } diff --git a/src/jalview/binding/JSeq.java b/src/jalview/binding/JSeq.java index 68d545f..14b1f2f 100644 --- a/src/jalview/binding/JSeq.java +++ b/src/jalview/binding/JSeq.java @@ -1,30 +1,15 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) - * Copyright (C) $$Year-Rel$$ The Jalview Authors - * - * This file is part of Jalview. - * - * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. - * - * Jalview is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Jalview. If not, see . - * The Jalview Authors are detailed in the 'AUTHORS' file. + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ */ + package jalview.binding; + //---------------------------------/ + //- Imported classes and packages -/ //---------------------------------/ -//- Imported classes and packages -/ -//---------------------------------/ - -import jalview.util.MessageManager; import org.exolab.castor.xml.Marshaller; import org.exolab.castor.xml.Unmarshaller; @@ -34,635 +19,605 @@ import org.exolab.castor.xml.Unmarshaller; * * @version $Revision$ $Date$ */ -public class JSeq implements java.io.Serializable -{ - - // --------------------------/ - // - Class/Member Variables -/ - // --------------------------/ - - /** - * Field _colour. - */ - private int _colour; - - /** - * keeps track of state for field: _colour - */ - private boolean _has_colour; - - /** - * Field _start. - */ - private int _start; - - /** - * keeps track of state for field: _start - */ - private boolean _has_start; - - /** - * Field _end. - */ - private int _end; - - /** - * keeps track of state for field: _end - */ - private boolean _has_end; - - /** - * Field _id. - */ - private int _id; - - /** - * keeps track of state for field: _id - */ - private boolean _has_id; - - /** - * Field _featuresList. - */ - private java.util.Vector _featuresList; - - /** - * Field _pdbidsList. - */ - private java.util.Vector _pdbidsList; - - // ----------------/ - // - Constructors -/ - // ----------------/ - - public JSeq() - { - super(); - this._featuresList = new java.util.Vector(); - this._pdbidsList = new java.util.Vector(); - } - - // -----------/ - // - Methods -/ - // -----------/ - - /** - * - * - * @param vFeatures - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void addFeatures(final jalview.binding.Features vFeatures) - throws java.lang.IndexOutOfBoundsException - { - this._featuresList.addElement(vFeatures); - } - - /** - * - * - * @param index - * @param vFeatures - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void addFeatures(final int index, - final jalview.binding.Features vFeatures) - throws java.lang.IndexOutOfBoundsException - { - this._featuresList.add(index, vFeatures); - } - - /** - * - * - * @param vPdbids - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void addPdbids(final jalview.binding.Pdbids vPdbids) - throws java.lang.IndexOutOfBoundsException - { - this._pdbidsList.addElement(vPdbids); - } - - /** - * - * - * @param index - * @param vPdbids - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void addPdbids(final int index, - final jalview.binding.Pdbids vPdbids) - throws java.lang.IndexOutOfBoundsException - { - this._pdbidsList.add(index, vPdbids); - } - - /** - */ - public void deleteColour() - { - this._has_colour = false; - } - - /** - */ - public void deleteEnd() - { - this._has_end = false; - } - - /** - */ - public void deleteId() - { - this._has_id = false; - } - - /** - */ - public void deleteStart() - { - this._has_start = false; - } - - /** - * Method enumerateFeatures. - * - * @return an Enumeration over all jalview.binding.Features elements - */ - public java.util.Enumeration enumerateFeatures() - { - return this._featuresList.elements(); - } - - /** - * Method enumeratePdbids. - * - * @return an Enumeration over all jalview.binding.Pdbids elements - */ - public java.util.Enumeration enumeratePdbids() - { - return this._pdbidsList.elements(); - } - - /** - * Returns the value of field 'colour'. - * - * @return the value of field 'Colour'. - */ - public int getColour() - { - return this._colour; - } - - /** - * Returns the value of field 'end'. - * - * @return the value of field 'End'. - */ - public int getEnd() - { - return this._end; - } - - /** - * Method getFeatures. - * - * @param index - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - * @return the value of the jalview.binding.Features at the given index - */ - public jalview.binding.Features getFeatures(final int index) - throws java.lang.IndexOutOfBoundsException - { - // check bounds for index - if (index < 0 || index >= this._featuresList.size()) - { - throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{ - "getFeatures", - Integer.valueOf(index).toString(), - Integer.valueOf((this._featuresList.size() - 1)).toString() - })); - } - - return (jalview.binding.Features) _featuresList.get(index); - } - - /** - * Method getFeatures.Returns the contents of the collection in an Array. - *

    - * Note: Just in case the collection contents are changing in another thread, - * we pass a 0-length Array of the correct type into the API call. This way we - * know that the Array returned is of exactly the correct length. - * - * @return this collection as an Array - */ - public jalview.binding.Features[] getFeatures() - { - jalview.binding.Features[] array = new jalview.binding.Features[0]; - return (jalview.binding.Features[]) this._featuresList.toArray(array); - } - - /** - * Method getFeaturesCount. - * - * @return the size of this collection - */ - public int getFeaturesCount() - { - return this._featuresList.size(); - } - - /** - * Returns the value of field 'id'. - * - * @return the value of field 'Id'. - */ - public int getId() - { - return this._id; - } - - /** - * Method getPdbids. - * - * @param index - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - * @return the value of the jalview.binding.Pdbids at the given index - */ - public jalview.binding.Pdbids getPdbids(final int index) - throws java.lang.IndexOutOfBoundsException - { - // check bounds for index - if (index < 0 || index >= this._pdbidsList.size()) - { - throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{ - "getPdbids", - Integer.valueOf(index).toString(), - Integer.valueOf((this._pdbidsList.size() - 1)).toString() - })); - } - - return (jalview.binding.Pdbids) _pdbidsList.get(index); - } - - /** - * Method getPdbids.Returns the contents of the collection in an Array. - *

    - * Note: Just in case the collection contents are changing in another thread, - * we pass a 0-length Array of the correct type into the API call. This way we - * know that the Array returned is of exactly the correct length. - * - * @return this collection as an Array - */ - public jalview.binding.Pdbids[] getPdbids() - { - jalview.binding.Pdbids[] array = new jalview.binding.Pdbids[0]; - return (jalview.binding.Pdbids[]) this._pdbidsList.toArray(array); - } - - /** - * Method getPdbidsCount. - * - * @return the size of this collection - */ - public int getPdbidsCount() - { - return this._pdbidsList.size(); - } - - /** - * Returns the value of field 'start'. - * - * @return the value of field 'Start'. - */ - public int getStart() - { - return this._start; - } - - /** - * Method hasColour. - * - * @return true if at least one Colour has been added - */ - public boolean hasColour() - { - return this._has_colour; - } - - /** - * Method hasEnd. - * - * @return true if at least one End has been added - */ - public boolean hasEnd() - { - return this._has_end; - } - - /** - * Method hasId. - * - * @return true if at least one Id has been added - */ - public boolean hasId() - { - return this._has_id; - } - - /** - * Method hasStart. - * - * @return true if at least one Start has been added - */ - public boolean hasStart() - { - return this._has_start; - } - - /** - * Method isValid. - * - * @return true if this object is valid according to the schema - */ - public boolean isValid() - { - try - { - validate(); - } catch (org.exolab.castor.xml.ValidationException vex) - { - return false; - } - return true; - } - - /** - * - * - * @param out - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - */ - public void marshal(final java.io.Writer out) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - Marshaller.marshal(this, out); - } - - /** - * - * - * @param handler - * @throws java.io.IOException - * if an IOException occurs during marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - */ - public void marshal(final org.xml.sax.ContentHandler handler) - throws java.io.IOException, - org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - Marshaller.marshal(this, handler); - } - - /** - */ - public void removeAllFeatures() - { - this._featuresList.clear(); - } - - /** - */ - public void removeAllPdbids() - { - this._pdbidsList.clear(); - } - - /** - * Method removeFeatures. - * - * @param vFeatures - * @return true if the object was removed from the collection. - */ - public boolean removeFeatures(final jalview.binding.Features vFeatures) - { - boolean removed = _featuresList.remove(vFeatures); - return removed; - } - - /** - * Method removeFeaturesAt. - * - * @param index - * @return the element removed from the collection - */ - public jalview.binding.Features removeFeaturesAt(final int index) - { - java.lang.Object obj = this._featuresList.remove(index); - return (jalview.binding.Features) obj; - } - - /** - * Method removePdbids. - * - * @param vPdbids - * @return true if the object was removed from the collection. - */ - public boolean removePdbids(final jalview.binding.Pdbids vPdbids) - { - boolean removed = _pdbidsList.remove(vPdbids); - return removed; - } - - /** - * Method removePdbidsAt. - * - * @param index - * @return the element removed from the collection - */ - public jalview.binding.Pdbids removePdbidsAt(final int index) - { - java.lang.Object obj = this._pdbidsList.remove(index); - return (jalview.binding.Pdbids) obj; - } - - /** - * Sets the value of field 'colour'. - * - * @param colour - * the value of field 'colour'. - */ - public void setColour(final int colour) - { - this._colour = colour; - this._has_colour = true; - } - - /** - * Sets the value of field 'end'. - * - * @param end - * the value of field 'end'. - */ - public void setEnd(final int end) - { - this._end = end; - this._has_end = true; - } - - /** - * - * - * @param index - * @param vFeatures - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void setFeatures(final int index, - final jalview.binding.Features vFeatures) - throws java.lang.IndexOutOfBoundsException - { - // check bounds for index - if (index < 0 || index >= this._featuresList.size()) - { - throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{ - "setFeatures", - Integer.valueOf(index).toString(), - Integer.valueOf((this._featuresList.size() - 1)).toString() - })); - } - - this._featuresList.set(index, vFeatures); - } - - /** - * - * - * @param vFeaturesArray - */ - public void setFeatures(final jalview.binding.Features[] vFeaturesArray) - { - // -- copy array - _featuresList.clear(); - - for (int i = 0; i < vFeaturesArray.length; i++) - { - this._featuresList.add(vFeaturesArray[i]); - } - } - - /** - * Sets the value of field 'id'. - * - * @param id - * the value of field 'id'. - */ - public void setId(final int id) - { - this._id = id; - this._has_id = true; - } - - /** - * - * - * @param index - * @param vPdbids - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void setPdbids(final int index, - final jalview.binding.Pdbids vPdbids) - throws java.lang.IndexOutOfBoundsException - { - // check bounds for index - if (index < 0 || index >= this._pdbidsList.size()) - { - throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{ - "setPdbids", - Integer.valueOf(index).toString(), - Integer.valueOf((this._pdbidsList.size() - 1)).toString() - })); - } - - this._pdbidsList.set(index, vPdbids); - } - - /** - * - * - * @param vPdbidsArray - */ - public void setPdbids(final jalview.binding.Pdbids[] vPdbidsArray) - { - // -- copy array - _pdbidsList.clear(); - - for (int i = 0; i < vPdbidsArray.length; i++) - { - this._pdbidsList.add(vPdbidsArray[i]); - } - } - - /** - * Sets the value of field 'start'. - * - * @param start - * the value of field 'start'. - */ - public void setStart(final int start) - { - this._start = start; - this._has_start = true; - } - - /** - * Method unmarshal. - * - * @param reader - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - * @return the unmarshaled jalview.binding.JSeq - */ - public static jalview.binding.JSeq unmarshal(final java.io.Reader reader) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - return (jalview.binding.JSeq) Unmarshaller.unmarshal( - jalview.binding.JSeq.class, reader); - } - - /** - * - * - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - */ - public void validate() throws org.exolab.castor.xml.ValidationException - { - org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); - validator.validate(this); - } +public class JSeq implements java.io.Serializable { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field _colour. + */ + private int _colour; + + /** + * keeps track of state for field: _colour + */ + private boolean _has_colour; + + /** + * Field _start. + */ + private int _start; + + /** + * keeps track of state for field: _start + */ + private boolean _has_start; + + /** + * Field _end. + */ + private int _end; + + /** + * keeps track of state for field: _end + */ + private boolean _has_end; + + /** + * Field _id. + */ + private int _id; + + /** + * keeps track of state for field: _id + */ + private boolean _has_id; + + /** + * Field _featuresList. + */ + private java.util.Vector _featuresList; + + /** + * Field _pdbidsList. + */ + private java.util.Vector _pdbidsList; + + + //----------------/ + //- Constructors -/ + //----------------/ + + public JSeq() { + super(); + this._featuresList = new java.util.Vector(); + this._pdbidsList = new java.util.Vector(); + } + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * + * + * @param vFeatures + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addFeatures( + final jalview.binding.Features vFeatures) + throws java.lang.IndexOutOfBoundsException { + this._featuresList.addElement(vFeatures); + } + + /** + * + * + * @param index + * @param vFeatures + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addFeatures( + final int index, + final jalview.binding.Features vFeatures) + throws java.lang.IndexOutOfBoundsException { + this._featuresList.add(index, vFeatures); + } + + /** + * + * + * @param vPdbids + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addPdbids( + final jalview.binding.Pdbids vPdbids) + throws java.lang.IndexOutOfBoundsException { + this._pdbidsList.addElement(vPdbids); + } + + /** + * + * + * @param index + * @param vPdbids + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addPdbids( + final int index, + final jalview.binding.Pdbids vPdbids) + throws java.lang.IndexOutOfBoundsException { + this._pdbidsList.add(index, vPdbids); + } + + /** + */ + public void deleteColour( + ) { + this._has_colour= false; + } + + /** + */ + public void deleteEnd( + ) { + this._has_end= false; + } + + /** + */ + public void deleteId( + ) { + this._has_id= false; + } + + /** + */ + public void deleteStart( + ) { + this._has_start= false; + } + + /** + * Method enumerateFeatures. + * + * @return an Enumeration over all jalview.binding.Features + * elements + */ + public java.util.Enumeration enumerateFeatures( + ) { + return this._featuresList.elements(); + } + + /** + * Method enumeratePdbids. + * + * @return an Enumeration over all jalview.binding.Pdbids + * elements + */ + public java.util.Enumeration enumeratePdbids( + ) { + return this._pdbidsList.elements(); + } + + /** + * Returns the value of field 'colour'. + * + * @return the value of field 'Colour'. + */ + public int getColour( + ) { + return this._colour; + } + + /** + * Returns the value of field 'end'. + * + * @return the value of field 'End'. + */ + public int getEnd( + ) { + return this._end; + } + + /** + * Method getFeatures. + * + * @param index + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + * @return the value of the jalview.binding.Features at the + * given index + */ + public jalview.binding.Features getFeatures( + final int index) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._featuresList.size()) { + throw new IndexOutOfBoundsException("getFeatures: Index value '" + index + "' not in range [0.." + (this._featuresList.size() - 1) + "]"); + } + + return (jalview.binding.Features) _featuresList.get(index); + } + + /** + * Method getFeatures.Returns the contents of the collection in + * an Array.

    Note: Just in case the collection contents + * are changing in another thread, we pass a 0-length Array of + * the correct type into the API call. This way we know + * that the Array returned is of exactly the correct length. + * + * @return this collection as an Array + */ + public jalview.binding.Features[] getFeatures( + ) { + jalview.binding.Features[] array = new jalview.binding.Features[0]; + return (jalview.binding.Features[]) this._featuresList.toArray(array); + } + + /** + * Method getFeaturesCount. + * + * @return the size of this collection + */ + public int getFeaturesCount( + ) { + return this._featuresList.size(); + } + + /** + * Returns the value of field 'id'. + * + * @return the value of field 'Id'. + */ + public int getId( + ) { + return this._id; + } + + /** + * Method getPdbids. + * + * @param index + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + * @return the value of the jalview.binding.Pdbids at the given + * index + */ + public jalview.binding.Pdbids getPdbids( + final int index) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._pdbidsList.size()) { + throw new IndexOutOfBoundsException("getPdbids: Index value '" + index + "' not in range [0.." + (this._pdbidsList.size() - 1) + "]"); + } + + return (jalview.binding.Pdbids) _pdbidsList.get(index); + } + + /** + * Method getPdbids.Returns the contents of the collection in + * an Array.

    Note: Just in case the collection contents + * are changing in another thread, we pass a 0-length Array of + * the correct type into the API call. This way we know + * that the Array returned is of exactly the correct length. + * + * @return this collection as an Array + */ + public jalview.binding.Pdbids[] getPdbids( + ) { + jalview.binding.Pdbids[] array = new jalview.binding.Pdbids[0]; + return (jalview.binding.Pdbids[]) this._pdbidsList.toArray(array); + } + + /** + * Method getPdbidsCount. + * + * @return the size of this collection + */ + public int getPdbidsCount( + ) { + return this._pdbidsList.size(); + } + + /** + * Returns the value of field 'start'. + * + * @return the value of field 'Start'. + */ + public int getStart( + ) { + return this._start; + } + + /** + * Method hasColour. + * + * @return true if at least one Colour has been added + */ + public boolean hasColour( + ) { + return this._has_colour; + } + + /** + * Method hasEnd. + * + * @return true if at least one End has been added + */ + public boolean hasEnd( + ) { + return this._has_end; + } + + /** + * Method hasId. + * + * @return true if at least one Id has been added + */ + public boolean hasId( + ) { + return this._has_id; + } + + /** + * Method hasStart. + * + * @return true if at least one Start has been added + */ + public boolean hasStart( + ) { + return this._has_start; + } + + /** + * Method isValid. + * + * @return true if this object is valid according to the schema + */ + public boolean isValid( + ) { + try { + validate(); + } catch (org.exolab.castor.xml.ValidationException vex) { + return false; + } + return true; + } + + /** + * + * + * @param out + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void marshal( + final java.io.Writer out) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, out); + } + + /** + * + * + * @param handler + * @throws java.io.IOException if an IOException occurs during + * marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + */ + public void marshal( + final org.xml.sax.ContentHandler handler) + throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, handler); + } + + /** + */ + public void removeAllFeatures( + ) { + this._featuresList.clear(); + } + + /** + */ + public void removeAllPdbids( + ) { + this._pdbidsList.clear(); + } + + /** + * Method removeFeatures. + * + * @param vFeatures + * @return true if the object was removed from the collection. + */ + public boolean removeFeatures( + final jalview.binding.Features vFeatures) { + boolean removed = _featuresList.remove(vFeatures); + return removed; + } + + /** + * Method removeFeaturesAt. + * + * @param index + * @return the element removed from the collection + */ + public jalview.binding.Features removeFeaturesAt( + final int index) { + java.lang.Object obj = this._featuresList.remove(index); + return (jalview.binding.Features) obj; + } + + /** + * Method removePdbids. + * + * @param vPdbids + * @return true if the object was removed from the collection. + */ + public boolean removePdbids( + final jalview.binding.Pdbids vPdbids) { + boolean removed = _pdbidsList.remove(vPdbids); + return removed; + } + + /** + * Method removePdbidsAt. + * + * @param index + * @return the element removed from the collection + */ + public jalview.binding.Pdbids removePdbidsAt( + final int index) { + java.lang.Object obj = this._pdbidsList.remove(index); + return (jalview.binding.Pdbids) obj; + } + + /** + * Sets the value of field 'colour'. + * + * @param colour the value of field 'colour'. + */ + public void setColour( + final int colour) { + this._colour = colour; + this._has_colour = true; + } + + /** + * Sets the value of field 'end'. + * + * @param end the value of field 'end'. + */ + public void setEnd( + final int end) { + this._end = end; + this._has_end = true; + } + + /** + * + * + * @param index + * @param vFeatures + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void setFeatures( + final int index, + final jalview.binding.Features vFeatures) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._featuresList.size()) { + throw new IndexOutOfBoundsException("setFeatures: Index value '" + index + "' not in range [0.." + (this._featuresList.size() - 1) + "]"); + } + + this._featuresList.set(index, vFeatures); + } + + /** + * + * + * @param vFeaturesArray + */ + public void setFeatures( + final jalview.binding.Features[] vFeaturesArray) { + //-- copy array + _featuresList.clear(); + + for (int i = 0; i < vFeaturesArray.length; i++) { + this._featuresList.add(vFeaturesArray[i]); + } + } + + /** + * Sets the value of field 'id'. + * + * @param id the value of field 'id'. + */ + public void setId( + final int id) { + this._id = id; + this._has_id = true; + } + + /** + * + * + * @param index + * @param vPdbids + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void setPdbids( + final int index, + final jalview.binding.Pdbids vPdbids) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._pdbidsList.size()) { + throw new IndexOutOfBoundsException("setPdbids: Index value '" + index + "' not in range [0.." + (this._pdbidsList.size() - 1) + "]"); + } + + this._pdbidsList.set(index, vPdbids); + } + + /** + * + * + * @param vPdbidsArray + */ + public void setPdbids( + final jalview.binding.Pdbids[] vPdbidsArray) { + //-- copy array + _pdbidsList.clear(); + + for (int i = 0; i < vPdbidsArray.length; i++) { + this._pdbidsList.add(vPdbidsArray[i]); + } + } + + /** + * Sets the value of field 'start'. + * + * @param start the value of field 'start'. + */ + public void setStart( + final int start) { + this._start = start; + this._has_start = true; + } + + /** + * Method unmarshal. + * + * @param reader + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @return the unmarshaled jalview.binding.JSeq + */ + public static jalview.binding.JSeq unmarshal( + final java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + return (jalview.binding.JSeq) Unmarshaller.unmarshal(jalview.binding.JSeq.class, reader); + } + + /** + * + * + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void validate( + ) + throws org.exolab.castor.xml.ValidationException { + org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); + validator.validate(this); + } } diff --git a/src/jalview/binding/JalviewModel.java b/src/jalview/binding/JalviewModel.java index cebd813..21f8be9 100644 --- a/src/jalview/binding/JalviewModel.java +++ b/src/jalview/binding/JalviewModel.java @@ -1,27 +1,14 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) - * Copyright (C) $$Year-Rel$$ The Jalview Authors - * - * This file is part of Jalview. - * - * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. - * - * Jalview is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Jalview. If not, see . - * The Jalview Authors are detailed in the 'AUTHORS' file. + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ */ + package jalview.binding; -//---------------------------------/ -//- Imported classes and packages -/ + //---------------------------------/ + //- Imported classes and packages -/ //---------------------------------/ import org.exolab.castor.xml.Marshaller; @@ -32,215 +19,202 @@ import org.exolab.castor.xml.Unmarshaller; * * @version $Revision$ $Date$ */ -public class JalviewModel implements java.io.Serializable -{ - - // --------------------------/ - // - Class/Member Variables -/ - // --------------------------/ - - /** - * Field _creationDate. - */ - private java.util.Date _creationDate; - - /** - * Field _version. - */ - private java.lang.String _version; - - /** - * Field _vamsasModel. - */ - private jalview.binding.VamsasModel _vamsasModel; - - /** - * Field _jalviewModelSequence. - */ - private jalview.binding.JalviewModelSequence _jalviewModelSequence; - - // ----------------/ - // - Constructors -/ - // ----------------/ - - public JalviewModel() - { - super(); - } - - // -----------/ - // - Methods -/ - // -----------/ - - /** - * Returns the value of field 'creationDate'. - * - * @return the value of field 'CreationDate'. - */ - public java.util.Date getCreationDate() - { - return this._creationDate; - } - - /** - * Returns the value of field 'jalviewModelSequence'. - * - * @return the value of field 'JalviewModelSequence'. - */ - public jalview.binding.JalviewModelSequence getJalviewModelSequence() - { - return this._jalviewModelSequence; - } - - /** - * Returns the value of field 'vamsasModel'. - * - * @return the value of field 'VamsasModel'. - */ - public jalview.binding.VamsasModel getVamsasModel() - { - return this._vamsasModel; - } - - /** - * Returns the value of field 'version'. - * - * @return the value of field 'Version'. - */ - public java.lang.String getVersion() - { - return this._version; - } - - /** - * Method isValid. - * - * @return true if this object is valid according to the schema - */ - public boolean isValid() - { - try - { - validate(); - } catch (org.exolab.castor.xml.ValidationException vex) - { - return false; +public class JalviewModel implements java.io.Serializable { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field _creationDate. + */ + private java.util.Date _creationDate; + + /** + * Field _version. + */ + private java.lang.String _version; + + /** + * Field _vamsasModel. + */ + private jalview.binding.VamsasModel _vamsasModel; + + /** + * Field _jalviewModelSequence. + */ + private jalview.binding.JalviewModelSequence _jalviewModelSequence; + + + //----------------/ + //- Constructors -/ + //----------------/ + + public JalviewModel() { + super(); + } + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Returns the value of field 'creationDate'. + * + * @return the value of field 'CreationDate'. + */ + public java.util.Date getCreationDate( + ) { + return this._creationDate; + } + + /** + * Returns the value of field 'jalviewModelSequence'. + * + * @return the value of field 'JalviewModelSequence'. + */ + public jalview.binding.JalviewModelSequence getJalviewModelSequence( + ) { + return this._jalviewModelSequence; + } + + /** + * Returns the value of field 'vamsasModel'. + * + * @return the value of field 'VamsasModel'. + */ + public jalview.binding.VamsasModel getVamsasModel( + ) { + return this._vamsasModel; + } + + /** + * Returns the value of field 'version'. + * + * @return the value of field 'Version'. + */ + public java.lang.String getVersion( + ) { + return this._version; + } + + /** + * Method isValid. + * + * @return true if this object is valid according to the schema + */ + public boolean isValid( + ) { + try { + validate(); + } catch (org.exolab.castor.xml.ValidationException vex) { + return false; + } + return true; + } + + /** + * + * + * @param out + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void marshal( + final java.io.Writer out) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, out); + } + + /** + * + * + * @param handler + * @throws java.io.IOException if an IOException occurs during + * marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + */ + public void marshal( + final org.xml.sax.ContentHandler handler) + throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, handler); + } + + /** + * Sets the value of field 'creationDate'. + * + * @param creationDate the value of field 'creationDate'. + */ + public void setCreationDate( + final java.util.Date creationDate) { + this._creationDate = creationDate; + } + + /** + * Sets the value of field 'jalviewModelSequence'. + * + * @param jalviewModelSequence the value of field + * 'jalviewModelSequence'. + */ + public void setJalviewModelSequence( + final jalview.binding.JalviewModelSequence jalviewModelSequence) { + this._jalviewModelSequence = jalviewModelSequence; + } + + /** + * Sets the value of field 'vamsasModel'. + * + * @param vamsasModel the value of field 'vamsasModel'. + */ + public void setVamsasModel( + final jalview.binding.VamsasModel vamsasModel) { + this._vamsasModel = vamsasModel; + } + + /** + * Sets the value of field 'version'. + * + * @param version the value of field 'version'. + */ + public void setVersion( + final java.lang.String version) { + this._version = version; + } + + /** + * Method unmarshal. + * + * @param reader + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @return the unmarshaled jalview.binding.JalviewModel + */ + public static jalview.binding.JalviewModel unmarshal( + final java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + return (jalview.binding.JalviewModel) Unmarshaller.unmarshal(jalview.binding.JalviewModel.class, reader); + } + + /** + * + * + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void validate( + ) + throws org.exolab.castor.xml.ValidationException { + org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); + validator.validate(this); } - return true; - } - - /** - * - * - * @param out - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - */ - public void marshal(final java.io.Writer out) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - Marshaller.marshal(this, out); - } - - /** - * - * - * @param handler - * @throws java.io.IOException - * if an IOException occurs during marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - */ - public void marshal(final org.xml.sax.ContentHandler handler) - throws java.io.IOException, - org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - Marshaller.marshal(this, handler); - } - - /** - * Sets the value of field 'creationDate'. - * - * @param creationDate - * the value of field 'creationDate'. - */ - public void setCreationDate(final java.util.Date creationDate) - { - this._creationDate = creationDate; - } - - /** - * Sets the value of field 'jalviewModelSequence'. - * - * @param jalviewModelSequence - * the value of field 'jalviewModelSequence'. - */ - public void setJalviewModelSequence( - final jalview.binding.JalviewModelSequence jalviewModelSequence) - { - this._jalviewModelSequence = jalviewModelSequence; - } - - /** - * Sets the value of field 'vamsasModel'. - * - * @param vamsasModel - * the value of field 'vamsasModel'. - */ - public void setVamsasModel(final jalview.binding.VamsasModel vamsasModel) - { - this._vamsasModel = vamsasModel; - } - - /** - * Sets the value of field 'version'. - * - * @param version - * the value of field 'version'. - */ - public void setVersion(final java.lang.String version) - { - this._version = version; - } - - /** - * Method unmarshal. - * - * @param reader - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - * @return the unmarshaled jalview.binding.JalviewModel - */ - public static jalview.binding.JalviewModel unmarshal( - final java.io.Reader reader) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - return (jalview.binding.JalviewModel) Unmarshaller.unmarshal( - jalview.binding.JalviewModel.class, reader); - } - - /** - * - * - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - */ - public void validate() throws org.exolab.castor.xml.ValidationException - { - org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); - validator.validate(this); - } } diff --git a/src/jalview/binding/JalviewModelSequence.java b/src/jalview/binding/JalviewModelSequence.java index 43fa983..5ebcee6 100644 --- a/src/jalview/binding/JalviewModelSequence.java +++ b/src/jalview/binding/JalviewModelSequence.java @@ -1,30 +1,15 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) - * Copyright (C) $$Year-Rel$$ The Jalview Authors - * - * This file is part of Jalview. - * - * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. - * - * Jalview is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Jalview. If not, see . - * The Jalview Authors are detailed in the 'AUTHORS' file. + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ */ + package jalview.binding; + //---------------------------------/ + //- Imported classes and packages -/ //---------------------------------/ -//- Imported classes and packages -/ -//---------------------------------/ - -import jalview.util.MessageManager; import org.exolab.castor.xml.Marshaller; import org.exolab.castor.xml.Unmarshaller; @@ -34,961 +19,904 @@ import org.exolab.castor.xml.Unmarshaller; * * @version $Revision$ $Date$ */ -public class JalviewModelSequence implements java.io.Serializable -{ - - // --------------------------/ - // - Class/Member Variables -/ - // --------------------------/ - - /** - * Field _JSeqList. - */ - private java.util.Vector _JSeqList; - - /** - * Field _JGroupList. - */ - private java.util.Vector _JGroupList; - - /** - * Field _viewportList. - */ - private java.util.Vector _viewportList; - - /** - * Field _userColoursList. - */ - private java.util.Vector _userColoursList; - - /** - * Field _treeList. - */ - private java.util.Vector _treeList; - - /** - * Field _featureSettings. - */ - private jalview.binding.FeatureSettings _featureSettings; - - // ----------------/ - // - Constructors -/ - // ----------------/ - - public JalviewModelSequence() - { - super(); - this._JSeqList = new java.util.Vector(); - this._JGroupList = new java.util.Vector(); - this._viewportList = new java.util.Vector(); - this._userColoursList = new java.util.Vector(); - this._treeList = new java.util.Vector(); - } - - // -----------/ - // - Methods -/ - // -----------/ - - /** - * - * - * @param vJGroup - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void addJGroup(final jalview.binding.JGroup vJGroup) - throws java.lang.IndexOutOfBoundsException - { - this._JGroupList.addElement(vJGroup); - } - - /** - * - * - * @param index - * @param vJGroup - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void addJGroup(final int index, - final jalview.binding.JGroup vJGroup) - throws java.lang.IndexOutOfBoundsException - { - this._JGroupList.add(index, vJGroup); - } - - /** - * - * - * @param vJSeq - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void addJSeq(final jalview.binding.JSeq vJSeq) - throws java.lang.IndexOutOfBoundsException - { - this._JSeqList.addElement(vJSeq); - } - - /** - * - * - * @param index - * @param vJSeq - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void addJSeq(final int index, final jalview.binding.JSeq vJSeq) - throws java.lang.IndexOutOfBoundsException - { - this._JSeqList.add(index, vJSeq); - } - - /** - * - * - * @param vTree - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void addTree(final jalview.binding.Tree vTree) - throws java.lang.IndexOutOfBoundsException - { - this._treeList.addElement(vTree); - } - - /** - * - * - * @param index - * @param vTree - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void addTree(final int index, final jalview.binding.Tree vTree) - throws java.lang.IndexOutOfBoundsException - { - this._treeList.add(index, vTree); - } - - /** - * - * - * @param vUserColours - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void addUserColours(final jalview.binding.UserColours vUserColours) - throws java.lang.IndexOutOfBoundsException - { - this._userColoursList.addElement(vUserColours); - } - - /** - * - * - * @param index - * @param vUserColours - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void addUserColours(final int index, - final jalview.binding.UserColours vUserColours) - throws java.lang.IndexOutOfBoundsException - { - this._userColoursList.add(index, vUserColours); - } - - /** - * - * - * @param vViewport - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void addViewport(final jalview.binding.Viewport vViewport) - throws java.lang.IndexOutOfBoundsException - { - this._viewportList.addElement(vViewport); - } - - /** - * - * - * @param index - * @param vViewport - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void addViewport(final int index, - final jalview.binding.Viewport vViewport) - throws java.lang.IndexOutOfBoundsException - { - this._viewportList.add(index, vViewport); - } - - /** - * Method enumerateJGroup. - * - * @return an Enumeration over all jalview.binding.JGroup elements - */ - public java.util.Enumeration enumerateJGroup() - { - return this._JGroupList.elements(); - } - - /** - * Method enumerateJSeq. - * - * @return an Enumeration over all jalview.binding.JSeq elements - */ - public java.util.Enumeration enumerateJSeq() - { - return this._JSeqList.elements(); - } - - /** - * Method enumerateTree. - * - * @return an Enumeration over all jalview.binding.Tree elements - */ - public java.util.Enumeration enumerateTree() - { - return this._treeList.elements(); - } - - /** - * Method enumerateUserColours. - * - * @return an Enumeration over all jalview.binding.UserColours elements - */ - public java.util.Enumeration enumerateUserColours() - { - return this._userColoursList.elements(); - } - - /** - * Method enumerateViewport. - * - * @return an Enumeration over all jalview.binding.Viewport elements - */ - public java.util.Enumeration enumerateViewport() - { - return this._viewportList.elements(); - } - - /** - * Returns the value of field 'featureSettings'. - * - * @return the value of field 'FeatureSettings'. - */ - public jalview.binding.FeatureSettings getFeatureSettings() - { - return this._featureSettings; - } - - /** - * Method getJGroup. - * - * @param index - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - * @return the value of the jalview.binding.JGroup at the given index - */ - public jalview.binding.JGroup getJGroup(final int index) - throws java.lang.IndexOutOfBoundsException - { - // check bounds for index - if (index < 0 || index >= this._JGroupList.size()) - { - throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{ - "getJGroup", - Integer.valueOf(index).toString(), - Integer.valueOf((this._JGroupList.size() - 1)).toString() - })); - } - - return (jalview.binding.JGroup) _JGroupList.get(index); - } - - /** - * Method getJGroup.Returns the contents of the collection in an Array. - *

    - * Note: Just in case the collection contents are changing in another thread, - * we pass a 0-length Array of the correct type into the API call. This way we - * know that the Array returned is of exactly the correct length. - * - * @return this collection as an Array - */ - public jalview.binding.JGroup[] getJGroup() - { - jalview.binding.JGroup[] array = new jalview.binding.JGroup[0]; - return (jalview.binding.JGroup[]) this._JGroupList.toArray(array); - } - - /** - * Method getJGroupCount. - * - * @return the size of this collection - */ - public int getJGroupCount() - { - return this._JGroupList.size(); - } - - /** - * Method getJSeq. - * - * @param index - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - * @return the value of the jalview.binding.JSeq at the given index - */ - public jalview.binding.JSeq getJSeq(final int index) - throws java.lang.IndexOutOfBoundsException - { - // check bounds for index - if (index < 0 || index >= this._JSeqList.size()) - { - throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{ - "getJSeq", - Integer.valueOf(index).toString(), - Integer.valueOf((this._JSeqList.size() - 1)).toString() - })); - } - - return (jalview.binding.JSeq) _JSeqList.get(index); - } - - /** - * Method getJSeq.Returns the contents of the collection in an Array. - *

    - * Note: Just in case the collection contents are changing in another thread, - * we pass a 0-length Array of the correct type into the API call. This way we - * know that the Array returned is of exactly the correct length. - * - * @return this collection as an Array - */ - public jalview.binding.JSeq[] getJSeq() - { - jalview.binding.JSeq[] array = new jalview.binding.JSeq[0]; - return (jalview.binding.JSeq[]) this._JSeqList.toArray(array); - } - - /** - * Method getJSeqCount. - * - * @return the size of this collection - */ - public int getJSeqCount() - { - return this._JSeqList.size(); - } - - /** - * Method getTree. - * - * @param index - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - * @return the value of the jalview.binding.Tree at the given index - */ - public jalview.binding.Tree getTree(final int index) - throws java.lang.IndexOutOfBoundsException - { - // check bounds for index - if (index < 0 || index >= this._treeList.size()) - { - throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{ - "getJgetTreeSeq", - Integer.valueOf(index).toString(), - Integer.valueOf((this._treeList.size() - 1)).toString() - })); - } - - return (jalview.binding.Tree) _treeList.get(index); - } - - /** - * Method getTree.Returns the contents of the collection in an Array. - *

    - * Note: Just in case the collection contents are changing in another thread, - * we pass a 0-length Array of the correct type into the API call. This way we - * know that the Array returned is of exactly the correct length. - * - * @return this collection as an Array - */ - public jalview.binding.Tree[] getTree() - { - jalview.binding.Tree[] array = new jalview.binding.Tree[0]; - return (jalview.binding.Tree[]) this._treeList.toArray(array); - } - - /** - * Method getTreeCount. - * - * @return the size of this collection - */ - public int getTreeCount() - { - return this._treeList.size(); - } - - /** - * Method getUserColours. - * - * @param index - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - * @return the value of the jalview.binding.UserColours at the given index - */ - public jalview.binding.UserColours getUserColours(final int index) - throws java.lang.IndexOutOfBoundsException - { - // check bounds for index - if (index < 0 || index >= this._userColoursList.size()) - { - throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{ - "getUserColours", - Integer.valueOf(index).toString(), - Integer.valueOf((this._userColoursList.size() - 1)).toString() - })); - } - - return (jalview.binding.UserColours) _userColoursList.get(index); - } - - /** - * Method getUserColours.Returns the contents of the collection in an Array. - *

    - * Note: Just in case the collection contents are changing in another thread, - * we pass a 0-length Array of the correct type into the API call. This way we - * know that the Array returned is of exactly the correct length. - * - * @return this collection as an Array - */ - public jalview.binding.UserColours[] getUserColours() - { - jalview.binding.UserColours[] array = new jalview.binding.UserColours[0]; - return (jalview.binding.UserColours[]) this._userColoursList - .toArray(array); - } - - /** - * Method getUserColoursCount. - * - * @return the size of this collection - */ - public int getUserColoursCount() - { - return this._userColoursList.size(); - } - - /** - * Method getViewport. - * - * @param index - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - * @return the value of the jalview.binding.Viewport at the given index - */ - public jalview.binding.Viewport getViewport(final int index) - throws java.lang.IndexOutOfBoundsException - { - // check bounds for index - if (index < 0 || index >= this._viewportList.size()) - { - throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{ - "getViewport", - Integer.valueOf(index).toString(), - Integer.valueOf((this._viewportList.size() - 1)).toString() - })); - } - - return (jalview.binding.Viewport) _viewportList.get(index); - } - - /** - * Method getViewport.Returns the contents of the collection in an Array. - *

    - * Note: Just in case the collection contents are changing in another thread, - * we pass a 0-length Array of the correct type into the API call. This way we - * know that the Array returned is of exactly the correct length. - * - * @return this collection as an Array - */ - public jalview.binding.Viewport[] getViewport() - { - jalview.binding.Viewport[] array = new jalview.binding.Viewport[0]; - return (jalview.binding.Viewport[]) this._viewportList.toArray(array); - } - - /** - * Method getViewportCount. - * - * @return the size of this collection - */ - public int getViewportCount() - { - return this._viewportList.size(); - } - - /** - * Method isValid. - * - * @return true if this object is valid according to the schema - */ - public boolean isValid() - { - try - { - validate(); - } catch (org.exolab.castor.xml.ValidationException vex) - { - return false; - } - return true; - } - - /** - * - * - * @param out - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - */ - public void marshal(final java.io.Writer out) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - Marshaller.marshal(this, out); - } - - /** - * - * - * @param handler - * @throws java.io.IOException - * if an IOException occurs during marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - */ - public void marshal(final org.xml.sax.ContentHandler handler) - throws java.io.IOException, - org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - Marshaller.marshal(this, handler); - } - - /** - */ - public void removeAllJGroup() - { - this._JGroupList.clear(); - } - - /** - */ - public void removeAllJSeq() - { - this._JSeqList.clear(); - } - - /** - */ - public void removeAllTree() - { - this._treeList.clear(); - } - - /** - */ - public void removeAllUserColours() - { - this._userColoursList.clear(); - } - - /** - */ - public void removeAllViewport() - { - this._viewportList.clear(); - } - - /** - * Method removeJGroup. - * - * @param vJGroup - * @return true if the object was removed from the collection. - */ - public boolean removeJGroup(final jalview.binding.JGroup vJGroup) - { - boolean removed = _JGroupList.remove(vJGroup); - return removed; - } - - /** - * Method removeJGroupAt. - * - * @param index - * @return the element removed from the collection - */ - public jalview.binding.JGroup removeJGroupAt(final int index) - { - java.lang.Object obj = this._JGroupList.remove(index); - return (jalview.binding.JGroup) obj; - } - - /** - * Method removeJSeq. - * - * @param vJSeq - * @return true if the object was removed from the collection. - */ - public boolean removeJSeq(final jalview.binding.JSeq vJSeq) - { - boolean removed = _JSeqList.remove(vJSeq); - return removed; - } - - /** - * Method removeJSeqAt. - * - * @param index - * @return the element removed from the collection - */ - public jalview.binding.JSeq removeJSeqAt(final int index) - { - java.lang.Object obj = this._JSeqList.remove(index); - return (jalview.binding.JSeq) obj; - } - - /** - * Method removeTree. - * - * @param vTree - * @return true if the object was removed from the collection. - */ - public boolean removeTree(final jalview.binding.Tree vTree) - { - boolean removed = _treeList.remove(vTree); - return removed; - } - - /** - * Method removeTreeAt. - * - * @param index - * @return the element removed from the collection - */ - public jalview.binding.Tree removeTreeAt(final int index) - { - java.lang.Object obj = this._treeList.remove(index); - return (jalview.binding.Tree) obj; - } - - /** - * Method removeUserColours. - * - * @param vUserColours - * @return true if the object was removed from the collection. - */ - public boolean removeUserColours( - final jalview.binding.UserColours vUserColours) - { - boolean removed = _userColoursList.remove(vUserColours); - return removed; - } - - /** - * Method removeUserColoursAt. - * - * @param index - * @return the element removed from the collection - */ - public jalview.binding.UserColours removeUserColoursAt(final int index) - { - java.lang.Object obj = this._userColoursList.remove(index); - return (jalview.binding.UserColours) obj; - } - - /** - * Method removeViewport. - * - * @param vViewport - * @return true if the object was removed from the collection. - */ - public boolean removeViewport(final jalview.binding.Viewport vViewport) - { - boolean removed = _viewportList.remove(vViewport); - return removed; - } - - /** - * Method removeViewportAt. - * - * @param index - * @return the element removed from the collection - */ - public jalview.binding.Viewport removeViewportAt(final int index) - { - java.lang.Object obj = this._viewportList.remove(index); - return (jalview.binding.Viewport) obj; - } - - /** - * Sets the value of field 'featureSettings'. - * - * @param featureSettings - * the value of field 'featureSettings'. - */ - public void setFeatureSettings( - final jalview.binding.FeatureSettings featureSettings) - { - this._featureSettings = featureSettings; - } - - /** - * - * - * @param index - * @param vJGroup - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void setJGroup(final int index, - final jalview.binding.JGroup vJGroup) - throws java.lang.IndexOutOfBoundsException - { - // check bounds for index - if (index < 0 || index >= this._JGroupList.size()) - { - throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{ - "setJGroup", - Integer.valueOf(index).toString(), - Integer.valueOf((this._JGroupList.size() - 1)).toString() - })); - } - - this._JGroupList.set(index, vJGroup); - } - - /** - * - * - * @param vJGroupArray - */ - public void setJGroup(final jalview.binding.JGroup[] vJGroupArray) - { - // -- copy array - _JGroupList.clear(); - - for (int i = 0; i < vJGroupArray.length; i++) - { - this._JGroupList.add(vJGroupArray[i]); - } - } - - /** - * - * - * @param index - * @param vJSeq - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void setJSeq(final int index, final jalview.binding.JSeq vJSeq) - throws java.lang.IndexOutOfBoundsException - { - // check bounds for index - if (index < 0 || index >= this._JSeqList.size()) - { - throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{ - "setJSeq", - Integer.valueOf(index).toString(), - Integer.valueOf((this._JSeqList.size() - 1)).toString() - })); - } - - this._JSeqList.set(index, vJSeq); - } - - /** - * - * - * @param vJSeqArray - */ - public void setJSeq(final jalview.binding.JSeq[] vJSeqArray) - { - // -- copy array - _JSeqList.clear(); - - for (int i = 0; i < vJSeqArray.length; i++) - { - this._JSeqList.add(vJSeqArray[i]); - } - } - - /** - * - * - * @param index - * @param vTree - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void setTree(final int index, final jalview.binding.Tree vTree) - throws java.lang.IndexOutOfBoundsException - { - // check bounds for index - if (index < 0 || index >= this._treeList.size()) - { - throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{ - "setTree", - Integer.valueOf(index).toString(), - Integer.valueOf((this._treeList.size() - 1)).toString() - })); - } - - this._treeList.set(index, vTree); - } - - /** - * - * - * @param vTreeArray - */ - public void setTree(final jalview.binding.Tree[] vTreeArray) - { - // -- copy array - _treeList.clear(); - - for (int i = 0; i < vTreeArray.length; i++) - { - this._treeList.add(vTreeArray[i]); - } - } - - /** - * - * - * @param index - * @param vUserColours - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void setUserColours(final int index, - final jalview.binding.UserColours vUserColours) - throws java.lang.IndexOutOfBoundsException - { - // check bounds for index - if (index < 0 || index >= this._userColoursList.size()) - { - throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{ - "setUserColours", - Integer.valueOf(index).toString(), - Integer.valueOf((this._userColoursList.size() - 1)).toString() - })); - } - - this._userColoursList.set(index, vUserColours); - } - - /** - * - * - * @param vUserColoursArray - */ - public void setUserColours( - final jalview.binding.UserColours[] vUserColoursArray) - { - // -- copy array - _userColoursList.clear(); - - for (int i = 0; i < vUserColoursArray.length; i++) - { - this._userColoursList.add(vUserColoursArray[i]); - } - } - - /** - * - * - * @param index - * @param vViewport - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void setViewport(final int index, - final jalview.binding.Viewport vViewport) - throws java.lang.IndexOutOfBoundsException - { - // check bounds for index - if (index < 0 || index >= this._viewportList.size()) - { - throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{ - "setViewport", - Integer.valueOf(index).toString(), - Integer.valueOf((this._viewportList.size() - 1)).toString() - })); - } - - this._viewportList.set(index, vViewport); - } - - /** - * - * - * @param vViewportArray - */ - public void setViewport(final jalview.binding.Viewport[] vViewportArray) - { - // -- copy array - _viewportList.clear(); - - for (int i = 0; i < vViewportArray.length; i++) - { - this._viewportList.add(vViewportArray[i]); - } - } - - /** - * Method unmarshal. - * - * @param reader - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - * @return the unmarshaled jalview.binding.JalviewModelSequence - */ - public static jalview.binding.JalviewModelSequence unmarshal( - final java.io.Reader reader) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - return (jalview.binding.JalviewModelSequence) Unmarshaller.unmarshal( - jalview.binding.JalviewModelSequence.class, reader); - } - - /** - * - * - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - */ - public void validate() throws org.exolab.castor.xml.ValidationException - { - org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); - validator.validate(this); - } +public class JalviewModelSequence implements java.io.Serializable { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field _JSeqList. + */ + private java.util.Vector _JSeqList; + + /** + * Field _JGroupList. + */ + private java.util.Vector _JGroupList; + + /** + * Field _viewportList. + */ + private java.util.Vector _viewportList; + + /** + * Field _userColoursList. + */ + private java.util.Vector _userColoursList; + + /** + * Field _treeList. + */ + private java.util.Vector _treeList; + + /** + * Field _featureSettings. + */ + private jalview.binding.FeatureSettings _featureSettings; + + + //----------------/ + //- Constructors -/ + //----------------/ + + public JalviewModelSequence() { + super(); + this._JSeqList = new java.util.Vector(); + this._JGroupList = new java.util.Vector(); + this._viewportList = new java.util.Vector(); + this._userColoursList = new java.util.Vector(); + this._treeList = new java.util.Vector(); + } + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * + * + * @param vJGroup + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addJGroup( + final jalview.binding.JGroup vJGroup) + throws java.lang.IndexOutOfBoundsException { + this._JGroupList.addElement(vJGroup); + } + + /** + * + * + * @param index + * @param vJGroup + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addJGroup( + final int index, + final jalview.binding.JGroup vJGroup) + throws java.lang.IndexOutOfBoundsException { + this._JGroupList.add(index, vJGroup); + } + + /** + * + * + * @param vJSeq + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addJSeq( + final jalview.binding.JSeq vJSeq) + throws java.lang.IndexOutOfBoundsException { + this._JSeqList.addElement(vJSeq); + } + + /** + * + * + * @param index + * @param vJSeq + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addJSeq( + final int index, + final jalview.binding.JSeq vJSeq) + throws java.lang.IndexOutOfBoundsException { + this._JSeqList.add(index, vJSeq); + } + + /** + * + * + * @param vTree + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addTree( + final jalview.binding.Tree vTree) + throws java.lang.IndexOutOfBoundsException { + this._treeList.addElement(vTree); + } + + /** + * + * + * @param index + * @param vTree + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addTree( + final int index, + final jalview.binding.Tree vTree) + throws java.lang.IndexOutOfBoundsException { + this._treeList.add(index, vTree); + } + + /** + * + * + * @param vUserColours + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addUserColours( + final jalview.binding.UserColours vUserColours) + throws java.lang.IndexOutOfBoundsException { + this._userColoursList.addElement(vUserColours); + } + + /** + * + * + * @param index + * @param vUserColours + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addUserColours( + final int index, + final jalview.binding.UserColours vUserColours) + throws java.lang.IndexOutOfBoundsException { + this._userColoursList.add(index, vUserColours); + } + + /** + * + * + * @param vViewport + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addViewport( + final jalview.binding.Viewport vViewport) + throws java.lang.IndexOutOfBoundsException { + this._viewportList.addElement(vViewport); + } + + /** + * + * + * @param index + * @param vViewport + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addViewport( + final int index, + final jalview.binding.Viewport vViewport) + throws java.lang.IndexOutOfBoundsException { + this._viewportList.add(index, vViewport); + } + + /** + * Method enumerateJGroup. + * + * @return an Enumeration over all jalview.binding.JGroup + * elements + */ + public java.util.Enumeration enumerateJGroup( + ) { + return this._JGroupList.elements(); + } + + /** + * Method enumerateJSeq. + * + * @return an Enumeration over all jalview.binding.JSeq elements + */ + public java.util.Enumeration enumerateJSeq( + ) { + return this._JSeqList.elements(); + } + + /** + * Method enumerateTree. + * + * @return an Enumeration over all jalview.binding.Tree elements + */ + public java.util.Enumeration enumerateTree( + ) { + return this._treeList.elements(); + } + + /** + * Method enumerateUserColours. + * + * @return an Enumeration over all jalview.binding.UserColours + * elements + */ + public java.util.Enumeration enumerateUserColours( + ) { + return this._userColoursList.elements(); + } + + /** + * Method enumerateViewport. + * + * @return an Enumeration over all jalview.binding.Viewport + * elements + */ + public java.util.Enumeration enumerateViewport( + ) { + return this._viewportList.elements(); + } + + /** + * Returns the value of field 'featureSettings'. + * + * @return the value of field 'FeatureSettings'. + */ + public jalview.binding.FeatureSettings getFeatureSettings( + ) { + return this._featureSettings; + } + + /** + * Method getJGroup. + * + * @param index + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + * @return the value of the jalview.binding.JGroup at the given + * index + */ + public jalview.binding.JGroup getJGroup( + final int index) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._JGroupList.size()) { + throw new IndexOutOfBoundsException("getJGroup: Index value '" + index + "' not in range [0.." + (this._JGroupList.size() - 1) + "]"); + } + + return (jalview.binding.JGroup) _JGroupList.get(index); + } + + /** + * Method getJGroup.Returns the contents of the collection in + * an Array.

    Note: Just in case the collection contents + * are changing in another thread, we pass a 0-length Array of + * the correct type into the API call. This way we know + * that the Array returned is of exactly the correct length. + * + * @return this collection as an Array + */ + public jalview.binding.JGroup[] getJGroup( + ) { + jalview.binding.JGroup[] array = new jalview.binding.JGroup[0]; + return (jalview.binding.JGroup[]) this._JGroupList.toArray(array); + } + + /** + * Method getJGroupCount. + * + * @return the size of this collection + */ + public int getJGroupCount( + ) { + return this._JGroupList.size(); + } + + /** + * Method getJSeq. + * + * @param index + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + * @return the value of the jalview.binding.JSeq at the given + * index + */ + public jalview.binding.JSeq getJSeq( + final int index) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._JSeqList.size()) { + throw new IndexOutOfBoundsException("getJSeq: Index value '" + index + "' not in range [0.." + (this._JSeqList.size() - 1) + "]"); + } + + return (jalview.binding.JSeq) _JSeqList.get(index); + } + + /** + * Method getJSeq.Returns the contents of the collection in an + * Array.

    Note: Just in case the collection contents are + * changing in another thread, we pass a 0-length Array of the + * correct type into the API call. This way we know + * that the Array returned is of exactly the correct length. + * + * @return this collection as an Array + */ + public jalview.binding.JSeq[] getJSeq( + ) { + jalview.binding.JSeq[] array = new jalview.binding.JSeq[0]; + return (jalview.binding.JSeq[]) this._JSeqList.toArray(array); + } + + /** + * Method getJSeqCount. + * + * @return the size of this collection + */ + public int getJSeqCount( + ) { + return this._JSeqList.size(); + } + + /** + * Method getTree. + * + * @param index + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + * @return the value of the jalview.binding.Tree at the given + * index + */ + public jalview.binding.Tree getTree( + final int index) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._treeList.size()) { + throw new IndexOutOfBoundsException("getTree: Index value '" + index + "' not in range [0.." + (this._treeList.size() - 1) + "]"); + } + + return (jalview.binding.Tree) _treeList.get(index); + } + + /** + * Method getTree.Returns the contents of the collection in an + * Array.

    Note: Just in case the collection contents are + * changing in another thread, we pass a 0-length Array of the + * correct type into the API call. This way we know + * that the Array returned is of exactly the correct length. + * + * @return this collection as an Array + */ + public jalview.binding.Tree[] getTree( + ) { + jalview.binding.Tree[] array = new jalview.binding.Tree[0]; + return (jalview.binding.Tree[]) this._treeList.toArray(array); + } + + /** + * Method getTreeCount. + * + * @return the size of this collection + */ + public int getTreeCount( + ) { + return this._treeList.size(); + } + + /** + * Method getUserColours. + * + * @param index + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + * @return the value of the jalview.binding.UserColours at the + * given index + */ + public jalview.binding.UserColours getUserColours( + final int index) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._userColoursList.size()) { + throw new IndexOutOfBoundsException("getUserColours: Index value '" + index + "' not in range [0.." + (this._userColoursList.size() - 1) + "]"); + } + + return (jalview.binding.UserColours) _userColoursList.get(index); + } + + /** + * Method getUserColours.Returns the contents of the collection + * in an Array.

    Note: Just in case the collection contents + * are changing in another thread, we pass a 0-length Array of + * the correct type into the API call. This way we know + * that the Array returned is of exactly the correct length. + * + * @return this collection as an Array + */ + public jalview.binding.UserColours[] getUserColours( + ) { + jalview.binding.UserColours[] array = new jalview.binding.UserColours[0]; + return (jalview.binding.UserColours[]) this._userColoursList.toArray(array); + } + + /** + * Method getUserColoursCount. + * + * @return the size of this collection + */ + public int getUserColoursCount( + ) { + return this._userColoursList.size(); + } + + /** + * Method getViewport. + * + * @param index + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + * @return the value of the jalview.binding.Viewport at the + * given index + */ + public jalview.binding.Viewport getViewport( + final int index) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._viewportList.size()) { + throw new IndexOutOfBoundsException("getViewport: Index value '" + index + "' not in range [0.." + (this._viewportList.size() - 1) + "]"); + } + + return (jalview.binding.Viewport) _viewportList.get(index); + } + + /** + * Method getViewport.Returns the contents of the collection in + * an Array.

    Note: Just in case the collection contents + * are changing in another thread, we pass a 0-length Array of + * the correct type into the API call. This way we know + * that the Array returned is of exactly the correct length. + * + * @return this collection as an Array + */ + public jalview.binding.Viewport[] getViewport( + ) { + jalview.binding.Viewport[] array = new jalview.binding.Viewport[0]; + return (jalview.binding.Viewport[]) this._viewportList.toArray(array); + } + + /** + * Method getViewportCount. + * + * @return the size of this collection + */ + public int getViewportCount( + ) { + return this._viewportList.size(); + } + + /** + * Method isValid. + * + * @return true if this object is valid according to the schema + */ + public boolean isValid( + ) { + try { + validate(); + } catch (org.exolab.castor.xml.ValidationException vex) { + return false; + } + return true; + } + + /** + * + * + * @param out + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void marshal( + final java.io.Writer out) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, out); + } + + /** + * + * + * @param handler + * @throws java.io.IOException if an IOException occurs during + * marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + */ + public void marshal( + final org.xml.sax.ContentHandler handler) + throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, handler); + } + + /** + */ + public void removeAllJGroup( + ) { + this._JGroupList.clear(); + } + + /** + */ + public void removeAllJSeq( + ) { + this._JSeqList.clear(); + } + + /** + */ + public void removeAllTree( + ) { + this._treeList.clear(); + } + + /** + */ + public void removeAllUserColours( + ) { + this._userColoursList.clear(); + } + + /** + */ + public void removeAllViewport( + ) { + this._viewportList.clear(); + } + + /** + * Method removeJGroup. + * + * @param vJGroup + * @return true if the object was removed from the collection. + */ + public boolean removeJGroup( + final jalview.binding.JGroup vJGroup) { + boolean removed = _JGroupList.remove(vJGroup); + return removed; + } + + /** + * Method removeJGroupAt. + * + * @param index + * @return the element removed from the collection + */ + public jalview.binding.JGroup removeJGroupAt( + final int index) { + java.lang.Object obj = this._JGroupList.remove(index); + return (jalview.binding.JGroup) obj; + } + + /** + * Method removeJSeq. + * + * @param vJSeq + * @return true if the object was removed from the collection. + */ + public boolean removeJSeq( + final jalview.binding.JSeq vJSeq) { + boolean removed = _JSeqList.remove(vJSeq); + return removed; + } + + /** + * Method removeJSeqAt. + * + * @param index + * @return the element removed from the collection + */ + public jalview.binding.JSeq removeJSeqAt( + final int index) { + java.lang.Object obj = this._JSeqList.remove(index); + return (jalview.binding.JSeq) obj; + } + + /** + * Method removeTree. + * + * @param vTree + * @return true if the object was removed from the collection. + */ + public boolean removeTree( + final jalview.binding.Tree vTree) { + boolean removed = _treeList.remove(vTree); + return removed; + } + + /** + * Method removeTreeAt. + * + * @param index + * @return the element removed from the collection + */ + public jalview.binding.Tree removeTreeAt( + final int index) { + java.lang.Object obj = this._treeList.remove(index); + return (jalview.binding.Tree) obj; + } + + /** + * Method removeUserColours. + * + * @param vUserColours + * @return true if the object was removed from the collection. + */ + public boolean removeUserColours( + final jalview.binding.UserColours vUserColours) { + boolean removed = _userColoursList.remove(vUserColours); + return removed; + } + + /** + * Method removeUserColoursAt. + * + * @param index + * @return the element removed from the collection + */ + public jalview.binding.UserColours removeUserColoursAt( + final int index) { + java.lang.Object obj = this._userColoursList.remove(index); + return (jalview.binding.UserColours) obj; + } + + /** + * Method removeViewport. + * + * @param vViewport + * @return true if the object was removed from the collection. + */ + public boolean removeViewport( + final jalview.binding.Viewport vViewport) { + boolean removed = _viewportList.remove(vViewport); + return removed; + } + + /** + * Method removeViewportAt. + * + * @param index + * @return the element removed from the collection + */ + public jalview.binding.Viewport removeViewportAt( + final int index) { + java.lang.Object obj = this._viewportList.remove(index); + return (jalview.binding.Viewport) obj; + } + + /** + * Sets the value of field 'featureSettings'. + * + * @param featureSettings the value of field 'featureSettings'. + */ + public void setFeatureSettings( + final jalview.binding.FeatureSettings featureSettings) { + this._featureSettings = featureSettings; + } + + /** + * + * + * @param index + * @param vJGroup + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void setJGroup( + final int index, + final jalview.binding.JGroup vJGroup) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._JGroupList.size()) { + throw new IndexOutOfBoundsException("setJGroup: Index value '" + index + "' not in range [0.." + (this._JGroupList.size() - 1) + "]"); + } + + this._JGroupList.set(index, vJGroup); + } + + /** + * + * + * @param vJGroupArray + */ + public void setJGroup( + final jalview.binding.JGroup[] vJGroupArray) { + //-- copy array + _JGroupList.clear(); + + for (int i = 0; i < vJGroupArray.length; i++) { + this._JGroupList.add(vJGroupArray[i]); + } + } + + /** + * + * + * @param index + * @param vJSeq + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void setJSeq( + final int index, + final jalview.binding.JSeq vJSeq) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._JSeqList.size()) { + throw new IndexOutOfBoundsException("setJSeq: Index value '" + index + "' not in range [0.." + (this._JSeqList.size() - 1) + "]"); + } + + this._JSeqList.set(index, vJSeq); + } + + /** + * + * + * @param vJSeqArray + */ + public void setJSeq( + final jalview.binding.JSeq[] vJSeqArray) { + //-- copy array + _JSeqList.clear(); + + for (int i = 0; i < vJSeqArray.length; i++) { + this._JSeqList.add(vJSeqArray[i]); + } + } + + /** + * + * + * @param index + * @param vTree + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void setTree( + final int index, + final jalview.binding.Tree vTree) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._treeList.size()) { + throw new IndexOutOfBoundsException("setTree: Index value '" + index + "' not in range [0.." + (this._treeList.size() - 1) + "]"); + } + + this._treeList.set(index, vTree); + } + + /** + * + * + * @param vTreeArray + */ + public void setTree( + final jalview.binding.Tree[] vTreeArray) { + //-- copy array + _treeList.clear(); + + for (int i = 0; i < vTreeArray.length; i++) { + this._treeList.add(vTreeArray[i]); + } + } + + /** + * + * + * @param index + * @param vUserColours + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void setUserColours( + final int index, + final jalview.binding.UserColours vUserColours) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._userColoursList.size()) { + throw new IndexOutOfBoundsException("setUserColours: Index value '" + index + "' not in range [0.." + (this._userColoursList.size() - 1) + "]"); + } + + this._userColoursList.set(index, vUserColours); + } + + /** + * + * + * @param vUserColoursArray + */ + public void setUserColours( + final jalview.binding.UserColours[] vUserColoursArray) { + //-- copy array + _userColoursList.clear(); + + for (int i = 0; i < vUserColoursArray.length; i++) { + this._userColoursList.add(vUserColoursArray[i]); + } + } + + /** + * + * + * @param index + * @param vViewport + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void setViewport( + final int index, + final jalview.binding.Viewport vViewport) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._viewportList.size()) { + throw new IndexOutOfBoundsException("setViewport: Index value '" + index + "' not in range [0.." + (this._viewportList.size() - 1) + "]"); + } + + this._viewportList.set(index, vViewport); + } + + /** + * + * + * @param vViewportArray + */ + public void setViewport( + final jalview.binding.Viewport[] vViewportArray) { + //-- copy array + _viewportList.clear(); + + for (int i = 0; i < vViewportArray.length; i++) { + this._viewportList.add(vViewportArray[i]); + } + } + + /** + * Method unmarshal. + * + * @param reader + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @return the unmarshaled jalview.binding.JalviewModelSequence + */ + public static jalview.binding.JalviewModelSequence unmarshal( + final java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + return (jalview.binding.JalviewModelSequence) Unmarshaller.unmarshal(jalview.binding.JalviewModelSequence.class, reader); + } + + /** + * + * + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void validate( + ) + throws org.exolab.castor.xml.ValidationException { + org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); + validator.validate(this); + } } diff --git a/src/jalview/binding/JalviewUserColours.java b/src/jalview/binding/JalviewUserColours.java index f368245..9a6465b 100644 --- a/src/jalview/binding/JalviewUserColours.java +++ b/src/jalview/binding/JalviewUserColours.java @@ -1,31 +1,16 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) - * Copyright (C) $$Year-Rel$$ The Jalview Authors - * - * This file is part of Jalview. - * - * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. - * - * Jalview is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Jalview. If not, see . - * The Jalview Authors are detailed in the 'AUTHORS' file. + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ */ + package jalview.binding; -//---------------------------------/ -//- Imported classes and packages -/ + //---------------------------------/ + //- Imported classes and packages -/ //---------------------------------/ -import jalview.util.MessageManager; - import org.exolab.castor.xml.Marshaller; import org.exolab.castor.xml.Unmarshaller; @@ -34,330 +19,312 @@ import org.exolab.castor.xml.Unmarshaller; * * @version $Revision$ $Date$ */ -public class JalviewUserColours implements java.io.Serializable -{ - - // --------------------------/ - // - Class/Member Variables -/ - // --------------------------/ - - /** - * Field _schemeName. - */ - private java.lang.String _schemeName; - - /** - * Jalview colour scheme document version. - * - */ - private java.lang.String _version; - - /** - * Field _colourList. - */ - private java.util.Vector _colourList; - - // ----------------/ - // - Constructors -/ - // ----------------/ - - public JalviewUserColours() - { - super(); - this._colourList = new java.util.Vector(); - } - - // -----------/ - // - Methods -/ - // -----------/ - - /** - * - * - * @param vColour - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void addColour(final Colour vColour) - throws java.lang.IndexOutOfBoundsException - { - this._colourList.addElement(vColour); - } - - /** - * - * - * @param index - * @param vColour - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void addColour(final int index, final Colour vColour) - throws java.lang.IndexOutOfBoundsException - { - this._colourList.add(index, vColour); - } - - /** - * Method enumerateColour. - * - * @return an Enumeration over all Colour elements - */ - public java.util.Enumeration enumerateColour() - { - return this._colourList.elements(); - } - - /** - * Method getColour. - * - * @param index - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - * @return the value of the Colour at the given index - */ - public Colour getColour(final int index) - throws java.lang.IndexOutOfBoundsException - { - // check bounds for index - if (index < 0 || index >= this._colourList.size()) - { - throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{ - "getColour", - Integer.valueOf(index).toString(), - Integer.valueOf((this._colourList.size() - 1)).toString() - })); +public class JalviewUserColours implements java.io.Serializable { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field _schemeName. + */ + private java.lang.String _schemeName; + + /** + * Jalview colour scheme document version. + * + */ + private java.lang.String _version; + + /** + * Field _colourList. + */ + private java.util.Vector _colourList; + + + //----------------/ + //- Constructors -/ + //----------------/ + + public JalviewUserColours() { + super(); + this._colourList = new java.util.Vector(); } - return (Colour) _colourList.get(index); - } - - /** - * Method getColour.Returns the contents of the collection in an Array. - *

    - * Note: Just in case the collection contents are changing in another thread, - * we pass a 0-length Array of the correct type into the API call. This way we - * know that the Array returned is of exactly the correct length. - * - * @return this collection as an Array - */ - public Colour[] getColour() - { - Colour[] array = new Colour[0]; - return (Colour[]) this._colourList.toArray(array); - } - - /** - * Method getColourCount. - * - * @return the size of this collection - */ - public int getColourCount() - { - return this._colourList.size(); - } - - /** - * Returns the value of field 'schemeName'. - * - * @return the value of field 'SchemeName'. - */ - public java.lang.String getSchemeName() - { - return this._schemeName; - } - - /** - * Returns the value of field 'version'. The field 'version' has the following - * description: Jalview colour scheme document version. - * - * - * @return the value of field 'Version'. - */ - public java.lang.String getVersion() - { - return this._version; - } - - /** - * Method isValid. - * - * @return true if this object is valid according to the schema - */ - public boolean isValid() - { - try - { - validate(); - } catch (org.exolab.castor.xml.ValidationException vex) - { - return false; + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * + * + * @param vColour + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addColour( + final Colour vColour) + throws java.lang.IndexOutOfBoundsException { + this._colourList.addElement(vColour); + } + + /** + * + * + * @param index + * @param vColour + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addColour( + final int index, + final Colour vColour) + throws java.lang.IndexOutOfBoundsException { + this._colourList.add(index, vColour); + } + + /** + * Method enumerateColour. + * + * @return an Enumeration over all Colour elements + */ + public java.util.Enumeration enumerateColour( + ) { + return this._colourList.elements(); + } + + /** + * Method getColour. + * + * @param index + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + * @return the value of the Colour at the given index + */ + public Colour getColour( + final int index) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._colourList.size()) { + throw new IndexOutOfBoundsException("getColour: Index value '" + index + "' not in range [0.." + (this._colourList.size() - 1) + "]"); + } + + return (Colour) _colourList.get(index); } - return true; - } - - /** - * - * - * @param out - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - */ - public void marshal(final java.io.Writer out) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - Marshaller.marshal(this, out); - } - - /** - * - * - * @param handler - * @throws java.io.IOException - * if an IOException occurs during marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - */ - public void marshal(final org.xml.sax.ContentHandler handler) - throws java.io.IOException, - org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - Marshaller.marshal(this, handler); - } - - /** + + /** + * Method getColour.Returns the contents of the collection in + * an Array.

    Note: Just in case the collection contents + * are changing in another thread, we pass a 0-length Array of + * the correct type into the API call. This way we know + * that the Array returned is of exactly the correct length. + * + * @return this collection as an Array + */ + public Colour[] getColour( + ) { + Colour[] array = new Colour[0]; + return (Colour[]) this._colourList.toArray(array); + } + + /** + * Method getColourCount. + * + * @return the size of this collection */ - public void removeAllColour() - { - this._colourList.clear(); - } - - /** - * Method removeColour. - * - * @param vColour - * @return true if the object was removed from the collection. - */ - public boolean removeColour(final Colour vColour) - { - boolean removed = _colourList.remove(vColour); - return removed; - } - - /** - * Method removeColourAt. - * - * @param index - * @return the element removed from the collection - */ - public Colour removeColourAt(final int index) - { - java.lang.Object obj = this._colourList.remove(index); - return (Colour) obj; - } - - /** - * - * - * @param index - * @param vColour - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void setColour(final int index, final Colour vColour) - throws java.lang.IndexOutOfBoundsException - { - // check bounds for index - if (index < 0 || index >= this._colourList.size()) - { - throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{ - "setColour", - Integer.valueOf(index).toString(), - Integer.valueOf((this._colourList.size() - 1)).toString() - })); + public int getColourCount( + ) { + return this._colourList.size(); } - this._colourList.set(index, vColour); - } - - /** - * - * - * @param vColourArray - */ - public void setColour(final Colour[] vColourArray) - { - // -- copy array - _colourList.clear(); - - for (int i = 0; i < vColourArray.length; i++) - { - this._colourList.add(vColourArray[i]); + /** + * Returns the value of field 'schemeName'. + * + * @return the value of field 'SchemeName'. + */ + public java.lang.String getSchemeName( + ) { + return this._schemeName; + } + + /** + * Returns the value of field 'version'. The field 'version' + * has the following description: Jalview colour scheme + * document version. + * + * + * @return the value of field 'Version'. + */ + public java.lang.String getVersion( + ) { + return this._version; + } + + /** + * Method isValid. + * + * @return true if this object is valid according to the schema + */ + public boolean isValid( + ) { + try { + validate(); + } catch (org.exolab.castor.xml.ValidationException vex) { + return false; + } + return true; + } + + /** + * + * + * @param out + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void marshal( + final java.io.Writer out) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, out); + } + + /** + * + * + * @param handler + * @throws java.io.IOException if an IOException occurs during + * marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + */ + public void marshal( + final org.xml.sax.ContentHandler handler) + throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, handler); + } + + /** + */ + public void removeAllColour( + ) { + this._colourList.clear(); + } + + /** + * Method removeColour. + * + * @param vColour + * @return true if the object was removed from the collection. + */ + public boolean removeColour( + final Colour vColour) { + boolean removed = _colourList.remove(vColour); + return removed; + } + + /** + * Method removeColourAt. + * + * @param index + * @return the element removed from the collection + */ + public Colour removeColourAt( + final int index) { + java.lang.Object obj = this._colourList.remove(index); + return (Colour) obj; + } + + /** + * + * + * @param index + * @param vColour + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void setColour( + final int index, + final Colour vColour) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._colourList.size()) { + throw new IndexOutOfBoundsException("setColour: Index value '" + index + "' not in range [0.." + (this._colourList.size() - 1) + "]"); + } + + this._colourList.set(index, vColour); + } + + /** + * + * + * @param vColourArray + */ + public void setColour( + final Colour[] vColourArray) { + //-- copy array + _colourList.clear(); + + for (int i = 0; i < vColourArray.length; i++) { + this._colourList.add(vColourArray[i]); + } + } + + /** + * Sets the value of field 'schemeName'. + * + * @param schemeName the value of field 'schemeName'. + */ + public void setSchemeName( + final java.lang.String schemeName) { + this._schemeName = schemeName; + } + + /** + * Sets the value of field 'version'. The field 'version' has + * the following description: Jalview colour scheme document + * version. + * + * + * @param version the value of field 'version'. + */ + public void setVersion( + final java.lang.String version) { + this._version = version; + } + + /** + * Method unmarshal. + * + * @param reader + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @return the unmarshaled jalview.binding.JalviewUserColours + */ + public static jalview.binding.JalviewUserColours unmarshal( + final java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + return (jalview.binding.JalviewUserColours) Unmarshaller.unmarshal(jalview.binding.JalviewUserColours.class, reader); + } + + /** + * + * + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void validate( + ) + throws org.exolab.castor.xml.ValidationException { + org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); + validator.validate(this); } - } - - /** - * Sets the value of field 'schemeName'. - * - * @param schemeName - * the value of field 'schemeName'. - */ - public void setSchemeName(final java.lang.String schemeName) - { - this._schemeName = schemeName; - } - - /** - * Sets the value of field 'version'. The field 'version' has the following - * description: Jalview colour scheme document version. - * - * - * @param version - * the value of field 'version'. - */ - public void setVersion(final java.lang.String version) - { - this._version = version; - } - - /** - * Method unmarshal. - * - * @param reader - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - * @return the unmarshaled jalview.binding.JalviewUserColours - */ - public static jalview.binding.JalviewUserColours unmarshal( - final java.io.Reader reader) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - return (jalview.binding.JalviewUserColours) Unmarshaller.unmarshal( - jalview.binding.JalviewUserColours.class, reader); - } - - /** - * - * - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - */ - public void validate() throws org.exolab.castor.xml.ValidationException - { - org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); - validator.validate(this); - } } diff --git a/src/jalview/binding/Pdbentry.java b/src/jalview/binding/Pdbentry.java index b2bade5..cac4cf6 100644 --- a/src/jalview/binding/Pdbentry.java +++ b/src/jalview/binding/Pdbentry.java @@ -1,31 +1,16 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) - * Copyright (C) $$Year-Rel$$ The Jalview Authors - * - * This file is part of Jalview. - * - * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. - * - * Jalview is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Jalview. If not, see . - * The Jalview Authors are detailed in the 'AUTHORS' file. + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ */ + package jalview.binding; -//---------------------------------/ -//- Imported classes and packages -/ + //---------------------------------/ + //- Imported classes and packages -/ //---------------------------------/ -import jalview.util.MessageManager; - import org.exolab.castor.xml.Marshaller; import org.exolab.castor.xml.Unmarshaller; @@ -34,330 +19,308 @@ import org.exolab.castor.xml.Unmarshaller; * * @version $Revision$ $Date$ */ -public class Pdbentry implements java.io.Serializable -{ - - // --------------------------/ - // - Class/Member Variables -/ - // --------------------------/ - - /** - * Field _id. - */ - private java.lang.String _id; - - /** - * Field _type. - */ - private java.lang.String _type; - - /** - * Field _items. - */ - private java.util.Vector _items; - - // ----------------/ - // - Constructors -/ - // ----------------/ - - public Pdbentry() - { - super(); - this._items = new java.util.Vector(); - } - - // -----------/ - // - Methods -/ - // -----------/ - - /** - * - * - * @param vPdbentryItem - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void addPdbentryItem( - final jalview.binding.PdbentryItem vPdbentryItem) - throws java.lang.IndexOutOfBoundsException - { - this._items.addElement(vPdbentryItem); - } - - /** - * - * - * @param index - * @param vPdbentryItem - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void addPdbentryItem(final int index, - final jalview.binding.PdbentryItem vPdbentryItem) - throws java.lang.IndexOutOfBoundsException - { - this._items.add(index, vPdbentryItem); - } - - /** - * Method enumeratePdbentryItem. - * - * @return an Enumeration over all jalview.binding.PdbentryItem elements - */ - public java.util.Enumeration enumeratePdbentryItem() - { - return this._items.elements(); - } - - /** - * Returns the value of field 'id'. - * - * @return the value of field 'Id'. - */ - public java.lang.String getId() - { - return this._id; - } - - /** - * Method getPdbentryItem. - * - * @param index - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - * @return the value of the jalview.binding.PdbentryItem at the given index - */ - public jalview.binding.PdbentryItem getPdbentryItem(final int index) - throws java.lang.IndexOutOfBoundsException - { - // check bounds for index - if (index < 0 || index >= this._items.size()) - { - throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{ - "getPdbentryItem", - Integer.valueOf(index).toString(), - Integer.valueOf((this._items.size() - 1)).toString() - })); +public class Pdbentry implements java.io.Serializable { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field _id. + */ + private java.lang.String _id; + + /** + * Field _type. + */ + private java.lang.String _type; + + /** + * Field _items. + */ + private java.util.Vector _items; + + + //----------------/ + //- Constructors -/ + //----------------/ + + public Pdbentry() { + super(); + this._items = new java.util.Vector(); } - return (jalview.binding.PdbentryItem) _items.get(index); - } - - /** - * Method getPdbentryItem.Returns the contents of the collection in an Array. - *

    - * Note: Just in case the collection contents are changing in another thread, - * we pass a 0-length Array of the correct type into the API call. This way we - * know that the Array returned is of exactly the correct length. - * - * @return this collection as an Array - */ - public jalview.binding.PdbentryItem[] getPdbentryItem() - { - jalview.binding.PdbentryItem[] array = new jalview.binding.PdbentryItem[0]; - return (jalview.binding.PdbentryItem[]) this._items.toArray(array); - } - - /** - * Method getPdbentryItemCount. - * - * @return the size of this collection - */ - public int getPdbentryItemCount() - { - return this._items.size(); - } - - /** - * Returns the value of field 'type'. - * - * @return the value of field 'Type'. - */ - public java.lang.String getType() - { - return this._type; - } - - /** - * Method isValid. - * - * @return true if this object is valid according to the schema - */ - public boolean isValid() - { - try - { - validate(); - } catch (org.exolab.castor.xml.ValidationException vex) - { - return false; + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * + * + * @param vPdbentryItem + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addPdbentryItem( + final jalview.binding.PdbentryItem vPdbentryItem) + throws java.lang.IndexOutOfBoundsException { + this._items.addElement(vPdbentryItem); + } + + /** + * + * + * @param index + * @param vPdbentryItem + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addPdbentryItem( + final int index, + final jalview.binding.PdbentryItem vPdbentryItem) + throws java.lang.IndexOutOfBoundsException { + this._items.add(index, vPdbentryItem); + } + + /** + * Method enumeratePdbentryItem. + * + * @return an Enumeration over all jalview.binding.PdbentryItem + * elements + */ + public java.util.Enumeration enumeratePdbentryItem( + ) { + return this._items.elements(); + } + + /** + * Returns the value of field 'id'. + * + * @return the value of field 'Id'. + */ + public java.lang.String getId( + ) { + return this._id; } - return true; - } - - /** - * - * - * @param out - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - */ - public void marshal(final java.io.Writer out) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - Marshaller.marshal(this, out); - } - - /** - * - * - * @param handler - * @throws java.io.IOException - * if an IOException occurs during marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - */ - public void marshal(final org.xml.sax.ContentHandler handler) - throws java.io.IOException, - org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - Marshaller.marshal(this, handler); - } - - /** + + /** + * Method getPdbentryItem. + * + * @param index + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + * @return the value of the jalview.binding.PdbentryItem at the + * given index + */ + public jalview.binding.PdbentryItem getPdbentryItem( + final int index) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._items.size()) { + throw new IndexOutOfBoundsException("getPdbentryItem: Index value '" + index + "' not in range [0.." + (this._items.size() - 1) + "]"); + } + + return (jalview.binding.PdbentryItem) _items.get(index); + } + + /** + * Method getPdbentryItem.Returns the contents of the + * collection in an Array.

    Note: Just in case the + * collection contents are changing in another thread, we pass + * a 0-length Array of the correct type into the API call. + * This way we know that the Array returned is of + * exactly the correct length. + * + * @return this collection as an Array */ - public void removeAllPdbentryItem() - { - this._items.clear(); - } - - /** - * Method removePdbentryItem. - * - * @param vPdbentryItem - * @return true if the object was removed from the collection. - */ - public boolean removePdbentryItem( - final jalview.binding.PdbentryItem vPdbentryItem) - { - boolean removed = _items.remove(vPdbentryItem); - return removed; - } - - /** - * Method removePdbentryItemAt. - * - * @param index - * @return the element removed from the collection - */ - public jalview.binding.PdbentryItem removePdbentryItemAt(final int index) - { - java.lang.Object obj = this._items.remove(index); - return (jalview.binding.PdbentryItem) obj; - } - - /** - * Sets the value of field 'id'. - * - * @param id - * the value of field 'id'. - */ - public void setId(final java.lang.String id) - { - this._id = id; - } - - /** - * - * - * @param index - * @param vPdbentryItem - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void setPdbentryItem(final int index, - final jalview.binding.PdbentryItem vPdbentryItem) - throws java.lang.IndexOutOfBoundsException - { - // check bounds for index - if (index < 0 || index >= this._items.size()) - { - throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{ - "setPdbentryItem", - Integer.valueOf(index).toString(), - Integer.valueOf((this._items.size() - 1)).toString() - })); + public jalview.binding.PdbentryItem[] getPdbentryItem( + ) { + jalview.binding.PdbentryItem[] array = new jalview.binding.PdbentryItem[0]; + return (jalview.binding.PdbentryItem[]) this._items.toArray(array); } - this._items.set(index, vPdbentryItem); - } - - /** - * - * - * @param vPdbentryItemArray - */ - public void setPdbentryItem( - final jalview.binding.PdbentryItem[] vPdbentryItemArray) - { - // -- copy array - _items.clear(); - - for (int i = 0; i < vPdbentryItemArray.length; i++) - { - this._items.add(vPdbentryItemArray[i]); + /** + * Method getPdbentryItemCount. + * + * @return the size of this collection + */ + public int getPdbentryItemCount( + ) { + return this._items.size(); + } + + /** + * Returns the value of field 'type'. + * + * @return the value of field 'Type'. + */ + public java.lang.String getType( + ) { + return this._type; + } + + /** + * Method isValid. + * + * @return true if this object is valid according to the schema + */ + public boolean isValid( + ) { + try { + validate(); + } catch (org.exolab.castor.xml.ValidationException vex) { + return false; + } + return true; + } + + /** + * + * + * @param out + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void marshal( + final java.io.Writer out) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, out); + } + + /** + * + * + * @param handler + * @throws java.io.IOException if an IOException occurs during + * marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + */ + public void marshal( + final org.xml.sax.ContentHandler handler) + throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, handler); + } + + /** + */ + public void removeAllPdbentryItem( + ) { + this._items.clear(); + } + + /** + * Method removePdbentryItem. + * + * @param vPdbentryItem + * @return true if the object was removed from the collection. + */ + public boolean removePdbentryItem( + final jalview.binding.PdbentryItem vPdbentryItem) { + boolean removed = _items.remove(vPdbentryItem); + return removed; + } + + /** + * Method removePdbentryItemAt. + * + * @param index + * @return the element removed from the collection + */ + public jalview.binding.PdbentryItem removePdbentryItemAt( + final int index) { + java.lang.Object obj = this._items.remove(index); + return (jalview.binding.PdbentryItem) obj; + } + + /** + * Sets the value of field 'id'. + * + * @param id the value of field 'id'. + */ + public void setId( + final java.lang.String id) { + this._id = id; + } + + /** + * + * + * @param index + * @param vPdbentryItem + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void setPdbentryItem( + final int index, + final jalview.binding.PdbentryItem vPdbentryItem) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._items.size()) { + throw new IndexOutOfBoundsException("setPdbentryItem: Index value '" + index + "' not in range [0.." + (this._items.size() - 1) + "]"); + } + + this._items.set(index, vPdbentryItem); + } + + /** + * + * + * @param vPdbentryItemArray + */ + public void setPdbentryItem( + final jalview.binding.PdbentryItem[] vPdbentryItemArray) { + //-- copy array + _items.clear(); + + for (int i = 0; i < vPdbentryItemArray.length; i++) { + this._items.add(vPdbentryItemArray[i]); + } + } + + /** + * Sets the value of field 'type'. + * + * @param type the value of field 'type'. + */ + public void setType( + final java.lang.String type) { + this._type = type; + } + + /** + * Method unmarshal. + * + * @param reader + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @return the unmarshaled jalview.binding.Pdbentry + */ + public static jalview.binding.Pdbentry unmarshal( + final java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + return (jalview.binding.Pdbentry) Unmarshaller.unmarshal(jalview.binding.Pdbentry.class, reader); + } + + /** + * + * + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void validate( + ) + throws org.exolab.castor.xml.ValidationException { + org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); + validator.validate(this); } - } - - /** - * Sets the value of field 'type'. - * - * @param type - * the value of field 'type'. - */ - public void setType(final java.lang.String type) - { - this._type = type; - } - - /** - * Method unmarshal. - * - * @param reader - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - * @return the unmarshaled jalview.binding.Pdbentry - */ - public static jalview.binding.Pdbentry unmarshal( - final java.io.Reader reader) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - return (jalview.binding.Pdbentry) Unmarshaller.unmarshal( - jalview.binding.Pdbentry.class, reader); - } - - /** - * - * - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - */ - public void validate() throws org.exolab.castor.xml.ValidationException - { - org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); - validator.validate(this); - } } diff --git a/src/jalview/binding/PdbentryItem.java b/src/jalview/binding/PdbentryItem.java index 2e8d77d..83bc40a 100644 --- a/src/jalview/binding/PdbentryItem.java +++ b/src/jalview/binding/PdbentryItem.java @@ -1,215 +1,192 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) - * Copyright (C) $$Year-Rel$$ The Jalview Authors - * - * This file is part of Jalview. - * - * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. - * - * Jalview is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Jalview. If not, see . - * The Jalview Authors are detailed in the 'AUTHORS' file. + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ */ -package jalview.binding; -import jalview.util.MessageManager; +package jalview.binding; /** * Class PdbentryItem. * * @version $Revision$ $Date$ */ -public class PdbentryItem implements java.io.Serializable -{ - - // --------------------------/ - // - Class/Member Variables -/ - // --------------------------/ - - /** - * Field _propertyList. - */ - private java.util.Vector _propertyList; - - // ----------------/ - // - Constructors -/ - // ----------------/ - - public PdbentryItem() - { - super(); - this._propertyList = new java.util.Vector(); - } - - // -----------/ - // - Methods -/ - // -----------/ - - /** - * - * - * @param vProperty - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void addProperty(final jalview.binding.Property vProperty) - throws java.lang.IndexOutOfBoundsException - { - this._propertyList.addElement(vProperty); - } - - /** - * - * - * @param index - * @param vProperty - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void addProperty(final int index, - final jalview.binding.Property vProperty) - throws java.lang.IndexOutOfBoundsException - { - this._propertyList.add(index, vProperty); - } - - /** - * Method enumerateProperty. - * - * @return an Enumeration over all jalview.binding.Property elements - */ - public java.util.Enumeration enumerateProperty() - { - return this._propertyList.elements(); - } - - /** - * Method getProperty. - * - * @param index - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - * @return the value of the jalview.binding.Property at the given index - */ - public jalview.binding.Property getProperty(final int index) - throws java.lang.IndexOutOfBoundsException - { - // check bounds for index - if (index < 0 || index >= this._propertyList.size()) - { - throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{ - "getProperty", - Integer.valueOf(index).toString(), - Integer.valueOf((this._propertyList.size() - 1)).toString() - })); +public class PdbentryItem implements java.io.Serializable { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field _propertyList. + */ + private java.util.Vector _propertyList; + + + //----------------/ + //- Constructors -/ + //----------------/ + + public PdbentryItem() { + super(); + this._propertyList = new java.util.Vector(); + } + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * + * + * @param vProperty + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addProperty( + final jalview.binding.Property vProperty) + throws java.lang.IndexOutOfBoundsException { + this._propertyList.addElement(vProperty); + } + + /** + * + * + * @param index + * @param vProperty + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addProperty( + final int index, + final jalview.binding.Property vProperty) + throws java.lang.IndexOutOfBoundsException { + this._propertyList.add(index, vProperty); + } + + /** + * Method enumerateProperty. + * + * @return an Enumeration over all jalview.binding.Property + * elements + */ + public java.util.Enumeration enumerateProperty( + ) { + return this._propertyList.elements(); + } + + /** + * Method getProperty. + * + * @param index + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + * @return the value of the jalview.binding.Property at the + * given index + */ + public jalview.binding.Property getProperty( + final int index) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._propertyList.size()) { + throw new IndexOutOfBoundsException("getProperty: Index value '" + index + "' not in range [0.." + (this._propertyList.size() - 1) + "]"); + } + + return (jalview.binding.Property) _propertyList.get(index); + } + + /** + * Method getProperty.Returns the contents of the collection in + * an Array.

    Note: Just in case the collection contents + * are changing in another thread, we pass a 0-length Array of + * the correct type into the API call. This way we know + * that the Array returned is of exactly the correct length. + * + * @return this collection as an Array + */ + public jalview.binding.Property[] getProperty( + ) { + jalview.binding.Property[] array = new jalview.binding.Property[0]; + return (jalview.binding.Property[]) this._propertyList.toArray(array); + } + + /** + * Method getPropertyCount. + * + * @return the size of this collection + */ + public int getPropertyCount( + ) { + return this._propertyList.size(); } - return (jalview.binding.Property) _propertyList.get(index); - } - - /** - * Method getProperty.Returns the contents of the collection in an Array. - *

    - * Note: Just in case the collection contents are changing in another thread, - * we pass a 0-length Array of the correct type into the API call. This way we - * know that the Array returned is of exactly the correct length. - * - * @return this collection as an Array - */ - public jalview.binding.Property[] getProperty() - { - jalview.binding.Property[] array = new jalview.binding.Property[0]; - return (jalview.binding.Property[]) this._propertyList.toArray(array); - } - - /** - * Method getPropertyCount. - * - * @return the size of this collection - */ - public int getPropertyCount() - { - return this._propertyList.size(); - } - - /** + /** */ - public void removeAllProperty() - { - this._propertyList.clear(); - } - - /** - * Method removeProperty. - * - * @param vProperty - * @return true if the object was removed from the collection. - */ - public boolean removeProperty(final jalview.binding.Property vProperty) - { - boolean removed = _propertyList.remove(vProperty); - return removed; - } - - /** - * Method removePropertyAt. - * - * @param index - * @return the element removed from the collection - */ - public jalview.binding.Property removePropertyAt(final int index) - { - java.lang.Object obj = this._propertyList.remove(index); - return (jalview.binding.Property) obj; - } - - /** - * - * - * @param index - * @param vProperty - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void setProperty(final int index, - final jalview.binding.Property vProperty) - throws java.lang.IndexOutOfBoundsException - { - // check bounds for index - if (index < 0 || index >= this._propertyList.size()) - { - throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{ - "setProperty", - Integer.valueOf(index).toString(), - Integer.valueOf((this._propertyList.size() - 1)).toString() - })); + public void removeAllProperty( + ) { + this._propertyList.clear(); } - this._propertyList.set(index, vProperty); - } - - /** - * - * - * @param vPropertyArray - */ - public void setProperty(final jalview.binding.Property[] vPropertyArray) - { - // -- copy array - _propertyList.clear(); - - for (int i = 0; i < vPropertyArray.length; i++) - { - this._propertyList.add(vPropertyArray[i]); + /** + * Method removeProperty. + * + * @param vProperty + * @return true if the object was removed from the collection. + */ + public boolean removeProperty( + final jalview.binding.Property vProperty) { + boolean removed = _propertyList.remove(vProperty); + return removed; + } + + /** + * Method removePropertyAt. + * + * @param index + * @return the element removed from the collection + */ + public jalview.binding.Property removePropertyAt( + final int index) { + java.lang.Object obj = this._propertyList.remove(index); + return (jalview.binding.Property) obj; + } + + /** + * + * + * @param index + * @param vProperty + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void setProperty( + final int index, + final jalview.binding.Property vProperty) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._propertyList.size()) { + throw new IndexOutOfBoundsException("setProperty: Index value '" + index + "' not in range [0.." + (this._propertyList.size() - 1) + "]"); + } + + this._propertyList.set(index, vProperty); + } + + /** + * + * + * @param vPropertyArray + */ + public void setProperty( + final jalview.binding.Property[] vPropertyArray) { + //-- copy array + _propertyList.clear(); + + for (int i = 0; i < vPropertyArray.length; i++) { + this._propertyList.add(vPropertyArray[i]); + } } - } } diff --git a/src/jalview/binding/Pdbids.java b/src/jalview/binding/Pdbids.java index a37f249..b4745a2 100644 --- a/src/jalview/binding/Pdbids.java +++ b/src/jalview/binding/Pdbids.java @@ -1,27 +1,14 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) - * Copyright (C) $$Year-Rel$$ The Jalview Authors - * - * This file is part of Jalview. - * - * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. - * - * Jalview is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Jalview. If not, see . - * The Jalview Authors are detailed in the 'AUTHORS' file. + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ */ + package jalview.binding; -//---------------------------------/ -//- Imported classes and packages -/ + //---------------------------------/ + //- Imported classes and packages -/ //---------------------------------/ import org.exolab.castor.xml.Marshaller; @@ -32,106 +19,98 @@ import org.exolab.castor.xml.Unmarshaller; * * @version $Revision$ $Date$ */ -public class Pdbids extends Pdbentry implements java.io.Serializable +public class Pdbids extends Pdbentry +implements java.io.Serializable { - // ----------------/ - // - Constructors -/ - // ----------------/ - public Pdbids() - { - super(); - } + //----------------/ + //- Constructors -/ + //----------------/ + + public Pdbids() { + super(); + } + - // -----------/ - // - Methods -/ - // -----------/ + //-----------/ + //- Methods -/ + //-----------/ - /** - * Method isValid. - * - * @return true if this object is valid according to the schema - */ - public boolean isValid() - { - try - { - validate(); - } catch (org.exolab.castor.xml.ValidationException vex) - { - return false; + /** + * Method isValid. + * + * @return true if this object is valid according to the schema + */ + public boolean isValid( + ) { + try { + validate(); + } catch (org.exolab.castor.xml.ValidationException vex) { + return false; + } + return true; } - return true; - } - /** - * - * - * @param out - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - */ - public void marshal(final java.io.Writer out) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - Marshaller.marshal(this, out); - } + /** + * + * + * @param out + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void marshal( + final java.io.Writer out) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, out); + } - /** - * - * - * @param handler - * @throws java.io.IOException - * if an IOException occurs during marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - */ - public void marshal(final org.xml.sax.ContentHandler handler) - throws java.io.IOException, - org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - Marshaller.marshal(this, handler); - } + /** + * + * + * @param handler + * @throws java.io.IOException if an IOException occurs during + * marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + */ + public void marshal( + final org.xml.sax.ContentHandler handler) + throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, handler); + } - /** - * Method unmarshal. - * - * @param reader - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - * @return the unmarshaled jalview.binding.Pdbentry - */ - public static jalview.binding.Pdbentry unmarshal( - final java.io.Reader reader) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - return (jalview.binding.Pdbentry) Unmarshaller.unmarshal( - jalview.binding.Pdbids.class, reader); - } + /** + * Method unmarshal. + * + * @param reader + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @return the unmarshaled jalview.binding.Pdbentry + */ + public static jalview.binding.Pdbentry unmarshal( + final java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + return (jalview.binding.Pdbentry) Unmarshaller.unmarshal(jalview.binding.Pdbids.class, reader); + } - /** - * - * - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - */ - public void validate() throws org.exolab.castor.xml.ValidationException - { - org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); - validator.validate(this); - } + /** + * + * + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void validate( + ) + throws org.exolab.castor.xml.ValidationException { + org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); + validator.validate(this); + } } diff --git a/src/jalview/binding/Property.java b/src/jalview/binding/Property.java index 8a3eb8c..f1114f7 100644 --- a/src/jalview/binding/Property.java +++ b/src/jalview/binding/Property.java @@ -1,27 +1,14 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) - * Copyright (C) $$Year-Rel$$ The Jalview Authors - * - * This file is part of Jalview. - * - * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. - * - * Jalview is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Jalview. If not, see . - * The Jalview Authors are detailed in the 'AUTHORS' file. + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ */ + package jalview.binding; -//---------------------------------/ -//- Imported classes and packages -/ + //---------------------------------/ + //- Imported classes and packages -/ //---------------------------------/ import org.exolab.castor.xml.Marshaller; @@ -32,162 +19,151 @@ import org.exolab.castor.xml.Unmarshaller; * * @version $Revision$ $Date$ */ -public class Property implements java.io.Serializable -{ - - // --------------------------/ - // - Class/Member Variables -/ - // --------------------------/ - - /** - * Field _name. - */ - private java.lang.String _name; - - /** - * Field _value. - */ - private java.lang.String _value; - - // ----------------/ - // - Constructors -/ - // ----------------/ - - public Property() - { - super(); - } - - // -----------/ - // - Methods -/ - // -----------/ - - /** - * Returns the value of field 'name'. - * - * @return the value of field 'Name'. - */ - public java.lang.String getName() - { - return this._name; - } - - /** - * Returns the value of field 'value'. - * - * @return the value of field 'Value'. - */ - public java.lang.String getValue() - { - return this._value; - } - - /** - * Method isValid. - * - * @return true if this object is valid according to the schema - */ - public boolean isValid() - { - try - { - validate(); - } catch (org.exolab.castor.xml.ValidationException vex) - { - return false; +public class Property implements java.io.Serializable { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field _name. + */ + private java.lang.String _name; + + /** + * Field _value. + */ + private java.lang.String _value; + + + //----------------/ + //- Constructors -/ + //----------------/ + + public Property() { + super(); + } + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Returns the value of field 'name'. + * + * @return the value of field 'Name'. + */ + public java.lang.String getName( + ) { + return this._name; + } + + /** + * Returns the value of field 'value'. + * + * @return the value of field 'Value'. + */ + public java.lang.String getValue( + ) { + return this._value; + } + + /** + * Method isValid. + * + * @return true if this object is valid according to the schema + */ + public boolean isValid( + ) { + try { + validate(); + } catch (org.exolab.castor.xml.ValidationException vex) { + return false; + } + return true; + } + + /** + * + * + * @param out + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void marshal( + final java.io.Writer out) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, out); + } + + /** + * + * + * @param handler + * @throws java.io.IOException if an IOException occurs during + * marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + */ + public void marshal( + final org.xml.sax.ContentHandler handler) + throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, handler); + } + + /** + * Sets the value of field 'name'. + * + * @param name the value of field 'name'. + */ + public void setName( + final java.lang.String name) { + this._name = name; + } + + /** + * Sets the value of field 'value'. + * + * @param value the value of field 'value'. + */ + public void setValue( + final java.lang.String value) { + this._value = value; + } + + /** + * Method unmarshal. + * + * @param reader + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @return the unmarshaled jalview.binding.Property + */ + public static jalview.binding.Property unmarshal( + final java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + return (jalview.binding.Property) Unmarshaller.unmarshal(jalview.binding.Property.class, reader); + } + + /** + * + * + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void validate( + ) + throws org.exolab.castor.xml.ValidationException { + org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); + validator.validate(this); } - return true; - } - - /** - * - * - * @param out - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - */ - public void marshal(final java.io.Writer out) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - Marshaller.marshal(this, out); - } - - /** - * - * - * @param handler - * @throws java.io.IOException - * if an IOException occurs during marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - */ - public void marshal(final org.xml.sax.ContentHandler handler) - throws java.io.IOException, - org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - Marshaller.marshal(this, handler); - } - - /** - * Sets the value of field 'name'. - * - * @param name - * the value of field 'name'. - */ - public void setName(final java.lang.String name) - { - this._name = name; - } - - /** - * Sets the value of field 'value'. - * - * @param value - * the value of field 'value'. - */ - public void setValue(final java.lang.String value) - { - this._value = value; - } - - /** - * Method unmarshal. - * - * @param reader - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - * @return the unmarshaled jalview.binding.Property - */ - public static jalview.binding.Property unmarshal( - final java.io.Reader reader) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - return (jalview.binding.Property) Unmarshaller.unmarshal( - jalview.binding.Property.class, reader); - } - - /** - * - * - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - */ - public void validate() throws org.exolab.castor.xml.ValidationException - { - org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); - validator.validate(this); - } } diff --git a/src/jalview/binding/Sequence.java b/src/jalview/binding/Sequence.java index 17762a3..9c8cbc2 100644 --- a/src/jalview/binding/Sequence.java +++ b/src/jalview/binding/Sequence.java @@ -1,27 +1,14 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) - * Copyright (C) $$Year-Rel$$ The Jalview Authors - * - * This file is part of Jalview. - * - * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. - * - * Jalview is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Jalview. If not, see . - * The Jalview Authors are detailed in the 'AUTHORS' file. + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ */ + package jalview.binding; -//---------------------------------/ -//- Imported classes and packages -/ + //---------------------------------/ + //- Imported classes and packages -/ //---------------------------------/ import org.exolab.castor.xml.Marshaller; @@ -32,106 +19,98 @@ import org.exolab.castor.xml.Unmarshaller; * * @version $Revision$ $Date$ */ -public class Sequence extends SequenceType implements java.io.Serializable +public class Sequence extends SequenceType +implements java.io.Serializable { - // ----------------/ - // - Constructors -/ - // ----------------/ - public Sequence() - { - super(); - } + //----------------/ + //- Constructors -/ + //----------------/ + + public Sequence() { + super(); + } + - // -----------/ - // - Methods -/ - // -----------/ + //-----------/ + //- Methods -/ + //-----------/ - /** - * Method isValid. - * - * @return true if this object is valid according to the schema - */ - public boolean isValid() - { - try - { - validate(); - } catch (org.exolab.castor.xml.ValidationException vex) - { - return false; + /** + * Method isValid. + * + * @return true if this object is valid according to the schema + */ + public boolean isValid( + ) { + try { + validate(); + } catch (org.exolab.castor.xml.ValidationException vex) { + return false; + } + return true; } - return true; - } - /** - * - * - * @param out - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - */ - public void marshal(final java.io.Writer out) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - Marshaller.marshal(this, out); - } + /** + * + * + * @param out + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void marshal( + final java.io.Writer out) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, out); + } - /** - * - * - * @param handler - * @throws java.io.IOException - * if an IOException occurs during marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - */ - public void marshal(final org.xml.sax.ContentHandler handler) - throws java.io.IOException, - org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - Marshaller.marshal(this, handler); - } + /** + * + * + * @param handler + * @throws java.io.IOException if an IOException occurs during + * marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + */ + public void marshal( + final org.xml.sax.ContentHandler handler) + throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, handler); + } - /** - * Method unmarshal. - * - * @param reader - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - * @return the unmarshaled jalview.binding.SequenceType - */ - public static jalview.binding.SequenceType unmarshal( - final java.io.Reader reader) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - return (jalview.binding.SequenceType) Unmarshaller.unmarshal( - jalview.binding.Sequence.class, reader); - } + /** + * Method unmarshal. + * + * @param reader + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @return the unmarshaled jalview.binding.SequenceType + */ + public static jalview.binding.SequenceType unmarshal( + final java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + return (jalview.binding.SequenceType) Unmarshaller.unmarshal(jalview.binding.Sequence.class, reader); + } - /** - * - * - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - */ - public void validate() throws org.exolab.castor.xml.ValidationException - { - org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); - validator.validate(this); - } + /** + * + * + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void validate( + ) + throws org.exolab.castor.xml.ValidationException { + org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); + validator.validate(this); + } } diff --git a/src/jalview/binding/SequenceSet.java b/src/jalview/binding/SequenceSet.java index 05da739..13a9020 100644 --- a/src/jalview/binding/SequenceSet.java +++ b/src/jalview/binding/SequenceSet.java @@ -1,30 +1,15 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) - * Copyright (C) $$Year-Rel$$ The Jalview Authors - * - * This file is part of Jalview. - * - * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. - * - * Jalview is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Jalview. If not, see . - * The Jalview Authors are detailed in the 'AUTHORS' file. + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ */ + package jalview.binding; + //---------------------------------/ + //- Imported classes and packages -/ //---------------------------------/ -//- Imported classes and packages -/ -//---------------------------------/ - -import jalview.util.MessageManager; import org.exolab.castor.xml.Marshaller; import org.exolab.castor.xml.Unmarshaller; @@ -34,528 +19,496 @@ import org.exolab.castor.xml.Unmarshaller; * * @version $Revision$ $Date$ */ -public class SequenceSet implements java.io.Serializable -{ - - // --------------------------/ - // - Class/Member Variables -/ - // --------------------------/ - - /** - * Field _gapChar. - */ - private java.lang.String _gapChar; - - /** - * Field _aligned. - */ - private boolean _aligned; - - /** - * keeps track of state for field: _aligned - */ - private boolean _has_aligned; - - /** - * Field _sequenceList. - */ - private java.util.Vector _sequenceList; - - /** - * Field _annotationList. - */ - private java.util.Vector _annotationList; - - // ----------------/ - // - Constructors -/ - // ----------------/ - - public SequenceSet() - { - super(); - this._sequenceList = new java.util.Vector(); - this._annotationList = new java.util.Vector(); - } - - // -----------/ - // - Methods -/ - // -----------/ - - /** - * - * - * @param vAnnotation - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void addAnnotation(final jalview.binding.Annotation vAnnotation) - throws java.lang.IndexOutOfBoundsException - { - this._annotationList.addElement(vAnnotation); - } - - /** - * - * - * @param index - * @param vAnnotation - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void addAnnotation(final int index, - final jalview.binding.Annotation vAnnotation) - throws java.lang.IndexOutOfBoundsException - { - this._annotationList.add(index, vAnnotation); - } - - /** - * - * - * @param vSequence - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void addSequence(final jalview.binding.Sequence vSequence) - throws java.lang.IndexOutOfBoundsException - { - this._sequenceList.addElement(vSequence); - } - - /** - * - * - * @param index - * @param vSequence - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void addSequence(final int index, - final jalview.binding.Sequence vSequence) - throws java.lang.IndexOutOfBoundsException - { - this._sequenceList.add(index, vSequence); - } - - /** - */ - public void deleteAligned() - { - this._has_aligned = false; - } - - /** - * Method enumerateAnnotation. - * - * @return an Enumeration over all jalview.binding.Annotation elements - */ - public java.util.Enumeration enumerateAnnotation() - { - return this._annotationList.elements(); - } - - /** - * Method enumerateSequence. - * - * @return an Enumeration over all jalview.binding.Sequence elements - */ - public java.util.Enumeration enumerateSequence() - { - return this._sequenceList.elements(); - } - - /** - * Returns the value of field 'aligned'. - * - * @return the value of field 'Aligned'. - */ - public boolean getAligned() - { - return this._aligned; - } - - /** - * Method getAnnotation. - * - * @param index - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - * @return the value of the jalview.binding.Annotation at the given index - */ - public jalview.binding.Annotation getAnnotation(final int index) - throws java.lang.IndexOutOfBoundsException - { - // check bounds for index - if (index < 0 || index >= this._annotationList.size()) - { - throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{ - "getAnnotation", - Integer.valueOf(index).toString(), - Integer.valueOf((this._annotationList.size() - 1)).toString() - })); - } - - return (jalview.binding.Annotation) _annotationList.get(index); - } - - /** - * Method getAnnotation.Returns the contents of the collection in an Array. - *

    - * Note: Just in case the collection contents are changing in another thread, - * we pass a 0-length Array of the correct type into the API call. This way we - * know that the Array returned is of exactly the correct length. - * - * @return this collection as an Array - */ - public jalview.binding.Annotation[] getAnnotation() - { - jalview.binding.Annotation[] array = new jalview.binding.Annotation[0]; - return (jalview.binding.Annotation[]) this._annotationList - .toArray(array); - } - - /** - * Method getAnnotationCount. - * - * @return the size of this collection - */ - public int getAnnotationCount() - { - return this._annotationList.size(); - } - - /** - * Returns the value of field 'gapChar'. - * - * @return the value of field 'GapChar'. - */ - public java.lang.String getGapChar() - { - return this._gapChar; - } - - /** - * Method getSequence. - * - * @param index - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - * @return the value of the jalview.binding.Sequence at the given index - */ - public jalview.binding.Sequence getSequence(final int index) - throws java.lang.IndexOutOfBoundsException - { - // check bounds for index - if (index < 0 || index >= this._sequenceList.size()) - { - throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{ - "getSequence", - Integer.valueOf(index).toString(), - Integer.valueOf((this._sequenceList.size() - 1)).toString() - })); - } - - return (jalview.binding.Sequence) _sequenceList.get(index); - } - - /** - * Method getSequence.Returns the contents of the collection in an Array. - *

    - * Note: Just in case the collection contents are changing in another thread, - * we pass a 0-length Array of the correct type into the API call. This way we - * know that the Array returned is of exactly the correct length. - * - * @return this collection as an Array - */ - public jalview.binding.Sequence[] getSequence() - { - jalview.binding.Sequence[] array = new jalview.binding.Sequence[0]; - return (jalview.binding.Sequence[]) this._sequenceList.toArray(array); - } - - /** - * Method getSequenceCount. - * - * @return the size of this collection - */ - public int getSequenceCount() - { - return this._sequenceList.size(); - } - - /** - * Method hasAligned. - * - * @return true if at least one Aligned has been added - */ - public boolean hasAligned() - { - return this._has_aligned; - } - - /** - * Returns the value of field 'aligned'. - * - * @return the value of field 'Aligned'. - */ - public boolean isAligned() - { - return this._aligned; - } - - /** - * Method isValid. - * - * @return true if this object is valid according to the schema - */ - public boolean isValid() - { - try - { - validate(); - } catch (org.exolab.castor.xml.ValidationException vex) - { - return false; - } - return true; - } - - /** - * - * - * @param out - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - */ - public void marshal(final java.io.Writer out) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - Marshaller.marshal(this, out); - } - - /** - * - * - * @param handler - * @throws java.io.IOException - * if an IOException occurs during marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - */ - public void marshal(final org.xml.sax.ContentHandler handler) - throws java.io.IOException, - org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - Marshaller.marshal(this, handler); - } - - /** - */ - public void removeAllAnnotation() - { - this._annotationList.clear(); - } - - /** - */ - public void removeAllSequence() - { - this._sequenceList.clear(); - } - - /** - * Method removeAnnotation. - * - * @param vAnnotation - * @return true if the object was removed from the collection. - */ - public boolean removeAnnotation( - final jalview.binding.Annotation vAnnotation) - { - boolean removed = _annotationList.remove(vAnnotation); - return removed; - } - - /** - * Method removeAnnotationAt. - * - * @param index - * @return the element removed from the collection - */ - public jalview.binding.Annotation removeAnnotationAt(final int index) - { - java.lang.Object obj = this._annotationList.remove(index); - return (jalview.binding.Annotation) obj; - } - - /** - * Method removeSequence. - * - * @param vSequence - * @return true if the object was removed from the collection. - */ - public boolean removeSequence(final jalview.binding.Sequence vSequence) - { - boolean removed = _sequenceList.remove(vSequence); - return removed; - } - - /** - * Method removeSequenceAt. - * - * @param index - * @return the element removed from the collection - */ - public jalview.binding.Sequence removeSequenceAt(final int index) - { - java.lang.Object obj = this._sequenceList.remove(index); - return (jalview.binding.Sequence) obj; - } - - /** - * Sets the value of field 'aligned'. - * - * @param aligned - * the value of field 'aligned'. - */ - public void setAligned(final boolean aligned) - { - this._aligned = aligned; - this._has_aligned = true; - } - - /** - * - * - * @param index - * @param vAnnotation - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void setAnnotation(final int index, - final jalview.binding.Annotation vAnnotation) - throws java.lang.IndexOutOfBoundsException - { - // check bounds for index - if (index < 0 || index >= this._annotationList.size()) - { - throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{ - "setAnnotation", - Integer.valueOf(index).toString(), - Integer.valueOf((this._annotationList.size() - 1)).toString() - })); - } - - this._annotationList.set(index, vAnnotation); - } - - /** - * - * - * @param vAnnotationArray - */ - public void setAnnotation( - final jalview.binding.Annotation[] vAnnotationArray) - { - // -- copy array - _annotationList.clear(); - - for (int i = 0; i < vAnnotationArray.length; i++) - { - this._annotationList.add(vAnnotationArray[i]); - } - } - - /** - * Sets the value of field 'gapChar'. - * - * @param gapChar - * the value of field 'gapChar'. - */ - public void setGapChar(final java.lang.String gapChar) - { - this._gapChar = gapChar; - } - - /** - * - * - * @param index - * @param vSequence - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void setSequence(final int index, - final jalview.binding.Sequence vSequence) - throws java.lang.IndexOutOfBoundsException - { - // check bounds for index - if (index < 0 || index >= this._sequenceList.size()) - { - throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{ - "setSequence", - Integer.valueOf(index).toString(), - Integer.valueOf((this._sequenceList.size() - 1)).toString() - })); - } - - this._sequenceList.set(index, vSequence); - } - - /** - * - * - * @param vSequenceArray - */ - public void setSequence(final jalview.binding.Sequence[] vSequenceArray) - { - // -- copy array - _sequenceList.clear(); - - for (int i = 0; i < vSequenceArray.length; i++) - { - this._sequenceList.add(vSequenceArray[i]); - } - } - - /** - * Method unmarshal. - * - * @param reader - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - * @return the unmarshaled jalview.binding.SequenceSet - */ - public static jalview.binding.SequenceSet unmarshal( - final java.io.Reader reader) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - return (jalview.binding.SequenceSet) Unmarshaller.unmarshal( - jalview.binding.SequenceSet.class, reader); - } - - /** - * - * - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - */ - public void validate() throws org.exolab.castor.xml.ValidationException - { - org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); - validator.validate(this); - } +public class SequenceSet implements java.io.Serializable { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field _gapChar. + */ + private java.lang.String _gapChar; + + /** + * Field _aligned. + */ + private boolean _aligned; + + /** + * keeps track of state for field: _aligned + */ + private boolean _has_aligned; + + /** + * Field _sequenceList. + */ + private java.util.Vector _sequenceList; + + /** + * Field _annotationList. + */ + private java.util.Vector _annotationList; + + + //----------------/ + //- Constructors -/ + //----------------/ + + public SequenceSet() { + super(); + this._sequenceList = new java.util.Vector(); + this._annotationList = new java.util.Vector(); + } + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * + * + * @param vAnnotation + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addAnnotation( + final jalview.binding.Annotation vAnnotation) + throws java.lang.IndexOutOfBoundsException { + this._annotationList.addElement(vAnnotation); + } + + /** + * + * + * @param index + * @param vAnnotation + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addAnnotation( + final int index, + final jalview.binding.Annotation vAnnotation) + throws java.lang.IndexOutOfBoundsException { + this._annotationList.add(index, vAnnotation); + } + + /** + * + * + * @param vSequence + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addSequence( + final jalview.binding.Sequence vSequence) + throws java.lang.IndexOutOfBoundsException { + this._sequenceList.addElement(vSequence); + } + + /** + * + * + * @param index + * @param vSequence + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addSequence( + final int index, + final jalview.binding.Sequence vSequence) + throws java.lang.IndexOutOfBoundsException { + this._sequenceList.add(index, vSequence); + } + + /** + */ + public void deleteAligned( + ) { + this._has_aligned= false; + } + + /** + * Method enumerateAnnotation. + * + * @return an Enumeration over all jalview.binding.Annotation + * elements + */ + public java.util.Enumeration enumerateAnnotation( + ) { + return this._annotationList.elements(); + } + + /** + * Method enumerateSequence. + * + * @return an Enumeration over all jalview.binding.Sequence + * elements + */ + public java.util.Enumeration enumerateSequence( + ) { + return this._sequenceList.elements(); + } + + /** + * Returns the value of field 'aligned'. + * + * @return the value of field 'Aligned'. + */ + public boolean getAligned( + ) { + return this._aligned; + } + + /** + * Method getAnnotation. + * + * @param index + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + * @return the value of the jalview.binding.Annotation at the + * given index + */ + public jalview.binding.Annotation getAnnotation( + final int index) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._annotationList.size()) { + throw new IndexOutOfBoundsException("getAnnotation: Index value '" + index + "' not in range [0.." + (this._annotationList.size() - 1) + "]"); + } + + return (jalview.binding.Annotation) _annotationList.get(index); + } + + /** + * Method getAnnotation.Returns the contents of the collection + * in an Array.

    Note: Just in case the collection contents + * are changing in another thread, we pass a 0-length Array of + * the correct type into the API call. This way we know + * that the Array returned is of exactly the correct length. + * + * @return this collection as an Array + */ + public jalview.binding.Annotation[] getAnnotation( + ) { + jalview.binding.Annotation[] array = new jalview.binding.Annotation[0]; + return (jalview.binding.Annotation[]) this._annotationList.toArray(array); + } + + /** + * Method getAnnotationCount. + * + * @return the size of this collection + */ + public int getAnnotationCount( + ) { + return this._annotationList.size(); + } + + /** + * Returns the value of field 'gapChar'. + * + * @return the value of field 'GapChar'. + */ + public java.lang.String getGapChar( + ) { + return this._gapChar; + } + + /** + * Method getSequence. + * + * @param index + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + * @return the value of the jalview.binding.Sequence at the + * given index + */ + public jalview.binding.Sequence getSequence( + final int index) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._sequenceList.size()) { + throw new IndexOutOfBoundsException("getSequence: Index value '" + index + "' not in range [0.." + (this._sequenceList.size() - 1) + "]"); + } + + return (jalview.binding.Sequence) _sequenceList.get(index); + } + + /** + * Method getSequence.Returns the contents of the collection in + * an Array.

    Note: Just in case the collection contents + * are changing in another thread, we pass a 0-length Array of + * the correct type into the API call. This way we know + * that the Array returned is of exactly the correct length. + * + * @return this collection as an Array + */ + public jalview.binding.Sequence[] getSequence( + ) { + jalview.binding.Sequence[] array = new jalview.binding.Sequence[0]; + return (jalview.binding.Sequence[]) this._sequenceList.toArray(array); + } + + /** + * Method getSequenceCount. + * + * @return the size of this collection + */ + public int getSequenceCount( + ) { + return this._sequenceList.size(); + } + + /** + * Method hasAligned. + * + * @return true if at least one Aligned has been added + */ + public boolean hasAligned( + ) { + return this._has_aligned; + } + + /** + * Returns the value of field 'aligned'. + * + * @return the value of field 'Aligned'. + */ + public boolean isAligned( + ) { + return this._aligned; + } + + /** + * Method isValid. + * + * @return true if this object is valid according to the schema + */ + public boolean isValid( + ) { + try { + validate(); + } catch (org.exolab.castor.xml.ValidationException vex) { + return false; + } + return true; + } + + /** + * + * + * @param out + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void marshal( + final java.io.Writer out) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, out); + } + + /** + * + * + * @param handler + * @throws java.io.IOException if an IOException occurs during + * marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + */ + public void marshal( + final org.xml.sax.ContentHandler handler) + throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, handler); + } + + /** + */ + public void removeAllAnnotation( + ) { + this._annotationList.clear(); + } + + /** + */ + public void removeAllSequence( + ) { + this._sequenceList.clear(); + } + + /** + * Method removeAnnotation. + * + * @param vAnnotation + * @return true if the object was removed from the collection. + */ + public boolean removeAnnotation( + final jalview.binding.Annotation vAnnotation) { + boolean removed = _annotationList.remove(vAnnotation); + return removed; + } + + /** + * Method removeAnnotationAt. + * + * @param index + * @return the element removed from the collection + */ + public jalview.binding.Annotation removeAnnotationAt( + final int index) { + java.lang.Object obj = this._annotationList.remove(index); + return (jalview.binding.Annotation) obj; + } + + /** + * Method removeSequence. + * + * @param vSequence + * @return true if the object was removed from the collection. + */ + public boolean removeSequence( + final jalview.binding.Sequence vSequence) { + boolean removed = _sequenceList.remove(vSequence); + return removed; + } + + /** + * Method removeSequenceAt. + * + * @param index + * @return the element removed from the collection + */ + public jalview.binding.Sequence removeSequenceAt( + final int index) { + java.lang.Object obj = this._sequenceList.remove(index); + return (jalview.binding.Sequence) obj; + } + + /** + * Sets the value of field 'aligned'. + * + * @param aligned the value of field 'aligned'. + */ + public void setAligned( + final boolean aligned) { + this._aligned = aligned; + this._has_aligned = true; + } + + /** + * + * + * @param index + * @param vAnnotation + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void setAnnotation( + final int index, + final jalview.binding.Annotation vAnnotation) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._annotationList.size()) { + throw new IndexOutOfBoundsException("setAnnotation: Index value '" + index + "' not in range [0.." + (this._annotationList.size() - 1) + "]"); + } + + this._annotationList.set(index, vAnnotation); + } + + /** + * + * + * @param vAnnotationArray + */ + public void setAnnotation( + final jalview.binding.Annotation[] vAnnotationArray) { + //-- copy array + _annotationList.clear(); + + for (int i = 0; i < vAnnotationArray.length; i++) { + this._annotationList.add(vAnnotationArray[i]); + } + } + + /** + * Sets the value of field 'gapChar'. + * + * @param gapChar the value of field 'gapChar'. + */ + public void setGapChar( + final java.lang.String gapChar) { + this._gapChar = gapChar; + } + + /** + * + * + * @param index + * @param vSequence + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void setSequence( + final int index, + final jalview.binding.Sequence vSequence) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._sequenceList.size()) { + throw new IndexOutOfBoundsException("setSequence: Index value '" + index + "' not in range [0.." + (this._sequenceList.size() - 1) + "]"); + } + + this._sequenceList.set(index, vSequence); + } + + /** + * + * + * @param vSequenceArray + */ + public void setSequence( + final jalview.binding.Sequence[] vSequenceArray) { + //-- copy array + _sequenceList.clear(); + + for (int i = 0; i < vSequenceArray.length; i++) { + this._sequenceList.add(vSequenceArray[i]); + } + } + + /** + * Method unmarshal. + * + * @param reader + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @return the unmarshaled jalview.binding.SequenceSet + */ + public static jalview.binding.SequenceSet unmarshal( + final java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + return (jalview.binding.SequenceSet) Unmarshaller.unmarshal(jalview.binding.SequenceSet.class, reader); + } + + /** + * + * + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void validate( + ) + throws org.exolab.castor.xml.ValidationException { + org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); + validator.validate(this); + } } diff --git a/src/jalview/binding/SequenceType.java b/src/jalview/binding/SequenceType.java index c23a93b..1bb2a62 100644 --- a/src/jalview/binding/SequenceType.java +++ b/src/jalview/binding/SequenceType.java @@ -1,27 +1,14 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) - * Copyright (C) $$Year-Rel$$ The Jalview Authors - * - * This file is part of Jalview. - * - * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. - * - * Jalview is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Jalview. If not, see . - * The Jalview Authors are detailed in the 'AUTHORS' file. + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ */ + package jalview.binding; -//---------------------------------/ -//- Imported classes and packages -/ + //---------------------------------/ + //- Imported classes and packages -/ //---------------------------------/ import org.exolab.castor.xml.Marshaller; @@ -32,188 +19,176 @@ import org.exolab.castor.xml.Unmarshaller; * * @version $Revision$ $Date$ */ -public class SequenceType implements java.io.Serializable -{ - - // --------------------------/ - // - Class/Member Variables -/ - // --------------------------/ - - /** - * Field _id. - */ - private java.lang.String _id; - - /** - * Field _sequence. - */ - private java.lang.String _sequence; - - /** - * Field _name. - */ - private java.lang.String _name; - - // ----------------/ - // - Constructors -/ - // ----------------/ - - public SequenceType() - { - super(); - } - - // -----------/ - // - Methods -/ - // -----------/ - - /** - * Returns the value of field 'id'. - * - * @return the value of field 'Id'. - */ - public java.lang.String getId() - { - return this._id; - } - - /** - * Returns the value of field 'name'. - * - * @return the value of field 'Name'. - */ - public java.lang.String getName() - { - return this._name; - } - - /** - * Returns the value of field 'sequence'. - * - * @return the value of field 'Sequence'. - */ - public java.lang.String getSequence() - { - return this._sequence; - } - - /** - * Method isValid. - * - * @return true if this object is valid according to the schema - */ - public boolean isValid() - { - try - { - validate(); - } catch (org.exolab.castor.xml.ValidationException vex) - { - return false; +public class SequenceType implements java.io.Serializable { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field _id. + */ + private java.lang.String _id; + + /** + * Field _sequence. + */ + private java.lang.String _sequence; + + /** + * Field _name. + */ + private java.lang.String _name; + + + //----------------/ + //- Constructors -/ + //----------------/ + + public SequenceType() { + super(); + } + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Returns the value of field 'id'. + * + * @return the value of field 'Id'. + */ + public java.lang.String getId( + ) { + return this._id; + } + + /** + * Returns the value of field 'name'. + * + * @return the value of field 'Name'. + */ + public java.lang.String getName( + ) { + return this._name; + } + + /** + * Returns the value of field 'sequence'. + * + * @return the value of field 'Sequence'. + */ + public java.lang.String getSequence( + ) { + return this._sequence; + } + + /** + * Method isValid. + * + * @return true if this object is valid according to the schema + */ + public boolean isValid( + ) { + try { + validate(); + } catch (org.exolab.castor.xml.ValidationException vex) { + return false; + } + return true; + } + + /** + * + * + * @param out + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void marshal( + final java.io.Writer out) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, out); + } + + /** + * + * + * @param handler + * @throws java.io.IOException if an IOException occurs during + * marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + */ + public void marshal( + final org.xml.sax.ContentHandler handler) + throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, handler); + } + + /** + * Sets the value of field 'id'. + * + * @param id the value of field 'id'. + */ + public void setId( + final java.lang.String id) { + this._id = id; + } + + /** + * Sets the value of field 'name'. + * + * @param name the value of field 'name'. + */ + public void setName( + final java.lang.String name) { + this._name = name; + } + + /** + * Sets the value of field 'sequence'. + * + * @param sequence the value of field 'sequence'. + */ + public void setSequence( + final java.lang.String sequence) { + this._sequence = sequence; + } + + /** + * Method unmarshal. + * + * @param reader + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @return the unmarshaled jalview.binding.SequenceType + */ + public static jalview.binding.SequenceType unmarshal( + final java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + return (jalview.binding.SequenceType) Unmarshaller.unmarshal(jalview.binding.SequenceType.class, reader); + } + + /** + * + * + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void validate( + ) + throws org.exolab.castor.xml.ValidationException { + org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); + validator.validate(this); } - return true; - } - - /** - * - * - * @param out - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - */ - public void marshal(final java.io.Writer out) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - Marshaller.marshal(this, out); - } - - /** - * - * - * @param handler - * @throws java.io.IOException - * if an IOException occurs during marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - */ - public void marshal(final org.xml.sax.ContentHandler handler) - throws java.io.IOException, - org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - Marshaller.marshal(this, handler); - } - - /** - * Sets the value of field 'id'. - * - * @param id - * the value of field 'id'. - */ - public void setId(final java.lang.String id) - { - this._id = id; - } - - /** - * Sets the value of field 'name'. - * - * @param name - * the value of field 'name'. - */ - public void setName(final java.lang.String name) - { - this._name = name; - } - - /** - * Sets the value of field 'sequence'. - * - * @param sequence - * the value of field 'sequence'. - */ - public void setSequence(final java.lang.String sequence) - { - this._sequence = sequence; - } - - /** - * Method unmarshal. - * - * @param reader - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - * @return the unmarshaled jalview.binding.SequenceType - */ - public static jalview.binding.SequenceType unmarshal( - final java.io.Reader reader) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - return (jalview.binding.SequenceType) Unmarshaller.unmarshal( - jalview.binding.SequenceType.class, reader); - } - - /** - * - * - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - */ - public void validate() throws org.exolab.castor.xml.ValidationException - { - org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); - validator.validate(this); - } } diff --git a/src/jalview/binding/Setting.java b/src/jalview/binding/Setting.java index bde410f..9cd84b4 100644 --- a/src/jalview/binding/Setting.java +++ b/src/jalview/binding/Setting.java @@ -1,27 +1,14 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) - * Copyright (C) $$Year-Rel$$ The Jalview Authors - * - * This file is part of Jalview. - * - * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. - * - * Jalview is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Jalview. If not, see . - * The Jalview Authors are detailed in the 'AUTHORS' file. + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ */ + package jalview.binding; -//---------------------------------/ -//- Imported classes and packages -/ + //---------------------------------/ + //- Imported classes and packages -/ //---------------------------------/ import org.exolab.castor.xml.Marshaller; @@ -32,244 +19,232 @@ import org.exolab.castor.xml.Unmarshaller; * * @version $Revision$ $Date$ */ -public class Setting implements java.io.Serializable -{ - - // --------------------------/ - // - Class/Member Variables -/ - // --------------------------/ - - /** - * Field _type. - */ - private java.lang.String _type; - - /** - * Field _colour. - */ - private int _colour; - - /** - * keeps track of state for field: _colour - */ - private boolean _has_colour; - - /** - * Field _display. - */ - private boolean _display; - - /** - * keeps track of state for field: _display - */ - private boolean _has_display; - - // ----------------/ - // - Constructors -/ - // ----------------/ - - public Setting() - { - super(); - } - - // -----------/ - // - Methods -/ - // -----------/ - - /** +public class Setting implements java.io.Serializable { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field _type. + */ + private java.lang.String _type; + + /** + * Field _colour. + */ + private int _colour; + + /** + * keeps track of state for field: _colour + */ + private boolean _has_colour; + + /** + * Field _display. + */ + private boolean _display; + + /** + * keeps track of state for field: _display + */ + private boolean _has_display; + + + //----------------/ + //- Constructors -/ + //----------------/ + + public Setting() { + super(); + } + + + //-----------/ + //- Methods -/ + //-----------/ + + /** */ - public void deleteColour() - { - this._has_colour = false; - } + public void deleteColour( + ) { + this._has_colour= false; + } + + /** + */ + public void deleteDisplay( + ) { + this._has_display= false; + } + + /** + * Returns the value of field 'colour'. + * + * @return the value of field 'Colour'. + */ + public int getColour( + ) { + return this._colour; + } + + /** + * Returns the value of field 'display'. + * + * @return the value of field 'Display'. + */ + public boolean getDisplay( + ) { + return this._display; + } + + /** + * Returns the value of field 'type'. + * + * @return the value of field 'Type'. + */ + public java.lang.String getType( + ) { + return this._type; + } + + /** + * Method hasColour. + * + * @return true if at least one Colour has been added + */ + public boolean hasColour( + ) { + return this._has_colour; + } + + /** + * Method hasDisplay. + * + * @return true if at least one Display has been added + */ + public boolean hasDisplay( + ) { + return this._has_display; + } + + /** + * Returns the value of field 'display'. + * + * @return the value of field 'Display'. + */ + public boolean isDisplay( + ) { + return this._display; + } + + /** + * Method isValid. + * + * @return true if this object is valid according to the schema + */ + public boolean isValid( + ) { + try { + validate(); + } catch (org.exolab.castor.xml.ValidationException vex) { + return false; + } + return true; + } + + /** + * + * + * @param out + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void marshal( + final java.io.Writer out) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, out); + } + + /** + * + * + * @param handler + * @throws java.io.IOException if an IOException occurs during + * marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + */ + public void marshal( + final org.xml.sax.ContentHandler handler) + throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, handler); + } + + /** + * Sets the value of field 'colour'. + * + * @param colour the value of field 'colour'. + */ + public void setColour( + final int colour) { + this._colour = colour; + this._has_colour = true; + } + + /** + * Sets the value of field 'display'. + * + * @param display the value of field 'display'. + */ + public void setDisplay( + final boolean display) { + this._display = display; + this._has_display = true; + } + + /** + * Sets the value of field 'type'. + * + * @param type the value of field 'type'. + */ + public void setType( + final java.lang.String type) { + this._type = type; + } + + /** + * Method unmarshal. + * + * @param reader + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @return the unmarshaled jalview.binding.Setting + */ + public static jalview.binding.Setting unmarshal( + final java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + return (jalview.binding.Setting) Unmarshaller.unmarshal(jalview.binding.Setting.class, reader); + } - /** + /** + * + * + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema */ - public void deleteDisplay() - { - this._has_display = false; - } - - /** - * Returns the value of field 'colour'. - * - * @return the value of field 'Colour'. - */ - public int getColour() - { - return this._colour; - } - - /** - * Returns the value of field 'display'. - * - * @return the value of field 'Display'. - */ - public boolean getDisplay() - { - return this._display; - } - - /** - * Returns the value of field 'type'. - * - * @return the value of field 'Type'. - */ - public java.lang.String getType() - { - return this._type; - } - - /** - * Method hasColour. - * - * @return true if at least one Colour has been added - */ - public boolean hasColour() - { - return this._has_colour; - } - - /** - * Method hasDisplay. - * - * @return true if at least one Display has been added - */ - public boolean hasDisplay() - { - return this._has_display; - } - - /** - * Returns the value of field 'display'. - * - * @return the value of field 'Display'. - */ - public boolean isDisplay() - { - return this._display; - } - - /** - * Method isValid. - * - * @return true if this object is valid according to the schema - */ - public boolean isValid() - { - try - { - validate(); - } catch (org.exolab.castor.xml.ValidationException vex) - { - return false; + public void validate( + ) + throws org.exolab.castor.xml.ValidationException { + org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); + validator.validate(this); } - return true; - } - - /** - * - * - * @param out - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - */ - public void marshal(final java.io.Writer out) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - Marshaller.marshal(this, out); - } - - /** - * - * - * @param handler - * @throws java.io.IOException - * if an IOException occurs during marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - */ - public void marshal(final org.xml.sax.ContentHandler handler) - throws java.io.IOException, - org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - Marshaller.marshal(this, handler); - } - - /** - * Sets the value of field 'colour'. - * - * @param colour - * the value of field 'colour'. - */ - public void setColour(final int colour) - { - this._colour = colour; - this._has_colour = true; - } - - /** - * Sets the value of field 'display'. - * - * @param display - * the value of field 'display'. - */ - public void setDisplay(final boolean display) - { - this._display = display; - this._has_display = true; - } - - /** - * Sets the value of field 'type'. - * - * @param type - * the value of field 'type'. - */ - public void setType(final java.lang.String type) - { - this._type = type; - } - - /** - * Method unmarshal. - * - * @param reader - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - * @return the unmarshaled jalview.binding.Setting - */ - public static jalview.binding.Setting unmarshal( - final java.io.Reader reader) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - return (jalview.binding.Setting) Unmarshaller.unmarshal( - jalview.binding.Setting.class, reader); - } - - /** - * - * - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - */ - public void validate() throws org.exolab.castor.xml.ValidationException - { - org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); - validator.validate(this); - } } diff --git a/src/jalview/binding/Tree.java b/src/jalview/binding/Tree.java index 59d1319..5f138d0 100644 --- a/src/jalview/binding/Tree.java +++ b/src/jalview/binding/Tree.java @@ -1,27 +1,14 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) - * Copyright (C) $$Year-Rel$$ The Jalview Authors - * - * This file is part of Jalview. - * - * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. - * - * Jalview is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Jalview. If not, see . - * The Jalview Authors are detailed in the 'AUTHORS' file. + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ */ + package jalview.binding; -//---------------------------------/ -//- Imported classes and packages -/ + //---------------------------------/ + //- Imported classes and packages -/ //---------------------------------/ import org.exolab.castor.xml.Marshaller; @@ -32,825 +19,802 @@ import org.exolab.castor.xml.Unmarshaller; * * @version $Revision$ $Date$ */ -public class Tree implements java.io.Serializable -{ - - // --------------------------/ - // - Class/Member Variables -/ - // --------------------------/ - - /** - * Field _width. - */ - private int _width; - - /** - * keeps track of state for field: _width - */ - private boolean _has_width; - - /** - * Field _height. - */ - private int _height; - - /** - * keeps track of state for field: _height - */ - private boolean _has_height; - - /** - * Field _xpos. - */ - private int _xpos; - - /** - * keeps track of state for field: _xpos - */ - private boolean _has_xpos; - - /** - * Field _ypos. - */ - private int _ypos; - - /** - * keeps track of state for field: _ypos - */ - private boolean _has_ypos; - - /** - * Field _fontName. - */ - private java.lang.String _fontName; - - /** - * Field _fontSize. - */ - private int _fontSize; - - /** - * keeps track of state for field: _fontSize - */ - private boolean _has_fontSize; - - /** - * Field _fontStyle. - */ - private int _fontStyle; - - /** - * keeps track of state for field: _fontStyle - */ - private boolean _has_fontStyle; - - /** - * Field _threshold. - */ - private float _threshold; - - /** - * keeps track of state for field: _threshold - */ - private boolean _has_threshold; - - /** - * Field _showBootstrap. - */ - private boolean _showBootstrap; - - /** - * keeps track of state for field: _showBootstrap - */ - private boolean _has_showBootstrap; - - /** - * Field _showDistances. - */ - private boolean _showDistances; - - /** - * keeps track of state for field: _showDistances - */ - private boolean _has_showDistances; - - /** - * Field _markUnlinked. - */ - private boolean _markUnlinked; - - /** - * keeps track of state for field: _markUnlinked - */ - private boolean _has_markUnlinked; - - /** - * Field _fitToWindow. - */ - private boolean _fitToWindow; - - /** - * keeps track of state for field: _fitToWindow - */ - private boolean _has_fitToWindow; - - /** - * Field _currentTree. - */ - private boolean _currentTree; - - /** - * keeps track of state for field: _currentTree - */ - private boolean _has_currentTree; - - /** - * Field _title. - */ - private java.lang.String _title; - - /** - * Field _newick. - */ - private java.lang.String _newick; - - // ----------------/ - // - Constructors -/ - // ----------------/ - - public Tree() - { - super(); - } - - // -----------/ - // - Methods -/ - // -----------/ - - /** - */ - public void deleteCurrentTree() - { - this._has_currentTree = false; - } - - /** - */ - public void deleteFitToWindow() - { - this._has_fitToWindow = false; - } - - /** - */ - public void deleteFontSize() - { - this._has_fontSize = false; - } - - /** - */ - public void deleteFontStyle() - { - this._has_fontStyle = false; - } - - /** - */ - public void deleteHeight() - { - this._has_height = false; - } - - /** - */ - public void deleteMarkUnlinked() - { - this._has_markUnlinked = false; - } - - /** - */ - public void deleteShowBootstrap() - { - this._has_showBootstrap = false; - } - - /** - */ - public void deleteShowDistances() - { - this._has_showDistances = false; - } - - /** - */ - public void deleteThreshold() - { - this._has_threshold = false; - } - - /** - */ - public void deleteWidth() - { - this._has_width = false; - } - - /** - */ - public void deleteXpos() - { - this._has_xpos = false; - } - - /** - */ - public void deleteYpos() - { - this._has_ypos = false; - } - - /** - * Returns the value of field 'currentTree'. - * - * @return the value of field 'CurrentTree'. - */ - public boolean getCurrentTree() - { - return this._currentTree; - } - - /** - * Returns the value of field 'fitToWindow'. - * - * @return the value of field 'FitToWindow'. - */ - public boolean getFitToWindow() - { - return this._fitToWindow; - } - - /** - * Returns the value of field 'fontName'. - * - * @return the value of field 'FontName'. - */ - public java.lang.String getFontName() - { - return this._fontName; - } - - /** - * Returns the value of field 'fontSize'. - * - * @return the value of field 'FontSize'. - */ - public int getFontSize() - { - return this._fontSize; - } - - /** - * Returns the value of field 'fontStyle'. - * - * @return the value of field 'FontStyle'. - */ - public int getFontStyle() - { - return this._fontStyle; - } - - /** - * Returns the value of field 'height'. - * - * @return the value of field 'Height'. - */ - public int getHeight() - { - return this._height; - } - - /** - * Returns the value of field 'markUnlinked'. - * - * @return the value of field 'MarkUnlinked'. - */ - public boolean getMarkUnlinked() - { - return this._markUnlinked; - } - - /** - * Returns the value of field 'newick'. - * - * @return the value of field 'Newick'. - */ - public java.lang.String getNewick() - { - return this._newick; - } - - /** - * Returns the value of field 'showBootstrap'. - * - * @return the value of field 'ShowBootstrap'. - */ - public boolean getShowBootstrap() - { - return this._showBootstrap; - } - - /** - * Returns the value of field 'showDistances'. - * - * @return the value of field 'ShowDistances'. - */ - public boolean getShowDistances() - { - return this._showDistances; - } - - /** - * Returns the value of field 'threshold'. - * - * @return the value of field 'Threshold'. - */ - public float getThreshold() - { - return this._threshold; - } - - /** - * Returns the value of field 'title'. - * - * @return the value of field 'Title'. - */ - public java.lang.String getTitle() - { - return this._title; - } - - /** - * Returns the value of field 'width'. - * - * @return the value of field 'Width'. - */ - public int getWidth() - { - return this._width; - } - - /** - * Returns the value of field 'xpos'. - * - * @return the value of field 'Xpos'. - */ - public int getXpos() - { - return this._xpos; - } - - /** - * Returns the value of field 'ypos'. - * - * @return the value of field 'Ypos'. - */ - public int getYpos() - { - return this._ypos; - } - - /** - * Method hasCurrentTree. - * - * @return true if at least one CurrentTree has been added - */ - public boolean hasCurrentTree() - { - return this._has_currentTree; - } - - /** - * Method hasFitToWindow. - * - * @return true if at least one FitToWindow has been added - */ - public boolean hasFitToWindow() - { - return this._has_fitToWindow; - } - - /** - * Method hasFontSize. - * - * @return true if at least one FontSize has been added - */ - public boolean hasFontSize() - { - return this._has_fontSize; - } - - /** - * Method hasFontStyle. - * - * @return true if at least one FontStyle has been added - */ - public boolean hasFontStyle() - { - return this._has_fontStyle; - } - - /** - * Method hasHeight. - * - * @return true if at least one Height has been added - */ - public boolean hasHeight() - { - return this._has_height; - } - - /** - * Method hasMarkUnlinked. - * - * @return true if at least one MarkUnlinked has been added - */ - public boolean hasMarkUnlinked() - { - return this._has_markUnlinked; - } - - /** - * Method hasShowBootstrap. - * - * @return true if at least one ShowBootstrap has been added - */ - public boolean hasShowBootstrap() - { - return this._has_showBootstrap; - } - - /** - * Method hasShowDistances. - * - * @return true if at least one ShowDistances has been added - */ - public boolean hasShowDistances() - { - return this._has_showDistances; - } - - /** - * Method hasThreshold. - * - * @return true if at least one Threshold has been added - */ - public boolean hasThreshold() - { - return this._has_threshold; - } - - /** - * Method hasWidth. - * - * @return true if at least one Width has been added - */ - public boolean hasWidth() - { - return this._has_width; - } - - /** - * Method hasXpos. - * - * @return true if at least one Xpos has been added - */ - public boolean hasXpos() - { - return this._has_xpos; - } - - /** - * Method hasYpos. - * - * @return true if at least one Ypos has been added - */ - public boolean hasYpos() - { - return this._has_ypos; - } - - /** - * Returns the value of field 'currentTree'. - * - * @return the value of field 'CurrentTree'. - */ - public boolean isCurrentTree() - { - return this._currentTree; - } - - /** - * Returns the value of field 'fitToWindow'. - * - * @return the value of field 'FitToWindow'. - */ - public boolean isFitToWindow() - { - return this._fitToWindow; - } - - /** - * Returns the value of field 'markUnlinked'. - * - * @return the value of field 'MarkUnlinked'. - */ - public boolean isMarkUnlinked() - { - return this._markUnlinked; - } - - /** - * Returns the value of field 'showBootstrap'. - * - * @return the value of field 'ShowBootstrap'. - */ - public boolean isShowBootstrap() - { - return this._showBootstrap; - } - - /** - * Returns the value of field 'showDistances'. - * - * @return the value of field 'ShowDistances'. - */ - public boolean isShowDistances() - { - return this._showDistances; - } - - /** - * Method isValid. - * - * @return true if this object is valid according to the schema - */ - public boolean isValid() - { - try - { - validate(); - } catch (org.exolab.castor.xml.ValidationException vex) - { - return false; - } - return true; - } - - /** - * - * - * @param out - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - */ - public void marshal(final java.io.Writer out) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - Marshaller.marshal(this, out); - } - - /** - * - * - * @param handler - * @throws java.io.IOException - * if an IOException occurs during marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - */ - public void marshal(final org.xml.sax.ContentHandler handler) - throws java.io.IOException, - org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - Marshaller.marshal(this, handler); - } - - /** - * Sets the value of field 'currentTree'. - * - * @param currentTree - * the value of field 'currentTree'. - */ - public void setCurrentTree(final boolean currentTree) - { - this._currentTree = currentTree; - this._has_currentTree = true; - } - - /** - * Sets the value of field 'fitToWindow'. - * - * @param fitToWindow - * the value of field 'fitToWindow'. - */ - public void setFitToWindow(final boolean fitToWindow) - { - this._fitToWindow = fitToWindow; - this._has_fitToWindow = true; - } - - /** - * Sets the value of field 'fontName'. - * - * @param fontName - * the value of field 'fontName'. - */ - public void setFontName(final java.lang.String fontName) - { - this._fontName = fontName; - } - - /** - * Sets the value of field 'fontSize'. - * - * @param fontSize - * the value of field 'fontSize'. - */ - public void setFontSize(final int fontSize) - { - this._fontSize = fontSize; - this._has_fontSize = true; - } - - /** - * Sets the value of field 'fontStyle'. - * - * @param fontStyle - * the value of field 'fontStyle'. - */ - public void setFontStyle(final int fontStyle) - { - this._fontStyle = fontStyle; - this._has_fontStyle = true; - } - - /** - * Sets the value of field 'height'. - * - * @param height - * the value of field 'height'. - */ - public void setHeight(final int height) - { - this._height = height; - this._has_height = true; - } - - /** - * Sets the value of field 'markUnlinked'. - * - * @param markUnlinked - * the value of field 'markUnlinked'. - */ - public void setMarkUnlinked(final boolean markUnlinked) - { - this._markUnlinked = markUnlinked; - this._has_markUnlinked = true; - } - - /** - * Sets the value of field 'newick'. - * - * @param newick - * the value of field 'newick'. - */ - public void setNewick(final java.lang.String newick) - { - this._newick = newick; - } - - /** - * Sets the value of field 'showBootstrap'. - * - * @param showBootstrap - * the value of field 'showBootstrap'. - */ - public void setShowBootstrap(final boolean showBootstrap) - { - this._showBootstrap = showBootstrap; - this._has_showBootstrap = true; - } - - /** - * Sets the value of field 'showDistances'. - * - * @param showDistances - * the value of field 'showDistances'. - */ - public void setShowDistances(final boolean showDistances) - { - this._showDistances = showDistances; - this._has_showDistances = true; - } - - /** - * Sets the value of field 'threshold'. - * - * @param threshold - * the value of field 'threshold'. - */ - public void setThreshold(final float threshold) - { - this._threshold = threshold; - this._has_threshold = true; - } - - /** - * Sets the value of field 'title'. - * - * @param title - * the value of field 'title'. - */ - public void setTitle(final java.lang.String title) - { - this._title = title; - } - - /** - * Sets the value of field 'width'. - * - * @param width - * the value of field 'width'. - */ - public void setWidth(final int width) - { - this._width = width; - this._has_width = true; - } - - /** - * Sets the value of field 'xpos'. - * - * @param xpos - * the value of field 'xpos'. - */ - public void setXpos(final int xpos) - { - this._xpos = xpos; - this._has_xpos = true; - } - - /** - * Sets the value of field 'ypos'. - * - * @param ypos - * the value of field 'ypos'. - */ - public void setYpos(final int ypos) - { - this._ypos = ypos; - this._has_ypos = true; - } - - /** - * Method unmarshal. - * - * @param reader - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - * @return the unmarshaled jalview.binding.Tree - */ - public static jalview.binding.Tree unmarshal(final java.io.Reader reader) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - return (jalview.binding.Tree) Unmarshaller.unmarshal( - jalview.binding.Tree.class, reader); - } - - /** - * - * - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - */ - public void validate() throws org.exolab.castor.xml.ValidationException - { - org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); - validator.validate(this); - } +public class Tree implements java.io.Serializable { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field _width. + */ + private int _width; + + /** + * keeps track of state for field: _width + */ + private boolean _has_width; + + /** + * Field _height. + */ + private int _height; + + /** + * keeps track of state for field: _height + */ + private boolean _has_height; + + /** + * Field _xpos. + */ + private int _xpos; + + /** + * keeps track of state for field: _xpos + */ + private boolean _has_xpos; + + /** + * Field _ypos. + */ + private int _ypos; + + /** + * keeps track of state for field: _ypos + */ + private boolean _has_ypos; + + /** + * Field _fontName. + */ + private java.lang.String _fontName; + + /** + * Field _fontSize. + */ + private int _fontSize; + + /** + * keeps track of state for field: _fontSize + */ + private boolean _has_fontSize; + + /** + * Field _fontStyle. + */ + private int _fontStyle; + + /** + * keeps track of state for field: _fontStyle + */ + private boolean _has_fontStyle; + + /** + * Field _threshold. + */ + private float _threshold; + + /** + * keeps track of state for field: _threshold + */ + private boolean _has_threshold; + + /** + * Field _showBootstrap. + */ + private boolean _showBootstrap; + + /** + * keeps track of state for field: _showBootstrap + */ + private boolean _has_showBootstrap; + + /** + * Field _showDistances. + */ + private boolean _showDistances; + + /** + * keeps track of state for field: _showDistances + */ + private boolean _has_showDistances; + + /** + * Field _markUnlinked. + */ + private boolean _markUnlinked; + + /** + * keeps track of state for field: _markUnlinked + */ + private boolean _has_markUnlinked; + + /** + * Field _fitToWindow. + */ + private boolean _fitToWindow; + + /** + * keeps track of state for field: _fitToWindow + */ + private boolean _has_fitToWindow; + + /** + * Field _currentTree. + */ + private boolean _currentTree; + + /** + * keeps track of state for field: _currentTree + */ + private boolean _has_currentTree; + + /** + * Field _title. + */ + private java.lang.String _title; + + /** + * Field _newick. + */ + private java.lang.String _newick; + + + //----------------/ + //- Constructors -/ + //----------------/ + + public Tree() { + super(); + } + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + */ + public void deleteCurrentTree( + ) { + this._has_currentTree= false; + } + + /** + */ + public void deleteFitToWindow( + ) { + this._has_fitToWindow= false; + } + + /** + */ + public void deleteFontSize( + ) { + this._has_fontSize= false; + } + + /** + */ + public void deleteFontStyle( + ) { + this._has_fontStyle= false; + } + + /** + */ + public void deleteHeight( + ) { + this._has_height= false; + } + + /** + */ + public void deleteMarkUnlinked( + ) { + this._has_markUnlinked= false; + } + + /** + */ + public void deleteShowBootstrap( + ) { + this._has_showBootstrap= false; + } + + /** + */ + public void deleteShowDistances( + ) { + this._has_showDistances= false; + } + + /** + */ + public void deleteThreshold( + ) { + this._has_threshold= false; + } + + /** + */ + public void deleteWidth( + ) { + this._has_width= false; + } + + /** + */ + public void deleteXpos( + ) { + this._has_xpos= false; + } + + /** + */ + public void deleteYpos( + ) { + this._has_ypos= false; + } + + /** + * Returns the value of field 'currentTree'. + * + * @return the value of field 'CurrentTree'. + */ + public boolean getCurrentTree( + ) { + return this._currentTree; + } + + /** + * Returns the value of field 'fitToWindow'. + * + * @return the value of field 'FitToWindow'. + */ + public boolean getFitToWindow( + ) { + return this._fitToWindow; + } + + /** + * Returns the value of field 'fontName'. + * + * @return the value of field 'FontName'. + */ + public java.lang.String getFontName( + ) { + return this._fontName; + } + + /** + * Returns the value of field 'fontSize'. + * + * @return the value of field 'FontSize'. + */ + public int getFontSize( + ) { + return this._fontSize; + } + + /** + * Returns the value of field 'fontStyle'. + * + * @return the value of field 'FontStyle'. + */ + public int getFontStyle( + ) { + return this._fontStyle; + } + + /** + * Returns the value of field 'height'. + * + * @return the value of field 'Height'. + */ + public int getHeight( + ) { + return this._height; + } + + /** + * Returns the value of field 'markUnlinked'. + * + * @return the value of field 'MarkUnlinked'. + */ + public boolean getMarkUnlinked( + ) { + return this._markUnlinked; + } + + /** + * Returns the value of field 'newick'. + * + * @return the value of field 'Newick'. + */ + public java.lang.String getNewick( + ) { + return this._newick; + } + + /** + * Returns the value of field 'showBootstrap'. + * + * @return the value of field 'ShowBootstrap'. + */ + public boolean getShowBootstrap( + ) { + return this._showBootstrap; + } + + /** + * Returns the value of field 'showDistances'. + * + * @return the value of field 'ShowDistances'. + */ + public boolean getShowDistances( + ) { + return this._showDistances; + } + + /** + * Returns the value of field 'threshold'. + * + * @return the value of field 'Threshold'. + */ + public float getThreshold( + ) { + return this._threshold; + } + + /** + * Returns the value of field 'title'. + * + * @return the value of field 'Title'. + */ + public java.lang.String getTitle( + ) { + return this._title; + } + + /** + * Returns the value of field 'width'. + * + * @return the value of field 'Width'. + */ + public int getWidth( + ) { + return this._width; + } + + /** + * Returns the value of field 'xpos'. + * + * @return the value of field 'Xpos'. + */ + public int getXpos( + ) { + return this._xpos; + } + + /** + * Returns the value of field 'ypos'. + * + * @return the value of field 'Ypos'. + */ + public int getYpos( + ) { + return this._ypos; + } + + /** + * Method hasCurrentTree. + * + * @return true if at least one CurrentTree has been added + */ + public boolean hasCurrentTree( + ) { + return this._has_currentTree; + } + + /** + * Method hasFitToWindow. + * + * @return true if at least one FitToWindow has been added + */ + public boolean hasFitToWindow( + ) { + return this._has_fitToWindow; + } + + /** + * Method hasFontSize. + * + * @return true if at least one FontSize has been added + */ + public boolean hasFontSize( + ) { + return this._has_fontSize; + } + + /** + * Method hasFontStyle. + * + * @return true if at least one FontStyle has been added + */ + public boolean hasFontStyle( + ) { + return this._has_fontStyle; + } + + /** + * Method hasHeight. + * + * @return true if at least one Height has been added + */ + public boolean hasHeight( + ) { + return this._has_height; + } + + /** + * Method hasMarkUnlinked. + * + * @return true if at least one MarkUnlinked has been added + */ + public boolean hasMarkUnlinked( + ) { + return this._has_markUnlinked; + } + + /** + * Method hasShowBootstrap. + * + * @return true if at least one ShowBootstrap has been added + */ + public boolean hasShowBootstrap( + ) { + return this._has_showBootstrap; + } + + /** + * Method hasShowDistances. + * + * @return true if at least one ShowDistances has been added + */ + public boolean hasShowDistances( + ) { + return this._has_showDistances; + } + + /** + * Method hasThreshold. + * + * @return true if at least one Threshold has been added + */ + public boolean hasThreshold( + ) { + return this._has_threshold; + } + + /** + * Method hasWidth. + * + * @return true if at least one Width has been added + */ + public boolean hasWidth( + ) { + return this._has_width; + } + + /** + * Method hasXpos. + * + * @return true if at least one Xpos has been added + */ + public boolean hasXpos( + ) { + return this._has_xpos; + } + + /** + * Method hasYpos. + * + * @return true if at least one Ypos has been added + */ + public boolean hasYpos( + ) { + return this._has_ypos; + } + + /** + * Returns the value of field 'currentTree'. + * + * @return the value of field 'CurrentTree'. + */ + public boolean isCurrentTree( + ) { + return this._currentTree; + } + + /** + * Returns the value of field 'fitToWindow'. + * + * @return the value of field 'FitToWindow'. + */ + public boolean isFitToWindow( + ) { + return this._fitToWindow; + } + + /** + * Returns the value of field 'markUnlinked'. + * + * @return the value of field 'MarkUnlinked'. + */ + public boolean isMarkUnlinked( + ) { + return this._markUnlinked; + } + + /** + * Returns the value of field 'showBootstrap'. + * + * @return the value of field 'ShowBootstrap'. + */ + public boolean isShowBootstrap( + ) { + return this._showBootstrap; + } + + /** + * Returns the value of field 'showDistances'. + * + * @return the value of field 'ShowDistances'. + */ + public boolean isShowDistances( + ) { + return this._showDistances; + } + + /** + * Method isValid. + * + * @return true if this object is valid according to the schema + */ + public boolean isValid( + ) { + try { + validate(); + } catch (org.exolab.castor.xml.ValidationException vex) { + return false; + } + return true; + } + + /** + * + * + * @param out + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void marshal( + final java.io.Writer out) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, out); + } + + /** + * + * + * @param handler + * @throws java.io.IOException if an IOException occurs during + * marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + */ + public void marshal( + final org.xml.sax.ContentHandler handler) + throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, handler); + } + + /** + * Sets the value of field 'currentTree'. + * + * @param currentTree the value of field 'currentTree'. + */ + public void setCurrentTree( + final boolean currentTree) { + this._currentTree = currentTree; + this._has_currentTree = true; + } + + /** + * Sets the value of field 'fitToWindow'. + * + * @param fitToWindow the value of field 'fitToWindow'. + */ + public void setFitToWindow( + final boolean fitToWindow) { + this._fitToWindow = fitToWindow; + this._has_fitToWindow = true; + } + + /** + * Sets the value of field 'fontName'. + * + * @param fontName the value of field 'fontName'. + */ + public void setFontName( + final java.lang.String fontName) { + this._fontName = fontName; + } + + /** + * Sets the value of field 'fontSize'. + * + * @param fontSize the value of field 'fontSize'. + */ + public void setFontSize( + final int fontSize) { + this._fontSize = fontSize; + this._has_fontSize = true; + } + + /** + * Sets the value of field 'fontStyle'. + * + * @param fontStyle the value of field 'fontStyle'. + */ + public void setFontStyle( + final int fontStyle) { + this._fontStyle = fontStyle; + this._has_fontStyle = true; + } + + /** + * Sets the value of field 'height'. + * + * @param height the value of field 'height'. + */ + public void setHeight( + final int height) { + this._height = height; + this._has_height = true; + } + + /** + * Sets the value of field 'markUnlinked'. + * + * @param markUnlinked the value of field 'markUnlinked'. + */ + public void setMarkUnlinked( + final boolean markUnlinked) { + this._markUnlinked = markUnlinked; + this._has_markUnlinked = true; + } + + /** + * Sets the value of field 'newick'. + * + * @param newick the value of field 'newick'. + */ + public void setNewick( + final java.lang.String newick) { + this._newick = newick; + } + + /** + * Sets the value of field 'showBootstrap'. + * + * @param showBootstrap the value of field 'showBootstrap'. + */ + public void setShowBootstrap( + final boolean showBootstrap) { + this._showBootstrap = showBootstrap; + this._has_showBootstrap = true; + } + + /** + * Sets the value of field 'showDistances'. + * + * @param showDistances the value of field 'showDistances'. + */ + public void setShowDistances( + final boolean showDistances) { + this._showDistances = showDistances; + this._has_showDistances = true; + } + + /** + * Sets the value of field 'threshold'. + * + * @param threshold the value of field 'threshold'. + */ + public void setThreshold( + final float threshold) { + this._threshold = threshold; + this._has_threshold = true; + } + + /** + * Sets the value of field 'title'. + * + * @param title the value of field 'title'. + */ + public void setTitle( + final java.lang.String title) { + this._title = title; + } + + /** + * Sets the value of field 'width'. + * + * @param width the value of field 'width'. + */ + public void setWidth( + final int width) { + this._width = width; + this._has_width = true; + } + + /** + * Sets the value of field 'xpos'. + * + * @param xpos the value of field 'xpos'. + */ + public void setXpos( + final int xpos) { + this._xpos = xpos; + this._has_xpos = true; + } + + /** + * Sets the value of field 'ypos'. + * + * @param ypos the value of field 'ypos'. + */ + public void setYpos( + final int ypos) { + this._ypos = ypos; + this._has_ypos = true; + } + + /** + * Method unmarshal. + * + * @param reader + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @return the unmarshaled jalview.binding.Tree + */ + public static jalview.binding.Tree unmarshal( + final java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + return (jalview.binding.Tree) Unmarshaller.unmarshal(jalview.binding.Tree.class, reader); + } + + /** + * + * + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void validate( + ) + throws org.exolab.castor.xml.ValidationException { + org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); + validator.validate(this); + } } diff --git a/src/jalview/binding/UserColourScheme.java b/src/jalview/binding/UserColourScheme.java index 18fa2e1..24c97ff 100644 --- a/src/jalview/binding/UserColourScheme.java +++ b/src/jalview/binding/UserColourScheme.java @@ -1,27 +1,14 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) - * Copyright (C) $$Year-Rel$$ The Jalview Authors - * - * This file is part of Jalview. - * - * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. - * - * Jalview is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Jalview. If not, see . - * The Jalview Authors are detailed in the 'AUTHORS' file. + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ */ + package jalview.binding; -//---------------------------------/ -//- Imported classes and packages -/ + //---------------------------------/ + //- Imported classes and packages -/ //---------------------------------/ import org.exolab.castor.xml.Marshaller; @@ -32,107 +19,98 @@ import org.exolab.castor.xml.Unmarshaller; * * @version $Revision$ $Date$ */ -public class UserColourScheme extends JalviewUserColours implements - java.io.Serializable +public class UserColourScheme extends JalviewUserColours +implements java.io.Serializable { - // ----------------/ - // - Constructors -/ - // ----------------/ - public UserColourScheme() - { - super(); - } + //----------------/ + //- Constructors -/ + //----------------/ + + public UserColourScheme() { + super(); + } + - // -----------/ - // - Methods -/ - // -----------/ + //-----------/ + //- Methods -/ + //-----------/ - /** - * Method isValid. - * - * @return true if this object is valid according to the schema - */ - public boolean isValid() - { - try - { - validate(); - } catch (org.exolab.castor.xml.ValidationException vex) - { - return false; + /** + * Method isValid. + * + * @return true if this object is valid according to the schema + */ + public boolean isValid( + ) { + try { + validate(); + } catch (org.exolab.castor.xml.ValidationException vex) { + return false; + } + return true; } - return true; - } - /** - * - * - * @param out - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - */ - public void marshal(final java.io.Writer out) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - Marshaller.marshal(this, out); - } + /** + * + * + * @param out + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void marshal( + final java.io.Writer out) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, out); + } - /** - * - * - * @param handler - * @throws java.io.IOException - * if an IOException occurs during marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - */ - public void marshal(final org.xml.sax.ContentHandler handler) - throws java.io.IOException, - org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - Marshaller.marshal(this, handler); - } + /** + * + * + * @param handler + * @throws java.io.IOException if an IOException occurs during + * marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + */ + public void marshal( + final org.xml.sax.ContentHandler handler) + throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, handler); + } - /** - * Method unmarshal. - * - * @param reader - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - * @return the unmarshaled jalview.binding.JalviewUserColours - */ - public static jalview.binding.JalviewUserColours unmarshal( - final java.io.Reader reader) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - return (jalview.binding.JalviewUserColours) Unmarshaller.unmarshal( - jalview.binding.UserColourScheme.class, reader); - } + /** + * Method unmarshal. + * + * @param reader + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @return the unmarshaled jalview.binding.JalviewUserColours + */ + public static jalview.binding.JalviewUserColours unmarshal( + final java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + return (jalview.binding.JalviewUserColours) Unmarshaller.unmarshal(jalview.binding.UserColourScheme.class, reader); + } - /** - * - * - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - */ - public void validate() throws org.exolab.castor.xml.ValidationException - { - org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); - validator.validate(this); - } + /** + * + * + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void validate( + ) + throws org.exolab.castor.xml.ValidationException { + org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); + validator.validate(this); + } } diff --git a/src/jalview/binding/UserColours.java b/src/jalview/binding/UserColours.java index 96bb810..bdefe05 100644 --- a/src/jalview/binding/UserColours.java +++ b/src/jalview/binding/UserColours.java @@ -1,27 +1,14 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) - * Copyright (C) $$Year-Rel$$ The Jalview Authors - * - * This file is part of Jalview. - * - * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. - * - * Jalview is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Jalview. If not, see . - * The Jalview Authors are detailed in the 'AUTHORS' file. + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ */ + package jalview.binding; -//---------------------------------/ -//- Imported classes and packages -/ + //---------------------------------/ + //- Imported classes and packages -/ //---------------------------------/ import org.exolab.castor.xml.Marshaller; @@ -32,163 +19,151 @@ import org.exolab.castor.xml.Unmarshaller; * * @version $Revision$ $Date$ */ -public class UserColours implements java.io.Serializable -{ - - // --------------------------/ - // - Class/Member Variables -/ - // --------------------------/ - - /** - * Field _id. - */ - private java.lang.String _id; - - /** - * Field _userColourScheme. - */ - private jalview.binding.UserColourScheme _userColourScheme; - - // ----------------/ - // - Constructors -/ - // ----------------/ - - public UserColours() - { - super(); - } - - // -----------/ - // - Methods -/ - // -----------/ - - /** - * Returns the value of field 'id'. - * - * @return the value of field 'Id'. - */ - public java.lang.String getId() - { - return this._id; - } - - /** - * Returns the value of field 'userColourScheme'. - * - * @return the value of field 'UserColourScheme'. - */ - public jalview.binding.UserColourScheme getUserColourScheme() - { - return this._userColourScheme; - } - - /** - * Method isValid. - * - * @return true if this object is valid according to the schema - */ - public boolean isValid() - { - try - { - validate(); - } catch (org.exolab.castor.xml.ValidationException vex) - { - return false; +public class UserColours implements java.io.Serializable { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field _id. + */ + private java.lang.String _id; + + /** + * Field _userColourScheme. + */ + private jalview.binding.UserColourScheme _userColourScheme; + + + //----------------/ + //- Constructors -/ + //----------------/ + + public UserColours() { + super(); + } + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Returns the value of field 'id'. + * + * @return the value of field 'Id'. + */ + public java.lang.String getId( + ) { + return this._id; + } + + /** + * Returns the value of field 'userColourScheme'. + * + * @return the value of field 'UserColourScheme'. + */ + public jalview.binding.UserColourScheme getUserColourScheme( + ) { + return this._userColourScheme; + } + + /** + * Method isValid. + * + * @return true if this object is valid according to the schema + */ + public boolean isValid( + ) { + try { + validate(); + } catch (org.exolab.castor.xml.ValidationException vex) { + return false; + } + return true; + } + + /** + * + * + * @param out + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void marshal( + final java.io.Writer out) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, out); + } + + /** + * + * + * @param handler + * @throws java.io.IOException if an IOException occurs during + * marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + */ + public void marshal( + final org.xml.sax.ContentHandler handler) + throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, handler); + } + + /** + * Sets the value of field 'id'. + * + * @param id the value of field 'id'. + */ + public void setId( + final java.lang.String id) { + this._id = id; + } + + /** + * Sets the value of field 'userColourScheme'. + * + * @param userColourScheme the value of field 'userColourScheme' + */ + public void setUserColourScheme( + final jalview.binding.UserColourScheme userColourScheme) { + this._userColourScheme = userColourScheme; + } + + /** + * Method unmarshal. + * + * @param reader + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @return the unmarshaled jalview.binding.UserColours + */ + public static jalview.binding.UserColours unmarshal( + final java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + return (jalview.binding.UserColours) Unmarshaller.unmarshal(jalview.binding.UserColours.class, reader); + } + + /** + * + * + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void validate( + ) + throws org.exolab.castor.xml.ValidationException { + org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); + validator.validate(this); } - return true; - } - - /** - * - * - * @param out - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - */ - public void marshal(final java.io.Writer out) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - Marshaller.marshal(this, out); - } - - /** - * - * - * @param handler - * @throws java.io.IOException - * if an IOException occurs during marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - */ - public void marshal(final org.xml.sax.ContentHandler handler) - throws java.io.IOException, - org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - Marshaller.marshal(this, handler); - } - - /** - * Sets the value of field 'id'. - * - * @param id - * the value of field 'id'. - */ - public void setId(final java.lang.String id) - { - this._id = id; - } - - /** - * Sets the value of field 'userColourScheme'. - * - * @param userColourScheme - * the value of field 'userColourScheme' - */ - public void setUserColourScheme( - final jalview.binding.UserColourScheme userColourScheme) - { - this._userColourScheme = userColourScheme; - } - - /** - * Method unmarshal. - * - * @param reader - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - * @return the unmarshaled jalview.binding.UserColours - */ - public static jalview.binding.UserColours unmarshal( - final java.io.Reader reader) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - return (jalview.binding.UserColours) Unmarshaller.unmarshal( - jalview.binding.UserColours.class, reader); - } - - /** - * - * - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - */ - public void validate() throws org.exolab.castor.xml.ValidationException - { - org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); - validator.validate(this); - } } diff --git a/src/jalview/binding/VAMSAS.java b/src/jalview/binding/VAMSAS.java index d7f98ce..1c92bd3 100644 --- a/src/jalview/binding/VAMSAS.java +++ b/src/jalview/binding/VAMSAS.java @@ -1,31 +1,16 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) - * Copyright (C) $$Year-Rel$$ The Jalview Authors - * - * This file is part of Jalview. - * - * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. - * - * Jalview is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Jalview. If not, see . - * The Jalview Authors are detailed in the 'AUTHORS' file. + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ */ + package jalview.binding; -//---------------------------------/ -//- Imported classes and packages -/ + //---------------------------------/ + //- Imported classes and packages -/ //---------------------------------/ -import jalview.util.MessageManager; - import org.exolab.castor.xml.Marshaller; import org.exolab.castor.xml.Unmarshaller; @@ -34,598 +19,563 @@ import org.exolab.castor.xml.Unmarshaller; * * @version $Revision$ $Date$ */ -public class VAMSAS implements java.io.Serializable -{ - - // --------------------------/ - // - Class/Member Variables -/ - // --------------------------/ - - /** - * Field _alignmentList. - */ - private java.util.Vector _alignmentList; - - /** - * Field _treeList. - */ - private java.util.Vector _treeList; - - /** - * Field _sequenceSetList. - */ - private java.util.Vector _sequenceSetList; - - // ----------------/ - // - Constructors -/ - // ----------------/ - - public VAMSAS() - { - super(); - this._alignmentList = new java.util.Vector(); - this._treeList = new java.util.Vector(); - this._sequenceSetList = new java.util.Vector(); - } - - // -----------/ - // - Methods -/ - // -----------/ - - /** - * - * - * @param vAlignment - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void addAlignment(final Alignment vAlignment) - throws java.lang.IndexOutOfBoundsException - { - this._alignmentList.addElement(vAlignment); - } - - /** - * - * - * @param index - * @param vAlignment - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void addAlignment(final int index, final Alignment vAlignment) - throws java.lang.IndexOutOfBoundsException - { - this._alignmentList.add(index, vAlignment); - } - - /** - * - * - * @param vSequenceSet - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void addSequenceSet(final SequenceSet vSequenceSet) - throws java.lang.IndexOutOfBoundsException - { - this._sequenceSetList.addElement(vSequenceSet); - } - - /** - * - * - * @param index - * @param vSequenceSet - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void addSequenceSet(final int index, final SequenceSet vSequenceSet) - throws java.lang.IndexOutOfBoundsException - { - this._sequenceSetList.add(index, vSequenceSet); - } - - /** - * - * - * @param vTree - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void addTree(final java.lang.String vTree) - throws java.lang.IndexOutOfBoundsException - { - this._treeList.addElement(vTree); - } - - /** - * - * - * @param index - * @param vTree - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void addTree(final int index, final java.lang.String vTree) - throws java.lang.IndexOutOfBoundsException - { - this._treeList.add(index, vTree); - } - - /** - * Method enumerateAlignment. - * - * @return an Enumeration over all Alignment elements - */ - public java.util.Enumeration enumerateAlignment() - { - return this._alignmentList.elements(); - } - - /** - * Method enumerateSequenceSet. - * - * @return an Enumeration over all SequenceSet elements - */ - public java.util.Enumeration enumerateSequenceSet() - { - return this._sequenceSetList.elements(); - } - - /** - * Method enumerateTree. - * - * @return an Enumeration over all java.lang.String elements - */ - public java.util.Enumeration enumerateTree() - { - return this._treeList.elements(); - } - - /** - * Method getAlignment. - * - * @param index - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - * @return the value of the Alignment at the given index - */ - public Alignment getAlignment(final int index) - throws java.lang.IndexOutOfBoundsException - { - // check bounds for index - if (index < 0 || index >= this._alignmentList.size()) - { - throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{ - "getAlignment", - Integer.valueOf(index).toString(), - Integer.valueOf((this._alignmentList.size() - 1)).toString() - })); - } - - return (Alignment) _alignmentList.get(index); - } - - /** - * Method getAlignment.Returns the contents of the collection in an Array. - *

    - * Note: Just in case the collection contents are changing in another thread, - * we pass a 0-length Array of the correct type into the API call. This way we - * know that the Array returned is of exactly the correct length. - * - * @return this collection as an Array - */ - public Alignment[] getAlignment() - { - Alignment[] array = new Alignment[0]; - return (Alignment[]) this._alignmentList.toArray(array); - } - - /** - * Method getAlignmentCount. - * - * @return the size of this collection - */ - public int getAlignmentCount() - { - return this._alignmentList.size(); - } - - /** - * Method getSequenceSet. - * - * @param index - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - * @return the value of the SequenceSet at the given index - */ - public SequenceSet getSequenceSet(final int index) - throws java.lang.IndexOutOfBoundsException - { - // check bounds for index - if (index < 0 || index >= this._sequenceSetList.size()) - { - throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{ - "getSequenceSet", - Integer.valueOf(index).toString(), - Integer.valueOf((this._sequenceSetList.size() - 1)).toString() - })); - } - - return (SequenceSet) _sequenceSetList.get(index); - } - - /** - * Method getSequenceSet.Returns the contents of the collection in an Array. - *

    - * Note: Just in case the collection contents are changing in another thread, - * we pass a 0-length Array of the correct type into the API call. This way we - * know that the Array returned is of exactly the correct length. - * - * @return this collection as an Array - */ - public SequenceSet[] getSequenceSet() - { - SequenceSet[] array = new SequenceSet[0]; - return (SequenceSet[]) this._sequenceSetList.toArray(array); - } - - /** - * Method getSequenceSetCount. - * - * @return the size of this collection - */ - public int getSequenceSetCount() - { - return this._sequenceSetList.size(); - } - - /** - * Method getTree. - * - * @param index - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - * @return the value of the java.lang.String at the given index - */ - public java.lang.String getTree(final int index) - throws java.lang.IndexOutOfBoundsException - { - // check bounds for index - if (index < 0 || index >= this._treeList.size()) - { - throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{ - "getTree", - Integer.valueOf(index).toString(), - Integer.valueOf((this._treeList.size() - 1)).toString() - })); - } - - return (java.lang.String) _treeList.get(index); - } - - /** - * Method getTree.Returns the contents of the collection in an Array. - *

    - * Note: Just in case the collection contents are changing in another thread, - * we pass a 0-length Array of the correct type into the API call. This way we - * know that the Array returned is of exactly the correct length. - * - * @return this collection as an Array - */ - public java.lang.String[] getTree() - { - java.lang.String[] array = new java.lang.String[0]; - return (java.lang.String[]) this._treeList.toArray(array); - } - - /** - * Method getTreeCount. - * - * @return the size of this collection - */ - public int getTreeCount() - { - return this._treeList.size(); - } - - /** - * Method isValid. - * - * @return true if this object is valid according to the schema - */ - public boolean isValid() - { - try - { - validate(); - } catch (org.exolab.castor.xml.ValidationException vex) - { - return false; - } - return true; - } - - /** - * - * - * @param out - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - */ - public void marshal(final java.io.Writer out) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - Marshaller.marshal(this, out); - } - - /** - * - * - * @param handler - * @throws java.io.IOException - * if an IOException occurs during marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - */ - public void marshal(final org.xml.sax.ContentHandler handler) - throws java.io.IOException, - org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - Marshaller.marshal(this, handler); - } - - /** - * Method removeAlignment. - * - * @param vAlignment - * @return true if the object was removed from the collection. - */ - public boolean removeAlignment(final Alignment vAlignment) - { - boolean removed = _alignmentList.remove(vAlignment); - return removed; - } - - /** - * Method removeAlignmentAt. - * - * @param index - * @return the element removed from the collection - */ - public Alignment removeAlignmentAt(final int index) - { - java.lang.Object obj = this._alignmentList.remove(index); - return (Alignment) obj; - } - - /** - */ - public void removeAllAlignment() - { - this._alignmentList.clear(); - } - - /** - */ - public void removeAllSequenceSet() - { - this._sequenceSetList.clear(); - } - - /** - */ - public void removeAllTree() - { - this._treeList.clear(); - } - - /** - * Method removeSequenceSet. - * - * @param vSequenceSet - * @return true if the object was removed from the collection. - */ - public boolean removeSequenceSet(final SequenceSet vSequenceSet) - { - boolean removed = _sequenceSetList.remove(vSequenceSet); - return removed; - } - - /** - * Method removeSequenceSetAt. - * - * @param index - * @return the element removed from the collection - */ - public SequenceSet removeSequenceSetAt(final int index) - { - java.lang.Object obj = this._sequenceSetList.remove(index); - return (SequenceSet) obj; - } - - /** - * Method removeTree. - * - * @param vTree - * @return true if the object was removed from the collection. - */ - public boolean removeTree(final java.lang.String vTree) - { - boolean removed = _treeList.remove(vTree); - return removed; - } - - /** - * Method removeTreeAt. - * - * @param index - * @return the element removed from the collection - */ - public java.lang.String removeTreeAt(final int index) - { - java.lang.Object obj = this._treeList.remove(index); - return (java.lang.String) obj; - } - - /** - * - * - * @param index - * @param vAlignment - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void setAlignment(final int index, final Alignment vAlignment) - throws java.lang.IndexOutOfBoundsException - { - // check bounds for index - if (index < 0 || index >= this._alignmentList.size()) - { - throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{ - "setAlignment", - Integer.valueOf(index).toString(), - Integer.valueOf((this._alignmentList.size() - 1)).toString() - })); - } - - this._alignmentList.set(index, vAlignment); - } - - /** - * - * - * @param vAlignmentArray - */ - public void setAlignment(final Alignment[] vAlignmentArray) - { - // -- copy array - _alignmentList.clear(); - - for (int i = 0; i < vAlignmentArray.length; i++) - { - this._alignmentList.add(vAlignmentArray[i]); - } - } - - /** - * - * - * @param index - * @param vSequenceSet - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void setSequenceSet(final int index, final SequenceSet vSequenceSet) - throws java.lang.IndexOutOfBoundsException - { - // check bounds for index - if (index < 0 || index >= this._sequenceSetList.size()) - { - throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{ - "setSequenceSet", - Integer.valueOf(index).toString(), - Integer.valueOf((this._sequenceSetList.size() - 1)).toString() - })); - } - - this._sequenceSetList.set(index, vSequenceSet); - } - - /** - * - * - * @param vSequenceSetArray - */ - public void setSequenceSet(final SequenceSet[] vSequenceSetArray) - { - // -- copy array - _sequenceSetList.clear(); - - for (int i = 0; i < vSequenceSetArray.length; i++) - { - this._sequenceSetList.add(vSequenceSetArray[i]); - } - } - - /** - * - * - * @param index - * @param vTree - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void setTree(final int index, final java.lang.String vTree) - throws java.lang.IndexOutOfBoundsException - { - // check bounds for index - if (index < 0 || index >= this._treeList.size()) - { - throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{ - "setTree", - Integer.valueOf(index).toString(), - Integer.valueOf((this._treeList.size() - 1)).toString() - })); - } - - this._treeList.set(index, vTree); - } - - /** - * - * - * @param vTreeArray - */ - public void setTree(final java.lang.String[] vTreeArray) - { - // -- copy array - _treeList.clear(); - - for (int i = 0; i < vTreeArray.length; i++) - { - this._treeList.add(vTreeArray[i]); - } - } - - /** - * Method unmarshal. - * - * @param reader - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - * @return the unmarshaled jalview.binding.VAMSAS - */ - public static jalview.binding.VAMSAS unmarshal(final java.io.Reader reader) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - return (jalview.binding.VAMSAS) Unmarshaller.unmarshal( - jalview.binding.VAMSAS.class, reader); - } - - /** - * - * - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - */ - public void validate() throws org.exolab.castor.xml.ValidationException - { - org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); - validator.validate(this); - } +public class VAMSAS implements java.io.Serializable { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field _alignmentList. + */ + private java.util.Vector _alignmentList; + + /** + * Field _treeList. + */ + private java.util.Vector _treeList; + + /** + * Field _sequenceSetList. + */ + private java.util.Vector _sequenceSetList; + + + //----------------/ + //- Constructors -/ + //----------------/ + + public VAMSAS() { + super(); + this._alignmentList = new java.util.Vector(); + this._treeList = new java.util.Vector(); + this._sequenceSetList = new java.util.Vector(); + } + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * + * + * @param vAlignment + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addAlignment( + final Alignment vAlignment) + throws java.lang.IndexOutOfBoundsException { + this._alignmentList.addElement(vAlignment); + } + + /** + * + * + * @param index + * @param vAlignment + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addAlignment( + final int index, + final Alignment vAlignment) + throws java.lang.IndexOutOfBoundsException { + this._alignmentList.add(index, vAlignment); + } + + /** + * + * + * @param vSequenceSet + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addSequenceSet( + final SequenceSet vSequenceSet) + throws java.lang.IndexOutOfBoundsException { + this._sequenceSetList.addElement(vSequenceSet); + } + + /** + * + * + * @param index + * @param vSequenceSet + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addSequenceSet( + final int index, + final SequenceSet vSequenceSet) + throws java.lang.IndexOutOfBoundsException { + this._sequenceSetList.add(index, vSequenceSet); + } + + /** + * + * + * @param vTree + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addTree( + final java.lang.String vTree) + throws java.lang.IndexOutOfBoundsException { + this._treeList.addElement(vTree); + } + + /** + * + * + * @param index + * @param vTree + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addTree( + final int index, + final java.lang.String vTree) + throws java.lang.IndexOutOfBoundsException { + this._treeList.add(index, vTree); + } + + /** + * Method enumerateAlignment. + * + * @return an Enumeration over all Alignment elements + */ + public java.util.Enumeration enumerateAlignment( + ) { + return this._alignmentList.elements(); + } + + /** + * Method enumerateSequenceSet. + * + * @return an Enumeration over all SequenceSet elements + */ + public java.util.Enumeration enumerateSequenceSet( + ) { + return this._sequenceSetList.elements(); + } + + /** + * Method enumerateTree. + * + * @return an Enumeration over all java.lang.String elements + */ + public java.util.Enumeration enumerateTree( + ) { + return this._treeList.elements(); + } + + /** + * Method getAlignment. + * + * @param index + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + * @return the value of the Alignment at the given index + */ + public Alignment getAlignment( + final int index) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._alignmentList.size()) { + throw new IndexOutOfBoundsException("getAlignment: Index value '" + index + "' not in range [0.." + (this._alignmentList.size() - 1) + "]"); + } + + return (Alignment) _alignmentList.get(index); + } + + /** + * Method getAlignment.Returns the contents of the collection + * in an Array.

    Note: Just in case the collection contents + * are changing in another thread, we pass a 0-length Array of + * the correct type into the API call. This way we know + * that the Array returned is of exactly the correct length. + * + * @return this collection as an Array + */ + public Alignment[] getAlignment( + ) { + Alignment[] array = new Alignment[0]; + return (Alignment[]) this._alignmentList.toArray(array); + } + + /** + * Method getAlignmentCount. + * + * @return the size of this collection + */ + public int getAlignmentCount( + ) { + return this._alignmentList.size(); + } + + /** + * Method getSequenceSet. + * + * @param index + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + * @return the value of the SequenceSet at the given index + */ + public SequenceSet getSequenceSet( + final int index) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._sequenceSetList.size()) { + throw new IndexOutOfBoundsException("getSequenceSet: Index value '" + index + "' not in range [0.." + (this._sequenceSetList.size() - 1) + "]"); + } + + return (SequenceSet) _sequenceSetList.get(index); + } + + /** + * Method getSequenceSet.Returns the contents of the collection + * in an Array.

    Note: Just in case the collection contents + * are changing in another thread, we pass a 0-length Array of + * the correct type into the API call. This way we know + * that the Array returned is of exactly the correct length. + * + * @return this collection as an Array + */ + public SequenceSet[] getSequenceSet( + ) { + SequenceSet[] array = new SequenceSet[0]; + return (SequenceSet[]) this._sequenceSetList.toArray(array); + } + + /** + * Method getSequenceSetCount. + * + * @return the size of this collection + */ + public int getSequenceSetCount( + ) { + return this._sequenceSetList.size(); + } + + /** + * Method getTree. + * + * @param index + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + * @return the value of the java.lang.String at the given index + */ + public java.lang.String getTree( + final int index) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._treeList.size()) { + throw new IndexOutOfBoundsException("getTree: Index value '" + index + "' not in range [0.." + (this._treeList.size() - 1) + "]"); + } + + return (java.lang.String) _treeList.get(index); + } + + /** + * Method getTree.Returns the contents of the collection in an + * Array.

    Note: Just in case the collection contents are + * changing in another thread, we pass a 0-length Array of the + * correct type into the API call. This way we know + * that the Array returned is of exactly the correct length. + * + * @return this collection as an Array + */ + public java.lang.String[] getTree( + ) { + java.lang.String[] array = new java.lang.String[0]; + return (java.lang.String[]) this._treeList.toArray(array); + } + + /** + * Method getTreeCount. + * + * @return the size of this collection + */ + public int getTreeCount( + ) { + return this._treeList.size(); + } + + /** + * Method isValid. + * + * @return true if this object is valid according to the schema + */ + public boolean isValid( + ) { + try { + validate(); + } catch (org.exolab.castor.xml.ValidationException vex) { + return false; + } + return true; + } + + /** + * + * + * @param out + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void marshal( + final java.io.Writer out) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, out); + } + + /** + * + * + * @param handler + * @throws java.io.IOException if an IOException occurs during + * marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + */ + public void marshal( + final org.xml.sax.ContentHandler handler) + throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, handler); + } + + /** + * Method removeAlignment. + * + * @param vAlignment + * @return true if the object was removed from the collection. + */ + public boolean removeAlignment( + final Alignment vAlignment) { + boolean removed = _alignmentList.remove(vAlignment); + return removed; + } + + /** + * Method removeAlignmentAt. + * + * @param index + * @return the element removed from the collection + */ + public Alignment removeAlignmentAt( + final int index) { + java.lang.Object obj = this._alignmentList.remove(index); + return (Alignment) obj; + } + + /** + */ + public void removeAllAlignment( + ) { + this._alignmentList.clear(); + } + + /** + */ + public void removeAllSequenceSet( + ) { + this._sequenceSetList.clear(); + } + + /** + */ + public void removeAllTree( + ) { + this._treeList.clear(); + } + + /** + * Method removeSequenceSet. + * + * @param vSequenceSet + * @return true if the object was removed from the collection. + */ + public boolean removeSequenceSet( + final SequenceSet vSequenceSet) { + boolean removed = _sequenceSetList.remove(vSequenceSet); + return removed; + } + + /** + * Method removeSequenceSetAt. + * + * @param index + * @return the element removed from the collection + */ + public SequenceSet removeSequenceSetAt( + final int index) { + java.lang.Object obj = this._sequenceSetList.remove(index); + return (SequenceSet) obj; + } + + /** + * Method removeTree. + * + * @param vTree + * @return true if the object was removed from the collection. + */ + public boolean removeTree( + final java.lang.String vTree) { + boolean removed = _treeList.remove(vTree); + return removed; + } + + /** + * Method removeTreeAt. + * + * @param index + * @return the element removed from the collection + */ + public java.lang.String removeTreeAt( + final int index) { + java.lang.Object obj = this._treeList.remove(index); + return (java.lang.String) obj; + } + + /** + * + * + * @param index + * @param vAlignment + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void setAlignment( + final int index, + final Alignment vAlignment) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._alignmentList.size()) { + throw new IndexOutOfBoundsException("setAlignment: Index value '" + index + "' not in range [0.." + (this._alignmentList.size() - 1) + "]"); + } + + this._alignmentList.set(index, vAlignment); + } + + /** + * + * + * @param vAlignmentArray + */ + public void setAlignment( + final Alignment[] vAlignmentArray) { + //-- copy array + _alignmentList.clear(); + + for (int i = 0; i < vAlignmentArray.length; i++) { + this._alignmentList.add(vAlignmentArray[i]); + } + } + + /** + * + * + * @param index + * @param vSequenceSet + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void setSequenceSet( + final int index, + final SequenceSet vSequenceSet) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._sequenceSetList.size()) { + throw new IndexOutOfBoundsException("setSequenceSet: Index value '" + index + "' not in range [0.." + (this._sequenceSetList.size() - 1) + "]"); + } + + this._sequenceSetList.set(index, vSequenceSet); + } + + /** + * + * + * @param vSequenceSetArray + */ + public void setSequenceSet( + final SequenceSet[] vSequenceSetArray) { + //-- copy array + _sequenceSetList.clear(); + + for (int i = 0; i < vSequenceSetArray.length; i++) { + this._sequenceSetList.add(vSequenceSetArray[i]); + } + } + + /** + * + * + * @param index + * @param vTree + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void setTree( + final int index, + final java.lang.String vTree) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._treeList.size()) { + throw new IndexOutOfBoundsException("setTree: Index value '" + index + "' not in range [0.." + (this._treeList.size() - 1) + "]"); + } + + this._treeList.set(index, vTree); + } + + /** + * + * + * @param vTreeArray + */ + public void setTree( + final java.lang.String[] vTreeArray) { + //-- copy array + _treeList.clear(); + + for (int i = 0; i < vTreeArray.length; i++) { + this._treeList.add(vTreeArray[i]); + } + } + + /** + * Method unmarshal. + * + * @param reader + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @return the unmarshaled jalview.binding.VAMSAS + */ + public static jalview.binding.VAMSAS unmarshal( + final java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + return (jalview.binding.VAMSAS) Unmarshaller.unmarshal(jalview.binding.VAMSAS.class, reader); + } + + /** + * + * + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void validate( + ) + throws org.exolab.castor.xml.ValidationException { + org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); + validator.validate(this); + } } diff --git a/src/jalview/binding/VamsasModel.java b/src/jalview/binding/VamsasModel.java index c57556a..5fda35e 100644 --- a/src/jalview/binding/VamsasModel.java +++ b/src/jalview/binding/VamsasModel.java @@ -1,27 +1,14 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) - * Copyright (C) $$Year-Rel$$ The Jalview Authors - * - * This file is part of Jalview. - * - * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. - * - * Jalview is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Jalview. If not, see . - * The Jalview Authors are detailed in the 'AUTHORS' file. + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ */ + package jalview.binding; -//---------------------------------/ -//- Imported classes and packages -/ + //---------------------------------/ + //- Imported classes and packages -/ //---------------------------------/ import org.exolab.castor.xml.Marshaller; @@ -32,105 +19,98 @@ import org.exolab.castor.xml.Unmarshaller; * * @version $Revision$ $Date$ */ -public class VamsasModel extends VAMSAS implements java.io.Serializable +public class VamsasModel extends VAMSAS +implements java.io.Serializable { - // ----------------/ - // - Constructors -/ - // ----------------/ - public VamsasModel() - { - super(); - } + //----------------/ + //- Constructors -/ + //----------------/ + + public VamsasModel() { + super(); + } + - // -----------/ - // - Methods -/ - // -----------/ + //-----------/ + //- Methods -/ + //-----------/ - /** - * Method isValid. - * - * @return true if this object is valid according to the schema - */ - public boolean isValid() - { - try - { - validate(); - } catch (org.exolab.castor.xml.ValidationException vex) - { - return false; + /** + * Method isValid. + * + * @return true if this object is valid according to the schema + */ + public boolean isValid( + ) { + try { + validate(); + } catch (org.exolab.castor.xml.ValidationException vex) { + return false; + } + return true; } - return true; - } - /** - * - * - * @param out - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - */ - public void marshal(final java.io.Writer out) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - Marshaller.marshal(this, out); - } + /** + * + * + * @param out + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void marshal( + final java.io.Writer out) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, out); + } - /** - * - * - * @param handler - * @throws java.io.IOException - * if an IOException occurs during marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - */ - public void marshal(final org.xml.sax.ContentHandler handler) - throws java.io.IOException, - org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - Marshaller.marshal(this, handler); - } + /** + * + * + * @param handler + * @throws java.io.IOException if an IOException occurs during + * marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + */ + public void marshal( + final org.xml.sax.ContentHandler handler) + throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, handler); + } - /** - * Method unmarshal. - * - * @param reader - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - * @return the unmarshaled jalview.binding.VAMSAS - */ - public static jalview.binding.VAMSAS unmarshal(final java.io.Reader reader) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - return (jalview.binding.VAMSAS) Unmarshaller.unmarshal( - jalview.binding.VamsasModel.class, reader); - } + /** + * Method unmarshal. + * + * @param reader + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @return the unmarshaled jalview.binding.VAMSAS + */ + public static jalview.binding.VAMSAS unmarshal( + final java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + return (jalview.binding.VAMSAS) Unmarshaller.unmarshal(jalview.binding.VamsasModel.class, reader); + } - /** - * - * - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - */ - public void validate() throws org.exolab.castor.xml.ValidationException - { - org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); - validator.validate(this); - } + /** + * + * + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void validate( + ) + throws org.exolab.castor.xml.ValidationException { + org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); + validator.validate(this); + } } diff --git a/src/jalview/binding/Viewport.java b/src/jalview/binding/Viewport.java index af2f286..643c323 100644 --- a/src/jalview/binding/Viewport.java +++ b/src/jalview/binding/Viewport.java @@ -1,27 +1,14 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) - * Copyright (C) $$Year-Rel$$ The Jalview Authors - * - * This file is part of Jalview. - * - * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. - * - * Jalview is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Jalview. If not, see . - * The Jalview Authors are detailed in the 'AUTHORS' file. + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ */ + package jalview.binding; -//---------------------------------/ -//- Imported classes and packages -/ + //---------------------------------/ + //- Imported classes and packages -/ //---------------------------------/ import org.exolab.castor.xml.Marshaller; @@ -32,1445 +19,1414 @@ import org.exolab.castor.xml.Unmarshaller; * * @version $Revision$ $Date$ */ -public class Viewport implements java.io.Serializable -{ - - // --------------------------/ - // - Class/Member Variables -/ - // --------------------------/ - - /** - * Field _conservationSelected. - */ - private boolean _conservationSelected; - - /** - * keeps track of state for field: _conservationSelected - */ - private boolean _has_conservationSelected; - - /** - * Field _pidSelected. - */ - private boolean _pidSelected; - - /** - * keeps track of state for field: _pidSelected - */ - private boolean _has_pidSelected; - - /** - * Field _bgColour. - */ - private java.lang.String _bgColour; - - /** - * Field _consThreshold. - */ - private int _consThreshold; - - /** - * keeps track of state for field: _consThreshold - */ - private boolean _has_consThreshold; - - /** - * Field _pidThreshold. - */ - private int _pidThreshold; - - /** - * keeps track of state for field: _pidThreshold - */ - private boolean _has_pidThreshold; - - /** - * Field _title. - */ - private java.lang.String _title; - - /** - * Field _showFullId. - */ - private boolean _showFullId; - - /** - * keeps track of state for field: _showFullId - */ - private boolean _has_showFullId; - - /** - * Field _showText. - */ - private boolean _showText; - - /** - * keeps track of state for field: _showText - */ - private boolean _has_showText; - - /** - * Field _showColourText. - */ - private boolean _showColourText; - - /** - * keeps track of state for field: _showColourText - */ - private boolean _has_showColourText; - - /** - * Field _showBoxes. - */ - private boolean _showBoxes; - - /** - * keeps track of state for field: _showBoxes - */ - private boolean _has_showBoxes; - - /** - * Field _wrapAlignment. - */ - private boolean _wrapAlignment; - - /** - * keeps track of state for field: _wrapAlignment - */ - private boolean _has_wrapAlignment; - - /** - * Field _renderGaps. - */ - private boolean _renderGaps; - - /** - * keeps track of state for field: _renderGaps - */ - private boolean _has_renderGaps; - - /** - * Field _showSequenceFeatures. - */ - private boolean _showSequenceFeatures; - - /** - * keeps track of state for field: _showSequenceFeatures - */ - private boolean _has_showSequenceFeatures; - - /** - * Field _showAnnotation. - */ - private boolean _showAnnotation; - - /** - * keeps track of state for field: _showAnnotation - */ - private boolean _has_showAnnotation; - - /** - * Field _showConservation. - */ - private boolean _showConservation; - - /** - * keeps track of state for field: _showConservation - */ - private boolean _has_showConservation; - - /** - * Field _showQuality. - */ - private boolean _showQuality; - - /** - * keeps track of state for field: _showQuality - */ - private boolean _has_showQuality; - - /** - * Field _showIdentity. - */ - private boolean _showIdentity; - - /** - * keeps track of state for field: _showIdentity - */ - private boolean _has_showIdentity; - - /** - * Field _xpos. - */ - private int _xpos; - - /** - * keeps track of state for field: _xpos - */ - private boolean _has_xpos; - - /** - * Field _ypos. - */ - private int _ypos; - - /** - * keeps track of state for field: _ypos - */ - private boolean _has_ypos; - - /** - * Field _width. - */ - private int _width; - - /** - * keeps track of state for field: _width - */ - private boolean _has_width; - - /** - * Field _height. - */ - private int _height; - - /** - * keeps track of state for field: _height - */ - private boolean _has_height; - - /** - * Field _startRes. - */ - private int _startRes; - - /** - * keeps track of state for field: _startRes - */ - private boolean _has_startRes; - - /** - * Field _startSeq. - */ - private int _startSeq; - - /** - * keeps track of state for field: _startSeq - */ - private boolean _has_startSeq; - - /** - * Field _fontName. - */ - private java.lang.String _fontName; - - /** - * Field _fontSize. - */ - private int _fontSize; - - /** - * keeps track of state for field: _fontSize - */ - private boolean _has_fontSize; - - /** - * Field _fontStyle. - */ - private int _fontStyle; - - /** - * keeps track of state for field: _fontStyle - */ - private boolean _has_fontStyle; - - // ----------------/ - // - Constructors -/ - // ----------------/ - - public Viewport() - { - super(); - } - - // -----------/ - // - Methods -/ - // -----------/ +public class Viewport implements java.io.Serializable { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field _conservationSelected. + */ + private boolean _conservationSelected; + + /** + * keeps track of state for field: _conservationSelected + */ + private boolean _has_conservationSelected; + + /** + * Field _pidSelected. + */ + private boolean _pidSelected; + + /** + * keeps track of state for field: _pidSelected + */ + private boolean _has_pidSelected; + + /** + * Field _bgColour. + */ + private java.lang.String _bgColour; + + /** + * Field _consThreshold. + */ + private int _consThreshold; + + /** + * keeps track of state for field: _consThreshold + */ + private boolean _has_consThreshold; + + /** + * Field _pidThreshold. + */ + private int _pidThreshold; + + /** + * keeps track of state for field: _pidThreshold + */ + private boolean _has_pidThreshold; + + /** + * Field _title. + */ + private java.lang.String _title; + + /** + * Field _showFullId. + */ + private boolean _showFullId; + + /** + * keeps track of state for field: _showFullId + */ + private boolean _has_showFullId; + + /** + * Field _showText. + */ + private boolean _showText; + + /** + * keeps track of state for field: _showText + */ + private boolean _has_showText; + + /** + * Field _showColourText. + */ + private boolean _showColourText; + + /** + * keeps track of state for field: _showColourText + */ + private boolean _has_showColourText; + + /** + * Field _showBoxes. + */ + private boolean _showBoxes; + + /** + * keeps track of state for field: _showBoxes + */ + private boolean _has_showBoxes; + + /** + * Field _wrapAlignment. + */ + private boolean _wrapAlignment; + + /** + * keeps track of state for field: _wrapAlignment + */ + private boolean _has_wrapAlignment; + + /** + * Field _renderGaps. + */ + private boolean _renderGaps; + + /** + * keeps track of state for field: _renderGaps + */ + private boolean _has_renderGaps; + + /** + * Field _showSequenceFeatures. + */ + private boolean _showSequenceFeatures; + + /** + * keeps track of state for field: _showSequenceFeatures + */ + private boolean _has_showSequenceFeatures; + + /** + * Field _showAnnotation. + */ + private boolean _showAnnotation; + + /** + * keeps track of state for field: _showAnnotation + */ + private boolean _has_showAnnotation; + + /** + * Field _showConservation. + */ + private boolean _showConservation; + + /** + * keeps track of state for field: _showConservation + */ + private boolean _has_showConservation; + + /** + * Field _showQuality. + */ + private boolean _showQuality; + + /** + * keeps track of state for field: _showQuality + */ + private boolean _has_showQuality; + + /** + * Field _showIdentity. + */ + private boolean _showIdentity; + + /** + * keeps track of state for field: _showIdentity + */ + private boolean _has_showIdentity; + + /** + * Field _xpos. + */ + private int _xpos; + + /** + * keeps track of state for field: _xpos + */ + private boolean _has_xpos; + + /** + * Field _ypos. + */ + private int _ypos; + + /** + * keeps track of state for field: _ypos + */ + private boolean _has_ypos; + + /** + * Field _width. + */ + private int _width; - /** + /** + * keeps track of state for field: _width */ - public void deleteConsThreshold() - { - this._has_consThreshold = false; - } + private boolean _has_width; - /** + /** + * Field _height. */ - public void deleteConservationSelected() - { - this._has_conservationSelected = false; - } + private int _height; - /** + /** + * keeps track of state for field: _height */ - public void deleteFontSize() - { - this._has_fontSize = false; - } + private boolean _has_height; - /** + /** + * Field _startRes. */ - public void deleteFontStyle() - { - this._has_fontStyle = false; - } + private int _startRes; - /** + /** + * keeps track of state for field: _startRes */ - public void deleteHeight() - { - this._has_height = false; - } + private boolean _has_startRes; - /** + /** + * Field _startSeq. */ - public void deletePidSelected() - { - this._has_pidSelected = false; - } + private int _startSeq; - /** + /** + * keeps track of state for field: _startSeq */ - public void deletePidThreshold() - { - this._has_pidThreshold = false; - } + private boolean _has_startSeq; - /** + /** + * Field _fontName. */ - public void deleteRenderGaps() - { - this._has_renderGaps = false; - } + private java.lang.String _fontName; - /** + /** + * Field _fontSize. */ - public void deleteShowAnnotation() - { - this._has_showAnnotation = false; - } + private int _fontSize; - /** + /** + * keeps track of state for field: _fontSize */ - public void deleteShowBoxes() - { - this._has_showBoxes = false; - } + private boolean _has_fontSize; - /** + /** + * Field _fontStyle. */ - public void deleteShowColourText() - { - this._has_showColourText = false; - } + private int _fontStyle; - /** + /** + * keeps track of state for field: _fontStyle */ - public void deleteShowConservation() - { - this._has_showConservation = false; - } + private boolean _has_fontStyle; - /** + + //----------------/ + //- Constructors -/ + //----------------/ + + public Viewport() { + super(); + } + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + */ + public void deleteConsThreshold( + ) { + this._has_consThreshold= false; + } + + /** */ - public void deleteShowFullId() - { - this._has_showFullId = false; - } + public void deleteConservationSelected( + ) { + this._has_conservationSelected= false; + } - /** + /** */ - public void deleteShowIdentity() - { - this._has_showIdentity = false; - } + public void deleteFontSize( + ) { + this._has_fontSize= false; + } + + /** + */ + public void deleteFontStyle( + ) { + this._has_fontStyle= false; + } + + /** + */ + public void deleteHeight( + ) { + this._has_height= false; + } + + /** + */ + public void deletePidSelected( + ) { + this._has_pidSelected= false; + } + + /** + */ + public void deletePidThreshold( + ) { + this._has_pidThreshold= false; + } + + /** + */ + public void deleteRenderGaps( + ) { + this._has_renderGaps= false; + } + + /** + */ + public void deleteShowAnnotation( + ) { + this._has_showAnnotation= false; + } + + /** + */ + public void deleteShowBoxes( + ) { + this._has_showBoxes= false; + } + + /** + */ + public void deleteShowColourText( + ) { + this._has_showColourText= false; + } + + /** + */ + public void deleteShowConservation( + ) { + this._has_showConservation= false; + } + + /** + */ + public void deleteShowFullId( + ) { + this._has_showFullId= false; + } + + /** + */ + public void deleteShowIdentity( + ) { + this._has_showIdentity= false; + } + + /** + */ + public void deleteShowQuality( + ) { + this._has_showQuality= false; + } + + /** + */ + public void deleteShowSequenceFeatures( + ) { + this._has_showSequenceFeatures= false; + } + + /** + */ + public void deleteShowText( + ) { + this._has_showText= false; + } + + /** + */ + public void deleteStartRes( + ) { + this._has_startRes= false; + } + + /** + */ + public void deleteStartSeq( + ) { + this._has_startSeq= false; + } + + /** + */ + public void deleteWidth( + ) { + this._has_width= false; + } + + /** + */ + public void deleteWrapAlignment( + ) { + this._has_wrapAlignment= false; + } + + /** + */ + public void deleteXpos( + ) { + this._has_xpos= false; + } + + /** + */ + public void deleteYpos( + ) { + this._has_ypos= false; + } + + /** + * Returns the value of field 'bgColour'. + * + * @return the value of field 'BgColour'. + */ + public java.lang.String getBgColour( + ) { + return this._bgColour; + } + + /** + * Returns the value of field 'consThreshold'. + * + * @return the value of field 'ConsThreshold'. + */ + public int getConsThreshold( + ) { + return this._consThreshold; + } + + /** + * Returns the value of field 'conservationSelected'. + * + * @return the value of field 'ConservationSelected'. + */ + public boolean getConservationSelected( + ) { + return this._conservationSelected; + } + + /** + * Returns the value of field 'fontName'. + * + * @return the value of field 'FontName'. + */ + public java.lang.String getFontName( + ) { + return this._fontName; + } + + /** + * Returns the value of field 'fontSize'. + * + * @return the value of field 'FontSize'. + */ + public int getFontSize( + ) { + return this._fontSize; + } + + /** + * Returns the value of field 'fontStyle'. + * + * @return the value of field 'FontStyle'. + */ + public int getFontStyle( + ) { + return this._fontStyle; + } + + /** + * Returns the value of field 'height'. + * + * @return the value of field 'Height'. + */ + public int getHeight( + ) { + return this._height; + } + + /** + * Returns the value of field 'pidSelected'. + * + * @return the value of field 'PidSelected'. + */ + public boolean getPidSelected( + ) { + return this._pidSelected; + } + + /** + * Returns the value of field 'pidThreshold'. + * + * @return the value of field 'PidThreshold'. + */ + public int getPidThreshold( + ) { + return this._pidThreshold; + } + + /** + * Returns the value of field 'renderGaps'. + * + * @return the value of field 'RenderGaps'. + */ + public boolean getRenderGaps( + ) { + return this._renderGaps; + } + + /** + * Returns the value of field 'showAnnotation'. + * + * @return the value of field 'ShowAnnotation'. + */ + public boolean getShowAnnotation( + ) { + return this._showAnnotation; + } + + /** + * Returns the value of field 'showBoxes'. + * + * @return the value of field 'ShowBoxes'. + */ + public boolean getShowBoxes( + ) { + return this._showBoxes; + } + + /** + * Returns the value of field 'showColourText'. + * + * @return the value of field 'ShowColourText'. + */ + public boolean getShowColourText( + ) { + return this._showColourText; + } + + /** + * Returns the value of field 'showConservation'. + * + * @return the value of field 'ShowConservation'. + */ + public boolean getShowConservation( + ) { + return this._showConservation; + } + + /** + * Returns the value of field 'showFullId'. + * + * @return the value of field 'ShowFullId'. + */ + public boolean getShowFullId( + ) { + return this._showFullId; + } + + /** + * Returns the value of field 'showIdentity'. + * + * @return the value of field 'ShowIdentity'. + */ + public boolean getShowIdentity( + ) { + return this._showIdentity; + } + + /** + * Returns the value of field 'showQuality'. + * + * @return the value of field 'ShowQuality'. + */ + public boolean getShowQuality( + ) { + return this._showQuality; + } + + /** + * Returns the value of field 'showSequenceFeatures'. + * + * @return the value of field 'ShowSequenceFeatures'. + */ + public boolean getShowSequenceFeatures( + ) { + return this._showSequenceFeatures; + } + + /** + * Returns the value of field 'showText'. + * + * @return the value of field 'ShowText'. + */ + public boolean getShowText( + ) { + return this._showText; + } + + /** + * Returns the value of field 'startRes'. + * + * @return the value of field 'StartRes'. + */ + public int getStartRes( + ) { + return this._startRes; + } + + /** + * Returns the value of field 'startSeq'. + * + * @return the value of field 'StartSeq'. + */ + public int getStartSeq( + ) { + return this._startSeq; + } - /** + /** + * Returns the value of field 'title'. + * + * @return the value of field 'Title'. */ - public void deleteShowQuality() - { - this._has_showQuality = false; - } - - /** - */ - public void deleteShowSequenceFeatures() - { - this._has_showSequenceFeatures = false; - } - - /** - */ - public void deleteShowText() - { - this._has_showText = false; - } - - /** - */ - public void deleteStartRes() - { - this._has_startRes = false; - } - - /** - */ - public void deleteStartSeq() - { - this._has_startSeq = false; - } - - /** - */ - public void deleteWidth() - { - this._has_width = false; - } - - /** - */ - public void deleteWrapAlignment() - { - this._has_wrapAlignment = false; - } - - /** - */ - public void deleteXpos() - { - this._has_xpos = false; - } - - /** - */ - public void deleteYpos() - { - this._has_ypos = false; - } - - /** - * Returns the value of field 'bgColour'. - * - * @return the value of field 'BgColour'. - */ - public java.lang.String getBgColour() - { - return this._bgColour; - } - - /** - * Returns the value of field 'consThreshold'. - * - * @return the value of field 'ConsThreshold'. - */ - public int getConsThreshold() - { - return this._consThreshold; - } - - /** - * Returns the value of field 'conservationSelected'. - * - * @return the value of field 'ConservationSelected'. - */ - public boolean getConservationSelected() - { - return this._conservationSelected; - } - - /** - * Returns the value of field 'fontName'. - * - * @return the value of field 'FontName'. - */ - public java.lang.String getFontName() - { - return this._fontName; - } - - /** - * Returns the value of field 'fontSize'. - * - * @return the value of field 'FontSize'. - */ - public int getFontSize() - { - return this._fontSize; - } - - /** - * Returns the value of field 'fontStyle'. - * - * @return the value of field 'FontStyle'. - */ - public int getFontStyle() - { - return this._fontStyle; - } - - /** - * Returns the value of field 'height'. - * - * @return the value of field 'Height'. - */ - public int getHeight() - { - return this._height; - } - - /** - * Returns the value of field 'pidSelected'. - * - * @return the value of field 'PidSelected'. - */ - public boolean getPidSelected() - { - return this._pidSelected; - } - - /** - * Returns the value of field 'pidThreshold'. - * - * @return the value of field 'PidThreshold'. - */ - public int getPidThreshold() - { - return this._pidThreshold; - } - - /** - * Returns the value of field 'renderGaps'. - * - * @return the value of field 'RenderGaps'. - */ - public boolean getRenderGaps() - { - return this._renderGaps; - } - - /** - * Returns the value of field 'showAnnotation'. - * - * @return the value of field 'ShowAnnotation'. - */ - public boolean getShowAnnotation() - { - return this._showAnnotation; - } - - /** - * Returns the value of field 'showBoxes'. - * - * @return the value of field 'ShowBoxes'. - */ - public boolean getShowBoxes() - { - return this._showBoxes; - } - - /** - * Returns the value of field 'showColourText'. - * - * @return the value of field 'ShowColourText'. - */ - public boolean getShowColourText() - { - return this._showColourText; - } - - /** - * Returns the value of field 'showConservation'. - * - * @return the value of field 'ShowConservation'. - */ - public boolean getShowConservation() - { - return this._showConservation; - } - - /** - * Returns the value of field 'showFullId'. - * - * @return the value of field 'ShowFullId'. - */ - public boolean getShowFullId() - { - return this._showFullId; - } - - /** - * Returns the value of field 'showIdentity'. - * - * @return the value of field 'ShowIdentity'. - */ - public boolean getShowIdentity() - { - return this._showIdentity; - } - - /** - * Returns the value of field 'showQuality'. - * - * @return the value of field 'ShowQuality'. - */ - public boolean getShowQuality() - { - return this._showQuality; - } - - /** - * Returns the value of field 'showSequenceFeatures'. - * - * @return the value of field 'ShowSequenceFeatures'. - */ - public boolean getShowSequenceFeatures() - { - return this._showSequenceFeatures; - } - - /** - * Returns the value of field 'showText'. - * - * @return the value of field 'ShowText'. - */ - public boolean getShowText() - { - return this._showText; - } - - /** - * Returns the value of field 'startRes'. - * - * @return the value of field 'StartRes'. - */ - public int getStartRes() - { - return this._startRes; - } - - /** - * Returns the value of field 'startSeq'. - * - * @return the value of field 'StartSeq'. - */ - public int getStartSeq() - { - return this._startSeq; - } - - /** - * Returns the value of field 'title'. - * - * @return the value of field 'Title'. - */ - public java.lang.String getTitle() - { - return this._title; - } - - /** - * Returns the value of field 'width'. - * - * @return the value of field 'Width'. - */ - public int getWidth() - { - return this._width; - } - - /** - * Returns the value of field 'wrapAlignment'. - * - * @return the value of field 'WrapAlignment'. - */ - public boolean getWrapAlignment() - { - return this._wrapAlignment; - } - - /** - * Returns the value of field 'xpos'. - * - * @return the value of field 'Xpos'. - */ - public int getXpos() - { - return this._xpos; - } - - /** - * Returns the value of field 'ypos'. - * - * @return the value of field 'Ypos'. - */ - public int getYpos() - { - return this._ypos; - } - - /** - * Method hasConsThreshold. - * - * @return true if at least one ConsThreshold has been added - */ - public boolean hasConsThreshold() - { - return this._has_consThreshold; - } - - /** - * Method hasConservationSelected. - * - * @return true if at least one ConservationSelected has been added - */ - public boolean hasConservationSelected() - { - return this._has_conservationSelected; - } - - /** - * Method hasFontSize. - * - * @return true if at least one FontSize has been added - */ - public boolean hasFontSize() - { - return this._has_fontSize; - } - - /** - * Method hasFontStyle. - * - * @return true if at least one FontStyle has been added - */ - public boolean hasFontStyle() - { - return this._has_fontStyle; - } - - /** - * Method hasHeight. - * - * @return true if at least one Height has been added - */ - public boolean hasHeight() - { - return this._has_height; - } - - /** - * Method hasPidSelected. - * - * @return true if at least one PidSelected has been added - */ - public boolean hasPidSelected() - { - return this._has_pidSelected; - } - - /** - * Method hasPidThreshold. - * - * @return true if at least one PidThreshold has been added - */ - public boolean hasPidThreshold() - { - return this._has_pidThreshold; - } - - /** - * Method hasRenderGaps. - * - * @return true if at least one RenderGaps has been added - */ - public boolean hasRenderGaps() - { - return this._has_renderGaps; - } - - /** - * Method hasShowAnnotation. - * - * @return true if at least one ShowAnnotation has been added - */ - public boolean hasShowAnnotation() - { - return this._has_showAnnotation; - } - - /** - * Method hasShowBoxes. - * - * @return true if at least one ShowBoxes has been added - */ - public boolean hasShowBoxes() - { - return this._has_showBoxes; - } - - /** - * Method hasShowColourText. - * - * @return true if at least one ShowColourText has been added - */ - public boolean hasShowColourText() - { - return this._has_showColourText; - } - - /** - * Method hasShowConservation. - * - * @return true if at least one ShowConservation has been added - */ - public boolean hasShowConservation() - { - return this._has_showConservation; - } - - /** - * Method hasShowFullId. - * - * @return true if at least one ShowFullId has been added - */ - public boolean hasShowFullId() - { - return this._has_showFullId; - } - - /** - * Method hasShowIdentity. - * - * @return true if at least one ShowIdentity has been added - */ - public boolean hasShowIdentity() - { - return this._has_showIdentity; - } - - /** - * Method hasShowQuality. - * - * @return true if at least one ShowQuality has been added - */ - public boolean hasShowQuality() - { - return this._has_showQuality; - } - - /** - * Method hasShowSequenceFeatures. - * - * @return true if at least one ShowSequenceFeatures has been added - */ - public boolean hasShowSequenceFeatures() - { - return this._has_showSequenceFeatures; - } - - /** - * Method hasShowText. - * - * @return true if at least one ShowText has been added - */ - public boolean hasShowText() - { - return this._has_showText; - } - - /** - * Method hasStartRes. - * - * @return true if at least one StartRes has been added - */ - public boolean hasStartRes() - { - return this._has_startRes; - } - - /** - * Method hasStartSeq. - * - * @return true if at least one StartSeq has been added - */ - public boolean hasStartSeq() - { - return this._has_startSeq; - } - - /** - * Method hasWidth. - * - * @return true if at least one Width has been added - */ - public boolean hasWidth() - { - return this._has_width; - } - - /** - * Method hasWrapAlignment. - * - * @return true if at least one WrapAlignment has been added - */ - public boolean hasWrapAlignment() - { - return this._has_wrapAlignment; - } - - /** - * Method hasXpos. - * - * @return true if at least one Xpos has been added - */ - public boolean hasXpos() - { - return this._has_xpos; - } - - /** - * Method hasYpos. - * - * @return true if at least one Ypos has been added - */ - public boolean hasYpos() - { - return this._has_ypos; - } - - /** - * Returns the value of field 'conservationSelected'. - * - * @return the value of field 'ConservationSelected'. - */ - public boolean isConservationSelected() - { - return this._conservationSelected; - } - - /** - * Returns the value of field 'pidSelected'. - * - * @return the value of field 'PidSelected'. - */ - public boolean isPidSelected() - { - return this._pidSelected; - } - - /** - * Returns the value of field 'renderGaps'. - * - * @return the value of field 'RenderGaps'. - */ - public boolean isRenderGaps() - { - return this._renderGaps; - } - - /** - * Returns the value of field 'showAnnotation'. - * - * @return the value of field 'ShowAnnotation'. - */ - public boolean isShowAnnotation() - { - return this._showAnnotation; - } - - /** - * Returns the value of field 'showBoxes'. - * - * @return the value of field 'ShowBoxes'. - */ - public boolean isShowBoxes() - { - return this._showBoxes; - } - - /** - * Returns the value of field 'showColourText'. - * - * @return the value of field 'ShowColourText'. - */ - public boolean isShowColourText() - { - return this._showColourText; - } - - /** - * Returns the value of field 'showConservation'. - * - * @return the value of field 'ShowConservation'. - */ - public boolean isShowConservation() - { - return this._showConservation; - } - - /** - * Returns the value of field 'showFullId'. - * - * @return the value of field 'ShowFullId'. - */ - public boolean isShowFullId() - { - return this._showFullId; - } - - /** - * Returns the value of field 'showIdentity'. - * - * @return the value of field 'ShowIdentity'. - */ - public boolean isShowIdentity() - { - return this._showIdentity; - } - - /** - * Returns the value of field 'showQuality'. - * - * @return the value of field 'ShowQuality'. - */ - public boolean isShowQuality() - { - return this._showQuality; - } - - /** - * Returns the value of field 'showSequenceFeatures'. - * - * @return the value of field 'ShowSequenceFeatures'. - */ - public boolean isShowSequenceFeatures() - { - return this._showSequenceFeatures; - } - - /** - * Returns the value of field 'showText'. - * - * @return the value of field 'ShowText'. - */ - public boolean isShowText() - { - return this._showText; - } - - /** - * Method isValid. - * - * @return true if this object is valid according to the schema - */ - public boolean isValid() - { - try - { - validate(); - } catch (org.exolab.castor.xml.ValidationException vex) - { - return false; - } - return true; - } - - /** - * Returns the value of field 'wrapAlignment'. - * - * @return the value of field 'WrapAlignment'. - */ - public boolean isWrapAlignment() - { - return this._wrapAlignment; - } - - /** - * - * - * @param out - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - */ - public void marshal(final java.io.Writer out) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - Marshaller.marshal(this, out); - } - - /** - * - * - * @param handler - * @throws java.io.IOException - * if an IOException occurs during marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - */ - public void marshal(final org.xml.sax.ContentHandler handler) - throws java.io.IOException, - org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - Marshaller.marshal(this, handler); - } - - /** - * Sets the value of field 'bgColour'. - * - * @param bgColour - * the value of field 'bgColour'. - */ - public void setBgColour(final java.lang.String bgColour) - { - this._bgColour = bgColour; - } - - /** - * Sets the value of field 'consThreshold'. - * - * @param consThreshold - * the value of field 'consThreshold'. - */ - public void setConsThreshold(final int consThreshold) - { - this._consThreshold = consThreshold; - this._has_consThreshold = true; - } - - /** - * Sets the value of field 'conservationSelected'. - * - * @param conservationSelected - * the value of field 'conservationSelected'. - */ - public void setConservationSelected(final boolean conservationSelected) - { - this._conservationSelected = conservationSelected; - this._has_conservationSelected = true; - } - - /** - * Sets the value of field 'fontName'. - * - * @param fontName - * the value of field 'fontName'. - */ - public void setFontName(final java.lang.String fontName) - { - this._fontName = fontName; - } - - /** - * Sets the value of field 'fontSize'. - * - * @param fontSize - * the value of field 'fontSize'. - */ - public void setFontSize(final int fontSize) - { - this._fontSize = fontSize; - this._has_fontSize = true; - } - - /** - * Sets the value of field 'fontStyle'. - * - * @param fontStyle - * the value of field 'fontStyle'. - */ - public void setFontStyle(final int fontStyle) - { - this._fontStyle = fontStyle; - this._has_fontStyle = true; - } - - /** - * Sets the value of field 'height'. - * - * @param height - * the value of field 'height'. - */ - public void setHeight(final int height) - { - this._height = height; - this._has_height = true; - } - - /** - * Sets the value of field 'pidSelected'. - * - * @param pidSelected - * the value of field 'pidSelected'. - */ - public void setPidSelected(final boolean pidSelected) - { - this._pidSelected = pidSelected; - this._has_pidSelected = true; - } - - /** - * Sets the value of field 'pidThreshold'. - * - * @param pidThreshold - * the value of field 'pidThreshold'. - */ - public void setPidThreshold(final int pidThreshold) - { - this._pidThreshold = pidThreshold; - this._has_pidThreshold = true; - } - - /** - * Sets the value of field 'renderGaps'. - * - * @param renderGaps - * the value of field 'renderGaps'. - */ - public void setRenderGaps(final boolean renderGaps) - { - this._renderGaps = renderGaps; - this._has_renderGaps = true; - } - - /** - * Sets the value of field 'showAnnotation'. - * - * @param showAnnotation - * the value of field 'showAnnotation'. - */ - public void setShowAnnotation(final boolean showAnnotation) - { - this._showAnnotation = showAnnotation; - this._has_showAnnotation = true; - } - - /** - * Sets the value of field 'showBoxes'. - * - * @param showBoxes - * the value of field 'showBoxes'. - */ - public void setShowBoxes(final boolean showBoxes) - { - this._showBoxes = showBoxes; - this._has_showBoxes = true; - } - - /** - * Sets the value of field 'showColourText'. - * - * @param showColourText - * the value of field 'showColourText'. - */ - public void setShowColourText(final boolean showColourText) - { - this._showColourText = showColourText; - this._has_showColourText = true; - } - - /** - * Sets the value of field 'showConservation'. - * - * @param showConservation - * the value of field 'showConservation' - */ - public void setShowConservation(final boolean showConservation) - { - this._showConservation = showConservation; - this._has_showConservation = true; - } - - /** - * Sets the value of field 'showFullId'. - * - * @param showFullId - * the value of field 'showFullId'. - */ - public void setShowFullId(final boolean showFullId) - { - this._showFullId = showFullId; - this._has_showFullId = true; - } - - /** - * Sets the value of field 'showIdentity'. - * - * @param showIdentity - * the value of field 'showIdentity'. - */ - public void setShowIdentity(final boolean showIdentity) - { - this._showIdentity = showIdentity; - this._has_showIdentity = true; - } - - /** - * Sets the value of field 'showQuality'. - * - * @param showQuality - * the value of field 'showQuality'. - */ - public void setShowQuality(final boolean showQuality) - { - this._showQuality = showQuality; - this._has_showQuality = true; - } - - /** - * Sets the value of field 'showSequenceFeatures'. - * - * @param showSequenceFeatures - * the value of field 'showSequenceFeatures'. - */ - public void setShowSequenceFeatures(final boolean showSequenceFeatures) - { - this._showSequenceFeatures = showSequenceFeatures; - this._has_showSequenceFeatures = true; - } - - /** - * Sets the value of field 'showText'. - * - * @param showText - * the value of field 'showText'. - */ - public void setShowText(final boolean showText) - { - this._showText = showText; - this._has_showText = true; - } - - /** - * Sets the value of field 'startRes'. - * - * @param startRes - * the value of field 'startRes'. - */ - public void setStartRes(final int startRes) - { - this._startRes = startRes; - this._has_startRes = true; - } - - /** - * Sets the value of field 'startSeq'. - * - * @param startSeq - * the value of field 'startSeq'. - */ - public void setStartSeq(final int startSeq) - { - this._startSeq = startSeq; - this._has_startSeq = true; - } - - /** - * Sets the value of field 'title'. - * - * @param title - * the value of field 'title'. - */ - public void setTitle(final java.lang.String title) - { - this._title = title; - } - - /** - * Sets the value of field 'width'. - * - * @param width - * the value of field 'width'. - */ - public void setWidth(final int width) - { - this._width = width; - this._has_width = true; - } - - /** - * Sets the value of field 'wrapAlignment'. - * - * @param wrapAlignment - * the value of field 'wrapAlignment'. - */ - public void setWrapAlignment(final boolean wrapAlignment) - { - this._wrapAlignment = wrapAlignment; - this._has_wrapAlignment = true; - } - - /** - * Sets the value of field 'xpos'. - * - * @param xpos - * the value of field 'xpos'. - */ - public void setXpos(final int xpos) - { - this._xpos = xpos; - this._has_xpos = true; - } - - /** - * Sets the value of field 'ypos'. - * - * @param ypos - * the value of field 'ypos'. - */ - public void setYpos(final int ypos) - { - this._ypos = ypos; - this._has_ypos = true; - } - - /** - * Method unmarshal. - * - * @param reader - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - * @return the unmarshaled jalview.binding.Viewport - */ - public static jalview.binding.Viewport unmarshal( - final java.io.Reader reader) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - return (jalview.binding.Viewport) Unmarshaller.unmarshal( - jalview.binding.Viewport.class, reader); - } - - /** - * - * - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - */ - public void validate() throws org.exolab.castor.xml.ValidationException - { - org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); - validator.validate(this); - } + public java.lang.String getTitle( + ) { + return this._title; + } + + /** + * Returns the value of field 'width'. + * + * @return the value of field 'Width'. + */ + public int getWidth( + ) { + return this._width; + } + + /** + * Returns the value of field 'wrapAlignment'. + * + * @return the value of field 'WrapAlignment'. + */ + public boolean getWrapAlignment( + ) { + return this._wrapAlignment; + } + + /** + * Returns the value of field 'xpos'. + * + * @return the value of field 'Xpos'. + */ + public int getXpos( + ) { + return this._xpos; + } + + /** + * Returns the value of field 'ypos'. + * + * @return the value of field 'Ypos'. + */ + public int getYpos( + ) { + return this._ypos; + } + + /** + * Method hasConsThreshold. + * + * @return true if at least one ConsThreshold has been added + */ + public boolean hasConsThreshold( + ) { + return this._has_consThreshold; + } + + /** + * Method hasConservationSelected. + * + * @return true if at least one ConservationSelected has been + * added + */ + public boolean hasConservationSelected( + ) { + return this._has_conservationSelected; + } + + /** + * Method hasFontSize. + * + * @return true if at least one FontSize has been added + */ + public boolean hasFontSize( + ) { + return this._has_fontSize; + } + + /** + * Method hasFontStyle. + * + * @return true if at least one FontStyle has been added + */ + public boolean hasFontStyle( + ) { + return this._has_fontStyle; + } + + /** + * Method hasHeight. + * + * @return true if at least one Height has been added + */ + public boolean hasHeight( + ) { + return this._has_height; + } + + /** + * Method hasPidSelected. + * + * @return true if at least one PidSelected has been added + */ + public boolean hasPidSelected( + ) { + return this._has_pidSelected; + } + + /** + * Method hasPidThreshold. + * + * @return true if at least one PidThreshold has been added + */ + public boolean hasPidThreshold( + ) { + return this._has_pidThreshold; + } + + /** + * Method hasRenderGaps. + * + * @return true if at least one RenderGaps has been added + */ + public boolean hasRenderGaps( + ) { + return this._has_renderGaps; + } + + /** + * Method hasShowAnnotation. + * + * @return true if at least one ShowAnnotation has been added + */ + public boolean hasShowAnnotation( + ) { + return this._has_showAnnotation; + } + + /** + * Method hasShowBoxes. + * + * @return true if at least one ShowBoxes has been added + */ + public boolean hasShowBoxes( + ) { + return this._has_showBoxes; + } + + /** + * Method hasShowColourText. + * + * @return true if at least one ShowColourText has been added + */ + public boolean hasShowColourText( + ) { + return this._has_showColourText; + } + + /** + * Method hasShowConservation. + * + * @return true if at least one ShowConservation has been added + */ + public boolean hasShowConservation( + ) { + return this._has_showConservation; + } + + /** + * Method hasShowFullId. + * + * @return true if at least one ShowFullId has been added + */ + public boolean hasShowFullId( + ) { + return this._has_showFullId; + } + + /** + * Method hasShowIdentity. + * + * @return true if at least one ShowIdentity has been added + */ + public boolean hasShowIdentity( + ) { + return this._has_showIdentity; + } + + /** + * Method hasShowQuality. + * + * @return true if at least one ShowQuality has been added + */ + public boolean hasShowQuality( + ) { + return this._has_showQuality; + } + + /** + * Method hasShowSequenceFeatures. + * + * @return true if at least one ShowSequenceFeatures has been + * added + */ + public boolean hasShowSequenceFeatures( + ) { + return this._has_showSequenceFeatures; + } + + /** + * Method hasShowText. + * + * @return true if at least one ShowText has been added + */ + public boolean hasShowText( + ) { + return this._has_showText; + } + + /** + * Method hasStartRes. + * + * @return true if at least one StartRes has been added + */ + public boolean hasStartRes( + ) { + return this._has_startRes; + } + + /** + * Method hasStartSeq. + * + * @return true if at least one StartSeq has been added + */ + public boolean hasStartSeq( + ) { + return this._has_startSeq; + } + + /** + * Method hasWidth. + * + * @return true if at least one Width has been added + */ + public boolean hasWidth( + ) { + return this._has_width; + } + + /** + * Method hasWrapAlignment. + * + * @return true if at least one WrapAlignment has been added + */ + public boolean hasWrapAlignment( + ) { + return this._has_wrapAlignment; + } + + /** + * Method hasXpos. + * + * @return true if at least one Xpos has been added + */ + public boolean hasXpos( + ) { + return this._has_xpos; + } + + /** + * Method hasYpos. + * + * @return true if at least one Ypos has been added + */ + public boolean hasYpos( + ) { + return this._has_ypos; + } + + /** + * Returns the value of field 'conservationSelected'. + * + * @return the value of field 'ConservationSelected'. + */ + public boolean isConservationSelected( + ) { + return this._conservationSelected; + } + + /** + * Returns the value of field 'pidSelected'. + * + * @return the value of field 'PidSelected'. + */ + public boolean isPidSelected( + ) { + return this._pidSelected; + } + + /** + * Returns the value of field 'renderGaps'. + * + * @return the value of field 'RenderGaps'. + */ + public boolean isRenderGaps( + ) { + return this._renderGaps; + } + + /** + * Returns the value of field 'showAnnotation'. + * + * @return the value of field 'ShowAnnotation'. + */ + public boolean isShowAnnotation( + ) { + return this._showAnnotation; + } + + /** + * Returns the value of field 'showBoxes'. + * + * @return the value of field 'ShowBoxes'. + */ + public boolean isShowBoxes( + ) { + return this._showBoxes; + } + + /** + * Returns the value of field 'showColourText'. + * + * @return the value of field 'ShowColourText'. + */ + public boolean isShowColourText( + ) { + return this._showColourText; + } + + /** + * Returns the value of field 'showConservation'. + * + * @return the value of field 'ShowConservation'. + */ + public boolean isShowConservation( + ) { + return this._showConservation; + } + + /** + * Returns the value of field 'showFullId'. + * + * @return the value of field 'ShowFullId'. + */ + public boolean isShowFullId( + ) { + return this._showFullId; + } + + /** + * Returns the value of field 'showIdentity'. + * + * @return the value of field 'ShowIdentity'. + */ + public boolean isShowIdentity( + ) { + return this._showIdentity; + } + + /** + * Returns the value of field 'showQuality'. + * + * @return the value of field 'ShowQuality'. + */ + public boolean isShowQuality( + ) { + return this._showQuality; + } + + /** + * Returns the value of field 'showSequenceFeatures'. + * + * @return the value of field 'ShowSequenceFeatures'. + */ + public boolean isShowSequenceFeatures( + ) { + return this._showSequenceFeatures; + } + + /** + * Returns the value of field 'showText'. + * + * @return the value of field 'ShowText'. + */ + public boolean isShowText( + ) { + return this._showText; + } + + /** + * Method isValid. + * + * @return true if this object is valid according to the schema + */ + public boolean isValid( + ) { + try { + validate(); + } catch (org.exolab.castor.xml.ValidationException vex) { + return false; + } + return true; + } + + /** + * Returns the value of field 'wrapAlignment'. + * + * @return the value of field 'WrapAlignment'. + */ + public boolean isWrapAlignment( + ) { + return this._wrapAlignment; + } + + /** + * + * + * @param out + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void marshal( + final java.io.Writer out) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, out); + } + + /** + * + * + * @param handler + * @throws java.io.IOException if an IOException occurs during + * marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + */ + public void marshal( + final org.xml.sax.ContentHandler handler) + throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, handler); + } + + /** + * Sets the value of field 'bgColour'. + * + * @param bgColour the value of field 'bgColour'. + */ + public void setBgColour( + final java.lang.String bgColour) { + this._bgColour = bgColour; + } + + /** + * Sets the value of field 'consThreshold'. + * + * @param consThreshold the value of field 'consThreshold'. + */ + public void setConsThreshold( + final int consThreshold) { + this._consThreshold = consThreshold; + this._has_consThreshold = true; + } + + /** + * Sets the value of field 'conservationSelected'. + * + * @param conservationSelected the value of field + * 'conservationSelected'. + */ + public void setConservationSelected( + final boolean conservationSelected) { + this._conservationSelected = conservationSelected; + this._has_conservationSelected = true; + } + + /** + * Sets the value of field 'fontName'. + * + * @param fontName the value of field 'fontName'. + */ + public void setFontName( + final java.lang.String fontName) { + this._fontName = fontName; + } + + /** + * Sets the value of field 'fontSize'. + * + * @param fontSize the value of field 'fontSize'. + */ + public void setFontSize( + final int fontSize) { + this._fontSize = fontSize; + this._has_fontSize = true; + } + + /** + * Sets the value of field 'fontStyle'. + * + * @param fontStyle the value of field 'fontStyle'. + */ + public void setFontStyle( + final int fontStyle) { + this._fontStyle = fontStyle; + this._has_fontStyle = true; + } + + /** + * Sets the value of field 'height'. + * + * @param height the value of field 'height'. + */ + public void setHeight( + final int height) { + this._height = height; + this._has_height = true; + } + + /** + * Sets the value of field 'pidSelected'. + * + * @param pidSelected the value of field 'pidSelected'. + */ + public void setPidSelected( + final boolean pidSelected) { + this._pidSelected = pidSelected; + this._has_pidSelected = true; + } + + /** + * Sets the value of field 'pidThreshold'. + * + * @param pidThreshold the value of field 'pidThreshold'. + */ + public void setPidThreshold( + final int pidThreshold) { + this._pidThreshold = pidThreshold; + this._has_pidThreshold = true; + } + + /** + * Sets the value of field 'renderGaps'. + * + * @param renderGaps the value of field 'renderGaps'. + */ + public void setRenderGaps( + final boolean renderGaps) { + this._renderGaps = renderGaps; + this._has_renderGaps = true; + } + + /** + * Sets the value of field 'showAnnotation'. + * + * @param showAnnotation the value of field 'showAnnotation'. + */ + public void setShowAnnotation( + final boolean showAnnotation) { + this._showAnnotation = showAnnotation; + this._has_showAnnotation = true; + } + + /** + * Sets the value of field 'showBoxes'. + * + * @param showBoxes the value of field 'showBoxes'. + */ + public void setShowBoxes( + final boolean showBoxes) { + this._showBoxes = showBoxes; + this._has_showBoxes = true; + } + + /** + * Sets the value of field 'showColourText'. + * + * @param showColourText the value of field 'showColourText'. + */ + public void setShowColourText( + final boolean showColourText) { + this._showColourText = showColourText; + this._has_showColourText = true; + } + + /** + * Sets the value of field 'showConservation'. + * + * @param showConservation the value of field 'showConservation' + */ + public void setShowConservation( + final boolean showConservation) { + this._showConservation = showConservation; + this._has_showConservation = true; + } + + /** + * Sets the value of field 'showFullId'. + * + * @param showFullId the value of field 'showFullId'. + */ + public void setShowFullId( + final boolean showFullId) { + this._showFullId = showFullId; + this._has_showFullId = true; + } + + /** + * Sets the value of field 'showIdentity'. + * + * @param showIdentity the value of field 'showIdentity'. + */ + public void setShowIdentity( + final boolean showIdentity) { + this._showIdentity = showIdentity; + this._has_showIdentity = true; + } + + /** + * Sets the value of field 'showQuality'. + * + * @param showQuality the value of field 'showQuality'. + */ + public void setShowQuality( + final boolean showQuality) { + this._showQuality = showQuality; + this._has_showQuality = true; + } + + /** + * Sets the value of field 'showSequenceFeatures'. + * + * @param showSequenceFeatures the value of field + * 'showSequenceFeatures'. + */ + public void setShowSequenceFeatures( + final boolean showSequenceFeatures) { + this._showSequenceFeatures = showSequenceFeatures; + this._has_showSequenceFeatures = true; + } + + /** + * Sets the value of field 'showText'. + * + * @param showText the value of field 'showText'. + */ + public void setShowText( + final boolean showText) { + this._showText = showText; + this._has_showText = true; + } + + /** + * Sets the value of field 'startRes'. + * + * @param startRes the value of field 'startRes'. + */ + public void setStartRes( + final int startRes) { + this._startRes = startRes; + this._has_startRes = true; + } + + /** + * Sets the value of field 'startSeq'. + * + * @param startSeq the value of field 'startSeq'. + */ + public void setStartSeq( + final int startSeq) { + this._startSeq = startSeq; + this._has_startSeq = true; + } + + /** + * Sets the value of field 'title'. + * + * @param title the value of field 'title'. + */ + public void setTitle( + final java.lang.String title) { + this._title = title; + } + + /** + * Sets the value of field 'width'. + * + * @param width the value of field 'width'. + */ + public void setWidth( + final int width) { + this._width = width; + this._has_width = true; + } + + /** + * Sets the value of field 'wrapAlignment'. + * + * @param wrapAlignment the value of field 'wrapAlignment'. + */ + public void setWrapAlignment( + final boolean wrapAlignment) { + this._wrapAlignment = wrapAlignment; + this._has_wrapAlignment = true; + } + + /** + * Sets the value of field 'xpos'. + * + * @param xpos the value of field 'xpos'. + */ + public void setXpos( + final int xpos) { + this._xpos = xpos; + this._has_xpos = true; + } + + /** + * Sets the value of field 'ypos'. + * + * @param ypos the value of field 'ypos'. + */ + public void setYpos( + final int ypos) { + this._ypos = ypos; + this._has_ypos = true; + } + + /** + * Method unmarshal. + * + * @param reader + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @return the unmarshaled jalview.binding.Viewport + */ + public static jalview.binding.Viewport unmarshal( + final java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + return (jalview.binding.Viewport) Unmarshaller.unmarshal(jalview.binding.Viewport.class, reader); + } + + /** + * + * + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void validate( + ) + throws org.exolab.castor.xml.ValidationException { + org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); + validator.validate(this); + } } diff --git a/src/jalview/datamodel/Alignment.java b/src/jalview/datamodel/Alignment.java index 81046f1..15df67b 100755 --- a/src/jalview/datamodel/Alignment.java +++ b/src/jalview/datamodel/Alignment.java @@ -20,6 +20,10 @@ */ package jalview.datamodel; +import jalview.analysis.AlignmentUtils; +import jalview.io.FastaFile; +import jalview.util.MessageManager; + import java.util.ArrayList; import java.util.Enumeration; import java.util.HashSet; @@ -30,10 +34,6 @@ import java.util.Map; import java.util.Set; import java.util.Vector; -import jalview.analysis.AlignmentUtils; -import jalview.io.FastaFile; -import jalview.util.MessageManager; - /** * Data structure to hold and manipulate a multiple sequence alignment */ @@ -1734,4 +1734,19 @@ public class Alignment implements AlignmentI } return names; } + + @Override + public boolean hasValidSequence() + { + boolean hasValidSeq = false; + for (SequenceI seq : getSequences()) + { + if (seq.getSequenceAsString().matches("(-*[a-zA-Z]-*){1}[a-zA-Z-]*")) + { + hasValidSeq = true; + break; + } + } + return hasValidSeq; + } } diff --git a/src/jalview/datamodel/AlignmentAnnotation.java b/src/jalview/datamodel/AlignmentAnnotation.java index 4c5ea17..322fd54 100755 --- a/src/jalview/datamodel/AlignmentAnnotation.java +++ b/src/jalview/datamodel/AlignmentAnnotation.java @@ -20,10 +20,6 @@ */ package jalview.datamodel; -import jalview.analysis.Rna; -import jalview.analysis.SecStrConsensus.SimpleBP; -import jalview.analysis.WUSSParseException; - import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -32,6 +28,10 @@ import java.util.Iterator; import java.util.Map; import java.util.Map.Entry; +import jalview.analysis.Rna; +import jalview.analysis.SecStrConsensus.SimpleBP; +import jalview.analysis.WUSSParseException; + /** * DOCUMENT ME! * @@ -40,6 +40,8 @@ import java.util.Map.Entry; */ public class AlignmentAnnotation { + private static final String ANNOTATION_ID_PREFIX = "ann"; + /* * Identifers for different types of profile data */ @@ -49,6 +51,8 @@ public class AlignmentAnnotation public static final int CDNA_PROFILE = 2; + private static long counter = 0; + /** * If true, this annotations is calculated every edit, eg consensus, quality * or conservation graphs @@ -282,6 +286,7 @@ public class AlignmentAnnotation public AlignmentAnnotation(String label, String description, Annotation[] annotations) { + setAnnotationId(); // always editable? editable = true; this.label = label; @@ -458,8 +463,6 @@ public class AlignmentAnnotation _updateRnaSecStr(new AnnotCharSequence()); } } - - annotationId = this.hashCode() + ""; } /** @@ -565,6 +568,7 @@ public class AlignmentAnnotation public AlignmentAnnotation(String label, String description, Annotation[] annotations, float min, float max, int graphType) { + setAnnotationId(); // graphs are not editable editable = graphType == 0; @@ -664,6 +668,7 @@ public class AlignmentAnnotation */ public AlignmentAnnotation(AlignmentAnnotation annotation) { + setAnnotationId(); this.label = new String(annotation.label); if (annotation.description != null) { @@ -1382,4 +1387,18 @@ public class AlignmentAnnotation return sequenceMapping == null ? null : sequenceMapping.get(position); } + + /** + * Set the id to "ann" followed by a counter that increments so as to be + * unique for the lifetime of the JVM + */ + protected final void setAnnotationId() + { + this.annotationId = ANNOTATION_ID_PREFIX + Long.toString(nextId()); + } + + protected static synchronized long nextId() + { + return counter++; + } } diff --git a/src/jalview/datamodel/AlignmentExportData.java b/src/jalview/datamodel/AlignmentExportData.java new file mode 100644 index 0000000..46da85d --- /dev/null +++ b/src/jalview/datamodel/AlignmentExportData.java @@ -0,0 +1,63 @@ +package jalview.datamodel; + +import jalview.gui.AlignExportSettings; + +public class AlignmentExportData +{ + private AlignmentI alignment; + + private String[] omitHidden; + + private int[] startEnd; + + private AlignExportSettings settings; + + public AlignmentExportData(AlignmentI align, String[] ommit, + int[] startEnd, AlignExportSettings settings) + { + this.alignment = align; + this.omitHidden = ommit; + this.startEnd = startEnd; + this.settings = settings; + } + + public AlignmentI getAlignment() + { + return alignment; + } + + public void setAlignment(AlignmentI alignment) + { + this.alignment = alignment; + } + + public String[] getOmitHidden() + { + return omitHidden; + } + + public void setOmitHidden(String[] omitHidden) + { + this.omitHidden = omitHidden; + } + + public int[] getStartEndPostions() + { + return startEnd; + } + + public void setStartEndPostions(int[] startEnd) + { + this.startEnd = startEnd; + } + + public AlignExportSettings getSettings() + { + return settings; + } + + public void setSettings(AlignExportSettings settings) + { + this.settings = settings; + } +} diff --git a/src/jalview/datamodel/AlignmentI.java b/src/jalview/datamodel/AlignmentI.java index 67e5743..8194bf0 100755 --- a/src/jalview/datamodel/AlignmentI.java +++ b/src/jalview/datamodel/AlignmentI.java @@ -517,4 +517,12 @@ public interface AlignmentI extends AnnotatedCollectionI * @return */ Set getSequenceNames(); + + /** + * Checks if the alignment has at least one sequence with one non-gaped + * residue + * + * @return + */ + public boolean hasValidSequence(); } diff --git a/src/jalview/datamodel/Annotation.java b/src/jalview/datamodel/Annotation.java index dae81ef..71ebbb3 100755 --- a/src/jalview/datamodel/Annotation.java +++ b/src/jalview/datamodel/Annotation.java @@ -107,9 +107,13 @@ public class Annotation return; } if (that.displayCharacter != null) + { displayCharacter = new String(that.displayCharacter); + } if (that.description != null) + { description = new String(that.description); + } secondaryStructure = that.secondaryStructure; value = that.value; colour = that.colour; @@ -168,7 +172,7 @@ public class Annotation { sb.append(","); } - if (value != Float.NaN) + if (!Float.isNaN(value)) { sb.append(value); } diff --git a/src/jalview/datamodel/RnaViewerModel.java b/src/jalview/datamodel/RnaViewerModel.java new file mode 100644 index 0000000..33783ec --- /dev/null +++ b/src/jalview/datamodel/RnaViewerModel.java @@ -0,0 +1,46 @@ +package jalview.datamodel; + + +/** + * A data bean class to hold properties of an RNA viewer + */ +public class RnaViewerModel +{ + public final String viewId; + + public final String title; + + public final int x; + + public final int y; + + public final int width; + + public final int height; + + public final int dividerLocation; + + /** + * Constructor + * + * @param viewId + * @param title + * @param xpos + * @param ypos + * @param width + * @param height + * @param dividerLocation + */ + public RnaViewerModel(String viewId, String title, int xpos, int ypos, + int width, + int height, int dividerLocation) + { + this.viewId = viewId; + this.title = title; + this.x = xpos; + this.y = ypos; + this.width = width; + this.height = height; + this.dividerLocation = dividerLocation; + } +} diff --git a/src/jalview/datamodel/Sequence.java b/src/jalview/datamodel/Sequence.java index 37bb7a9..c78ec22 100755 --- a/src/jalview/datamodel/Sequence.java +++ b/src/jalview/datamodel/Sequence.java @@ -20,6 +20,9 @@ */ package jalview.datamodel; +import jalview.analysis.AlignSeq; +import jalview.util.StringUtils; + import java.util.ArrayList; import java.util.Enumeration; import java.util.List; @@ -27,9 +30,6 @@ import java.util.Vector; import fr.orsay.lri.varna.models.rna.RNA; -import jalview.analysis.AlignSeq; -import jalview.util.StringUtils; - /** * * Implements the SequenceI interface for a char[] based sequence object. @@ -768,7 +768,7 @@ public class Sequence extends ASequence implements SequenceI public void deleteChars(int i, int j) { int newstart = start, newend = end; - if (i >= sequence.length) + if (i >= sequence.length || i < 0) { return; } diff --git a/src/jalview/datamodel/xdb/embl/EmblEntry.java b/src/jalview/datamodel/xdb/embl/EmblEntry.java index 3f890ba..9c9447e 100644 --- a/src/jalview/datamodel/xdb/embl/EmblEntry.java +++ b/src/jalview/datamodel/xdb/embl/EmblEntry.java @@ -20,11 +20,6 @@ */ package jalview.datamodel.xdb.embl; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.Vector; - import jalview.datamodel.DBRefEntry; import jalview.datamodel.DBRefSource; import jalview.datamodel.FeatureProperties; @@ -33,6 +28,10 @@ import jalview.datamodel.Sequence; import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceI; +import java.util.Hashtable; +import java.util.Map.Entry; +import java.util.Vector; + /** * Data model for one entry returned from an EMBL query, as marshalled by a * Castor binding file @@ -397,7 +396,7 @@ public class EmblEntry boolean noPeptide, String sourceDb) { // TODO: ensure emblEntry.getSequences behaves correctly for returning all // cases of noNa and noPeptide - Vector seqs = new Vector(); + Vector seqs = new Vector(); Sequence dna = null; if (!noNa) { @@ -415,26 +414,23 @@ public class EmblEntry // TODO: transform EMBL Database refs to canonical form if (dbRefs != null) { - for (Iterator i = dbRefs.iterator(); i.hasNext(); dna - .addDBRef((DBRefEntry) i.next())) + for (DBRefEntry dbref : dbRefs) { - ; + dna.addDBRef(dbref); } } } try { - for (Iterator i = features.iterator(); i.hasNext();) + for (EmblFeature feature: features) { - EmblFeature feature = (EmblFeature) i.next(); if (!noNa) { - if (feature.dbRefs != null && feature.dbRefs.size() > 0) + if (feature.dbRefs != null) { - for (Iterator dbr = feature.dbRefs.iterator(); dbr.hasNext(); dna - .addDBRef((DBRefEntry) dbr.next())) + for (DBRefEntry dbref : feature.dbRefs) { - ; + dna.addDBRef(dbref); } } } @@ -445,14 +441,14 @@ public class EmblEntry else { // General feature type. + // TODO this is just duplicated code ?? if (!noNa) { - if (feature.dbRefs != null && feature.dbRefs.size() > 0) + if (feature.dbRefs != null) { - for (Iterator dbr = feature.dbRefs.iterator(); dbr.hasNext(); dna - .addDBRef((DBRefEntry) dbr.next())) + for (DBRefEntry dbref : feature.dbRefs) { - ; + dna.addDBRef(dbref); } } } @@ -474,7 +470,7 @@ public class EmblEntry SequenceI[] sqs = new SequenceI[seqs.size()]; for (int i = 0, j = seqs.size(); i < j; i++) { - sqs[i] = (SequenceI) seqs.elementAt(i); + sqs[i] = seqs.elementAt(i); seqs.set(i, null); } return sqs; @@ -496,19 +492,16 @@ public class EmblEntry * flag for generation of Peptide sequence objects */ private void parseCodingFeature(EmblFeature feature, String sourceDb, - Vector seqs, Sequence dna, boolean noPeptide) + Vector seqs, Sequence dna, boolean noPeptide) { boolean isEmblCdna = sourceDb.equals(DBRefSource.EMBLCDS); // extract coding region(s) jalview.datamodel.Mapping map = null; int[] exon = null; - if (feature.locations != null && feature.locations.size() > 0) + if (feature.locations != null) { - for (Enumeration locs = feature.locations.elements(); locs - .hasMoreElements();) + for (EmblFeatureLocations loc : feature.locations) { - EmblFeatureLocations loc = (EmblFeatureLocations) locs - .nextElement(); int[] se = loc.getElementRanges(accession); if (exon == null) { @@ -526,19 +519,17 @@ public class EmblEntry String prseq = null; String prname = new String(); String prid = null; - Hashtable vals = new Hashtable(); + Hashtable vals = new Hashtable(); int prstart = 1; // get qualifiers - if (feature.getQualifiers() != null - && feature.getQualifiers().size() > 0) + if (feature.getQualifiers() != null) { - for (Iterator quals = feature.getQualifiers().iterator(); quals - .hasNext();) + for (Qualifier q : feature.getQualifiers()) { - Qualifier q = (Qualifier) quals.next(); - if (q.getName().equals("translation")) + String qname = q.getName(); + if (qname.equals("translation")) { - StringBuffer prsq = new StringBuffer(q.getValues()[0]); + StringBuilder prsq = new StringBuilder(q.getValues()[0]); int p = prsq.indexOf(" "); while (p > -1) { @@ -549,15 +540,15 @@ public class EmblEntry prsq = null; } - else if (q.getName().equals("protein_id")) + else if (qname.equals("protein_id")) { prid = q.getValues()[0]; } - else if (q.getName().equals("codon_start")) + else if (qname.equals("codon_start")) { prstart = Integer.parseInt(q.getValues()[0]); } - else if (q.getName().equals("product")) + else if (qname.equals("product")) { prname = q.getValues()[0]; } @@ -565,7 +556,7 @@ public class EmblEntry { // throw anything else into the additional properties hash String[] s = q.getValues(); - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); if (s != null) { for (int i = 0; i < s.length; i++) @@ -574,15 +565,15 @@ public class EmblEntry sb.append("\n"); } } - vals.put(q.getName(), sb.toString()); + vals.put(qname, sb.toString()); } } } Sequence product = null; DBRefEntry protEMBLCDS = null; exon = adjustForPrStart(prstart, exon); - boolean noProteinDbref=true; - + boolean noProteinDbref = true; + if (prseq != null && prname != null && prid != null) { // extract proteins. @@ -663,9 +654,9 @@ public class EmblEntry protEMBLCDS = new DBRefEntry(pcdnaref); protEMBLCDS.setSource(DBRefSource.EMBLCDSProduct); product.addDBRef(protEMBLCDS); - - } - + + } + } } // add cds feature to dna seq - this may include the stop codon @@ -676,31 +667,25 @@ public class EmblEntry sf.setEnd(exon[xint + 1]); sf.setType(feature.getName()); sf.setFeatureGroup(sourceDb); - sf.setDescription("Exon " + (1 + xint / 2) - + " for protein '" + prname + "' EMBLCDS:" + prid); + sf.setDescription("Exon " + (1 + xint / 2) + " for protein '" + + prname + "' EMBLCDS:" + prid); sf.setValue(FeatureProperties.EXONPOS, new Integer(1 + xint)); sf.setValue(FeatureProperties.EXONPRODUCT, prname); - if (vals != null && vals.size() > 0) + if (vals != null) { - Enumeration kv = vals.keys(); - while (kv.hasMoreElements()) + for (Entry val : vals.entrySet()) { - Object key = kv.nextElement(); - if (key != null) - { - sf.setValue(key.toString(), vals.get(key)); - } + sf.setValue(val.getKey(), val.getValue()); } } dna.addSequenceFeature(sf); } } // add dbRefs to sequence - if (feature.dbRefs != null && feature.dbRefs.size() > 0) + if (feature.dbRefs != null) { - for (Iterator dbr = feature.dbRefs.iterator(); dbr.hasNext();) + for (DBRefEntry ref : feature.dbRefs) { - DBRefEntry ref = (DBRefEntry) dbr.next(); ref.setSource(jalview.util.DBRefUtils.getCanonicalName(ref .getSource())); // Hard code the kind of protein product accessions that EMBL cite @@ -755,7 +740,7 @@ public class EmblEntry .setMap(new Mapping(product, map.getMap().getInverse())); } product.addDBRef(protEMBLCDS); - + // Add converse mapping reference if (map != null) { diff --git a/src/jalview/ext/jmol/JalviewJmolBinding.java b/src/jalview/ext/jmol/JalviewJmolBinding.java index cdd137b..c7496df 100644 --- a/src/jalview/ext/jmol/JalviewJmolBinding.java +++ b/src/jalview/ext/jmol/JalviewJmolBinding.java @@ -20,6 +20,21 @@ */ package jalview.ext.jmol; +import jalview.api.AlignmentViewPanel; +import jalview.api.FeatureRenderer; +import jalview.api.SequenceRenderer; +import jalview.datamodel.AlignmentI; +import jalview.datamodel.ColumnSelection; +import jalview.datamodel.PDBEntry; +import jalview.datamodel.SequenceI; +import jalview.io.AppletFormatAdapter; +import jalview.schemes.ColourSchemeI; +import jalview.schemes.ResidueProperties; +import jalview.structure.AtomSpec; +import jalview.structure.StructureMappingcommandSet; +import jalview.structure.StructureSelectionManager; +import jalview.structures.models.AAStructureBindingModel; + import java.awt.Color; import java.awt.Container; import java.awt.event.ComponentEvent; @@ -32,28 +47,17 @@ import java.util.List; import java.util.Map; import java.util.Vector; +import javajs.awt.Dimension; + import org.jmol.adapter.smarter.SmarterJmolAdapter; import org.jmol.api.JmolAppConsoleInterface; import org.jmol.api.JmolSelectionListener; import org.jmol.api.JmolStatusListener; import org.jmol.api.JmolViewer; -import org.jmol.constant.EnumCallback; -import org.jmol.popup.JmolPopup; - -import jalview.api.AlignmentViewPanel; -import jalview.api.FeatureRenderer; -import jalview.api.SequenceRenderer; -import jalview.datamodel.AlignmentI; -import jalview.datamodel.ColumnSelection; -import jalview.datamodel.PDBEntry; -import jalview.datamodel.SequenceI; -import jalview.io.AppletFormatAdapter; -import jalview.schemes.ColourSchemeI; -import jalview.schemes.ResidueProperties; -import jalview.structure.AtomSpec; -import jalview.structure.StructureMappingcommandSet; -import jalview.structure.StructureSelectionManager; -import jalview.structures.models.AAStructureBindingModel; +import org.jmol.c.CBK; +import org.jmol.script.T; +import org.jmol.viewer.JC; +import org.jmol.viewer.Viewer; public abstract class JalviewJmolBinding extends AAStructureBindingModel implements JmolStatusListener, JmolSelectionListener, @@ -72,13 +76,11 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel */ private boolean associateNewStructs = false; - Vector atomsPicked = new Vector(); - - public Vector chainNames; + Vector atomsPicked = new Vector(); - Hashtable chainFile; + public Vector chainNames; - StringBuffer eval = new StringBuffer(); + Hashtable chainFile; public String fileLoadingError; @@ -88,7 +90,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel */ int frameNo = 0; - protected JmolPopup jmolpopup; + // protected JmolGenericPopup jmolpopup; // not used - remove? String lastCommand; @@ -103,7 +105,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel StringBuffer resetLastRes = new StringBuffer(); - public JmolViewer viewer; + public Viewer viewer; public JalviewJmolBinding(StructureSelectionManager ssm, PDBEntry[] pdbentry, SequenceI[][] sequenceIs, String[][] chains, @@ -120,7 +122,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel } public JalviewJmolBinding(StructureSelectionManager ssm, - SequenceI[][] seqs, JmolViewer theViewer) + SequenceI[][] seqs, Viewer theViewer) { super(ssm, seqs); @@ -137,7 +139,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel */ public String getViewerTitle() { - return getViewerTitle("JMol", true); + return getViewerTitle("Jmol", true); } /** @@ -147,15 +149,13 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel * @param chainList * list of chains to make visible */ - public void centerViewer(Vector chainList) + public void centerViewer(Vector chainList) { - StringBuffer cmd = new StringBuffer(); - String lbl; + StringBuilder cmd = new StringBuilder(128); int mlength, p; - for (int i = 0, iSize = chainList.size(); i < iSize; i++) + for (String lbl : chainList) { mlength = 0; - lbl = (String) chainList.elementAt(i); do { p = mlength; @@ -163,7 +163,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel } while (p < mlength && mlength < (lbl.length() - 2)); // TODO: lookup each pdb id and recover proper model number for it. cmd.append(":" + lbl.substring(mlength + 1) + " /" - + (1 + getModelNum((String) chainFile.get(lbl))) + " or "); + + (1 + getModelNum(chainFile.get(lbl))) + " or "); } if (cmd.length() > 0) { @@ -174,7 +174,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel public void closeViewer() { - viewer.setModeMouse(org.jmol.viewer.JmolConstants.MOUSE_NONE); + viewer.acm.setModeMouse(JC.MOUSE_NONE); // remove listeners for all structures in viewer getSsm().removeStructureViewerListener(this, this.getPdbFile()); // and shut down jmol @@ -489,9 +489,10 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel * using the getFeatureRenderer() and getSequenceRenderer() renderers but only * if colourBySequence is enabled. */ - public void colourBySequence(boolean showFeatures, - jalview.api.AlignmentViewPanel alignmentv) + public void colourBySequence(AlignmentViewPanel alignmentv) { + boolean showFeatures = alignmentv.getAlignViewport() + .isShowSequenceFeatures(); if (!colourBySequence || !isLoadingFinished()) { return; @@ -586,7 +587,10 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel return null; } // TODO: verify atomIndex is selecting correct model. - return new Color(viewer.getAtomArgb(atomIndex)); + // return new Color(viewer.getAtomArgb(atomIndex)); Jmol 12.2.4 + int colour = viewer.ms.at[atomIndex] + .atomPropertyInt(T.color); + return new Color(colour); } /** @@ -642,26 +646,33 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel } if (modelFileNames == null) { - - String mset[] = new String[viewer.getModelCount()]; + String mset[] = new String[viewer.ms.mc]; _modelFileNameMap = new int[mset.length]; - int j = 1; - String m = viewer.getModelFileName(0); + String m = viewer.ms.getModelFileName(0); if (m != null) { + mset[0] = m; try { mset[0] = new File(m).getAbsolutePath(); } catch (AccessControlException x) { - // usually not allowed to do this in applet, so keep raw handle + // usually not allowed to do this in applet + System.err + .println("jmolBinding: Using local file string from Jmol: " + + m); + } + if (mset[0].indexOf("/file:") != -1) + { + // applet path with docroot - discard as format won't match pdbfile mset[0] = m; - // System.err.println("jmolBinding: Using local file string from Jmol: "+m); } } + int j = 1; for (int i = 1; i < mset.length; i++) { - m = viewer.getModelFileName(i); + m = viewer.ms.getModelFileName(i); + mset[j] = m; if (m != null) { try @@ -670,7 +681,6 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel } catch (AccessControlException x) { // usually not allowed to do this in applet, so keep raw handle - mset[j] = m; // System.err.println("jmolBinding: Using local file string from Jmol: "+m); } } @@ -714,7 +724,8 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel public void handlePopupMenu(int x, int y) { - jmolpopup.show(x, y); + // jmolpopup.show(x, y); + // jmolpopup.jpiShow(x, y); } /** @@ -744,12 +755,10 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel // look up file model number for this pdbfile int mdlNum = 0; - String fn; // may need to adjust for URLencoding here - we don't worry about that yet. while (mdlNum < modelFileNames.length && !pdbfile.equals(modelFileNames[mdlNum])) { - // System.out.println("nomatch:"+pdbfile+"\nmodelfn:"+fn); mdlNum++; } if (mdlNum == modelFileNames.length) @@ -765,31 +774,31 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel viewer.evalStringQuiet(resetLastRes.toString()); } - eval.setLength(0); - eval.append("select " + pdbResNum); // +modelNum + StringBuilder cmd = new StringBuilder(64); + cmd.append("select " + pdbResNum); // +modelNum resetLastRes.setLength(0); resetLastRes.append("select " + pdbResNum); // +modelNum - eval.append(":"); + cmd.append(":"); resetLastRes.append(":"); if (!chain.equals(" ")) { - eval.append(chain); + cmd.append(chain); resetLastRes.append(chain); } { - eval.append(" /" + (mdlNum + 1)); + cmd.append(" /" + (mdlNum + 1)); resetLastRes.append("/" + (mdlNum + 1)); } - eval.append(";wireframe 100;" + eval.toString() + " and not hetero;"); + cmd.append(";wireframe 100;" + cmd.toString() + " and not hetero;"); resetLastRes.append(";wireframe 0;" + resetLastRes.toString() + " and not hetero; spacefill 0;"); - eval.append("spacefill 200;select none"); + cmd.append("spacefill 200;select none"); - viewer.evalStringQuiet(eval.toString()); + viewer.evalStringQuiet(cmd.toString()); jmolHistory(true); } @@ -877,7 +886,8 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel pdbfilename = modelFileNames[_mp]; if (pdbfilename == null) { - pdbfilename = new File(viewer.getModelFileName(mnumber)) + pdbfilename = new File( + viewer.ms.getModelFileName(mnumber)) .getAbsolutePath(); } @@ -965,7 +975,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel } @Override - public void notifyCallback(EnumCallback type, Object[] data) + public void notifyCallback(CBK type, Object[] data) { try { @@ -1019,7 +1029,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel } @Override - public boolean notifyEnabled(EnumCallback callbackPick) + public boolean notifyEnabled(CBK callbackPick) { switch (callbackPick) { @@ -1032,13 +1042,9 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel case HOVER: case ERROR: return true; - case RESIZE: - case SYNC: - case CLICK: - case ANIMFRAME: - case MINIMIZATION: + default: + return false; } - return false; } // incremented every time a load notification is successfully handled - @@ -1069,8 +1075,8 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel fileLoadingError = null; String[] oldmodels = modelFileNames; modelFileNames = null; - chainNames = new Vector(); - chainFile = new Hashtable(); + chainNames = new Vector(); + chainFile = new Hashtable(); boolean notifyLoaded = false; String[] modelfilenames = getPdbFile(); // first check if we've lost any structures @@ -1114,7 +1120,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel String fileName = modelfilenames[modelnum]; boolean foundEntry = false; MCview.PDBfile pdb = null; - String pdbfile = null, pdbfhash = null; + String pdbfile = null; // model was probably loaded inline - so check the pdb file hashcode if (loadedInline) { @@ -1123,7 +1129,6 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel // 'best guess' pdbfile = viewer.getData("" + (1 + _modelFileNameMap[modelnum]) + ".0", "PDB"); - pdbfhash = "" + pdbfile.hashCode(); } // search pdbentries and sequences to find correct pdbentry for this // model @@ -1144,9 +1149,9 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel } else { - File fl; - if (matches = (fl = new File(getPdbEntry(pe).getFile())) - .equals(new File(fileName))) + File fl = new File(getPdbEntry(pe).getFile()); + matches = fl.equals(new File(fileName)); + if (matches) { foundEntry = true; // TODO: Jmol can in principle retrieve from CLASSLOADER but @@ -1204,11 +1209,11 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel } // FILE LOADED OK // so finally, update the jmol bits and pieces - if (jmolpopup != null) - { - // potential for deadlock here: - // jmolpopup.updateComputedMenus(); - } + // if (jmolpopup != null) + // { + // // potential for deadlock here: + // // jmolpopup.updateComputedMenus(); + // } if (!isLoadingFromArchive()) { viewer.evalStringQuiet("model 0; select backbone;restrict;cartoon;wireframe off;spacefill off"); @@ -1360,12 +1365,14 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel { commandOptions = ""; } - viewer = JmolViewer.allocateViewer(renderPanel, + viewer = (Viewer) JmolViewer.allocateViewer(renderPanel, (jmolfileio ? new SmarterJmolAdapter() : null), htmlName + ((Object) this).toString(), documentBase, codeBase, commandOptions, this); - console = createJmolConsole(viewer, consolePanel, buttonsToShow); + viewer.setJmolStatusListener(this); // extends JmolCallbackListener + + console = createJmolConsole(consolePanel, buttonsToShow); if (consolePanel != null) { consolePanel.addComponentListener(this); @@ -1375,7 +1382,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel } protected abstract JmolAppConsoleInterface createJmolConsole( - JmolViewer viewer2, Container consolePanel, String buttonsToShow); + Container consolePanel, String buttonsToShow); protected org.jmol.api.JmolAppConsoleInterface console = null; @@ -1388,10 +1395,10 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel } @Override - public void resizeInnerPanel(String data) + public Dimension resizeInnerPanel(String data) { // Jalview doesn't honour resize panel requests - + return null; } public boolean isFinishedInit() @@ -1458,3 +1465,4 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel showConsole(false); } } + diff --git a/src/jalview/ext/jmol/PDBFileWithJmol.java b/src/jalview/ext/jmol/PDBFileWithJmol.java index 3df8957..3b6f0c2 100644 --- a/src/jalview/ext/jmol/PDBFileWithJmol.java +++ b/src/jalview/ext/jmol/PDBFileWithJmol.java @@ -34,13 +34,15 @@ import java.io.IOException; import java.util.Hashtable; import java.util.Map; +import javajs.awt.Dimension; + import org.jmol.api.JmolStatusListener; import org.jmol.api.JmolViewer; -import org.jmol.constant.EnumCallback; +import org.jmol.c.CBK; import org.jmol.modelset.Group; import org.jmol.modelset.Model; import org.jmol.modelset.ModelSet; -import org.jmol.modelset.Polymer; +import org.jmol.modelsetbio.BioModel; import org.jmol.modelsetbio.BioPolymer; import org.jmol.viewer.Viewer; import org.openscience.jmol.app.JmolApp; @@ -82,19 +84,18 @@ public class PDBFileWithJmol extends AlignFile implements private Viewer getJmolData() { if (viewer == null) - { // note that -o -n -x are all implied + { // note that -o -n -x are all implied // TODO check for Jmol 14.2 jmolApp = new JmolApp(); jmolApp.isDataOnly = true; jmolApp.haveConsole = false; jmolApp.haveDisplay = false; - jmolApp.exitUponCompletion = true; try { viewer = (Viewer) JmolViewer.allocateViewer(null, null, null, null, - null, jmolApp.commandOptions, this); + null, "-x -o -n", this); viewer.setScreenDimension(jmolApp.startupWidth, jmolApp.startupHeight); - jmolApp.startViewer(viewer, null); + jmolApp.startViewer(viewer, null, false); } catch (ClassCastException x) { throw new Error(MessageManager.formatMessage("error.jmol_version_not_compatible_with_jalview_version", new String[]{JmolViewer.getJmolVersion()}), @@ -129,136 +130,147 @@ public class PDBFileWithJmol extends AlignFile implements Viewer jmd = getJmolData(); jmd.openReader(getDataName(), getDataName(), getReader()); waitForScript(jmd); - if (jmd.getModelCount() > 0) + + if (jmd.ms.mc > 0) { - ModelSet ms = jmd.getModelSet(); - String structs = ms.calculateStructures(null, true, false, true); + ModelSet ms = jmd.ms; + // Jmol 14.2 added third argument doReport = false + ms.calculateStructures(null, true, false, false, true); // System.out.println("Structs\n"+structs); - for (Model model : ms.getModels()) + Group group = null; + int modelIndex = -1; + for (Model model : ms.am) { - for (int _bp = 0, _bpc = model.getBioPolymerCount(); _bp < _bpc; _bp++) + modelIndex++; + for (BioPolymer bp : ((BioModel) model).bioPolymers) { - Polymer bp = model.getBioPolymer(_bp); - if (bp instanceof BioPolymer) + int lastChainId = 0; // int value of character e.g. 65 for A + String lastChainIdAlpha = ""; + + int[] groups = bp.getLeadAtomIndices(); + char seq[] = new char[groups.length], secstr[] = new char[groups.length], secstrcode[] = new char[groups.length]; + int groupc = 0, len = 0, firstrnum = 1, lastrnum = 0; + + do { - BioPolymer biopoly = (BioPolymer) bp; - char _lastChainId = 0; - int[] groups = biopoly.getLeadAtomIndices(); - Group[] bpgrp = biopoly.getGroups(); - char seq[] = new char[groups.length], secstr[] = new char[groups.length], secstrcode[] = new char[groups.length]; - int groupc = 0, len = 0, firstrnum = 1, lastrnum = 0; - do + if (groupc >= groups.length + || ms.at[groups[groupc]].group.chain.chainID != lastChainId) { - if (groupc >= groups.length - || ms.atoms[groups[groupc]].getChainID() != _lastChainId) + /* + * on change of chain (or at end), construct the sequence and + * secondary structure annotation for the last chain + */ + if (len > 0) { - if (len > 0) + boolean isNa = bp.isNucleic(); + // normalise sequence from Jmol to jalview + int[] cinds = isNa ? ResidueProperties.nucleotideIndex + : ResidueProperties.aaIndex; + int nonGap = isNa ? ResidueProperties.maxNucleotideIndex + : ResidueProperties.maxProteinIndex; + char ngc = 'X'; + char newseq[] = new char[len]; + Annotation asecstr[] = new Annotation[len + firstrnum - 1]; + for (int p = 0; p < len; p++) { - boolean isNa = (biopoly.isDna() || biopoly.isRna()); - // normalise sequence from Jmol to jalview - int[] cinds = isNa ? ResidueProperties.nucleotideIndex : ResidueProperties.aaIndex; - int nonGap = isNa ? ResidueProperties.maxNucleotideIndex - : ResidueProperties.maxProteinIndex; - char ngc = 'X'; - char newseq[] = new char[len]; - Annotation asecstr[] = new Annotation[len+firstrnum-1]; - for (int p = 0; p < len; p++) + newseq[p] = cinds[seq[p]] == nonGap ? ngc : seq[p]; + if (secstr[p] >= 'A' && secstr[p] <= 'z') { - newseq[p] = cinds[seq[p]] == nonGap ? ngc : seq[p]; - if (secstr[p] >= 'A' && secstr[p] <= 'z') - { - asecstr[p] = new Annotation("" + secstr[p], null, - secstrcode[p], Float.NaN); - } + asecstr[p] = new Annotation("" + secstr[p], null, + secstrcode[p], Float.NaN); } - SequenceI sq = new Sequence("" + getDataName() + "|" - + model.getModelTitle() + "|" + _lastChainId, - newseq, firstrnum, lastrnum); - PDBEntry pdbe = new PDBEntry(); - pdbe.setFile(getDataName()); - pdbe.setId(getDataName()); - pdbe.setProperty(new Hashtable()); - // pdbe.getProperty().put("CHAIN", "" + _lastChainId); - pdbe.setChainCode(String.valueOf(_lastChainId)); - sq.addPDBId(pdbe); - // JAL-1533 - // Need to put the number of models for this polymer somewhere for Chimera/others to grab - // pdbe.getProperty().put("PDBMODELS", biopoly.) - seqs.add(sq); - if (!isNa) + } + String modelTitle = (String) ms + .getInfo(modelIndex, "title"); + SequenceI sq = new Sequence("" + getDataName() + "|" + + modelTitle + "|" + lastChainIdAlpha, newseq, + firstrnum, lastrnum); + PDBEntry pdbe = new PDBEntry(); + pdbe.setFile(getDataName()); + pdbe.setId(getDataName()); + pdbe.setProperty(new Hashtable()); + // pdbe.getProperty().put("CHAIN", "" + _lastChainId); + pdbe.setChainCode(lastChainIdAlpha); + sq.addPDBId(pdbe); + // JAL-1533 + // Need to put the number of models for this polymer somewhere + // for Chimera/others to grab + // pdbe.getProperty().put("PDBMODELS", biopoly.) + seqs.add(sq); + if (!isNa) + { + String mt = modelTitle == null ? getDataName() + : modelTitle; + if (lastChainId >= ' ') { - String mt = model.getModelTitle() == null ? getDataName() - : model.getModelTitle(); - if (_lastChainId >= ' ') - { - mt += _lastChainId; - } - AlignmentAnnotation ann = new AlignmentAnnotation( - "Secondary Structure", - "Secondary Structure for " + mt, asecstr); - ann.belowAlignment=true; - ann.visible=true; - ann.autoCalculated=false; - ann.setCalcId(getClass().getName()); - sq.addAlignmentAnnotation(ann); - ann.adjustForAlignment(); - ann.validateRangeAndDisplay(); - annotations.add(ann); + mt += lastChainIdAlpha; } + AlignmentAnnotation ann = new AlignmentAnnotation( + "Secondary Structure", "Secondary Structure for " + + mt, asecstr); + ann.belowAlignment = true; + ann.visible = true; + ann.autoCalculated = false; + ann.setCalcId(getClass().getName()); + sq.addAlignmentAnnotation(ann); + ann.adjustForAlignment(); + ann.validateRangeAndDisplay(); + annotations.add(ann); } - len = 0; - firstrnum = 1; - lastrnum = 0; } - if (groupc < groups.length) + len = 0; + firstrnum = 1; + lastrnum = 0; + } + if (groupc < groups.length) + { + group = ms.at[groups[groupc]].group; + if (len == 0) + { + firstrnum = group.getResno(); + lastChainId = group.chain.chainID; + lastChainIdAlpha = group.chain.getIDStr(); + } + else { - if (len == 0) + lastrnum = group.getResno(); + } + seq[len] = group.getGroup1(); + switch (group.getProteinStructureSubType()) + { + case HELIX310: + if (secstr[len] == 0) { - firstrnum = bpgrp[groupc].getResno(); - _lastChainId = bpgrp[groupc].getChainID(); + secstr[len] = '3'; } - else + case HELIXALPHA: + if (secstr[len] == 0) { - lastrnum = bpgrp[groupc].getResno(); + secstr[len] = 'H'; } - seq[len] = bpgrp[groupc].getGroup1(); - switch (bpgrp[groupc].getProteinStructureSubType()) + case HELIXPI: + if (secstr[len] == 0) { - case HELIX_310: - if (secstr[len] == 0) - { - secstr[len] = '3'; - } - case HELIX_ALPHA: - if (secstr[len] == 0) - { - secstr[len] = 'H'; - } - case HELIX_PI: - if (secstr[len] == 0) - { - secstr[len] = 'P'; - } - case HELIX: - if (secstr[len] == 0) - { - secstr[len] = 'H'; - } - secstrcode[len] = 'H'; - break; - case SHEET: - secstr[len] = 'E'; - secstrcode[len] = 'E'; - break; - default: - secstr[len] = 0; - secstrcode[len] = 0; + secstr[len] = 'P'; + } + case HELIX: + if (secstr[len] == 0) + { + secstr[len] = 'H'; } - len++; + secstrcode[len] = 'H'; + break; + case SHEET: + secstr[len] = 'E'; + secstrcode[len] = 'E'; + break; + default: + secstr[len] = 0; + secstrcode[len] = 0; } - } while (groupc++ < groups.length); - - } + len++; + } + } while (groupc++ < groups.length); } } @@ -305,7 +317,7 @@ public class PDBFileWithJmol extends AlignFile implements * System.err.println("Squashed Jmol callback handler error:"); * e.printStackTrace(); } } */ - public void notifyCallback(EnumCallback type, Object[] data) + public void notifyCallback(CBK type, Object[] data) { String strInfo = (data == null || data[1] == null ? null : data[1] .toString()); @@ -343,13 +355,6 @@ public class PDBFileWithJmol extends AlignFile implements } } - private void notifyFileLoaded(String string, String string2, - String string3, String string4, int intValue) - { - // TODO Auto-generated method stub - - } - String lastConsoleEcho = ""; private void sendConsoleEcho(String string) @@ -378,7 +383,7 @@ public class PDBFileWithJmol extends AlignFile implements } @Override - public boolean notifyEnabled(EnumCallback callbackPick) + public boolean notifyEnabled(CBK callbackPick) { switch (callbackPick) { @@ -388,16 +393,9 @@ public class PDBFileWithJmol extends AlignFile implements case LOADSTRUCT: case ERROR: return true; - case MEASURE: - case PICK: - case HOVER: - case RESIZE: - case SYNC: - case CLICK: - case ANIMFRAME: - case MINIMIZATION: + default: + return false; } - return false; } @Override @@ -444,10 +442,15 @@ public class PDBFileWithJmol extends AlignFile implements } @Override - public void resizeInnerPanel(String data) + public Dimension resizeInnerPanel(String data) { - // TODO Auto-generated method stub + return null; + } + @Override + public Map getJSpecViewProperty(String arg0) + { + return null; } } diff --git a/src/jalview/ext/varna/RnaModel.java b/src/jalview/ext/varna/RnaModel.java new file mode 100644 index 0000000..b39ea94 --- /dev/null +++ b/src/jalview/ext/varna/RnaModel.java @@ -0,0 +1,32 @@ +package jalview.ext.varna; + +import jalview.datamodel.AlignmentAnnotation; +import jalview.datamodel.SequenceI; + +import fr.orsay.lri.varna.models.rna.RNA; + +/** + * Data bean wrapping the data items that define one RNA view + */ +public class RnaModel +{ + public final String title; + + public final AlignmentAnnotation ann; + + public final SequenceI seq; + + public final boolean gapped; + + public final RNA rna; + + public RnaModel(String t, AlignmentAnnotation aa, SequenceI s, RNA r, + boolean g) + { + title = t; + ann = aa; + seq = s; + rna = r; + gapped = g; + } +} \ No newline at end of file diff --git a/src/jalview/gui/AlignExportSettings.java b/src/jalview/gui/AlignExportSettings.java index fe7c940..49bb64a 100644 --- a/src/jalview/gui/AlignExportSettings.java +++ b/src/jalview/gui/AlignExportSettings.java @@ -1,14 +1,15 @@ package jalview.gui; +import jalview.api.AlignExportSettingI; +import jalview.bin.Jalview; +import jalview.jbgui.GAlignExportSettings; + import java.awt.event.ActionEvent; import javax.swing.JDialog; import javax.swing.JInternalFrame; import javax.swing.JOptionPane; -import jalview.api.AlignExportSettingI; -import jalview.jbgui.GAlignExportSettings; - @SuppressWarnings("serial") public class AlignExportSettings extends GAlignExportSettings implements AlignExportSettingI @@ -17,52 +18,25 @@ public class AlignExportSettings extends GAlignExportSettings implements boolean cancelled = false; - private int width = 450; - - private int height = 200; - JDialog dialog; public AlignExportSettings(boolean hasHiddenSeq, boolean hasHiddenCols, String alignFileFormat) { super(hasHiddenSeq, hasHiddenCols, alignFileFormat); - - // frame = new JInternalFrame(); - // frame.setContentPane(this); - // frame.setLayer(JLayeredPane.PALETTE_LAYER); - // Desktop.addInternalFrame(frame, "Export Settings", width, height); - - JOptionPane pane = new JOptionPane(null, JOptionPane.DEFAULT_OPTION, - JOptionPane.DEFAULT_OPTION, null, new Object[] - { this }); - dialog = pane.createDialog(Desktop.desktop, "Export Settings"); - - // dialog = new JDialog(Desktop.instance, true); - // dialog.setTitle("Export Settings"); - - dialog.pack(); - dialog.setVisible(true); - - dialog.setContentPane(this); - dialog.validate(); - + if (!Jalview.isHeadlessMode() && isShowDialog()) + { + JOptionPane pane = new JOptionPane(null, JOptionPane.DEFAULT_OPTION, + JOptionPane.DEFAULT_OPTION, null, new Object[] + { this }); + dialog = pane.createDialog(Desktop.desktop, "Export Settings"); + dialog.pack(); + dialog.setVisible(true); + dialog.setContentPane(this); + dialog.validate(); + } } - // public static void main(String[] args) - // { - // new AlignExportSettings(false, false, false); - // } - - // public void cancel_actionPerformed(ActionEvent e) - // { - // try - // { - // frame.setClosed(true); - // } catch (Exception ex) - // { - // } - // } public void ok_actionPerformed(ActionEvent e) { @@ -106,7 +80,6 @@ public class AlignExportSettings extends GAlignExportSettings implements return chkExportGrps.isSelected(); } - @Override public boolean isCancelled() { return cancelled; diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 01353d8..68d7397 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -28,7 +28,6 @@ import jalview.analysis.CrossRef; import jalview.analysis.Dna; import jalview.analysis.ParseProperties; import jalview.analysis.SequenceIdMatcher; -import jalview.api.AlignExportSettingI; import jalview.api.AlignViewControllerGuiI; import jalview.api.AlignViewControllerI; import jalview.api.AlignViewportI; @@ -38,6 +37,7 @@ import jalview.api.SplitContainerI; import jalview.api.ViewStyleI; import jalview.api.analysis.ScoreModelI; import jalview.bin.Cache; +import jalview.bin.Jalview; import jalview.commands.CommandI; import jalview.commands.EditCommand; import jalview.commands.EditCommand.Action; @@ -49,6 +49,7 @@ import jalview.commands.TrimRegionCommand; import jalview.datamodel.AlignedCodonFrame; import jalview.datamodel.Alignment; import jalview.datamodel.AlignmentAnnotation; +import jalview.datamodel.AlignmentExportData; import jalview.datamodel.AlignmentI; import jalview.datamodel.AlignmentOrder; import jalview.datamodel.AlignmentView; @@ -335,7 +336,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, */ void init() { - progressBar = new ProgressBar(this.statusPanel, this.statusBar); + if (!Jalview.isHeadlessMode()) + { + progressBar = new ProgressBar(this.statusPanel, this.statusBar); + } avc = new jalview.controller.AlignViewController(this, viewport, alignPanel); @@ -1135,13 +1139,20 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { warningMessage("Cannot save file " + fileName + " using format " + format, "Alignment output format not supported"); - saveAs_actionPerformed(null); - // JBPNote need to have a raise_gui flag here + if (!Jalview.isHeadlessMode()) + { + saveAs_actionPerformed(null); + } return false; } - ExportData exportData = getAlignmentForExport(format); - FormatAdapter f = new FormatAdapter(alignPanel); + AlignmentExportData exportData = getAlignmentForExport(format, viewport); + if (exportData.getSettings().isCancelled()) + { + return false; + } + FormatAdapter f = new FormatAdapter(alignPanel, + exportData.getSettings()); String output = f.formatSequences(format, exportData.getAlignment(), // class cast exceptions will // occur in the distant future @@ -1213,7 +1224,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, protected void outputText_actionPerformed(ActionEvent e) { - ExportData exportData = getAlignmentForExport(e.getActionCommand()); + AlignmentExportData exportData = getAlignmentForExport( + e.getActionCommand(), viewport); if (exportData.getSettings().isCancelled()) { return; @@ -1239,7 +1251,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } - public ExportData getAlignmentForExport(String exportFomat) + public static AlignmentExportData getAlignmentForExport(String exportFomat, + AlignViewportI viewport) { AlignmentI alignmentToExport = null; String[] omitHidden = null; @@ -1254,7 +1267,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { 0, alignmentToExport.getWidth() - 1 }; boolean hasHiddenSeqs = hiddenSeqs.getSize() > 0; - AlignExportSettingI settings = new AlignExportSettings(hasHiddenSeqs, + AlignExportSettings settings = new AlignExportSettings(hasHiddenSeqs, viewport.hasHiddenColumns(), exportFomat); settings.isExportAnnotations(); @@ -1273,8 +1286,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, alignmentStartEnd = getStartEnd(alignmentStartEnd, viewport .getColumnSelection().getHiddenColumns()); } - return new ExportData(alignmentToExport, omitHidden, alignmentStartEnd, + AlignmentExportData ed = new AlignmentExportData(alignmentToExport, omitHidden, alignmentStartEnd, settings); + return ed; } private static int[] getStartEnd(int[] aligmentStartEnd, @@ -1814,9 +1828,14 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, viewport.getSelectionGroup().getEndRes() + groupAdjustment); } + /* + * just extend the last slide command if compatible; but not if in + * SplitFrame mode (to ensure all edits are broadcast - JAL-1802) + */ boolean appendHistoryItem = false; Deque historyList = viewport.getHistoryList(); - if (historyList != null + boolean inSplitFrame = getSplitViewContainer() != null; + if (!inSplitFrame && historyList != null && historyList.size() > 0 && historyList.peek() instanceof SlideSequencesCommand) { @@ -4842,7 +4861,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, // temporary flag until SplitFrame is released boolean asSplitFrame = Cache.getDefault( - Preferences.ENABLE_SPLIT_FRAME, false); + Preferences.ENABLE_SPLIT_FRAME, true); if (asSplitFrame) { /* @@ -4974,7 +4993,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, "label.translation_of_params", new Object[] { this.getTitle() }); af.setTitle(newTitle); - if (Cache.getDefault(Preferences.ENABLE_SPLIT_FRAME, false)) + if (Cache.getDefault(Preferences.ENABLE_SPLIT_FRAME, true)) { final SequenceI[] seqs = viewport.getSelectionAsNewSequence(); viewport.openSplitFrame(af, new Alignment(seqs), @@ -5983,7 +6002,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, aa.visible = visible; } } - alignPanel.validateAnnotationDimensions(false); + alignPanel.validateAnnotationDimensions(true); alignPanel.alignmentChanged(); } @@ -6071,66 +6090,6 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } } - public class ExportData - { - private AlignmentI alignment; - - private String[] omitHidden; - - private int[] startEnd; - - private AlignExportSettingI settings; - - public ExportData(AlignmentI align, String[] ommit, int[] startEnd, - AlignExportSettingI settings) - { - this.alignment = align; - this.omitHidden = ommit; - this.startEnd = startEnd; - this.settings = settings; - } - - public AlignmentI getAlignment() - { - return alignment; - } - - public void setAlignment(AlignmentI alignment) - { - this.alignment = alignment; - } - - public String[] getOmitHidden() - { - return omitHidden; - } - - public void setOmitHidden(String[] omitHidden) - { - this.omitHidden = omitHidden; - } - - public int[] getStartEndPostions() - { - return startEnd; - } - - public void setStartEndPostions(int[] startEnd) - { - this.startEnd = startEnd; - } - - public AlignExportSettingI getSettings() - { - return settings; - } - - public void setSettings(AlignExportSettingI settings) - { - this.settings = settings; - } - } - } class PrintThread extends Thread diff --git a/src/jalview/gui/AlignViewport.java b/src/jalview/gui/AlignViewport.java index fc889ad..c18c989 100644 --- a/src/jalview/gui/AlignViewport.java +++ b/src/jalview/gui/AlignViewport.java @@ -799,7 +799,7 @@ public class AlignViewport extends AlignmentViewport implements * If any cDNA/protein mappings can be made between the alignments, offer to * open a linked alignment with split frame option. */ - if (Cache.getDefault(Preferences.ENABLE_SPLIT_FRAME, false)) + if (Cache.getDefault(Preferences.ENABLE_SPLIT_FRAME, true)) { if (AlignmentUtils.isMappable(al, getAlignment())) { @@ -909,6 +909,7 @@ public class AlignViewport extends AlignmentViewport implements if (openSplitPane) { + al.alignAs(thisAlignment); protein = openSplitFrame(newAlignFrame, thisAlignment, protein.getCodonFrames()); } @@ -1027,13 +1028,13 @@ public class AlignViewport extends AlignmentViewport implements * is found, the result will be empty. */ SearchResults sr = new SearchResults(); - int seqOffset = findComplementScrollTarget(sr); + int verticalOffset = findComplementScrollTarget(sr); if (!sr.isEmpty()) { // TODO would like next line without cast but needs more refactoring... final AlignmentPanel complementPanel = ((AlignViewport) getCodingComplement()).getAlignPanel(); complementPanel.setFollowingComplementScroll(true); - complementPanel.scrollToCentre(sr, seqOffset); + complementPanel.scrollToCentre(sr, verticalOffset); } } diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index 5bc46f4..ad7e75c 100644 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -20,6 +20,22 @@ */ package jalview.gui; +import jalview.analysis.AnnotationSorter; +import jalview.api.AlignViewportI; +import jalview.api.AlignmentViewPanel; +import jalview.bin.Cache; +import jalview.datamodel.AlignmentI; +import jalview.datamodel.SearchResults; +import jalview.datamodel.SequenceFeature; +import jalview.datamodel.SequenceGroup; +import jalview.datamodel.SequenceI; +import jalview.jbgui.GAlignmentPanel; +import jalview.math.AlignmentDimension; +import jalview.schemes.ResidueProperties; +import jalview.structure.StructureSelectionManager; +import jalview.util.MessageManager; +import jalview.util.Platform; + import java.awt.BorderLayout; import java.awt.Color; import java.awt.Container; @@ -27,6 +43,7 @@ import java.awt.Dimension; import java.awt.Font; import java.awt.FontMetrics; import java.awt.Graphics; +import java.awt.Insets; import java.awt.event.AdjustmentEvent; import java.awt.event.AdjustmentListener; import java.awt.print.PageFormat; @@ -41,21 +58,6 @@ import java.util.List; import javax.swing.SwingUtilities; -import jalview.analysis.AnnotationSorter; -import jalview.api.AlignViewportI; -import jalview.api.AlignmentViewPanel; -import jalview.bin.Cache; -import jalview.datamodel.AlignmentI; -import jalview.datamodel.SearchResults; -import jalview.datamodel.SequenceFeature; -import jalview.datamodel.SequenceGroup; -import jalview.datamodel.SequenceI; -import jalview.jbgui.GAlignmentPanel; -import jalview.math.AlignmentDimension; -import jalview.schemes.ResidueProperties; -import jalview.structure.StructureSelectionManager; -import jalview.util.MessageManager; - /** * DOCUMENT ME! * @@ -304,7 +306,7 @@ public class AlignmentPanel extends GAlignmentPanel implements */ public boolean scrollToPosition(SearchResults results) { - return scrollToPosition(results, true, false); + return scrollToPosition(results, 0, true, false); } /** @@ -317,7 +319,7 @@ public class AlignmentPanel extends GAlignmentPanel implements */ public boolean scrollToPosition(SearchResults searchResults, boolean redrawOverview) { - return scrollToPosition(searchResults, redrawOverview, false); + return scrollToPosition(searchResults, 0, redrawOverview, false); } /** @@ -325,6 +327,9 @@ public class AlignmentPanel extends GAlignmentPanel implements * (if any) * * @param results + * @param verticalOffset + * if greater than zero, allows scrolling to a position below the + * first displayed sequence * @param redrawOverview * - when set, the overview will be recalculated (takes longer) * @param centre @@ -332,6 +337,7 @@ public class AlignmentPanel extends GAlignmentPanel implements * @return false if results were not found */ public boolean scrollToPosition(SearchResults results, + int verticalOffset, boolean redrawOverview, boolean centre) { int startv, endv, starts, ends; @@ -390,6 +396,12 @@ public class AlignmentPanel extends GAlignmentPanel implements } } } + + /* + * allow for offset of target sequence (actually scroll to one above it) + */ + seqIndex = Math.max(0, seqIndex - verticalOffset); + if (!av.getWrapAlignment()) { if ((startv = av.getStartRes()) >= start) @@ -511,47 +523,47 @@ public class AlignmentPanel extends GAlignmentPanel implements */ protected void validateAnnotationDimensions(boolean adjustPanelHeight) { - int height = getAnnotationPanel().adjustPanelHeight(); - - int theight = av.getCharHeight() - * (av.getAlignment().getHeight() + (!av.hasHiddenRows() ? 0 - : av.getAlignment().getHiddenSequences().getSize())); - float sscaling = (float) (theight / (1.0 * theight + height)); - float ascaling = (float) (height * 1.0 / alignFrame.getHeight()); - int rheight = alignFrame.getHeight() - height - av.getCharHeight(); + int annotationHeight = getAnnotationPanel().adjustPanelHeight(); + if (adjustPanelHeight) { - // NOTE: this logic is different in the applet. Need a better algorithm to - // define behaviour - // try and set height according to alignment - if (ascaling > 0 && sscaling < 0.5) - { - // if the alignment is too big then - // default is 0.5 split - height = alignFrame.getHeight() / 2; - } - else + int rowHeight = av.getCharHeight(); + int alignmentHeight = rowHeight * av.getAlignment().getHeight(); + + /* + * Estimate available height in the AlignFrame for alignment + + * annotations. Deduct an estimate for title bar, menu bar, scale panel, + * hscroll, status bar (as these are not laid out we can't inspect their + * actual heights). Insets gives frame borders. + */ + int stuff = Platform.isAMac() ? 80 : 100; + Insets insets = alignFrame.getInsets(); + int availableHeight = alignFrame.getHeight() - stuff - insets.top + - insets.bottom; + + /* + * If not enough vertical space, maximize annotation height while keeping + * at least two rows of alignment visible + */ + if (annotationHeight + alignmentHeight > availableHeight) { - // if space for more than one sequence row left when annotation is fully - // displayed then set height to annotation height - // otherwise, leave at least two lines of sequence shown. - height = (rheight > av.getCharHeight()) ? height - : (-av.getCharHeight() * 3 + (int) (alignFrame.getHeight() * (1 - sscaling))); + annotationHeight = Math.min(annotationHeight, availableHeight - 2 + * rowHeight); } } else { // maintain same window layout whilst updating sliders - height = annotationScroller.getSize().height; + annotationHeight = annotationScroller.getSize().height; } hscroll.addNotify(); annotationScroller.setPreferredSize(new Dimension(annotationScroller - .getWidth(), height)); + .getWidth(), annotationHeight)); annotationSpaceFillerHolder.setPreferredSize(new Dimension( - annotationSpaceFillerHolder.getWidth(), height)); - annotationScroller.validate();// repaint(); + annotationSpaceFillerHolder.getWidth(), annotationHeight)); + annotationScroller.validate(); annotationScroller.addNotify(); } @@ -1727,10 +1739,10 @@ public class AlignmentPanel extends GAlignmentPanel implements * @param sr * holds mapped region(s) of this alignment that we are scrolling * 'to'; may be modified for sequence offset by this method - * @param seqOffset + * @param verticalOffset * the number of visible sequences to show above the mapped region */ - public void scrollToCentre(SearchResults sr, int seqOffset) + public void scrollToCentre(SearchResults sr, int verticalOffset) { /* * To avoid jumpy vertical scrolling (if some sequences are gapped or not @@ -1744,7 +1756,6 @@ public class AlignmentPanel extends GAlignmentPanel implements * This is like AlignmentI.findIndex(seq) but here we are matching the * dataset sequence not the aligned sequence */ - int sequenceIndex = 0; boolean matched = false; for (SequenceI seq : seqs) { @@ -1753,20 +1764,16 @@ public class AlignmentPanel extends GAlignmentPanel implements matched = true; break; } - sequenceIndex++; } if (!matched) { return; // failsafe, shouldn't happen } - sequenceIndex = Math.max(0, sequenceIndex - seqOffset); - sr.getResults().get(0) - .setSequence(av.getAlignment().getSequenceAt(sequenceIndex)); /* * Scroll to position but centring the target residue. */ - scrollToPosition(sr, true, true); + scrollToPosition(sr, verticalOffset, true, true); } /** diff --git a/src/jalview/gui/AnnotationPanel.java b/src/jalview/gui/AnnotationPanel.java index c952c13..97752f2 100755 --- a/src/jalview/gui/AnnotationPanel.java +++ b/src/jalview/gui/AnnotationPanel.java @@ -139,7 +139,7 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, public AnnotationPanel(AlignmentPanel ap) { - MAC = new jalview.util.Platform().isAMac(); + MAC = jalview.util.Platform.isAMac(); ToolTipManager.sharedInstance().registerComponent(this); ToolTipManager.sharedInstance().setInitialDelay(0); diff --git a/src/jalview/gui/AppJmol.java b/src/jalview/gui/AppJmol.java index c2a7299..a16ea68 100644 --- a/src/jalview/gui/AppJmol.java +++ b/src/jalview/gui/AppJmol.java @@ -20,6 +20,29 @@ */ package jalview.gui; +import jalview.bin.Cache; +import jalview.datamodel.Alignment; +import jalview.datamodel.AlignmentI; +import jalview.datamodel.ColumnSelection; +import jalview.datamodel.PDBEntry; +import jalview.datamodel.SequenceI; +import jalview.gui.StructureViewer.ViewerType; +import jalview.io.AppletFormatAdapter; +import jalview.io.JalviewFileChooser; +import jalview.io.JalviewFileView; +import jalview.schemes.BuriedColourScheme; +import jalview.schemes.ColourSchemeI; +import jalview.schemes.HelixColourScheme; +import jalview.schemes.HydrophobicColourScheme; +import jalview.schemes.PurinePyrimidineColourScheme; +import jalview.schemes.StrandColourScheme; +import jalview.schemes.TaylorColourScheme; +import jalview.schemes.TurnColourScheme; +import jalview.schemes.ZappoColourScheme; +import jalview.structures.models.AAStructureBindingModel; +import jalview.util.MessageManager; +import jalview.util.Platform; + import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; @@ -34,8 +57,8 @@ import java.io.BufferedReader; import java.io.File; import java.io.FileOutputStream; import java.io.FileReader; +import java.io.IOException; import java.io.PrintWriter; -import java.util.Enumeration; import java.util.Vector; import javax.swing.JCheckBoxMenuItem; @@ -51,29 +74,6 @@ import javax.swing.event.InternalFrameEvent; import javax.swing.event.MenuEvent; import javax.swing.event.MenuListener; -import jalview.bin.Cache; -import jalview.datamodel.Alignment; -import jalview.datamodel.AlignmentI; -import jalview.datamodel.ColumnSelection; -import jalview.datamodel.PDBEntry; -import jalview.datamodel.SequenceI; -import jalview.gui.StructureViewer.ViewerType; -import jalview.io.AppletFormatAdapter; -import jalview.io.JalviewFileChooser; -import jalview.io.JalviewFileView; -import jalview.schemes.BuriedColourScheme; -import jalview.schemes.ColourSchemeI; -import jalview.schemes.HelixColourScheme; -import jalview.schemes.HydrophobicColourScheme; -import jalview.schemes.PurinePyrimidineColourScheme; -import jalview.schemes.StrandColourScheme; -import jalview.schemes.TaylorColourScheme; -import jalview.schemes.TurnColourScheme; -import jalview.schemes.ZappoColourScheme; -import jalview.structures.models.AAStructureBindingModel; -import jalview.util.MessageManager; -import jalview.util.Platform; - public class AppJmol extends StructureViewerBase { AppJmolBinding jmb; @@ -84,41 +84,8 @@ public class AppJmol extends StructureViewerBase RenderPanel renderPanel; - Vector atomsPicked = new Vector(); - private boolean addingStructures = false; - /** - * - * @param file - * @param id - * @param seq - * @param ap - * @param loadStatus - * @param bounds - * @deprecated defaults to AppJmol(String[] files, ... , viewid); - */ - @Deprecated - public AppJmol(String file, String id, SequenceI[] seq, - AlignmentPanel ap, String loadStatus, Rectangle bounds) - { - this(file, id, seq, ap, loadStatus, bounds, null); - } - - /** - * @deprecated - */ - @Deprecated - public AppJmol(String file, String id, SequenceI[] seq, - AlignmentPanel ap, String loadStatus, Rectangle bounds, - String viewid) - { - this(new String[] - { file }, new String[] - { id }, new SequenceI[][] - { seq }, ap, true, true, false, loadStatus, bounds, viewid); - } - ViewSelectionMenu seqColourBy; /** @@ -185,6 +152,7 @@ public class AppJmol extends StructureViewerBase this.addInternalFrameListener(new InternalFrameAdapter() { + @Override public void internalFrameClosing(InternalFrameEvent internalFrameEvent) { closeViewer(false); @@ -345,36 +313,30 @@ public class AppJmol extends StructureViewerBase return; } } - // ///////////////////////////////// - // Check if there are other Jmol views involving this alignment - // and prompt user about adding this molecule to one of them - Vector existingViews = getJmolsFor(ap); - if (existingViews.size() > 0) + + /* + * Check if there are other Jmol views involving this alignment and prompt + * user about adding this molecule to one of them + */ + for (AppJmol topJmol : getJmolsFor(ap)) { - Enumeration jm = existingViews.elements(); - while (jm.hasMoreElements()) + // TODO: highlight topJmol in view somehow + int option = JOptionPane.showInternalConfirmDialog(Desktop.desktop, + MessageManager.formatMessage("label.add_pdbentry_to_view", + new String[] + { pdbentry.getId(), topJmol.getTitle() }), + MessageManager + .getString("label.align_to_existing_structure_view"), + JOptionPane.YES_NO_CANCEL_OPTION); + if (option == JOptionPane.CANCEL_OPTION) { - AppJmol topJmol = (AppJmol) jm.nextElement(); - // TODO: highlight topJmol in view somehow - int option = JOptionPane - .showInternalConfirmDialog( - Desktop.desktop, - MessageManager.formatMessage( - "label.add_pdbentry_to_view", new String[] - { pdbentry.getId(), topJmol.getTitle() }), - MessageManager - .getString("label.align_to_existing_structure_view"), - JOptionPane.YES_NO_CANCEL_OPTION); - if (option == JOptionPane.CANCEL_OPTION) - { - return; - } - if (option == JOptionPane.YES_OPTION) - { - topJmol.useAlignmentPanelForSuperposition(ap); - topJmol.addStructure(pdbentry, seq, chains, true, ap.alignFrame); - return; - } + return; + } + if (option == JOptionPane.YES_OPTION) + { + topJmol.useAlignmentPanelForSuperposition(ap); + topJmol.addStructure(pdbentry, seq, chains, true, ap.alignFrame); + return; } } // ///////////////////////////////// @@ -407,6 +369,7 @@ public class AppJmol extends StructureViewerBase } this.addInternalFrameListener(new InternalFrameAdapter() { + @Override public void internalFrameClosing(InternalFrameEvent internalFrameEvent) { closeViewer(false); @@ -489,18 +452,18 @@ public class AppJmol extends StructureViewerBase return; } - private Vector getJmolsFor(AlignmentPanel apanel) + private Vector getJmolsFor(AlignmentPanel apanel) { - Vector result = new Vector(); + Vector result = new Vector(); JInternalFrame[] frames = Desktop.instance.getAllFrames(); for (JInternalFrame frame : frames) { if (frame instanceof AppJmol) { - if (((StructureViewerBase) frame).isLinkedWith(apanel)) + if (((AppJmol) frame).isLinkedWith(apanel)) { - result.addElement(frame); + result.addElement((AppJmol) frame); } } } @@ -524,10 +487,10 @@ public class AppJmol extends StructureViewerBase scriptWindow = new JPanel(bl); scriptWindow.setVisible(false); } - ; + jmb.allocateViewer(renderPanel, true, "", null, null, "", scriptWindow, null); - jmb.newJmolPopup(true, "Jmol", true); + // jmb.newJmolPopup("Jmol"); if (command == null) { command = ""; @@ -536,7 +499,7 @@ public class AppJmol extends StructureViewerBase jmb.setFinishedInit(true); } - void setChainMenuItems(Vector chains) + void setChainMenuItems(Vector chains) { chainMenu.removeAll(); if (chains == null) @@ -564,9 +527,9 @@ public class AppJmol extends StructureViewerBase chainMenu.add(menuItem); - for (int c = 0; c < chains.size(); c++) + for (String chain : chains) { - menuItem = new JCheckBoxMenuItem(chains.elementAt(c).toString(), true); + menuItem = new JCheckBoxMenuItem(chain, true); menuItem.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent evt) @@ -588,9 +551,7 @@ public class AppJmol extends StructureViewerBase void centerViewer() { - Vector toshow = new Vector(); - String lbl; - int mlength, p, mnum; + Vector toshow = new Vector(); for (int i = 0; i < chainMenu.getItemCount(); i++) { if (chainMenu.getItem(i) instanceof JCheckBoxMenuItem) @@ -763,7 +724,7 @@ public class AppJmol extends StructureViewerBase // need to wait around until script has finished while (addingStructures ? lastnotify >= jmb.getLoadNotifiesHandled() - : (jmb.isFinishedInit() && jmb.getPdbFile() != null && jmb + : (!jmb.isFinishedInit() && jmb.getPdbFile() != null && jmb .getPdbFile().length != jmb.getPdbCount())) { try @@ -774,6 +735,7 @@ public class AppJmol extends StructureViewerBase { } } + // refresh the sequence colours for the new structure(s) for (AlignmentPanel ap : _colourwith) { @@ -813,10 +775,11 @@ public class AppJmol extends StructureViewerBase if (value == JalviewFileChooser.APPROVE_OPTION) { + BufferedReader in = null; try { // TODO: cope with multiple PDB files in view - BufferedReader in = new BufferedReader(new FileReader( + in = new BufferedReader(new FileReader( jmb.getPdbFile()[0])); File outFile = chooser.getSelectedFile(); @@ -833,6 +796,18 @@ public class AppJmol extends StructureViewerBase } catch (Exception ex) { ex.printStackTrace(); + } finally + { + if (in != null) + { + try + { + in.close(); + } catch (IOException e) + { + // ignore + } + } } } } @@ -899,8 +874,7 @@ public class AppJmol extends StructureViewerBase if (im.getGraphics() != null) { - Rectangle rect = new Rectangle(width, height); - jmb.viewer.renderScreenImage(im.getGraphics(), rect.getSize(), rect); + jmb.viewer.renderScreenImage(im.getGraphics(), width, height); im.writeImage(); } } @@ -936,7 +910,7 @@ public class AppJmol extends StructureViewerBase // Set the colour using the current view for the associated alignframe for (AlignmentPanel ap : _colourwith) { - jmb.colourBySequence(ap.av.isShowSequenceFeatures(), ap); + jmb.colourBySequence(ap); } } } @@ -1077,12 +1051,10 @@ public class AppJmol extends StructureViewerBase { final Dimension currentSize = new Dimension(); - final Rectangle rectClip = new Rectangle(); - + @Override public void paintComponent(Graphics g) { getSize(currentSize); - g.getClipBounds(rectClip); if (jmb != null && jmb.fileLoadingError != null) { @@ -1121,7 +1093,8 @@ public class AppJmol extends StructureViewerBase } else { - jmb.viewer.renderScreenImage(g, currentSize, rectClip); + jmb.viewer.renderScreenImage(g, currentSize.width, + currentSize.height); } } } diff --git a/src/jalview/gui/AppJmolBinding.java b/src/jalview/gui/AppJmolBinding.java index 3a376b8..5c4346e 100644 --- a/src/jalview/gui/AppJmolBinding.java +++ b/src/jalview/gui/AppJmolBinding.java @@ -28,12 +28,11 @@ import jalview.ext.jmol.JalviewJmolBinding; import jalview.structure.StructureSelectionManager; import java.awt.Container; -import java.util.BitSet; +import java.util.Map; import org.jmol.api.JmolAppConsoleInterface; -import org.jmol.api.JmolViewer; -import org.jmol.popup.JmolPopup; -import org.openscience.jmol.app.jmolpanel.AppConsole; +import org.jmol.java.BS; +import org.openscience.jmol.app.jmolpanel.console.AppConsole; public class AppJmolBinding extends JalviewJmolBinding { @@ -77,6 +76,7 @@ public class AppJmolBinding extends JalviewJmolBinding return new SequenceRenderer(((AlignmentPanel) alignment).av); } + @Override public void sendConsoleEcho(String strEcho) { if (console != null) @@ -85,6 +85,7 @@ public class AppJmolBinding extends JalviewJmolBinding } } + @Override public void sendConsoleMessage(String strStatus) { if (console != null && strStatus != null) @@ -124,7 +125,7 @@ public class AppJmolBinding extends JalviewJmolBinding public void updateColours(Object source) { - AlignmentPanel ap = (AlignmentPanel) source, topap; + AlignmentPanel ap = (AlignmentPanel) source; // ignore events from panels not used to colour this view if (!appJmolWindow.isUsedforcolourby(ap)) { @@ -132,10 +133,11 @@ public class AppJmolBinding extends JalviewJmolBinding } if (!isLoadingFromArchive()) { - colourBySequence(ap.av.isShowSequenceFeatures(), ap); + colourBySequence(ap); } } + @Override public void notifyScriptTermination(String strStatus, int msWalltime) { // todo - script termination doesn't happen ? @@ -149,34 +151,37 @@ public class AppJmolBinding extends JalviewJmolBinding showUrl(url, "jmol"); } - public void newJmolPopup(boolean translateLocale, String menuName, - boolean asPopup) + public void newJmolPopup(String menuName) { - jmolpopup = new JmolPopup(); - jmolpopup.initialize(viewer, translateLocale, menuName, asPopup); + // jmolpopup = new JmolAwtPopup(); + // jmolpopup.jpiInitialize((viewer), menuName); } - public void selectionChanged(BitSet arg0) + @Override + public void selectionChanged(BS arg0) { // TODO Auto-generated method stub } + @Override public void refreshPdbEntries() { // TODO Auto-generated method stub } + @Override public void showConsole(boolean b) { appJmolWindow.showConsole(b); } @Override - protected JmolAppConsoleInterface createJmolConsole(JmolViewer viewer2, + protected JmolAppConsoleInterface createJmolConsole( Container consolePanel, String buttonsToShow) { + viewer.setJmolCallbackListener(this); return new AppConsole(viewer, consolePanel, buttonsToShow); } @@ -195,4 +200,11 @@ public class AppJmolBinding extends JalviewJmolBinding appJmolWindow.removeAlignmentPanel(((SeqPanel) svl).ap); } } + + @Override + public Map getJSpecViewProperty(String arg0) + { + // TODO Auto-generated method stub + return null; + } } diff --git a/src/jalview/gui/AppVarna.java b/src/jalview/gui/AppVarna.java index 5c3785a..99bcff4 100644 --- a/src/jalview/gui/AppVarna.java +++ b/src/jalview/gui/AppVarna.java @@ -20,13 +20,29 @@ */ package jalview.gui; +import jalview.analysis.AlignSeq; +import jalview.datamodel.AlignmentAnnotation; +import jalview.datamodel.ColumnSelection; +import jalview.datamodel.RnaViewerModel; +import jalview.datamodel.SequenceGroup; +import jalview.datamodel.SequenceI; +import jalview.ext.varna.RnaModel; +import jalview.structure.SecondaryStructureListener; +import jalview.structure.SelectionListener; +import jalview.structure.SelectionSource; +import jalview.structure.StructureSelectionManager; +import jalview.structure.VamsasSource; +import jalview.util.Comparison; +import jalview.util.MessageManager; +import jalview.util.ShiftList; + import java.awt.BorderLayout; import java.awt.Color; -import java.util.ArrayList; +import java.util.Collection; import java.util.Hashtable; +import java.util.LinkedHashMap; +import java.util.List; import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import javax.swing.JInternalFrame; import javax.swing.JSplitPane; @@ -35,102 +51,165 @@ import javax.swing.event.InternalFrameEvent; import fr.orsay.lri.varna.VARNAPanel; import fr.orsay.lri.varna.exceptions.ExceptionFileFormatOrSyntax; +import fr.orsay.lri.varna.exceptions.ExceptionLoadingFailed; import fr.orsay.lri.varna.exceptions.ExceptionUnmatchedClosingParentheses; -import fr.orsay.lri.varna.interfaces.InterfaceVARNAListener; import fr.orsay.lri.varna.interfaces.InterfaceVARNASelectionListener; import fr.orsay.lri.varna.models.BaseList; -import fr.orsay.lri.varna.models.VARNAConfig; +import fr.orsay.lri.varna.models.FullBackup; import fr.orsay.lri.varna.models.annotations.HighlightRegionAnnotation; import fr.orsay.lri.varna.models.rna.ModeleBase; import fr.orsay.lri.varna.models.rna.RNA; -import jalview.bin.Cache; -import jalview.datamodel.ColumnSelection; -import jalview.datamodel.SequenceGroup; -import jalview.datamodel.SequenceI; -import jalview.structure.SecondaryStructureListener; -import jalview.structure.SelectionListener; -import jalview.structure.SelectionSource; -import jalview.structure.StructureSelectionManager; -import jalview.structure.VamsasSource; -import jalview.util.MessageManager; -import jalview.util.ShiftList; - -public class AppVarna extends JInternalFrame implements - InterfaceVARNAListener, SelectionListener, - SecondaryStructureListener// implements - // Runnable,SequenceStructureBinding, - // ViewSetProvider - , InterfaceVARNASelectionListener, VamsasSource - +public class AppVarna extends JInternalFrame implements SelectionListener, + SecondaryStructureListener, InterfaceVARNASelectionListener, + VamsasSource { - AppVarnaBinding vab; + private static final byte[] PAIRS = new byte[] + { '(', ')', '[', ']', '{', '}', '<', '>' }; - VARNAPanel varnaPanel; + private AppVarnaBinding vab; - public String name; + private AlignmentPanel ap; - public StructureSelectionManager ssm; + private String viewId; + + private StructureSelectionManager ssm; /* - * public AppVarna(){ vab = new AppVarnaBinding(); initVarna(); } + * Lookup for sequence and annotation mapped to each RNA in the viewer. Using + * a linked hashmap means that order is preserved when saved to the project. */ + private Map models = new LinkedHashMap(); + + private Map offsets = new Hashtable(); - AlignmentPanel ap; + private Map offsetsInv = new Hashtable(); - public AppVarna(String sname, SequenceI seq, String strucseq, - String struc, String name, AlignmentPanel ap) + private JSplitPane split; + + private VarnaHighlighter mouseOverHighlighter = new VarnaHighlighter(); + + private VarnaHighlighter selectionHighlighter = new VarnaHighlighter(); + + private class VarnaHighlighter { + private HighlightRegionAnnotation _lastHighlight; - // System.out.println("1:"+sname); - // System.out.println("2:"+seq); - // System.out.println("3:"+strucseq); - // System.out.println("4:"+struc); - // System.out.println("5:"+name); - // System.out.println("6:"+ap); - this.ap = ap; - ArrayList rnaList = new ArrayList(); - RNA rna1 = new RNA(name); - try + private RNA _lastRNAhighlighted = null; + + public VarnaHighlighter() { - rna1.setRNA(strucseq, replaceOddGaps(struc)); - // System.out.println("The sequence is :"+rna1.getSeq()); - // System.out.println("The sequence is:"+struc); - // System.out.println("The sequence is:"+replaceOddGaps(struc).toString()); - } catch (ExceptionUnmatchedClosingParentheses e2) + } + + /** + * Constructor when restoring from Varna session, including any highlight + * state + * + * @param rna + */ + public VarnaHighlighter(RNA rna) { - e2.printStackTrace(); - } catch (ExceptionFileFormatOrSyntax e3) + // TODO nice try but doesn't work; do we need a highlighter per model? + _lastRNAhighlighted = rna; + List highlights = rna.getHighlightRegion(); + if (highlights != null && !highlights.isEmpty()) + { + _lastHighlight = highlights.get(0); + } + } + + public void highlightRegion(RNA rna, int start, int end) { - e3.printStackTrace(); + clearLastSelection(); + HighlightRegionAnnotation highlight = new HighlightRegionAnnotation( + rna.getBasesBetween(start, end)); + rna.addHighlightRegion(highlight); + _lastHighlight = highlight; + _lastRNAhighlighted = rna; } - RNA trim = trimRNA(rna1, "trimmed " + sname); - rnaList.add(trim); - rnaList.add(rna1); - rnas.put(seq, rna1); - rnas.put(seq, trim); - rna1.setName(sname + " (with gaps)"); + public HighlightRegionAnnotation getLastHighlight() + { + return _lastHighlight; + } + /** + * Clears all structure selection and refreshes the display + */ + public void clearSelection() { - seqs.put(trim, seq); - seqs.put(rna1, seq); + if (_lastRNAhighlighted != null) + { + _lastRNAhighlighted.getHighlightRegion().clear(); + vab.updateSelectedRNA(_lastRNAhighlighted); + _lastRNAhighlighted = null; + _lastHighlight = null; + } + } - /** - * if (false || seq.getStart()!=1) { for (RNA rshift:rnaList) { ShiftList - * shift=offsets.get(rshift); if (shift==null) { offsets.put(rshift, - * shift=new ShiftList());} shift.addShift(1, seq.getStart()-1); - * offsetsInv.put(rshift, shift.getInverse()); } } - **/ + /** + * Clear the last structure selection + */ + public void clearLastSelection() + { + if (_lastRNAhighlighted != null) + { + _lastRNAhighlighted.removeHighlightRegion(_lastHighlight); + _lastRNAhighlighted = null; + _lastHighlight = null; + } } - vab = new AppVarnaBinding(rnaList); - // vab = new AppVarnaBinding(seq,struc); - this.name = sname + " trimmed to " + name; + } + + /** + * Constructor + * + * @param seq + * the RNA sequence + * @param aa + * the annotation with the secondary structure string + * @param ap + * the AlignmentPanel creating this object + */ + public AppVarna(SequenceI seq, AlignmentAnnotation aa, AlignmentPanel ap) + { + this(ap); + + String sname = aa.sequenceRef == null ? "secondary structure (alignment)" + : seq.getName() + " structure"; + String theTitle = sname + + (aa.sequenceRef == null ? " trimmed to " + seq.getName() : ""); + theTitle = MessageManager.formatMessage("label.varna_params", + new String[] + { theTitle }); + setTitle(theTitle); + + String gappedTitle = sname + " (with gaps)"; + RnaModel gappedModel = new RnaModel(gappedTitle, aa, seq, null, true); + addModel(gappedModel, gappedTitle); + + String trimmedTitle = "trimmed " + sname; + RnaModel trimmedModel = new RnaModel(trimmedTitle, aa, seq, null, false); + addModel(trimmedModel, trimmedTitle); + vab.setSelectedIndex(0); + } + + + /** + * Constructor that links the viewer to a parent panel (but has no structures + * yet - use addModel to add them) + * + * @param ap + */ + protected AppVarna(AlignmentPanel ap) + { + this.ap = ap; + this.viewId = System.currentTimeMillis() + "." + this.hashCode(); + vab = new AppVarnaBinding(); initVarna(); - ssm = ap.getStructureSelectionManager(); - // System.out.println(ssm.toString()); + this.ssm = ap.getStructureSelectionManager(); ssm.addStructureViewerListener(this); ssm.addSelectionListener(this); addInternalFrameListener(new InternalFrameAdapter() @@ -141,40 +220,52 @@ public class AppVarna extends JInternalFrame implements close(); } }); + } + /** + * Constructor given viewer data read from a saved project file + * + * @param model + * @param ap + * the (or a) parent alignment panel + */ + public AppVarna(RnaViewerModel model, AlignmentPanel ap) + { + this(ap); + setTitle(model.title); + this.viewId = model.viewId; + setBounds(model.x, model.y, model.width, model.height); + this.split.setDividerLocation(model.dividerLocation); } + /** + * Constructs a split pane with an empty selection list and display panel, and + * adds it to the desktop + */ public void initVarna() { - - // vab.setFinishedInit(false); - varnaPanel = vab.get_varnaPanel(); + VARNAPanel varnaPanel = vab.get_varnaPanel(); setBackground(Color.white); - JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, + split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, vab.getListPanel(), varnaPanel); getContentPane().setLayout(new BorderLayout()); getContentPane().add(split, BorderLayout.CENTER); - // getContentPane().add(vab.getTools(), BorderLayout.NORTH); - varnaPanel.addVARNAListener(this); + varnaPanel.addSelectionListener(this); - jalview.gui.Desktop.addInternalFrame(this, - MessageManager.formatMessage("label.varna_params", new String[] - { name }), getBounds().width, getBounds().height); + jalview.gui.Desktop.addInternalFrame(this, "", getBounds().width, + getBounds().height); this.pack(); showPanel(true); - - } - - public String replaceOddGaps(String oldStr) - { - String patternStr = "[^([{<>}])]"; - String replacementStr = "."; - Pattern pattern = Pattern.compile(patternStr); - Matcher matcher = pattern.matcher(oldStr); - String newStr = matcher.replaceAll(replacementStr); - return newStr; } + /** + * Constructs a new RNA model from the given one, without gaps. Also + * calculates and saves a 'shift list' + * + * @param rna + * @param name + * @return + */ public RNA trimRNA(RNA rna, String name) { ShiftList offset = new ShiftList(); @@ -182,7 +273,8 @@ public class AppVarna extends JInternalFrame implements RNA rnaTrim = new RNA(name); try { - rnaTrim.setRNA(rna.getSeq(), replaceOddGaps(rna.getStructDBN())); + String structDBN = rna.getStructDBN(true); + rnaTrim.setRNA(rna.getSeq(), replaceOddGaps(structDBN)); } catch (ExceptionUnmatchedClosingParentheses e2) { e2.printStackTrace(); @@ -191,19 +283,23 @@ public class AppVarna extends JInternalFrame implements e3.printStackTrace(); } - StringBuffer seq = new StringBuffer(rnaTrim.getSeq()); - StringBuffer struc = new StringBuffer(rnaTrim.getStructDBN()); - int ofstart = -1, sleng = rnaTrim.getSeq().length(); + String seq = rnaTrim.getSeq(); + StringBuilder struc = new StringBuilder(256); + struc.append(rnaTrim.getStructDBN(true)); + int ofstart = -1; + int sleng = seq.length(); + for (int i = 0; i < sleng; i++) { - // TODO: Jalview utility for gap detection java.utils.isGap() - // TODO: Switch to jalview rna datamodel - if (jalview.util.Comparison.isGap(seq.charAt(i))) + if (Comparison.isGap(seq.charAt(i))) { if (ofstart == -1) { ofstart = i; } + /* + * mark base or base & pair in the structure with * + */ if (!rnaTrim.findPair(i).isEmpty()) { int m = rnaTrim.findPair(i).get(1); @@ -232,35 +328,37 @@ public class AppVarna extends JInternalFrame implements offset.addShift(offset.shift(ofstart), ofstart - sleng); ofstart = -1; } - String newSeq = rnaTrim.getSeq().replace("-", ""); - rnaTrim.getSeq().replace(".", ""); + + /* + * remove the marked gaps from the structure + */ String newStruc = struc.toString().replace("*", ""); + /* + * remove gaps from the sequence + */ + String newSeq = AlignSeq.extractGaps(Comparison.GapChars, seq); + try { rnaTrim.setRNA(newSeq, newStruc); registerOffset(rnaTrim, offset); } catch (ExceptionUnmatchedClosingParentheses e) { - // TODO Auto-generated catch block e.printStackTrace(); } catch (ExceptionFileFormatOrSyntax e) { - // TODO Auto-generated catch block e.printStackTrace(); } return rnaTrim; } - // needs to be many-many - Map seqs = new Hashtable(); - - Map rnas = new Hashtable(); - - Map offsets = new Hashtable(); - - Map offsetsInv = new Hashtable(); - + /** + * Save the sequence to structure mapping, and also its inverse. + * + * @param rnaTrim + * @param offset + */ private void registerOffset(RNA rnaTrim, ShiftList offset) { offsets.put(rnaTrim, offset); @@ -272,115 +370,37 @@ public class AppVarna extends JInternalFrame implements this.setVisible(show); } - private boolean _started = false; - - public void run() - { - _started = true; - - try - { - initVarna(); - } catch (OutOfMemoryError oomerror) - { - new OOMWarning("When trying to open the Varna viewer!", oomerror); - } catch (Exception ex) - { - Cache.log.error("Couldn't open Varna viewer!", ex); - } - } - - @Override - public void onUINewStructure(VARNAConfig v, RNA r) - { - - } - - @Override - public void onWarningEmitted(String s) - { - // TODO Auto-generated method stub - - } - - private class VarnaHighlighter - { - private HighlightRegionAnnotation _lastHighlight; - - private RNA _lastRNAhighlighted = null; - - public void highlightRegion(RNA rna, int start, int end) - { - clearSelection(null); - HighlightRegionAnnotation highlight = new HighlightRegionAnnotation( - rna.getBasesBetween(start, end)); - rna.addHighlightRegion(highlight); - _lastHighlight = highlight; - _lastRNAhighlighted = rna; - - } - - public HighlightRegionAnnotation getLastHighlight() - { - return _lastHighlight; - } - - public RNA getLastRNA() - { - return _lastRNAhighlighted; - } - - public void clearSelection(AppVarnaBinding vab) - { - if (_lastRNAhighlighted != null) - { - _lastRNAhighlighted.removeHighlightRegion(_lastHighlight); - if (vab != null) - { - vab.updateSelectedRNA(_lastRNAhighlighted); - } - _lastRNAhighlighted = null; - _lastHighlight = null; - - } - } - } - - VarnaHighlighter mouseOverHighlighter = new VarnaHighlighter(), - selectionHighlighter = new VarnaHighlighter(); - /** * If a mouseOver event from the AlignmentPanel is noticed the currently * selected RNA in the VARNA window is highlighted at the specific position. * To be able to remove it before the next highlight it is saved in * _lastHighlight + * + * @param sequence + * @param index + * the aligned sequence position (base 0) + * @param position + * the dataset sequence position (base 1) */ @Override - public void mouseOverSequence(SequenceI sequence, int index) + public void mouseOverSequence(SequenceI sequence, final int index, + final int position) { RNA rna = vab.getSelectedRNA(); - if (seqs.get(rna) == sequence) + if (rna == null) { - ShiftList shift = offsets.get(rna); - if (shift != null) - { - // System.err.print("Orig pos:"+index); - index = shift.shift(index); - // System.err.println("\nFinal pos:"+index); - } - mouseOverHighlighter.highlightRegion(rna, index, index); + return; + } + RnaModel rnaModel = models.get(rna); + if (rnaModel.seq == sequence) + { + int highlightPos = rnaModel.gapped ? index : position - 1; + mouseOverHighlighter.highlightRegion(rna, highlightPos, highlightPos); vab.updateSelectedRNA(rna); } } @Override - public void onStructureRedrawn() - { - // TODO Auto-generated method stub - - } - - @Override public void selection(SequenceGroup seqsel, ColumnSelection colsel, SelectionSource source) { @@ -390,10 +410,14 @@ public class AppVarna extends JInternalFrame implements // TODO - reuse many-one panel-view system in jmol viewer return; } + RNA rna = vab.getSelectedRNA(); + if (rna == null) + { + return; + } if (seqsel != null && seqsel.getSize() > 0) { int start = seqsel.getStartRes(), end = seqsel.getEndRes(); - RNA rna = vab.getSelectedRNA(); ShiftList shift = offsets.get(rna); if (shift != null) { @@ -408,27 +432,30 @@ public class AppVarna extends JInternalFrame implements } else { - selectionHighlighter.clearSelection(vab); + selectionHighlighter.clearSelection(); } } + /** + * Respond to a change of the base hovered over in the Varna viewer + */ @Override - public void onHoverChanged(ModeleBase arg0, ModeleBase arg1) + public void onHoverChanged(ModeleBase previousBase, ModeleBase newBase) { RNA rna = vab.getSelectedRNA(); ShiftList shift = offsetsInv.get(rna); - SequenceI seq = seqs.get(rna); - if (arg1 != null && seq != null) + SequenceI seq = models.get(rna).seq; + if (newBase != null && seq != null) { if (shift != null) { - int i = shift.shift(arg1.getIndex()); + int i = shift.shift(newBase.getIndex()); // System.err.println("shifted "+(arg1.getIndex())+" to "+i); ssm.mouseOverVamsasSequence(seq, i, this); } else { - ssm.mouseOverVamsasSequence(seq, arg1.getIndex(), this); + ssm.mouseOverVamsasSequence(seq, newBase.getIndex(), this); } } } @@ -441,18 +468,56 @@ public class AppVarna extends JInternalFrame implements } - @Override - public void onTranslationChanged() + /** + * Returns the path to a temporary file containing a representation of the + * state of one Varna display + * + * @param rna + * + * @return + */ + public String getStateInfo(RNA rna) { - // TODO Auto-generated method stub + return vab.getStateInfo(rna); + } + public AlignmentPanel getAlignmentPanel() + { + return ap; } - @Override - public void onZoomLevelChanged() + public String getViewId() + { + return viewId; + } + + /** + * Returns true if any of the viewer's models (not necessarily the one + * currently displayed) is for the given sequence + * + * @param seq + * @return + */ + public boolean isListeningFor(SequenceI seq) { - // TODO Auto-generated method stub + for (RnaModel model : models.values()) + { + if (model.seq == seq) + { + return true; + } + } + return false; + } + /** + * Returns a value representing the horizontal split divider location + * + * @return + */ + public int getDividerLocation() + { + return split == null ? 0 : split.getDividerLocation(); } /** @@ -461,7 +526,7 @@ public class AppVarna extends JInternalFrame implements protected void close() { /* - * Deregister as a listener, to free references to this object + * Deregister as a listener, to release references to this object */ if (ssm != null) { @@ -470,4 +535,222 @@ public class AppVarna extends JInternalFrame implements } } + /** + * Returns the secondary structure annotation that this viewer displays for + * the given sequence + * + * @return + */ + public AlignmentAnnotation getAnnotation(SequenceI seq) + { + for (RnaModel model : models.values()) + { + if (model.seq == seq) + { + return model.ann; + } + } + return null; + } + + public int getSelectedIndex() + { + return this.vab.getSelectedIndex(); + } + + /** + * Returns the set of models shown by the viewer + * + * @return + */ + public Collection getModels() + { + return models.values(); + } + + /** + * Add a model (e.g. loaded from project file) + * + * @param rna + * @param modelName + */ + public RNA addModel(RnaModel model, String modelName) + { + if (!model.ann.isValidStruc()) + { + throw new IllegalArgumentException("Invalid RNA structure annotation"); + } + + /* + * opened on request in Jalview session + */ + RNA rna = new RNA(modelName); + String struc = model.ann.getRNAStruc(); + struc = replaceOddGaps(struc); + + String strucseq = model.seq.getSequenceAsString(); + try + { + rna.setRNA(strucseq, struc); + } catch (ExceptionUnmatchedClosingParentheses e2) + { + e2.printStackTrace(); + } catch (ExceptionFileFormatOrSyntax e3) + { + e3.printStackTrace(); + } + + if (!model.gapped) + { + rna = trimRNA(rna, modelName); + } + models.put(rna, new RnaModel(modelName, model.ann, model.seq, rna, + model.gapped)); + vab.addStructure(rna); + return rna; + } + + /** + * Constructs a shift list that describes the gaps in the sequence + * + * @param seq + * @return + */ + protected ShiftList buildOffset(SequenceI seq) + { + // TODO refactor to avoid duplication with trimRNA() + // TODO JAL-1789 bugs in use of ShiftList here + ShiftList offset = new ShiftList(); + int ofstart = -1; + int sleng = seq.getLength(); + char[] seqChars = seq.getSequence(); + + for (int i = 0; i < sleng; i++) + { + if (Comparison.isGap(seqChars[i])) + { + if (ofstart == -1) + { + ofstart = i; + } + } + else + { + if (ofstart > -1) + { + offset.addShift(offset.shift(ofstart), ofstart - i); + ofstart = -1; + } + } + } + // final gap + if (ofstart > -1) + { + offset.addShift(offset.shift(ofstart), ofstart - sleng); + ofstart = -1; + } + return offset; + } + + /** + * Set the selected index in the model selection list + * + * @param selectedIndex + */ + public void setInitialSelection(final int selectedIndex) + { + /* + * empirically it needs a second for Varna/AWT to finish loading/drawing + * models for this to work; SwingUtilities.invokeLater _not_ a solution; + * explanation and/or better solution welcome! + */ + synchronized (this) + { + try + { + wait(1000); + } catch (InterruptedException e) + { + // meh + } + } + vab.setSelectedIndex(selectedIndex); + } + + + /** + * Add a model with associated Varna session file + * + * @param rna + * @param modelName + */ + public RNA addModelSession(RnaModel model, String modelName, + String sessionFile) + { + if (!model.ann.isValidStruc()) + { + throw new IllegalArgumentException("Invalid RNA structure annotation"); + } + + try + { + FullBackup fromSession = vab.vp.loadSession(sessionFile); + vab.addStructure(fromSession.rna, fromSession.config); + RNA rna = fromSession.rna; + // copy the model, but now including the RNA object + RnaModel newModel = new RnaModel(model.title, model.ann, model.seq, + rna, model.gapped); + if (!model.gapped) + { + registerOffset(rna, buildOffset(model.seq)); + } + models.put(rna, newModel); + // capture rna selection state when saved + selectionHighlighter = new VarnaHighlighter(rna); + return fromSession.rna; + } catch (ExceptionLoadingFailed e) + { + System.err + .println("Error restoring Varna session: " + e.getMessage()); + return null; + } + } + + + /** + * Replace everything except RNA secondary structure characters with a period + * + * @param s + * @return + */ + public static String replaceOddGaps(String s) + { + if (s == null) + { + return null; + } + + // this is measured to be 10 times faster than a regex replace + boolean changed = false; + byte[] bytes = s.getBytes(); + for (int i = 0; i < bytes.length; i++) + { + boolean ok = false; + // todo check for ((b >= 'a' && b <= 'z') || (b >= 'A' && b <= 'Z')) if + // wanted also + for (int j = 0; !ok && (j < PAIRS.length); j++) + { + if (bytes[i] == PAIRS[j]) + { + ok = true; + } + } + if (!ok) + { + bytes[i] = '.'; + changed = true; + } + } + return changed ? new String(bytes) : s; + } } diff --git a/src/jalview/gui/AppVarnaBinding.java b/src/jalview/gui/AppVarnaBinding.java index 38385f0..25af7d1 100644 --- a/src/jalview/gui/AppVarnaBinding.java +++ b/src/jalview/gui/AppVarnaBinding.java @@ -20,38 +20,36 @@ */ package jalview.gui; +import jalview.datamodel.SequenceI; +import jalview.ext.varna.JalviewVarnaBinding; +import jalview.structure.AtomSpec; +import jalview.util.MessageManager; + import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; import java.awt.Dimension; -import java.awt.Font; -import java.awt.GridLayout; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.awt.dnd.DnDConstants; import java.awt.dnd.DropTarget; -import java.awt.dnd.DropTargetDragEvent; +import java.awt.dnd.DropTargetAdapter; import java.awt.dnd.DropTargetDropEvent; -import java.awt.dnd.DropTargetEvent; -import java.awt.dnd.DropTargetListener; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; import java.awt.event.ComponentEvent; +import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; import java.io.File; +import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.List; import javax.swing.DefaultListModel; import javax.swing.DefaultListSelectionModel; -import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JScrollPane; -import javax.swing.JTextField; import javax.swing.ListModel; import javax.swing.ListSelectionModel; import javax.swing.event.ListSelectionEvent; @@ -59,70 +57,17 @@ import javax.swing.event.ListSelectionListener; import fr.orsay.lri.varna.VARNAPanel; import fr.orsay.lri.varna.components.ReorderableJList; -import fr.orsay.lri.varna.exceptions.ExceptionFileFormatOrSyntax; import fr.orsay.lri.varna.exceptions.ExceptionLoadingFailed; +import fr.orsay.lri.varna.exceptions.ExceptionNAViewAlgorithm; import fr.orsay.lri.varna.exceptions.ExceptionNonEqualLength; -import fr.orsay.lri.varna.exceptions.ExceptionUnmatchedClosingParentheses; -import fr.orsay.lri.varna.interfaces.InterfaceVARNAListener; import fr.orsay.lri.varna.models.FullBackup; import fr.orsay.lri.varna.models.VARNAConfig; -import fr.orsay.lri.varna.models.rna.Mapping; import fr.orsay.lri.varna.models.rna.RNA; -import jalview.datamodel.SequenceI; -import jalview.structure.AtomSpec; -import jalview.util.MessageManager; - -public class AppVarnaBinding extends jalview.ext.varna.JalviewVarnaBinding - implements DropTargetListener, InterfaceVARNAListener, - MouseListener +public class AppVarnaBinding extends JalviewVarnaBinding { - - /** - * - */ - // private static final long serialVersionUID = -790155708306987257L; - - private String DEFAULT_SEQUENCE = "CAGCACGACACUAGCAGUCAGUGUCAGACUGCAIACAGCACGACACUAGCAGUCAGUGUCAGACUGCAIACAGCACGACACUAGCAGUCAGUGUCAGACUGCAIA"; - - private String DEFAULT_STRUCTURE1 = "..(((((...(((((...(((((...(((((.....)))))...))))).....(((((...(((((.....)))))...))))).....)))))...))))).."; - - private String DEFAULT_STRUCTURE2 = "..(((((...(((((...(((((........(((((...(((((.....)))))...)))))..................))))).....)))))...))))).."; - public VARNAPanel vp; - protected JPanel _tools = new JPanel(); - - private JPanel _input = new JPanel(); - - private JPanel _seqPanel = new JPanel(); - - private JPanel _strPanel = new JPanel(); - - private JLabel _info = new JLabel(); - - private JTextField _str = new JTextField(); - - private JTextField _seq = new JTextField(); - - private JLabel _strLabel = new JLabel( - MessageManager.getString("label.str")); - - private JLabel _seqLabel = new JLabel( - MessageManager.getString("label.seq")); - - private JButton _createButton = new JButton( - MessageManager.getString("action.create")); - - private JButton _updateButton = new JButton( - MessageManager.getString("action.update")); - - private JButton _deleteButton = new JButton( - MessageManager.getString("action.delete")); - - private JButton _duplicateButton = new JButton( - MessageManager.getString("action.snapshot")); - protected JPanel _listPanel = new JPanel(); private ReorderableJList _sideList = null; @@ -141,32 +86,23 @@ public class AppVarnaBinding extends jalview.ext.varna.JalviewVarnaBinding private BackupHolder _rnaList; - /* - * public AppVarnaBinding() { //super("VARNA in Jalview"); - * //this.set_seq("ATGC"); //this.set_str(".()."); //RNAPanelDemoInit(); - * - * //initVarna("ATGCATGATATATATATAT","....((((...))))...."); - * initVarna(this.DEFAULT_SEQUENCE,this.DEFAULT_STRUCTURE1); } + /** + * Constructor */ - - public AppVarnaBinding(String seq, String struc) - { - // super("VARNA in Jalview"); - initVarna(seq, struc); - - } - - public AppVarnaBinding(ArrayList rnaList) + public AppVarnaBinding() { - - // super("VARNA in Jalview"); - initVarnaEdit(rnaList); + init(); } - private void initVarna(String seq, String str) + /** + * Constructs the VARNAPanel and an (empty) selection list of structures to + * show in it + */ + private void init() { + DefaultListModel dlm = new DefaultListModel(); - DefaultListModel dlm = new DefaultListModel(); + int marginTools = 40; DefaultListSelectionModel m = new DefaultListSelectionModel(); m.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); @@ -174,212 +110,53 @@ public class AppVarnaBinding extends jalview.ext.varna.JalviewVarnaBinding _sideList = new ReorderableJList(); _sideList.setModel(dlm); - _sideList.addMouseListener(this); - _sideList.setSelectionModel(m); - _sideList.setPreferredSize(new Dimension(100, 0)); - _sideList.addListSelectionListener(new ListSelectionListener() + _sideList.addMouseListener(new MouseAdapter() { - public void valueChanged(ListSelectionEvent arg0) - { - if (!_sideList.isSelectionEmpty() && !arg0.getValueIsAdjusting()) - { - FullBackup sel = (FullBackup) _sideList.getSelectedValue(); - Mapping map = Mapping.DefaultOutermostMapping(vp.getRNA() - .getSize(), sel.rna.getSize()); - vp.showRNAInterpolated(sel.rna, sel.config, map); - _seq.setText(sel.rna.getSeq()); - _str.setText(sel.rna.getStructDBN()); - } + @Override + public void mouseClicked(MouseEvent e) { + AppVarnaBinding.this.mouseClicked(e); } }); - - _rnaList = new BackupHolder(dlm, _sideList); - RNA _RNA1 = new RNA("User defined 1"); - - try - { - - vp = new VARNAPanel("0", "."); - _RNA1.setRNA(seq, str); - _RNA1.drawRNARadiate(vp.getConfig()); - } catch (ExceptionNonEqualLength e) - { - vp.errorDialog(e); - } catch (ExceptionUnmatchedClosingParentheses e2) - { - e2.printStackTrace(); - } catch (ExceptionFileFormatOrSyntax e3) - { - e3.printStackTrace(); - } - vp.setPreferredSize(new Dimension(400, 400)); - _rnaList.add(vp.getConfig().clone(), _RNA1, generateDefaultName(), true); - - // TODO setBackground(_backgroundColor); - vp.setBackground(_backgroundColor); - - // TODO getContentPane().setLayout(new BorderLayout()); - // TODO getContentPane().add(vp, BorderLayout.CENTER); - - // setVisible(true); - vp.addVARNAListener(this); - } - - private void initVarnaEdit(ArrayList rnaInList) - { - - DefaultListModel dlm = new DefaultListModel(); - - int marginTools = 40; - - DefaultListSelectionModel m = new DefaultListSelectionModel(); - m.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - m.setLeadAnchorNotificationEnabled(false); - - _sideList = new ReorderableJList(); - _sideList.setModel(dlm); - _sideList.addMouseListener(this); _sideList.setSelectionModel(m); _sideList.setPreferredSize(new Dimension(100, 0)); _sideList.addListSelectionListener(new ListSelectionListener() { - public void valueChanged(ListSelectionEvent arg0) + public void valueChanged(ListSelectionEvent evt) { - // System.out.println(arg0); - if (!_sideList.isSelectionEmpty() && !arg0.getValueIsAdjusting()) - { - FullBackup sel = (FullBackup) _sideList.getSelectedValue(); - Mapping map = Mapping.DefaultOutermostMapping(vp.getRNA() - .getSize(), sel.rna.getSize()); - // vp.showRNAInterpolated(sel.rna, sel.config, map); - vp.showRNA(sel.rna, sel.config); - // _seq.setText(sel.rna.getSeq()); - _str.setText(sel.rna.getStructDBN()); - } + changeSelectedStructure_actionPerformed(evt); } }); _rnaList = new BackupHolder(dlm, _sideList); try { - vp = new VARNAPanel("0", "."); - for (int i = 0; i < rnaInList.size(); i++) - { - rnaInList.get(i).drawRNARadiate(vp.getConfig()); - - } } catch (ExceptionNonEqualLength e) { vp.errorDialog(e); } vp.setPreferredSize(new Dimension(400, 400)); - for (int i = 0; i < rnaInList.size(); i++) - { - if (i < rnaInList.size() - 1) - { - _rnaList.add(vp.getConfig().clone(), rnaInList.get(i), rnaInList - .get(i).getName()); - } - else - { - _rnaList.add(vp.getConfig().clone(), rnaInList.get(i), rnaInList - .get(i).getName(), true); - } - } - - /* - * _rnaList.add(vp.getConfig().clone(),_RNA2,generateDefaultName()); - * _rnaList.add(vp.getConfig().clone(),_RNA1,generateDefaultName(),true); - */ JScrollPane listScroller = new JScrollPane(_sideList); listScroller.setPreferredSize(new Dimension(150, 0)); vp.setBackground(_backgroundColor); - Font textFieldsFont = Font.decode("MonoSpaced-PLAIN-12"); - - // _seqLabel.setHorizontalTextPosition(JLabel.LEFT); - // _seqLabel.setPreferredSize(new Dimension(marginTools, 15)); - _seq.setFont(textFieldsFont); - _seq.setText(rnaInList.get(0).getSeq()); - - _updateButton.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - FullBackup sel = (FullBackup) _sideList.getSelectedValue(); - sel.rna.setSequence("A"); - } - }); - - // _seqPanel.setLayout(new BorderLayout()); - // _seqPanel.add(_seqLabel, BorderLayout.WEST); - // _seqPanel.add(_seq, BorderLayout.CENTER); - - _strLabel.setPreferredSize(new Dimension(marginTools, 15)); - _strLabel.setHorizontalTextPosition(JLabel.LEFT); - _str.setFont(textFieldsFont); - _strPanel.setLayout(new BorderLayout()); - _strPanel.add(_strLabel, BorderLayout.WEST); - _strPanel.add(_str, BorderLayout.CENTER); - - _input.setLayout(new GridLayout(1, 0)); - // _input.add(_seqPanel); - _input.add(_strPanel); - - JPanel goPanel = new JPanel(); - goPanel.setLayout(new BorderLayout()); - - _tools.setLayout(new BorderLayout()); - _tools.add(_input, BorderLayout.CENTER); - // _tools.add(_info, BorderLayout.SOUTH); - _tools.add(goPanel, BorderLayout.EAST); - - /* - * _deleteButton.addActionListener(new ActionListener() { public void - * actionPerformed(ActionEvent e) { _rnaList.removeSelected(); } }); - * _duplicateButton.addActionListener(new ActionListener() { public void - * actionPerformed(ActionEvent e) { - * _rnaList.add((VARNAConfig)vp.getConfig(). - * clone(),vp.getRNA().clone(),vp.getRNA - * ().getName()+"-"+DateFormat.getTimeInstance(DateFormat.LONG).format(new - * Date()),true); }}); - */ - goPanel.add(_updateButton, BorderLayout.CENTER); - - JPanel ops = new JPanel(); - ops.setLayout(new GridLayout(1, 2)); - ops.add(_deleteButton); - ops.add(_duplicateButton); - JLabel j = new JLabel( MessageManager.getString("label.structures_manager"), JLabel.CENTER); _listPanel.setLayout(new BorderLayout()); - // _listPanel.add(ops, BorderLayout.SOUTH); _listPanel.add(j, BorderLayout.NORTH); _listPanel.add(listScroller, BorderLayout.CENTER); - // JSplitPane split = new - // JSplitPane(JSplitPane.HORIZONTAL_SPLIT,true,_listPanel,vp); - /** - * TODO getContentPane().setLayout(new BorderLayout()); - * getContentPane().add(split, BorderLayout.CENTER); - * getContentPane().add(_tools, BorderLayout.NORTH); - */ - - // TODO setVisible(true); - DropTarget dt = new DropTarget(vp, this); - - vp.addVARNAListener(this); - } - - public JPanel getTools() - { - return _tools; + new DropTarget(vp, new DropTargetAdapter() { + @Override + public void drop(DropTargetDropEvent dtde) + { + AppVarnaBinding.this.drop(dtde); + } + }); } public JPanel getListPanel() @@ -388,13 +165,19 @@ public class AppVarnaBinding extends jalview.ext.varna.JalviewVarnaBinding } /** - * TODO: Is it effective to transfer the whole RNA? + * Returns the currently selected RNA, or null if none selected * - * @return Currently selected RNA + * @return */ public RNA getSelectedRNA() { - return _rnaList.getElementAt(_sideList.getSelectedIndex()).rna; + int selectedIndex = _sideList.getSelectedIndex(); + if (selectedIndex < 0) + { + return null; + } + FullBackup selected = _rnaList.getElementAt(selectedIndex); + return selected.rna; } /** @@ -408,123 +191,11 @@ public class AppVarnaBinding extends jalview.ext.varna.JalviewVarnaBinding vp.showRNA(rnaEdit); } - /* - * private void RNAPanelDemoInit() { DefaultListModel dlm = new - * DefaultListModel(); - * - * - * int marginTools = 40; - * - * DefaultListSelectionModel m = new DefaultListSelectionModel(); - * m.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - * m.setLeadAnchorNotificationEnabled(false); - * - * - * _sideList = new ReorderableJList(); _sideList.setModel(dlm); - * _sideList.addMouseListener(this); _sideList.setSelectionModel(m); - * _sideList.setPreferredSize(new Dimension(100, 0)); - * _sideList.addListSelectionListener( new ListSelectionListener(){ public - * void valueChanged(ListSelectionEvent arg0) { //System.out.println(arg0); if - * (!_sideList.isSelectionEmpty() && !arg0.getValueIsAdjusting()) { FullBackup - * sel = (FullBackup) _sideList.getSelectedValue(); Mapping map = - * Mapping.DefaultOutermostMapping(vp.getRNA().getSize(), sel.rna.getSize()); - * vp.showRNAInterpolated(sel.rna,sel.config,map); - * _seq.setText(sel.rna.getSeq()); _str.setText(sel.rna.getStructDBN()); } } - * }); - * - * _rnaList = new BackupHolder(dlm,_sideList); RNA _RNA1 = new - * RNA("User defined 1"); RNA _RNA2 = new RNA("User defined 2"); try { vp = - * new VARNAPanel("0","."); _RNA1.setRNA(DEFAULT_SEQUENCE, - * DEFAULT_STRUCTURE1); _RNA1.drawRNARadiate(vp.getConfig()); - * _RNA2.setRNA(DEFAULT_SEQUENCE, DEFAULT_STRUCTURE2); - * _RNA2.drawRNARadiate(vp.getConfig()); } catch (ExceptionNonEqualLength e) { - * vp.errorDialog(e); } catch (ExceptionUnmatchedClosingParentheses e2) { - * e2.printStackTrace(); } catch (ExceptionFileFormatOrSyntax e3) { - * e3.printStackTrace(); } vp.setPreferredSize(new Dimension(400, 400)); - * _rnaList.add(vp.getConfig().clone(),_RNA2,generateDefaultName()); - * _rnaList.add(vp.getConfig().clone(),_RNA1,generateDefaultName(),true); - * - * JScrollPane listScroller = new JScrollPane(_sideList); - * listScroller.setPreferredSize(new Dimension(150, 0)); - * - * setBackground(_backgroundColor); vp.setBackground(_backgroundColor); - * - * - * Font textFieldsFont = Font.decode("MonoSpaced-PLAIN-12"); - * - * _seqLabel.setHorizontalTextPosition(JLabel.LEFT); - * _seqLabel.setPreferredSize(new Dimension(marginTools, 15)); - * _seq.setFont(textFieldsFont); _seq.setText(DEFAULT_SEQUENCE); - * - * _createButton.addActionListener(new ActionListener() { public void - * actionPerformed(ActionEvent e) { try { RNA nRNA = new - * RNA(generateDefaultName()); nRNA.setRNA(_seq.getText(), _str.getText()); - * nRNA.drawRNARadiate(vp.getConfig()); _rnaList.add(new - * VARNAConfig(),nRNA,true); } catch (ExceptionUnmatchedClosingParentheses e1) - * { JOptionPane.showMessageDialog(vp, e1.getMessage(),"Error", - * JOptionPane.ERROR_MESSAGE); } catch (ExceptionFileFormatOrSyntax e1) { - * JOptionPane.showMessageDialog(vp, e1.getMessage(),"Error", - * JOptionPane.ERROR_MESSAGE); } } }); - * - * - * _seqPanel.setLayout(new BorderLayout()); _seqPanel.add(_seqLabel, - * BorderLayout.WEST); _seqPanel.add(_seq, BorderLayout.CENTER); - * - * _strLabel.setPreferredSize(new Dimension(marginTools, 15)); - * _strLabel.setHorizontalTextPosition(JLabel.LEFT); - * _str.setFont(textFieldsFont); _strPanel.setLayout(new BorderLayout()); - * _strPanel.add(_strLabel, BorderLayout.WEST); _strPanel.add(_str, - * BorderLayout.CENTER); - * - * _input.setLayout(new GridLayout(2, 0)); _input.add(_seqPanel); - * _input.add(_strPanel); - * - * JPanel goPanel = new JPanel(); goPanel.setLayout(new BorderLayout()); - * - * _tools.setLayout(new BorderLayout()); _tools.add(_input, - * BorderLayout.CENTER); _tools.add(_info, BorderLayout.SOUTH); - * _tools.add(goPanel, BorderLayout.EAST); - * - * _deleteButton.addActionListener(new ActionListener() { public void - * actionPerformed(ActionEvent e) { _rnaList.removeSelected(); } }); - * _duplicateButton.addActionListener(new ActionListener() { public void - * actionPerformed(ActionEvent e) { - * _rnaList.add((VARNAConfig)vp.getConfig().clone - * (),vp.getRNA().clone(),vp.getRNA - * ().getName()+"-"+DateFormat.getTimeInstance(DateFormat.LONG).format(new - * Date()),true); }}); - * - * JPanel ops = new JPanel(); ops.setLayout(new GridLayout(1,2)); - * ops.add(_deleteButton); ops.add(_duplicateButton); - * - * JLabel j = new JLabel("Structures Manager",JLabel.CENTER); - * _listPanel.setLayout(new BorderLayout()); - * - * _listPanel.add(ops,BorderLayout.SOUTH); - * _listPanel.add(j,BorderLayout.NORTH); - * _listPanel.add(listScroller,BorderLayout.CENTER); - * - * goPanel.add(_createButton, BorderLayout.CENTER); - * - * JSplitPane split = new - * JSplitPane(JSplitPane.HORIZONTAL_SPLIT,true,_listPanel,vp); - * getContentPane().setLayout(new BorderLayout()); getContentPane().add(split, - * BorderLayout.CENTER); getContentPane().add(_tools, BorderLayout.NORTH); - * - * setVisible(true); DropTarget dt = new DropTarget(vp, this); - * - * vp.addVARNAListener(this); } - */ public static String generateDefaultName() { return "User file #" + _nextID++; } - public RNA getRNA() - { - return (RNA) _sideList.getSelectedValue(); - } - public String[][] getParameterInfo() { String[][] info = @@ -537,12 +208,6 @@ public class AppVarnaBinding extends jalview.ext.varna.JalviewVarnaBinding return info; } - public void init() - { - vp.setBackground(_backgroundColor); - _error = true; - } - @SuppressWarnings("unused") private Color getSafeColor(String col, Color def) { @@ -573,60 +238,6 @@ public class AppVarnaBinding extends jalview.ext.varna.JalviewVarnaBinding vp = surface; } - public String get_seq() - { - return _seq.getText(); - } - - public void set_seq(String _seq) - { - this._seq.setText(_seq); - } - - public String get_str() - { - return _str.getText(); - } - - public void set_str(String _str) - { - this._str.setText(_str); - } - - public JLabel get_info() - { - return _info; - } - - public void set_info(JLabel _info) - { - this._info = _info; - } - - /* - * public static void main(String[] args) { AppVarnaBinding d = new - * AppVarnaBinding(); d.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - * d.pack(); d.setVisible(true); } - */ - - public void dragEnter(DropTargetDragEvent arg0) - { - // TODO Auto-generated method stub - - } - - public void dragExit(DropTargetEvent arg0) - { - // TODO Auto-generated method stub - - } - - public void dragOver(DropTargetDragEvent arg0) - { - // TODO Auto-generated method stub - - } - public void drop(DropTargetDropEvent dtde) { try @@ -653,7 +264,7 @@ public class AppVarnaBinding extends jalview.ext.varna.JalviewVarnaBinding if (c instanceof VARNAPanel) { String path = o.toString(); - VARNAPanel vp = (VARNAPanel) c; + VARNAPanel varnaPanel = (VARNAPanel) c; try { FullBackup bck = VARNAPanel.importSession(path); @@ -665,7 +276,7 @@ public class AppVarnaBinding extends jalview.ext.varna.JalviewVarnaBinding .loadSecStr(path); for (RNA r : mdls) { - r.drawRNA(vp.getConfig()); + r.drawRNA(varnaPanel.getConfig()); String name = r.getName(); if (name.equals("")) { @@ -676,7 +287,7 @@ public class AppVarnaBinding extends jalview.ext.varna.JalviewVarnaBinding { name += " (Model " + mn++ + ")"; } - _rnaList.add(vp.getConfig().clone(), r, name, true); + _rnaList.add(varnaPanel.getConfig().clone(), r, name, true); } } } @@ -698,147 +309,67 @@ public class AppVarnaBinding extends jalview.ext.varna.JalviewVarnaBinding } - public void dropActionChanged(DropTargetDragEvent arg0) - { - } - private class BackupHolder { - private DefaultListModel _rnaList; + private DefaultListModel _rnalist; - private ArrayList _rnas = new ArrayList(); + private List _rnas = new ArrayList(); JList _l; - public BackupHolder(DefaultListModel rnaList, JList l) + public BackupHolder(DefaultListModel rnaList, JList l) { - _rnaList = rnaList; + _rnalist = rnaList; _l = l; } - public void add(VARNAConfig c, RNA r) - { - add(c, r, r.getName(), false); - } - - public void add(VARNAConfig c, RNA r, boolean select) - { - add(c, r, r.getName(), select); - } - public void add(VARNAConfig c, RNA r, String name) { add(c, r, name, false); } + /** + * Adds an entry to the end of the selection list and (optionally) sets it + * as selected + * + * @param c + * @param r + * @param name + * @param select + */ public void add(VARNAConfig c, RNA r, String name, boolean select) { if (select) { - _l.removeSelectionInterval(0, _rnaList.size()); + _l.removeSelectionInterval(0, _rnalist.size()); } if (name.equals("")) { name = generateDefaultName(); } FullBackup bck = new FullBackup(c, r, name); - _rnas.add(0, r); - _rnaList.add(0, bck); + _rnas.add(r); + _rnalist.addElement(bck); if (select) { _l.setSelectedIndex(0); } } - public void remove(int i) - { - _rnas.remove(i); - _rnaList.remove(i); - - } - - public DefaultListModel getModel() - { - return _rnaList; - } - - public boolean contains(RNA r) - { - return _rnas.contains(r); - } - - /* - * public int getSize() { return _rnaList.getSize(); } - */ public FullBackup getElementAt(int i) { - return (FullBackup) _rnaList.getElementAt(i); - } - - public void removeSelected() - { - int i = _l.getSelectedIndex(); - if (i != -1) - { - if (_rnaList.getSize() == 1) - { - RNA r = new RNA(); - try - { - r.setRNA(" ", "."); - } catch (ExceptionUnmatchedClosingParentheses e1) - { - } catch (ExceptionFileFormatOrSyntax e1) - { - } - vp.showRNA(r); - vp.repaint(); - } - else - { - int newi = i + 1; - if (newi == _rnaList.getSize()) - { - newi = _rnaList.getSize() - 2; - } - FullBackup bck = (FullBackup) _rnaList.getElementAt(newi); - _l.setSelectedValue(bck, true); - } - _rnaList.remove(i); - } - + return _rnalist.getElementAt(i); } } - public void onLayoutChanged() - { - // TODO Auto-generated method stub - - } - - public void onUINewStructure(VARNAConfig v, RNA r) - { - // patch to fix infinite loop - // The problem is that onUINewStructure is called when user clicks - // check with Yann about whether Jalview should do anything with this event. - // e.g. if user has used VARNA's menu to import a structure .. Jalview may - // need to be told which structure is displayed. - - // _rnaList.add(v, r, "", true); - } - - public void onWarningEmitted(String s) - { - } - public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { int index = _sideList.locationToIndex(e.getPoint()); - ListModel dlm = _sideList.getModel(); - FullBackup item = (FullBackup) dlm.getElementAt(index); - ; + ListModel dlm = _sideList.getModel(); + // FullBackup item = dlm.getElementAt(index); + _sideList.ensureIndexIsVisible(index); /* * TODO Object newName = JOptionPane.showInputDialog( this, @@ -850,22 +381,6 @@ public class AppVarnaBinding extends jalview.ext.varna.JalviewVarnaBinding } } - public void mouseEntered(MouseEvent arg0) - { - } - - public void mouseExited(MouseEvent arg0) - { - } - - public void mousePressed(MouseEvent arg0) - { - } - - public void mouseReleased(MouseEvent arg0) - { - } - @Override public String[] getPdbFile() { @@ -903,28 +418,157 @@ public class AppVarnaBinding extends jalview.ext.varna.JalviewVarnaBinding } @Override - public void onStructureRedrawn() + public void highlightAtoms(List atoms) { } @Override - public void onZoomLevelChanged() + public boolean isListeningFor(SequenceI seq) { + return true; } - @Override - public void onTranslationChanged() + /** + * Returns the path to a temporary file containing a representation of the + * state of the Varna display, or null on any error + * + * @param rna + * @param jds + * + * @return + */ + public String getStateInfo(RNA rna) { + if (vp == null) + { + return null; + } + + /* + * we have to show the RNA we want to save in the viewer; get the currently + * displayed model first so we can restore it + */ + FullBackup sel = (FullBackup) _sideList.getSelectedValue(); + + FullBackup model = null; + ListModel models = _sideList.getModel(); + for (int i = 0; i < models.getSize(); i++) + { + model = (FullBackup) models.getElementAt(i); + if (model.rna == rna) + { + break; + } + } + if (model == null) + { + return null; + } + + /* + * switch display + */ + vp.showRNA(model.rna, model.config); + + try + { + File temp; + temp = File.createTempFile("varna", null); + temp.deleteOnExit(); + String filePath = temp.getAbsolutePath(); + vp.toXML(filePath); + + /* + * restore the previous display + */ + vp.showRNA(sel.rna, sel.config); + + return filePath; + } catch (IOException e) + { + return null; + } } - @Override - public void highlightAtoms(List atoms) + public int getSelectedIndex() { + return _sideList.getSelectedIndex(); } - @Override - public boolean isListeningFor(SequenceI seq) + /** + * Switch the Varna display to the structure selected in the left hand panel + * + * @param evt + */ + protected void changeSelectedStructure_actionPerformed(ListSelectionEvent evt) { - return true; + if (!evt.getValueIsAdjusting()) + { + showSelectedStructure(); + } + } + + /** + * + */ + protected void showSelectedStructure() + { + FullBackup sel = (FullBackup) _sideList.getSelectedValue(); + if (sel != null) + { + vp.showRNA(sel.rna, sel.config); + } + } + + /** + * Set and display the selected item in the list of structures + * + * @param selectedRna + */ + public void setSelectedIndex(final int selectedRna) + { + /* + * note this does nothing if, say, selecting item 3 when only 1 has been + * added on load + */ + _sideList.setSelectedIndex(selectedRna); + // TODO ? need a worker thread to get this to happen properly + } + + /** + * Add an RNA structure to the selection list + * + * @param rna + */ + public void addStructure(RNA rna) + { + VARNAConfig config = vp.getConfig().clone(); + addStructure(rna, config); + } + + /** + * @param rna + * @param config + */ + protected void addStructure(final RNA rna, final VARNAConfig config) + { + drawRna(rna, config); + _rnaList.add(config, rna, rna.getName()); + } + + /** + * @param rna + * @param config + */ + protected void drawRna(final RNA rna, final VARNAConfig config) + { + try + { + rna.drawRNA(rna.getDrawMode(), config); + } catch (ExceptionNAViewAlgorithm e) + { + // only throwable for draw mode = 3 NAView + System.err.println("Error drawing RNA: " + e.getMessage()); + } } } diff --git a/src/jalview/gui/ChimeraViewFrame.java b/src/jalview/gui/ChimeraViewFrame.java index 1e6da78..f644e95 100644 --- a/src/jalview/gui/ChimeraViewFrame.java +++ b/src/jalview/gui/ChimeraViewFrame.java @@ -1378,11 +1378,10 @@ public class ChimeraViewFrame extends StructureViewerBase is.close(); } catch (IOException e) { - // ignoreß + // ignore } } } - // return this.chimeraSessionFile == null ? "" : chimeraSessionFile; } @Override diff --git a/src/jalview/gui/CutAndPasteTransfer.java b/src/jalview/gui/CutAndPasteTransfer.java index 7268ae5..e08bfcd 100644 --- a/src/jalview/gui/CutAndPasteTransfer.java +++ b/src/jalview/gui/CutAndPasteTransfer.java @@ -23,6 +23,8 @@ package jalview.gui; import jalview.api.AlignViewportI; import jalview.api.AlignmentViewPanel; import jalview.api.ComplexAlignFile; +import jalview.api.FeaturesDisplayedI; +import jalview.bin.Jalview; import jalview.datamodel.AlignmentI; import jalview.datamodel.ColumnSelection; import jalview.datamodel.SequenceI; @@ -194,7 +196,28 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer */ public void ok_actionPerformed(ActionEvent e) { - String format = new IdentifyFile().Identify(getText(), "Paste"); + String text = getText(); + if (text.trim().length() < 1) + { + return; + } + + String format = new IdentifyFile().Identify(text, "Paste"); + if (format == null || format.equalsIgnoreCase("EMPTY DATA FILE")) + { + System.err.println(MessageManager + .getString("label.null_or_unidentifiable_data")); + if (!Jalview.isHeadlessMode()) + { + JOptionPane.showMessageDialog(null, + MessageManager + .getString("label.null_or_unidentifiable_data"), + MessageManager.getString("label.unidentifiable_data"), + JOptionPane.ERROR_MESSAGE); + } + return; + } + // TODO: identify feature, annotation or tree file and parse appropriately. AlignmentI al = null; @@ -217,7 +240,7 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer } } - if (al != null) + if (al != null && al.hasValidSequence()) { String title = MessageManager.formatMessage( "label.input_cut_paste_params", new String[] @@ -239,11 +262,13 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer boolean showSeqFeatures = ((ComplexAlignFile) source) .isShowSeqFeatures(); ColourSchemeI cs = ((ComplexAlignFile) source).getColourScheme(); + FeaturesDisplayedI fd = ((ComplexAlignFile) source) + .getDisplayedFeatures(); af = new AlignFrame(al, hiddenSeqs, colSel, AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT); - af.getViewport().setShowSequenceFeatures(showSeqFeatures); + af.getViewport().setFeaturesDisplayed(fd); af.changeColour(cs); } else @@ -267,6 +292,22 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer } } } + else + { + System.err.println(MessageManager + .getString("label.null_or_invalid_alignment")); + if (!Jalview.isHeadlessMode()) + { + JOptionPane + .showMessageDialog( + null, + MessageManager + .getString("label.null_or_invalid_alignment"), + MessageManager + .getString("label.unable_to_create_alignment"), + JOptionPane.ERROR_MESSAGE); + } + } } diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index cc9daa1..6a95363 100644 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -1133,7 +1133,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements public void inputTextboxMenuItem_actionPerformed(AlignViewport viewport) { CutAndPasteTransfer cap = new CutAndPasteTransfer(); - cap.setForInput(viewport.getAlignPanel()); +// cap.setForInput(viewport.getAlignPanel()); + cap.setForInput(null); Desktop.addInternalFrame(cap, MessageManager.getString("label.cut_paste_alignmen_file"), true, 600, 500); @@ -2616,28 +2617,6 @@ public class Desktop extends jalview.jbgui.GDesktop implements (t0 = new Thread(discoverer)).start(); } - // ENFIN services are EOLed as of Jalview 2.8.1 release - if (false) - { - try - { - if (Cache.getDefault("SHOW_ENFIN_SERVICES", true)) - { - // EnfinEnvision web service menu entries are rebuild every time the - // menu is shown, so no changeSupport events are needed. - jalview.ws.EnfinEnvision2OneWay.getInstance(); - (t1 = new Thread(jalview.ws.EnfinEnvision2OneWay.getInstance())) - .start(); - } - } catch (Exception e) - { - Cache.log - .info("Exception when trying to launch Envision2 workflow discovery.", - e); - Cache.log.info(e.getStackTrace()); - } - } - if (Cache.getDefault("SHOW_JWS2_SERVICES", true)) { if (jalview.ws.jws2.Jws2Discoverer.getDiscoverer().isRunning()) diff --git a/src/jalview/gui/Jalview2XML.java b/src/jalview/gui/Jalview2XML.java index e443512..3b90bf6 100644 --- a/src/jalview/gui/Jalview2XML.java +++ b/src/jalview/gui/Jalview2XML.java @@ -20,45 +20,6 @@ */ package jalview.gui; -import java.awt.Rectangle; -import java.io.BufferedReader; -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.OutputStreamWriter; -import java.io.PrintWriter; -import java.lang.reflect.InvocationTargetException; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Hashtable; -import java.util.IdentityHashMap; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.StringTokenizer; -import java.util.Vector; -import java.util.jar.JarEntry; -import java.util.jar.JarInputStream; -import java.util.jar.JarOutputStream; - -import javax.swing.JInternalFrame; -import javax.swing.JOptionPane; -import javax.swing.SwingUtilities; - -import org.exolab.castor.xml.Marshaller; -import org.exolab.castor.xml.Unmarshaller; - import jalview.api.structures.JalviewStructureDisplayI; import jalview.bin.Cache; import jalview.datamodel.AlignedCodonFrame; @@ -66,9 +27,12 @@ import jalview.datamodel.Alignment; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; import jalview.datamodel.PDBEntry; +import jalview.datamodel.RnaViewerModel; +import jalview.datamodel.SequenceGroup; import jalview.datamodel.SequenceI; import jalview.datamodel.StructureViewerModel; import jalview.datamodel.StructureViewerModel.StructureData; +import jalview.ext.varna.RnaModel; import jalview.gui.StructureViewer.ViewerType; import jalview.schemabinding.version2.AlcodMap; import jalview.schemabinding.version2.AlcodonFrame; @@ -92,6 +56,8 @@ import jalview.schemabinding.version2.OtherData; import jalview.schemabinding.version2.PdbentryItem; import jalview.schemabinding.version2.Pdbids; import jalview.schemabinding.version2.Property; +import jalview.schemabinding.version2.RnaViewer; +import jalview.schemabinding.version2.SecondaryStructure; import jalview.schemabinding.version2.Sequence; import jalview.schemabinding.version2.SequenceSet; import jalview.schemabinding.version2.SequenceSetProperties; @@ -123,6 +89,45 @@ import jalview.ws.params.ArgumentI; import jalview.ws.params.AutoCalcSetting; import jalview.ws.params.WsParamSetI; +import java.awt.Rectangle; +import java.io.BufferedReader; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.io.PrintWriter; +import java.lang.reflect.InvocationTargetException; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Hashtable; +import java.util.IdentityHashMap; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import java.util.StringTokenizer; +import java.util.Vector; +import java.util.jar.JarEntry; +import java.util.jar.JarInputStream; +import java.util.jar.JarOutputStream; + +import javax.swing.JInternalFrame; +import javax.swing.JOptionPane; +import javax.swing.SwingUtilities; + +import org.exolab.castor.xml.Marshaller; +import org.exolab.castor.xml.Unmarshaller; + /** * Write out the current jalview desktop state as a Jalview XML stream. * @@ -135,8 +140,15 @@ import jalview.ws.params.WsParamSetI; */ public class Jalview2XML { + private static final String VIEWER_PREFIX = "viewer_"; + + private static final String RNA_PREFIX = "rna_"; + private static final String UTF_8 = "UTF-8"; + // use this with nextCounter() to make unique names for entities + private int counter = 0; + /* * SequenceI reference -> XML ID string in jalview XML. Populated as XML reps * of sequence objects are created. @@ -160,6 +172,12 @@ public class Jalview2XML */ private Map splitFrameCandidates = new HashMap(); + /* + * Map from displayed rna structure models to their saved session state jar + * entry names + */ + private Map rnaSessions = new HashMap(); + /** * create/return unique hash string for sq * @@ -369,7 +387,7 @@ public class Jalview2XML */ public void saveState(JarOutputStream jout) { - AlignFrame[] frames = Desktop.getAlignFrames(); // Desktop.desktop.getAllFrames(); + AlignFrame[] frames = Desktop.getAlignFrames(); if (frames == null) { @@ -378,6 +396,13 @@ public class Jalview2XML Hashtable dsses = new Hashtable(); + /* + * ensure cached data is clear before starting + */ + // todo tidy up seqRefIds, seqsToIds initialisation / reset + rnaSessions.clear(); + splitFrameCandidates.clear(); + try { @@ -385,6 +410,7 @@ public class Jalview2XML // ////////////////////////////////////////////////// List shortNames = new ArrayList(); + List viewIds = new ArrayList(); // REVERSE ORDER for (int i = frames.length - 1; i > -1; i--) @@ -411,7 +437,7 @@ public class Jalview2XML fileName = fileName + ".xml"; } - saveState(apanel, fileName, jout); + saveState(apanel, fileName, jout, viewIds); String dssid = getDatasetIdRef(af.getViewport().getAlignment() .getDataset()); @@ -497,6 +523,8 @@ public class Jalview2XML FileOutputStream fos = new FileOutputStream(jarFile); JarOutputStream jout = new JarOutputStream(fos); Hashtable dsses = new Hashtable(); + List viewIds = new ArrayList(); + for (AlignmentPanel apanel : af.alignPanels) { String jfileName = apSize == 1 ? fileName : fileName + ap; @@ -505,7 +533,7 @@ public class Jalview2XML { jfileName = jfileName + ".xml"; } - saveState(apanel, jfileName, jout); + saveState(apanel, jfileName, jout, viewIds); String dssid = getDatasetIdRef(af.getViewport().getAlignment() .getDataset()); if (!dsses.containsKey(dssid)) @@ -543,7 +571,7 @@ public class Jalview2XML { jfileName = jfileName + ".xml"; } - saveState(_af.alignPanel, jfileName, true, jout); + saveState(_af.alignPanel, jfileName, true, jout, null); } } @@ -557,13 +585,14 @@ public class Jalview2XML * name of alignment panel written to output stream * @param jout * jar output stream + * @param viewIds * @param out * jar entry name */ public JalviewModel saveState(AlignmentPanel ap, String fileName, - JarOutputStream jout) + JarOutputStream jout, List viewIds) { - return saveState(ap, fileName, false, jout); + return saveState(ap, fileName, false, jout, viewIds); } /** @@ -583,10 +612,15 @@ public class Jalview2XML * jar entry name */ public JalviewModel saveState(AlignmentPanel ap, String fileName, - boolean storeDS, JarOutputStream jout) + boolean storeDS, JarOutputStream jout, List viewIds) { + if (viewIds == null) + { + viewIds = new ArrayList(); + } + initSeqRefs(); - List viewIds = new ArrayList(); + List userColours = new ArrayList(); AlignViewport av = ap.av; @@ -638,14 +672,12 @@ public class Jalview2XML Set calcIdSet = new HashSet(); // SAVE SEQUENCES - String id = ""; - jalview.datamodel.SequenceI jds, jdatasq; for (int i = 0; i < jal.getHeight(); i++) { - jds = jal.getSequenceAt(i); - jdatasq = jds.getDatasetSequence() == null ? jds : jds - .getDatasetSequence(); - id = seqHash(jds); + final SequenceI jds = jal.getSequenceAt(i); + final SequenceI jdatasq = jds.getDatasetSequence() == null ? jds + : jds.getDatasetSequence(); + String id = seqHash(jds); if (seqRefIds.get(id) != null) { @@ -703,8 +735,7 @@ public class Jalview2XML if (jds.getSequenceFeatures() != null) { - jalview.datamodel.SequenceFeature[] sf = jds - .getSequenceFeatures(); + jalview.datamodel.SequenceFeature[] sf = jds.getSequenceFeatures(); int index = 0; while (index < sf.length) { @@ -774,8 +805,8 @@ public class Jalview2XML matchedFile = saveStructureState(ap, jds, pdb, entry, viewIds, matchedFile, viewFrame); /* - * Only store each structure viewer's state once in each XML - * document. First time through only (storeDS==false) + * Only store each structure viewer's state once in the project + * jar. First time through only (storeDS==false) */ String viewId = viewFrame.getViewId(); if (!storeDS && !viewIds.contains(viewId)) @@ -783,8 +814,9 @@ public class Jalview2XML viewIds.add(viewId); try { + String viewerState = viewFrame.getStateInfo(); writeJarEntry(jout, getViewerJarEntryName(viewId), - viewFrame.getStateInfo().getBytes()); + viewerState.getBytes()); } catch (IOException e) { System.err.println("Error saving viewer state: " @@ -834,6 +866,8 @@ public class Jalview2XML } } + saveRnaViewers(jout, jseq, jds, viewIds, ap, storeDS); + jms.addJSeq(jseq); } @@ -864,36 +898,36 @@ public class Jalview2XML } } -// { -// AlcodonFrame alc = new AlcodonFrame(); -// vamsasSet.addAlcodonFrame(alc); -// for (int p = 0; p < acf.aaWidth; p++) -// { -// Alcodon cmap = new Alcodon(); -// if (acf.codons[p] != null) -// { -// // Null codons indicate a gapped column in the translated peptide -// // alignment. -// cmap.setPos1(acf.codons[p][0]); -// cmap.setPos2(acf.codons[p][1]); -// cmap.setPos3(acf.codons[p][2]); -// } -// alc.addAlcodon(cmap); -// } -// if (acf.getProtMappings() != null -// && acf.getProtMappings().length > 0) -// { -// SequenceI[] dnas = acf.getdnaSeqs(); -// jalview.datamodel.Mapping[] pmaps = acf.getProtMappings(); -// for (int m = 0; m < pmaps.length; m++) -// { -// AlcodMap alcmap = new AlcodMap(); -// alcmap.setDnasq(seqHash(dnas[m])); -// alcmap.setMapping(createVamsasMapping(pmaps[m], dnas[m], null, -// false)); -// alc.addAlcodMap(alcmap); -// } -// } + // { + // AlcodonFrame alc = new AlcodonFrame(); + // vamsasSet.addAlcodonFrame(alc); + // for (int p = 0; p < acf.aaWidth; p++) + // { + // Alcodon cmap = new Alcodon(); + // if (acf.codons[p] != null) + // { + // // Null codons indicate a gapped column in the translated peptide + // // alignment. + // cmap.setPos1(acf.codons[p][0]); + // cmap.setPos2(acf.codons[p][1]); + // cmap.setPos3(acf.codons[p][2]); + // } + // alc.addAlcodon(cmap); + // } + // if (acf.getProtMappings() != null + // && acf.getProtMappings().length > 0) + // { + // SequenceI[] dnas = acf.getdnaSeqs(); + // jalview.datamodel.Mapping[] pmaps = acf.getProtMappings(); + // for (int m = 0; m < pmaps.length; m++) + // { + // AlcodMap alcmap = new AlcodMap(); + // alcmap.setDnasq(seqHash(dnas[m])); + // alcmap.setMapping(createVamsasMapping(pmaps[m], dnas[m], null, + // false)); + // alc.addAlcodMap(alcmap); + // } + // } } } @@ -942,35 +976,17 @@ public class Jalview2XML } } - /* - * Save associated Varna panels - */ - if (Desktop.desktop != null) - { - for (JInternalFrame frame : Desktop.desktop.getAllFrames()) - { - if (frame instanceof AppVarna) - { - AppVarna vp = (AppVarna) frame; - if (vp.ap == ap) - { - // save Varna state - } - } - } - } - // SAVE ANNOTATIONS /** * store forward refs from an annotationRow to any groups */ - IdentityHashMap groupRefs = new IdentityHashMap(); + IdentityHashMap groupRefs = new IdentityHashMap(); if (storeDS) { for (SequenceI sq : jal.getSequences()) { // Store annotation on dataset sequences only - jalview.datamodel.AlignmentAnnotation[] aa = sq.getAnnotation(); + AlignmentAnnotation[] aa = sq.getAnnotation(); if (aa != null && aa.length > 0) { storeAlignmentAnnotation(aa, groupRefs, av, calcIdSet, storeDS, @@ -983,8 +999,7 @@ public class Jalview2XML if (jal.getAlignmentAnnotation() != null) { // Store the annotation shown on the alignment. - jalview.datamodel.AlignmentAnnotation[] aa = jal - .getAlignmentAnnotation(); + AlignmentAnnotation[] aa = jal.getAlignmentAnnotation(); storeAlignmentAnnotation(aa, groupRefs, av, calcIdSet, storeDS, vamsasSet); } @@ -996,70 +1011,66 @@ public class Jalview2XML int i = -1; for (jalview.datamodel.SequenceGroup sg : jal.getGroups()) { - groups[++i] = new JGroup(); + JGroup jGroup = new JGroup(); + groups[++i] = jGroup; - groups[i].setStart(sg.getStartRes()); - groups[i].setEnd(sg.getEndRes()); - groups[i].setName(sg.getName()); + jGroup.setStart(sg.getStartRes()); + jGroup.setEnd(sg.getEndRes()); + jGroup.setName(sg.getName()); if (groupRefs.containsKey(sg)) { - // group has references so set it's ID field - groups[i].setId(groupRefs.get(sg).toString()); + // group has references so set its ID field + jGroup.setId(groupRefs.get(sg)); } if (sg.cs != null) { if (sg.cs.conservationApplied()) { - groups[i].setConsThreshold(sg.cs.getConservationInc()); + jGroup.setConsThreshold(sg.cs.getConservationInc()); if (sg.cs instanceof jalview.schemes.UserColourScheme) { - groups[i].setColour(setUserColourScheme(sg.cs, userColours, - jms)); + jGroup.setColour(setUserColourScheme(sg.cs, userColours, jms)); } else { - groups[i] - .setColour(ColourSchemeProperty.getColourName(sg.cs)); + jGroup.setColour(ColourSchemeProperty.getColourName(sg.cs)); } } else if (sg.cs instanceof jalview.schemes.AnnotationColourGradient) { - groups[i].setColour("AnnotationColourGradient"); - groups[i].setAnnotationColours(constructAnnotationColours( + jGroup.setColour("AnnotationColourGradient"); + jGroup.setAnnotationColours(constructAnnotationColours( (jalview.schemes.AnnotationColourGradient) sg.cs, userColours, jms)); } else if (sg.cs instanceof jalview.schemes.UserColourScheme) { - groups[i] - .setColour(setUserColourScheme(sg.cs, userColours, jms)); + jGroup.setColour(setUserColourScheme(sg.cs, userColours, jms)); } else { - groups[i].setColour(ColourSchemeProperty.getColourName(sg.cs)); + jGroup.setColour(ColourSchemeProperty.getColourName(sg.cs)); } - groups[i].setPidThreshold(sg.cs.getThreshold()); + jGroup.setPidThreshold(sg.cs.getThreshold()); } - groups[i].setOutlineColour(sg.getOutlineColour().getRGB()); - groups[i].setDisplayBoxes(sg.getDisplayBoxes()); - groups[i].setDisplayText(sg.getDisplayText()); - groups[i].setColourText(sg.getColourText()); - groups[i].setTextCol1(sg.textColour.getRGB()); - groups[i].setTextCol2(sg.textColour2.getRGB()); - groups[i].setTextColThreshold(sg.thresholdTextColour); - groups[i].setShowUnconserved(sg.getShowNonconserved()); - groups[i].setIgnoreGapsinConsensus(sg.getIgnoreGapsConsensus()); - groups[i].setShowConsensusHistogram(sg.isShowConsensusHistogram()); - groups[i].setShowSequenceLogo(sg.isShowSequenceLogo()); - groups[i].setNormaliseSequenceLogo(sg.isNormaliseSequenceLogo()); - for (int s = 0; s < sg.getSize(); s++) - { - jalview.datamodel.Sequence seq = (jalview.datamodel.Sequence) sg - .getSequenceAt(s); - groups[i].addSeq(seqHash(seq)); + jGroup.setOutlineColour(sg.getOutlineColour().getRGB()); + jGroup.setDisplayBoxes(sg.getDisplayBoxes()); + jGroup.setDisplayText(sg.getDisplayText()); + jGroup.setColourText(sg.getColourText()); + jGroup.setTextCol1(sg.textColour.getRGB()); + jGroup.setTextCol2(sg.textColour2.getRGB()); + jGroup.setTextColThreshold(sg.thresholdTextColour); + jGroup.setShowUnconserved(sg.getShowNonconserved()); + jGroup.setIgnoreGapsinConsensus(sg.getIgnoreGapsConsensus()); + jGroup.setShowConsensusHistogram(sg.isShowConsensusHistogram()); + jGroup.setShowSequenceLogo(sg.isShowSequenceLogo()); + jGroup.setNormaliseSequenceLogo(sg.isNormaliseSequenceLogo()); + for (SequenceI seq : sg.getSequences()) + { + jGroup.addSeq(seqHash(seq)); } } @@ -1195,8 +1206,8 @@ public class Jalview2XML else { setting.setColour(ap.getSeqPanel().seqCanvas - .getFeatureRenderer() - .getColour(renderOrder[ro]).getRGB()); + .getFeatureRenderer().getColour(renderOrder[ro]) + .getRGB()); } setting.setDisplay(av.getFeaturesDisplayed().isVisible( @@ -1310,6 +1321,7 @@ public class Jalview2XML // using save and then load try { + System.out.println("Writing jar entry " + fileName); JarEntry entry = new JarEntry(fileName); jout.putNextEntry(entry); PrintWriter pout = new PrintWriter(new OutputStreamWriter(jout, @@ -1328,14 +1340,112 @@ public class Jalview2XML } /** - * Copy the contents of a file to a new file added to the output jar + * Save any Varna viewers linked to this sequence. Writes an rnaViewer element + * for each viewer, with + *

      + *
    • viewer geometry (position, size, split pane divider location)
    • + *
    • index of the selected structure in the viewer (currently shows gapped + * or ungapped)
    • + *
    • the id of the annotation holding RNA secondary structure
    • + *
    • (currently only one SS is shown per viewer, may be more in future)
    • + *
    + * Varna viewer state is also written out (in native Varna XML) to separate + * project jar entries. A separate entry is written for each RNA structure + * displayed, with the naming convention + *
      + *
    • rna_viewId_sequenceId_annotationId_[gapped|trimmed]
    • + *
    + * + * @param jout + * @param jseq + * @param jds + * @param viewIds + * @param ap + * @param storeDataset + */ + protected void saveRnaViewers(JarOutputStream jout, JSeq jseq, + final SequenceI jds, List viewIds, AlignmentPanel ap, + boolean storeDataset) + { + if (Desktop.desktop == null) + { + return; + } + JInternalFrame[] frames = Desktop.desktop.getAllFrames(); + for (int f = frames.length - 1; f > -1; f--) + { + if (frames[f] instanceof AppVarna) + { + AppVarna varna = (AppVarna) frames[f]; + /* + * link the sequence to every viewer that is showing it and is linked to + * its alignment panel + */ + if (varna.isListeningFor(jds) && ap == varna.getAlignmentPanel()) + { + String viewId = varna.getViewId(); + RnaViewer rna = new RnaViewer(); + rna.setViewId(viewId); + rna.setTitle(varna.getTitle()); + rna.setXpos(varna.getX()); + rna.setYpos(varna.getY()); + rna.setWidth(varna.getWidth()); + rna.setHeight(varna.getHeight()); + rna.setDividerLocation(varna.getDividerLocation()); + rna.setSelectedRna(varna.getSelectedIndex()); + jseq.addRnaViewer(rna); + + /* + * Store each Varna panel's state once in the project per sequence. + * First time through only (storeDataset==false) + */ + // boolean storeSessions = false; + // String sequenceViewId = viewId + seqsToIds.get(jds); + // if (!storeDataset && !viewIds.contains(sequenceViewId)) + // { + // viewIds.add(sequenceViewId); + // storeSessions = true; + // } + for (RnaModel model : varna.getModels()) + { + if (model.seq == jds) + { + /* + * VARNA saves each view (sequence or alignment secondary + * structure, gapped or trimmed) as a separate XML file + */ + String jarEntryName = rnaSessions.get(model); + if (jarEntryName == null) + { + + String varnaStateFile = varna.getStateInfo(model.rna); + jarEntryName = RNA_PREFIX + viewId + "_" + nextCounter(); + copyFileToJar(jout, varnaStateFile, jarEntryName); + rnaSessions.put(model, jarEntryName); + } + SecondaryStructure ss = new SecondaryStructure(); + String annotationId = varna.getAnnotation(jds).annotationId; + ss.setAnnotationId(annotationId); + ss.setViewerState(jarEntryName); + ss.setGapped(model.gapped); + ss.setTitle(model.title); + rna.addSecondaryStructure(ss); + } + } + } + } + } + } + + /** + * Copy the contents of a file to a new entry added to the output jar * * @param jout * @param infilePath - * @param jarfileName + * @param jarEntryName */ protected void copyFileToJar(JarOutputStream jout, String infilePath, - String jarfileName) + String jarEntryName) { DataInputStream dis = null; try @@ -1346,7 +1456,7 @@ public class Jalview2XML dis = new DataInputStream(new FileInputStream(file)); byte[] data = new byte[(int) file.length()]; dis.readFully(data); - writeJarEntry(jout, jarfileName, data); + writeJarEntry(jout, jarEntryName, data); } } catch (Exception ex) { @@ -1370,16 +1480,17 @@ public class Jalview2XML * Write the data to a new entry of given name in the output jar file * * @param jout - * @param jarfileName + * @param jarEntryName * @param data * @throws IOException */ - protected void writeJarEntry(JarOutputStream jout, String jarfileName, + protected void writeJarEntry(JarOutputStream jout, String jarEntryName, byte[] data) throws IOException { if (jout != null) { - jout.putNextEntry(new JarEntry(jarfileName)); + System.out.println("Writing jar entry " + jarEntryName); + jout.putNextEntry(new JarEntry(jarEntryName)); DataOutputStream dout = new DataOutputStream(jout); dout.write(data, 0, data.length); dout.flush(); @@ -1490,62 +1601,65 @@ public class Jalview2XML } private void storeAlignmentAnnotation(AlignmentAnnotation[] aa, - IdentityHashMap groupRefs, AlignmentViewport av, - Set calcIdSet, boolean storeDS, SequenceSet vamsasSet) + IdentityHashMap groupRefs, + AlignmentViewport av, Set calcIdSet, boolean storeDS, + SequenceSet vamsasSet) { for (int i = 0; i < aa.length; i++) { Annotation an = new Annotation(); - if (aa[i].annotationId != null) + AlignmentAnnotation annotation = aa[i]; + if (annotation.annotationId != null) { - annotationIds.put(aa[i].annotationId, aa[i]); + annotationIds.put(annotation.annotationId, annotation); } - an.setId(aa[i].annotationId); + an.setId(annotation.annotationId); - an.setVisible(aa[i].visible); + an.setVisible(annotation.visible); - an.setDescription(aa[i].description); + an.setDescription(annotation.description); - if (aa[i].sequenceRef != null) + if (annotation.sequenceRef != null) { - // TODO later annotation sequenceRef should be the XML ID of the - // sequence rather than its display name - an.setSequenceRef(aa[i].sequenceRef.getName()); + // 2.9 JAL-1781 xref on sequence id rather than name + an.setSequenceRef(seqsToIds.get(annotation.sequenceRef)); } - if (aa[i].groupRef != null) + if (annotation.groupRef != null) { - Object groupIdr = groupRefs.get(aa[i].groupRef); + String groupIdr = groupRefs.get(annotation.groupRef); if (groupIdr == null) { // make a locally unique String - groupRefs.put(aa[i].groupRef, + groupRefs.put( + annotation.groupRef, groupIdr = ("" + System.currentTimeMillis() - + aa[i].groupRef.getName() + groupRefs.size())); + + annotation.groupRef.getName() + groupRefs + .size())); } an.setGroupRef(groupIdr.toString()); } // store all visualization attributes for annotation - an.setGraphHeight(aa[i].graphHeight); - an.setCentreColLabels(aa[i].centreColLabels); - an.setScaleColLabels(aa[i].scaleColLabel); - an.setShowAllColLabels(aa[i].showAllColLabels); - an.setBelowAlignment(aa[i].belowAlignment); + an.setGraphHeight(annotation.graphHeight); + an.setCentreColLabels(annotation.centreColLabels); + an.setScaleColLabels(annotation.scaleColLabel); + an.setShowAllColLabels(annotation.showAllColLabels); + an.setBelowAlignment(annotation.belowAlignment); - if (aa[i].graph > 0) + if (annotation.graph > 0) { an.setGraph(true); - an.setGraphType(aa[i].graph); - an.setGraphGroup(aa[i].graphGroup); - if (aa[i].getThreshold() != null) + an.setGraphType(annotation.graph); + an.setGraphGroup(annotation.graphGroup); + if (annotation.getThreshold() != null) { ThresholdLine line = new ThresholdLine(); - line.setLabel(aa[i].getThreshold().label); - line.setValue(aa[i].getThreshold().value); - line.setColour(aa[i].getThreshold().colour.getRGB()); + line.setLabel(annotation.getThreshold().label); + line.setValue(annotation.getThreshold().value); + line.setColour(annotation.getThreshold().colour.getRGB()); an.setThresholdLine(line); } } @@ -1554,78 +1668,78 @@ public class Jalview2XML an.setGraph(false); } - an.setLabel(aa[i].label); + an.setLabel(annotation.label); - if (aa[i] == av.getAlignmentQualityAnnot() - || aa[i] == av.getAlignmentConservationAnnotation() - || aa[i] == av.getAlignmentConsensusAnnotation() - || aa[i].autoCalculated) + if (annotation == av.getAlignmentQualityAnnot() + || annotation == av.getAlignmentConservationAnnotation() + || annotation == av.getAlignmentConsensusAnnotation() + || annotation.autoCalculated) { // new way of indicating autocalculated annotation - - an.setAutoCalculated(aa[i].autoCalculated); + an.setAutoCalculated(annotation.autoCalculated); } - if (aa[i].hasScore()) + if (annotation.hasScore()) { - an.setScore(aa[i].getScore()); + an.setScore(annotation.getScore()); } - if (aa[i].getCalcId() != null) + if (annotation.getCalcId() != null) { - calcIdSet.add(aa[i].getCalcId()); - an.setCalcId(aa[i].getCalcId()); + calcIdSet.add(annotation.getCalcId()); + an.setCalcId(annotation.getCalcId()); } - if (aa[i].hasProperties()) + if (annotation.hasProperties()) { - for (String pr : aa[i].getProperties()) + for (String pr : annotation.getProperties()) { Property prop = new Property(); prop.setName(pr); - prop.setValue(aa[i].getProperty(pr)); + prop.setValue(annotation.getProperty(pr)); an.addProperty(prop); } } AnnotationElement ae; - if (aa[i].annotations != null) + if (annotation.annotations != null) { an.setScoreOnly(false); - for (int a = 0; a < aa[i].annotations.length; a++) + for (int a = 0; a < annotation.annotations.length; a++) { - if ((aa[i] == null) || (aa[i].annotations[a] == null)) + if ((annotation == null) || (annotation.annotations[a] == null)) { continue; } ae = new AnnotationElement(); - if (aa[i].annotations[a].description != null) + if (annotation.annotations[a].description != null) { - ae.setDescription(aa[i].annotations[a].description); + ae.setDescription(annotation.annotations[a].description); } - if (aa[i].annotations[a].displayCharacter != null) + if (annotation.annotations[a].displayCharacter != null) { - ae.setDisplayCharacter(aa[i].annotations[a].displayCharacter); + ae.setDisplayCharacter(annotation.annotations[a].displayCharacter); } - if (!Float.isNaN(aa[i].annotations[a].value)) + if (!Float.isNaN(annotation.annotations[a].value)) { - ae.setValue(aa[i].annotations[a].value); + ae.setValue(annotation.annotations[a].value); } ae.setPosition(a); - if (aa[i].annotations[a].secondaryStructure > ' ') + if (annotation.annotations[a].secondaryStructure > ' ') { - ae.setSecondaryStructure(aa[i].annotations[a].secondaryStructure + ae.setSecondaryStructure(annotation.annotations[a].secondaryStructure + ""); } - if (aa[i].annotations[a].colour != null - && aa[i].annotations[a].colour != java.awt.Color.black) + if (annotation.annotations[a].colour != null + && annotation.annotations[a].colour != java.awt.Color.black) { - ae.setColour(aa[i].annotations[a].colour.getRGB()); + ae.setColour(annotation.annotations[a].colour.getRGB()); } an.addAnnotationElement(ae); - if (aa[i].autoCalculated) + if (annotation.autoCalculated) { // only write one non-null entry into the annotation row - // sufficient to get the visualization attributes necessary to @@ -1638,7 +1752,7 @@ public class Jalview2XML { an.setScoreOnly(true); } - if (!storeDS || (storeDS && !aa[i].autoCalculated)) + if (!storeDS || (storeDS && !annotation.autoCalculated)) { // skip autocalculated annotation - these are only provided for // alignments @@ -2058,7 +2172,7 @@ public class Jalview2XML }); } catch (Exception x) { - + System.err.println("Error loading alignment: " + x.getMessage()); } } return af; @@ -2174,13 +2288,7 @@ public class Jalview2XML } } while (jarentry != null); resolveFrefedSequences(); - } catch (java.io.FileNotFoundException ex) - { - ex.printStackTrace(); - errorMessage = "Couldn't locate Jalview XML file : " + file; - System.err.println("Exception whilst loading jalview XML file : " - + ex + "\n"); - } catch (java.net.UnknownHostException ex) + } catch (IOException ex) { ex.printStackTrace(); errorMessage = "Couldn't locate Jalview XML file : " + file; @@ -2307,7 +2415,8 @@ public class Jalview2XML .entrySet()) { AlignFrame af = candidate.getValue(); - if (!addedToSplitFrames.contains(af)) { + if (!addedToSplitFrames.contains(af)) + { Viewport view = candidate.getKey(); Desktop.addInternalFrame(af, view.getTitle(), view.getWidth(), view.getHeight()); @@ -2740,10 +2849,11 @@ public class Jalview2XML // //////////////////////////////// // LOAD ANNOTATIONS List autoAlan = new ArrayList(); - /** + + /* * store any annotations which forward reference a group's ID */ - Hashtable> groupAnnotRefs = new Hashtable>(); + Map> groupAnnotRefs = new Hashtable>(); if (vamsasSet.getAnnotationCount() > 0) { @@ -2751,39 +2861,42 @@ public class Jalview2XML for (int i = 0; i < an.length; i++) { + Annotation annotation = an[i]; + /** * test if annotation is automatically calculated for this view only */ boolean autoForView = false; - if (an[i].getLabel().equals("Quality") - || an[i].getLabel().equals("Conservation") - || an[i].getLabel().equals("Consensus")) + if (annotation.getLabel().equals("Quality") + || annotation.getLabel().equals("Conservation") + || annotation.getLabel().equals("Consensus")) { // Kludge for pre 2.5 projects which lacked the autocalculated flag autoForView = true; - if (!an[i].hasAutoCalculated()) + if (!annotation.hasAutoCalculated()) { - an[i].setAutoCalculated(true); + annotation.setAutoCalculated(true); } } if (autoForView - || (an[i].hasAutoCalculated() && an[i].isAutoCalculated())) + || (annotation.hasAutoCalculated() && annotation + .isAutoCalculated())) { // remove ID - we don't recover annotation from other views for // view-specific annotation - an[i].setId(null); + annotation.setId(null); } // set visiblity for other annotation in this view - if (an[i].getId() != null - && annotationIds.containsKey(an[i].getId())) + String annotationId = annotation.getId(); + if (annotationId != null && annotationIds.containsKey(annotationId)) { - AlignmentAnnotation jda = annotationIds.get(an[i].getId()); + AlignmentAnnotation jda = annotationIds.get(annotationId); // in principle Visible should always be true for annotation displayed // in multiple views - if (an[i].hasVisible()) + if (annotation.hasVisible()) { - jda.visible = an[i].getVisible(); + jda.visible = annotation.getVisible(); } al.addAnnotation(jda); @@ -2791,11 +2904,11 @@ public class Jalview2XML continue; } // Construct new annotation from model. - AnnotationElement[] ae = an[i].getAnnotationElement(); + AnnotationElement[] ae = annotation.getAnnotationElement(); jalview.datamodel.Annotation[] anot = null; java.awt.Color firstColour = null; int anpos; - if (!an[i].getScoreOnly()) + if (!annotation.getScoreOnly()) { anot = new jalview.datamodel.Annotation[al.getWidth()]; for (int aa = 0; aa < ae.length && aa < anot.length; aa++) @@ -2832,27 +2945,27 @@ public class Jalview2XML } jalview.datamodel.AlignmentAnnotation jaa = null; - if (an[i].getGraph()) + if (annotation.getGraph()) { float llim = 0, hlim = 0; // if (autoForView || an[i].isAutoCalculated()) { // hlim=11f; // } - jaa = new jalview.datamodel.AlignmentAnnotation(an[i].getLabel(), - an[i].getDescription(), anot, llim, hlim, - an[i].getGraphType()); + jaa = new jalview.datamodel.AlignmentAnnotation( + annotation.getLabel(), annotation.getDescription(), anot, + llim, hlim, annotation.getGraphType()); - jaa.graphGroup = an[i].getGraphGroup(); + jaa.graphGroup = annotation.getGraphGroup(); jaa._linecolour = firstColour; - if (an[i].getThresholdLine() != null) + if (annotation.getThresholdLine() != null) { - jaa.setThreshold(new jalview.datamodel.GraphLine(an[i] - .getThresholdLine().getValue(), an[i] + jaa.setThreshold(new jalview.datamodel.GraphLine(annotation + .getThresholdLine().getValue(), annotation .getThresholdLine().getLabel(), new java.awt.Color( - an[i].getThresholdLine().getColour()))); + annotation.getThresholdLine().getColour()))); } - if (autoForView || an[i].isAutoCalculated()) + if (autoForView || annotation.isAutoCalculated()) { // Hardwire the symbol display line to ensure that labels for // histograms are displayed @@ -2872,19 +2985,26 @@ public class Jalview2XML jaa.annotationId = an[i].getId(); } // recover sequence association - if (an[i].getSequenceRef() != null) + String sequenceRef = an[i].getSequenceRef(); + if (sequenceRef != null) { - if (al.findName(an[i].getSequenceRef()) != null) + // from 2.9 sequenceRef is to sequence id (JAL-1781) + SequenceI sequence = seqRefIds.get(sequenceRef); + if (sequence == null) { - jaa.createSequenceMapping(al.findName(an[i].getSequenceRef()), - 1, true); - al.findName(an[i].getSequenceRef()).addAlignmentAnnotation(jaa); + // in pre-2.9 projects sequence ref is to sequence name + sequence = al.findName(sequenceRef); + } + if (sequence != null) + { + jaa.createSequenceMapping(sequence, 1, true); + sequence.addAlignmentAnnotation(jaa); } } // and make a note of any group association if (an[i].getGroupRef() != null && an[i].getGroupRef().length() > 0) { - ArrayList aal = groupAnnotRefs + List aal = groupAnnotRefs .get(an[i].getGroupRef()); if (aal == null) { @@ -2958,37 +3078,37 @@ public class Jalview2XML boolean addAnnotSchemeGroup = false; for (int i = 0; i < groups.length; i++) { + JGroup jGroup = groups[i]; ColourSchemeI cs = null; - - if (groups[i].getColour() != null) + if (jGroup.getColour() != null) { - if (groups[i].getColour().startsWith("ucs")) + if (jGroup.getColour().startsWith("ucs")) { - cs = getUserColourScheme(jms, groups[i].getColour()); + cs = getUserColourScheme(jms, jGroup.getColour()); } - else if (groups[i].getColour().equals("AnnotationColourGradient") - && groups[i].getAnnotationColours() != null) + else if (jGroup.getColour().equals("AnnotationColourGradient") + && jGroup.getAnnotationColours() != null) { addAnnotSchemeGroup = true; cs = null; } else { - cs = ColourSchemeProperty.getColour(al, groups[i].getColour()); + cs = ColourSchemeProperty.getColour(al, jGroup.getColour()); } if (cs != null) { - cs.setThreshold(groups[i].getPidThreshold(), true); + cs.setThreshold(jGroup.getPidThreshold(), true); } } - Vector seqs = new Vector(); + Vector seqs = new Vector(); - for (int s = 0; s < groups[i].getSeqCount(); s++) + for (int s = 0; s < jGroup.getSeqCount(); s++) { - String seqId = groups[i].getSeq(s) + ""; - jalview.datamodel.SequenceI ts = seqRefIds.get(seqId); + String seqId = jGroup.getSeq(s) + ""; + SequenceI ts = seqRefIds.get(seqId); if (ts != null) { @@ -3001,36 +3121,35 @@ public class Jalview2XML continue; } - jalview.datamodel.SequenceGroup sg = new jalview.datamodel.SequenceGroup( - seqs, groups[i].getName(), cs, groups[i].getDisplayBoxes(), - groups[i].getDisplayText(), groups[i].getColourText(), - groups[i].getStart(), groups[i].getEnd()); + SequenceGroup sg = new SequenceGroup(seqs, jGroup.getName(), cs, + jGroup.getDisplayBoxes(), jGroup.getDisplayText(), + jGroup.getColourText(), jGroup.getStart(), jGroup.getEnd()); - sg.setOutlineColour(new java.awt.Color(groups[i].getOutlineColour())); + sg.setOutlineColour(new java.awt.Color(jGroup.getOutlineColour())); - sg.textColour = new java.awt.Color(groups[i].getTextCol1()); - sg.textColour2 = new java.awt.Color(groups[i].getTextCol2()); - sg.setShowNonconserved(groups[i].hasShowUnconserved() ? groups[i] + sg.textColour = new java.awt.Color(jGroup.getTextCol1()); + sg.textColour2 = new java.awt.Color(jGroup.getTextCol2()); + sg.setShowNonconserved(jGroup.hasShowUnconserved() ? jGroup .isShowUnconserved() : false); - sg.thresholdTextColour = groups[i].getTextColThreshold(); - if (groups[i].hasShowConsensusHistogram()) + sg.thresholdTextColour = jGroup.getTextColThreshold(); + if (jGroup.hasShowConsensusHistogram()) { - sg.setShowConsensusHistogram(groups[i].isShowConsensusHistogram()); + sg.setShowConsensusHistogram(jGroup.isShowConsensusHistogram()); } ; - if (groups[i].hasShowSequenceLogo()) + if (jGroup.hasShowSequenceLogo()) { - sg.setshowSequenceLogo(groups[i].isShowSequenceLogo()); + sg.setshowSequenceLogo(jGroup.isShowSequenceLogo()); } - if (groups[i].hasNormaliseSequenceLogo()) + if (jGroup.hasNormaliseSequenceLogo()) { - sg.setNormaliseSequenceLogo(groups[i].isNormaliseSequenceLogo()); + sg.setNormaliseSequenceLogo(jGroup.isNormaliseSequenceLogo()); } - if (groups[i].hasIgnoreGapsinConsensus()) + if (jGroup.hasIgnoreGapsinConsensus()) { - sg.setIgnoreGapsConsensus(groups[i].getIgnoreGapsinConsensus()); + sg.setIgnoreGapsConsensus(jGroup.getIgnoreGapsinConsensus()); } - if (groups[i].getConsThreshold() != 0) + if (jGroup.getConsThreshold() != 0) { jalview.analysis.Conservation c = new jalview.analysis.Conservation( "All", ResidueProperties.propHash, 3, @@ -3040,14 +3159,14 @@ public class Jalview2XML sg.cs.setConservation(c); } - if (groups[i].getId() != null && groupAnnotRefs.size() > 0) + if (jGroup.getId() != null && groupAnnotRefs.size() > 0) { // re-instate unique group/annotation row reference - ArrayList jaal = groupAnnotRefs - .get(groups[i].getId()); + List jaal = groupAnnotRefs.get(jGroup + .getId()); if (jaal != null) { - for (jalview.datamodel.AlignmentAnnotation jaa : jaal) + for (AlignmentAnnotation jaa : jaal) { jaa.groupRef = sg; if (jaa.autoCalculated) @@ -3072,8 +3191,8 @@ public class Jalview2XML if (addAnnotSchemeGroup) { // reconstruct the annotation colourscheme - sg.cs = constructAnnotationColour( - groups[i].getAnnotationColours(), null, al, jms, false); + sg.cs = constructAnnotationColour(jGroup.getAnnotationColours(), + null, al, jms, false); } } } @@ -3164,90 +3283,202 @@ public class Jalview2XML av = af.viewport; ap = af.alignPanel; } - // LOAD TREES - // ///////////////////////////////////// - if (loadTreesAndStructures && jms.getTreeCount() > 0) + + /* + * Load any trees, PDB structures and viewers + * + * Not done if flag is false (when this method is used for New View) + */ + if (loadTreesAndStructures) { - try + loadTrees(jms, view, af, av, ap); + loadPDBStructures(jprovider, jseqs, af, ap); + loadRnaViewers(jprovider, jseqs, ap); + } + // and finally return. + return af; + } + + /** + * Instantiate and link any saved RNA (Varna) viewers. The state of the Varna + * panel is restored from separate jar entries, two (gapped and trimmed) per + * sequence and secondary structure. + * + * Currently each viewer shows just one sequence and structure (gapped and + * trimmed), however this method is designed to support multiple sequences or + * structures in viewers if wanted in future. + * + * @param jprovider + * @param jseqs + * @param ap + */ + private void loadRnaViewers(jarInputStreamProvider jprovider, + JSeq[] jseqs, AlignmentPanel ap) + { + /* + * scan the sequences for references to viewers; create each one the first + * time it is referenced, add Rna models to existing viewers + */ + for (JSeq jseq : jseqs) + { + for (int i = 0; i < jseq.getRnaViewerCount(); i++) { - for (int t = 0; t < jms.getTreeCount(); t++) + RnaViewer viewer = jseq.getRnaViewer(i); + AppVarna appVarna = findOrCreateVarnaViewer(viewer, + uniqueSetSuffix, ap); + + for (int j = 0; j < viewer.getSecondaryStructureCount(); j++) { + SecondaryStructure ss = viewer.getSecondaryStructure(j); + SequenceI seq = seqRefIds.get(jseq.getId()); + AlignmentAnnotation ann = this.annotationIds.get(ss + .getAnnotationId()); - Tree tree = jms.getTree(t); + /* + * add the structure to the Varna display (with session state copied + * from the jar to a temporary file) + */ + boolean gapped = ss.isGapped(); + String rnaTitle = ss.getTitle(); + String sessionState = ss.getViewerState(); + String tempStateFile = copyJarEntry(jprovider, sessionState, + "varna"); + RnaModel rna = new RnaModel(rnaTitle, ann, seq, null, gapped); + appVarna.addModelSession(rna, rnaTitle, tempStateFile); + } + appVarna.setInitialSelection(viewer.getSelectedRna()); + } + } + } - TreePanel tp = (TreePanel) retrieveExistingObj(tree.getId()); - if (tp == null) - { - tp = af.ShowNewickTree( - new jalview.io.NewickFile(tree.getNewick()), - tree.getTitle(), tree.getWidth(), tree.getHeight(), - tree.getXpos(), tree.getYpos()); - if (tree.getId() != null) - { - // perhaps bind the tree id to something ? - } - } - else - { - // update local tree attributes ? - // TODO: should check if tp has been manipulated by user - if so its - // settings shouldn't be modified - tp.setTitle(tree.getTitle()); - tp.setBounds(new Rectangle(tree.getXpos(), tree.getYpos(), tree - .getWidth(), tree.getHeight())); - tp.av = av; // af.viewport; // TODO: verify 'associate with all - // views' - // works still - tp.treeCanvas.av = av; // af.viewport; - tp.treeCanvas.ap = ap; // af.alignPanel; + /** + * Locate and return an already instantiated matching AppVarna, or create one + * if not found + * + * @param viewer + * @param viewIdSuffix + * @param ap + * @return + */ + protected AppVarna findOrCreateVarnaViewer(RnaViewer viewer, + String viewIdSuffix, AlignmentPanel ap) + { + /* + * on each load a suffix is appended to the saved viewId, to avoid conflicts + * if load is repeated + */ + String postLoadId = viewer.getViewId() + viewIdSuffix; + for (JInternalFrame frame : getAllFrames()) + { + if (frame instanceof AppVarna) + { + AppVarna varna = (AppVarna) frame; + if (postLoadId.equals(varna.getViewId())) + { + // this viewer is already instantiated + // could in future here add ap as another 'parent' of the + // AppVarna window; currently just 1-to-many + return varna; + } + } + } - } - if (tp == null) - { - warn("There was a problem recovering stored Newick tree: \n" - + tree.getNewick()); - continue; - } + /* + * viewer not found - make it + */ + RnaViewerModel model = new RnaViewerModel(postLoadId, + viewer.getTitle(), viewer.getXpos(), viewer.getYpos(), + viewer.getWidth(), viewer.getHeight(), + viewer.getDividerLocation()); + AppVarna varna = new AppVarna(model, ap); - tp.fitToWindow.setState(tree.getFitToWindow()); - tp.fitToWindow_actionPerformed(null); + return varna; + } - if (tree.getFontName() != null) - { - tp.setTreeFont(new java.awt.Font(tree.getFontName(), tree - .getFontStyle(), tree.getFontSize())); - } - else + /** + * Load any saved trees + * + * @param jms + * @param view + * @param af + * @param av + * @param ap + */ + protected void loadTrees(JalviewModelSequence jms, Viewport view, + AlignFrame af, AlignViewport av, AlignmentPanel ap) + { + // TODO result of automated refactoring - are all these parameters needed? + try + { + for (int t = 0; t < jms.getTreeCount(); t++) + { + + Tree tree = jms.getTree(t); + + TreePanel tp = (TreePanel) retrieveExistingObj(tree.getId()); + if (tp == null) + { + tp = af.ShowNewickTree( + new jalview.io.NewickFile(tree.getNewick()), + tree.getTitle(), tree.getWidth(), tree.getHeight(), + tree.getXpos(), tree.getYpos()); + if (tree.getId() != null) { - tp.setTreeFont(new java.awt.Font(view.getFontName(), view - .getFontStyle(), tree.getFontSize())); + // perhaps bind the tree id to something ? } + } + else + { + // update local tree attributes ? + // TODO: should check if tp has been manipulated by user - if so its + // settings shouldn't be modified + tp.setTitle(tree.getTitle()); + tp.setBounds(new Rectangle(tree.getXpos(), tree.getYpos(), tree + .getWidth(), tree.getHeight())); + tp.av = av; // af.viewport; // TODO: verify 'associate with all + // views' + // works still + tp.treeCanvas.av = av; // af.viewport; + tp.treeCanvas.ap = ap; // af.alignPanel; - tp.showPlaceholders(tree.getMarkUnlinked()); - tp.showBootstrap(tree.getShowBootstrap()); - tp.showDistances(tree.getShowDistances()); + } + if (tp == null) + { + warn("There was a problem recovering stored Newick tree: \n" + + tree.getNewick()); + continue; + } - tp.treeCanvas.threshold = tree.getThreshold(); + tp.fitToWindow.setState(tree.getFitToWindow()); + tp.fitToWindow_actionPerformed(null); - if (tree.getCurrentTree()) - { - af.viewport.setCurrentTree(tp.getTree()); - } + if (tree.getFontName() != null) + { + tp.setTreeFont(new java.awt.Font(tree.getFontName(), tree + .getFontStyle(), tree.getFontSize())); + } + else + { + tp.setTreeFont(new java.awt.Font(view.getFontName(), view + .getFontStyle(), tree.getFontSize())); } - } catch (Exception ex) - { - ex.printStackTrace(); + tp.showPlaceholders(tree.getMarkUnlinked()); + tp.showBootstrap(tree.getShowBootstrap()); + tp.showDistances(tree.getShowDistances()); + + tp.treeCanvas.threshold = tree.getThreshold(); + + if (tree.getCurrentTree()) + { + af.viewport.setCurrentTree(tp.getTree()); + } } - } - // //LOAD STRUCTURES - if (loadTreesAndStructures) + } catch (Exception ex) { - loadStructures(jprovider, jseqs, af, ap); + ex.printStackTrace(); } - // and finally return. - return af; } /** @@ -3258,7 +3489,7 @@ public class Jalview2XML * @param af * @param ap */ - protected void loadStructures(jarInputStreamProvider jprovider, + protected void loadPDBStructures(jarInputStreamProvider jprovider, JSeq[] jseqs, AlignFrame af, AlignmentPanel ap) { /* @@ -3442,21 +3673,22 @@ public class Jalview2XML * @param af * @param jprovider */ - protected void createChimeraViewer(Entry viewerData, - AlignFrame af, + protected void createChimeraViewer( + Entry viewerData, AlignFrame af, jarInputStreamProvider jprovider) { StructureViewerModel data = viewerData.getValue(); - String chimeraSessionFile = data.getStateData(); + String chimeraSessionFile = data.getStateData(); /* * Copy Chimera session from jar entry "viewer_"+viewId to a temporary file * - * Note this is the 'saved' viewId as in the project file XML, _not_ the + * NB this is the 'saved' viewId as in the project file XML, _not_ the * 'uniquified' sviewid used to reconstruct the viewer here */ - chimeraSessionFile = copyJarEntry(jprovider, - getViewerJarEntryName(data.getViewId()), "chimera"); + String viewerJarEntryName = getViewerJarEntryName(data.getViewId()); + chimeraSessionFile = copyJarEntry(jprovider, viewerJarEntryName, + "chimera"); Set> fileData = data.getFileData() .entrySet(); @@ -3481,9 +3713,10 @@ public class Jalview2XML final SequenceI[][] seqsArray = allseqs.toArray(new SequenceI[allseqs .size()][]); String newViewId = viewerData.getKey(); + ChimeraViewFrame cvf = new ChimeraViewFrame(chimeraSessionFile, - af.alignPanel, pdbArray, - seqsArray, colourByChimera, colourBySequence, newViewId); + af.alignPanel, pdbArray, seqsArray, colourByChimera, + colourBySequence, newViewId); cvf.setSize(data.getWidth(), data.getHeight()); cvf.setLocation(data.getX(), data.getY()); } @@ -3572,16 +3805,23 @@ public class Jalview2XML newFileLoc.append(";"); } - if (newFileLoc.length() > 0) + if (newFileLoc.length() == 0) { - int histbug = newFileLoc.indexOf("history = "); + return; + } + int histbug = newFileLoc.indexOf("history = "); + if (histbug > -1) + { + /* + * change "history = [true|false];" to "history = [1|0];" + */ histbug += 10; int diff = histbug == -1 ? -1 : newFileLoc.indexOf(";", histbug); String val = (diff == -1) ? null : newFileLoc .substring(histbug, diff); if (val != null && val.length() >= 4) { - if (val.contains("e")) + if (val.contains("e")) // eh? what can it be? { if (val.trim().equals("true")) { @@ -3594,54 +3834,55 @@ public class Jalview2XML newFileLoc.replace(histbug, diff, val); } } + } - final String[] pdbf = pdbfilenames.toArray(new String[pdbfilenames - .size()]); - final String[] id = pdbids.toArray(new String[pdbids.size()]); - final SequenceI[][] sq = seqmaps - .toArray(new SequenceI[seqmaps.size()][]); - final String fileloc = newFileLoc.toString(); - final String sviewid = viewerData.getKey(); - final AlignFrame alf = af; - final Rectangle rect = new Rectangle(svattrib.getX(), - svattrib.getY(), svattrib.getWidth(), svattrib.getHeight()); - try + final String[] pdbf = pdbfilenames.toArray(new String[pdbfilenames + .size()]); + final String[] id = pdbids.toArray(new String[pdbids.size()]); + final SequenceI[][] sq = seqmaps + .toArray(new SequenceI[seqmaps.size()][]); + final String fileloc = newFileLoc.toString(); + final String sviewid = viewerData.getKey(); + final AlignFrame alf = af; + final Rectangle rect = new Rectangle(svattrib.getX(), svattrib.getY(), + svattrib.getWidth(), svattrib.getHeight()); + try + { + javax.swing.SwingUtilities.invokeAndWait(new Runnable() { - javax.swing.SwingUtilities.invokeAndWait(new Runnable() + @Override + public void run() { - @Override - public void run() + JalviewStructureDisplayI sview = null; + try { - JalviewStructureDisplayI sview = null; - try - { - sview = new StructureViewer(alf.alignPanel - .getStructureSelectionManager()).createView( - StructureViewer.ViewerType.JMOL, pdbf, id, sq, - alf.alignPanel, svattrib, fileloc, rect, sviewid); - addNewStructureViewer(sview); - } catch (OutOfMemoryError ex) + sview = new StructureViewer(alf.alignPanel + .getStructureSelectionManager()).createView( + StructureViewer.ViewerType.JMOL, pdbf, id, sq, + alf.alignPanel, svattrib, fileloc, rect, sviewid); + addNewStructureViewer(sview); + } catch (OutOfMemoryError ex) + { + new OOMWarning("restoring structure view for PDB id " + id, + (OutOfMemoryError) ex.getCause()); + if (sview != null && sview.isVisible()) { - new OOMWarning("restoring structure view for PDB id " + id, - (OutOfMemoryError) ex.getCause()); - if (sview != null && sview.isVisible()) - { - sview.closeViewer(false); - sview.setVisible(false); - sview.dispose(); - } + sview.closeViewer(false); + sview.setVisible(false); + sview.dispose(); } } - }); - } catch (InvocationTargetException ex) - { - warn("Unexpected error when opening Jmol view.", ex); + } + }); + } catch (InvocationTargetException ex) + { + warn("Unexpected error when opening Jmol view.", ex); - } catch (InterruptedException e) - { - // e.printStackTrace(); - } + } catch (InterruptedException e) + { + // e.printStackTrace(); } + } /** @@ -3653,7 +3894,7 @@ public class Jalview2XML */ protected String getViewerJarEntryName(String viewId) { - return "viewer_" + viewId; + return VIEWER_PREFIX + viewId; } /** @@ -3794,7 +4035,8 @@ public class Jalview2XML * @return true if version is development/null or evaluates to the same or * later X.Y.Z (where X,Y,Z are like [0-9]+b?[0-9]*) */ - private boolean isVersionStringLaterThan(String supported, String version) + protected boolean isVersionStringLaterThan(String supported, + String version) { if (version == null || version.equalsIgnoreCase("DEVELOPMENT BUILD") || version.equalsIgnoreCase("Test") @@ -4177,7 +4419,7 @@ public class Jalview2XML } } af.setMenusFromViewport(af.viewport); - + // TODO: we don't need to do this if the viewport is aready visible. /* * Add the AlignFrame to the desktop (it may be 'gathered' later), unless it @@ -4630,20 +4872,24 @@ public class Jalview2XML } } - java.util.Hashtable datasetIds = null; + /* + * TODO use AlignmentI here and in related methods - needs + * AlignmentI.getDataset() changed to return AlignmentI instead of Alignment + */ + Hashtable datasetIds = null; - java.util.IdentityHashMap dataset2Ids = null; + IdentityHashMap dataset2Ids = null; private Alignment getDatasetFor(String datasetId) { if (datasetIds == null) { - datasetIds = new Hashtable(); + datasetIds = new Hashtable(); return null; } if (datasetIds.containsKey(datasetId)) { - return (Alignment) datasetIds.get(datasetId); + return datasetIds.get(datasetId); } return null; } @@ -4652,7 +4898,7 @@ public class Jalview2XML { if (datasetIds == null) { - datasetIds = new Hashtable(); + datasetIds = new Hashtable(); } datasetIds.put(datasetId, dataset); } @@ -4663,7 +4909,7 @@ public class Jalview2XML * @param dataset * @return */ - private String getDatasetIdRef(jalview.datamodel.Alignment dataset) + private String getDatasetIdRef(Alignment dataset) { if (dataset.getDataset() != null) { @@ -4675,11 +4921,11 @@ public class Jalview2XML // make a new datasetId and record it if (dataset2Ids == null) { - dataset2Ids = new IdentityHashMap(); + dataset2Ids = new IdentityHashMap(); } else { - datasetId = (String) dataset2Ids.get(dataset); + datasetId = dataset2Ids.get(dataset); } if (datasetId == null) { @@ -4798,8 +5044,7 @@ public class Jalview2XML boolean keepSeqRefs) { initSeqRefs(); - jalview.schemabinding.version2.JalviewModel jm = saveState(ap, null, - null); + JalviewModel jm = saveState(ap, null, null, null); if (!keepSeqRefs) { @@ -5079,7 +5324,17 @@ public class Jalview2XML } } } - + return result; } + + /** + * Returns an incrementing counter (0, 1, 2...) + * + * @return + */ + private synchronized int nextCounter() + { + return counter++; + } } diff --git a/src/jalview/gui/PopupMenu.java b/src/jalview/gui/PopupMenu.java index 2aa8675..5699d9e 100644 --- a/src/jalview/gui/PopupMenu.java +++ b/src/jalview/gui/PopupMenu.java @@ -204,7 +204,7 @@ public class PopupMenu extends JPopupMenu JMenu jMenu1 = new JMenu(); - JMenuItem proteinStructureMenu = new JMenuItem(); + JMenuItem pdbStructureDialog = new JMenuItem(); JMenu rnaStructureMenu = new JMenu(); @@ -322,49 +322,55 @@ public class PopupMenu extends JPopupMenu makeReferenceSeq.setText("Mark as representative"); } - if (ap.av.getAlignment().isNucleotide() == false) + if (!ap.av.getAlignment().isNucleotide()) { remove(rnaStructureMenu); } - - if (ap.av.getAlignment().isNucleotide() == true) + else { - AlignmentAnnotation[] aa = ap.av.getAlignment() + int origCount = rnaStructureMenu.getItemCount(); + /* + * add menu items to 2D-render any alignment or sequence secondary + * structure annotation + */ + AlignmentAnnotation[] aas = ap.av.getAlignment() .getAlignmentAnnotation(); - for (int i = 0; aa != null && i < aa.length; i++) + if (aas != null) { - if (aa[i].isValidStruc() && aa[i].sequenceRef == null) + for (final AlignmentAnnotation aa : aas) { - final String rnastruc = aa[i].getRNAStruc(); - final String structureLine = aa[i].label + " (alignment)"; - menuItem = new JMenuItem(); - menuItem.setText(MessageManager.formatMessage( - "label.2d_rna_structure_line", new Object[] - { structureLine })); - menuItem.addActionListener(new java.awt.event.ActionListener() + if (aa.isValidStruc() && aa.sequenceRef == null) { - @Override - public void actionPerformed(ActionEvent e) + /* + * valid alignment RNA secondary structure annotation + */ + menuItem = new JMenuItem(); + menuItem.setText(MessageManager.formatMessage( + "label.2d_rna_structure_line", new Object[] + { aa.label })); + menuItem.addActionListener(new java.awt.event.ActionListener() { - new AppVarna(structureLine, seq, seq.getSequenceAsString(), - rnastruc, seq.getName(), ap); - System.out.println("end"); - } - }); - rnaStructureMenu.add(menuItem); + @Override + public void actionPerformed(ActionEvent e) + { + new AppVarna(seq, aa, ap); + } + }); + rnaStructureMenu.add(menuItem); + } } } - if (seq.getAnnotation() != null) { - AlignmentAnnotation seqAnno[] = seq.getAnnotation(); - for (int i = 0; i < seqAnno.length; i++) + AlignmentAnnotation seqAnns[] = seq.getAnnotation(); + for (final AlignmentAnnotation aa : seqAnns) { - if (seqAnno[i].isValidStruc()) + if (aa.isValidStruc()) { - final String rnastruc = seqAnno[i].getRNAStruc(); - + /* + * valid sequence RNA secondary structure annotation + */ // TODO: make rnastrucF a bit more nice menuItem = new JMenuItem(); menuItem.setText(MessageManager.formatMessage( @@ -376,16 +382,17 @@ public class PopupMenu extends JPopupMenu public void actionPerformed(ActionEvent e) { // TODO: VARNA does'nt print gaps in the sequence - - new AppVarna(seq.getName() + " structure", seq, seq - .getSequenceAsString(), rnastruc, seq.getName(), - ap); + new AppVarna(seq, aa, ap); } }); rnaStructureMenu.add(menuItem); } } } + if (rnaStructureMenu.getItemCount() == origCount) + { + remove(rnaStructureMenu); + } } menuItem = new JMenuItem( @@ -598,7 +605,7 @@ public class PopupMenu extends JPopupMenu if (seq == null) { sequenceMenu.setVisible(false); - proteinStructureMenu.setVisible(false); + pdbStructureDialog.setVisible(false); rnaStructureMenu.setVisible(false); } @@ -1340,9 +1347,9 @@ public class PopupMenu extends JPopupMenu } }); jMenu1.setText(MessageManager.getString("label.group")); - proteinStructureMenu.setText(MessageManager - .getString("label.view_protein_structure")); - proteinStructureMenu.addActionListener(new ActionListener() + pdbStructureDialog.setText(MessageManager + .getString("label.show_pdbstruct_dialog")); + pdbStructureDialog.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) @@ -1403,7 +1410,7 @@ public class PopupMenu extends JPopupMenu add(groupMenu); add(sequenceMenu); add(rnaStructureMenu); - add(proteinStructureMenu); + add(pdbStructureDialog); if (sequence!=null) { add(hideInsertions); @@ -2395,7 +2402,7 @@ public class PopupMenu extends JPopupMenu // or we simply trust the user wants // wysiwig behaviour - cap.setText(new FormatAdapter().formatSequences(e.getActionCommand(), + cap.setText(new FormatAdapter(ap).formatSequences(e.getActionCommand(), ap, true)); } diff --git a/src/jalview/gui/ProgressBar.java b/src/jalview/gui/ProgressBar.java index 5307f26..c7db535 100644 --- a/src/jalview/gui/ProgressBar.java +++ b/src/jalview/gui/ProgressBar.java @@ -1,5 +1,7 @@ package jalview.gui; +import jalview.util.MessageManager; + import java.awt.BorderLayout; import java.awt.Component; import java.awt.GridLayout; @@ -14,8 +16,6 @@ import javax.swing.JPanel; import javax.swing.JProgressBar; import javax.swing.SwingUtilities; -import jalview.util.MessageManager; - /** * A class to manage multiple progress bars embedded in a JPanel. */ diff --git a/src/jalview/gui/ScriptWindow.java b/src/jalview/gui/ScriptWindow.java deleted file mode 100644 index 972e5ef..0000000 --- a/src/jalview/gui/ScriptWindow.java +++ /dev/null @@ -1,739 +0,0 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) - * Copyright (C) $$Year-Rel$$ The Jalview Authors - * - * This file is part of Jalview. - * - * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. - * - * Jalview is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Jalview. If not, see . - * The Jalview Authors are detailed in the 'AUTHORS' file. - */ -package jalview.gui; - -import org.jmol.api.*; - -import jalview.jbgui.GStructureViewer; - -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; - -// TODO: this class is copied in from jmol 11.0.2 - upgrade to 12.0.2 ? -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; - - GStructureViewer appJmol; - - public ScriptWindow(AppJmol appJmol) - { - this.viewer = appJmol.jmb.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 < buttonPanel.getComponentCount(); i++) - { - // ((JButton)buttonPanel.getComponent(i)) - // .setMargin(new Insets(0, 0, 0, 0)); - } - - } - - public void sendConsoleEcho(String strEcho) - { - if (strEcho != null && !isError) - { - - console.outputEcho(strEcho); - - } - setError(false); - } - - boolean isError = false; - - void setError(boolean TF) - { - isError = TF; - // if (isError) - // console.recallCommand(true); - } - - public void sendConsoleMessage(String strStatus) - { - if (strStatus == null) - { - console.clearContent(); - console.outputStatus(""); - } - else if (strStatus.indexOf("ERROR:") >= 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, true)) - 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/SequenceRenderer.java b/src/jalview/gui/SequenceRenderer.java index 70acb7b..21286ad 100755 --- a/src/jalview/gui/SequenceRenderer.java +++ b/src/jalview/gui/SequenceRenderer.java @@ -323,11 +323,17 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer { boolean srep = av.isDisplayReferenceSeq(); boolean getboxColour = false; + boolean isarep = av.getAlignment().getSeqrep() == seq; + boolean isgrep = currentSequenceGroup != null ? currentSequenceGroup + .getSeqrep() == seq : false; + char sr_c; for (int i = start; i <= end; i++) { + graphics.setColor(av.getTextColour()); getboxColour = false; s = seq.getCharAt(i); + if (!renderGaps && jalview.util.Comparison.isGap(s)) { continue; @@ -364,11 +370,12 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer { graphics.setColor(currentSequenceGroup.textColour); } - if (currentSequenceGroup.getShowNonconserved()) // todo optimize + if (!isarep && !isgrep + && currentSequenceGroup.getShowNonconserved()) // todo + // optimize { // todo - use sequence group consensus - s = getDisplayChar(srep, i, s, - '.'); + s = getDisplayChar(srep, i, s, '.', currentSequenceGroup); } @@ -408,10 +415,9 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer graphics.setColor(av.getTextColour2()); } } - if (av.getShowUnconserved()) + if (!isarep && av.getShowUnconserved()) { - s = getDisplayChar(srep, i, s, - '.'); + s = getDisplayChar(srep, i, s, '.', currentSequenceGroup); } @@ -438,12 +444,20 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer * @return */ private char getDisplayChar(final boolean usesrep, int position, - char sequenceChar, char conservedChar) + char sequenceChar, char conservedChar, SequenceGroup currentGroup) { // TODO - use currentSequenceGroup rather than alignment // currentSequenceGroup.getConsensus() - char conschar = (usesrep) ? av.getAlignment().getSeqrep().getCharAt(position) : av.getAlignmentConsensusAnnotation().annotations[position].displayCharacter - .charAt(0); + char conschar = (usesrep) ? (currentGroup == null ? av.getAlignment() + .getSeqrep().getCharAt(position) + : (currentGroup.getSeqrep() != null ? currentGroup.getSeqrep() + .getCharAt(position) : av.getAlignment().getSeqrep() + .getCharAt(position))) + : (currentGroup != null && currentGroup.getConsensus() != null) ? currentGroup + .getConsensus().annotations[position].displayCharacter + .charAt(0) + : av.getAlignmentConsensusAnnotation().annotations[position].displayCharacter + .charAt(0); if (conschar != '-' && (sequenceChar == conschar || sequenceChar + CHAR_TO_UPPER == conschar)) { diff --git a/src/jalview/io/AnnotationFile.java b/src/jalview/io/AnnotationFile.java index 88cb46e..7702792 100755 --- a/src/jalview/io/AnnotationFile.java +++ b/src/jalview/io/AnnotationFile.java @@ -241,7 +241,7 @@ public class AnnotationFile && row.annotations[j].displayCharacter.length() > 0 && !row.annotations[j].displayCharacter .equals(" ")); hasGlyphs |= (row.annotations[j].secondaryStructure != 0 && row.annotations[j].secondaryStructure != ' '); - hasValues |= (row.annotations[j].value != Float.NaN); // NaNs can't + hasValues |= (!Float.isNaN(row.annotations[j].value)); // NaNs can't // be // rendered.. hasText |= (row.annotations[j].description != null && row.annotations[j].description @@ -331,13 +331,13 @@ public class AnnotationFile } if (hasValues) { - if (row.annotations[j].value != Float.NaN) + if (!Float.isNaN(row.annotations[j].value)) { text.append(comma + row.annotations[j].value); } else { - System.err.println("Skipping NaN - not valid value."); + // System.err.println("Skipping NaN - not valid value."); text.append(comma + 0f);// row.annotations[j].value); } comma = ","; diff --git a/src/jalview/io/AppletFormatAdapter.java b/src/jalview/io/AppletFormatAdapter.java index d3d4d6e..02de02e 100755 --- a/src/jalview/io/AppletFormatAdapter.java +++ b/src/jalview/io/AppletFormatAdapter.java @@ -205,6 +205,10 @@ public class AppletFormatAdapter public static final boolean isValidFormat(String format, boolean forwriting) { + if (format == null) + { + return false; + } boolean valid = false; String[] format_list = (forwriting) ? WRITEABLE_FORMATS : READABLE_FORMATS; @@ -483,7 +487,7 @@ public class AppletFormatAdapter private AlignmentI buildAlignmentFrom(AlignFile alignFile2) { // Standard boilerplate for creating alignment from parser - alignFile.configureForView(viewpanel); + // alignFile.configureForView(viewpanel); AlignmentI al = new Alignment(alignFile.getSeqsAsArray()); @@ -519,7 +523,7 @@ public class AppletFormatAdapter aselview.addAnnotation(aa); } } - + viewpanel = ap; return formatSequences(format, aselview, jvsuffix); } @@ -597,11 +601,10 @@ public class AppletFormatAdapter { throw new Exception(MessageManager.getString("error.implementation_error_unknown_file_format_string")); } + afile.setNewlineString(newline); afile.addJVSuffix(jvsuffix); - afile.setExportSettings(exportSettings); - afile.configureForView(viewpanel); // check whether we were given a specific alignment to export, rather than diff --git a/src/jalview/io/BioJsHTMLOutput.java b/src/jalview/io/BioJsHTMLOutput.java index 74fb147..73be79f 100644 --- a/src/jalview/io/BioJsHTMLOutput.java +++ b/src/jalview/io/BioJsHTMLOutput.java @@ -1,6 +1,7 @@ package jalview.io; import jalview.api.AlignmentViewPanel; +import jalview.datamodel.AlignmentExportData; import jalview.exceptions.NoFileSelectedException; import jalview.json.binding.v1.BioJSReleasePojo; import jalview.json.binding.v1.BioJSRepositoryPojo; @@ -51,7 +52,20 @@ public class BioJsHTMLOutput try { String outputFile = getOutputFile(); - String jalviewAlignmentJson = JSONFile.getJSONData(ap); + // String jalviewAlignmentJson = JSONFile.getJSONData(ap); + AlignmentExportData exportData = jalview.gui.AlignFrame + .getAlignmentForExport( + JSONFile.FILE_DESC, ap.getAlignViewport()); + if (exportData.getSettings().isCancelled()) + { + return; + } + String jalviewAlignmentJson = new FormatAdapter(ap, + exportData.getSettings()).formatSequences(JSONFile.FILE_DESC, + exportData.getAlignment(), exportData.getOmitHidden(), + exportData.getStartEndPostions(), ap.getAlignViewport() + .getColumnSelection()); + String bioJSTemplateString = getBioJsTemplateAsString(); String generatedBioJsWithJalviewAlignmentAsJson = bioJSTemplateString .replaceAll( @@ -82,7 +96,6 @@ public class BioJsHTMLOutput { "HTML files" }, "HTML files"); jvFileChooser.setFileView(new JalviewFileView()); - // TODO uncomment when supported by MassageManager jvFileChooser.setDialogTitle(MessageManager .getString("label.save_as_biojs_html")); jvFileChooser.setDialogTitle("save as BioJs HTML"); @@ -187,10 +200,13 @@ public class BioJsHTMLOutput try { String gitRepoPkgJson = getURLContentAsString(BJS_TEMPLATE_GIT_REPO); - BioJSRepositoryPojo release = new BioJSRepositoryPojo( - gitRepoPkgJson); - syncUpdates(BJS_TEMPLATES_LOCAL_DIRECTORY, release); - refreshBioJSVersionsInfo(BJS_TEMPLATES_LOCAL_DIRECTORY); + if (gitRepoPkgJson != null) + { + BioJSRepositoryPojo release = new BioJSRepositoryPojo( + gitRepoPkgJson); + syncUpdates(BJS_TEMPLATES_LOCAL_DIRECTORY, release); + refreshBioJSVersionsInfo(BJS_TEMPLATES_LOCAL_DIRECTORY); + } } catch (URISyntaxException e) { e.printStackTrace(); diff --git a/src/jalview/io/FeaturesFile.java b/src/jalview/io/FeaturesFile.java index 57f6384..fbe871b 100755 --- a/src/jalview/io/FeaturesFile.java +++ b/src/jalview/io/FeaturesFile.java @@ -1384,7 +1384,7 @@ public class FeaturesFile extends AlignFile out.append(next[j].end); out.append("\t"); out.append(next[j].type); - if (next[j].score != Float.NaN) + if (!Float.isNaN(next[j].score)) { out.append("\t"); out.append(next[j].score); diff --git a/src/jalview/io/FileLoader.java b/src/jalview/io/FileLoader.java index 7387fa2..73c10df 100755 --- a/src/jalview/io/FileLoader.java +++ b/src/jalview/io/FileLoader.java @@ -21,6 +21,8 @@ package jalview.io; import jalview.api.ComplexAlignFile; +import jalview.api.FeaturesDisplayedI; +import jalview.bin.Jalview; import jalview.datamodel.AlignmentI; import jalview.datamodel.ColumnSelection; import jalview.datamodel.PDBEntry; @@ -256,6 +258,22 @@ public class FileLoader implements Runnable { format = new IdentifyFile().Identify(file, protocol); } + + } + + if (format == null || format.equalsIgnoreCase("EMPTY DATA FILE")) + { + Desktop.instance.stopLoading(); + System.err.println("The input file \"" + file + + "\" has null or unidentifiable data content!"); + if (!Jalview.isHeadlessMode()) + { + JOptionPane.showMessageDialog(null, "The input file \"" + file + + "\" has null or unidentifiable data content!", + "Empty data file", + JOptionPane.ERROR_MESSAGE); + } + return; } // TODO: cache any stream datasources as a temporary file (eg. PDBs // retrieved via URL) @@ -299,7 +317,8 @@ public class FileLoader implements Runnable // open a new source and read from it FormatAdapter fa = new FormatAdapter(); al = fa.readFile(file, protocol, format); - source = fa.getAlignFile(); // keep reference for later if necessary. + source = fa.getAlignFile(); // keep reference for later if + // necessary. } } catch (java.io.IOException ex) { @@ -355,11 +374,14 @@ public class FileLoader implements Runnable .isShowSeqFeatures(); ColourSchemeI cs = ((ComplexAlignFile) source) .getColourScheme(); + FeaturesDisplayedI fd = ((ComplexAlignFile) source) + .getDisplayedFeatures(); alignFrame = new AlignFrame(al, hiddenSeqs, colSel, AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT); alignFrame.getViewport().setShowSequenceFeatures( showSeqFeatures); + alignFrame.getViewport().setFeaturesDisplayed(fd); alignFrame.changeColour(cs); } else @@ -367,34 +389,34 @@ public class FileLoader implements Runnable alignFrame = new AlignFrame(al, AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT); } - } - // add metadata and update ui - if (!protocol.equals(AppletFormatAdapter.PASTE)) - { - alignFrame.setFileName(file, format); - } + // add metadata and update ui + if (!protocol.equals(AppletFormatAdapter.PASTE)) + { + alignFrame.setFileName(file, format); + } - alignFrame.statusBar.setText(MessageManager.formatMessage( - "label.successfully_loaded_file", new String[] - { title })); + alignFrame.statusBar.setText(MessageManager.formatMessage( + "label.successfully_loaded_file", new String[] + { title })); - if (raiseGUI) - { - // add the window to the GUI - // note - this actually should happen regardless of raiseGUI - // status in Jalview 3 - // TODO: define 'virtual desktop' for benefit of headless scripts - // that perform queries to find the 'current working alignment' - Desktop.addInternalFrame(alignFrame, title, - AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT); - } + if (raiseGUI) + { + // add the window to the GUI + // note - this actually should happen regardless of raiseGUI + // status in Jalview 3 + // TODO: define 'virtual desktop' for benefit of headless scripts + // that perform queries to find the 'current working alignment' + Desktop.addInternalFrame(alignFrame, title, + AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT); + } - try - { - alignFrame.setMaximum(jalview.bin.Cache.getDefault( - "SHOW_FULLSCREEN", false)); - } catch (java.beans.PropertyVetoException ex) - { + try + { + alignFrame.setMaximum(jalview.bin.Cache.getDefault( + "SHOW_FULLSCREEN", false)); + } catch (java.beans.PropertyVetoException ex) + { + } } } else @@ -461,12 +483,12 @@ public class FileLoader implements Runnable { public void run() { - javax.swing.JOptionPane - .showInternalMessageDialog( - Desktop.desktop, - MessageManager.formatMessage("warn.out_of_memory_loading_file", new String[]{file}), - MessageManager.getString("label.out_of_memory"), - javax.swing.JOptionPane.WARNING_MESSAGE); + javax.swing.JOptionPane.showInternalMessageDialog( + Desktop.desktop, MessageManager.formatMessage( + "warn.out_of_memory_loading_file", new String[] + { file }), MessageManager + .getString("label.out_of_memory"), + javax.swing.JOptionPane.WARNING_MESSAGE); } }); } diff --git a/src/jalview/io/FormatAdapter.java b/src/jalview/io/FormatAdapter.java index e795925..8a563fa 100755 --- a/src/jalview/io/FormatAdapter.java +++ b/src/jalview/io/FormatAdapter.java @@ -29,7 +29,6 @@ import jalview.datamodel.ColumnSelection; import jalview.datamodel.Sequence; import jalview.datamodel.SequenceGroup; import jalview.datamodel.SequenceI; -import jalview.gui.AlignmentPanel; /** * Additional formatting methods used by the application in a number of places. @@ -51,7 +50,7 @@ public class FormatAdapter extends AppletFormatAdapter init(); } - public FormatAdapter(AlignmentPanel alignPanel, + public FormatAdapter(AlignmentViewPanel alignPanel, AlignExportSettingI settings) { super(alignPanel, settings); diff --git a/src/jalview/io/HtmlFile.java b/src/jalview/io/HtmlFile.java index a4e9bf4..0f5cd55 100644 --- a/src/jalview/io/HtmlFile.java +++ b/src/jalview/io/HtmlFile.java @@ -21,6 +21,12 @@ package jalview.io; +import jalview.api.ComplexAlignFile; +import jalview.api.FeaturesDisplayedI; +import jalview.datamodel.ColumnSelection; +import jalview.datamodel.SequenceI; +import jalview.schemes.ColourSchemeI; + import java.io.IOException; import java.io.StringReader; @@ -28,11 +34,6 @@ import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; -import jalview.api.ComplexAlignFile; -import jalview.datamodel.ColumnSelection; -import jalview.datamodel.SequenceI; -import jalview.schemes.ColourSchemeI; - public class HtmlFile extends AlignFile implements ComplexAlignFile { public static final String FILE_EXT = "html"; @@ -47,6 +48,8 @@ public class HtmlFile extends AlignFile implements ComplexAlignFile private SequenceI[] hiddenSequences; + private FeaturesDisplayedI displayedFeatures; + public HtmlFile() { super(); @@ -92,6 +95,7 @@ public class HtmlFile extends AlignFile implements ComplexAlignFile this.colourScheme = jsonFile.getColourScheme(); this.hiddenSequences = jsonFile.getHiddenSequences(); this.columnSelection = jsonFile.getColumnSelection(); + this.displayedFeatures = jsonFile.getDisplayedFeatures(); } catch (Exception e) { errormessage = "Failed to extract data from HTML document."; @@ -147,4 +151,10 @@ public class HtmlFile extends AlignFile implements ComplexAlignFile this.hiddenSequences = hiddenSequences; } + @Override + public FeaturesDisplayedI getDisplayedFeatures() + { + return displayedFeatures; + } + } diff --git a/src/jalview/io/HtmlSvgOutput.java b/src/jalview/io/HtmlSvgOutput.java index 7e02118..781eace 100644 --- a/src/jalview/io/HtmlSvgOutput.java +++ b/src/jalview/io/HtmlSvgOutput.java @@ -1,6 +1,7 @@ package jalview.io; import jalview.api.FeatureRenderer; +import jalview.datamodel.AlignmentExportData; import jalview.datamodel.SequenceI; import jalview.gui.AlignViewport; import jalview.gui.AlignmentPanel; @@ -93,13 +94,26 @@ public class HtmlSvgOutput } printUnwrapped(aDimension.getWidth(), aDimension.getHeight(), 0, g1, g2); - FileOutputStream out = new FileOutputStream(file); String titleSvgData = g1.getSVGDocument(); String alignSvgData = g2.getSVGDocument(); - String jsonData = JSONFile.getJSONData(ap); + + AlignmentExportData exportData = ap.alignFrame.getAlignmentForExport( + JSONFile.FILE_DESC, av); + if (exportData.getSettings().isCancelled()) + { + return; + } + String jsonData = new FormatAdapter(ap, exportData.getSettings()) + .formatSequences(JSONFile.FILE_DESC, exportData + .getAlignment(), exportData.getOmitHidden(), + exportData.getStartEndPostions(), ap + .getAlignViewport().getColumnSelection()); + + // String jsonData = JSONFile.getJSONData(ap); String htmlData = getHtml(titleSvgData, alignSvgData, jsonData); + FileOutputStream out = new FileOutputStream(file); out.write(htmlData.getBytes()); out.flush(); out.close(); diff --git a/src/jalview/io/IdentifyFile.java b/src/jalview/io/IdentifyFile.java index 27f08ae..dae8f82 100755 --- a/src/jalview/io/IdentifyFile.java +++ b/src/jalview/io/IdentifyFile.java @@ -98,7 +98,7 @@ public class IdentifyFile } while ((data = source.nextLine()) != null) { - length += data.length(); + length += data.trim().length(); if (!lineswereskipped) { for (int i = 0; !isBinary && i < data.length(); i++) @@ -142,19 +142,35 @@ public class IdentifyFile reply = "STH"; break; } - // if (data.matches("<(\"[^\"]*\"|'[^']*'|[^'\">])*>")) - if (data.matches("<(?i)html(\"[^\"]*\"|'[^']*'|[^'\">])*>")) - { - reply = HtmlFile.FILE_DESC; - break; - } - if (data.matches("<(?i)rnaml (\"[^\"]*\"|'[^']*'|[^'\">])*>")) + if ((data.indexOf("<") > -1)) // possible Markup Language data i.e HTML, + // RNAML, XML { - reply = "RNAML"; - break; + boolean identified = false; + do + { + if (data.matches("<(?i)html(\"[^\"]*\"|'[^']*'|[^'\">])*>")) + { + reply = HtmlFile.FILE_DESC; + identified = true; + break; + } + + if (data.matches("<(?i)rnaml (\"[^\"]*\"|'[^']*'|[^'\">])*>")) + { + reply = "RNAML"; + identified = true; + break; + } + } while ((data = source.nextLine()) != null); + + if (identified) + { + break; + } } + if (data.indexOf("{\"") > -1) { reply = JSONFile.FILE_DESC; diff --git a/src/jalview/io/JSONFile.java b/src/jalview/io/JSONFile.java index ce70ea5..b079a3c 100644 --- a/src/jalview/io/JSONFile.java +++ b/src/jalview/io/JSONFile.java @@ -21,11 +21,14 @@ package jalview.io; +import jalview.api.AlignExportSettingI; +import jalview.api.AlignViewportI; import jalview.api.AlignmentViewPanel; import jalview.api.ComplexAlignFile; import jalview.api.FeatureRenderer; import jalview.api.FeaturesDisplayedI; import jalview.datamodel.AlignmentAnnotation; +import jalview.datamodel.AlignmentI; import jalview.datamodel.Annotation; import jalview.datamodel.ColumnSelection; import jalview.datamodel.HiddenSequences; @@ -42,6 +45,7 @@ import jalview.json.binding.v1.SequenceGrpPojo; import jalview.json.binding.v1.SequencePojo; import jalview.schemes.ColourSchemeI; import jalview.schemes.ColourSchemeProperty; +import jalview.viewmodel.seqfeatures.FeaturesDisplayed; import java.awt.Color; import java.io.IOException; @@ -88,6 +92,7 @@ public class JSONFile extends AlignFile implements ComplexAlignFile private ArrayList hiddenSequences; + public JSONFile() { super(); @@ -116,6 +121,45 @@ public class JSONFile extends AlignFile implements ComplexAlignFile try { AlignmentPojo jsonAlignmentPojo = new AlignmentPojo(); + AlignExportSettingI exportSettings = getExportSettings(); + + // if no export settings were supplied use the following with all values + // defaulting to true + if (exportSettings == null) + { + exportSettings = new AlignExportSettingI() + { + @Override + public boolean isExportHiddenSequences() + { + return true; + } + + @Override + public boolean isExportHiddenColumns() + { + return true; + } + + @Override + public boolean isExportGroups() + { + return true; + } + + @Override + public boolean isExportFeatures() + { + return true; + } + + @Override + public boolean isExportAnnotations() + { + return true; + } + }; + } int count = 0; for (SequenceI seq : seqs) @@ -144,14 +188,14 @@ public class JSONFile extends AlignFile implements ComplexAlignFile if (hiddenSections != null) { if (hiddenSections[0] != null - && getExportSettings() + && exportSettings .isExportHiddenColumns()) { jsonAlignmentPojo.getAppSettings().put("hiddenCols", String.valueOf(hiddenSections[0])); } if (hiddenSections[1] != null - && getExportSettings() + && exportSettings .isExportHiddenSequences()) { jsonAlignmentPojo.getAppSettings().put("hiddenSeqs", @@ -159,19 +203,19 @@ public class JSONFile extends AlignFile implements ComplexAlignFile } } - if (getExportSettings().isExportAnnotations()) + if (exportSettings.isExportAnnotations()) { jsonAlignmentPojo .setAlignAnnotation(annotationToJsonPojo(annotations)); } - if (getExportSettings().isExportFeatures()) + if (exportSettings.isExportFeatures()) { jsonAlignmentPojo .setSeqFeatures(sequenceFeatureToJsonPojo(seqs, fr)); } - if (getExportSettings().isExportGroups() + if (exportSettings.isExportGroups() && seqGroups != null && seqGroups.size() > 0) { @@ -257,10 +301,10 @@ public class JSONFile extends AlignFile implements ComplexAlignFile return hiddenSections; } - public static List sequenceFeatureToJsonPojo( + public List sequenceFeatureToJsonPojo( List seqs, FeatureRenderer fr) { - FeaturesDisplayedI displayedFeatures = (fr == null) ? null : fr + displayedFeatures = (fr == null) ? null : fr .getFeaturesDisplayed(); List sequenceFeaturesPojo = new ArrayList(); for (SequenceI seq : seqs) @@ -283,6 +327,7 @@ public class JSONFile extends AlignFile implements ComplexAlignFile { SequenceFeaturesPojo jsonFeature = new SequenceFeaturesPojo( String.valueOf(seq.hashCode())); + String featureColour = (fr == null) ? null : jalview.util.Format .getHexString(fr .findFeatureColour(Color.white, seq, @@ -425,8 +470,9 @@ public class JSONFile extends AlignFile implements ComplexAlignFile } } } - ColourSchemeI scheme = getJalviewColorScheme(colourScheme); - SequenceGroup seqGrp = new SequenceGroup(grpSeqs, grpName, scheme, + ColourSchemeI grpColourScheme = getJalviewColorScheme(colourScheme); + SequenceGroup seqGrp = new SequenceGroup(grpSeqs, grpName, + grpColourScheme, displayBoxes, displayText, colourText, startRes, endRes); seqGrp.setShowNonconserved(showNonconserved); seqGrp.setDescription(description); @@ -509,6 +555,7 @@ public class JSONFile extends AlignFile implements ComplexAlignFile { if (jsonSeqFeatures != null) { + displayedFeatures = new FeaturesDisplayed(); for (Iterator seqFeatureItr = jsonSeqFeatures.iterator(); seqFeatureItr .hasNext();) { @@ -540,6 +587,7 @@ public class JSONFile extends AlignFile implements ComplexAlignFile sequenceFeature.setBegin(seq.findPosition(begin.intValue())); sequenceFeature.setEnd(seq.findPosition(end.intValue()) - 1); seq.addSequenceFeature(sequenceFeature); + displayedFeatures.setVisible(type); } } } @@ -580,6 +628,7 @@ public class JSONFile extends AlignFile implements ComplexAlignFile this.colourScheme = colourScheme; } + @Override public FeaturesDisplayedI getDisplayedFeatures() { return displayedFeatures; @@ -590,50 +639,34 @@ public class JSONFile extends AlignFile implements ComplexAlignFile this.displayedFeatures = displayedFeatures; } - @Override + public void configureForView(AlignmentViewPanel avpanel) { super.configureForView(avpanel); - if (isExporting()) - { - setViewport(avpanel.getAlignViewport()); - seqGroups = avpanel.getAlignment().getGroups(); - setDisplayedFeatures(getViewport().getFeaturesDisplayed()); - fr = avpanel.cloneFeatureRenderer(); + AlignViewportI viewport = avpanel.getAlignViewport(); + AlignmentI alignment = viewport.getAlignment(); + AlignmentAnnotation[] annots = alignment.getAlignmentAnnotation(); - for (SequenceI seq : getViewport().getAlignment().getSequences()) - { - seqs.add(seq); - } + seqGroups = alignment.getGroups(); + fr = avpanel.cloneFeatureRenderer(); - // Add non auto calculated annotation to AlignFile - for (AlignmentAnnotation annot : getViewport().getAlignment() - .getAlignmentAnnotation()) + // Add non auto calculated annotation to AlignFile + for (AlignmentAnnotation annot : annots) + { + if (annot != null && !annot.autoCalculated) { - if (annot != null && !annot.autoCalculated) + if (!annot.visible) { - if (annot.label.equals("PDB.CATempFactor")) - { - continue; - } - annotations.add(annot); + continue; } + annotations.add(annot); } - - globalColorScheme = ColourSchemeProperty.getColourName(getViewport() - .getGlobalColourScheme()); - setDisplayedFeatures(getViewport().getFeaturesDisplayed()); - showSeqFeatures = getViewport().isShowSequenceFeatures(); } - } + globalColorScheme = ColourSchemeProperty.getColourName(viewport + .getGlobalColourScheme()); + setDisplayedFeatures(viewport.getFeaturesDisplayed()); + showSeqFeatures = viewport.isShowSequenceFeatures(); - - public static String getJSONData(AlignmentViewPanel av) - { - JSONFile jsonFile = new JSONFile(); - jsonFile.configureForView(av); - String jsonString = jsonFile.print(); - return jsonString; } public boolean isShowSeqFeatures() diff --git a/src/jalview/io/SequenceAnnotationReport.java b/src/jalview/io/SequenceAnnotationReport.java index 7c96d45..6d8ce5f 100644 --- a/src/jalview/io/SequenceAnnotationReport.java +++ b/src/jalview/io/SequenceAnnotationReport.java @@ -152,7 +152,7 @@ public class SequenceAnnotationReport } } // check score should be shown - if (feature.getScore() != Float.NaN) + if (!Float.isNaN(feature.getScore())) { float[][] rng = (minmax == null) ? null : ((float[][]) minmax .get(feature.getType())); diff --git a/src/jalview/io/vamsas/Sequencefeature.java b/src/jalview/io/vamsas/Sequencefeature.java index 3d598d2..ffc9998 100644 --- a/src/jalview/io/vamsas/Sequencefeature.java +++ b/src/jalview/io/vamsas/Sequencefeature.java @@ -20,6 +20,12 @@ */ package jalview.io.vamsas; +import jalview.bin.Cache; +import jalview.datamodel.SequenceFeature; +import jalview.datamodel.SequenceI; +import jalview.io.VamsasAppDatastore; +import jalview.util.UrlLink; + import java.util.Enumeration; import java.util.Vector; @@ -31,11 +37,6 @@ import uk.ac.vamsas.objects.core.RangeAnnotation; import uk.ac.vamsas.objects.core.Score; import uk.ac.vamsas.objects.core.Seg; import uk.ac.vamsas.objects.utils.Properties; -import jalview.bin.Cache; -import jalview.datamodel.SequenceFeature; -import jalview.datamodel.SequenceI; -import jalview.io.VamsasAppDatastore; -import jalview.util.UrlLink; /** * @author JimP @@ -207,7 +208,7 @@ public class Sequencefeature extends Rangetype { for (int i = 0, iSize = feature.links.size(); i < iSize; i++) { - String link = (String) feature.links.elementAt(i); + String link = feature.links.elementAt(i); UrlLink ulink = new UrlLink(link); if (ulink.isValid()) { @@ -220,7 +221,7 @@ public class Sequencefeature extends Rangetype } } dsa.setGroup(feature.getFeatureGroup()); - if (feature.getScore() != Float.NaN) + if (!Float.isNaN(feature.getScore())) { Score fscore = new Score(); dsa.setScore(new Score[] diff --git a/src/jalview/jbgui/GAlignExportSettings.java b/src/jalview/jbgui/GAlignExportSettings.java index 2583b6b..15498c6 100644 --- a/src/jalview/jbgui/GAlignExportSettings.java +++ b/src/jalview/jbgui/GAlignExportSettings.java @@ -44,9 +44,8 @@ public abstract class GAlignExportSettings extends JPanel JButton btnCancel = new JButton("Cancel"); - private boolean hasHiddenSeq, hasHiddenCols, isComplexAlignFile; - - boolean isComplexFormat = false; + private boolean hasHiddenSeq, hasHiddenCols, isComplexAlignFile, + showDialog; public GAlignExportSettings(boolean hasHiddenSeq, boolean hasHiddenCols, String alignFileFormat) @@ -64,7 +63,10 @@ public abstract class GAlignExportSettings extends JPanel break; } } - + if (this.hasHiddenCols || this.hasHiddenSeq || this.isComplexAlignFile) + { + this.showDialog = true; + } init(); } @@ -113,7 +115,7 @@ public abstract class GAlignExportSettings extends JPanel optionsPanel.add(hiddenRegionConfPanel); } - if (isComplexAlignFile) + if (this.isComplexAlignFile) { optionsPanel.add(complexExportPanel); } @@ -124,8 +126,6 @@ public abstract class GAlignExportSettings extends JPanel add(actionPanel, BorderLayout.SOUTH); } - - private void checkAllAction() { @@ -140,6 +140,16 @@ public abstract class GAlignExportSettings extends JPanel && chkExportGrps.isEnabled() && isSelected); } + public boolean isShowDialog() + { + return showDialog; + } + + public void setShowDialog(boolean showDialog) + { + this.showDialog = showDialog; + } + public abstract void ok_actionPerformed(ActionEvent e); public abstract void cancel_actionPerformed(ActionEvent e); diff --git a/src/jalview/jbgui/GAlignFrame.java b/src/jalview/jbgui/GAlignFrame.java index befa3b1..c6a042b 100755 --- a/src/jalview/jbgui/GAlignFrame.java +++ b/src/jalview/jbgui/GAlignFrame.java @@ -20,6 +20,14 @@ */ package jalview.jbgui; +import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder; +import jalview.api.SplitContainerI; +import jalview.bin.Cache; +import jalview.gui.JvSwingUtils; +import jalview.gui.Preferences; +import jalview.schemes.ColourSchemeProperty; +import jalview.util.MessageManager; + import java.awt.BorderLayout; import java.awt.Color; import java.awt.GridLayout; @@ -52,14 +60,6 @@ import javax.swing.event.ChangeEvent; import javax.swing.event.MenuEvent; import javax.swing.event.MenuListener; -import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder; -import jalview.api.SplitContainerI; -import jalview.bin.Cache; -import jalview.gui.JvSwingUtils; -import jalview.gui.Preferences; -import jalview.schemes.ColourSchemeProperty; -import jalview.util.MessageManager; - public class GAlignFrame extends JInternalFrame { protected JMenuBar alignFrameMenuBar = new JMenuBar(); @@ -262,7 +262,7 @@ public class GAlignFrame extends JInternalFrame System.err.println(e.toString()); } - if (!new jalview.util.Platform().isAMac()) + if (!jalview.util.Platform.isAMac()) { closeMenuItem.setMnemonic('C'); outputTextboxMenu.setMnemonic('T'); diff --git a/src/jalview/jbgui/PDBDocFieldPreferences.java b/src/jalview/jbgui/PDBDocFieldPreferences.java index 96e27e6..4ec649a 100644 --- a/src/jalview/jbgui/PDBDocFieldPreferences.java +++ b/src/jalview/jbgui/PDBDocFieldPreferences.java @@ -51,15 +51,15 @@ public class PDBDocFieldPreferences extends JScrollPane { case SEARCH_SUMMARY: columnNames = new String[] - { "PDB Feild", "Show in search summary" }; + { "PDB Field", "Show in search summary" }; break; case STRUCTURE_CHOOSER: columnNames = new String[] - { "PDB Feild", "Show in structure summary" }; + { "PDB Field", "Show in structure summary" }; break; case PREFERENCES: columnNames = new String[] - { "PDB Feild", "Show in search summary", "Show in structure summary" }; + { "PDB Field", "Show in search summary", "Show in structure summary" }; break; default: break; diff --git a/src/jalview/json/binding/v1/BioJSRepositoryPojo.java b/src/jalview/json/binding/v1/BioJSRepositoryPojo.java index 4028a9d..1e6ef7e 100644 --- a/src/jalview/json/binding/v1/BioJSRepositoryPojo.java +++ b/src/jalview/json/binding/v1/BioJSRepositoryPojo.java @@ -3,6 +3,7 @@ package jalview.json.binding.v1; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; +import java.util.Objects; import org.json.simple.JSONArray; import org.json.simple.JSONObject; @@ -36,6 +37,8 @@ public class BioJSRepositoryPojo @SuppressWarnings("unchecked") private void parse(String jsonString) throws ParseException { + Objects.requireNonNull(jsonString, + "Supplied jsonString must not be null"); JSONParser jsonParser = new JSONParser(); JSONObject JsonObj = (JSONObject) jsonParser.parse(jsonString); this.description = (String) JsonObj.get("description"); diff --git a/src/jalview/renderer/AnnotationRenderer.java b/src/jalview/renderer/AnnotationRenderer.java index 2ba7aff..61194ce 100644 --- a/src/jalview/renderer/AnnotationRenderer.java +++ b/src/jalview/renderer/AnnotationRenderer.java @@ -47,6 +47,12 @@ import com.stevesoft.pat.Regex; public class AnnotationRenderer { + private static final int UPPER_TO_LOWER = 'a' - 'A'; // 32 + + private static final int CHAR_A = 'A'; // 65 + + private static final int CHAR_Z = 'Z'; // 90 + /** * flag indicating if timing and redraw parameter info should be output */ @@ -132,7 +138,7 @@ public class AnnotationRenderer private FontMetrics fm; - private final boolean MAC = new jalview.util.Platform().isAMac(); + private final boolean MAC = jalview.util.Platform.isAMac(); boolean av_renderHistogram = true, av_renderProfile = true, av_normaliseProfile = false; @@ -715,14 +721,14 @@ public class AnnotationRenderer } } - if (ss >= 65) + if (isRNA && (ss >= CHAR_A) && (ss <= CHAR_Z)) { // distinguish between forward/backward base-pairing - if (displayChar.indexOf(ss + 32) > -1) + int ssLowerCase = ss + UPPER_TO_LOWER; + // TODO would .equals() be safer here? or charAt(0)? + if (displayChar.indexOf(ssLowerCase) > -1) { - - ss = (char) (ss + 32); - + ss = (char) ssLowerCase; } } diff --git a/src/jalview/renderer/seqfeatures/FeatureRenderer.java b/src/jalview/renderer/seqfeatures/FeatureRenderer.java index 7eda2f7..0f2a49c 100644 --- a/src/jalview/renderer/seqfeatures/FeatureRenderer.java +++ b/src/jalview/renderer/seqfeatures/FeatureRenderer.java @@ -349,7 +349,7 @@ public class FeatureRenderer extends else if (showFeature(sequenceFeature)) { if (av_isShowSeqFeatureHeight - && sequenceFeature.score != Float.NaN) + && !Float.isNaN(sequenceFeature.score)) { renderScoreFeature(g, seq, seq.findIndex(sequenceFeature.begin) - 1, diff --git a/src/jalview/schemabinding/version2/.castor.cdr b/src/jalview/schemabinding/version2/.castor.cdr index 65150f6..e01bbd4 100644 --- a/src/jalview/schemabinding/version2/.castor.cdr +++ b/src/jalview/schemabinding/version2/.castor.cdr @@ -1,4 +1,4 @@ -#Wed Jun 10 11:15:53 BST 2015 +#Fri Jun 26 14:22:47 BST 2015 jalview.schemabinding.version2.ThresholdLine=jalview.schemabinding.version2.descriptors.ThresholdLineDescriptor jalview.schemabinding.version2.SequenceSetProperties=jalview.schemabinding.version2.descriptors.SequenceSetPropertiesDescriptor jalview.schemabinding.version2.StructureState=jalview.schemabinding.version2.descriptors.StructureStateDescriptor @@ -10,8 +10,10 @@ jalview.schemabinding.version2.OtherData=jalview.schemabinding.version2.descript jalview.schemabinding.version2.Setting=jalview.schemabinding.version2.descriptors.SettingDescriptor jalview.schemabinding.version2.AlcodonFrame=jalview.schemabinding.version2.descriptors.AlcodonFrameDescriptor jalview.schemabinding.version2.AnnotationElement=jalview.schemabinding.version2.descriptors.AnnotationElementDescriptor +jalview.schemabinding.version2.SecondaryStructure=jalview.schemabinding.version2.descriptors.SecondaryStructureDescriptor jalview.schemabinding.version2.SequenceSet=jalview.schemabinding.version2.descriptors.SequenceSetDescriptor jalview.schemabinding.version2.Viewport=jalview.schemabinding.version2.descriptors.ViewportDescriptor +jalview.schemabinding.version2.RnaViewer=jalview.schemabinding.version2.descriptors.RnaViewerDescriptor jalview.schemabinding.version2.MapListType=jalview.schemabinding.version2.descriptors.MapListTypeDescriptor jalview.schemabinding.version2.Property=jalview.schemabinding.version2.descriptors.PropertyDescriptor jalview.schemabinding.version2.UserColourScheme=jalview.schemabinding.version2.descriptors.UserColourSchemeDescriptor diff --git a/src/jalview/schemabinding/version2/CalcIdParam.java b/src/jalview/schemabinding/version2/CalcIdParam.java index 9fc3384..cae3ec2 100644 --- a/src/jalview/schemabinding/version2/CalcIdParam.java +++ b/src/jalview/schemabinding/version2/CalcIdParam.java @@ -29,13 +29,16 @@ implements java.io.Serializable //--------------------------/ /** - * handle for the calculation which uses this parameter set + * handle for the calculation which uses + * this parameter set + * */ private java.lang.String _calcId; /** - * should the calculation be performed immediately after - * loading in order to refresh results + * should the calculation be performed + * immediately after loading in order to refresh results + * */ private boolean _needsUpdate = false; @@ -45,7 +48,9 @@ implements java.io.Serializable private boolean _has_needsUpdate; /** - * should the calculation be automatically performed on edits + * should the calculation be automatically + * performed on edits + * */ private boolean _autoUpdate; @@ -85,7 +90,9 @@ implements java.io.Serializable /** * Returns the value of field 'autoUpdate'. The field * 'autoUpdate' has the following description: should the - * calculation be automatically performed on edits + * calculation be automatically + * performed on edits + * * * @return the value of field 'AutoUpdate'. */ @@ -97,7 +104,9 @@ implements java.io.Serializable /** * Returns the value of field 'calcId'. The field 'calcId' has * the following description: handle for the calculation which - * uses this parameter set + * uses + * this parameter set + * * * @return the value of field 'CalcId'. */ @@ -109,8 +118,9 @@ implements java.io.Serializable /** * Returns the value of field 'needsUpdate'. The field * 'needsUpdate' has the following description: should the - * calculation be performed immediately after loading in order - * to refresh results + * calculation be performed + * immediately after loading in order to refresh results + * * * @return the value of field 'NeedsUpdate'. */ @@ -142,7 +152,9 @@ implements java.io.Serializable /** * Returns the value of field 'autoUpdate'. The field * 'autoUpdate' has the following description: should the - * calculation be automatically performed on edits + * calculation be automatically + * performed on edits + * * * @return the value of field 'AutoUpdate'. */ @@ -154,8 +166,9 @@ implements java.io.Serializable /** * Returns the value of field 'needsUpdate'. The field * 'needsUpdate' has the following description: should the - * calculation be performed immediately after loading in order - * to refresh results + * calculation be performed + * immediately after loading in order to refresh results + * * * @return the value of field 'NeedsUpdate'. */ @@ -214,7 +227,9 @@ implements java.io.Serializable /** * Sets the value of field 'autoUpdate'. The field 'autoUpdate' * has the following description: should the calculation be - * automatically performed on edits + * automatically + * performed on edits + * * * @param autoUpdate the value of field 'autoUpdate'. */ @@ -227,7 +242,8 @@ implements java.io.Serializable /** * Sets the value of field 'calcId'. The field 'calcId' has the * following description: handle for the calculation which uses - * this parameter set + * this parameter set + * * * @param calcId the value of field 'calcId'. */ @@ -239,8 +255,9 @@ implements java.io.Serializable /** * Sets the value of field 'needsUpdate'. The field * 'needsUpdate' has the following description: should the - * calculation be performed immediately after loading in order - * to refresh results + * calculation be performed + * immediately after loading in order to refresh results + * * * @param needsUpdate the value of field 'needsUpdate'. */ diff --git a/src/jalview/schemabinding/version2/JGroup.java b/src/jalview/schemabinding/version2/JGroup.java index 86d789e..602473f 100644 --- a/src/jalview/schemabinding/version2/JGroup.java +++ b/src/jalview/schemabinding/version2/JGroup.java @@ -198,7 +198,8 @@ public class JGroup implements java.io.Serializable { /** * Optional sequence group ID (only - * needs to be unique for this + * needs to be + * unique for this * alignment) * */ @@ -452,7 +453,8 @@ public class JGroup implements java.io.Serializable { /** * Returns the value of field 'id'. The field 'id' has the * following description: Optional sequence group ID (only - * needs to be unique for this + * needs to be + * unique for this * alignment) * * @@ -1027,7 +1029,8 @@ public class JGroup implements java.io.Serializable { /** * Sets the value of field 'id'. The field 'id' has the * following description: Optional sequence group ID (only - * needs to be unique for this + * needs to be + * unique for this * alignment) * * diff --git a/src/jalview/schemabinding/version2/JSeq.java b/src/jalview/schemabinding/version2/JSeq.java index d5eda07..193b005 100644 --- a/src/jalview/schemabinding/version2/JSeq.java +++ b/src/jalview/schemabinding/version2/JSeq.java @@ -86,6 +86,17 @@ public class JSeq implements java.io.Serializable { */ private java.util.Vector _hiddenSequencesList; + /** + * Reference to a viewer showing RNA structure + * for this sequence. Schema supports one viewer showing + * multiple + * annotations for multiple sequences, though currently only + * one + * annotation for one sequence (gapped or trimmed) is used + * + */ + private java.util.Vector _rnaViewerList; + //----------------/ //- Constructors -/ @@ -96,6 +107,7 @@ public class JSeq implements java.io.Serializable { this._featuresList = new java.util.Vector(); this._pdbidsList = new java.util.Vector(); this._hiddenSequencesList = new java.util.Vector(); + this._rnaViewerList = new java.util.Vector(); } @@ -188,6 +200,34 @@ public class JSeq implements java.io.Serializable { } /** + * + * + * @param vRnaViewer + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addRnaViewer( + final jalview.schemabinding.version2.RnaViewer vRnaViewer) + throws java.lang.IndexOutOfBoundsException { + this._rnaViewerList.addElement(vRnaViewer); + } + + /** + * + * + * @param index + * @param vRnaViewer + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addRnaViewer( + final int index, + final jalview.schemabinding.version2.RnaViewer vRnaViewer) + throws java.lang.IndexOutOfBoundsException { + this._rnaViewerList.add(index, vRnaViewer); + } + + /** */ public void deleteColour( ) { @@ -248,6 +288,17 @@ public class JSeq implements java.io.Serializable { } /** + * Method enumerateRnaViewer. + * + * @return an Enumeration over all + * jalview.schemabinding.version2.RnaViewer elements + */ + public java.util.Enumeration enumerateRnaViewer( + ) { + return this._rnaViewerList.elements(); + } + + /** * Returns the value of field 'colour'. * * @return the value of field 'Colour'. @@ -424,6 +475,51 @@ public class JSeq implements java.io.Serializable { } /** + * Method getRnaViewer. + * + * @param index + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + * @return the value of the + * jalview.schemabinding.version2.RnaViewer at the given index + */ + public jalview.schemabinding.version2.RnaViewer getRnaViewer( + final int index) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._rnaViewerList.size()) { + throw new IndexOutOfBoundsException("getRnaViewer: Index value '" + index + "' not in range [0.." + (this._rnaViewerList.size() - 1) + "]"); + } + + return (jalview.schemabinding.version2.RnaViewer) _rnaViewerList.get(index); + } + + /** + * Method getRnaViewer.Returns the contents of the collection + * in an Array.

    Note: Just in case the collection contents + * are changing in another thread, we pass a 0-length Array of + * the correct type into the API call. This way we know + * that the Array returned is of exactly the correct length. + * + * @return this collection as an Array + */ + public jalview.schemabinding.version2.RnaViewer[] getRnaViewer( + ) { + jalview.schemabinding.version2.RnaViewer[] array = new jalview.schemabinding.version2.RnaViewer[0]; + return (jalview.schemabinding.version2.RnaViewer[]) this._rnaViewerList.toArray(array); + } + + /** + * Method getRnaViewerCount. + * + * @return the size of this collection + */ + public int getRnaViewerCount( + ) { + return this._rnaViewerList.size(); + } + + /** * Returns the value of field 'start'. * * @return the value of field 'Start'. @@ -552,6 +648,13 @@ public class JSeq implements java.io.Serializable { } /** + */ + public void removeAllRnaViewer( + ) { + this._rnaViewerList.clear(); + } + + /** * Method removeFeatures. * * @param vFeatures @@ -624,6 +727,30 @@ public class JSeq implements java.io.Serializable { } /** + * Method removeRnaViewer. + * + * @param vRnaViewer + * @return true if the object was removed from the collection. + */ + public boolean removeRnaViewer( + final jalview.schemabinding.version2.RnaViewer vRnaViewer) { + boolean removed = _rnaViewerList.remove(vRnaViewer); + return removed; + } + + /** + * Method removeRnaViewerAt. + * + * @param index + * @return the element removed from the collection + */ + public jalview.schemabinding.version2.RnaViewer removeRnaViewerAt( + final int index) { + java.lang.Object obj = this._rnaViewerList.remove(index); + return (jalview.schemabinding.version2.RnaViewer) obj; + } + + /** * Sets the value of field 'colour'. * * @param colour the value of field 'colour'. @@ -772,6 +899,41 @@ public class JSeq implements java.io.Serializable { } /** + * + * + * @param index + * @param vRnaViewer + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void setRnaViewer( + final int index, + final jalview.schemabinding.version2.RnaViewer vRnaViewer) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._rnaViewerList.size()) { + throw new IndexOutOfBoundsException("setRnaViewer: Index value '" + index + "' not in range [0.." + (this._rnaViewerList.size() - 1) + "]"); + } + + this._rnaViewerList.set(index, vRnaViewer); + } + + /** + * + * + * @param vRnaViewerArray + */ + public void setRnaViewer( + final jalview.schemabinding.version2.RnaViewer[] vRnaViewerArray) { + //-- copy array + _rnaViewerList.clear(); + + for (int i = 0; i < vRnaViewerArray.length; i++) { + this._rnaViewerList.add(vRnaViewerArray[i]); + } + } + + /** * Sets the value of field 'start'. * * @param start the value of field 'start'. diff --git a/src/jalview/schemabinding/version2/RnaViewer.java b/src/jalview/schemabinding/version2/RnaViewer.java new file mode 100644 index 0000000..96c4195 --- /dev/null +++ b/src/jalview/schemabinding/version2/RnaViewer.java @@ -0,0 +1,643 @@ +/* + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ + */ + +package jalview.schemabinding.version2; + + //---------------------------------/ + //- Imported classes and packages -/ +//---------------------------------/ + +import org.exolab.castor.xml.Marshaller; +import org.exolab.castor.xml.Unmarshaller; + +/** + * Reference to a viewer showing RNA structure + * for this sequence. Schema supports one viewer showing multiple + * annotations for multiple sequences, though currently only one + * annotation for one sequence (gapped or trimmed) is used + * + * + * @version $Revision$ $Date$ + */ +public class RnaViewer implements java.io.Serializable { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field _title. + */ + private java.lang.String _title; + + /** + * An id unique to the RNA viewer panel + * + */ + private java.lang.String _viewId; + + /** + * horizontal position of split pane divider + * + */ + private int _dividerLocation; + + /** + * keeps track of state for field: _dividerLocation + */ + private boolean _has_dividerLocation; + + /** + * Index of the selected structure in the + * viewer panel + * + */ + private int _selectedRna; + + /** + * keeps track of state for field: _selectedRna + */ + private boolean _has_selectedRna; + + /** + * Field _width. + */ + private int _width; + + /** + * keeps track of state for field: _width + */ + private boolean _has_width; + + /** + * Field _height. + */ + private int _height; + + /** + * keeps track of state for field: _height + */ + private boolean _has_height; + + /** + * Field _xpos. + */ + private int _xpos; + + /** + * keeps track of state for field: _xpos + */ + private boolean _has_xpos; + + /** + * Field _ypos. + */ + private int _ypos; + + /** + * keeps track of state for field: _ypos + */ + private boolean _has_ypos; + + /** + * Field _secondaryStructureList. + */ + private java.util.Vector _secondaryStructureList; + + + //----------------/ + //- Constructors -/ + //----------------/ + + public RnaViewer() { + super(); + this._secondaryStructureList = new java.util.Vector(); + } + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * + * + * @param vSecondaryStructure + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addSecondaryStructure( + final jalview.schemabinding.version2.SecondaryStructure vSecondaryStructure) + throws java.lang.IndexOutOfBoundsException { + this._secondaryStructureList.addElement(vSecondaryStructure); + } + + /** + * + * + * @param index + * @param vSecondaryStructure + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addSecondaryStructure( + final int index, + final jalview.schemabinding.version2.SecondaryStructure vSecondaryStructure) + throws java.lang.IndexOutOfBoundsException { + this._secondaryStructureList.add(index, vSecondaryStructure); + } + + /** + */ + public void deleteDividerLocation( + ) { + this._has_dividerLocation= false; + } + + /** + */ + public void deleteHeight( + ) { + this._has_height= false; + } + + /** + */ + public void deleteSelectedRna( + ) { + this._has_selectedRna= false; + } + + /** + */ + public void deleteWidth( + ) { + this._has_width= false; + } + + /** + */ + public void deleteXpos( + ) { + this._has_xpos= false; + } + + /** + */ + public void deleteYpos( + ) { + this._has_ypos= false; + } + + /** + * Method enumerateSecondaryStructure. + * + * @return an Enumeration over all + * jalview.schemabinding.version2.SecondaryStructure elements + */ + public java.util.Enumeration enumerateSecondaryStructure( + ) { + return this._secondaryStructureList.elements(); + } + + /** + * Returns the value of field 'dividerLocation'. The field + * 'dividerLocation' has the following description: horizontal + * position of split pane divider + * + * + * @return the value of field 'DividerLocation'. + */ + public int getDividerLocation( + ) { + return this._dividerLocation; + } + + /** + * Returns the value of field 'height'. + * + * @return the value of field 'Height'. + */ + public int getHeight( + ) { + return this._height; + } + + /** + * Method getSecondaryStructure. + * + * @param index + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + * @return the value of the + * jalview.schemabinding.version2.SecondaryStructure at the + * given index + */ + public jalview.schemabinding.version2.SecondaryStructure getSecondaryStructure( + final int index) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._secondaryStructureList.size()) { + throw new IndexOutOfBoundsException("getSecondaryStructure: Index value '" + index + "' not in range [0.." + (this._secondaryStructureList.size() - 1) + "]"); + } + + return (jalview.schemabinding.version2.SecondaryStructure) _secondaryStructureList.get(index); + } + + /** + * Method getSecondaryStructure.Returns the contents of the + * collection in an Array.

    Note: Just in case the + * collection contents are changing in another thread, we pass + * a 0-length Array of the correct type into the API call. + * This way we know that the Array returned is of + * exactly the correct length. + * + * @return this collection as an Array + */ + public jalview.schemabinding.version2.SecondaryStructure[] getSecondaryStructure( + ) { + jalview.schemabinding.version2.SecondaryStructure[] array = new jalview.schemabinding.version2.SecondaryStructure[0]; + return (jalview.schemabinding.version2.SecondaryStructure[]) this._secondaryStructureList.toArray(array); + } + + /** + * Method getSecondaryStructureCount. + * + * @return the size of this collection + */ + public int getSecondaryStructureCount( + ) { + return this._secondaryStructureList.size(); + } + + /** + * Returns the value of field 'selectedRna'. The field + * 'selectedRna' has the following description: Index of the + * selected structure in the + * viewer panel + * + * + * @return the value of field 'SelectedRna'. + */ + public int getSelectedRna( + ) { + return this._selectedRna; + } + + /** + * Returns the value of field 'title'. + * + * @return the value of field 'Title'. + */ + public java.lang.String getTitle( + ) { + return this._title; + } + + /** + * Returns the value of field 'viewId'. The field 'viewId' has + * the following description: An id unique to the RNA viewer + * panel + * + * + * @return the value of field 'ViewId'. + */ + public java.lang.String getViewId( + ) { + return this._viewId; + } + + /** + * Returns the value of field 'width'. + * + * @return the value of field 'Width'. + */ + public int getWidth( + ) { + return this._width; + } + + /** + * Returns the value of field 'xpos'. + * + * @return the value of field 'Xpos'. + */ + public int getXpos( + ) { + return this._xpos; + } + + /** + * Returns the value of field 'ypos'. + * + * @return the value of field 'Ypos'. + */ + public int getYpos( + ) { + return this._ypos; + } + + /** + * Method hasDividerLocation. + * + * @return true if at least one DividerLocation has been added + */ + public boolean hasDividerLocation( + ) { + return this._has_dividerLocation; + } + + /** + * Method hasHeight. + * + * @return true if at least one Height has been added + */ + public boolean hasHeight( + ) { + return this._has_height; + } + + /** + * Method hasSelectedRna. + * + * @return true if at least one SelectedRna has been added + */ + public boolean hasSelectedRna( + ) { + return this._has_selectedRna; + } + + /** + * Method hasWidth. + * + * @return true if at least one Width has been added + */ + public boolean hasWidth( + ) { + return this._has_width; + } + + /** + * Method hasXpos. + * + * @return true if at least one Xpos has been added + */ + public boolean hasXpos( + ) { + return this._has_xpos; + } + + /** + * Method hasYpos. + * + * @return true if at least one Ypos has been added + */ + public boolean hasYpos( + ) { + return this._has_ypos; + } + + /** + * Method isValid. + * + * @return true if this object is valid according to the schema + */ + public boolean isValid( + ) { + try { + validate(); + } catch (org.exolab.castor.xml.ValidationException vex) { + return false; + } + return true; + } + + /** + * + * + * @param out + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void marshal( + final java.io.Writer out) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, out); + } + + /** + * + * + * @param handler + * @throws java.io.IOException if an IOException occurs during + * marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + */ + public void marshal( + final org.xml.sax.ContentHandler handler) + throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, handler); + } + + /** + */ + public void removeAllSecondaryStructure( + ) { + this._secondaryStructureList.clear(); + } + + /** + * Method removeSecondaryStructure. + * + * @param vSecondaryStructure + * @return true if the object was removed from the collection. + */ + public boolean removeSecondaryStructure( + final jalview.schemabinding.version2.SecondaryStructure vSecondaryStructure) { + boolean removed = _secondaryStructureList.remove(vSecondaryStructure); + return removed; + } + + /** + * Method removeSecondaryStructureAt. + * + * @param index + * @return the element removed from the collection + */ + public jalview.schemabinding.version2.SecondaryStructure removeSecondaryStructureAt( + final int index) { + java.lang.Object obj = this._secondaryStructureList.remove(index); + return (jalview.schemabinding.version2.SecondaryStructure) obj; + } + + /** + * Sets the value of field 'dividerLocation'. The field + * 'dividerLocation' has the following description: horizontal + * position of split pane divider + * + * + * @param dividerLocation the value of field 'dividerLocation'. + */ + public void setDividerLocation( + final int dividerLocation) { + this._dividerLocation = dividerLocation; + this._has_dividerLocation = true; + } + + /** + * Sets the value of field 'height'. + * + * @param height the value of field 'height'. + */ + public void setHeight( + final int height) { + this._height = height; + this._has_height = true; + } + + /** + * + * + * @param index + * @param vSecondaryStructure + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void setSecondaryStructure( + final int index, + final jalview.schemabinding.version2.SecondaryStructure vSecondaryStructure) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._secondaryStructureList.size()) { + throw new IndexOutOfBoundsException("setSecondaryStructure: Index value '" + index + "' not in range [0.." + (this._secondaryStructureList.size() - 1) + "]"); + } + + this._secondaryStructureList.set(index, vSecondaryStructure); + } + + /** + * + * + * @param vSecondaryStructureArray + */ + public void setSecondaryStructure( + final jalview.schemabinding.version2.SecondaryStructure[] vSecondaryStructureArray) { + //-- copy array + _secondaryStructureList.clear(); + + for (int i = 0; i < vSecondaryStructureArray.length; i++) { + this._secondaryStructureList.add(vSecondaryStructureArray[i]); + } + } + + /** + * Sets the value of field 'selectedRna'. The field + * 'selectedRna' has the following description: Index of the + * selected structure in the + * viewer panel + * + * + * @param selectedRna the value of field 'selectedRna'. + */ + public void setSelectedRna( + final int selectedRna) { + this._selectedRna = selectedRna; + this._has_selectedRna = true; + } + + /** + * Sets the value of field 'title'. + * + * @param title the value of field 'title'. + */ + public void setTitle( + final java.lang.String title) { + this._title = title; + } + + /** + * Sets the value of field 'viewId'. The field 'viewId' has the + * following description: An id unique to the RNA viewer panel + * + * + * @param viewId the value of field 'viewId'. + */ + public void setViewId( + final java.lang.String viewId) { + this._viewId = viewId; + } + + /** + * Sets the value of field 'width'. + * + * @param width the value of field 'width'. + */ + public void setWidth( + final int width) { + this._width = width; + this._has_width = true; + } + + /** + * Sets the value of field 'xpos'. + * + * @param xpos the value of field 'xpos'. + */ + public void setXpos( + final int xpos) { + this._xpos = xpos; + this._has_xpos = true; + } + + /** + * Sets the value of field 'ypos'. + * + * @param ypos the value of field 'ypos'. + */ + public void setYpos( + final int ypos) { + this._ypos = ypos; + this._has_ypos = true; + } + + /** + * Method unmarshal. + * + * @param reader + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @return the unmarshaled + * jalview.schemabinding.version2.RnaViewer + */ + public static jalview.schemabinding.version2.RnaViewer unmarshal( + final java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + return (jalview.schemabinding.version2.RnaViewer) Unmarshaller.unmarshal(jalview.schemabinding.version2.RnaViewer.class, reader); + } + + /** + * + * + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void validate( + ) + throws org.exolab.castor.xml.ValidationException { + org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); + validator.validate(this); + } + +} diff --git a/src/jalview/schemabinding/version2/SecondaryStructure.java b/src/jalview/schemabinding/version2/SecondaryStructure.java new file mode 100644 index 0000000..d2f97fb --- /dev/null +++ b/src/jalview/schemabinding/version2/SecondaryStructure.java @@ -0,0 +1,290 @@ +/* + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ + */ + +package jalview.schemabinding.version2; + + //---------------------------------/ + //- Imported classes and packages -/ +//---------------------------------/ + +import org.exolab.castor.xml.Marshaller; +import org.exolab.castor.xml.Unmarshaller; + +/** + * Class SecondaryStructure. + * + * @version $Revision$ $Date$ + */ +public class SecondaryStructure implements java.io.Serializable { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field _title. + */ + private java.lang.String _title; + + /** + * id attribute of Annotation in + * vamsasModel for + * the secondary structure annotation shown + * in the viewer + * + */ + private java.lang.String _annotationId; + + /** + * if true the RNA structure is shown with gaps, if false + * without + * + */ + private boolean _gapped; + + /** + * keeps track of state for field: _gapped + */ + private boolean _has_gapped; + + /** + * name of the project jar entry that holds + * the VARNA viewer state for the structure + * + */ + private java.lang.String _viewerState; + + + //----------------/ + //- Constructors -/ + //----------------/ + + public SecondaryStructure() { + super(); + } + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + */ + public void deleteGapped( + ) { + this._has_gapped= false; + } + + /** + * Returns the value of field 'annotationId'. The field + * 'annotationId' has the following description: id attribute + * of Annotation in + * vamsasModel for + * the secondary structure annotation shown + * in the viewer + * + * + * @return the value of field 'AnnotationId'. + */ + public java.lang.String getAnnotationId( + ) { + return this._annotationId; + } + + /** + * Returns the value of field 'gapped'. The field 'gapped' has + * the following description: if true the RNA structure is + * shown with gaps, if false without + * + * + * @return the value of field 'Gapped'. + */ + public boolean getGapped( + ) { + return this._gapped; + } + + /** + * Returns the value of field 'title'. + * + * @return the value of field 'Title'. + */ + public java.lang.String getTitle( + ) { + return this._title; + } + + /** + * Returns the value of field 'viewerState'. The field + * 'viewerState' has the following description: name of the + * project jar entry that holds + * the VARNA viewer state for the structure + * + * + * @return the value of field 'ViewerState'. + */ + public java.lang.String getViewerState( + ) { + return this._viewerState; + } + + /** + * Method hasGapped. + * + * @return true if at least one Gapped has been added + */ + public boolean hasGapped( + ) { + return this._has_gapped; + } + + /** + * Returns the value of field 'gapped'. The field 'gapped' has + * the following description: if true the RNA structure is + * shown with gaps, if false without + * + * + * @return the value of field 'Gapped'. + */ + public boolean isGapped( + ) { + return this._gapped; + } + + /** + * Method isValid. + * + * @return true if this object is valid according to the schema + */ + public boolean isValid( + ) { + try { + validate(); + } catch (org.exolab.castor.xml.ValidationException vex) { + return false; + } + return true; + } + + /** + * + * + * @param out + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void marshal( + final java.io.Writer out) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, out); + } + + /** + * + * + * @param handler + * @throws java.io.IOException if an IOException occurs during + * marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + */ + public void marshal( + final org.xml.sax.ContentHandler handler) + throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, handler); + } + + /** + * Sets the value of field 'annotationId'. The field + * 'annotationId' has the following description: id attribute + * of Annotation in + * vamsasModel for + * the secondary structure annotation shown + * in the viewer + * + * + * @param annotationId the value of field 'annotationId'. + */ + public void setAnnotationId( + final java.lang.String annotationId) { + this._annotationId = annotationId; + } + + /** + * Sets the value of field 'gapped'. The field 'gapped' has the + * following description: if true the RNA structure is shown + * with gaps, if false without + * + * + * @param gapped the value of field 'gapped'. + */ + public void setGapped( + final boolean gapped) { + this._gapped = gapped; + this._has_gapped = true; + } + + /** + * Sets the value of field 'title'. + * + * @param title the value of field 'title'. + */ + public void setTitle( + final java.lang.String title) { + this._title = title; + } + + /** + * Sets the value of field 'viewerState'. The field + * 'viewerState' has the following description: name of the + * project jar entry that holds + * the VARNA viewer state for the structure + * + * + * @param viewerState the value of field 'viewerState'. + */ + public void setViewerState( + final java.lang.String viewerState) { + this._viewerState = viewerState; + } + + /** + * Method unmarshal. + * + * @param reader + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @return the unmarshaled + * jalview.schemabinding.version2.SecondaryStructure + */ + public static jalview.schemabinding.version2.SecondaryStructure unmarshal( + final java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + return (jalview.schemabinding.version2.SecondaryStructure) Unmarshaller.unmarshal(jalview.schemabinding.version2.SecondaryStructure.class, reader); + } + + /** + * + * + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void validate( + ) + throws org.exolab.castor.xml.ValidationException { + org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); + validator.validate(this); + } + +} diff --git a/src/jalview/schemabinding/version2/Setting.java b/src/jalview/schemabinding/version2/Setting.java index 5408c63..2c19f1f 100644 --- a/src/jalview/schemabinding/version2/Setting.java +++ b/src/jalview/schemabinding/version2/Setting.java @@ -63,7 +63,8 @@ public class Setting implements java.io.Serializable { /** * Optional minimum colour - * for graduated feature + * for graduated + * feature * colour * */ @@ -286,7 +287,8 @@ public class Setting implements java.io.Serializable { * Returns the value of field 'mincolour'. The field * 'mincolour' has the following description: Optional minimum * colour - * for graduated feature + * for graduated + * feature * colour * * @@ -591,7 +593,8 @@ public class Setting implements java.io.Serializable { /** * Sets the value of field 'mincolour'. The field 'mincolour' * has the following description: Optional minimum colour - * for graduated feature + * for graduated + * feature * colour * * diff --git a/src/jalview/schemabinding/version2/StructureState.java b/src/jalview/schemabinding/version2/StructureState.java index 82773a3..fe7c95d 100644 --- a/src/jalview/schemabinding/version2/StructureState.java +++ b/src/jalview/schemabinding/version2/StructureState.java @@ -199,8 +199,17 @@ public class StructureState implements java.io.Serializable { private boolean _has_colourByJmol; /** - * An identifier for the viewer type, currently either - * JMOL or CHIMERA + * An + * identifier + * for + * the + * viewer + * type, + * currently + * either + * JMOL + * or + * CHIMERA * */ private java.lang.String _type; @@ -441,9 +450,17 @@ public class StructureState implements java.io.Serializable { /** * Returns the value of field 'type'. The field 'type' has the - * following description: An identifier for the viewer type, - * currently either - * JMOL or CHIMERA + * following description: An + * identifier + * for + * the + * viewer + * type, + * currently + * either + * JMOL + * or + * CHIMERA * * * @return the value of field 'Type'. @@ -929,9 +946,17 @@ public class StructureState implements java.io.Serializable { /** * Sets the value of field 'type'. The field 'type' has the - * following description: An identifier for the viewer type, - * currently either - * JMOL or CHIMERA + * following description: An + * identifier + * for + * the + * viewer + * type, + * currently + * either + * JMOL + * or + * CHIMERA * * * @param type the value of field 'type'. diff --git a/src/jalview/schemabinding/version2/Tree.java b/src/jalview/schemabinding/version2/Tree.java index 7fd6238..b147498 100644 --- a/src/jalview/schemabinding/version2/Tree.java +++ b/src/jalview/schemabinding/version2/Tree.java @@ -113,7 +113,8 @@ public class Tree implements java.io.Serializable { /** * Tree ID added for binding tree - * visualization settings to vamsas + * visualization + * settings to vamsas * document trees in jalview 2.4.1 * */ @@ -330,7 +331,8 @@ public class Tree implements java.io.Serializable { /** * Returns the value of field 'id'. The field 'id' has the * following description: Tree ID added for binding tree - * visualization settings to vamsas + * visualization + * settings to vamsas * document trees in jalview 2.4.1 * * @@ -716,7 +718,8 @@ public class Tree implements java.io.Serializable { /** * Sets the value of field 'id'. The field 'id' has the * following description: Tree ID added for binding tree - * visualization settings to vamsas + * visualization + * settings to vamsas * document trees in jalview 2.4.1 * * diff --git a/src/jalview/schemabinding/version2/Viewport.java b/src/jalview/schemabinding/version2/Viewport.java index 7dcb3ee..136a3b3 100644 --- a/src/jalview/schemabinding/version2/Viewport.java +++ b/src/jalview/schemabinding/version2/Viewport.java @@ -383,15 +383,16 @@ public class Viewport implements java.io.Serializable { /** * unique id used by jalview to - * synchronize between stored and + * synchronize + * between stored and * instantiated views * */ private java.lang.String _id; /** - * The viewport id of this viewport's (cdna/protein) coding - * complement, if any + * The viewport id of this viewport's + * (cdna/protein) coding complement, if any * */ private java.lang.String _complementId; @@ -882,8 +883,8 @@ public class Viewport implements java.io.Serializable { /** * Returns the value of field 'complementId'. The field * 'complementId' has the following description: The viewport - * id of this viewport's (cdna/protein) coding complement, if - * any + * id of this viewport's + * (cdna/protein) coding complement, if any * * * @return the value of field 'ComplementId'. @@ -1033,7 +1034,8 @@ public class Viewport implements java.io.Serializable { /** * Returns the value of field 'id'. The field 'id' has the * following description: unique id used by jalview to - * synchronize between stored and + * synchronize + * between stored and * instantiated views * * @@ -2151,8 +2153,8 @@ public class Viewport implements java.io.Serializable { /** * Sets the value of field 'complementId'. The field * 'complementId' has the following description: The viewport - * id of this viewport's (cdna/protein) coding complement, if - * any + * id of this viewport's + * (cdna/protein) coding complement, if any * * * @param complementId the value of field 'complementId'. @@ -2299,7 +2301,8 @@ public class Viewport implements java.io.Serializable { /** * Sets the value of field 'id'. The field 'id' has the * following description: unique id used by jalview to - * synchronize between stored and + * synchronize + * between stored and * instantiated views * * diff --git a/src/jalview/schemabinding/version2/descriptors/JSeqDescriptor.java b/src/jalview/schemabinding/version2/descriptors/JSeqDescriptor.java index ab0eaaf..44c8caf 100644 --- a/src/jalview/schemabinding/version2/descriptors/JSeqDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/JSeqDescriptor.java @@ -408,6 +408,48 @@ public class JSeqDescriptor extends org.exolab.castor.xml.util.XMLClassDescripto typeValidator.setMaxInclusive(2147483647); } desc.setValidator(fieldValidator); + //-- _rnaViewerList + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.RnaViewer.class, "_rnaViewerList", "rnaViewer", org.exolab.castor.xml.NodeType.Element); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + JSeq target = (JSeq) object; + return target.getRnaViewer(); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + JSeq target = (JSeq) object; + target.addRnaViewer( (jalview.schemabinding.version2.RnaViewer) value); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException { + try { + JSeq target = (JSeq) object; + target.removeAllRnaViewer(); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return new jalview.schemabinding.version2.RnaViewer(); + } + }; + desc.setHandler(handler); + desc.setNameSpaceURI("www.jalview.org"); + desc.setMultivalued(true); + addFieldDescriptor(desc); + + //-- validation code for: _rnaViewerList + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + fieldValidator.setMinOccurs(0); + { //-- local scope + } + desc.setValidator(fieldValidator); } diff --git a/src/jalview/schemabinding/version2/descriptors/RnaViewerDescriptor.java b/src/jalview/schemabinding/version2/descriptors/RnaViewerDescriptor.java new file mode 100644 index 0000000..fd824a1 --- /dev/null +++ b/src/jalview/schemabinding/version2/descriptors/RnaViewerDescriptor.java @@ -0,0 +1,535 @@ +/* + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ + */ + +package jalview.schemabinding.version2.descriptors; + + //---------------------------------/ + //- Imported classes and packages -/ +//---------------------------------/ + +import jalview.schemabinding.version2.RnaViewer; + +/** + * Class RnaViewerDescriptor. + * + * @version $Revision$ $Date$ + */ +public class RnaViewerDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field _elementDefinition. + */ + private boolean _elementDefinition; + + /** + * Field _nsPrefix. + */ + private java.lang.String _nsPrefix; + + /** + * Field _nsURI. + */ + private java.lang.String _nsURI; + + /** + * Field _xmlName. + */ + private java.lang.String _xmlName; + + + //----------------/ + //- Constructors -/ + //----------------/ + + public RnaViewerDescriptor() { + super(); + _nsURI = "www.jalview.org"; + _xmlName = "rnaViewer"; + _elementDefinition = true; + + //-- set grouping compositor + setCompositorAsSequence(); + org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null; + org.exolab.castor.mapping.FieldHandler handler = null; + org.exolab.castor.xml.FieldValidator fieldValidator = null; + //-- initialize attribute descriptors + + //-- _title + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_title", "title", org.exolab.castor.xml.NodeType.Attribute); + desc.setImmutable(true); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + RnaViewer target = (RnaViewer) object; + return target.getTitle(); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + RnaViewer target = (RnaViewer) object; + target.setTitle( (java.lang.String) value); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return null; + } + }; + desc.setHandler(handler); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _title + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + { //-- local scope + org.exolab.castor.xml.validators.StringValidator typeValidator; + typeValidator = new org.exolab.castor.xml.validators.StringValidator(); + fieldValidator.setValidator(typeValidator); + typeValidator.setWhiteSpace("preserve"); + } + desc.setValidator(fieldValidator); + //-- _viewId + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_viewId", "viewId", org.exolab.castor.xml.NodeType.Attribute); + desc.setImmutable(true); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + RnaViewer target = (RnaViewer) object; + return target.getViewId(); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + RnaViewer target = (RnaViewer) object; + target.setViewId( (java.lang.String) value); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return null; + } + }; + desc.setHandler(handler); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _viewId + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + { //-- local scope + org.exolab.castor.xml.validators.StringValidator typeValidator; + typeValidator = new org.exolab.castor.xml.validators.StringValidator(); + fieldValidator.setValidator(typeValidator); + typeValidator.setWhiteSpace("preserve"); + } + desc.setValidator(fieldValidator); + //-- _dividerLocation + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_dividerLocation", "dividerLocation", org.exolab.castor.xml.NodeType.Attribute); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + RnaViewer target = (RnaViewer) object; + if (!target.hasDividerLocation()) { return null; } + return new java.lang.Integer(target.getDividerLocation()); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + RnaViewer target = (RnaViewer) object; + // if null, use delete method for optional primitives + if (value == null) { + target.deleteDividerLocation(); + return; + } + target.setDividerLocation( ((java.lang.Integer) value).intValue()); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return null; + } + }; + desc.setHandler(handler); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _dividerLocation + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + { //-- local scope + org.exolab.castor.xml.validators.IntValidator typeValidator; + typeValidator = new org.exolab.castor.xml.validators.IntValidator(); + fieldValidator.setValidator(typeValidator); + typeValidator.setMinInclusive(-2147483648); + typeValidator.setMaxInclusive(2147483647); + } + desc.setValidator(fieldValidator); + //-- _selectedRna + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_selectedRna", "selectedRna", org.exolab.castor.xml.NodeType.Attribute); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + RnaViewer target = (RnaViewer) object; + if (!target.hasSelectedRna()) { return null; } + return new java.lang.Integer(target.getSelectedRna()); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + RnaViewer target = (RnaViewer) object; + // if null, use delete method for optional primitives + if (value == null) { + target.deleteSelectedRna(); + return; + } + target.setSelectedRna( ((java.lang.Integer) value).intValue()); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return null; + } + }; + desc.setHandler(handler); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _selectedRna + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + { //-- local scope + org.exolab.castor.xml.validators.IntValidator typeValidator; + typeValidator = new org.exolab.castor.xml.validators.IntValidator(); + fieldValidator.setValidator(typeValidator); + typeValidator.setMinInclusive(-2147483648); + typeValidator.setMaxInclusive(2147483647); + } + desc.setValidator(fieldValidator); + //-- _width + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_width", "width", org.exolab.castor.xml.NodeType.Attribute); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + RnaViewer target = (RnaViewer) object; + if (!target.hasWidth()) { return null; } + return new java.lang.Integer(target.getWidth()); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + RnaViewer target = (RnaViewer) object; + // if null, use delete method for optional primitives + if (value == null) { + target.deleteWidth(); + return; + } + target.setWidth( ((java.lang.Integer) value).intValue()); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return null; + } + }; + desc.setHandler(handler); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _width + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + { //-- local scope + org.exolab.castor.xml.validators.IntValidator typeValidator; + typeValidator = new org.exolab.castor.xml.validators.IntValidator(); + fieldValidator.setValidator(typeValidator); + typeValidator.setMinInclusive(-2147483648); + typeValidator.setMaxInclusive(2147483647); + } + desc.setValidator(fieldValidator); + //-- _height + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_height", "height", org.exolab.castor.xml.NodeType.Attribute); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + RnaViewer target = (RnaViewer) object; + if (!target.hasHeight()) { return null; } + return new java.lang.Integer(target.getHeight()); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + RnaViewer target = (RnaViewer) object; + // if null, use delete method for optional primitives + if (value == null) { + target.deleteHeight(); + return; + } + target.setHeight( ((java.lang.Integer) value).intValue()); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return null; + } + }; + desc.setHandler(handler); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _height + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + { //-- local scope + org.exolab.castor.xml.validators.IntValidator typeValidator; + typeValidator = new org.exolab.castor.xml.validators.IntValidator(); + fieldValidator.setValidator(typeValidator); + typeValidator.setMinInclusive(-2147483648); + typeValidator.setMaxInclusive(2147483647); + } + desc.setValidator(fieldValidator); + //-- _xpos + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_xpos", "xpos", org.exolab.castor.xml.NodeType.Attribute); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + RnaViewer target = (RnaViewer) object; + if (!target.hasXpos()) { return null; } + return new java.lang.Integer(target.getXpos()); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + RnaViewer target = (RnaViewer) object; + // if null, use delete method for optional primitives + if (value == null) { + target.deleteXpos(); + return; + } + target.setXpos( ((java.lang.Integer) value).intValue()); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return null; + } + }; + desc.setHandler(handler); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _xpos + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + { //-- local scope + org.exolab.castor.xml.validators.IntValidator typeValidator; + typeValidator = new org.exolab.castor.xml.validators.IntValidator(); + fieldValidator.setValidator(typeValidator); + typeValidator.setMinInclusive(-2147483648); + typeValidator.setMaxInclusive(2147483647); + } + desc.setValidator(fieldValidator); + //-- _ypos + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_ypos", "ypos", org.exolab.castor.xml.NodeType.Attribute); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + RnaViewer target = (RnaViewer) object; + if (!target.hasYpos()) { return null; } + return new java.lang.Integer(target.getYpos()); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + RnaViewer target = (RnaViewer) object; + // if null, use delete method for optional primitives + if (value == null) { + target.deleteYpos(); + return; + } + target.setYpos( ((java.lang.Integer) value).intValue()); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return null; + } + }; + desc.setHandler(handler); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _ypos + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + { //-- local scope + org.exolab.castor.xml.validators.IntValidator typeValidator; + typeValidator = new org.exolab.castor.xml.validators.IntValidator(); + fieldValidator.setValidator(typeValidator); + typeValidator.setMinInclusive(-2147483648); + typeValidator.setMaxInclusive(2147483647); + } + desc.setValidator(fieldValidator); + //-- initialize element descriptors + + //-- _secondaryStructureList + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.SecondaryStructure.class, "_secondaryStructureList", "secondaryStructure", org.exolab.castor.xml.NodeType.Element); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + RnaViewer target = (RnaViewer) object; + return target.getSecondaryStructure(); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + RnaViewer target = (RnaViewer) object; + target.addSecondaryStructure( (jalview.schemabinding.version2.SecondaryStructure) value); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException { + try { + RnaViewer target = (RnaViewer) object; + target.removeAllSecondaryStructure(); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return new jalview.schemabinding.version2.SecondaryStructure(); + } + }; + desc.setHandler(handler); + desc.setNameSpaceURI("www.jalview.org"); + desc.setRequired(true); + desc.setMultivalued(true); + addFieldDescriptor(desc); + + //-- validation code for: _secondaryStructureList + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + fieldValidator.setMinOccurs(1); + { //-- local scope + } + desc.setValidator(fieldValidator); + } + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method getAccessMode. + * + * @return the access mode specified for this class. + */ + public org.exolab.castor.mapping.AccessMode getAccessMode( + ) { + return null; + } + + /** + * Method getIdentity. + * + * @return the identity field, null if this class has no + * identity. + */ + public org.exolab.castor.mapping.FieldDescriptor getIdentity( + ) { + return super.getIdentity(); + } + + /** + * Method getJavaClass. + * + * @return the Java class represented by this descriptor. + */ + public java.lang.Class getJavaClass( + ) { + return jalview.schemabinding.version2.RnaViewer.class; + } + + /** + * Method getNameSpacePrefix. + * + * @return the namespace prefix to use when marshaling as XML. + */ + public java.lang.String getNameSpacePrefix( + ) { + return _nsPrefix; + } + + /** + * Method getNameSpaceURI. + * + * @return the namespace URI used when marshaling and + * unmarshaling as XML. + */ + public java.lang.String getNameSpaceURI( + ) { + return _nsURI; + } + + /** + * Method getValidator. + * + * @return a specific validator for the class described by this + * ClassDescriptor. + */ + public org.exolab.castor.xml.TypeValidator getValidator( + ) { + return this; + } + + /** + * Method getXMLName. + * + * @return the XML Name for the Class being described. + */ + public java.lang.String getXMLName( + ) { + return _xmlName; + } + + /** + * Method isElementDefinition. + * + * @return true if XML schema definition of this Class is that + * of a global + * element or element with anonymous type definition. + */ + public boolean isElementDefinition( + ) { + return _elementDefinition; + } + +} diff --git a/src/jalview/schemabinding/version2/descriptors/SecondaryStructureDescriptor.java b/src/jalview/schemabinding/version2/descriptors/SecondaryStructureDescriptor.java new file mode 100644 index 0000000..bc7e4ac --- /dev/null +++ b/src/jalview/schemabinding/version2/descriptors/SecondaryStructureDescriptor.java @@ -0,0 +1,311 @@ +/* + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ + */ + +package jalview.schemabinding.version2.descriptors; + + //---------------------------------/ + //- Imported classes and packages -/ +//---------------------------------/ + +import jalview.schemabinding.version2.SecondaryStructure; + +/** + * Class SecondaryStructureDescriptor. + * + * @version $Revision$ $Date$ + */ +public class SecondaryStructureDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field _elementDefinition. + */ + private boolean _elementDefinition; + + /** + * Field _nsPrefix. + */ + private java.lang.String _nsPrefix; + + /** + * Field _nsURI. + */ + private java.lang.String _nsURI; + + /** + * Field _xmlName. + */ + private java.lang.String _xmlName; + + + //----------------/ + //- Constructors -/ + //----------------/ + + public SecondaryStructureDescriptor() { + super(); + _nsURI = "www.jalview.org"; + _xmlName = "secondaryStructure"; + _elementDefinition = true; + org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null; + org.exolab.castor.mapping.FieldHandler handler = null; + org.exolab.castor.xml.FieldValidator fieldValidator = null; + //-- initialize attribute descriptors + + //-- _title + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_title", "title", org.exolab.castor.xml.NodeType.Attribute); + desc.setImmutable(true); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + SecondaryStructure target = (SecondaryStructure) object; + return target.getTitle(); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + SecondaryStructure target = (SecondaryStructure) object; + target.setTitle( (java.lang.String) value); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return null; + } + }; + desc.setHandler(handler); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _title + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + { //-- local scope + org.exolab.castor.xml.validators.StringValidator typeValidator; + typeValidator = new org.exolab.castor.xml.validators.StringValidator(); + fieldValidator.setValidator(typeValidator); + typeValidator.setWhiteSpace("preserve"); + } + desc.setValidator(fieldValidator); + //-- _annotationId + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_annotationId", "annotationId", org.exolab.castor.xml.NodeType.Attribute); + desc.setImmutable(true); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + SecondaryStructure target = (SecondaryStructure) object; + return target.getAnnotationId(); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + SecondaryStructure target = (SecondaryStructure) object; + target.setAnnotationId( (java.lang.String) value); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return null; + } + }; + desc.setHandler(handler); + desc.setRequired(true); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _annotationId + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + fieldValidator.setMinOccurs(1); + { //-- local scope + org.exolab.castor.xml.validators.StringValidator typeValidator; + typeValidator = new org.exolab.castor.xml.validators.StringValidator(); + fieldValidator.setValidator(typeValidator); + typeValidator.setWhiteSpace("preserve"); + } + desc.setValidator(fieldValidator); + //-- _gapped + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_gapped", "gapped", org.exolab.castor.xml.NodeType.Attribute); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + SecondaryStructure target = (SecondaryStructure) object; + if (!target.hasGapped()) { return null; } + return (target.getGapped() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + SecondaryStructure target = (SecondaryStructure) object; + // if null, use delete method for optional primitives + if (value == null) { + target.deleteGapped(); + return; + } + target.setGapped( ((java.lang.Boolean) value).booleanValue()); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return null; + } + }; + desc.setHandler(handler); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _gapped + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + { //-- local scope + org.exolab.castor.xml.validators.BooleanValidator typeValidator; + typeValidator = new org.exolab.castor.xml.validators.BooleanValidator(); + fieldValidator.setValidator(typeValidator); + } + desc.setValidator(fieldValidator); + //-- _viewerState + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_viewerState", "viewerState", org.exolab.castor.xml.NodeType.Attribute); + desc.setImmutable(true); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + SecondaryStructure target = (SecondaryStructure) object; + return target.getViewerState(); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + SecondaryStructure target = (SecondaryStructure) object; + target.setViewerState( (java.lang.String) value); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return null; + } + }; + desc.setHandler(handler); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _viewerState + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + { //-- local scope + org.exolab.castor.xml.validators.StringValidator typeValidator; + typeValidator = new org.exolab.castor.xml.validators.StringValidator(); + fieldValidator.setValidator(typeValidator); + typeValidator.setWhiteSpace("preserve"); + } + desc.setValidator(fieldValidator); + //-- initialize element descriptors + + } + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method getAccessMode. + * + * @return the access mode specified for this class. + */ + public org.exolab.castor.mapping.AccessMode getAccessMode( + ) { + return null; + } + + /** + * Method getIdentity. + * + * @return the identity field, null if this class has no + * identity. + */ + public org.exolab.castor.mapping.FieldDescriptor getIdentity( + ) { + return super.getIdentity(); + } + + /** + * Method getJavaClass. + * + * @return the Java class represented by this descriptor. + */ + public java.lang.Class getJavaClass( + ) { + return jalview.schemabinding.version2.SecondaryStructure.class; + } + + /** + * Method getNameSpacePrefix. + * + * @return the namespace prefix to use when marshaling as XML. + */ + public java.lang.String getNameSpacePrefix( + ) { + return _nsPrefix; + } + + /** + * Method getNameSpaceURI. + * + * @return the namespace URI used when marshaling and + * unmarshaling as XML. + */ + public java.lang.String getNameSpaceURI( + ) { + return _nsURI; + } + + /** + * Method getValidator. + * + * @return a specific validator for the class described by this + * ClassDescriptor. + */ + public org.exolab.castor.xml.TypeValidator getValidator( + ) { + return this; + } + + /** + * Method getXMLName. + * + * @return the XML Name for the Class being described. + */ + public java.lang.String getXMLName( + ) { + return _xmlName; + } + + /** + * Method isElementDefinition. + * + * @return true if XML schema definition of this Class is that + * of a global + * element or element with anonymous type definition. + */ + public boolean isElementDefinition( + ) { + return _elementDefinition; + } + +} diff --git a/src/jalview/schemes/GraduatedColor.java b/src/jalview/schemes/GraduatedColor.java index 4f1cb58..8a55f79 100644 --- a/src/jalview/schemes/GraduatedColor.java +++ b/src/jalview/schemes/GraduatedColor.java @@ -145,7 +145,7 @@ public class GraduatedColor public boolean isColored(SequenceFeature feature) { float val = feature.getScore(); - if (val == Float.NaN) + if (Float.isNaN(val)) { return true; } @@ -153,7 +153,7 @@ public class GraduatedColor { return true; } - if (this.thrsh == Float.NaN) + if (Float.isNaN(this.thrsh)) { return true; } @@ -211,7 +211,7 @@ public class GraduatedColor return getMaxColor(); } float scr = feature.getScore(); - if (scr == Float.NaN) + if (Float.isNaN(scr)) { return getMinColor(); } diff --git a/src/jalview/structure/SecondaryStructureListener.java b/src/jalview/structure/SecondaryStructureListener.java index 5d5d880..a7384f8 100644 --- a/src/jalview/structure/SecondaryStructureListener.java +++ b/src/jalview/structure/SecondaryStructureListener.java @@ -20,11 +20,20 @@ */ package jalview.structure; -import jalview.datamodel.*; +import jalview.datamodel.SequenceI; public interface SecondaryStructureListener { // TODO - redefine to allow RNA mouseovers to be passed back correctly to // listeners - public void mouseOverSequence(SequenceI sequence, int index); + /** + * act on a mouseover event + * + * @param sequence + * @param index + * the aligned sequence position (base 0) + * @param position + * the dataset sequence position (base 1) + */ + public void mouseOverSequence(SequenceI sequence, int index, int position); } diff --git a/src/jalview/structure/StructureSelectionManager.java b/src/jalview/structure/StructureSelectionManager.java index 0253a7e..ac14b52 100644 --- a/src/jalview/structure/StructureSelectionManager.java +++ b/src/jalview/structure/StructureSelectionManager.java @@ -739,7 +739,7 @@ public class StructureSelectionManager else if (listener instanceof SecondaryStructureListener) { ((SecondaryStructureListener) listener).mouseOverSequence(seq, - indexpos); + indexpos, index); } } } diff --git a/src/jalview/util/ImageMaker.java b/src/jalview/util/ImageMaker.java index 100ecf5..8abe965 100755 --- a/src/jalview/util/ImageMaker.java +++ b/src/jalview/util/ImageMaker.java @@ -20,6 +20,7 @@ */ package jalview.util; +import jalview.bin.Jalview; import jalview.gui.EPSOptions; import jalview.gui.SVGOptions; import jalview.io.JalviewFileChooser; @@ -259,6 +260,10 @@ public class ImageMaker static JalviewFileChooser getPNGChooser() { + if (Jalview.isHeadlessMode()) + { + return null; + } return new jalview.io.JalviewFileChooser( jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[] { "png" }, new String[] @@ -267,6 +272,10 @@ public class ImageMaker static JalviewFileChooser getEPSChooser() { + if (Jalview.isHeadlessMode()) + { + return null; + } return new jalview.io.JalviewFileChooser( jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[] { "eps" }, new String[] @@ -275,6 +284,10 @@ public class ImageMaker static JalviewFileChooser getSVGChooser() { + if (Jalview.isHeadlessMode()) + { + return null; + } return new jalview.io.JalviewFileChooser( jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[] { "svg" }, new String[] diff --git a/src/jalview/util/Platform.java b/src/jalview/util/Platform.java index 333aff4..b812feb 100644 --- a/src/jalview/util/Platform.java +++ b/src/jalview/util/Platform.java @@ -32,13 +32,13 @@ public class Platform * * @return true if we do things in a special way. */ - public boolean isAMac() + public static boolean isAMac() { return java.lang.System.getProperty("os.name").indexOf("Mac") > -1; } - public boolean isHeadless() + public static boolean isHeadless() { String hdls = java.lang.System.getProperty("java.awt.headless"); diff --git a/src/jalview/util/StringUtils.java b/src/jalview/util/StringUtils.java index 1325ce5..c55d467 100644 --- a/src/jalview/util/StringUtils.java +++ b/src/jalview/util/StringUtils.java @@ -66,7 +66,7 @@ public class StringUtils */ public static final char[] deleteChars(char[] in, int from, int to) { - if (from >= in.length) + if (from >= in.length || from < 0) { return in; } diff --git a/src/jalview/viewmodel/AlignmentViewport.java b/src/jalview/viewmodel/AlignmentViewport.java index 5617bcf..899e8a7 100644 --- a/src/jalview/viewmodel/AlignmentViewport.java +++ b/src/jalview/viewmodel/AlignmentViewport.java @@ -2501,14 +2501,14 @@ public abstract class AlignmentViewport implements AlignViewportI, */ protected int findComplementScrollTarget(SearchResults sr) { - final AlignViewportI codingComplement = getCodingComplement(); - if (codingComplement == null || !codingComplement.isFollowHighlight()) + final AlignViewportI complement = getCodingComplement(); + if (complement == null || !complement.isFollowHighlight()) { return 0; } boolean iAmProtein = !getAlignment().isNucleotide(); AlignmentI proteinAlignment = iAmProtein ? getAlignment() - : codingComplement.getAlignment(); + : complement.getAlignment(); if (proteinAlignment == null) { return 0; @@ -2546,7 +2546,7 @@ public abstract class AlignmentViewport implements AlignViewportI, .findMappingsForSequence(sequence, mappings); if (!seqMappings.isEmpty()) { - break; + break; } } diff --git a/src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java b/src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java index 674f3d1..19c6ca8 100644 --- a/src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java +++ b/src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java @@ -369,7 +369,7 @@ public abstract class FeatureRendererModel implements { allfeatures.add(features[index].getType()); } - if (features[index].score != Float.NaN) + if (!Float.isNaN(features[index].score)) { int nonpos = features[index].getBegin() >= 1 ? 0 : 1; float[][] mm = (float[][]) minmax.get(features[index].getType()); diff --git a/src/jalview/ws/EnfinEnvision2OneWay.java b/src/jalview/ws/EnfinEnvision2OneWay.java deleted file mode 100644 index 239a626..0000000 --- a/src/jalview/ws/EnfinEnvision2OneWay.java +++ /dev/null @@ -1,703 +0,0 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) - * Copyright (C) $$Year-Rel$$ The Jalview Authors - * - * This file is part of Jalview. - * - * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. - * - * Jalview is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Jalview. If not, see . - * The Jalview Authors are detailed in the 'AUTHORS' file. - */ -package jalview.ws; - -import jalview.bin.Cache; -import jalview.datamodel.DBRefEntry; -import jalview.datamodel.SequenceGroup; -import jalview.datamodel.SequenceI; -import jalview.gui.AlignFrame; -import jalview.gui.Desktop; -import jalview.gui.JvSwingUtils; -import jalview.util.GroupUrlLink; -import jalview.util.MessageManager; -import jalview.util.GroupUrlLink.UrlStringTooLongException; - -import java.awt.Component; -import java.awt.Cursor; -import java.awt.event.ActionEvent; -import java.io.UnsupportedEncodingException; -import java.net.URL; -import java.net.URLEncoder; -import java.util.Hashtable; -import java.util.Map; -import java.util.Vector; -import java.util.regex.Pattern; - -import javax.swing.JMenu; -import javax.swing.JMenuItem; -import javax.swing.JOptionPane; -import javax.swing.event.MenuEvent; -import javax.swing.event.MenuListener; -import javax.xml.parsers.SAXParser; -import javax.xml.parsers.SAXParserFactory; - -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; -import org.xml.sax.helpers.DefaultHandler; - -import com.lowagie.text.html.HtmlEncoder; - -/** - * Lightweight runnable to discover dynamic 'one way' group URL services - * - * as of Jalview 2.8.1 this class is mothballed and will be dropped in v3. - * - * @author JimP - * @deprecated - * - */ -public class EnfinEnvision2OneWay extends DefaultHandler implements - Runnable, WSMenuEntryProviderI -{ - private static EnfinEnvision2OneWay groupURLLinksGatherer = null; - - public static EnfinEnvision2OneWay getInstance() - { - if (groupURLLinksGatherer == null) - { - groupURLLinksGatherer = new EnfinEnvision2OneWay(); - } - return groupURLLinksGatherer; - } - - private void waitForCompletion() - { - if (groupURLLinksGatherer.isRunning()) - { - // wait around and show a visual delay indicator - Cursor oldCursor = Desktop.instance.getCursor(); - Desktop.instance.setCursor(new Cursor(Cursor.WAIT_CURSOR)); - while (groupURLLinksGatherer.isRunning()) - { - try - { - Thread.sleep(100); - } catch (InterruptedException e) - { - } - ; - } - Desktop.instance.setCursor(oldCursor); - } - } - - public Vector getEnvisionServiceGroupURLS() - { - waitForCompletion(); - return groupURLLinks; - } - - /** - * indicate if - */ - private static String BACKGROUND = "BACKGROUNDPARAM"; - - /** - * contains null strings or one of the above constants - indicate if this URL - * is a special case. - */ - private Vector additionalPar = new Vector(); - - /** - * the enfin service URL - */ - private String enfinService = null; - - private String description = null; - - private String wfname; - - /* - * (non-Javadoc) - * - * @see org.xml.sax.helpers.DefaultHandler#endElement(java.lang.String, - * java.lang.String, java.lang.String) - */ - public void endElement(String uri, String localName, String qName) - throws SAXException - { - - // System.err.println("End element: : '"+uri+" "+localName+" "+qName); - if (qName.equalsIgnoreCase("workflow") && description != null - && description.length() > 0) - { - // groupURLLinks.addElement("UNIPROT|EnVision2|http://www.ebi.ac.uk/enfin-srv/envision2/pages/linkin.jsf?tool=Jalview&workflow=Default&datasetName=JalviewIDs$DATASETID$&input=$SEQUENCEIDS$&inputType=0|,"); - // groupURLLinks.addElement("Seqs|EnVision2|http://www.ebi.ac.uk/enfin-srv/envision2/pages/linkin.jsf?tool=Jalview&workflow=Default&datasetName=JalviewSeqs$DATASETID$&input=$SEQUENCES=/([A-Za-z]+)+/=$&inputType=1|,"); - System.err.println("Adding entry for " + wfname + " " + description); - if (wfname.toLowerCase().indexOf("funcnet") == -1) - { - description = Pattern.compile("\\s+", Pattern.MULTILINE) - .matcher(description).replaceAll(" "); - groupURLdescr.addElement(description); - groupURLdescr.addElement(description); - String urlstub = wfname; - if (wfname.indexOf(" ") > -1) - { - // make the name safe! - try - { - urlstub = URLEncoder.encode(wfname, "utf-8"); - } catch (UnsupportedEncodingException e) - { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - groupURLLinks - .addElement(wfname - + "|" - + "http://www.ebi.ac.uk/enfin-srv/envision2/pages/linkin.jsf?tool=Jalview&workflow=" - + urlstub - + "&datasetName=JalviewSeqs$DATASETID$&input=$SEQUENCEIDS$&inputType=0|,"); // #"+description+"#"); - groupURLLinks - .addElement(wfname - + "|" - + "http://www.ebi.ac.uk/enfin-srv/envision2/pages/linkin.jsf?tool=Jalview&workflow=" - + urlstub - + "&datasetName=JalviewSeqs$DATASETID$&input=$SEQUENCES=/([A-Za-z]+)+/=$&inputType=1|,"); // #"+description+"#"); - } - } - } - - /* - * (non-Javadoc) - * - * @see org.xml.sax.helpers.DefaultHandler#characters(char[], int, int) - */ - public void characters(char[] ch, int start, int length) - throws SAXException - { - if (description != null) - { - for (int i = start; i < start + length; i++) - { - description += ch[i]; - } - } - } - - /* - * (non-Javadoc) - * - * @see org.xml.sax.helpers.DefaultHandler#startElement(java.lang.String, - * java.lang.String, java.lang.String, org.xml.sax.Attributes) - */ - public void startElement(String uri, String localName, String qName, - Attributes attributes) throws SAXException - { - if (qName.equalsIgnoreCase("workflow")) - { - description = null; - wfname = attributes.getValue("name"); - } - if (qName.equalsIgnoreCase("description")) - { - description = ""; - } - - // System.err.println("Start element: : '"+uri+" "+localName+" "+qName+" attributes"+attributes); - // super.startElement(uri,localName,qname,attributes); - } - - private boolean started = false; - - private boolean running = false; - - private Vector groupURLLinks = null; - - private Vector groupURLdescr = null; - - private static String[] allowedDb = new String[] - { "UNIPROT", "EMBL", "PDB" }; - - public EnfinEnvision2OneWay() - { - groupURLLinks = new Vector(); - groupURLdescr = new Vector(); - - enfinService = Cache.getDefault("ENVISION2_WORKFLOWSERVICE", - "http://www.ebi.ac.uk/enfin-srv/envision2/pages/workflows.xml"); - new Thread(this).start(); - } - - public void run() - { - started = true; - running = true; - try - { - SAXParserFactory spf = SAXParserFactory.newInstance(); - SAXParser sp = spf.newSAXParser(); - sp.parse(new URL(enfinService).openStream(), this); - } catch (Exception e) - { - Cache.log.warn("Exception when discovering One Way services: ", e); - } catch (Error e) - { - Cache.log.warn("Error when discovering One Way services: ", e); - } - running = false; - Cache.log.debug("Finished running."); - } - - /** - * have we finished running yet ? - * - * @return false if we have been run. - */ - public boolean isRunning() - { - - // TODO Auto-generated method stub - return !started || running; - } - - public static void main(String[] args) - { - Cache.initLogger(); - EnfinEnvision2OneWay ow = new EnfinEnvision2OneWay(); - while (ow.isRunning()) - { - try - { - Thread.sleep(50); - } catch (Exception e) - { - } - ; - - } - for (int i = 0; i < ow.groupURLLinks.size(); i++) - { - System.err.println("Description" + ow.groupURLdescr.elementAt(i) - + "Service URL: " + ow.groupURLLinks.elementAt(i)); - } - } - - // / Copied from jalview.gui.PopupMenu - /** - * add a late bound URL service item to the given menu - * - * @param linkMenu - * @param label - * - menu label string - * @param urlgenerator - * GroupURLLink used to generate URL - * @param urlstub - * Object array returned from the makeUrlStubs function. - */ - private void addshowLink(JMenu linkMenu, String label, String descr, - String dbname, final GroupUrlLink urlgenerator, - final Object[] urlstub) - { - Component[] jmi = linkMenu.getMenuComponents(); - for (int i = 0; i < jmi.length; i++) - { - if (jmi[i] instanceof JMenuItem - && ((JMenuItem) jmi[i]).getText().equalsIgnoreCase(label)) - { - // don't add this - its a repeat of an existing URL. - return; - } - } - try - { - descr = HtmlEncoder.encode(descr); - } catch (Exception e) - { - } - ; - - boolean seqsorids = (urlgenerator.getGroupURLType() & urlgenerator.SEQUENCEIDS) == 0; - int i = urlgenerator.getNumberInvolved(urlstub); - JMenuItem item = new JMenuItem(label); - // - if (dbname == null || dbname.trim().length() == 0) - { - dbname = ""; - } - item.setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager.formatMessage("label.submit_sequence", new String[]{Integer.valueOf(i).toString(), dbname, (seqsorids ? "sequence" : "sequence id"), (i > 1 ? "s" : "")}))); - item.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(ActionEvent e) - { - new Thread(new Runnable() - { - - public void run() - { - try - { - showLink(urlgenerator.constructFrom(urlstub)); - } catch (UrlStringTooLongException ex) - { - Cache.log.warn("Not showing link: URL is too long!", ex); - } - } - - }).start(); - } - }); - - linkMenu.add(item); - } - - /** - * open the given link in a new browser window - * - * @param url - */ - public void showLink(String url) - { - try - { - jalview.util.BrowserLauncher.openURL(url); - } catch (Exception ex) - { - JOptionPane - .showInternalMessageDialog( - Desktop.desktop, - MessageManager.getString("label.web_browser_not_found_unix"), - MessageManager.getString("label.web_browser_not_found"), JOptionPane.WARNING_MESSAGE); - - ex.printStackTrace(); - } - } - - /** - * called by a web service menu instance when it is opened. - * - * @param enfinServiceMenu - * @param alignFrame - */ - private void buildGroupLinkMenu(JMenu enfinServiceMenu, - AlignFrame alignFrame) - { - if (running || !started) - { - return; - } - SequenceI[] seqs = alignFrame.getViewport().getSelectionAsNewSequence(); - SequenceGroup sg = alignFrame.getViewport().getSelectionGroup(); - if (sg == null) - { - // consider visible regions here/ - } - enfinServiceMenu.removeAll(); - JMenu entries = buildGroupURLMenu(seqs, sg); - if (entries != null) - { - for (int i = 0, iSize = entries.getMenuComponentCount(); i < iSize; i++) - { - // transfer - menu component is removed from entries automatically - enfinServiceMenu.add(entries.getMenuComponent(0)); - } - // entries.removeAll(); - enfinServiceMenu.setEnabled(true); - } - else - { - enfinServiceMenu.setEnabled(false); - } - } - - /** - * construct a dynamic enfin services menu given a sequence selection - * - * @param seqs - * @param sg - * @param groupLinks - * @return - */ - private JMenu buildGroupURLMenu(SequenceI[] seqs, SequenceGroup sg) - { - if (groupURLdescr == null || groupURLLinks == null) - return null; - // TODO: usability: thread off the generation of group url content so root - // menu appears asap - // sequence only URLs - // ID/regex match URLs - JMenu groupLinksMenu = new JMenu(MessageManager.getString("action.group_link")); - String[][] idandseqs = GroupUrlLink.formStrings(seqs); - Hashtable commonDbrefs = new Hashtable(); - for (int sq = 0; sq < seqs.length; sq++) - { - - int start, end; - if (sg != null) - { - start = seqs[sq].findPosition(sg.getStartRes()); - end = seqs[sq].findPosition(sg.getEndRes()); - } - else - { - // get total width of alignment. - start = seqs[sq].getStart(); - end = seqs[sq].findPosition(seqs[sq].getLength()); - } - // we skip sequences which do not have any non-gaps in the region of - // interest - if (start > end) - { - continue; - } - // just collect ids from dataset sequence - // TODO: check if IDs collected from selecton group intersects with the - // current selection, too - SequenceI sqi = seqs[sq]; - while (sqi.getDatasetSequence() != null) - { - sqi = sqi.getDatasetSequence(); - } - DBRefEntry[] dbr = sqi.getDBRef(); - if (dbr != null && dbr.length > 0) - { - for (int d = 0; d < dbr.length; d++) - { - String src = dbr[d].getSource(); // jalview.util.DBRefUtils.getCanonicalName(dbr[d].getSource()).toUpperCase(); - Object[] sarray = (Object[]) commonDbrefs.get(src); - if (sarray == null) - { - sarray = new Object[2]; - sarray[0] = new int[] - { 0 }; - sarray[1] = new String[seqs.length]; - - commonDbrefs.put(src, sarray); - } - - if (((String[]) sarray[1])[sq] == null) - { - if (!dbr[d].hasMap() - || (dbr[d].getMap().locateMappedRange(start, end) != null)) - { - ((String[]) sarray[1])[sq] = dbr[d].getAccessionId(); - ((int[]) sarray[0])[0]++; - } - } - } - } - } - // now create group links for all distinct ID/sequence sets. - Hashtable gurlMenus = new Hashtable(); - /** - * last number of sequences where URL generation failed - */ - int[] nsqtype = new int[] - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - for (int i = 0; i < groupURLLinks.size(); i++) - { - String link = (String) groupURLLinks.elementAt(i); - String descr = (String) groupURLdescr.elementAt(i); - - // boolean specialCase = - // additionalPar.elementAt(i).toString().equals(BACKGROUND); - GroupUrlLink urlLink = null; - try - { - urlLink = new GroupUrlLink(link); - } catch (Exception foo) - { - jalview.bin.Cache.log.error("Exception for GroupURLLink '" + link - + "'", foo); - continue; - } - ; - if (!urlLink.isValid()) - { - jalview.bin.Cache.log.error(urlLink.getInvalidMessage()); - continue; - } - final String label = urlLink.getLabel(); - // create/recover the sub menus that might be populated for this link. - JMenu[] wflinkMenus = gurlMenus.get(label); - if (wflinkMenus == null) - { - // three types of url that might be - // created. - wflinkMenus = new JMenu[] - { null, new JMenu(MessageManager.getString("action.ids")), new JMenu(MessageManager.getString("action.sequences")), - new JMenu(MessageManager.getString("action.ids_sequences")) }; - gurlMenus.put(label, wflinkMenus); - } - - boolean usingNames = false; - // Now see which parts of the group apply for this URL - String ltarget; - String[] seqstr, ids; // input to makeUrl - for (int t = 0; t < allowedDb.length; t++) - { - ltarget = allowedDb[t]; // jalview.util.DBRefUtils.getCanonicalName(urlLink.getTarget()); - Object[] idset = (Object[]) commonDbrefs.get(ltarget.toUpperCase()); - if (idset != null) - { - int numinput = ((int[]) idset[0])[0]; - String[] allids = ((String[]) idset[1]); - seqstr = new String[numinput]; - ids = new String[numinput]; - if (nsqtype[urlLink.getGroupURLType()] > 0 - && numinput >= nsqtype[urlLink.getGroupURLType()]) - { - continue; - } - for (int sq = 0, idcount = 0; sq < seqs.length; sq++) - { - if (allids[sq] != null) - { - ids[idcount] = allids[sq]; - seqstr[idcount++] = idandseqs[1][sq]; - } - } - try - { - createAndAddLinks(wflinkMenus, false, urlLink, ltarget, null, - descr, ids, seqstr); - } catch (UrlStringTooLongException ex) - { - nsqtype[urlLink.getGroupURLType()] = numinput; - } - } - } - // also do names only. - seqstr = idandseqs[1]; - ids = idandseqs[0]; - if (nsqtype[urlLink.getGroupURLType()] > 0 - && idandseqs[0].length >= nsqtype[urlLink.getGroupURLType()]) - { - continue; - } - - try - { - createAndAddLinks(wflinkMenus, true, urlLink, "Any", null, descr, - ids, seqstr); - } catch (UrlStringTooLongException ex) - { - nsqtype[urlLink.getGroupURLType()] = idandseqs[0].length; - } - } - boolean anyadded = false; // indicates if there are any group links to give - // to user - for (Map.Entry menues : gurlMenus.entrySet()) - { - JMenu grouplinkset = new JMenu(menues.getKey()); - JMenu[] wflinkMenus = menues.getValue(); - for (int m = 0; m < wflinkMenus.length; m++) - { - if (wflinkMenus[m] != null - && wflinkMenus[m].getMenuComponentCount() > 0) - { - anyadded = true; - grouplinkset.add(wflinkMenus[m]); - } - } - groupLinksMenu.add(grouplinkset); - } - if (anyadded) - { - return groupLinksMenu; - } - return null; - } - - private boolean createAndAddLinks(JMenu[] linkMenus, boolean usingNames, - GroupUrlLink urlLink, String label, String ltarget, String descr, - String[] ids, String[] seqstr) throws UrlStringTooLongException - { - Object[] urlset = urlLink.makeUrlStubs(ids, seqstr, "FromJalview" - + System.currentTimeMillis(), false); - - if (urlset != null) - { - int type = urlLink.getGroupURLType() & 3; - // System.out.println(urlLink.getGroupURLType() - // +" "+((String[])urlset[3])[0]); - // first two bits ofurlLink type bitfield are sequenceids and sequences - // TODO: FUTURE: ensure the groupURL menu structure can be generalised - addshowLink( - linkMenus[type], - label - + " " - + (ltarget == null ? (((type & 1) == 1 ? "ID" - : "Sequence") + (urlLink - .getNumberInvolved(urlset) > 1 ? "s" : "")) - : (usingNames ? (((type & 1) == 1) ? "(Names)" - : "") - : ("(" + ltarget + ")"))), descr, - usingNames ? null : label, urlLink, urlset); - return true; - } - return false; - } - - // / end of stuff copied from popupmenu - public void attachWSMenuEntry(final JMenu wsmenu, - final AlignFrame alignFrame) - { - final JMenu enfinServiceMenu = new JMenu("Envision 2"); - wsmenu.add(enfinServiceMenu); - enfinServiceMenu.setEnabled(false); - wsmenu.addMenuListener(new MenuListener() - { - // this listener remembers when the menu was first selected, and - // doesn't rebuild the session list until it has been cleared and - // reselected again. - boolean refresh = true; - - public void menuCanceled(MenuEvent e) - { - refresh = true; - } - - public void menuDeselected(MenuEvent e) - { - refresh = true; - } - - public void menuSelected(MenuEvent e) - { - if (refresh && !isRunning()) - { - new Thread(new Runnable() - { - public void run() - { - try - { - buildGroupLinkMenu(enfinServiceMenu, alignFrame); - } catch (OutOfMemoryError ex) - { - Cache.log - .error("Out of memory when calculating the Envision2 links.", - ex); - enfinServiceMenu.setEnabled(false); - } - } - }).start(); - refresh = false; - } - } - }); - - } - -} diff --git a/src/jalview/ws/dbsources/PDBRestClient.java b/src/jalview/ws/dbsources/PDBRestClient.java index 67ab3f2..09c10ef 100644 --- a/src/jalview/ws/dbsources/PDBRestClient.java +++ b/src/jalview/ws/dbsources/PDBRestClient.java @@ -269,27 +269,27 @@ public class PDBRestClient * table. The PDB Id serves as a unique identifier for a given row in the * summary table * - * @param wantedFeilds + * @param wantedFields * the available table columns in no particular order * @return the pdb id field column index */ public static int getPDBIdColumIndex( - Collection wantedFeilds, boolean hasRefSeq) + Collection wantedFields, boolean hasRefSeq) { // If a reference sequence is attached then start counting from 1 else // start from zero - int pdbFeildIndexCounter = hasRefSeq ? 1 : 0; + int pdbFieldIndexCounter = hasRefSeq ? 1 : 0; - for (PDBDocField feild : wantedFeilds) + for (PDBDocField field : wantedFields) { - if (feild.equals(PDBDocField.PDB_ID)) + if (field.equals(PDBDocField.PDB_ID)) { break; // Once PDB Id index is determined exit iteration } - ++pdbFeildIndexCounter; + ++pdbFieldIndexCounter; } - return pdbFeildIndexCounter; + return pdbFieldIndexCounter; } /** diff --git a/src/jalview/ws/dbsources/das/datamodel/DasSourceRegistry.java b/src/jalview/ws/dbsources/das/datamodel/DasSourceRegistry.java index e2e7534..3f6afbc 100644 --- a/src/jalview/ws/dbsources/das/datamodel/DasSourceRegistry.java +++ b/src/jalview/ws/dbsources/das/datamodel/DasSourceRegistry.java @@ -20,6 +20,10 @@ */ package jalview.ws.dbsources.das.datamodel; +import jalview.bin.Cache; +import jalview.ws.dbsources.das.api.DasSourceRegistryI; +import jalview.ws.dbsources.das.api.jalviewSourceI; + import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; @@ -39,10 +43,6 @@ import org.biodas.jdas.schema.sources.SOURCE; import org.biodas.jdas.schema.sources.SOURCES; import org.biodas.jdas.schema.sources.VERSION; -import jalview.bin.Cache; -import jalview.ws.dbsources.das.api.DasSourceRegistryI; -import jalview.ws.dbsources.das.api.jalviewSourceI; - /** * */ @@ -56,7 +56,8 @@ public class DasSourceRegistry implements DasSourceRegistryI, private Hashtable localSources = null; - public static String DEFAULT_REGISTRY = "http://www.dasregistry.org/das/"; + // public static String DEFAULT_REGISTRY = "http://www.dasregistry.org/das/"; + public static String DEFAULT_REGISTRY = "http://www.ebi.ac.uk/das-srv/registry/das/"; /** * true if thread is running and we are talking to DAS registry service diff --git a/src/jalview/ws/jws2/AADisorderClient.java b/src/jalview/ws/jws2/AADisorderClient.java index dfb13a6..91be2e6 100644 --- a/src/jalview/ws/jws2/AADisorderClient.java +++ b/src/jalview/ws/jws2/AADisorderClient.java @@ -265,7 +265,7 @@ public class AADisorderClient extends JabawsCalcWorker implements + rn.from, base + rn.to, methodName); } dseq.addSequenceFeature(sf); - if (last != val && last != Float.NaN) + if (last != val && !Float.isNaN(last)) { fc.put(sf.getType(), sf); } diff --git a/src/jalview/ws/jws2/JabaParamStore.java b/src/jalview/ws/jws2/JabaParamStore.java index be18b51..baa1d9d 100644 --- a/src/jalview/ws/jws2/JabaParamStore.java +++ b/src/jalview/ws/jws2/JabaParamStore.java @@ -27,7 +27,6 @@ import java.util.Hashtable; import java.util.List; import java.util.StringTokenizer; -import org.jmol.util.ArrayUtil; import compbio.metadata.Argument; import compbio.metadata.Option; import compbio.metadata.Parameter; diff --git a/src/jalview/ws/jws2/MsaWSThread.java b/src/jalview/ws/jws2/MsaWSThread.java index d0d0a6e..d2c1b38 100644 --- a/src/jalview/ws/jws2/MsaWSThread.java +++ b/src/jalview/ws/jws2/MsaWSThread.java @@ -959,6 +959,7 @@ class MsaWSThread extends AWS2Thread implements WSClientI } else { + // TODO 2.9.x feature 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 @@ -987,17 +988,22 @@ class MsaWSThread extends AWS2Thread implements WSClientI addSortByMenuItems(af, alorders); } + // TODO: refactor retrieve and show as new splitFrame as Desktop method + /* * If alignment was requested from one half of a SplitFrame, show in a * SplitFrame with the other pane similarly aligned. */ AlignFrame requestedBy = getRequestingAlignFrame(); - if (requestedBy != null && requestedBy.getSplitViewContainer() != null) + if (requestedBy != null && requestedBy.getSplitViewContainer() != null + && requestedBy.getSplitViewContainer().getComplement(requestedBy)!=null) { AlignmentI complement = requestedBy.getSplitViewContainer() .getComplement(requestedBy); String complementTitle = requestedBy.getSplitViewContainer() .getComplementTitle(requestedBy); + // becomes null if the alignment window was closed before the alignment + // job finished. AlignmentI copyComplement = new Alignment(complement); copyComplement.alignAs(al); if (copyComplement.getHeight() > 0) diff --git a/test/MCview/AtomTest.java b/test/MCview/AtomTest.java index 186ac03..2e6551c 100644 --- a/test/MCview/AtomTest.java +++ b/test/MCview/AtomTest.java @@ -12,7 +12,7 @@ public class AtomTest * Test the constructor that parses a PDB file format ATOM line. Fields are in * fixed column positions */ - @Test + @Test(groups ={ "Functional" }) public void testStringConstructor() { Atom a = new Atom( @@ -35,7 +35,7 @@ public class AtomTest * Test the case where occupancy and temp factor are blank - should default to * 1 */ - @Test + @Test(groups ={ "Functional" }) public void testStringConstructor_blankOccupancyTempFactor() { Atom a = new Atom( @@ -47,7 +47,7 @@ public class AtomTest /** * Parsing non-numeric data as Atom throws an exception */ - @Test + @Test(groups ={ "Functional" }) public void testStringConstructor_malformed() { try diff --git a/test/MCview/BondTest.java b/test/MCview/BondTest.java index 6f701e2..4bdfff7 100644 --- a/test/MCview/BondTest.java +++ b/test/MCview/BondTest.java @@ -7,7 +7,7 @@ import org.testng.annotations.Test; public class BondTest { - @Test + @Test(groups ={ "Functional" }) public void testTranslate() { Atom a1 = new Atom(1f, 2f, 3f); diff --git a/test/MCview/PDBChainTest.java b/test/MCview/PDBChainTest.java index 0df7851..b84ca28 100644 --- a/test/MCview/PDBChainTest.java +++ b/test/MCview/PDBChainTest.java @@ -16,21 +16,29 @@ import jalview.schemes.TaylorColourScheme; import java.awt.Color; import java.util.Vector; +import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; public class PDBChainTest { - PDBChain c = new PDBChain("1GAQ", "A"); + PDBChain c; - Atom a1 = new Atom(1f, 2f, 3f); + final Atom a1 = new Atom(1f, 2f, 3f); - Atom a2 = new Atom(5f, 6f, 4f); + final Atom a2 = new Atom(5f, 6f, 4f); - Atom a3 = new Atom(2f, 5f, 6f); + final Atom a3 = new Atom(2f, 5f, 6f); - Atom a4 = new Atom(2f, 1f, 7f); + final Atom a4 = new Atom(2f, 1f, 7f); - @Test + @BeforeMethod(alwaysRun = true) + public void setUp() + { + System.out.println("setup"); + c = new PDBChain("1GAQ", "A"); + } + + @Test(groups ={ "Functional" }) public void testGetNewlineString() { assertEquals(System.lineSeparator(), c.getNewlineString()); @@ -38,7 +46,7 @@ public class PDBChainTest assertEquals("gaga", c.getNewlineString()); } - @Test + @Test(groups ={ "Functional" }) public void testPrint() { c.offset = 7; @@ -66,7 +74,7 @@ public class PDBChainTest * Test the method that constructs a Bond between two atoms and adds it to the * chain's list of bonds */ - @Test + @Test(groups ={ "Functional" }) public void testMakeBond() { /* @@ -101,7 +109,7 @@ public class PDBChainTest assertEquals(3f, b2.end[2], 0.0001f); } - @Test + @Test(groups ={ "Functional" }) public void testSetChainColours_colour() { c.makeBond(a1, a2); @@ -118,7 +126,7 @@ public class PDBChainTest * Test setting bond start/end colours based on a colour scheme i.e. colour by * residue */ - @Test + @Test(groups ={ "Functional" }) public void testSetChainColours_colourScheme() { Color alaColour = new Color(204, 255, 0); @@ -146,7 +154,7 @@ public class PDBChainTest assertEquals(Color.gray, b.endCol); } - @Test + @Test(groups ={ "Functional" }) public void testGetChargeColour() { assertEquals(Color.red, PDBChain.getChargeColour("ASP")); @@ -161,7 +169,7 @@ public class PDBChainTest /** * Test the method that sets bond start/end colours by residue charge property */ - @Test + @Test(groups ={ "Functional" }) public void testSetChargeColours() { a1.resName = "ASP"; // red @@ -190,7 +198,7 @@ public class PDBChainTest /** * Test the method that converts the raw list of atoms to a list of residues */ - @Test + @Test(groups ={ "Functional" }) public void testMakeResidueList_noAnnotation() { Vector atoms = new Vector(); @@ -248,7 +256,7 @@ public class PDBChainTest * Test the method that converts the raw list of atoms to a list of residues, * including parsing of tempFactor to an alignment annotation */ - @Test + @Test(groups ={ "Functional" }) public void testMakeResidueList_withTempFactor() { Vector atoms = new Vector(); @@ -299,7 +307,7 @@ public class PDBChainTest * Test the method that constructs bonds between successive residues' CA or P * atoms */ - @Test + @Test(groups ={ "Functional" }) public void testMakeCaBondList() { c.isNa = true; @@ -330,7 +338,7 @@ public class PDBChainTest assertTrue(c.isNa); } - @Test + @Test(groups ={ "Functional" }) public void testMakeCaBondList_nucleotide() { c.isNa = false; @@ -362,7 +370,7 @@ public class PDBChainTest /** * Test the method that updates atoms with their alignment positions */ - @Test + @Test(groups ={ "Functional" }) public void testMakeExactMapping() { Vector atoms = new Vector(); diff --git a/test/MCview/PDBfileTest.java b/test/MCview/PDBfileTest.java index a4fd286..1dfeba9 100644 --- a/test/MCview/PDBfileTest.java +++ b/test/MCview/PDBfileTest.java @@ -15,12 +15,13 @@ import jalview.datamodel.SequenceI; import jalview.io.AppletFormatAdapter; import java.io.IOException; +import java.util.List; import org.testng.annotations.Test; public class PDBfileTest { - @Test + @Test(groups ={ "Functional" }) public void testIsRna() { SequenceI seq = new Sequence("Seq1", "CGAU"); @@ -42,7 +43,7 @@ public class PDBfileTest * * @throws IOException */ - @Test + @Test(groups ={ "Functional" }) public void testParse() throws IOException { /* @@ -96,6 +97,21 @@ public class PDBfileTest assertTrue(chainD.sequence.getSequenceAsString().startsWith("ATYNVK")); assertTrue(chainD.sequence.getSequenceAsString().endsWith("KEEELT")); assertEquals("3W5V|D", chainD.sequence.getName()); + + /* + * verify PDB-related data in parsed sequences + */ + List seqs = pf.getSeqs(); + assertEquals(4, seqs.size()); + assertEquals("3W5V|A", seqs.get(0).getName()); + assertEquals("3W5V|B", seqs.get(1).getName()); + assertEquals("3W5V|C", seqs.get(2).getName()); + assertEquals("3W5V|D", seqs.get(3).getName()); + assertEquals(1, seqs.get(0).getPDBId().size()); + PDBEntry pdbe = seqs.get(0).getPDBId().get(0); + assertEquals("A", pdbe.getChainCode()); + assertEquals("3W5V", pdbe.getId()); + assertEquals(PDBEntry.Type.PDB.toString(), pdbe.getType()); } /** @@ -104,7 +120,7 @@ public class PDBfileTest * * @throws IOException */ - @Test + @Test(groups ={ "Functional" }) public void testParse_withAnnotations_noSS() throws IOException { PDBfile pf = new PDBfile(true, false, false, "examples/3W5V.pdb", @@ -162,7 +178,7 @@ public class PDBfileTest * * @throws IOException */ - @Test + @Test(groups ={ "Functional" }) public void testParse_withJmol_noAnnotations() throws IOException { PDBfile pf = new PDBfile(false, true, false, "examples/3W5V.pdb", @@ -191,7 +207,7 @@ public class PDBfileTest * * @throws IOException */ - @Test + @Test(groups ={ "Functional" }) public void testParse_withJmolAddAlignmentAnnotations() throws IOException { @@ -248,7 +264,8 @@ public class PDBfileTest * @throws IOException */ - @Test(enabled = false) + @Test(groups = + { "Functional" }, enabled = false) public void testParse_withAnnotate3D() throws IOException { // TODO requires a mock for Annotate3D processing @@ -265,7 +282,7 @@ public class PDBfileTest private AlignmentAnnotation[] getAlignmentAnnotations(PDBfile pf) { AlignmentI al = new Alignment(pf.getSeqsAsArray()); - pf.addAnnotations((Alignment) al); + pf.addAnnotations(al); return al.getAlignmentAnnotation(); } } diff --git a/test/MCview/ResidueTest.java b/test/MCview/ResidueTest.java index b5ca0ed..bb7f796 100644 --- a/test/MCview/ResidueTest.java +++ b/test/MCview/ResidueTest.java @@ -10,7 +10,7 @@ import org.testng.annotations.Test; public class ResidueTest { - @Test + @Test(groups ={ "Functional" }) public void testFindAtom() { Atom a1 = new Atom(1f, 2f, 3f); diff --git a/test/com/stevesoft/pat/RegexWriterTest.java b/test/com/stevesoft/pat/RegexWriterTest.java index ea07aa2..d91119d 100644 --- a/test/com/stevesoft/pat/RegexWriterTest.java +++ b/test/com/stevesoft/pat/RegexWriterTest.java @@ -5,6 +5,7 @@ import static org.testng.AssertJUnit.assertEquals; import java.io.IOException; import java.io.StringWriter; +import org.testng.annotations.DataProvider; import org.testng.annotations.Test; /** @@ -25,6 +26,9 @@ public class RegexWriterTest * an input string * @throws Exception */ + + @Test(groups = + { "Functional" }, dataProvider = "testWriteParam") void test(String re, String inp) throws IOException { StringWriter sw = new StringWriter(); @@ -47,27 +51,50 @@ public class RegexWriterTest } } - @Test - public void testWrite() throws IOException + // @Test(groups ={ "Functional" }) + // public void testWrite() throws IOException + // { + // for (int n = 1; n <= 1; n++) + // { + // test("s/x/y/", "-----x123456789"); + // test("s/x/y/", "x123456789"); + // test("s/x/y/", "-----x"); + // test("s/x.*?x/y/", ".xx..x..x...x...x....x....x"); + // test("s/x.*x/[$&]/", "--x........x--xx"); + // test("s/x.*x/[$&]/", "--x........x------"); + // test("s/.$/a/m", "bb\nbbb\nbbbb\nbbbbb\nbbbbbb\nbbbbbbbbbbbb"); + // test("s/.$/a/", "123"); + // test("s/.$/a/", "bb\nbbb\nbbbb\nbbbbb\nbbbbbb\nbb"); + // test("s/^./a/", "bb\nbbb\nbbbb\nbbbbb\nbbbbbb\nbb"); + // test("s/$/a/", "bbb"); + // test("s/^/a/", "bbb"); + // test("s/^/a/", ""); + // test("s{.*}{N}", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); + // test("s/.{0,7}/y/", "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"); + // test("s/x/$&/", "xxx"); + // } + // } + + @DataProvider(name = "testWriteParam") + public Object[][] regexTestParams() { - for (int n = 1; n <= 1; n++) + return new Object[][] { - test("s/x/y/", "-----x123456789"); - test("s/x/y/", "x123456789"); - test("s/x/y/", "-----x"); - test("s/x.*?x/y/", ".xx..x..x...x...x....x....x"); - test("s/x.*x/[$&]/", "--x........x--xx"); - test("s/x.*x/[$&]/", "--x........x------"); - test("s/.$/a/m", "bb\nbbb\nbbbb\nbbbbb\nbbbbbb\nbbbbbbbbbbbb"); - test("s/.$/a/", "123"); - test("s/.$/a/", "bb\nbbb\nbbbb\nbbbbb\nbbbbbb\nbb"); - test("s/^./a/", "bb\nbbb\nbbbb\nbbbbb\nbbbbbb\nbb"); - test("s/$/a/", "bbb"); - test("s/^/a/", "bbb"); - test("s/^/a/", ""); - test("s{.*}{N}", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); - test("s/.{0,7}/y/", "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"); - test("s/x/$&/", "xxx"); - } + { "s/x/y/", "-----x123456789" }, + { "s/x/y/", "x123456789" }, + { "s/x/y/", "-----x" }, + { "s/x.*?x/y/", ".xx..x..x...x...x....x....x" }, + { "s/x.*x/[$&]/", "--x........x--xx" }, + { "s/x.*x/[$&]/", "--x........x------" }, + { "s/.$/a/m", "bb\nbbb\nbbbb\nbbbbb\nbbbbbb\nbbbbbbbbbbbb" }, + { "s/.$/a/", "123" }, + { "s/.$/a/", "bb\nbbb\nbbbb\nbbbbb\nbbbbbb\nbb" }, + { "s/^./a/", "bb\nbbb\nbbbb\nbbbbb\nbbbbbb\nbb" }, + { "s/$/a/", "bbb" }, + { "s/^/a/", "bbb" }, + { "s/^/a/", "" }, + { "s{.*}{N}", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, + { "s/.{0,7}/y/", "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" }, + { "s/x/$&/", "xxx" } }; } } diff --git a/test/jalview/analysis/AAFrequencyTest.java b/test/jalview/analysis/AAFrequencyTest.java index eb496bb..77d592a 100644 --- a/test/jalview/analysis/AAFrequencyTest.java +++ b/test/jalview/analysis/AAFrequencyTest.java @@ -22,7 +22,7 @@ public class AAFrequencyTest private static final String P = AAFrequency.PROFILE; - @Test + @Test(groups ={ "Functional" }) public void testCalculate_noProfile() { SequenceI seq1 = new Sequence("Seq1", "CAGT"); @@ -65,7 +65,7 @@ public class AAFrequencyTest assertEquals("T", col.get(R)); } - @Test + @Test(groups ={ "Functional" }) public void testCalculate_withProfile() { SequenceI seq1 = new Sequence("Seq1", "CAGT"); @@ -100,7 +100,7 @@ public class AAFrequencyTest assertEquals(4, profile[1][1]); } - @Test + @Test(groups ={ "Functional" }) public void testCalculate_withProfileTiming() { SequenceI seq1 = new Sequence("Seq1", "CAGT"); @@ -122,7 +122,7 @@ public class AAFrequencyTest System.out.println(System.currentTimeMillis() - start); } - @Test + @Test(groups ={ "Functional" }) public void testGetPercentageFormat() { assertNull(AAFrequency.getPercentageFormat(0)); diff --git a/test/jalview/analysis/AlignSeqTest.java b/test/jalview/analysis/AlignSeqTest.java new file mode 100644 index 0000000..34ae612 --- /dev/null +++ b/test/jalview/analysis/AlignSeqTest.java @@ -0,0 +1,23 @@ +package jalview.analysis; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +import org.testng.annotations.Test; + +public class AlignSeqTest +{ + @Test(groups ={ "Functional" }) + public void testExtractGaps() + { + assertNull(AlignSeq.extractGaps(null, null)); + assertNull(AlignSeq.extractGaps(null, "ACG")); + assertNull(AlignSeq.extractGaps("-. ", null)); + + assertEquals(" AC-G.T", AlignSeq.extractGaps("", " AC-G.T")); + assertEquals("AC-G.T", AlignSeq.extractGaps(" ", " AC-G.T")); + assertEquals("ACG.T", AlignSeq.extractGaps(" -", " AC-G.T")); + assertEquals("ACGT", AlignSeq.extractGaps(" -.", " AC-G.T .")); + assertEquals(" ACG.T", AlignSeq.extractGaps("-", " AC-G.T")); + } +} diff --git a/test/jalview/analysis/AlignmentAnnotationUtilsTest.java b/test/jalview/analysis/AlignmentAnnotationUtilsTest.java index 606a840..b68842a 100644 --- a/test/jalview/analysis/AlignmentAnnotationUtilsTest.java +++ b/test/jalview/analysis/AlignmentAnnotationUtilsTest.java @@ -45,7 +45,7 @@ public class AlignmentAnnotationUtilsTest /** * Test method that converts a (possibly null) array to a list. */ - @Test + @Test(groups ={ "Functional" }) public void testAsList() { // null array @@ -118,7 +118,7 @@ public class AlignmentAnnotationUtilsTest * * @throws IOException */ - @BeforeMethod + @BeforeMethod(alwaysRun = true) public void setUp() throws IOException { alignment = new jalview.io.FormatAdapter().readFile(TEST_DATA, @@ -143,7 +143,7 @@ public class AlignmentAnnotationUtilsTest /** * Test a mixture of show/hidden annotations in/outside selection group. */ - @Test + @Test(groups ={ "Functional" }) public void testGetShownHiddenTypes_forSelectionGroup() { Map>> shownTypes = new HashMap>>(); @@ -222,7 +222,7 @@ public class AlignmentAnnotationUtilsTest * Test case where there are 'grouped' annotations, visible and hidden, within * and without the selection group. */ - @Test + @Test(groups ={ "Functional" }) public void testGetShownHiddenTypes_withGraphGroups() { final int GROUP_3 = 3; @@ -348,7 +348,7 @@ public class AlignmentAnnotationUtilsTest /** * Test method that determines visible graph groups. */ - @Test + @Test(groups ={ "Functional" }) public void testGetVisibleGraphGroups() { AlignmentAnnotation[] anns = alignment.getAlignmentAnnotation(); @@ -395,7 +395,7 @@ public class AlignmentAnnotationUtilsTest * Test for case where no sequence is selected. Shouldn't normally arise but * check it handles it gracefully. */ - @Test + @Test(groups ={ "Functional" }) public void testGetShownHiddenTypes_noSequenceSelected() { Map>> shownTypes = new HashMap>>(); diff --git a/test/jalview/analysis/AlignmentUtilsTests.java b/test/jalview/analysis/AlignmentUtilsTests.java index d44a6bc..61b2487 100644 --- a/test/jalview/analysis/AlignmentUtilsTests.java +++ b/test/jalview/analysis/AlignmentUtilsTests.java @@ -96,7 +96,7 @@ public class AlignmentUtilsTests public static Sequence ts = new Sequence("short", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklm"); - @Test + @Test(groups ={ "Functional" }) public void testExpandContext() { AlignmentI al = new Alignment(new Sequence[] {}); @@ -150,7 +150,7 @@ public class AlignmentUtilsTests /** * Test that annotations are correctly adjusted by expandContext */ - @Test + @Test(groups ={ "Functional" }) public void testExpandContext_annotation() { AlignmentI al = new Alignment(new Sequence[] @@ -240,7 +240,7 @@ public class AlignmentUtilsTests * * @throws IOException */ - @Test + @Test(groups ={ "Functional" }) public void testGetSequencesByName() throws IOException { final String data = ">Seq1Name\nKQYL\n" + ">Seq2Name\nRFPW\n" @@ -278,7 +278,7 @@ public class AlignmentUtilsTests * * @throws IOException */ - @Test + @Test(groups ={ "Functional" }) public void testMapProteinToCdna_noXrefs() throws IOException { List protseqs = new ArrayList(); @@ -341,7 +341,7 @@ public class AlignmentUtilsTests /** * Test for the alignSequenceAs method that takes two sequences and a mapping. */ - @Test + @Test(groups ={ "Functional" }) public void testAlignSequenceAs_withMapping_noIntrons() { MapList map = new MapList(new int[] @@ -387,7 +387,7 @@ public class AlignmentUtilsTests /** * Test for the alignSequenceAs method that takes two sequences and a mapping. */ - @Test + @Test(groups ={ "Functional" }) public void testAlignSequenceAs_withMapping_withIntrons() { /* @@ -437,7 +437,7 @@ public class AlignmentUtilsTests /** * Test for the case where not all of the protein sequence is mapped to cDNA. */ - @Test + @Test(groups ={ "Functional" }) public void testAlignSequenceAs_withMapping_withUnmappedProtein() { @@ -487,7 +487,7 @@ public class AlignmentUtilsTests /** * Test for the alignSequenceAs method where we preserve gaps in introns only. */ - @Test + @Test(groups ={ "Functional" }) public void testAlignSequenceAs_keepIntronGapsOnly() { @@ -506,7 +506,7 @@ public class AlignmentUtilsTests * Test for the method that generates an aligned translated sequence from one * mapping. */ - @Test + @Test(groups ={ "Functional" }) public void testGetAlignedTranslation_dnaLikeProtein() { // dna alignment will be replaced @@ -530,7 +530,7 @@ public class AlignmentUtilsTests /** * Test the method that realigns protein to match mapped codon alignment. */ - @Test + @Test(groups ={ "Functional" }) public void testAlignProteinAsDna() { // seq1 codons are [1,2,3] [4,5,6] [7,8,9] [10,11,12] @@ -574,7 +574,7 @@ public class AlignmentUtilsTests * Test the method that tests whether a CDNA sequence translates to a protein * sequence */ - @Test + @Test(groups ={ "Functional" }) public void testTranslatesAs() { assertTrue(AlignmentUtils.translatesAs("tttcccaaaggg".toCharArray(), 0, @@ -613,7 +613,7 @@ public class AlignmentUtilsTests * * @throws IOException */ - @Test + @Test(groups ={ "Functional" }) public void testMapProteinToCdna_withStartAndStopCodons() throws IOException { @@ -706,7 +706,7 @@ public class AlignmentUtilsTests * * @throws IOException */ - @Test + @Test(groups ={ "Functional" }) public void testMapProteinToCdna_withXrefs() throws IOException { List protseqs = new ArrayList(); @@ -782,7 +782,7 @@ public class AlignmentUtilsTests * * @throws IOException */ - @Test + @Test(groups ={ "Functional" }) public void testMapProteinToCdna_prioritiseXrefs() throws IOException { List protseqs = new ArrayList(); @@ -832,7 +832,7 @@ public class AlignmentUtilsTests * Test the method that shows or hides sequence annotations by type(s) and * selection group. */ - @Test + @Test(groups ={ "Functional" }) public void testShowOrHideSequenceAnnotations() { SequenceI seq1 = new Sequence("Seq1", "AAA"); @@ -940,7 +940,7 @@ public class AlignmentUtilsTests /** * Tests for the method that checks if one sequence cross-references another */ - @Test + @Test(groups ={ "Functional" }) public void testHasCrossRef() { assertFalse(AlignmentUtils.hasCrossRef(null, null)); @@ -969,7 +969,7 @@ public class AlignmentUtilsTests * Tests for the method that checks if either sequence cross-references the * other */ - @Test + @Test(groups ={ "Functional" }) public void testHaveCrossRef() { assertFalse(AlignmentUtils.hasCrossRef(null, null)); @@ -999,7 +999,7 @@ public class AlignmentUtilsTests /** * Test the method that extracts the exon-only part of a dna alignment. */ - @Test + @Test(groups ={ "Functional" }) public void testMakeExonAlignment() { SequenceI dna1 = new Sequence("dna1", "aaaGGGcccTTTaaa"); @@ -1094,7 +1094,7 @@ public class AlignmentUtilsTests * already has a protein product (Uniprot translation) which in turn has an * x-ref to the EMBLCDS record. */ - @Test + @Test(groups ={ "Functional" }) public void testMakeExonSequences() { SequenceI dna1 = new Sequence("dna1", "aaaGGGcccTTTaaa"); @@ -1136,7 +1136,7 @@ public class AlignmentUtilsTests * its product mappings, for the case where there are multiple exon mappings * to different protein products. */ - @Test + @Test(groups ={ "Functional" }) public void testMakeExonAlignment_multipleProteins() { SequenceI dna1 = new Sequence("dna1", "aaaGGGcccTTTaaa"); diff --git a/test/jalview/analysis/AnnotationSorterTest.java b/test/jalview/analysis/AnnotationSorterTest.java index 8c3489b..1731302 100644 --- a/test/jalview/analysis/AnnotationSorterTest.java +++ b/test/jalview/analysis/AnnotationSorterTest.java @@ -30,7 +30,7 @@ public class AnnotationSorterTest /* * Set up 6 sequences and 7 annotations. */ - @BeforeMethod + @BeforeMethod(alwaysRun = true) public void setUp() { al = buildAlignment(NUM_SEQS); @@ -84,7 +84,7 @@ public class AnnotationSorterTest * sequence ref

  • *
*/ - @Test + @Test(groups ={ "Functional" }) public void testSortBySequenceAndType_autocalcLast() { // @formatter:off @@ -111,7 +111,7 @@ public class AnnotationSorterTest /** * Variant with autocalculated annotations sorting to front */ - @Test + @Test(groups ={ "Functional" }) public void testSortBySequenceAndType_autocalcFirst() { // @formatter:off @@ -147,7 +147,7 @@ public class AnnotationSorterTest * sequence ref * */ - @Test + @Test(groups ={ "Functional" }) public void testSortByTypeAndSequence_autocalcLast() { // @formatter:off @@ -174,7 +174,7 @@ public class AnnotationSorterTest /** * Variant of test with autocalculated annotations sorted to front */ - @Test + @Test(groups ={ "Functional" }) public void testSortByTypeAndSequence_autocalcFirst() { // @formatter:off @@ -202,7 +202,7 @@ public class AnnotationSorterTest * Variant of test with autocalculated annotations sorted to front but * otherwise no change. */ - @Test + @Test(groups ={ "Functional" }) public void testNoSort_autocalcFirst() { // @formatter:off @@ -226,7 +226,7 @@ public class AnnotationSorterTest assertEquals("Structure", anns[6].label); } - @Test + @Test(groups ={ "Functional" }) public void testSort_timingPresorted() { testTiming_presorted(50, 100); @@ -242,23 +242,23 @@ public class AnnotationSorterTest */ private void testTiming_presorted(final int numSeqs, final int numAnns) { - al = buildAlignment(numSeqs); - anns = buildAnnotations(numAnns); + Alignment alignment = buildAlignment(numSeqs); + AlignmentAnnotation[] annotations = buildAnnotations(numAnns); /* * Set the annotations presorted by label */ Random r = new Random(); - final SequenceI[] sequences = al.getSequencesArray(); - for (int i = 0; i < anns.length; i++) + final SequenceI[] sequences = alignment.getSequencesArray(); + for (int i = 0; i < annotations.length; i++) { SequenceI randomSequenceRef = sequences[r.nextInt(sequences.length)]; - anns[i].sequenceRef = randomSequenceRef; - anns[i].label = "label" + i; + annotations[i].sequenceRef = randomSequenceRef; + annotations[i].label = "label" + i; } long startTime = System.currentTimeMillis(); - AnnotationSorter testee = new AnnotationSorter(al, false); - testee.sort(anns, SequenceAnnotationOrder.LABEL_AND_SEQUENCE); + AnnotationSorter testee = new AnnotationSorter(alignment, false); + testee.sort(annotations, SequenceAnnotationOrder.LABEL_AND_SEQUENCE); long endTime = System.currentTimeMillis(); final long elapsed = endTime - startTime; System.out.println("Timing test for presorted " + numSeqs @@ -269,7 +269,7 @@ public class AnnotationSorterTest /** * Timing tests for sorting randomly sorted annotations for various sizes. */ - @Test + @Test(groups ={ "Functional" }) public void testSort_timingUnsorted() { testTiming_unsorted(50, 100); @@ -286,23 +286,23 @@ public class AnnotationSorterTest */ private void testTiming_unsorted(final int numSeqs, final int numAnns) { - al = buildAlignment(numSeqs); - anns = buildAnnotations(numAnns); + Alignment alignment = buildAlignment(numSeqs); + AlignmentAnnotation[] annotations = buildAnnotations(numAnns); /* * Set the annotations in random order with respect to the sequences */ Random r = new Random(); - final SequenceI[] sequences = al.getSequencesArray(); - for (int i = 0; i < anns.length; i++) + final SequenceI[] sequences = alignment.getSequencesArray(); + for (int i = 0; i < annotations.length; i++) { SequenceI randomSequenceRef = sequences[r.nextInt(sequences.length)]; - anns[i].sequenceRef = randomSequenceRef; - anns[i].label = "label" + i; + annotations[i].sequenceRef = randomSequenceRef; + annotations[i].label = "label" + i; } long startTime = System.currentTimeMillis(); - AnnotationSorter testee = new AnnotationSorter(al, false); - testee.sort(anns, SequenceAnnotationOrder.SEQUENCE_AND_LABEL); + AnnotationSorter testee = new AnnotationSorter(alignment, false); + testee.sort(annotations, SequenceAnnotationOrder.SEQUENCE_AND_LABEL); long endTime = System.currentTimeMillis(); final long elapsed = endTime - startTime; System.out.println("Timing test for unsorted " + numSeqs @@ -313,7 +313,7 @@ public class AnnotationSorterTest /** * Timing test for sorting annotations with a limited range of types (labels). */ - @Test + @Test(groups ={ "Functional" }) public void testSort_timingSemisorted() { testTiming_semiSorted(50, 100); @@ -336,8 +336,8 @@ public class AnnotationSorterTest */ private void testTiming_semiSorted(final int numSeqs, final int numAnns) { - al = buildAlignment(numSeqs); - anns = buildAnnotations(numAnns); + Alignment alignment = buildAlignment(numSeqs); + AlignmentAnnotation[] annotations = buildAnnotations(numAnns); String[] labels = new String[] { "label1", "label2", "label3", "label4", "label5", "label6" }; @@ -346,16 +346,16 @@ public class AnnotationSorterTest * Set the annotations in sequence order with randomly assigned labels. */ Random r = new Random(); - final SequenceI[] sequences = al.getSequencesArray(); - for (int i = 0; i < anns.length; i++) + final SequenceI[] sequences = alignment.getSequencesArray(); + for (int i = 0; i < annotations.length; i++) { SequenceI sequenceRef = sequences[i % sequences.length]; - anns[i].sequenceRef = sequenceRef; - anns[i].label = labels[r.nextInt(labels.length)]; + annotations[i].sequenceRef = sequenceRef; + annotations[i].label = labels[r.nextInt(labels.length)]; } long startTime = System.currentTimeMillis(); - AnnotationSorter testee = new AnnotationSorter(al, false); - testee.sort(anns, SequenceAnnotationOrder.LABEL_AND_SEQUENCE); + AnnotationSorter testee = new AnnotationSorter(alignment, false); + testee.sort(annotations, SequenceAnnotationOrder.LABEL_AND_SEQUENCE); long endTime = System.currentTimeMillis(); long elapsed = endTime - startTime; System.out.println("Sort by label for semisorted " + numSeqs @@ -364,7 +364,7 @@ public class AnnotationSorterTest // now resort by sequence startTime = System.currentTimeMillis(); - testee.sort(anns, SequenceAnnotationOrder.SEQUENCE_AND_LABEL); + testee.sort(annotations, SequenceAnnotationOrder.SEQUENCE_AND_LABEL); endTime = System.currentTimeMillis(); elapsed = endTime - startTime; System.out.println("Resort by sequence for semisorted " + numSeqs @@ -373,7 +373,7 @@ public class AnnotationSorterTest // now resort by label startTime = System.currentTimeMillis(); - testee.sort(anns, SequenceAnnotationOrder.LABEL_AND_SEQUENCE); + testee.sort(annotations, SequenceAnnotationOrder.LABEL_AND_SEQUENCE); endTime = System.currentTimeMillis(); elapsed = endTime - startTime; System.out.println("Resort by label for semisorted " + numSeqs diff --git a/test/jalview/analysis/CodingUtilsTest.java b/test/jalview/analysis/CodingUtilsTest.java index e787ac3..429c9ed 100644 --- a/test/jalview/analysis/CodingUtilsTest.java +++ b/test/jalview/analysis/CodingUtilsTest.java @@ -10,7 +10,7 @@ import org.testng.annotations.Test; public class CodingUtilsTest { - @Test + @Test(groups ={ "Functional" }) public void testDecodeCodon() { assertTrue(Arrays.equals(new char[] @@ -31,7 +31,7 @@ public class CodingUtilsTest { 'T', 'T', 'T' }, CodingUtils.decodeCodon(63))); } - @Test + @Test(groups ={ "Functional" }) public void testDecodeNucleotide() { assertEquals('A', CodingUtils.decodeNucleotide(0)); @@ -41,7 +41,7 @@ public class CodingUtilsTest assertEquals('0', CodingUtils.decodeNucleotide(4)); } - @Test + @Test(groups ={ "Functional" }) public void testEncodeCodon() { assertTrue(CodingUtils.encodeCodon('Z') < 0); diff --git a/test/jalview/analysis/CrossRefTest.java b/test/jalview/analysis/CrossRefTest.java index 095fc05..bd737fa 100644 --- a/test/jalview/analysis/CrossRefTest.java +++ b/test/jalview/analysis/CrossRefTest.java @@ -9,7 +9,7 @@ import org.testng.annotations.Test; public class CrossRefTest { - @Test + @Test(groups ={ "Functional" }) public void testFindXDbRefs() { DBRefEntry ref1 = new DBRefEntry("UNIPROT", "1", "A123"); diff --git a/test/jalview/analysis/DnaTest.java b/test/jalview/analysis/DnaTest.java index 6371315..55908dd 100644 --- a/test/jalview/analysis/DnaTest.java +++ b/test/jalview/analysis/DnaTest.java @@ -94,7 +94,7 @@ public class DnaTest * * @throws IOException */ - @Test + @Test(groups ={ "Functional" }) public void testTranslateCdna_withUntranslatableCodons() throws IOException { @@ -116,7 +116,7 @@ public class DnaTest * * @throws IOException */ - @Test + @Test(groups ={ "Functional" }) public void testTranslateCdna_withUntranslatableCodonsAndHiddenColumns() throws IOException { @@ -152,7 +152,7 @@ public class DnaTest * * @throws IOException */ - @Test + @Test(groups ={ "Functional" }) public void testTranslateCdna_simple() throws IOException { AlignmentI alf = new FormatAdapter().readFile(fasta, @@ -173,7 +173,7 @@ public class DnaTest * * @throws IOException */ - @Test + @Test(groups ={ "Functional" }) public void testTranslateCdna_hiddenColumns() throws IOException { AlignmentI alf = new FormatAdapter().readFile(fasta, @@ -193,7 +193,7 @@ public class DnaTest /** * Use this test to help debug into any cases of interest. */ - @Test + @Test(groups ={ "Functional" }) public void testCompareCodonPos_oneOnly() { assertFollows("-AA--A", "G--GG"); // 2 shifted seq2, 3 shifted seq1 @@ -202,7 +202,7 @@ public class DnaTest /** * Tests for method that compares 'alignment' of two codon position triplets. */ - @Test + @Test(groups ={ "Functional" }) public void testCompareCodonPos() { /* @@ -259,7 +259,7 @@ public class DnaTest * reorders the cDNA and retranslates, and verifies that the translations are * the same (apart from ordering). */ - @Test + @Test(groups ={ "Functional" }) public void testTranslateCdna_sequenceOrderIndependent() { /* @@ -313,7 +313,7 @@ public class DnaTest * Test that all the cases in testCompareCodonPos have a 'symmetric' * comparison (without checking the actual comparison result). */ - @Test + @Test(groups ={ "Functional" }) public void testCompareCodonPos_isSymmetric() { assertSymmetric("AAA", "GGG"); @@ -436,7 +436,7 @@ public class DnaTest /** * Weirdly, maybe worth a test to prove the helper method of this test class. */ - @Test + @Test(groups ={ "Functional" }) public void testConvertCodon() { assertEquals("[0, 1, 2]", convertCodon("AAA").toString()); diff --git a/test/jalview/analysis/GroupingTest.java b/test/jalview/analysis/GroupingTest.java index df04243..4698d0d 100644 --- a/test/jalview/analysis/GroupingTest.java +++ b/test/jalview/analysis/GroupingTest.java @@ -37,7 +37,7 @@ public class GroupingTest int[] positions = new int[] { 1, 7, 9 }; - @Test + @Test(groups ={ "Functional" }) public void testMakeGroupsWithBoth() { ArrayList str = new ArrayList(); diff --git a/test/jalview/analysis/ParsePropertiesTest.java b/test/jalview/analysis/ParsePropertiesTest.java index 90faedc..1325671 100644 --- a/test/jalview/analysis/ParsePropertiesTest.java +++ b/test/jalview/analysis/ParsePropertiesTest.java @@ -23,7 +23,7 @@ public class ParsePropertiesTest /** * Construct an alignment with 4 sequences with varying description format */ - @BeforeMethod + @BeforeMethod(alwaysRun = true) public void setUp() { SequenceI[] seqs = new SequenceI[] @@ -46,7 +46,7 @@ public class ParsePropertiesTest * more 'number characters' (0-9+.), i.e. greedily matches any trailing * numeric part of the string */ - @Test + @Test(groups ={ "Functional" }) public void testGetScoresFromDescription() { String regex = ".*([-0-9.+]+)"; @@ -82,7 +82,7 @@ public class ParsePropertiesTest * character, followed by at least one 'number character', then any trailing * characters. */ - @Test + @Test(groups ={ "Functional" }) public void testGetScoresFromDescription_twoScores() { String regex = ".*([-0-9.+]+).+([-0-9.+]+).*"; @@ -144,7 +144,7 @@ public class ParsePropertiesTest * * @see AlignFrame.extractScores_actionPerformed */ - @Test + @Test(groups ={ "Functional" }) public void testGetScoresFromDescription_wordBoundaries() { String regex = "\\W*([-+eE0-9.]+)"; diff --git a/test/jalview/analysis/RnaTest.java b/test/jalview/analysis/RnaTest.java new file mode 100644 index 0000000..3676e0b --- /dev/null +++ b/test/jalview/analysis/RnaTest.java @@ -0,0 +1,58 @@ +package jalview.analysis; + +import static org.testng.AssertJUnit.assertEquals; +import static org.testng.AssertJUnit.fail; + +import jalview.analysis.SecStrConsensus.SimpleBP; + +import java.util.Vector; + +import org.testng.annotations.Test; +public class RnaTest +{ + @Test(groups ={ "Functional" }) + public void testGetSimpleBPs() throws WUSSParseException + { + String rna = "([{})]"; // JAL-1081 example + Vector bps = Rna.GetSimpleBPs(rna); + assertEquals(3, bps.size()); + + /* + * the base pairs are added in the order in which the matching base is found + */ + assertEquals(2, bps.get(0).bp5); // { + assertEquals(3, bps.get(0).bp3); // } + assertEquals(0, bps.get(1).bp5); // ( + assertEquals(4, bps.get(1).bp3); // ) + assertEquals(1, bps.get(2).bp5); // [ + assertEquals(5, bps.get(2).bp3); // ] + } + + @Test(groups ={ "Functional" }) + public void testGetSimpleBPs_unmatchedOpener() + { + String rna = "(([{})]"; + try + { + Rna.GetSimpleBPs(rna); + fail("expected exception"); + } catch (WUSSParseException e) + { + // expected + } + } + + @Test(groups ={ "Functional" }) + public void testGetSimpleBPs_unmatchedCloser() + { + String rna = "([{})]]"; + try + { + Rna.GetSimpleBPs(rna); + fail("expected exception"); + } catch (WUSSParseException e) + { + // expected + } + } +} diff --git a/test/jalview/analysis/TestAlignSeq.java b/test/jalview/analysis/TestAlignSeq.java index 81bcf86..3c84189 100644 --- a/test/jalview/analysis/TestAlignSeq.java +++ b/test/jalview/analysis/TestAlignSeq.java @@ -46,7 +46,7 @@ public class TestAlignSeq /** * @throws java.lang.Exception */ - @BeforeMethod + @BeforeMethod(alwaysRun = true) public void setUp() throws Exception { s1 = new Sequence("Seq1", "ASDFAQQQRRRSSS"); @@ -59,7 +59,7 @@ public class TestAlignSeq } - @Test + @Test(groups ={ "Functional" }) /** * simple test that mapping from alignment corresponds identical positions. */ @@ -86,7 +86,7 @@ public class TestAlignSeq } } - @Test + @Test(groups ={ "Functional" }) public void testExtractGaps() { assertNull(AlignSeq.extractGaps(null, null)); @@ -96,7 +96,7 @@ public class TestAlignSeq assertEquals("ABCD", AlignSeq.extractGaps(" .-", ". -A-B.C D.")); } - @Test + @Test(groups ={ "Functional" }) public void testPrintAlignment() { AlignSeq as = AlignSeq.doGlobalNWAlignment(s1, s3, AlignSeq.PEP); diff --git a/test/jalview/analysis/scoremodels/FeatureScoreModelTest.java b/test/jalview/analysis/scoremodels/FeatureScoreModelTest.java index 5ab0bb0..221b230 100644 --- a/test/jalview/analysis/scoremodels/FeatureScoreModelTest.java +++ b/test/jalview/analysis/scoremodels/FeatureScoreModelTest.java @@ -23,7 +23,7 @@ public class FeatureScoreModelTest int[] sf3 = new int[] { -1, -1, -1, -1, -1, -1, 76, 77 }; - @Test + @Test(groups ={ "Functional" }) public void testFeatureScoreModel() throws Exception { AlignFrame alf = new FileLoader(false).LoadFileWaitTillLoaded(alntestFile, diff --git a/test/jalview/bin/CommandLineOperations.java b/test/jalview/bin/CommandLineOperations.java index d9d3bb3..09650ea 100644 --- a/test/jalview/bin/CommandLineOperations.java +++ b/test/jalview/bin/CommandLineOperations.java @@ -24,25 +24,18 @@ import java.io.BufferedReader; import java.io.File; import java.io.IOException; import java.io.InputStreamReader; +import java.util.ArrayList; import org.testng.Assert; -import org.testng.AssertJUnit; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; +import org.testng.FileAssert; +import org.testng.annotations.BeforeTest; +import org.testng.annotations.DataProvider; import org.testng.annotations.Test; public class CommandLineOperations { - @BeforeClass - public static void setUpBeforeClass() throws Exception - { - } - - @AfterClass - public static void tearDownAfterClass() throws Exception - { - } + private ArrayList successfulCMDs = new ArrayList(); /*** * from @@ -55,7 +48,8 @@ public class CommandLineOperations private static class Worker extends Thread { private final Process process; - + private BufferedReader outputReader; + private BufferedReader errorReader; private Integer exit; private Worker(Process process) @@ -73,99 +67,223 @@ public class CommandLineOperations return; } } + + public BufferedReader getOutputReader() + { + return outputReader; + } + + public void setOutputReader(BufferedReader outputReader) + { + this.outputReader = outputReader; + } + + public BufferedReader getErrorReader() + { + return errorReader; + } + + public void setErrorReader(BufferedReader errorReader) + { + this.errorReader = errorReader; + } } private Worker jalviewDesktopRunner(boolean withAwt, String cmd, - int timeout) throws InterruptedException, IOException + int timeout) { String _cmd = "java " + (withAwt ? "-Djava.awt.headless=true" : "") + " -Djava.ext.dirs=./lib -classpath ./classes jalview.bin.Jalview "; - System.out.println("###############Jalview CMD: " + _cmd + cmd); - Process ls2_proc = Runtime.getRuntime().exec(_cmd + cmd); - BufferedReader outputReader = new BufferedReader(new InputStreamReader( - ls2_proc.getInputStream())); - - BufferedReader errorReader = new BufferedReader(new InputStreamReader( - ls2_proc.getErrorStream())); - Worker worker = new Worker(ls2_proc); - worker.start(); - worker.join(timeout); - System.out.println("Output: "); + System.out.println("CMD [" + cmd + "]"); + Process ls2_proc = null; + Worker worker = null; + try + { + ls2_proc = Runtime.getRuntime().exec(_cmd + cmd); + } catch (IOException e1) + { + e1.printStackTrace(); + } + if (ls2_proc != null) + { + BufferedReader outputReader = new BufferedReader( + new InputStreamReader(ls2_proc.getInputStream())); + BufferedReader errorReader = new BufferedReader( + new InputStreamReader(ls2_proc.getErrorStream())); + worker = new Worker(ls2_proc); + worker.start(); + try + { + worker.join(timeout); + } catch (InterruptedException e) + { + // e.printStackTrace(); + } + worker.setOutputReader(outputReader); + worker.setErrorReader(errorReader); + } + return worker; + } + + @BeforeTest(alwaysRun = true) + public void initialize() + { + new CommandLineOperations(); + } + + @BeforeTest(alwaysRun = true) + public void setUpForHeadlessCommandLineInputOperations() + throws IOException + { + String cmds = "nodisplay -open examples/uniref50.fa -sortbytree -props FILE -colour zappo " + + "-jabaws http://www.compbio.dundee.ac.uk/jabaws -nosortbytree -dasserver nickname=www.test.com " + + "-features examples/testdata/plantfdx.features -annotations examples/testdata/plantfdx.annotations -tree examples/testdata/uniref50_test_tree"; + Worker worker = jalviewDesktopRunner(true, cmds, 9000); String ln = null; - while ((ln = outputReader.readLine()) != null) + while ((ln = worker.getOutputReader().readLine()) != null) { System.out.println(ln); + successfulCMDs.add(ln); } + } - System.out.println("Error: "); - while ((ln = errorReader.readLine()) != null) + @BeforeTest(alwaysRun = true) + public void setUpForCommandLineInputOperations() throws IOException + { + String cmds = "-open examples/uniref50.fa -noquestionnaire -nousagestats"; + Worker worker = jalviewDesktopRunner(false, cmds, 9000); + String ln = null; + int count = 0; + while ((ln = worker.getErrorReader().readLine()) != null) { System.out.println(ln); + successfulCMDs.add(ln); + if (++count > 5) + { + break; + } } - return worker; + if (worker != null && worker.exit == null) + { + worker.interrupt(); + Thread.currentThread().interrupt(); + worker.process.destroy(); + } + } + + @Test(groups = + { "Functional" }, dataProvider = "allInputOpearationsData") + public void testAllInputOperations(String expectedString, + String failureMsg) + { + Assert.assertTrue(successfulCMDs.contains(expectedString), failureMsg); } - @Test - public void testHeadlessModeEPS() throws Exception + @Test(groups = + { "Functional" }, dataProvider = "headlessModeOutputOperationsData") + public void testHeadlessModeOutputOperations(String harg, String type, + String fileName, boolean withAWT, int expectedMinFileSize, + int timeout) { - String[] headlessArgs = new String[] - { "nodisplay", "headless", "nogui" }; - for (String _harg : headlessArgs) + String cmd = harg + type + " " + fileName; + // System.out.println(">>>>>>>>>>>>>>>> Command : " + cmd); + File file = new File(fileName); + Worker worker = jalviewDesktopRunner(withAWT, cmd, timeout); + + FileAssert.assertFile(file, "Didn't create an output" + type + + " file.[" + harg + "]"); + FileAssert.assertMinLength(new File(fileName), expectedMinFileSize); + if (worker != null && worker.exit == null) { - boolean _switch = false, withAwt = false; - do - { - if (_switch) + worker.interrupt(); + Thread.currentThread().interrupt(); + worker.process.destroy(); + Assert.fail("Jalview did not exit after " + + type + + " generation (try running test again to verify - timeout at 9000ms). [" + + harg + "]"); + } + new File(fileName).delete(); + } + + + @DataProvider(name = "allInputOpearationsData") + public Object[][] getHeadlessModeInputParams() + { + return new Object[][] + { + // headless mode input operations + { "CMD [-color zappo] executed successfully!", + "Failed command : -color zappo" }, + { "CMD [-props FILE] executed successfully!", + "Failed command : -props File" }, + { "CMD [-sortbytree] executed successfully!", + "Failed command : -sortbytree" }, { - withAwt = true; - } - _switch = true; - String jalview_input = "examples/uniref50.fa"; - String jalview_output = "test_uniref50_out.eps"; - String cmd = "" + _harg + " -open " + jalview_input + " -eps " - + jalview_output; - String harg = _harg - + (withAwt ? "-Djava.awt.headless=true" - : " NO AWT.HEADLESS"); - System.out.println("Testing with Headless argument: '" + harg - + "'\n"); - Worker worker = jalviewDesktopRunner(withAwt, cmd, 9000); - AssertJUnit.assertTrue("Didn't create an output EPS file.[" + harg - + "]", new File("test_uniref50_out.eps").exists()); - AssertJUnit.assertTrue( - "Didn't create an EPS file with any content[" + harg + "]", - new File("test_uniref50_out.eps").length() > 4096); - if (worker.exit == null) + "CMD [-jabaws http://www.compbio.dundee.ac.uk/jabaws] executed successfully!", + "Failed command : -jabaws http://www.compbio.dundee.ac.uk/jabaws" }, + { "CMD [-open examples/uniref50.fa] executed successfully!", + "Failed command : -open examples/uniref50.fa" }, + { "CMD [-nosortbytree] executed successfully!", + "Failed command : -nosortbytree" }, + { "CMD [-dasserver nickname=www.test.com] executed successfully!", + "Failed command : -dasserver nickname=www.test.com" }, { - worker.interrupt(); - Thread.currentThread().interrupt(); - worker.process.destroy(); - Assert.fail("Jalview did not exit after EPS generation (try running test again to verify - timeout at 9000ms). [" - + harg + "]"); - } - } while (!withAwt); - } + "CMD [-features examples/testdata/plantfdx.features] executed successfully!", + "Failed command : -features examples/testdata/plantfdx.features" }, + { + "CMD [-annotations examples/testdata/plantfdx.annotations] executed successfully!", + "Failed command : -annotations examples/testdata/plantfdx.annotations" }, + { + "CMD [-tree examples/testdata/uniref50_test_tree] executed successfully!", + "Failed command : -tree examples/testdata/uniref50_test_tree" }, + // non headless mode input operations + { "CMD [-nousagestats] executed successfully!", + "Failed command : -nousagestats" }, + { "CMD [-noquestionnaire] executed successfully!", + "Failed command : -noquestionnaire nickname=www.test.com" } + }; + + } + + @DataProvider(name = "headlessModeOutputOperationsData") + public static Object[][] getHeadlessModeOutputParams() + { + return new Object[][] + { + { "nodisplay -open examples/uniref50.fa", " -eps", + "test_uniref50_out.eps", true, 4096, 4000 }, + { "nodisplay -open examples/uniref50.fa", " -eps", + "test_uniref50_out.eps", false, 4096, 4000 }, + { "nogui -open examples/uniref50.fa", " -eps", + "test_uniref50_out.eps", true, 4096, 4000 }, + { "nogui -open examples/uniref50.fa", " -eps", + "test_uniref50_out.eps", false, 4096, 4000 }, + { "headless -open examples/uniref50.fa", " -eps", + "test_uniref50_out.eps", true, 4096, 4000 }, + { "headless -open examples/uniref50.fa", " -svg", + "test_uniref50_out.svg", false, 4096, 3000 }, + { "headless -open examples/uniref50.fa", " -png", + "test_uniref50_out.png", true, 4096, 3000 }, + { "headless -open examples/uniref50.fa", " -html", + "test_uniref50_out.html", true, 4096, 3000 }, + { "headless -open examples/uniref50.fa", " -fasta", + "test_uniref50_out.mfa", true, 2096, 3000 }, + { "headless -open examples/uniref50.fa", " -clustal", + "test_uniref50_out.aln", true, 2096, 3000 }, + { "headless -open examples/uniref50.fa", " -msf", + "test_uniref50_out.msf", true, 2096, 3000 }, + { "headless -open examples/uniref50.fa", " -pileup", + "test_uniref50_out.aln", true, 2096, 3000 }, + { "headless -open examples/uniref50.fa", " -pir", + "test_uniref50_out.pir", true, 2096, 3000 }, + { "headless -open examples/uniref50.fa", " -pfam", + "test_uniref50_out.pfam", true, 2096, 3000 }, + { "headless -open examples/uniref50.fa", " -blc", + "test_uniref50_out.blc", true, 2096, 3000 }, + { "headless -open examples/uniref50.fa", " -jalview", + "test_uniref50_out.jvp", true, 2096, 3000 }, + }; } - // @Test - // public void testJalview2XMLDataset() throws Exception - // { - // String jalview_input = "examples/uniref50.fa"; - // String jalview_output = "test_uniref50_out.eps"; - // String cmd = ""+" -open "+ jalview_input + " -eps " + jalview_output; - // //String harg = _harg+(withAwt ? - // "-Djava.awt.headless=true":" NO AWT.HEADLESS"); - // System.out.println("Testing with Headless argument: '"+harg+"'\n"); - // Worker worker = jalviewDesktopRunner(withAwt, cmd, 9000); - // assertTrue("Didn't create an output EPS file.["+harg+"]", new - // File("test_uniref50_out.eps").exists()); - // assertTrue("Didn't create an EPS file with any content["+harg+"]", new - // File("test_uniref50_out.eps").length()>4096); - // if (worker.exit == null){ - // worker.interrupt(); - // Thread.currentThread().interrupt(); - // worker.process.destroy(); - // fail("Jalview did not exit after EPS generation (try running test again to verify - timeout at 9000ms). ["+harg+"]"); - // } - // } } diff --git a/test/jalview/commands/EditCommandTest.java b/test/jalview/commands/EditCommandTest.java index 6c570d5..6fa7c22 100644 --- a/test/jalview/commands/EditCommandTest.java +++ b/test/jalview/commands/EditCommandTest.java @@ -30,8 +30,8 @@ public class EditCommandTest private Alignment al; - @BeforeMethod - public void setUp() + @BeforeMethod(alwaysRun = true) + public void setUp() { testee = new EditCommand(); seqs = new SequenceI[4]; @@ -50,7 +50,7 @@ public class EditCommandTest /** * Test inserting gap characters */ - @Test + @Test(groups ={ "Functional" }) public void testAppendEdit_insertGap() { // set a non-standard gap character to prove it is actually used @@ -67,7 +67,7 @@ public class EditCommandTest * Test deleting characters from sequences. Note the deleteGap() action does * not check that only gap characters are being removed. */ - @Test + @Test(groups ={ "Functional" }) public void testAppendEdit_deleteGap() { testee.appendEdit(Action.DELETE_GAP, seqs, 4, 3, al, true); @@ -81,7 +81,7 @@ public class EditCommandTest * Test a cut action. The command should store the cut characters to support * undo. */ - @Test + @Test(groups ={ "Functional" }) public void testCut() { Edit ec = testee.new Edit(Action.CUT, seqs, 4, 3, al); @@ -102,7 +102,8 @@ public class EditCommandTest /** * Test a Paste action, where this adds sequences to an alignment. */ - @Test(enabled = false) + @Test(groups = + { "Functional" }, enabled = false) // TODO fix so it works public void testPaste_addToAlignment() { @@ -122,7 +123,7 @@ public class EditCommandTest /** * Test insertGap followed by undo command */ - @Test + @Test(groups ={ "Functional" }) public void testUndo_insertGap() { // Edit ec = testee.new Edit(Action.INSERT_GAP, seqs, 4, 3, '?'); @@ -140,7 +141,7 @@ public class EditCommandTest /** * Test deleteGap followed by undo command */ - @Test + @Test(groups ={ "Functional" }) public void testUndo_deleteGap() { testee.appendEdit(Action.DELETE_GAP, seqs, 4, 3, al, true); @@ -158,7 +159,7 @@ public class EditCommandTest /** * Test several commands followed by an undo command */ - @Test + @Test(groups ={ "Functional" }) public void testUndo_multipleCommands() { // delete positions 3/4/5 (counting from 1) @@ -187,7 +188,7 @@ public class EditCommandTest * Unit test for JAL-1594 bug: click and drag sequence right to insert gaps - * undo did not remove them all. */ - @Test + @Test(groups ={ "Functional" }) public void testUndo_multipleInsertGaps() { testee.appendEdit(Action.INSERT_GAP, seqs, 4, 1, al, true); @@ -205,7 +206,7 @@ public class EditCommandTest /** * Test cut followed by undo command */ - @Test + @Test(groups ={ "Functional" }) public void testUndo_cut() { testee.appendEdit(Action.CUT, seqs, 4, 3, al, true); @@ -222,7 +223,7 @@ public class EditCommandTest /** * Test the replace command (used to manually edit a sequence) */ - @Test + @Test(groups ={ "Functional" }) public void testReplace() { // seem to need a dataset sequence on the edited sequence here @@ -239,7 +240,7 @@ public class EditCommandTest * Test that the addEdit command correctly merges insert gap commands when * possible. */ - @Test + @Test(groups ={ "Functional" }) public void testAddEdit_multipleInsertGap() { /* @@ -289,7 +290,7 @@ public class EditCommandTest * Test that the addEdit command correctly merges delete gap commands when * possible. */ - @Test + @Test(groups ={ "Functional" }) public void testAddEdit_multipleDeleteGap() { /* @@ -346,7 +347,7 @@ public class EditCommandTest * case when they appear contiguous but are acting on different sequences. * They should not be merged. */ - @Test + @Test(groups ={ "Functional" }) public void testAddEdit_removeAllGaps() { seqs[0].setSequence("a???bcdefghjk"); @@ -367,7 +368,7 @@ public class EditCommandTest * Test that the addEdit command correctly merges insert gap commands acting * on a multi-sequence selection. */ - @Test + @Test(groups ={ "Functional" }) public void testAddEdit_groupInsertGaps() { /* @@ -403,7 +404,7 @@ public class EditCommandTest *
  • last: --A--B-CDEF
  • * */ - @Test + @Test(groups ={ "Functional" }) public void testPriorState_multipleInserts() { EditCommand command = new EditCommand(); @@ -431,7 +432,7 @@ public class EditCommandTest *
  • End: ABC
  • * */ - @Test + @Test(groups ={ "Functional" }) public void testPriorState_removeAllGaps() { EditCommand command = new EditCommand(); @@ -452,7 +453,7 @@ public class EditCommandTest /** * Test for 'undoing' a single delete edit. */ - @Test + @Test(groups ={ "Functional" }) public void testPriorState_singleDelete() { EditCommand command = new EditCommand(); @@ -471,7 +472,7 @@ public class EditCommandTest /** * Test 'undoing' a single gap insertion edit command. */ - @Test + @Test(groups ={ "Functional" }) public void testPriorState_singleInsert() { EditCommand command = new EditCommand(); @@ -491,7 +492,7 @@ public class EditCommandTest * Test that mimics 'remove all gaps' action. This generates delete gap edits * for contiguous gaps in each sequence separately. */ - @Test + @Test(groups ={ "Functional" }) public void testPriorState_removeGapsMultipleSeqs() { EditCommand command = new EditCommand(); @@ -555,7 +556,7 @@ public class EditCommandTest * series Delete Gap edits that each act on all sequences that share a gapped * column region. */ - @Test + @Test(groups ={ "Functional" }) public void testPriorState_removeGappedCols() { EditCommand command = new EditCommand(); diff --git a/test/jalview/datamodel/AlignedCodonFrameTest.java b/test/jalview/datamodel/AlignedCodonFrameTest.java index 63f6772..35d92d3 100644 --- a/test/jalview/datamodel/AlignedCodonFrameTest.java +++ b/test/jalview/datamodel/AlignedCodonFrameTest.java @@ -15,7 +15,7 @@ public class AlignedCodonFrameTest /** * Test the method that locates the first aligned sequence that has a mapping. */ - @Test + @Test(groups ={ "Functional" }) public void testFindAlignedSequence() { AlignmentI cdna = new Alignment(new SequenceI[] @@ -63,7 +63,7 @@ public class AlignedCodonFrameTest /** * Test the method that locates the mapped codon for a protein position. */ - @Test + @Test(groups ={ "Functional" }) public void testGetMappedRegion() { // introns lower case, exons upper case @@ -111,7 +111,7 @@ public class AlignedCodonFrameTest assertNull(acf.getMappedRegion(seq1, aseq2, 1)); } - @Test + @Test(groups ={ "Functional" }) public void testGetMappedCodon() { final Sequence seq1 = new Sequence("Seq1", "c-G-TA-gC-gT-T"); diff --git a/test/jalview/datamodel/AlignedCodonIteratorTest.java b/test/jalview/datamodel/AlignedCodonIteratorTest.java index 65fe4bf..d9c7e12 100644 --- a/test/jalview/datamodel/AlignedCodonIteratorTest.java +++ b/test/jalview/datamodel/AlignedCodonIteratorTest.java @@ -21,7 +21,7 @@ public class AlignedCodonIteratorTest /** * Test normal case for iterating over aligned codons. */ - @Test + @Test(groups ={ "Functional" }) public void testNext() { SequenceI from = new Sequence("Seq1", "-CgC-C-cCtAG-AtG-Gc"); @@ -49,7 +49,7 @@ public class AlignedCodonIteratorTest /** * Test weird case where the mapping skips over a peptide. */ - @Test + @Test(groups ={ "Functional" }) public void testNext_unmappedPeptide() { SequenceI from = new Sequence("Seq1", "-CgC-C-cCtAG-AtG-Gc"); @@ -77,7 +77,7 @@ public class AlignedCodonIteratorTest /** * Test for exception thrown for an incomplete codon. */ - @Test + @Test(groups ={ "Functional" }) public void testNext_incompleteCodon() { SequenceI from = new Sequence("Seq1", "-CgC-C-cCgTt"); @@ -106,7 +106,7 @@ public class AlignedCodonIteratorTest /** * Test normal case for iterating over aligned codons. */ - @Test + @Test(groups ={ "Functional" }) public void testAnother() { SequenceI from = new Sequence("Seq1", "TGCCATTACCAG-"); diff --git a/test/jalview/datamodel/AlignedCodonTest.java b/test/jalview/datamodel/AlignedCodonTest.java index afa6169..a6802b1 100644 --- a/test/jalview/datamodel/AlignedCodonTest.java +++ b/test/jalview/datamodel/AlignedCodonTest.java @@ -9,7 +9,7 @@ import org.testng.annotations.Test; public class AlignedCodonTest { - @Test + @Test(groups ={ "Functional" }) public void testEquals() { AlignedCodon ac = new AlignedCodon(1, 3, 4); @@ -20,7 +20,7 @@ public class AlignedCodonTest assertTrue(ac.equals(ac)); } - @Test + @Test(groups ={ "Functional" }) public void testToString() { AlignedCodon ac = new AlignedCodon(1, 3, 4); assertEquals("[1, 3, 4]", ac.toString()); diff --git a/test/jalview/datamodel/AlignmentAnnotationTests.java b/test/jalview/datamodel/AlignmentAnnotationTests.java index 4c9eabe..d32105d 100644 --- a/test/jalview/datamodel/AlignmentAnnotationTests.java +++ b/test/jalview/datamodel/AlignmentAnnotationTests.java @@ -10,7 +10,7 @@ import org.testng.annotations.Test; public class AlignmentAnnotationTests { - @Test + @Test(groups ={ "Functional" }) public void testCopyConstructor() { SequenceI sq = new Sequence("Foo", "ARAARARARAWEAWEAWRAWEAWE"); @@ -74,7 +74,7 @@ public class AlignmentAnnotationTests * different dataset frames (annotation transferred by mapping between * sequences) */ - @Test + @Test(groups ={ "Functional" }) public void testLiftOver() { SequenceI sqFrom = new Sequence("fromLong", "QQQCDEWGH"); @@ -157,7 +157,7 @@ public class AlignmentAnnotationTests } } - @Test + @Test(groups ={ "Functional" }) public void testAdjustForAlignment() { SequenceI seq = new Sequence("TestSeq", "ABCDEFG"); diff --git a/test/jalview/datamodel/AlignmentTest.java b/test/jalview/datamodel/AlignmentTest.java index 036f2cf..2eaae94 100644 --- a/test/jalview/datamodel/AlignmentTest.java +++ b/test/jalview/datamodel/AlignmentTest.java @@ -79,7 +79,7 @@ public class AlignmentTest * Read in Stockholm format test data including secondary structure * annotations. */ - @BeforeMethod + @BeforeMethod(alwaysRun = true) public void setUp() throws IOException { al = loadAlignment(TEST_DATA, "STH"); @@ -94,7 +94,7 @@ public class AlignmentTest /** * Test method that returns annotations that match on calcId. */ - @Test + @Test(groups ={ "Functional" }) public void testFindAnnotation_byCalcId() { Iterable anns = al @@ -106,7 +106,7 @@ public class AlignmentTest assertFalse(iter.hasNext()); } - @Test + @Test(groups ={ "Functional" }) public void testDeleteAllAnnotations_includingAutocalculated() { AlignmentAnnotation aa = new AlignmentAnnotation("Consensus", @@ -120,7 +120,7 @@ public class AlignmentTest assertEquals("Not all deleted", 0, al.getAlignmentAnnotation().length); } - @Test + @Test(groups ={ "Functional" }) public void testDeleteAllAnnotations_excludingAutocalculated() { AlignmentAnnotation aa = new AlignmentAnnotation("Consensus", @@ -144,7 +144,7 @@ public class AlignmentTest * * @throws IOException */ - @Test + @Test(groups ={ "Functional" }) public void testAlignAs_dnaAsDna() throws IOException { // aligned cDNA: @@ -176,7 +176,7 @@ public class AlignmentTest * * @throws IOException */ - @Test + @Test(groups ={ "Functional" }) public void testAlignAs_proteinAsCdna() throws IOException { // see also AlignmentUtilsTests @@ -200,7 +200,7 @@ public class AlignmentTest * * @throws IOException */ - @Test + @Test(groups ={ "Functional" }) public void testAlignAs_cdnaAsProtein() throws IOException { /* @@ -232,7 +232,7 @@ public class AlignmentTest * * @throws IOException */ - @Test + @Test(groups ={ "Functional" }) public void testAlignAs_dnaAsProtein_withIntrons() throws IOException { /* diff --git a/test/jalview/datamodel/ColumnSelectionTest.java b/test/jalview/datamodel/ColumnSelectionTest.java index 2ffebe0..38e9c93 100644 --- a/test/jalview/datamodel/ColumnSelectionTest.java +++ b/test/jalview/datamodel/ColumnSelectionTest.java @@ -9,7 +9,7 @@ import org.testng.annotations.Test; public class ColumnSelectionTest { - @Test + @Test(groups ={ "Functional" }) public void testAddElement() { ColumnSelection cs = new ColumnSelection(); @@ -25,7 +25,7 @@ public class ColumnSelectionTest * Test the remove method - in particular to verify that remove(int i) removes * the element whose value is i, _NOT_ the i'th element. */ - @Test + @Test(groups ={ "Functional" }) public void testRemoveElement() { ColumnSelection cs = new ColumnSelection(); @@ -50,7 +50,7 @@ public class ColumnSelectionTest * Test the method that finds the visible column position of an alignment * column, allowing for hidden columns. */ - @Test + @Test(groups ={ "Functional" }) public void testFindColumnPosition() { ColumnSelection cs = new ColumnSelection(); diff --git a/test/jalview/datamodel/DBRefEntryTest.java b/test/jalview/datamodel/DBRefEntryTest.java index b5549f0..f00cb38 100644 --- a/test/jalview/datamodel/DBRefEntryTest.java +++ b/test/jalview/datamodel/DBRefEntryTest.java @@ -13,7 +13,7 @@ public class DBRefEntryTest /** * Tests for the method that compares equality of reference (but not mapping) */ - @Test + @Test(groups ={ "Functional" }) public void testEqualRef() { DBRefEntry ref1 = new DBRefEntry("UNIPROT", "1", "V71633"); diff --git a/test/jalview/datamodel/MappingTest.java b/test/jalview/datamodel/MappingTest.java index 378d708..cb528aa 100644 --- a/test/jalview/datamodel/MappingTest.java +++ b/test/jalview/datamodel/MappingTest.java @@ -17,7 +17,7 @@ public class MappingTest * trite test of the intersectVisContigs method for a simple DNA -> Protein * exon map and a range of visContigs */ - @Test + @Test(groups ={ "Functional" }) public void testIntersectVisContigs() { MapList fk = new MapList(new int[] diff --git a/test/jalview/datamodel/PDBEntryTest.java b/test/jalview/datamodel/PDBEntryTest.java index 093702f..2e6f3f9 100644 --- a/test/jalview/datamodel/PDBEntryTest.java +++ b/test/jalview/datamodel/PDBEntryTest.java @@ -9,7 +9,7 @@ import org.testng.annotations.Test; public class PDBEntryTest { - @BeforeMethod + @BeforeMethod(alwaysRun = true) public void setUp() throws Exception { } @@ -19,7 +19,7 @@ public class PDBEntryTest { } - @Test + @Test(groups ={ "Functional" }) public void test() { try diff --git a/test/jalview/datamodel/SearchResultsTest.java b/test/jalview/datamodel/SearchResultsTest.java index 7f099c8..b576569 100644 --- a/test/jalview/datamodel/SearchResultsTest.java +++ b/test/jalview/datamodel/SearchResultsTest.java @@ -7,7 +7,7 @@ import org.testng.annotations.Test; public class SearchResultsTest { - @Test + @Test(groups ={ "Functional" }) public void testToString() { SequenceI seq = new Sequence("", "abcdefghijklm"); diff --git a/test/jalview/datamodel/SeqCigarTest.java b/test/jalview/datamodel/SeqCigarTest.java index b8748b6..3b50ce1 100644 --- a/test/jalview/datamodel/SeqCigarTest.java +++ b/test/jalview/datamodel/SeqCigarTest.java @@ -15,7 +15,7 @@ public class SeqCigarTest * * TODO: split into separate tests */ - @Test + @Test(groups ={ "Functional" }) public void testSomething() throws Exception { String o_seq = "asdfktryasdtqwrtsaslldddptyipqqwaslchvhttt"; diff --git a/test/jalview/datamodel/SequenceDummyTest.java b/test/jalview/datamodel/SequenceDummyTest.java index 2fc1934..4629a47 100644 --- a/test/jalview/datamodel/SequenceDummyTest.java +++ b/test/jalview/datamodel/SequenceDummyTest.java @@ -1,15 +1,17 @@ package jalview.datamodel; +import static org.testng.AssertJUnit.assertFalse; +import static org.testng.AssertJUnit.assertTrue; + +import org.testng.annotations.Test; -import org.junit.Assert; -import org.junit.Test; public class SequenceDummyTest { /** * test for become method */ - @Test + @Test(groups ={ "Functional" }) public void testBecome() { SequenceI seq = new Sequence("OrigSeq", "ASEQUENCE"); @@ -19,9 +21,9 @@ public class SequenceDummyTest SequenceDummy dummySeq = new SequenceDummy("OrigSeq"); dummySeq.addSequenceFeature(ofeat); dummySeq.become(seq); - Assert.assertFalse("Dummy sequence did not become a full sequence", + assertFalse("Dummy sequence did not become a full sequence", dummySeq.isDummy()); - Assert.assertTrue("Sequence was not updated from template", seq + assertTrue("Sequence was not updated from template", seq .getSequenceAsString().equals(dummySeq.getSequenceAsString())); boolean found = false; for (SequenceFeature sf : dummySeq.getSequenceFeatures()) @@ -32,7 +34,7 @@ public class SequenceDummyTest break; } } - Assert.assertTrue("Didn't retain original sequence feature", found); + assertTrue("Didn't retain original sequence feature", found); // todo - should test all aspect of copy constructor } diff --git a/test/jalview/datamodel/SequenceTest.java b/test/jalview/datamodel/SequenceTest.java index b216b13..4d08b15 100644 --- a/test/jalview/datamodel/SequenceTest.java +++ b/test/jalview/datamodel/SequenceTest.java @@ -15,12 +15,12 @@ public class SequenceTest { SequenceI seq; - @BeforeMethod + @BeforeMethod(alwaysRun = true) public void setUp() { seq = new Sequence("FER1", "AKPNGVL"); } - @Test + @Test(groups ={ "Functional" }) public void testInsertGapsAndGapmaps() { SequenceI aseq = seq.deriveSequence(); @@ -35,7 +35,7 @@ public class SequenceTest assertEquals("Gap interval 2 end wrong", 8, gapInt.get(1)[1]); } - @Test + @Test(groups ={ "Functional" }) public void testGetAnnotation() { // initial state returns null not an empty array @@ -51,7 +51,7 @@ public class SequenceTest assertNull(seq.getAnnotation()); } - @Test + @Test(groups ={ "Functional" }) public void testGetAnnotation_forLabel() { AlignmentAnnotation ann1 = addAnnotation("label1", "desc1", "calcId1", 1f); @@ -74,7 +74,7 @@ public class SequenceTest return annotation; } - @Test + @Test(groups ={ "Functional" }) public void testGetAlignmentAnnotations_forCalcIdAndLabel() { AlignmentAnnotation ann1 = addAnnotation("label1", "desc1", "calcId1", @@ -107,7 +107,7 @@ public class SequenceTest * setting the sequenceRef on the annotation. Adding the same annotation twice * should be ignored. */ - @Test + @Test(groups ={ "Functional" }) public void testAddAlignmentAnnotation() { assertNull(seq.getAnnotation()); @@ -137,7 +137,7 @@ public class SequenceTest } - @Test + @Test(groups ={ "Functional" }) public void testGetStartGetEnd() { SequenceI seq = new Sequence("test", "ABCDEF"); @@ -157,7 +157,7 @@ public class SequenceTest * Tests for the method that returns an alignment column position (base 1) for * a given sequence position (base 1). */ - @Test + @Test(groups ={ "Functional" }) public void testFindIndex() { SequenceI seq = new Sequence("test", "ABCDEF"); @@ -185,7 +185,7 @@ public class SequenceTest * Tests for the method that returns a dataset sequence position (base 1) for * an aligned column position (base 0). */ - @Test + @Test(groups ={ "Functional" }) public void testFindPosition() { SequenceI seq = new Sequence("test", "ABCDEF"); @@ -220,7 +220,7 @@ public class SequenceTest assertEquals(7, seq.findPosition(11)); } - @Test + @Test(groups ={ "Functional" }) public void testDeleteChars() { SequenceI seq = new Sequence("test", "ABCDEF"); @@ -238,7 +238,7 @@ public class SequenceTest assertEquals(6, seq.getEnd()); } - @Test + @Test(groups ={ "Functional" }) public void testInsertCharAt() { // non-static methods: @@ -255,7 +255,7 @@ public class SequenceTest * Test the method that returns an array of aligned sequence positions where * the array index is the data sequence position (both base 0). */ - @Test + @Test(groups ={ "Functional" }) public void testGapMap() { SequenceI seq = new Sequence("test", "-A--B-CD-E--F-"); @@ -267,7 +267,7 @@ public class SequenceTest * Test the method that gets sequence features, either from the sequence or * its dataset. */ - @Test + @Test(groups ={ "Functional" }) public void testGetSequenceFeatures() { SequenceI seq = new Sequence("test", "GATCAT"); @@ -316,7 +316,7 @@ public class SequenceTest * entries are the residue positions at the sequence position (or to the right * if a gap) */ - @Test + @Test(groups ={ "Functional" }) public void testFindPositionMap() { /* @@ -334,7 +334,7 @@ public class SequenceTest /** * Test for getSubsequence */ - @Test + @Test(groups ={ "Functional" }) public void testGetSubsequence() { SequenceI seq = new Sequence("TestSeq", "ABCDEFG"); @@ -354,7 +354,7 @@ public class SequenceTest /** * Test for deriveSequence applied to a sequence with a dataset */ - @Test + @Test(groups ={ "Functional" }) public void testDeriveSequence_existingDataset() { SequenceI seq = new Sequence("Seq1", "CD"); @@ -369,7 +369,7 @@ public class SequenceTest /** * Test for deriveSequence applied to an ungapped sequence with no dataset */ - @Test + @Test(groups ={ "Functional" }) public void testDeriveSequence_noDatasetUngapped() { SequenceI seq = new Sequence("Seq1", "ABCDEF"); @@ -384,7 +384,7 @@ public class SequenceTest /** * Test for deriveSequence applied to a gapped sequence with no dataset */ - @Test + @Test(groups ={ "Functional" }) public void testDeriveSequence_noDatasetGapped() { SequenceI seq = new Sequence("Seq1", "AB-C.D EF"); diff --git a/test/jalview/datamodel/xdb/embl/EmblFileTest.java b/test/jalview/datamodel/xdb/embl/EmblFileTest.java index 2d9b713..81aae0b 100644 --- a/test/jalview/datamodel/xdb/embl/EmblFileTest.java +++ b/test/jalview/datamodel/xdb/embl/EmblFileTest.java @@ -31,7 +31,7 @@ public class EmblFileTest + "" + "GTGACG"; - @Test + @Test(groups ={ "Functional" }) public void testGetEmblFile() { Vector entries = EmblFile.getEmblFile( diff --git a/test/jalview/ext/jmol/PDBFileWithJmolTest.java b/test/jalview/ext/jmol/PDBFileWithJmolTest.java index 0627217..fd465cf 100644 --- a/test/jalview/ext/jmol/PDBFileWithJmolTest.java +++ b/test/jalview/ext/jmol/PDBFileWithJmolTest.java @@ -50,7 +50,7 @@ public class PDBFileWithJmolTest // "./examples/DNMT1_MOUSE.pdb" // }; - @BeforeMethod + @BeforeMethod(alwaysRun = true) public void setUp() { Cache.applicationProperties.setProperty("STRUCT_FROM_PDB", @@ -59,7 +59,7 @@ public class PDBFileWithJmolTest Boolean.TRUE.toString()); } - @Test + @Test(groups ={ "Functional" }) public void testAlignmentLoader() throws Exception { for (String f : testFile) @@ -71,7 +71,7 @@ public class PDBFileWithJmolTest } } - @Test + @Test(groups ={ "Functional" }) public void testFileParser() throws Exception { for (String pdbStr : testFile) diff --git a/test/jalview/ext/paradise/TestAnnotate3D.java b/test/jalview/ext/paradise/TestAnnotate3D.java index d8582af..126c221 100644 --- a/test/jalview/ext/paradise/TestAnnotate3D.java +++ b/test/jalview/ext/paradise/TestAnnotate3D.java @@ -43,7 +43,8 @@ import compbio.util.FileUtil; public class TestAnnotate3D { - @Test(enabled = false) + @Test(groups = + { "Functional" }, enabled = false) public void test1GIDbyId() throws Exception { // use same ID as standard tests given at @@ -53,7 +54,8 @@ public class TestAnnotate3D testRNAMLcontent(ids, null); } - @Test(enabled = false) + @Test(groups = + { "Functional" }, enabled = false) public void testIdVsContent2GIS() throws Exception { Iterator ids = Annotate3D.getRNAMLForPDBId("2GIS"); @@ -97,7 +99,8 @@ public class TestAnnotate3D * * @throws Exception */ - @Test(enabled = false) + @Test(groups = + { "Functional" }, enabled = false) public void testPDBfileVsRNAML() throws Exception { PDBfile pdbf = new PDBfile(true, false, true, "examples/2GIS.pdb", @@ -111,7 +114,8 @@ public class TestAnnotate3D testRNAMLcontent(readers, pdbf); } - @Test(enabled = false) + @Test(groups = + { "Functional" }, enabled = false) private void testRNAMLcontent(Iterator readers, PDBfile pdbf) throws Exception { diff --git a/test/jalview/ext/rbvi/chimera/ChimeraCommandsTest.java b/test/jalview/ext/rbvi/chimera/ChimeraCommandsTest.java index e8b6b19..a3e13e8 100644 --- a/test/jalview/ext/rbvi/chimera/ChimeraCommandsTest.java +++ b/test/jalview/ext/rbvi/chimera/ChimeraCommandsTest.java @@ -13,7 +13,7 @@ import org.testng.annotations.Test; public class ChimeraCommandsTest { - @Test + @Test(groups ={ "Functional" }) public void testAddColourRange() { Map>>> map = new LinkedHashMap>>>(); @@ -67,7 +67,7 @@ public class ChimeraCommandsTest { 5, 9 }, posList.get(0))); } - @Test + @Test(groups ={ "Functional" }) public void testBuildColourCommands() { diff --git a/test/jalview/ext/rbvi/chimera/ChimeraConnect.java b/test/jalview/ext/rbvi/chimera/ChimeraConnect.java index d40a43d..e7f95a0 100644 --- a/test/jalview/ext/rbvi/chimera/ChimeraConnect.java +++ b/test/jalview/ext/rbvi/chimera/ChimeraConnect.java @@ -11,7 +11,7 @@ import ext.edu.ucsf.rbvi.strucviz2.StructureManager; public class ChimeraConnect { - @Test + @Test(groups ={ "Functional" }) public void testLaunchAndExit() { final StructureManager structureManager = new StructureManager(true); diff --git a/test/jalview/ext/rbvi/chimera/JalviewChimeraView.java b/test/jalview/ext/rbvi/chimera/JalviewChimeraView.java index 59a0fdb..0c5d7fa 100644 --- a/test/jalview/ext/rbvi/chimera/JalviewChimeraView.java +++ b/test/jalview/ext/rbvi/chimera/JalviewChimeraView.java @@ -19,7 +19,7 @@ public class JalviewChimeraView /** * @throws java.lang.Exception */ - @BeforeClass + @BeforeClass(alwaysRun = true) public static void setUpBeforeClass() throws Exception { jalview.bin.Jalview.main(new String[] @@ -42,7 +42,7 @@ public class JalviewChimeraView } - @Test + @Test(groups ={ "Functional" }) public void testSingleSeqViewJMol() { String inFile = "examples/1gaq.txt"; @@ -86,7 +86,7 @@ public class JalviewChimeraView } } - @Test + @Test(groups ={ "Functional" }) public void testSingleSeqViewChimera() { String inFile = "examples/1gaq.txt"; diff --git a/test/jalview/gui/AlignViewportTest.java b/test/jalview/gui/AlignViewportTest.java index a6e7ea0..4c55386 100644 --- a/test/jalview/gui/AlignViewportTest.java +++ b/test/jalview/gui/AlignViewportTest.java @@ -19,7 +19,7 @@ public class AlignViewportTest AlignmentI al; AlignViewport testee; - @BeforeMethod + @BeforeMethod(alwaysRun = true) public void setUp() { SequenceI seq1 = new Sequence("Seq1", "ABC"); @@ -32,7 +32,7 @@ public class AlignViewportTest testee = new AlignViewport(al); } - @Test + @Test(groups ={ "Functional" }) public void testCollateForPdb() { /* diff --git a/test/jalview/gui/AnnotationChooserTest.java b/test/jalview/gui/AnnotationChooserTest.java index 3f56985..ae56fb4 100644 --- a/test/jalview/gui/AnnotationChooserTest.java +++ b/test/jalview/gui/AnnotationChooserTest.java @@ -52,7 +52,7 @@ public class AnnotationChooserTest AlignFrame af; - @BeforeMethod + @BeforeMethod(alwaysRun = true) public void setUp() throws IOException { // pin down annotation sort order for test @@ -107,7 +107,7 @@ public class AnnotationChooserTest /** * Test creation of panel with OK and Cancel buttons */ - @Test + @Test(groups ={ "Functional" }) public void testBuildActionButtonsPanel() { testee = new AnnotationChooser(parentPanel); @@ -136,7 +136,7 @@ public class AnnotationChooserTest * Test 'Apply to' has 3 radio buttons enabled, 'Selected Sequences' selected, * when there is a current selection group. */ - @Test + @Test(groups ={ "Functional" }) public void testBuildApplyToOptionsPanel_withSelectionGroup() { selectSequences(0, 2, 3); @@ -183,7 +183,7 @@ public class AnnotationChooserTest * Test 'Apply to' has 1 radio button enabled, 'All Sequences' selected, when * there is no current selection group. */ - @Test + @Test(groups ={ "Functional" }) public void testBuildApplyToOptionsPanel_noSelectionGroup() { testee = new AnnotationChooser(parentPanel); @@ -224,7 +224,7 @@ public class AnnotationChooserTest /** * Test Show and Hide radio buttons created, with Hide initially selected. */ - @Test + @Test(groups ={ "Functional" }) public void testBuildShowHidePanel() { testee = new AnnotationChooser(parentPanel); @@ -262,7 +262,7 @@ public class AnnotationChooserTest /** * Test construction of panel containing two sub-panels */ - @Test + @Test(groups ={ "Functional" }) public void testBuildShowHideOptionsPanel() { testee = new AnnotationChooser(parentPanel); @@ -279,7 +279,7 @@ public class AnnotationChooserTest * Test that annotation types are (uniquely) identified. * */ - @Test + @Test(groups ={ "Functional" }) public void testGetAnnotationTypes() { selectSequences(1); @@ -311,7 +311,7 @@ public class AnnotationChooserTest * We expect all annotations of that type to be set hidden. Other annotations * should be left visible. */ - @Test + @Test(groups ={ "Functional" }) public void testSelectType_hideForAll() { selectSequences(1, 2); @@ -347,7 +347,7 @@ public class AnnotationChooserTest * We expect the annotations of that type, linked to the sequence group, to be * set hidden. Other annotations should be left visible. */ - @Test + @Test(groups ={ "Functional" }) public void testSelectType_hideForSelected() { selectSequences(1, 2); @@ -384,7 +384,7 @@ public class AnnotationChooserTest * We expect all annotations of that type to be set visible. Other annotations * should be left unchanged. */ - @Test + @Test(groups ={ "Functional" }) public void testDeselectType_hideForAll() { selectSequences(1, 2); @@ -426,7 +426,7 @@ public class AnnotationChooserTest * We expect the annotations of that type, linked to the sequence group, to be * set visible. Other annotations should be left unchanged. */ - @Test + @Test(groups ={ "Functional" }) public void testDeselectType_hideForSelected() { selectSequences(1, 2); @@ -461,7 +461,7 @@ public class AnnotationChooserTest * We expect all annotations of that type to be set visible. Other annotations * should be left unchanged */ - @Test + @Test(groups ={ "Functional" }) public void testSelectType_showForAll() { selectSequences(1, 2); @@ -500,7 +500,7 @@ public class AnnotationChooserTest * We expect all annotations of that type, linked to the sequence group, to be * set visible. Other annotations should be left unchanged */ - @Test + @Test(groups ={ "Functional" }) public void testSelectType_showForSelected() { // sequences 1 and 2 have annotations IUPred and Jmol @@ -542,7 +542,7 @@ public class AnnotationChooserTest * We expect all annotations of that type to be set hidden. Other annotations * should be left unchanged. */ - @Test + @Test(groups ={ "Functional" }) public void testDeselectType_showForAll() { selectSequences(1, 2); @@ -583,7 +583,7 @@ public class AnnotationChooserTest * We expect the annotations of that type, linked to the sequence group, to be * set hidden. Other annotations should be left unchanged. */ - @Test + @Test(groups ={ "Functional" }) public void testDeselectType_showForSelected() { selectSequences(1, 2); @@ -677,7 +677,7 @@ public class AnnotationChooserTest * Test cases include sequences in the selection group, and others not in the * group. */ - @Test + @Test(groups ={ "Functional" }) public void testIsInActionScope_selectedScope() { // sequences 1 and 2 have annotations 4 and 3 respectively @@ -703,7 +703,7 @@ public class AnnotationChooserTest * Test cases include sequences in the selection group, and others not in the * group. */ - @Test + @Test(groups ={ "Functional" }) public void testIsInActionScope_unselectedScope() { // sequences 1 and 2 have annotations 4 and 3 respectively @@ -727,7 +727,7 @@ public class AnnotationChooserTest /** * Test that the reset method restores previous visibility flags. */ - @Test + @Test(groups ={ "Functional" }) public void testResetOriginalState() { testee = new AnnotationChooser(parentPanel); diff --git a/test/jalview/gui/AppVarnaTest.java b/test/jalview/gui/AppVarnaTest.java new file mode 100644 index 0000000..94a3300 --- /dev/null +++ b/test/jalview/gui/AppVarnaTest.java @@ -0,0 +1,24 @@ +package jalview.gui; + +import static org.testng.AssertJUnit.assertEquals; +import static org.testng.AssertJUnit.assertNull; +import static org.testng.AssertJUnit.assertSame; + +import org.testng.annotations.Test; + +public class AppVarnaTest +{ + @Test + public void testReplaceOddGaps() + { + String struct = "{(<]}>)"; + String replaced = AppVarna.replaceOddGaps(struct); + assertEquals(struct, replaced); + assertSame(struct, replaced); + assertEquals("..{.([.<.].}.>)", + AppVarna.replaceOddGaps("..{ ([*<-]?} >)")); + assertEquals("....", AppVarna.replaceOddGaps("cgta")); + assertEquals("", AppVarna.replaceOddGaps("")); + assertNull(AppVarna.replaceOddGaps(null)); + } +} diff --git a/test/jalview/gui/FontChooserTest.java b/test/jalview/gui/FontChooserTest.java index 646016c..8da11b8 100644 --- a/test/jalview/gui/FontChooserTest.java +++ b/test/jalview/gui/FontChooserTest.java @@ -15,7 +15,7 @@ public class FontChooserTest * available, plain) fonts and point sizes that would be rejected by Jalview's * FontChooser as having an I-width of less than 1.0. */ - @Test + @Test(groups ={ "Functional" }) public void dumpInvalidFonts() { String[] fonts = java.awt.GraphicsEnvironment diff --git a/test/jalview/gui/HelpTest.java b/test/jalview/gui/HelpTest.java index f280797..bb538a5 100644 --- a/test/jalview/gui/HelpTest.java +++ b/test/jalview/gui/HelpTest.java @@ -14,7 +14,7 @@ import org.testng.annotations.Test; public class HelpTest { - @Test + @Test(groups ={ "Functional" }) public void checkHelpTargets() throws HelpSetException { ClassLoader cl = Desktop.class.getClassLoader(); diff --git a/test/jalview/gui/JAL1353bugdemo.java b/test/jalview/gui/JAL1353bugdemo.java index 4a17622..e90e3d9 100644 --- a/test/jalview/gui/JAL1353bugdemo.java +++ b/test/jalview/gui/JAL1353bugdemo.java @@ -42,7 +42,7 @@ import org.testng.annotations.Test; public class JAL1353bugdemo { - @BeforeClass + @BeforeClass(alwaysRun = true) public static void setUpBeforeClass() throws Exception { } @@ -54,7 +54,8 @@ public class JAL1353bugdemo volatile boolean finish = false; - @Test(enabled = false) + @Test(groups = + { "Functional" }, enabled = false) public void test() { Cache.initLogger(); diff --git a/test/jalview/gui/JvSwingUtilsTest.java b/test/jalview/gui/JvSwingUtilsTest.java index 1a16053..8a6f63b 100644 --- a/test/jalview/gui/JvSwingUtilsTest.java +++ b/test/jalview/gui/JvSwingUtilsTest.java @@ -9,7 +9,7 @@ import org.testng.annotations.Test; public class JvSwingUtilsTest { - @Test + @Test(groups ={ "Functional" }) public void testGetScrollBarProportion() { /* @@ -24,7 +24,7 @@ public class JvSwingUtilsTest assertEquals(0.25f, JvSwingUtils.getScrollBarProportion(sb), 0.001f); } - @Test + @Test(groups ={ "Functional" }) public void testGetScrollValueForProportion() { /* diff --git a/test/jalview/gui/PDBSearchPanelTest.java b/test/jalview/gui/PDBSearchPanelTest.java index 3a1c554..7697bda 100644 --- a/test/jalview/gui/PDBSearchPanelTest.java +++ b/test/jalview/gui/PDBSearchPanelTest.java @@ -13,7 +13,7 @@ import org.testng.annotations.Test; public class PDBSearchPanelTest { - @BeforeMethod + @BeforeMethod(alwaysRun = true) public void setUp() throws Exception { } @@ -23,7 +23,7 @@ public class PDBSearchPanelTest { } - @Test + @Test(groups ={ "Functional" }) public void populateCmbSearchTargetOptionsTest() { PDBSearchPanel searchPanel = new PDBSearchPanel(null); @@ -31,7 +31,7 @@ public class PDBSearchPanelTest searchPanel.populateCmbSearchTargetOptions(); } - @Test + @Test(groups ={ "Functional" }) public void testDecodeSearchTerm() { String expectedString = "1xyz OR text:2xyz OR text:3xyz"; @@ -46,7 +46,7 @@ public class PDBSearchPanelTest assertEquals(expectedString, outcome); } - @Test + @Test(groups ={ "Functional" }) public void testgetPDBIdwithSpecifiedChain() { @@ -68,7 +68,8 @@ public class PDBSearchPanelTest assertEquals(expectedString, outcome); } - @Test + @Test(groups = + { "Network", "External" }, timeOut = 5000) public void txt_search_ActionPerformedTest() { PDBSearchPanel searchPanel = new PDBSearchPanel(null); diff --git a/test/jalview/gui/PaintRefresherTest.java b/test/jalview/gui/PaintRefresherTest.java index adbf385..1705e90 100644 --- a/test/jalview/gui/PaintRefresherTest.java +++ b/test/jalview/gui/PaintRefresherTest.java @@ -22,7 +22,7 @@ import org.testng.annotations.Test; public class PaintRefresherTest { // TODO would prefer PaintRefresher to be a single rather than static - @BeforeMethod + @BeforeMethod(alwaysRun = true) public void setUp() { PaintRefresher.components.clear(); @@ -34,7 +34,7 @@ public class PaintRefresherTest PaintRefresher.components.clear(); } - @Test + @Test(groups ={ "Functional" }) public void testRegister() { JPanel jp = new JPanel(); @@ -60,7 +60,7 @@ public class PaintRefresherTest assertTrue(registered.get("44").contains(jp4)); } - @Test + @Test(groups ={ "Functional" }) public void testRemoveComponent() { Map> registered = PaintRefresher.components; @@ -92,7 +92,7 @@ public class PaintRefresherTest assertTrue(registered.get("22").contains(jp2)); } - @Test + @Test(groups ={ "Functional" }) public void testGetAssociatedPanels() { SequenceI [] seqs = new SequenceI[]{new Sequence("", "ABC")}; diff --git a/test/jalview/gui/PopupMenuTest.java b/test/jalview/gui/PopupMenuTest.java index ba1b275..46397d3 100644 --- a/test/jalview/gui/PopupMenuTest.java +++ b/test/jalview/gui/PopupMenuTest.java @@ -41,7 +41,7 @@ public class PopupMenuTest PopupMenu testee = null; - @BeforeMethod + @BeforeMethod(alwaysRun = true) public void setUp() throws IOException { alignment = new FormatAdapter().readFile(TEST_DATA, @@ -60,7 +60,7 @@ public class PopupMenuTest } } - @Test + @Test(groups ={ "Functional" }) public void testConfigureReferenceAnnotationsMenu_noSequenceSelected() { JMenuItem menu = new JMenuItem(); @@ -78,7 +78,7 @@ public class PopupMenuTest * are no reference annotations to add to the alignment. The menu item should * be disabled. */ - @Test + @Test(groups ={ "Functional" }) public void testConfigureReferenceAnnotationsMenu_noReferenceAnnotations() { JMenuItem menu = new JMenuItem(); @@ -99,7 +99,7 @@ public class PopupMenuTest * reference annotations are already on the alignment. The menu item should be * disabled. */ - @Test + @Test(groups ={ "Functional" }) public void testConfigureReferenceAnnotationsMenu_alreadyAdded() { JMenuItem menu = new JMenuItem(); @@ -119,7 +119,7 @@ public class PopupMenuTest * The menu item should be enabled, and acquire a tooltip which lists the * annotation sources (calcIds) and type (labels). */ - @Test + @Test(groups ={ "Functional" }) public void testConfigureReferenceAnnotationsMenu() { JMenuItem menu = new JMenuItem(); @@ -140,7 +140,7 @@ public class PopupMenuTest * on the alignment. The menu item should be enabled, and acquire a tooltip * which lists the annotation sources (calcIds) and type (labels). */ - @Test + @Test(groups ={ "Functional" }) public void testConfigureReferenceAnnotationsMenu_notOnAlignment() { JMenuItem menu = new JMenuItem(); @@ -219,7 +219,7 @@ public class PopupMenuTest * The menu item should be enabled, and acquire a tooltip which lists the * annotation sources (calcIds) and type (labels). */ - @Test + @Test(groups ={ "Functional" }) public void testConfigureReferenceAnnotationsMenu_twoViews() { } @@ -228,7 +228,7 @@ public class PopupMenuTest * Test for building menu options including 'show' and 'hide' annotation * types. */ - @Test + @Test(groups ={ "Functional" }) public void testBuildAnnotationTypesMenus() { JMenu showMenu = new JMenu(); @@ -310,7 +310,7 @@ public class PopupMenuTest /** * Test for building menu options with only 'hide' annotation types enabled. */ - @Test + @Test(groups ={ "Functional" }) public void testBuildAnnotationTypesMenus_showDisabled() { JMenu showMenu = new JMenu(); @@ -369,7 +369,7 @@ public class PopupMenuTest /** * Test for building menu options with only 'show' annotation types enabled. */ - @Test + @Test(groups ={ "Functional" }) public void testBuildAnnotationTypesMenus_hideDisabled() { JMenu showMenu = new JMenu(); diff --git a/test/jalview/gui/ProgressBarTest.java b/test/jalview/gui/ProgressBarTest.java index 281ed2d..e50148c 100644 --- a/test/jalview/gui/ProgressBarTest.java +++ b/test/jalview/gui/ProgressBarTest.java @@ -20,7 +20,7 @@ public class ProgressBarTest private JLabel statusBar; - @Test + @Test(groups ={ "Functional" }) public void testConstructor_prematureInstantiation() { try @@ -33,7 +33,7 @@ public class ProgressBarTest } } - @Test + @Test(groups ={ "Functional" }) public void testConstructor_wrongLayout() { statusPanel = new JPanel(); @@ -48,7 +48,7 @@ public class ProgressBarTest } } - @Test + @Test(groups ={ "Functional" }) public void testSetProgressBar() { statusPanel = new JPanel(); diff --git a/test/jalview/gui/SequenceRendererTest.java b/test/jalview/gui/SequenceRendererTest.java index 64d15b8..0f3d4f6 100644 --- a/test/jalview/gui/SequenceRendererTest.java +++ b/test/jalview/gui/SequenceRendererTest.java @@ -15,7 +15,7 @@ import org.testng.annotations.Test; public class SequenceRendererTest { - @Test + @Test(groups ={ "Functional" }) public void testGetResidueBoxColour_zappo() { SequenceI seq = new Sequence("name", "MATVLGSPRAPAFF"); // FER1_MAIZE... diff --git a/test/jalview/gui/StructureChooserTest.java b/test/jalview/gui/StructureChooserTest.java index 44b51f2..71d062c 100644 --- a/test/jalview/gui/StructureChooserTest.java +++ b/test/jalview/gui/StructureChooserTest.java @@ -18,7 +18,7 @@ public class StructureChooserTest { Sequence seq; - @BeforeMethod + @BeforeMethod(alwaysRun = true) public void setUp() throws Exception { seq = new Sequence("PDB|4kqy|4KQY|A", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", 1, @@ -48,7 +48,7 @@ public class StructureChooserTest - @Test + @Test(groups ={ "Functional" }) public void buildQueryTest() { String query = StructureChooser.buildQuery(seq); @@ -58,7 +58,7 @@ public class StructureChooserTest query); } - @Test + @Test(groups ={ "Functional" }) public void populateFilterComboBoxTest() { SequenceI[] selectedSeqs = new SequenceI[] @@ -77,7 +77,7 @@ public class StructureChooserTest // should be populated } - @Test + @Test(groups ={ "Functional" }) public void fetchStructuresInfoTest() { SequenceI[] selectedSeqs = new SequenceI[] diff --git a/test/jalview/io/AnnotatedPDBFileInputTest.java b/test/jalview/io/AnnotatedPDBFileInputTest.java index 1c6a489..31bfd9d 100644 --- a/test/jalview/io/AnnotatedPDBFileInputTest.java +++ b/test/jalview/io/AnnotatedPDBFileInputTest.java @@ -32,7 +32,7 @@ public class AnnotatedPDBFileInputTest String pdbId; - @BeforeMethod + @BeforeMethod(alwaysRun = true) public void setup() throws Exception { Cache.applicationProperties.setProperty("STRUCT_FROM_PDB", @@ -47,7 +47,7 @@ public class AnnotatedPDBFileInputTest .get(0).getId(); } - @Test + @Test(groups ={ "Functional" }) public void checkNoDuplicates() { // not strictly a requirement, but strange things may happen if multiple @@ -67,7 +67,7 @@ public class AnnotatedPDBFileInputTest } } - @Test + @Test(groups ={ "Functional" }) public void checkPDBannotationSource() { @@ -85,7 +85,7 @@ public class AnnotatedPDBFileInputTest /** * Check sequence features have been added */ - @Test + @Test(groups ={ "Functional" }) public void checkPDBSequenceFeatures() { StructureSelectionManager ssm = StructureSelectionManager @@ -124,7 +124,7 @@ public class AnnotatedPDBFileInputTest assertEquals("TYR:314 1gaqC", sf[295].getDescription()); } - @Test + @Test(groups ={ "Functional" }) public void checkAnnotationWiring() { assertTrue(al.getAlignmentAnnotation() != null); @@ -156,7 +156,7 @@ public class AnnotatedPDBFileInputTest /** * @throws java.lang.Exception */ - @BeforeClass + @BeforeClass(alwaysRun = true) public static void setUpBeforeClass() throws Exception { jalview.bin.Jalview.main(new String[] @@ -173,7 +173,7 @@ public class AnnotatedPDBFileInputTest } - @Test + @Test(groups ={ "Functional" }) public void testJalviewProjectRelocationAnnotation() throws Exception { diff --git a/test/jalview/io/AnnotationFileIOTest.java b/test/jalview/io/AnnotationFileIOTest.java index d36a82b..a63923a 100644 --- a/test/jalview/io/AnnotationFileIOTest.java +++ b/test/jalview/io/AnnotationFileIOTest.java @@ -52,7 +52,7 @@ public class AnnotationFileIOTest { "Test hiding/showing of insertions on sequence_ref", "examples/uniref50.fa", "examples/testdata/uniref50_seqref.jva" } }; - @Test + @Test(groups ={ "Functional" }) public void exampleAnnotationFileIO() throws Exception { for (String[] testPair : TestFiles) @@ -100,7 +100,7 @@ public class AnnotationFileIOTest * f */ - // @Test + // @Test(groups ={ "Functional" }) public static void testAnnotationFileIO(String testname, File f, File annotFile) { diff --git a/test/jalview/io/BioJsHTMLOutputTest.java b/test/jalview/io/BioJsHTMLOutputTest.java index 8440b6d..27c8a0e 100644 --- a/test/jalview/io/BioJsHTMLOutputTest.java +++ b/test/jalview/io/BioJsHTMLOutputTest.java @@ -19,7 +19,7 @@ import org.testng.annotations.Test; public class BioJsHTMLOutputTest { - @Test + @Test(groups ={ "Functional" }) public void getJalviewAlignmentAsJsonString() { String bjsTemplate = null; @@ -44,7 +44,8 @@ public class BioJsHTMLOutputTest Assert.assertNotNull(bjsTemplate); } - @Test(expectedExceptions = NullPointerException.class) + @Test(groups = + { "Functional" }, expectedExceptions = NullPointerException.class) public void expectedNullPointerException() { try @@ -57,7 +58,7 @@ public class BioJsHTMLOutputTest } } - @Test + @Test(groups ={ "Functional" }) public void getBioJsMSAVersions() { TreeMap versions = null; @@ -89,7 +90,8 @@ public class BioJsHTMLOutputTest } - @Test + @Test(groups = + { "Network" }) public void testBioJsUpdate() { String url = BioJsHTMLOutput.BJS_TEMPLATE_GIT_REPO; diff --git a/test/jalview/io/FileIOTester.java b/test/jalview/io/FileIOTester.java index 6b7de77..2404ea9 100644 --- a/test/jalview/io/FileIOTester.java +++ b/test/jalview/io/FileIOTester.java @@ -38,7 +38,7 @@ public class FileIOTester /** * @throws java.lang.Exception */ - @BeforeClass + @BeforeClass(alwaysRun = true) public static void setUpBeforeClass() throws Exception { } @@ -73,7 +73,7 @@ public class FileIOTester + "' identified as '" + type + "'", type.equalsIgnoreCase(fmt)); } - @Test + @Test(groups ={ "Functional" }) public void testStarsInFasta1() throws IOException { String uri; @@ -82,7 +82,7 @@ public class FileIOTester assertValidFormat("FASTA", uri, fp); } - @Test + @Test(groups ={ "Functional" }) public void testStarsInFasta2() throws IOException { String uri; @@ -91,7 +91,7 @@ public class FileIOTester assertValidFormat("FASTA", uri, fp); } - @Test + @Test(groups ={ "Functional" }) public void testGzipIo() throws IOException { String uri; @@ -100,7 +100,7 @@ public class FileIOTester assertValidFormat("FASTA", uri, fp); } - @Test + @Test(groups ={ "Functional" }) public void testGziplocalFileIO() throws IOException { String filepath; @@ -109,7 +109,7 @@ public class FileIOTester assertValidFormat("FASTA", filepath, fp); } - @Test + @Test(groups ={ "Functional" }) public void testNonGzipURLIO() throws IOException { String uri; @@ -118,7 +118,7 @@ public class FileIOTester assertValidFormat("FASTA", uri, fp); } - @Test + @Test(groups ={ "Functional" }) public void testNonGziplocalFileIO() throws IOException { String filepath; diff --git a/test/jalview/io/Gff3tests.java b/test/jalview/io/Gff3tests.java index 8df44df..c8cf638 100644 --- a/test/jalview/io/Gff3tests.java +++ b/test/jalview/io/Gff3tests.java @@ -1,5 +1,11 @@ package jalview.io; +import static org.testng.AssertJUnit.assertEquals; +import static org.testng.AssertJUnit.assertFalse; +import static org.testng.AssertJUnit.assertNotNull; +import static org.testng.AssertJUnit.assertNull; +import static org.testng.AssertJUnit.assertTrue; + import jalview.datamodel.Alignment; import jalview.datamodel.AlignmentI; import jalview.datamodel.SequenceDummy; @@ -8,8 +14,7 @@ import jalview.gui.AlignFrame; import java.io.IOException; -import org.junit.Assert; -import org.junit.Test; +import org.testng.annotations.Test; public class Gff3tests { @@ -18,7 +23,7 @@ public class Gff3tests exonerateOutput = "examples/testdata/exonerateoutput.gff", simpleGff3file = "examples/testdata/simpleGff3.gff"; - @Test + @Test(groups ={ "Functional" }) public void testExonerateImport() { // exonerate does not tag sequences after features, so we have a more @@ -29,26 +34,26 @@ public class Gff3tests AlignFrame af = loader.LoadFileWaitTillLoaded(exonerateSeqs, FormatAdapter.FILE); - Assert.assertEquals("Unexpected number of DNA protein associations", 0, + assertEquals("Unexpected number of DNA protein associations", 0, af.getViewport().getAlignment().getCodonFrames().size()); af.loadJalviewDataFile(exonerateOutput, FormatAdapter.FILE, null, null); - Assert.assertNotEquals("Expected at least one DNA protein association", - 0, af.getViewport().getAlignment().getDataset() - .getCodonFrames().size()); + assertTrue("Expected at least one DNA protein association", af + .getViewport().getAlignment().getDataset().getCodonFrames() + .size() > 0); } - @Test + @Test(groups ={ "Functional" }) public void simpleGff3FileIdentify() { - Assert.assertEquals("Didn't recognise file correctly.", + assertEquals("Didn't recognise file correctly.", IdentifyFile.GFF3File, new IdentifyFile().Identify(simpleGff3file, FormatAdapter.FILE)); } - @Test + @Test(groups ={ "Functional" }) public void simpleGff3FileClass() throws IOException { AlignmentI dataset = new Alignment(new SequenceI[] @@ -57,22 +62,22 @@ public class Gff3tests FormatAdapter.FILE); boolean parseResult = ffile.parse(dataset, null, null, false, false); - Assert.assertTrue("return result should be true", parseResult); + assertTrue("return result should be true", parseResult); checkDatasetfromSimpleGff3(dataset); } - @Test + @Test(groups ={ "Functional" }) public void simpleGff3FileLoader() throws IOException { AlignFrame af = new FileLoader(false).LoadFileWaitTillLoaded( simpleGff3file, FormatAdapter.FILE); - Assert.assertTrue( + assertTrue( "Didn't read the alignment into an alignframe from Gff3 File", af != null); checkDatasetfromSimpleGff3(af.getViewport().getAlignment().getDataset()); } - @Test + @Test(groups ={ "Functional" }) public void simpleGff3RelaxedIdMatching() throws IOException { AlignmentI dataset = new Alignment(new SequenceI[] @@ -81,12 +86,12 @@ public class Gff3tests FormatAdapter.FILE); boolean parseResult = ffile.parse(dataset, null, null, false, true); - Assert.assertTrue("return result (relaxedID matching) should be true", + assertTrue("return result (relaxedID matching) should be true", parseResult); checkDatasetfromSimpleGff3(dataset); } - @Test + @Test(groups ={ "Functional" }) public void readGff3File() throws IOException { Gff3File gff3reader = new Gff3File(simpleGff3file, FormatAdapter.FILE); @@ -98,47 +103,50 @@ public class Gff3tests private void checkDatasetfromSimpleGff3(AlignmentI dataset) { - Assert.assertEquals("no sequences extracted from GFF3 file", 2, + assertEquals("no sequences extracted from GFF3 file", 2, dataset.getHeight()); SequenceI seq1 = dataset.findName("seq1"), seq2 = dataset .findName("seq2"); - Assert.assertNotNull(seq1); - Assert.assertNotNull(seq2); - Assert.assertFalse( + assertNotNull(seq1); + assertNotNull(seq2); + assertFalse( "Failed to replace dummy seq1 with real sequence", seq1 instanceof SequenceDummy && ((SequenceDummy) seq1).isDummy()); - Assert.assertFalse( + assertFalse( "Failed to replace dummy seq2 with real sequence", seq2 instanceof SequenceDummy && ((SequenceDummy) seq2).isDummy()); String placeholderseq = new SequenceDummy("foo").getSequenceAsString(); - Assert.assertFalse("dummy replacement buggy for seq1", + assertFalse("dummy replacement buggy for seq1", placeholderseq.equals(seq1.getSequenceAsString())); - Assert.assertNotEquals("dummy replacement buggy for seq2", + assertFalse("dummy replacement buggy for seq2", placeholderseq.equals(seq2.getSequenceAsString())); - Assert.assertNotNull("No features added to seq1", + assertNotNull("No features added to seq1", seq1.getSequenceFeatures());// != null); - Assert.assertEquals("Wrong number of features", 3, + assertEquals("Wrong number of features", 3, seq1.getSequenceFeatures().length); - Assert.assertNull(seq2.getSequenceFeatures()); - Assert.assertEquals("Wrong number of features", 0, seq2 + assertNull(seq2.getSequenceFeatures()); + assertEquals( + "Wrong number of features", + 0, + seq2 .getSequenceFeatures() == null ? 0 : seq2.getSequenceFeatures().length); - Assert.assertTrue( + assertTrue( "Expected at least one CDNA/Protein mapping for seq1", dataset.getCodonFrame(seq1) != null && dataset.getCodonFrame(seq1).size() > 0); } - // @Test + // @Test(groups ={ "Functional" }) // public final void testPrintGFFFormatSequenceIArrayMapOfStringObject() // { // fail("Not yet implemented"); // } // - // @Test + // @Test(groups ={ "Functional" }) // public final void testAlignFileBooleanStringString() // { // fail("Not yet implemented"); diff --git a/test/jalview/io/HtmlFileTest.java b/test/jalview/io/HtmlFileTest.java index eca3984..10d1057 100644 --- a/test/jalview/io/HtmlFileTest.java +++ b/test/jalview/io/HtmlFileTest.java @@ -7,7 +7,8 @@ import org.testng.annotations.Test; public class HtmlFileTest { - @Test(enabled = false) + @Test(groups = + { "Functional" }, enabled = false) public void test() { fail("Not yet implemented"); diff --git a/test/jalview/io/IdentifyFileTest.java b/test/jalview/io/IdentifyFileTest.java new file mode 100644 index 0000000..1c34e1f --- /dev/null +++ b/test/jalview/io/IdentifyFileTest.java @@ -0,0 +1,45 @@ +package jalview.io; + +import org.testng.Assert; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + +public class IdentifyFileTest { + + @Test(groups = + { "Functional" }, dataProvider = "identifyFiles") + public void Identify(String data, String expectedFileType) + { + String protocol = AppletFormatAdapter.FILE; + IdentifyFile ider = new IdentifyFile(); + String actualFiletype = ider.Identify(data, protocol); + Assert.assertEquals(actualFiletype, expectedFileType, + "File identification Failed!"); + } + + @DataProvider(name = "identifyFiles") + public Object[][] IdentifyFileDP() + { + return new Object[][] + { + { "examples/example.json", "JSON" }, + { "examples/plantfdx.fa", "FASTA" }, + { "examples/dna_interleaved.phy", "PHYLIP" }, + { "examples/2GIS.pdb", "PDB" }, + { "examples/rf00031_folded.stk", "STH" }, + { "examples/testdata/test.rnaml", "RNAML" }, + { "examples/testdata/test.aln", "CLUSTAL" }, + { "examples/testdata/test.pfam", "PFAM" }, + { "examples/testdata/test.msf", "MSF" }, + { "examples/testdata/test.pir", "PIR" }, + { "examples/testdata/test.html", "HTML" }, + { "examples/testdata/test.pileup", "PileUp" }, + { "examples/testdata/test.blc", "BLC" }, + { "examples/testdata/simplegff3.gff", "GFF v2 or v3" }, + { "examples/testdata/test.jvp", "Jalview" }, + // { "examples/testdata/test.amsa", "AMSA" }, + // { "examples/test.jnet", "JnetFile" }, + }; + } + +} diff --git a/test/jalview/io/JSONFileTest.java b/test/jalview/io/JSONFileTest.java index 2e28e3a..b6a3e4a 100644 --- a/test/jalview/io/JSONFileTest.java +++ b/test/jalview/io/JSONFileTest.java @@ -3,25 +3,30 @@ package jalview.io; import static org.testng.AssertJUnit.assertNotNull; +import jalview.api.AlignExportSettingI; +import jalview.datamodel.Alignment; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; import jalview.datamodel.Annotation; +import jalview.datamodel.ColumnSelection; import jalview.datamodel.Sequence; import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceGroup; import jalview.datamodel.SequenceI; import jalview.gui.AlignFrame; -import jalview.gui.AlignmentPanel; import jalview.schemes.ColourSchemeI; -import jalview.viewmodel.seqfeatures.FeaturesDisplayed; +import jalview.schemes.ZappoColourScheme; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; +import java.util.List; +import org.testng.Assert; import org.testng.AssertJUnit; -import org.testng.annotations.AfterMethod; +import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeMethod; +import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; public class JSONFileTest @@ -33,17 +38,31 @@ public class JSONFileTest private int TEST_ANOT_HEIGHT = 0; - private AlignFrame af; + private int TEST_CS_HEIGHT = 0; - AlignmentI alignment; + private String TEST_JSON_FILE = "examples/example.json"; - AlignmentPanel alignPanel; + private Alignment alignment; - HashMap testSeqs = new HashMap(); - HashMap testAnnots = new HashMap(); - HashMap testGrps = new HashMap(); + private HashMap expectedSeqs = new HashMap(); - @BeforeMethod + private HashMap expectedAnnots = new HashMap(); + + private HashMap expectedGrps = new HashMap(); + + private ColumnSelection expectedColSel = new ColumnSelection(); + + private SequenceI[] expectedHiddenSeqs = new SequenceI[1]; + + private AlignmentI testAlignment; + + private int passedCount; + + private JSONFile testJsonFile; + + private JSONFile jf; + + @BeforeTest(alwaysRun = true) public void setup() throws Exception { // create and add sequences @@ -59,6 +78,10 @@ public class JSONFileTest seqs[4] = new Sequence("Q7XA98_TRIPR", "ALYGTAVSTSFMRRQPVPMSV-ATTTTTKAFPSGF", 6, 39); + SequenceI hiddenSeq = new Sequence("FER_TOCH", + "FILGTMISKSFLFRKPAVTSL-KAISNVGE--ALF", 3, 34); + expectedHiddenSeqs[0] = hiddenSeq; + // create and add sequence features SequenceFeature seqFeature2 = new SequenceFeature("feature_x", "desciption", "status", 6, 15, "Jalview"); @@ -70,17 +93,11 @@ public class JSONFileTest seqs[3].addSequenceFeature(seqFeature3); seqs[4].addSequenceFeature(seqFeature4); - // add created features to features displayed - FeaturesDisplayed fDis = new FeaturesDisplayed(); - fDis.setVisible("feature_x"); - // jsonFile.setDisplayedFeatures(fDis); - // jsonFile.setShowSeqFeatures(true); for (Sequence seq : seqs) { seq.setDatasetSequence(seq); - testSeqs.put(seq.getName(), seq); - // jsonFile.seqs.add(seq); + expectedSeqs.put(seq.getName(), seq); } // create and add sequence groups @@ -94,8 +111,8 @@ public class JSONFileTest scheme, true, true, false, 21, 29); seqGrp.setShowNonconserved(false); seqGrp.setDescription(null); - // jsonFile.seqGroups.add(seqGrp); - testGrps.put(seqGrp.getName(), seqGrp); + + expectedGrps.put(seqGrp.getName(), seqGrp); // create and add annotation Annotation[] annot = new Annotation[35]; @@ -137,51 +154,166 @@ public class JSONFileTest AlignmentAnnotation alignAnnot = new AlignmentAnnotation( "Secondary Structure", "New description", annot); - // jsonFile.annotations.add(alignAnnot); - testAnnots.put(alignAnnot.label, alignAnnot); + expectedAnnots.put(alignAnnot.label, alignAnnot); - // Alignment al = new Alignment(seqs); - TEST_SEQ_HEIGHT = testSeqs.size(); - TEST_GRP_HEIGHT = testGrps.size(); - TEST_ANOT_HEIGHT = testAnnots.size(); - } + expectedColSel.hideColumns(32, 33); + expectedColSel.hideColumns(34, 34); - @AfterMethod - public void tearDown() throws Exception - { - } + TEST_SEQ_HEIGHT = expectedSeqs.size(); + TEST_GRP_HEIGHT = expectedGrps.size(); + TEST_ANOT_HEIGHT = expectedAnnots.size(); + TEST_CS_HEIGHT = expectedColSel.getHiddenColumns().size(); - @Test - public void testParse() - { - String jsonFile = "examples/example.json"; - AppletFormatAdapter rf = new AppletFormatAdapter(); - AlignmentI al = null; + AlignExportSettingI exportSettings = new AlignExportSettingI() + { + @Override + public boolean isExportHiddenSequences() + { + return true; + } + + @Override + public boolean isExportHiddenColumns() + { + return true; + } + + @Override + public boolean isExportGroups() + { + return true; + } + + @Override + public boolean isExportFeatures() + { + return true; + } + + @Override + public boolean isExportAnnotations() + { + return true; + } + }; + + AppletFormatAdapter formatAdapter = new AppletFormatAdapter(); try { - al = rf.readFile(jsonFile, AppletFormatAdapter.FILE, - JSONFile.FILE_DESC); + alignment = (Alignment) formatAdapter.readFile(TEST_JSON_FILE, + AppletFormatAdapter.FILE, JSONFile.FILE_DESC); + jf = (JSONFile) formatAdapter.getAlignFile(); + + AlignFrame af = new AlignFrame(alignment, jf.getHiddenSequences(), + jf.getColumnSelection(), AlignFrame.DEFAULT_WIDTH, + AlignFrame.DEFAULT_HEIGHT); + af.getViewport().setShowSequenceFeatures(jf.isShowSeqFeatures()); + af.changeColour(jf.getColourScheme()); + af.getViewport().setFeaturesDisplayed(jf.getDisplayedFeatures()); + + + formatAdapter = new AppletFormatAdapter(af.alignPanel, exportSettings); + String jsonOutput = formatAdapter.formatSequences(JSONFile.FILE_DESC, + af.alignPanel.getAlignment(), false); + + formatAdapter = new AppletFormatAdapter(); + testAlignment = formatAdapter.readFile(jsonOutput, + AppletFormatAdapter.PASTE, JSONFile.FILE_DESC); + testJsonFile = (JSONFile) formatAdapter.getAlignFile(); + // System.out.println(jsonOutput); } catch (IOException e) { e.printStackTrace(); } - assertNotNull("Couldn't read supplied alignment data.", al); - int passedCount = 0; - for (SequenceI seq : al.getSequences()) + } + + @BeforeMethod(alwaysRun = true) + public void methodSetup() + { + passedCount = 0; + } + + @AfterTest + public void tearDown() throws Exception + { + testJsonFile = null; + alignment = null; + expectedSeqs = null; + expectedAnnots = null; + expectedGrps = null; + testAlignment = null; + jf = null; + } + + @Test(groups ={ "Functional" }) + public void roundTripTest() + { + assertNotNull("JSON roundtrip test failed!", testJsonFile); + } + + @Test(groups ={ "Functional" }) + public void testSeqParsed() + { + assertNotNull("Couldn't read supplied alignment data.", testAlignment); + Assert.assertNotNull(testAlignment.getSequences()); + for (SequenceI seq : testAlignment.getSequences()) { - SequenceI expectedSeq = testSeqs.get(seq.getName()); - AssertJUnit.assertTrue("Failed Sequence Test for >>> " + seq.getName(), + SequenceI expectedSeq = expectedSeqs.get(seq.getName()); + AssertJUnit.assertTrue( + "Failed Sequence Test for >>> " + seq.getName(), isSeqMatched(expectedSeq, seq)); passedCount++; } AssertJUnit.assertEquals("Some Sequences did not pass the test", TEST_SEQ_HEIGHT, passedCount); + } + + @Test(groups ={ "Functional" }) + public void hiddenColsTest() + { + ColumnSelection cs = testJsonFile.getColumnSelection(); + Assert.assertNotNull(cs); + Assert.assertNotNull(cs.getHiddenColumns()); + List hiddenCols = cs.getHiddenColumns(); + Assert.assertEquals(hiddenCols.size(), TEST_CS_HEIGHT); + Assert.assertEquals(hiddenCols, expectedColSel.getHiddenColumns(), + "Mismatched hidden columns!"); + } - passedCount = 0; - for (SequenceGroup seqGrp : al.getGroups()) + @Test(groups ={ "Functional" }) + public void hiddenSeqsTest() + { + Assert.assertNotNull(testJsonFile.getHiddenSequences(), + "Hidden sequence Expected but found Null"); + Assert.assertEquals(jf.getHiddenSequences().length, 1, + "Hidden sequece"); + } + + @Test(groups ={ "Functional" }) + public void colorSchemeTest() + { + Assert.assertNotNull(testJsonFile.getColourScheme(), + "Colourscheme is null, parsing failed!"); + Assert.assertTrue( + testJsonFile.getColourScheme() instanceof ZappoColourScheme, + "Zappo colour scheme expected!"); + } + + @Test(groups ={ "Functional" }) + public void isShowSeqFeaturesSet() + { + Assert.assertTrue(testJsonFile.isShowSeqFeatures(), + "Sequence feature isDisplayed setting expected to be true"); + } + + @Test(groups ={ "Functional" }) + public void testGrpParsed() + { + Assert.assertNotNull(testAlignment.getGroups()); + for (SequenceGroup seqGrp : testAlignment.getGroups()) { - SequenceGroup expectedGrp = testGrps.get(seqGrp.getName()); + SequenceGroup expectedGrp = expectedGrps.get(seqGrp.getName()); AssertJUnit.assertTrue( "Failed SequenceGroup Test for >>> " + seqGrp.getName(), isGroupMatched(expectedGrp, seqGrp)); @@ -189,21 +321,21 @@ public class JSONFileTest } AssertJUnit.assertEquals("Some SequenceGroups did not pass the test", TEST_GRP_HEIGHT, passedCount); + } - passedCount = 0; - for (AlignmentAnnotation annot : al.getAlignmentAnnotation()) + @Test(groups ={ "Functional" }) + public void testAnnotationParsed() + { + Assert.assertNotNull(testAlignment.getAlignmentAnnotation()); + for (AlignmentAnnotation annot : testAlignment.getAlignmentAnnotation()) { - AlignmentAnnotation expectedAnnot = testAnnots.get(annot.label); + AlignmentAnnotation expectedAnnot = expectedAnnots.get(annot.label); AssertJUnit.assertTrue("Failed AlignmentAnnotation Test for >>> " + annot.label, isAnnotationMatched(expectedAnnot, annot)); passedCount++; } AssertJUnit.assertEquals("Some Sequences did not pass the test", TEST_ANOT_HEIGHT, passedCount); - - // af = new AlignFrame(al, 700, 500); - // AlignViewport viewport = af.getViewport(); - // alignPanel = new AlignmentPanel(af, viewport); } public boolean isAnnotationMatched(AlignmentAnnotation eAnnot, diff --git a/test/jalview/io/Jalview2xmlTests.java b/test/jalview/io/Jalview2xmlTests.java index 7d24727..2afcdc2 100644 --- a/test/jalview/io/Jalview2xmlTests.java +++ b/test/jalview/io/Jalview2xmlTests.java @@ -47,7 +47,7 @@ public class Jalview2xmlTests /** * @throws java.lang.Exception */ - @BeforeClass + @BeforeClass(alwaysRun = true) public static void setUpBeforeClass() throws Exception { jalview.bin.Jalview.main(new String[] @@ -83,7 +83,7 @@ public class Jalview2xmlTests return numdsann; } - @Test + @Test(groups ={ "Functional" }) public void testRNAStructureRecovery() throws Exception { String inFile = "examples/RF00031_folded.stk"; @@ -118,7 +118,7 @@ public class Jalview2xmlTests af.getViewport().getGlobalColourScheme() instanceof jalview.schemes.RNAHelicesColour); } - @Test + @Test(groups ={ "Functional" }) public void testTCoffeeScores() throws Exception { String inFile = "examples/uniref50.fa", inAnnot = "examples/uniref50.score_ascii"; @@ -154,7 +154,7 @@ public class Jalview2xmlTests .println("T-Coffee score shading successfully recovered from project."); } - @Test + @Test(groups ={ "Functional" }) public void testColourByAnnotScores() throws Exception { String inFile = "examples/uniref50.fa", inAnnot = "examples/testdata/uniref50_iupred.jva"; @@ -240,7 +240,7 @@ public class Jalview2xmlTests .println("Per sequence (Group) colourscheme successfully applied and recovered."); } - @Test + @Test(groups ={ "Functional" }) public void gatherViewsHere() throws Exception { int origCount = Desktop.getAlignFrames() == null ? 0 : Desktop @@ -253,7 +253,7 @@ public class Jalview2xmlTests } - @Test + @Test(groups ={ "Functional" }) public void viewRefPdbAnnotation() throws Exception { Cache.applicationProperties.setProperty("STRUCT_FROM_PDB", @@ -315,7 +315,7 @@ public class Jalview2xmlTests } - @Test + @Test(groups ={ "Functional" }) public void testCopyViewSettings() throws Exception { AlignFrame af = new jalview.io.FileLoader().LoadFileWaitTillLoaded( diff --git a/test/jalview/io/NewickFileTests.java b/test/jalview/io/NewickFileTests.java index a016134..261ffc6 100644 --- a/test/jalview/io/NewickFileTests.java +++ b/test/jalview/io/NewickFileTests.java @@ -84,12 +84,12 @@ public class NewickFileTests /** * @throws java.lang.Exception */ - @BeforeClass + @BeforeClass(alwaysRun = true) public static void setUpBeforeClass() throws Exception { } - @Test + @Test(groups ={ "Functional" }) public void testTreeIO() throws Exception { String stage = "Init", treename = " '" + name + "' :"; diff --git a/test/jalview/io/PhylipFileTests.java b/test/jalview/io/PhylipFileTests.java index d335731..9c95486 100644 --- a/test/jalview/io/PhylipFileTests.java +++ b/test/jalview/io/PhylipFileTests.java @@ -79,7 +79,7 @@ public class PhylipFileTests * * @throws Exception */ - @Test + @Test(groups ={ "Functional" }) public void testSequentialDataExtraction() throws Exception { testDataExtraction(sequentialFile); @@ -91,7 +91,7 @@ public class PhylipFileTests * * @throws Exception */ - @Test + @Test(groups ={ "Functional" }) public void testInterleavedDataExtraction() throws Exception { testDataExtraction(interleavedFile); @@ -124,7 +124,7 @@ public class PhylipFileTests * * @throws Exception */ - @Test + @Test(groups ={ "Functional" }) public void testSequentialIO() throws Exception { testIO(sequentialFile); @@ -136,7 +136,7 @@ public class PhylipFileTests * * @throws Exception */ - @Test + @Test(groups ={ "Functional" }) public void testInterleavedIO() throws Exception { testIO(interleavedFile); diff --git a/test/jalview/io/RNAMLfileTest.java b/test/jalview/io/RNAMLfileTest.java index d684512..fc54ef1 100644 --- a/test/jalview/io/RNAMLfileTest.java +++ b/test/jalview/io/RNAMLfileTest.java @@ -29,7 +29,7 @@ import org.testng.annotations.Test; public class RNAMLfileTest { - @BeforeClass + @BeforeClass(alwaysRun = true) public static void setUpBeforeClass() throws Exception { } @@ -39,7 +39,7 @@ public class RNAMLfileTest { } - @Test + @Test(groups ={ "Functional" }) public void testRnamlToStockholmIO() { StockholmFileTest.testFileIOwithFormat(new File( diff --git a/test/jalview/io/StockholmFileTest.java b/test/jalview/io/StockholmFileTest.java index 45de531..2537002 100644 --- a/test/jalview/io/StockholmFileTest.java +++ b/test/jalview/io/StockholmFileTest.java @@ -43,13 +43,13 @@ public class StockholmFileTest static String PfamFile = "examples/PF00111_seed.stk", RfamFile = "examples/RF00031_folded.stk"; - @Test + @Test(groups ={ "Functional" }) public void pfamFileIO() throws Exception { testFileIOwithFormat(new File(PfamFile), "STH", -1, 0); } - @Test + @Test(groups ={ "Functional" }) public void pfamFileDataExtraction() throws Exception { AppletFormatAdapter af = new AppletFormatAdapter(); @@ -68,7 +68,7 @@ public class StockholmFileTest numpdb > 0); } - @Test + @Test(groups ={ "Functional" }) public void rfamFileIO() throws Exception { testFileIOwithFormat(new File(RfamFile), "STH", 2, 1); diff --git a/test/jalview/io/TCoffeeScoreFileTest.java b/test/jalview/io/TCoffeeScoreFileTest.java index b7da5e4..7911188 100644 --- a/test/jalview/io/TCoffeeScoreFileTest.java +++ b/test/jalview/io/TCoffeeScoreFileTest.java @@ -40,7 +40,7 @@ public class TCoffeeScoreFileTest final static File ALIGN_FILE = new File( "test/jalview/io/tcoffee.fasta_aln"); - @Test + @Test(groups ={ "Functional" }) public void testReadHeader() throws IOException { @@ -65,7 +65,7 @@ public class TCoffeeScoreFileTest AssertJUnit.assertEquals(90, header.getScoreFor("cons")); } - @Test + @Test(groups ={ "Functional" }) public void testWrongFile() { try @@ -80,7 +80,7 @@ public class TCoffeeScoreFileTest } } - @Test + @Test(groups ={ "Functional" }) public void testHeightAndWidth() throws IOException { TCoffeeScoreFile result = new TCoffeeScoreFile(SCORE_FILE.getPath(), @@ -90,7 +90,7 @@ public class TCoffeeScoreFileTest AssertJUnit.assertEquals(83, result.getWidth()); } - @Test + @Test(groups ={ "Functional" }) public void testReadBlock() throws IOException { @@ -129,7 +129,7 @@ public class TCoffeeScoreFileTest block.getConsensus()); } - @Test + @Test(groups ={ "Functional" }) public void testParse() throws IOException { @@ -165,7 +165,7 @@ public class TCoffeeScoreFileTest parser.getScoresFor("cons")); } - @Test + @Test(groups ={ "Functional" }) public void testGetAsList() throws IOException { @@ -203,7 +203,7 @@ public class TCoffeeScoreFileTest } - @Test + @Test(groups ={ "Functional" }) public void testGetAsArray() throws IOException { @@ -234,7 +234,7 @@ public class TCoffeeScoreFileTest } - @Test + @Test(groups ={ "Functional" }) public void testHeightAndWidthWithResidueNumbers() throws Exception { String file = "test/jalview/io/tcoffee.score_ascii_with_residue_numbers"; diff --git a/test/jalview/schemes/DnaCodonTests.java b/test/jalview/schemes/DnaCodonTests.java index 75877ee..3d20190 100644 --- a/test/jalview/schemes/DnaCodonTests.java +++ b/test/jalview/schemes/DnaCodonTests.java @@ -29,13 +29,13 @@ import org.testng.annotations.Test; public class DnaCodonTests { - @Test + @Test(groups ={ "Functional" }) public void testAmbiguityCodeGeneration() { assertTrue(ResidueProperties.ambiguityCodes.size() > 0); } - @Test + @Test(groups ={ "Functional" }) public void testAmbiguityCodon() { for (String ac : ResidueProperties.ambiguityCodes.keySet()) @@ -45,7 +45,7 @@ public class DnaCodonTests } } - @Test + @Test(groups ={ "Functional" }) public void regenerateCodonTable() { for (Map.Entry codon : ResidueProperties.codonHash2 @@ -56,7 +56,7 @@ public class DnaCodonTests } } - @Test + @Test(groups ={ "Functional" }) public void checkOldCodonagainstNewCodonTable() { // note - this test will be removed once the old codon table (including diff --git a/test/jalview/schemes/ResiduePropertiesTest.java b/test/jalview/schemes/ResiduePropertiesTest.java index d7e0e0b..eb2ad45 100644 --- a/test/jalview/schemes/ResiduePropertiesTest.java +++ b/test/jalview/schemes/ResiduePropertiesTest.java @@ -14,7 +14,7 @@ public class ResiduePropertiesTest /** * Test 'standard' codon translations (no ambiguity codes) */ - @Test + @Test(groups ={ "Functional" }) public void testCodonTranslate() { // standard translation table order column 1/2/3/4 @@ -88,7 +88,7 @@ public class ResiduePropertiesTest * Test a sample of codon translations involving ambiguity codes. Should * return a protein value where the ambiguity does not affect the translation. */ - @Test + @Test(groups ={ "Functional" }) public void testCodonTranslate_ambiguityCodes() { // Y is C or T @@ -175,7 +175,7 @@ public class ResiduePropertiesTest assertNull(ResidueProperties.codonTranslate("WSK")); } - @Test + @Test(groups ={ "Functional" }) public void testGetResidues_nucleotide() { /* @@ -194,7 +194,7 @@ public class ResiduePropertiesTest assertEquals("[A, C, G, I, N, R, T, U, X, Y]", residues.toString()); } - @Test + @Test(groups ={ "Functional" }) public void testGetResidues_peptide() { /* diff --git a/test/jalview/schemes/ScoreMatrixPrinter.java b/test/jalview/schemes/ScoreMatrixPrinter.java index 0b15b60..f00ac8d 100644 --- a/test/jalview/schemes/ScoreMatrixPrinter.java +++ b/test/jalview/schemes/ScoreMatrixPrinter.java @@ -28,7 +28,7 @@ import org.testng.annotations.Test; public class ScoreMatrixPrinter { - @Test + @Test(groups ={ "Functional" }) public void printAllMatrices() { for (Map.Entry sm : ResidueProperties.scoreMatrices @@ -39,7 +39,7 @@ public class ScoreMatrixPrinter } } - @Test + @Test(groups ={ "Functional" }) public void printHTMLMatrices() { for (Map.Entry _sm : ResidueProperties.scoreMatrices diff --git a/test/jalview/structure/Mapping.java b/test/jalview/structure/Mapping.java index db0ea49..c057980 100644 --- a/test/jalview/structure/Mapping.java +++ b/test/jalview/structure/Mapping.java @@ -27,7 +27,8 @@ public class Mapping * 115 in PDB Res Numbering secondary structure numbers in jmol seem to be in * msd numbering, not pdb res numbering. */ - @Test(enabled = false) + @Test(groups = + { "Functional" }, enabled = false) public void pdbEntryPositionMap() throws Exception { Assert.fail("This test intentionally left to fail"); @@ -109,7 +110,8 @@ public class Mapping } } - @Test(enabled = false) + @Test(groups = + { "Functional" }, enabled = false) public void testPDBentryMapping() throws Exception { Assert.fail("This test intentionally left to fail"); @@ -210,7 +212,7 @@ public class Mapping * transform * */ - @Test + @Test(groups ={ "Functional" }) public void mapFer1From3W5V() throws Exception { AlignFrame seqf = new FileLoader(false) @@ -233,7 +235,7 @@ public class Mapping * compare reference annotation for imported pdb sequence to identical * seuqence with transferred annotation from mapped pdb file */ - @Test + @Test(groups ={ "Functional" }) public void compareTransferredToRefPDBAnnot() throws Exception { AlignFrame ref = new FileLoader(false) diff --git a/test/jalview/structure/StructureSelectionManagerTest.java b/test/jalview/structure/StructureSelectionManagerTest.java index 589adde..e3612a5 100644 --- a/test/jalview/structure/StructureSelectionManagerTest.java +++ b/test/jalview/structure/StructureSelectionManagerTest.java @@ -15,13 +15,13 @@ public class StructureSelectionManagerTest { private StructureSelectionManager ssm; - @BeforeMethod + @BeforeMethod(alwaysRun = true) public void setUp() { ssm = new StructureSelectionManager(); } - @Test + @Test(groups ={ "Functional" }) public void testAddMapping() { AlignedCodonFrame acf1 = new AlignedCodonFrame(); @@ -59,7 +59,7 @@ public class StructureSelectionManagerTest assertEquals(1, ssm.seqMappingRefCounts.get(acf2).intValue()); } - @Test + @Test(groups ={ "Functional" }) public void testAddMappings() { AlignedCodonFrame acf1 = new AlignedCodonFrame(); @@ -89,7 +89,7 @@ public class StructureSelectionManagerTest assertEquals(1, ssm.seqMappingRefCounts.get(acf3).intValue()); } - @Test + @Test(groups ={ "Functional" }) public void testRemoveMapping() { AlignedCodonFrame acf1 = new AlignedCodonFrame(); @@ -127,7 +127,7 @@ public class StructureSelectionManagerTest assertEquals(0, ssm.seqMappingRefCounts.size()); } - @Test + @Test(groups ={ "Functional" }) public void testRemoveMappings() { AlignedCodonFrame acf1 = new AlignedCodonFrame(); diff --git a/test/jalview/structures/models/AAStructureBindingModelTest.java b/test/jalview/structures/models/AAStructureBindingModelTest.java index 7871e77..3354e38 100644 --- a/test/jalview/structures/models/AAStructureBindingModelTest.java +++ b/test/jalview/structures/models/AAStructureBindingModelTest.java @@ -57,7 +57,7 @@ public class AAStructureBindingModelTest /** * Set up test conditions with three aligned sequences, */ - @BeforeMethod + @BeforeMethod(alwaysRun = true) public void setUp() { SequenceI seq1 = new Sequence("1YCS", "-VPSQK"); @@ -119,7 +119,7 @@ public class AAStructureBindingModelTest * Verify that the method determines that columns 2, 5 and 6 of the aligment * are alignable in structure */ - @Test + @Test(groups ={ "Functional" }) public void testFindSuperposableResidues() { SuperposeData[] structs = new SuperposeData[al.getHeight()]; @@ -150,7 +150,7 @@ public class AAStructureBindingModelTest assertTrue(matched[5]); } - @Test + @Test(groups ={ "Functional" }) public void testFindSuperposableResidues_hiddenColumn() { SuperposeData[] structs = new SuperposeData[al.getHeight()]; diff --git a/test/jalview/util/ColorUtilsTest.java b/test/jalview/util/ColorUtilsTest.java index ad6e6d0..6d8dded 100644 --- a/test/jalview/util/ColorUtilsTest.java +++ b/test/jalview/util/ColorUtilsTest.java @@ -16,7 +16,7 @@ public class ColorUtilsTest Color darkColour = new Color(11, 30, 50); // dark blue - @Test + @Test(groups ={ "Functional" }) public void testDarkerThan() { assertEquals("Wrong darker shade", new Color(32, 69, 37), @@ -28,7 +28,7 @@ public class ColorUtilsTest assertNull(ColorUtils.darkerThan(null)); } - @Test + @Test(groups ={ "Functional" }) public void testBrighterThan() { assertEquals("Wrong brighter shade", new Color(255, 255, 255), // white @@ -43,7 +43,7 @@ public class ColorUtilsTest /** * @see http://www.rtapo.com/notes/named_colors.html */ - @Test + @Test(groups ={ "Functional" }) public void testToTkCode() { assertEquals("#fffafa", ColorUtils.toTkCode(new Color(255, 250, 250))); // snow diff --git a/test/jalview/util/ComparisonTest.java b/test/jalview/util/ComparisonTest.java index 837cbe6..d8efa69 100644 --- a/test/jalview/util/ComparisonTest.java +++ b/test/jalview/util/ComparisonTest.java @@ -12,7 +12,7 @@ import org.testng.annotations.Test; public class ComparisonTest { - @Test + @Test(groups ={ "Functional" }) public void testIsGap() { assertTrue(Comparison.isGap('-')); @@ -28,7 +28,7 @@ public class ComparisonTest * Test for isNucleotide is that sequences in a dataset are more than 85% * AGCTU. Test is not case-sensitive and ignores gaps. */ - @Test + @Test(groups ={ "Functional" }) public void testIsNucleotide() { SequenceI seq = new Sequence("eightypercent", "agctuAGCPV"); assertFalse(Comparison.isNucleotide(new SequenceI[] @@ -94,7 +94,7 @@ public class ComparisonTest /** * Test percentage identity calculation for two sequences. */ - @Test + @Test(groups ={ "Functional" }) public void testPID_matchGaps() { String seq1 = "ABCDEF"; diff --git a/test/jalview/util/DBRefUtilsTest.java b/test/jalview/util/DBRefUtilsTest.java index 036ad91..b06132b 100644 --- a/test/jalview/util/DBRefUtilsTest.java +++ b/test/jalview/util/DBRefUtilsTest.java @@ -22,7 +22,7 @@ public class DBRefUtilsTest * Test the method that selects DBRefEntry items whose source is in a supplied * list */ - @Test + @Test(groups ={ "Functional" }) public void testSelectRefs() { assertNull(DBRefUtils.selectRefs(null, null)); @@ -66,7 +66,7 @@ public class DBRefUtilsTest * Test the method that converts (currently three) database names to a * canonical name (not case-sensitive) */ - @Test + @Test(groups ={ "Functional" }) public void testGetCanonicalName() { assertNull(DBRefUtils.getCanonicalName(null)); @@ -83,7 +83,7 @@ public class DBRefUtilsTest DBRefUtils.getCanonicalName("UNIPROTKB/SWISS-CHEESE")); } - @Test + @Test(groups ={ "Functional" }) public void testIsDasCoordinateSystem() { assertFalse(DBRefUtils.isDasCoordinateSystem(null, null)); @@ -118,7 +118,7 @@ public class DBRefUtilsTest /** * Test 'parsing' a DBRef - non PDB case */ - @Test + @Test(groups ={ "Functional" }) public void testParseToDbRef() { SequenceI seq = new Sequence("Seq1", "ABCD"); @@ -135,7 +135,7 @@ public class DBRefUtilsTest /** * Test 'parsing' a DBRef - Stockholm PDB format */ - @Test + @Test(groups ={ "Functional" }) public void testParseToDbRef_PDB() { SequenceI seq = new Sequence("Seq1", "ABCD"); @@ -160,7 +160,7 @@ public class DBRefUtilsTest * Test the method that searches for matches references - case when we are * matching a reference with no mappings */ - @Test + @Test(groups ={ "Functional" }) public void testSearchRefs_noMapping() { DBRefEntry target = new DBRefEntry("EMBL", "2", "A1234"); @@ -189,7 +189,7 @@ public class DBRefUtilsTest * Test the method that searches for matches references - case when we are * matching a reference with a mapping */ - @Test + @Test(groups ={ "Functional" }) public void testSearchRefs_withMapping() { DBRefEntry target = new DBRefEntry("EMBL", "2", "A1234"); diff --git a/test/jalview/util/MapListTest.java b/test/jalview/util/MapListTest.java index 5579efb..6e7e19e 100644 --- a/test/jalview/util/MapListTest.java +++ b/test/jalview/util/MapListTest.java @@ -14,7 +14,7 @@ import org.testng.annotations.Test; public class MapListTest { - @Test + @Test(groups ={ "Functional" }) public void testSomething() { MapList ml = new MapList(new int[] @@ -219,7 +219,7 @@ public class MapListTest * Tests for method that locates ranges in the 'from' map for given range in * the 'to' map. */ - @Test + @Test(groups ={ "Functional" }) public void testLocateInFrom_noIntrons() { /* @@ -251,7 +251,7 @@ public class MapListTest * Tests for method that locates ranges in the 'from' map for given range in * the 'to' map. */ - @Test + @Test(groups ={ "Functional" }) public void testLocateInFrom_withIntrons() { /* @@ -274,7 +274,7 @@ public class MapListTest * Tests for method that locates ranges in the 'to' map for given range in the * 'from' map. */ - @Test + @Test(groups ={ "Functional" }) public void testLocateInTo_noIntrons() { /* @@ -314,7 +314,7 @@ public class MapListTest * Tests for method that locates ranges in the 'to' map for given range in the * 'from' map. */ - @Test + @Test(groups ={ "Functional" }) public void testLocateInTo_withIntrons() { /* @@ -357,7 +357,7 @@ public class MapListTest /** * Test equals method. */ - @Test + @Test(groups ={ "Functional" }) public void testEquals() { int[] codons = new int[] @@ -406,7 +406,7 @@ public class MapListTest /** * Test for the method that flattens a list of ranges into a single array. */ - @Test + @Test(groups ={ "Functional" }) public void testGetRanges() { List ranges = new ArrayList(); @@ -420,7 +420,7 @@ public class MapListTest /** * Check state after construction */ - @Test + @Test(groups ={ "Functional" }) public void testConstructor() { int[] codons = @@ -478,7 +478,7 @@ public class MapListTest /** * Test the method that creates an inverse mapping */ - @Test + @Test(groups ={ "Functional" }) public void testGetInverse() { int[] codons = @@ -498,7 +498,7 @@ public class MapListTest prettyPrint(ml2.getFromRanges())); } - @Test + @Test(groups ={ "Functional" }) public void testToString() { MapList ml = new MapList(new int[] diff --git a/test/jalview/util/MappingUtilsTest.java b/test/jalview/util/MappingUtilsTest.java index 9985fb3..2c0045b 100644 --- a/test/jalview/util/MappingUtilsTest.java +++ b/test/jalview/util/MappingUtilsTest.java @@ -36,7 +36,7 @@ public class MappingUtilsTest /** * Simple test of mapping with no intron involved. */ - @Test + @Test(groups ={ "Functional" }) public void testBuildSearchResults() { final Sequence seq1 = new Sequence("Seq1", "C-G-TA-GC"); @@ -89,7 +89,7 @@ public class MappingUtilsTest /** * Simple test of mapping with introns involved. */ - @Test + @Test(groups ={ "Functional" }) public void testBuildSearchResults_withIntron() { final Sequence seq1 = new Sequence("Seq1", "C-G-TAGA-GCAGCTT"); @@ -166,7 +166,7 @@ public class MappingUtilsTest * * @throws IOException */ - @Test + @Test(groups ={ "Functional" }) public void testMapSequenceGroup_sequences() throws IOException { /* @@ -259,7 +259,7 @@ public class MappingUtilsTest * * @throws IOException */ - @Test + @Test(groups ={ "Functional" }) public void testMapColumnSelection_proteinToDna() throws IOException { setupMappedAlignments(); @@ -357,7 +357,7 @@ public class MappingUtilsTest * * @throws IOException */ - @Test + @Test(groups ={ "Functional" }) public void testMapColumnSelection_dnaToProtein() throws IOException { setupMappedAlignments(); @@ -384,7 +384,7 @@ public class MappingUtilsTest assertEquals("[0, 1, 3]", cs.getSelected().toString()); } - @Test + @Test(groups ={ "Functional" }) public void testMapColumnSelection_null() throws IOException { setupMappedAlignments(); @@ -397,7 +397,7 @@ public class MappingUtilsTest * Tests for the method that converts a series of [start, end] ranges to * single positions */ - @Test + @Test(groups ={ "Functional" }) public void testFlattenRanges() { assertEquals("[1, 2, 3, 4]", @@ -423,7 +423,7 @@ public class MappingUtilsTest * * @throws IOException */ - @Test + @Test(groups ={ "Functional" }) public void testMapSequenceGroup_columns() throws IOException { /* @@ -506,7 +506,7 @@ public class MappingUtilsTest * * @throws IOException */ - @Test + @Test(groups ={ "Functional" }) public void testMapSequenceGroup_region() throws IOException { /* @@ -600,7 +600,7 @@ public class MappingUtilsTest assertEquals(4, mappedGroup.getEndRes()); } - @Test + @Test(groups ={ "Functional" }) public void testFindMappingsForSequence() { SequenceI seq1 = new Sequence("Seq1", "ABC"); diff --git a/test/jalview/util/QuickSortTest.java b/test/jalview/util/QuickSortTest.java index 7d10758..ea55779 100644 --- a/test/jalview/util/QuickSortTest.java +++ b/test/jalview/util/QuickSortTest.java @@ -23,14 +23,14 @@ public class QuickSortTest private final Object[] sortedThings = new Object[] { c4, c2, c1, c3 }; - @BeforeMethod + @BeforeMethod(alwaysRun = true) public void setUp() { things = new Object[] { c1, c2, c3, c4 }; } - @Test + @Test(groups ={ "Functional" }) public void testSort_byIntValues() { int[] values = new int[] @@ -41,7 +41,7 @@ public class QuickSortTest assertTrue(Arrays.equals(sortedThings, things)); } - @Test + @Test(groups ={ "Functional" }) public void testSort_byFloatValues() { float[] values = new float[] @@ -52,7 +52,7 @@ public class QuickSortTest assertTrue(Arrays.equals(sortedThings, things)); } - @Test + @Test(groups ={ "Functional" }) public void testSort_byDoubleValues() { double[] values = new double[] @@ -66,7 +66,7 @@ public class QuickSortTest /** * Sort by String is descending order, case-sensitive */ - @Test + @Test(groups ={ "Functional" }) public void testSort_byStringValues() { String[] values = new String[] @@ -81,7 +81,8 @@ public class QuickSortTest /** * Test whether sort is stable i.e. equal values retain their mutual ordering. */ - @Test(enabled = false) + @Test(groups = + { "Functional" }, enabled = false) public void testSort_withDuplicates() { int[] values = new int[] @@ -99,7 +100,7 @@ public class QuickSortTest * Test that exercises sort with a mostly zero-valued sortby array. May be of * interest to check the sort algorithm is efficient. */ - @Test + @Test(groups ={ "Functional" }) public void testSort_MostlyZeroValues() { char[] residues = new char[64]; diff --git a/test/jalview/util/ShiftListTest.java b/test/jalview/util/ShiftListTest.java index ea9b2e4..eae2811 100644 --- a/test/jalview/util/ShiftListTest.java +++ b/test/jalview/util/ShiftListTest.java @@ -11,7 +11,7 @@ import org.testng.annotations.Test; public class ShiftListTest { - @Test + @Test(groups ={ "Functional" }) public void testParseMap() { assertNull(ShiftList.parseMap(null)); diff --git a/test/jalview/util/StringUtilsTest.java b/test/jalview/util/StringUtilsTest.java index 7442530..e8de3bd 100644 --- a/test/jalview/util/StringUtilsTest.java +++ b/test/jalview/util/StringUtilsTest.java @@ -11,7 +11,7 @@ import org.testng.annotations.Test; public class StringUtilsTest { - @Test + @Test(groups ={ "Functional" }) public void testInsertCharAt() { char[] c1 = "ABC".toCharArray(); @@ -31,7 +31,7 @@ public class StringUtilsTest StringUtils.insertCharAt(c1, 7, 2, 'w'))); } - @Test + @Test(groups ={ "Functional" }) public void testDeleteChars() { char[] c1 = "ABC".toCharArray(); @@ -56,7 +56,7 @@ public class StringUtilsTest assertTrue(Arrays.equals(c1, StringUtils.deleteChars(c1, 3, 4))); } - @Test + @Test(groups ={ "Functional" }) public void testGetLastToken() { assertNull(StringUtils.getLastToken(null, null)); @@ -69,7 +69,7 @@ public class StringUtilsTest "file://localhost:8080/data/examples/file1.dat", "/")); } - @Test + @Test(groups ={ "Functional" }) public void testSeparatorListToArray() { String[] result = StringUtils.separatorListToArray( @@ -90,7 +90,7 @@ public class StringUtilsTest .separatorListToArray("abc='|'d|ef|g", "|"))); } - @Test + @Test(groups ={ "Functional" }) public void testArrayToSeparatorList() { assertEquals("*", StringUtils.arrayToSeparatorList(null, "*")); diff --git a/test/jalview/viewmodel/styles/ViewStyleTest.java b/test/jalview/viewmodel/styles/ViewStyleTest.java index 64b15a6..9e259a9 100644 --- a/test/jalview/viewmodel/styles/ViewStyleTest.java +++ b/test/jalview/viewmodel/styles/ViewStyleTest.java @@ -30,7 +30,7 @@ public class ViewStyleTest * @throws IllegalAccessException * @throws IllegalArgumentException */ - @Test + @Test(groups ={ "Functional" }) public void testCopyConstructor() throws IllegalArgumentException, IllegalAccessException { @@ -165,7 +165,7 @@ public class ViewStyleTest * @throws IllegalAccessException * @throws IllegalArgumentException */ - @Test + @Test(groups ={ "Functional" }) public void testEquals() throws IllegalArgumentException, IllegalAccessException { diff --git a/test/jalview/ws/PDBSequenceFetcherTest.java b/test/jalview/ws/PDBSequenceFetcherTest.java index ef03fd0..2963ef2 100644 --- a/test/jalview/ws/PDBSequenceFetcherTest.java +++ b/test/jalview/ws/PDBSequenceFetcherTest.java @@ -37,7 +37,7 @@ public class PDBSequenceFetcherTest SequenceFetcher sf; - @BeforeMethod + @BeforeMethod(alwaysRun = true) public void setUp() throws Exception { // ensure 'add annotation from structure' is selected @@ -49,7 +49,8 @@ public class PDBSequenceFetcherTest sf = new SequenceFetcher(false); } - @Test(enabled = false) + @Test(groups = + { "Network" }, enabled = true) public void testRnaSeqRetrieve() throws Exception { List sps = sf.getSourceProxy("PDB"); diff --git a/test/jalview/ws/dbsources/PDBRestClientTest.java b/test/jalview/ws/dbsources/PDBRestClientTest.java index 3b3ef86..9ae5b26 100644 --- a/test/jalview/ws/dbsources/PDBRestClientTest.java +++ b/test/jalview/ws/dbsources/PDBRestClientTest.java @@ -34,7 +34,7 @@ import com.sun.jersey.api.client.config.DefaultClientConfig; public class PDBRestClientTest { - @BeforeMethod + @BeforeMethod(alwaysRun = true) public void setUp() throws Exception { } @@ -44,7 +44,8 @@ public class PDBRestClientTest { } - @Test + @Test(groups = + { "External", "Network" }) public void executeRequestTest() { List wantedFields = new ArrayList(); @@ -76,7 +77,7 @@ public class PDBRestClientTest assertTrue(response.getSearchSummary().size() > 99); } - @Test + @Test(groups ={ "Functional" }) public void getPDBDocFieldsAsCommaDelimitedStringTest() { List wantedFields = new ArrayList(); @@ -93,7 +94,8 @@ public class PDBRestClientTest assertEquals("", expectedResult, actualResult); } - @Test + @Test(groups = + { "External, Network" }) public void parsePDBJsonExceptionStringTest() { List wantedFields = new ArrayList(); @@ -131,7 +133,8 @@ public class PDBRestClientTest assertEquals(expectedErrorMsg, parsedErrorResponse); } - @Test(expectedExceptions = Exception.class) + @Test(groups = + { "External", "Network" }, expectedExceptions = Exception.class) public void testForExpectedRuntimeException() throws Exception { List wantedFields = new ArrayList(); @@ -144,7 +147,8 @@ public class PDBRestClientTest new PDBRestClient().executeRequest(request); } - @Test + @Test(groups = + { "External" }) public void parsePDBJsonResponseTest() { List wantedFields = new ArrayList(); @@ -173,7 +177,7 @@ public class PDBRestClientTest assertTrue(response.getSearchSummary().size() == 14); } - @Test + @Test(groups ={ "Functional" }) public void getPDBIdColumIndexTest() { List wantedFields = new ArrayList(); @@ -186,7 +190,8 @@ public class PDBRestClientTest assertEquals(4, PDBRestClient.getPDBIdColumIndex(wantedFields, false)); } - @Test + @Test(groups = + { "External" }) public void externalServiceIntegrationTest() { ClientConfig clientConfig = new DefaultClientConfig(); diff --git a/test/jalview/ws/dbsources/UniprotTest.java b/test/jalview/ws/dbsources/UniprotTest.java index 9fba1cb..c89324b 100644 --- a/test/jalview/ws/dbsources/UniprotTest.java +++ b/test/jalview/ws/dbsources/UniprotTest.java @@ -35,7 +35,7 @@ public class UniprotTest /** * Test the method that unmarshals XML to a Uniprot model */ - @Test + @Test(groups ={ "Functional" }) public void testGetUniprotEntries() { Uniprot u = new Uniprot(); @@ -108,7 +108,7 @@ public class UniprotTest /** * Test the method that formats the sequence name in Fasta style */ - @Test + @Test(groups ={ "Functional" }) public void testConstructSequenceFastaHeader() { Uniprot u = new Uniprot(); diff --git a/test/jalview/ws/gui/Jws2ParamView.java b/test/jalview/ws/gui/Jws2ParamView.java index a3ae56d..41ead2f 100644 --- a/test/jalview/ws/gui/Jws2ParamView.java +++ b/test/jalview/ws/gui/Jws2ParamView.java @@ -62,7 +62,7 @@ public class Jws2ParamView public static Jws2Discoverer disc = null; - @BeforeClass + @BeforeClass(alwaysRun = true) public static void setUpBeforeClass() throws Exception { Cache.initLogger(); @@ -74,7 +74,8 @@ public class Jws2ParamView * rather than hang */ - @Test(enabled = false) + @Test(groups = + { "Interactive" }, enabled = true) public void testJws2Gui() { Iterator presetEnum = presetTests.iterator(); diff --git a/test/jalview/ws/jabaws/DisorderAnnotExportImport.java b/test/jalview/ws/jabaws/DisorderAnnotExportImport.java index 470c39b..35110a4 100644 --- a/test/jalview/ws/jabaws/DisorderAnnotExportImport.java +++ b/test/jalview/ws/jabaws/DisorderAnnotExportImport.java @@ -52,7 +52,7 @@ public class DisorderAnnotExportImport public static jalview.gui.AlignFrame af = null; - @BeforeClass + @BeforeClass(alwaysRun = true) public static void setUpBeforeClass() throws Exception { @@ -86,7 +86,7 @@ public class DisorderAnnotExportImport /** * test for patches to JAL-1294 */ - @Test + @Test(groups ={ "Functional" }) public void testDisorderAnnotExport() { disorderClient = new AADisorderClient(iupreds.get(0), af, null, null); diff --git a/test/jalview/ws/jabaws/JalviewJabawsTestUtils.java b/test/jalview/ws/jabaws/JalviewJabawsTestUtils.java index ec901da..08bb405 100644 --- a/test/jalview/ws/jabaws/JalviewJabawsTestUtils.java +++ b/test/jalview/ws/jabaws/JalviewJabawsTestUtils.java @@ -34,7 +34,7 @@ import org.testng.annotations.Test; public class JalviewJabawsTestUtils { - @BeforeClass + @BeforeClass(alwaysRun = true) public static void setUpBeforeClass() throws Exception { } @@ -51,7 +51,8 @@ public class JalviewJabawsTestUtils { "http://localhost:8080/jabaws", "http://www.compbio.dundee.ac.uk/jabaws" }; - @Test(enabled = false) + @Test(groups = + { "Functional" }, enabled = false) public void testAnnotExport() { fail("Not yet implemented"); diff --git a/test/jalview/ws/jabaws/JpredJabaStructExportImport.java b/test/jalview/ws/jabaws/JpredJabaStructExportImport.java index 49a3064..e458876 100644 --- a/test/jalview/ws/jabaws/JpredJabaStructExportImport.java +++ b/test/jalview/ws/jabaws/JpredJabaStructExportImport.java @@ -62,7 +62,7 @@ public class JpredJabaStructExportImport public static jalview.gui.AlignFrame af = null; - @BeforeClass + @BeforeClass(alwaysRun = true) public static void setUpBeforeClass() throws Exception { @@ -71,7 +71,6 @@ public class JpredJabaStructExportImport for (Jws2Instance svc : disc.getServices()) { - if (svc.getServiceTypeURI().toLowerCase().contains("jpred")) { jpredws = svc; @@ -79,18 +78,10 @@ public class JpredJabaStructExportImport } System.out.println("State of jpredws: " + jpredws); - - if (jpredws == null) - { - Assert.fail("jpredws is null"); - } - + Assert.assertNotNull(jpredws, "jpredws is null!"); jalview.io.FileLoader fl = new jalview.io.FileLoader(false); - af = fl.LoadFileWaitTillLoaded(testseqs, jalview.io.FormatAdapter.FILE); - assertNotNull("Couldn't load test data ('" + testseqs + "')", af); - } @AfterClass @@ -103,7 +94,7 @@ public class JpredJabaStructExportImport } } - @Test + @Test(groups ={ "Functional" }) public void testJPredStructOneSeqOnly() { af.selectAllSequenceMenuItem_actionPerformed(null); @@ -155,7 +146,7 @@ public class JpredJabaStructExportImport } - @Test + @Test(groups ={ "Functional" }) public void testJPredStructExport() { @@ -226,7 +217,7 @@ public class JpredJabaStructExportImport + "\nCouldn't complete Annotation file roundtrip input/output/input test."); } - @Test + @Test(groups ={ "Functional" }) public void testJpredwsSettingsRecovery() { Assert.fail("not implemnented"); diff --git a/test/jalview/ws/jabaws/MinJabawsClientTests.java b/test/jalview/ws/jabaws/MinJabawsClientTests.java index 0a50e47..61f8203 100644 --- a/test/jalview/ws/jabaws/MinJabawsClientTests.java +++ b/test/jalview/ws/jabaws/MinJabawsClientTests.java @@ -23,7 +23,8 @@ public class MinJabawsClientTests * @throws Exception */ @SuppressWarnings("rawtypes") - @Test + @Test(groups = + { "Network" }) public void msaTest() throws Exception { String url; RegistryWS registry = Jws2Client diff --git a/test/jalview/ws/jabaws/RNAStructExportImport.java b/test/jalview/ws/jabaws/RNAStructExportImport.java index 5d9773a..87a4ec6 100644 --- a/test/jalview/ws/jabaws/RNAStructExportImport.java +++ b/test/jalview/ws/jabaws/RNAStructExportImport.java @@ -61,7 +61,7 @@ public class RNAStructExportImport public static jalview.gui.AlignFrame af = null; - @BeforeClass + @BeforeClass(alwaysRun = true) public static void setUpBeforeClass() throws Exception { @@ -118,7 +118,7 @@ public class RNAStructExportImport } } - @Test + @Test(groups ={ "Functional" }) public void testRNAAliFoldValidStructure() { @@ -152,7 +152,7 @@ public class RNAStructExportImport } } - @Test + @Test(groups ={ "Functional" }) public void testRNAStructExport() { @@ -223,7 +223,7 @@ public class RNAStructExportImport + "\nCouldn't complete Annotation file roundtrip input/output/input test."); } - @Test + @Test(groups ={ "Functional" }) public void testRnaalifoldSettingsRecovery() { List opts = new ArrayList(); diff --git a/test/jalview/ws/jws2/ParameterUtilsTest.java b/test/jalview/ws/jws2/ParameterUtilsTest.java index 3403446..523ccb3 100644 --- a/test/jalview/ws/jws2/ParameterUtilsTest.java +++ b/test/jalview/ws/jws2/ParameterUtilsTest.java @@ -51,7 +51,7 @@ public class ParameterUtilsTest private static Jws2Discoverer disc = null; - @BeforeClass + @BeforeClass(alwaysRun = true) public static void setUpBeforeClass() throws Exception { serviceTests.add("AAConWS".toLowerCase()); @@ -59,7 +59,7 @@ public class ParameterUtilsTest disc = JalviewJabawsTestUtils.getJabawsDiscoverer(); } - @Test + @Test(groups ={ "Functional" }) public void testWriteParameterSet() throws WrongParameterException { for (Jws2Instance service : disc.getServices()) @@ -119,7 +119,7 @@ public class ParameterUtilsTest || serviceTests.contains(service.serviceType.toLowerCase()); } - @Test + @Test(groups ={ "Functional" }) public void testCopyOption() { for (Jws2Instance service : disc.getServices()) @@ -143,7 +143,7 @@ public class ParameterUtilsTest /** */ - @Test + @Test(groups ={ "Functional" }) public void testCopyParameter() { for (Jws2Instance service : disc.getServices()) diff --git a/test/jalview/ws/rest/RestClientTest.java b/test/jalview/ws/rest/RestClientTest.java index 70071a5..0c96c48 100644 --- a/test/jalview/ws/rest/RestClientTest.java +++ b/test/jalview/ws/rest/RestClientTest.java @@ -13,7 +13,7 @@ public class RestClientTest /** * Refactored 'as is' from main method */ - @Test + @Test(groups ={ "Functional" }) public void testGetRestClient() { /* diff --git a/test/jalview/ws/rest/ShmmrRSBSService.java b/test/jalview/ws/rest/ShmmrRSBSService.java index 99135d9..1f807b3 100644 --- a/test/jalview/ws/rest/ShmmrRSBSService.java +++ b/test/jalview/ws/rest/ShmmrRSBSService.java @@ -36,7 +36,7 @@ import org.testng.annotations.Test; public class ShmmrRSBSService { - @Test + @Test(groups ={ "Functional" }) public void testShmmrService() { @@ -46,7 +46,7 @@ public class ShmmrRSBSService RestClient.makeShmmrRestClient().service)); } - @Test + @Test(groups ={ "Functional" }) public void testShmmrServiceDataprep() throws Exception { RestClient _rc = RestClient.makeShmmrRestClient(); diff --git a/test/jalview/ws/seqfetcher/DasSequenceFetcher.java b/test/jalview/ws/seqfetcher/DasSequenceFetcher.java index c830f23..148cb9e 100644 --- a/test/jalview/ws/seqfetcher/DasSequenceFetcher.java +++ b/test/jalview/ws/seqfetcher/DasSequenceFetcher.java @@ -6,7 +6,7 @@ import org.testng.annotations.Test; public class DasSequenceFetcher { - @Test + @Test(groups ={ "Functional" }) public void testDasRegistryContact() { jalview.bin.Cache.getDasSourceRegistry().refreshSources(); diff --git a/test/jalview/ws/seqfetcher/DbRefFetcherTest.java b/test/jalview/ws/seqfetcher/DbRefFetcherTest.java index d6bd4b0..d9b1d90 100644 --- a/test/jalview/ws/seqfetcher/DbRefFetcherTest.java +++ b/test/jalview/ws/seqfetcher/DbRefFetcherTest.java @@ -48,7 +48,7 @@ public class DbRefFetcherTest /** * @throws java.lang.Exception */ - @BeforeClass + @BeforeClass(alwaysRun = true) public static void setUpBeforeClass() throws Exception { jalview.bin.Cache.initLogger(); @@ -62,7 +62,7 @@ public class DbRefFetcherTest { } - @Test + @Test(groups ={ "Functional" }) public void testStandardProtDbs() { String[] defdb = DBRefSource.PROTEINDBS; @@ -99,7 +99,8 @@ public class DbRefFetcherTest uniprot != null && i < 2); } - @Test + @Test(groups = + { "External" }) public void testEmblUniprotProductRecovery() throws Exception { String retrievalId = "CAA23748"; // "V00488"; @@ -108,7 +109,8 @@ public class DbRefFetcherTest verifyProteinNucleotideXref(retrievalId, embl); } - @Test + @Test(groups = + { "External" }) public void testEmblCDSUniprotProductRecovery() throws Exception { String retrievalId = "AAH29712"; diff --git a/utils/InstallAnywhere/Jalview.iap_xml b/utils/InstallAnywhere/Jalview.iap_xml index 64f42cd..14b372f 100755 --- a/utils/InstallAnywhere/Jalview.iap_xml +++ b/utils/InstallAnywhere/Jalview.iap_xml @@ -1216,7 +1216,7 @@ and any path to a file to save to the file]]>
    - + false @@ -1234,7 +1234,7 @@ and any path to a file to save to the file]]> true - + 4938027 @@ -1840,7 +1840,7 @@ and any path to a file to save to the file]]> - + false @@ -1858,7 +1858,7 @@ and any path to a file to save to the file]]> true - + 663408 diff --git a/utils/JettyExamplesDir.java b/utils/JettyExamplesDir.java new file mode 100644 index 0000000..58f7694 --- /dev/null +++ b/utils/JettyExamplesDir.java @@ -0,0 +1,73 @@ +// +//======================================================================== +//Copyright (c) 1995-2015 Mort Bay Consulting Pty. Ltd. +//------------------------------------------------------------------------ +//All rights reserved. This program and the accompanying materials +//are made available under the terms of the Eclipse Public License v1.0 +//and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +//You may elect to redistribute this code under either of these licenses. +//======================================================================== +// + + +import org.eclipse.jetty.server.Handler; +import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.server.handler.DefaultHandler; +import org.eclipse.jetty.server.handler.HandlerList; +import org.eclipse.jetty.server.handler.ResourceHandler; + +public class JettyExamplesDir +{ + + /** + * Simple Jetty FileServer. This is a simple example of Jetty configured as a + * FileServer. + */ + + public static void main(String[] args) throws Exception + { + // Create a basic Jetty server object that will listen on port 8080. Note + // that if you set this to port 0 + // then a randomly available port will be assigned that you can either look + // in the logs for the port, + // or programmatically obtain it for use in test cases. + Server server = new Server(8080); + + // Create the ResourceHandler. It is the object that will actually handle + // the request for a given file. It is + // a Jetty Handler object so it is suitable for chaining with other handlers + // as you will see in other examples. + ResourceHandler resource_handler = new ResourceHandler(); + // Configure the ResourceHandler. Setting the resource base indicates where + // the files should be served out of. + // In this example it is the current directory but it can be configured to + // anything that the jvm has access to. + resource_handler.setDirectoriesListed(true); + resource_handler.setWelcomeFiles(new String[] + { "applets.html" }); + resource_handler.setResourceBase("."); + + // Add the ResourceHandler to the server. + // GzipHandler gzip = new GzipHandler(); + // server.setHandler(gzip); + HandlerList handlers = new HandlerList(); + handlers.setHandlers(new Handler[] + { resource_handler, new DefaultHandler() }); + server.setHandler(handlers); + + // Start things up! By using the server.join() the server thread will join + // with the current thread. + // See + // "http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Thread.html#join()" + // for more details. + server.start(); + server.join(); +} +} \ No newline at end of file