Merge branch 'develop' into menard
authorjprocter <jprocter@compbio.dundee.ac.uk>
Fri, 17 Aug 2012 12:13:56 +0000 (13:13 +0100)
committerjprocter <jprocter@compbio.dundee.ac.uk>
Fri, 17 Aug 2012 12:13:56 +0000 (13:13 +0100)
Conflicts:
src/jalview/ws/jws2/AAConsClient.java
 (preferred develop)

26 files changed:
FEATURETODO
help/html/calculations/pca.html
schemas/jalview.xsd
src/jalview/analysis/NJTree.java
src/jalview/commands/EditCommand.java
src/jalview/gui/AlignFrame.java
src/jalview/gui/AlignViewport.java
src/jalview/gui/Jalview2XML.java
src/jalview/gui/TreePanel.java
src/jalview/gui/WsJobParameters.java
src/jalview/gui/WsParamSetManager.java
src/jalview/schemabinding/version2/.castor.cdr
src/jalview/schemabinding/version2/CalcIdParam.java [new file with mode: 0644]
src/jalview/schemabinding/version2/Viewport.java
src/jalview/schemabinding/version2/descriptors/CalcIdParamDescriptor.java [new file with mode: 0644]
src/jalview/schemabinding/version2/descriptors/ViewportDescriptor.java
src/jalview/schemes/UserColourScheme.java
src/jalview/ws/jws2/AAConsClient.java
src/jalview/ws/jws2/JabaParamStore.java
src/jalview/ws/jws2/JabawsAlignCalcWorker.java
src/jalview/ws/jws2/Jws2Client.java
src/jalview/ws/jws2/Jws2Discoverer.java
src/jalview/ws/jws2/SequenceAnnotationWSClient.java
src/jalview/ws/jws2/dm/AAConsSettings.java
src/jalview/ws/jws2/jabaws2/Jws2Instance.java
src/jalview/ws/params/AutoCalcSetting.java [new file with mode: 0644]

index 636cb53..83f3bbf 100644 (file)
@@ -1,7 +1,15 @@
-Normalised logo feature todo
+JAL-958 Normalised logo feature todo
 
 * add gui switches in applet for normalised logo display
 * add flags for normalised logo display to AnnotationFile and Jalview Project
 * add preference for application
 * consider rationalising flag model for N types of consensus/logo calculation methods
 
+JAL-976 JABAWS 2 services todo
+* test store/recall of settings for AACons service
+* debug IUPred for case when parameters are tweaked and get a 'sequences must be aligned' error from JABAWS server
+* decide where AACons job stats should be stored (this is a report for the current view, rather than alignment as a whole)
+* make disorder calculation more intelligent
+-* only calculate for sequences where no calculation has already been performed ?
+-* if parameters are changed, old features should be replaced with new ones
+..? calcId for features, too ?
index b042dd8..695c45a 100755 (executable)
@@ -65,20 +65,28 @@ to be saved (<strong>File&#8594;Save</strong> submenu) as an EPS or PNG
 image or printed, and the original alignment data and matrix resulting
 from its PCA analysis to be retrieved. The coordinates for the whole PCA
 space, or just the current view may also be exported as CSV files for
-visualization in another program or further analysis.</p>
+visualization in another program or further analysis.<p>
+<p>Options for coordinates export are:</p>
+<ul>
+<li>Output Values - complete dump of analysis (TxT* matrix computed from sum of scores for all pairs of aligned residues from from i->j and j->i, conditioned matrix to be diagonalised, tridiagonal form, major eigenvalues found)</li>
+<li>Output Points - The eigenvector matrix - rows correspond to sequences, columns correspond to each dimension in the PCA</li>
+<li>Transformed Points - The 3D coordinates for each sequence as shown in the PCA plot</li></ul>
+
 <p>A tool tip gives the sequence ID corresponding to a point in the
 space, and clicking a point toggles the selection of the corresponding
-sequence in the associated alignment window views. Rectangular region
+sequence in the associated alignment window views.<!-- Rectangular region
 based selection is also possible, by holding the 'S' key whilst
-left-clicking and dragging the mouse over the display. By default,
+left-clicking and dragging the mouse over the display. --> By default,
 points are only associated with the alignment view from which the PCA
 was calculated, but this may be changed via the <strong>View&#8594;Associate
 Nodes</strong> sub-menu.</p>
 <p>Initially, the display shows the first three components of the
 similarity space, but any eigenvector can be used by changing the
 selected dimension for the x, y, or z axis through each ones menu
-located below the 3d display.</p>
+located below the 3d display. The <em>Reset</em> button will reset axis and rotation settings to their defaults.</p>
 <p>
 <p>
+<em>The output of points and transformed point coordinates was added to the Jalview desktop in v2.7.</em>
+<em>The Reset button, and Nucleotide or Protein calculation settings were added in Jalview 2.8.</em>
 </body>
 </html>
index cc8b1e9..e1fbb67 100755 (executable)
  * 
  * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
 -->
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:vamsas="www.vamsas.ac.uk/jalview/version2" xmlns:jalview="www.jalview.org/colours" xmlns:jv="www.jalview.org" targetNamespace="www.jalview.org" elementFormDefault="qualified" attributeFormDefault="unqualified">
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:vamsas="www.vamsas.ac.uk/jalview/version2" xmlns:jalview="www.jalview.org/colours" xmlns:jv="www.jalview.org" xmlns:jvws="www.jalview.org/xml/wsparamset" targetNamespace="www.jalview.org" elementFormDefault="qualified" attributeFormDefault="unqualified">
                <xs:import namespace="www.vamsas.ac.uk/jalview/version2" schemaLocation="vamsas.xsd"/>
        <xs:import namespace="www.jalview.org/colours" schemaLocation="JalviewUserColours.xsd"/>
+       <xs:import namespace="www.jalview.org/xml/wsparamset" schemaLocation="JalviewWsParamSet.xsd"/>
        <xs:complexType name="JalviewModel">
                <xs:sequence>
-                       <xs:element name="creationDate" type="xs:dateTime"/>
-                       <xs:element name="version" type="xs:string"/>
-                       <xs:element name="vamsasModel" type="vamsas:VAMSAS"/>
+                       <xs:element name="creationDate" type="xs:dateTime" />
+                       <xs:element name="version" type="xs:string" />
+                       <xs:element name="vamsasModel" type="vamsas:VAMSAS" />
                        <xs:sequence>
                                <xs:element name="JSeq" maxOccurs="unbounded">
                                        <xs:complexType>
                                                <xs:sequence>
-                                                       <xs:element name="features" type="jv:feature" minOccurs="0" maxOccurs="unbounded"/>
-                                                       <xs:element name="pdbids" minOccurs="0" maxOccurs="unbounded">
+                                                       <xs:element name="features"
+                                                               type="jv:feature" minOccurs="0" maxOccurs="unbounded" />
+                                                       <xs:element name="pdbids" minOccurs="0"
+                                                               maxOccurs="unbounded">
                                                                <xs:complexType>
                                                                        <xs:complexContent>
-                                                                               <xs:extension base="jv:pdbentry">
+                                                                               <xs:extension
+                                                                                       base="jv:pdbentry">
                                                                                        <xs:sequence>
-                                                                                               <xs:element name="structureState" minOccurs="0" maxOccurs="unbounded">
+                                                                                               <xs:element
+                                                                                                       name="structureState" minOccurs="0"
+                                                                                                       maxOccurs="unbounded">
                                                                                                        <xs:complexType>
                                                                                                                <xs:simpleContent>
-                                                                                                               <xs:extension base="xs:string">
-                                                                                                               <xs:attributeGroup ref="jv:swingwindow"/>
-                                                                                                                               <xs:attribute name="visible" type="xs:boolean"/>
-                                                                                                                               <xs:attribute name="viewId" type="xs:string" use="optional">
+                                                                                                                       <xs:extension
+                                                                                                                               base="xs:string">
+                                                                                                                               <xs:attributeGroup
+                                                                                                                                       ref="jv:swingwindow" />
+                                                                                                                               <xs:attribute
+                                                                                                                                       name="visible" type="xs:boolean" />
+                                                                                                                               <xs:attribute
+                                                                                                                                       name="viewId" type="xs:string" use="optional">
                                                                                                                                        <xs:annotation>
-                                                                                                                                               <xs:documentation>additional identifier which properly disambiguates
-                                                                                                                                               the structure view from any other view with the same attributes. This is not an ID,
-                                                                                                                                               because it is possible to have many references to the same physical structure view
-                                                                                                                                               from different sequences in an alignment. A structureState element citing the same
-                                                                                                                                               viewId will appear for each instance.</xs:documentation>
+                                                                                                                                               <xs:documentation>
+                                                                                                                                                       additional
+                                                                                                                                                       identifier
+                                                                                                                                                       which
+                                                                                                                                                       properly
+                                                                                                                                                       disambiguates
+                                                                                                                                                       the
+                                                                                                                                                       structure
+                                                                                                                                                       view
+                                                                                                                                                       from
+                                                                                                                                                       any
+                                                                                                                                                       other
+                                                                                                                                                       view
+                                                                                                                                                       with
+                                                                                                                                                       the
+                                                                                                                                                       same
+                                                                                                                                                       attributes.
+                                                                                                                                                       This
+                                                                                                                                                       is
+                                                                                                                                                       not
+                                                                                                                                                       an
+                                                                                                                                                       ID,
+                                                                                                                                                       because
+                                                                                                                                                       it
+                                                                                                                                                       is
+                                                                                                                                                       possible
+                                                                                                                                                       to
+                                                                                                                                                       have
+                                                                                                                                                       many
+                                                                                                                                                       references
+                                                                                                                                                       to
+                                                                                                                                                       the
+                                                                                                                                                       same
+                                                                                                                                                       physical
+                                                                                                                                                       structure
+                                                                                                                                                       view
+                                                                                                                                                       from
+                                                                                                                                                       different
+                                                                                                                                                       sequences
+                                                                                                                                                       in
+                                                                                                                                                       an
+                                                                                                                                                       alignment.
+                                                                                                                                                       A
+                                                                                                                                                       structureState
+                                                                                                                                                       element
+                                                                                                                                                       citing
+                                                                                                                                                       the
+                                                                                                                                                       same
+                                                                                                                                                       viewId
+                                                                                                                                                       will
+                                                                                                                                                       appear
+                                                                                                                                                       for
+                                                                                                                                                       each
+                                                                                                                                                       instance.
+                                                                                                                                               </xs:documentation>
                                                                                                                                        </xs:annotation>
                                                                                                                                </xs:attribute>
-                                                                                                                               <xs:attribute name="alignwithAlignPanel" type="xs:boolean" use="optional" default="true">
-                                                                                                                               <xs:annotation>
-                                                                                                                               <xs:documentation>
-                                                                                                                                       Flag set if the alignment panel containing this JSeq should be included in those used to perform a structure superposition (since Jalview 2.7).
-                                                                                                                               </xs:documentation>
-                                                                                                                               </xs:annotation>
+                                                                                                                               <xs:attribute
+                                                                                                                                       name="alignwithAlignPanel" type="xs:boolean"
+                                                                                                                                       use="optional" default="true">
+                                                                                                                                       <xs:annotation>
+                                                                                                                                               <xs:documentation>
+                                                                                                                                                       Flag
+                                                                                                                                                       set
+                                                                                                                                                       if
+                                                                                                                                                       the
+                                                                                                                                                       alignment
+                                                                                                                                                       panel
+                                                                                                                                                       containing
+                                                                                                                                                       this
+                                                                                                                                                       JSeq
+                                                                                                                                                       should
+                                                                                                                                                       be
+                                                                                                                                                       included
+                                                                                                                                                       in
+                                                                                                                                                       those
+                                                                                                                                                       used
+                                                                                                                                                       to
+                                                                                                                                                       perform
+                                                                                                                                                       a
+                                                                                                                                                       structure
+                                                                                                                                                       superposition
+                                                                                                                                                       (since
+                                                                                                                                                       Jalview
+                                                                                                                                                       2.7).
+                                                                                                                                               </xs:documentation>
+                                                                                                                                       </xs:annotation>
                                                                                                                                </xs:attribute>
-                                                                                                                               <xs:attribute name="colourwithAlignPanel" type="xs:boolean" use="optional" default="false">
-                                                                                                                               <xs:annotation>
-                                                                                                                               <xs:documentation>
-                                                                                                                                       Flag set if the alignment panel containing this JSeq should be included in those used to colour its associated sequences in this structureState(since Jalview 2.7).
-                                                                                                                               </xs:documentation>
-                                                                                                                               </xs:annotation>
+                                                                                                                               <xs:attribute
+                                                                                                                                       name="colourwithAlignPanel" type="xs:boolean"
+                                                                                                                                       use="optional" default="false">
+                                                                                                                                       <xs:annotation>
+                                                                                                                                               <xs:documentation>
+                                                                                                                                                       Flag
+                                                                                                                                                       set
+                                                                                                                                                       if
+                                                                                                                                                       the
+                                                                                                                                                       alignment
+                                                                                                                                                       panel
+                                                                                                                                                       containing
+                                                                                                                                                       this
+                                                                                                                                                       JSeq
+                                                                                                                                                       should
+                                                                                                                                                       be
+                                                                                                                                                       included
+                                                                                                                                                       in
+                                                                                                                                                       those
+                                                                                                                                                       used
+                                                                                                                                                       to
+                                                                                                                                                       colour
+                                                                                                                                                       its
+                                                                                                                                                       associated
+                                                                                                                                                       sequences
+                                                                                                                                                       in
+                                                                                                                                                       this
+                                                                                                                                                       structureState(since
+                                                                                                                                                       Jalview
+                                                                                                                                                       2.7).
+                                                                                                                                               </xs:documentation>
+                                                                                                                                       </xs:annotation>
+                                                                                                                               </xs:attribute>
+                                                                                                                               <xs:attribute
+                                                                                                                                       name="colourByJmol" type="xs:boolean" use="optional"
+                                                                                                                                       default="true">
+                                                                                                                                       <xs:annotation>
+                                                                                                                                               <xs:documentation>
+                                                                                                                                                       Flag
+                                                                                                                                                       set
+                                                                                                                                                       if
+                                                                                                                                                       the
+                                                                                                                                                       structure
+                                                                                                                                                       display
+                                                                                                                                                       is
+                                                                                                                                                       coloured
+                                                                                                                                                       by
+                                                                                                                                                       the
+                                                                                                                                                       Jmol
+                                                                                                                                                       state,
+                                                                                                                                                       rather
+                                                                                                                                                       than
+                                                                                                                                                       by
+                                                                                                                                                       one
+                                                                                                                                                       or
+                                                                                                                                                       more
+                                                                                                                                                       linked
+                                                                                                                                                       alignment
+                                                                                                                                                       views.
+                                                                                                                                               </xs:documentation>
+                                                                                                                                       </xs:annotation>
                                                                                                                                </xs:attribute>
-                                                                                                                               <xs:attribute name="colourByJmol" type="xs:boolean" use="optional" default="true">
-                                                                                                                               <xs:annotation><xs:documentation>
-                                                                                                                                 Flag set if the structure display is coloured by the Jmol state, rather than by one or more linked alignment views.
-                                                                                                                               </xs:documentation></xs:annotation></xs:attribute>      
-                                                                                                                               
+
                                                                                                                        </xs:extension>
-                                                                                                   </xs:simpleContent>
+                                                                                                               </xs:simpleContent>
                                                                                                        </xs:complexType>
                                                                                                </xs:element>
                                                                                        </xs:sequence>
                                                                        </xs:complexContent>
                                                                </xs:complexType>
                                                        </xs:element>
-                                                       <xs:element name="hiddenSequences" type="xs:int" minOccurs="0" maxOccurs="unbounded"/>
+                                                       <xs:element name="hiddenSequences"
+                                                               type="xs:int" minOccurs="0" maxOccurs="unbounded" />
                                                </xs:sequence>
-                                               <xs:attribute name="colour" type="xs:int" use="optional"/>
-                                               <xs:attribute name="start" type="xs:int" use="required"/>
-                                               <xs:attribute name="end" type="xs:int" use="required"/>
-                                               <xs:attribute name="id" type="xs:string" use="required"/>
-                                               <xs:attribute name="hidden" type="xs:boolean"/>
+                                               <xs:attribute name="colour" type="xs:int"
+                                                       use="optional" />
+                                               <xs:attribute name="start" type="xs:int"
+                                                       use="required" />
+                                               <xs:attribute name="end" type="xs:int"
+                                                       use="required" />
+                                               <xs:attribute name="id" type="xs:string"
+                                                       use="required" />
+                                               <xs:attribute name="hidden" type="xs:boolean" />
                                        </xs:complexType>
                                </xs:element>
-                               <xs:element name="JGroup" minOccurs="0" maxOccurs="unbounded">
+                               <xs:element name="JGroup" minOccurs="0"
+                                       maxOccurs="unbounded">
                                        <xs:complexType>
                                                <xs:sequence>
-                                                       <xs:element name="seq" type="xs:string" maxOccurs="unbounded"/>
+                                                       <xs:element name="seq" type="xs:string"
+                                                               maxOccurs="unbounded" />
                                                </xs:sequence>
-                                               <xs:attribute name="start" type="xs:int"/>
-                                               <xs:attribute name="end" type="xs:int"/>
-                                               <xs:attribute name="name" type="xs:string"/>
-                                               <xs:attribute name="colour" type="xs:string"/>
-                                               <xs:attribute name="consThreshold" type="xs:int"/>
-                                               <xs:attribute name="pidThreshold" type="xs:int"/>
-                                               <xs:attribute name="outlineColour" type="xs:int"/>
-                                               <xs:attribute name="displayBoxes" type="xs:boolean"/>
-                                               <xs:attribute name="displayText" type="xs:boolean"/>
-                                               <xs:attribute name="colourText" type="xs:boolean"/>
-                                               <xs:attribute name="textCol1" type="xs:int"/>
-                                               <xs:attribute name="textCol2" type="xs:int"/>
-                                               <xs:attribute name="textColThreshold" type="xs:int"/>
-                                               <xs:attribute name="showUnconserved" type="xs:boolean" use="optional"/>
-                                               <xs:attribute name="ignoreGapsinConsensus" type="xs:boolean" use="optional" default="true"/>
-                                               <xs:attribute name="showConsensusHistogram" type="xs:boolean" use="optional" default="true"/>
-                                               <xs:attribute name="showSequenceLogo" type="xs:boolean" use="optional" default="false"/>
-                                               <xs:attribute name="id" type="xs:string" use="optional"><xs:annotation>
-                                               <xs:documentation>
-                                               Optional sequence group ID (only needs to be unique for this alignment)
-                                               </xs:documentation>
-                                               </xs:annotation></xs:attribute>
+                                               <xs:attribute name="start" type="xs:int" />
+                                               <xs:attribute name="end" type="xs:int" />
+                                               <xs:attribute name="name" type="xs:string" />
+                                               <xs:attribute name="colour" type="xs:string" />
+                                               <xs:attribute name="consThreshold"
+                                                       type="xs:int" />
+                                               <xs:attribute name="pidThreshold" type="xs:int" />
+                                               <xs:attribute name="outlineColour"
+                                                       type="xs:int" />
+                                               <xs:attribute name="displayBoxes"
+                                                       type="xs:boolean" />
+                                               <xs:attribute name="displayText"
+                                                       type="xs:boolean" />
+                                               <xs:attribute name="colourText"
+                                                       type="xs:boolean" />
+                                               <xs:attribute name="textCol1" type="xs:int" />
+                                               <xs:attribute name="textCol2" type="xs:int" />
+                                               <xs:attribute name="textColThreshold"
+                                                       type="xs:int" />
+                                               <xs:attribute name="showUnconserved"
+                                                       type="xs:boolean" use="optional" />
+                                               <xs:attribute name="ignoreGapsinConsensus"
+                                                       type="xs:boolean" use="optional" default="true" />
+                                               <xs:attribute name="showConsensusHistogram"
+                                                       type="xs:boolean" use="optional" default="true" />
+                                               <xs:attribute name="showSequenceLogo"
+                                                       type="xs:boolean" use="optional" default="false" />
+                                               <xs:attribute name="id" type="xs:string"
+                                                       use="optional">
+                                                       <xs:annotation>
+                                                               <xs:documentation>
+                                                                       Optional sequence group ID (only
+                                                                       needs to be unique for this
+                                                                       alignment)
+                                                               </xs:documentation>
+                                                       </xs:annotation>
+                                               </xs:attribute>
                                        </xs:complexType>
                                </xs:element>
                                <xs:element name="Viewport" maxOccurs="unbounded">
                                        <xs:complexType>
                                                <xs:sequence>
-                                                       <xs:element name="AnnotationColours" minOccurs="0">
+                                                       <xs:element name="AnnotationColours"
+                                                               minOccurs="0">
                                                                <xs:complexType>
-                                                                       <xs:attribute name="aboveThreshold" type="xs:int"/>
-                                                                       <xs:attribute name="annotation" type="xs:string"/>
-                                                                       <xs:attribute name="minColour" type="xs:int"/>
-                                                                       <xs:attribute name="maxColour" type="xs:int"/>
-                                                                       <xs:attribute name="colourScheme" type="xs:string"/>
-                                                                       <xs:attribute name="threshold" type="xs:float"/>
+                                                                       <xs:attribute name="aboveThreshold"
+                                                                               type="xs:int" />
+                                                                       <xs:attribute name="annotation"
+                                                                               type="xs:string" />
+                                                                       <xs:attribute name="minColour"
+                                                                               type="xs:int" />
+                                                                       <xs:attribute name="maxColour"
+                                                                               type="xs:int" />
+                                                                       <xs:attribute name="colourScheme"
+                                                                               type="xs:string" />
+                                                                       <xs:attribute name="threshold"
+                                                                               type="xs:float" />
                                                                </xs:complexType>
                                                        </xs:element>
-                                                       <xs:element name="hiddenColumns" minOccurs="0" maxOccurs="unbounded">
+                                                       <xs:element name="hiddenColumns"
+                                                               minOccurs="0" maxOccurs="unbounded">
                                                                <xs:complexType>
-                                                                       <xs:attribute name="start" type="xs:int"/>
-                                                                       <xs:attribute name="end" type="xs:int"/>
+                                                                       <xs:attribute name="start"
+                                                                               type="xs:int" />
+                                                                       <xs:attribute name="end"
+                                                                               type="xs:int" />
                                                                </xs:complexType>
                                                        </xs:element>
+                                                       <xs:element name="calcIdParam" 
+                                                        
+                                                       minOccurs="0" maxOccurs="unbounded">
+                                                       <xs:complexType>
+                                                       <xs:complexContent>
+                                                       <xs:extension base="jvws:WebServiceParameterSet">
+                                                       <xs:attribute name="calcId" type="xs:string" use="required">
+                                                       <xs:annotation>
+                                                       <xs:documentation>handle for the calculation which uses this parameter set</xs:documentation></xs:annotation>
+                                                       </xs:attribute>
+                                                       <xs:attribute name="needsUpdate" type="xs:boolean" use="optional" default="false">
+                                                       <xs:annotation><xs:documentation>should the calculation be performed immediately after loading in order to refresh results</xs:documentation></xs:annotation>
+                                                       </xs:attribute>
+                                                       <xs:attribute name="autoUpdate" type="xs:boolean" use="required">
+                                                       <xs:annotation><xs:documentation>should the calculation be automatically performed on edits</xs:documentation></xs:annotation>
+                                                       </xs:attribute>
+                                                       </xs:extension>
+                                                       </xs:complexContent>
+                                                       </xs:complexType>
+                                                       </xs:element>
                                                </xs:sequence>
-                                               <xs:attributeGroup ref="jv:swingwindow"/>
-                                               <xs:attribute name="conservationSelected" type="xs:boolean"/>
-                                               <xs:attribute name="pidSelected" type="xs:boolean"/>
-                                               <xs:attribute name="bgColour" type="xs:string"/>
-                                               <xs:attribute name="consThreshold" type="xs:int"/>
-                                               <xs:attribute name="pidThreshold" type="xs:int"/>
-                                               <xs:attribute name="title" type="xs:string"/>
-                                               <xs:attribute name="showFullId" type="xs:boolean"/>
-                                               <xs:attribute name="rightAlignIds" type="xs:boolean"/>
-                                               <xs:attribute name="showText" type="xs:boolean"/>
-                                               <xs:attribute name="showColourText" type="xs:boolean"/>
-                                               <xs:attribute name="showUnconserved" type="xs:boolean" use="optional" default="false"/>
-                                               <xs:attribute name="showBoxes" type="xs:boolean"/>
-                                               <xs:attribute name="wrapAlignment" type="xs:boolean"/>
-                                               <xs:attribute name="renderGaps" type="xs:boolean"/>
-                                               <xs:attribute name="showSequenceFeatures" type="xs:boolean"/>
-                                               <xs:attribute name="showNPfeatureTooltip" type="xs:boolean" use="optional"/>
-                                               <xs:attribute name="showDbRefTooltip" type="xs:boolean" use="optional"/>
-                                               <xs:attribute name="followHighlight" type="xs:boolean" use="optional" default="true"/>
-                                               <xs:attribute name="followSelection" type="xs:boolean" use="optional" default="true"/>
-                                               <xs:attribute name="showAnnotation" type="xs:boolean"/>
-                                               <xs:attribute name="centreColumnLabels" type="xs:boolean" use="optional" default="false"/>
-                                               <xs:attribute name="showGroupConservation" type="xs:boolean" use="optional" default="false"/>
-                                               <xs:attribute name="showGroupConsensus" type="xs:boolean" use="optional" default="false"/>
-                                               <xs:attribute name="showConsensusHistogram" type="xs:boolean" use="optional" default="true"/>
-                                               <xs:attribute name="showSequenceLogo" type="xs:boolean" use="optional" default="false"/>
-                                               <xs:attribute name="ignoreGapsinConsensus" type="xs:boolean" use="optional" default="true"/>
-                                               
-                                               <xs:attribute name="startRes" type="xs:int"/>
-                                               <xs:attribute name="startSeq" type="xs:int"/>
-                                               <xs:attribute name="fontName" type="xs:string"/>
-                                               <xs:attribute name="fontSize" type="xs:int"/>
-                                               <xs:attribute name="fontStyle" type="xs:int"/>
-                                               <xs:attribute name="viewName" type="xs:string"/>
-                                               <xs:attribute name="sequenceSetId" type="xs:string"/>
-                                               <xs:attribute name="gatheredViews" type="xs:boolean"/>
-                                               <xs:attribute name="textCol1" type="xs:int"/>
-                                               <xs:attribute name="textCol2" type="xs:int"/>
-                                               <xs:attribute name="textColThreshold" type="xs:int"/>
-                                               <xs:attribute name="id" type="xs:ID" use="optional">
+                                               <xs:attributeGroup ref="jv:swingwindow" />
+                                               <xs:attribute name="conservationSelected"
+                                                       type="xs:boolean" />
+                                               <xs:attribute name="pidSelected"
+                                                       type="xs:boolean" />
+                                               <xs:attribute name="bgColour" type="xs:string" />
+                                               <xs:attribute name="consThreshold"
+                                                       type="xs:int" />
+                                               <xs:attribute name="pidThreshold" type="xs:int" />
+                                               <xs:attribute name="title" type="xs:string" />
+                                               <xs:attribute name="showFullId"
+                                                       type="xs:boolean" />
+                                               <xs:attribute name="rightAlignIds"
+                                                       type="xs:boolean" />
+                                               <xs:attribute name="showText" type="xs:boolean" />
+                                               <xs:attribute name="showColourText"
+                                                       type="xs:boolean" />
+                                               <xs:attribute name="showUnconserved"
+                                                       type="xs:boolean" use="optional" default="false" />
+                                               <xs:attribute name="showBoxes"
+                                                       type="xs:boolean" />
+                                               <xs:attribute name="wrapAlignment"
+                                                       type="xs:boolean" />
+                                               <xs:attribute name="renderGaps"
+                                                       type="xs:boolean" />
+                                               <xs:attribute name="showSequenceFeatures"
+                                                       type="xs:boolean" />
+                                               <xs:attribute name="showNPfeatureTooltip"
+                                                       type="xs:boolean" use="optional" />
+                                               <xs:attribute name="showDbRefTooltip"
+                                                       type="xs:boolean" use="optional" />
+                                               <xs:attribute name="followHighlight"
+                                                       type="xs:boolean" use="optional" default="true" />
+                                               <xs:attribute name="followSelection"
+                                                       type="xs:boolean" use="optional" default="true" />
+                                               <xs:attribute name="showAnnotation"
+                                                       type="xs:boolean" />
+                                               <xs:attribute name="centreColumnLabels"
+                                                       type="xs:boolean" use="optional" default="false" />
+                                               <xs:attribute name="showGroupConservation"
+                                                       type="xs:boolean" use="optional" default="false" />
+                                               <xs:attribute name="showGroupConsensus"
+                                                       type="xs:boolean" use="optional" default="false" />
+                                               <xs:attribute name="showConsensusHistogram"
+                                                       type="xs:boolean" use="optional" default="true" />
+                                               <xs:attribute name="showSequenceLogo"
+                                                       type="xs:boolean" use="optional" default="false" />
+                                               <xs:attribute name="ignoreGapsinConsensus"
+                                                       type="xs:boolean" use="optional" default="true" />
+
+                                               <xs:attribute name="startRes" type="xs:int" />
+                                               <xs:attribute name="startSeq" type="xs:int" />
+                                               <xs:attribute name="fontName" type="xs:string" />
+                                               <xs:attribute name="fontSize" type="xs:int" />
+                                               <xs:attribute name="fontStyle" type="xs:int" />
+                                               <xs:attribute name="viewName" type="xs:string" />
+                                               <xs:attribute name="sequenceSetId"
+                                                       type="xs:string" />
+                                               <xs:attribute name="gatheredViews"
+                                                       type="xs:boolean" />
+                                               <xs:attribute name="textCol1" type="xs:int" />
+                                               <xs:attribute name="textCol2" type="xs:int" />
+                                               <xs:attribute name="textColThreshold"
+                                                       type="xs:int" />
+                                               <xs:attribute name="id" type="xs:ID"
+                                                       use="optional">
                                                        <xs:annotation>
                                                                <xs:documentation>
-                                                                       unique id used by jalview to synchronize between stored and instantiated views
+                                                                       unique id used by jalview to
+                                                                       synchronize between stored and
+                                                                       instantiated views
                                                                </xs:documentation>
                                                        </xs:annotation>
                                                </xs:attribute>
-          </xs:complexType>
+                                       </xs:complexType>
                                </xs:element>
-                               <xs:element name="UserColours" minOccurs="0" maxOccurs="unbounded">
+                               <xs:element name="UserColours" minOccurs="0"
+                                       maxOccurs="unbounded">
                                        <xs:complexType>
                                                <xs:sequence>
-                                                       <xs:element name="UserColourScheme" type="jalview:JalviewUserColours"/>
+                                                       <xs:element name="UserColourScheme"
+                                                               type="jalview:JalviewUserColours" />
                                                </xs:sequence>
-                                               <xs:attribute name="id" type="xs:string"/>
+                                               <xs:attribute name="id" type="xs:string" />
                                        </xs:complexType>
                                </xs:element>
-                               <xs:element name="tree" minOccurs="0" maxOccurs="unbounded">
+                               <xs:element name="tree" minOccurs="0"
+                                       maxOccurs="unbounded">
                                        <xs:complexType>
-                                        <xs:sequence minOccurs="0">
-              <xs:element name="title" type="xs:string"/>
-              <xs:element name="newick" type="xs:string"/>
-            </xs:sequence>
-            <xs:attribute name="fontName" type="xs:string"/>
-            <xs:attribute name="fontSize" type="xs:int"/>
-            <xs:attribute name="fontStyle" type="xs:int"/>
-            <xs:attribute name="threshold" type="xs:float"/>
-            <xs:attribute name="showBootstrap" type="xs:boolean"/>
-            <xs:attribute name="showDistances" type="xs:boolean"/>
-            <xs:attribute name="markUnlinked" type="xs:boolean"/>
-            <xs:attribute name="fitToWindow" type="xs:boolean"/>
-            <xs:attribute name="currentTree" type="xs:boolean"/>
-            <xs:attribute name="id" type="xs:ID" use="optional">
-              <xs:annotation><xs:documentation>Tree ID added for binding tree visualization settings to vamsas document trees in jalview 2.4.1</xs:documentation></xs:annotation>
-            </xs:attribute>
-          <xs:attributeGroup ref="jv:swingwindow"/>
-          </xs:complexType>
+                                               <xs:sequence minOccurs="0">
+                                                       <xs:element name="title" type="xs:string" />
+                                                       <xs:element name="newick" type="xs:string" />
+                                               </xs:sequence>
+                                               <xs:attribute name="fontName" type="xs:string" />
+                                               <xs:attribute name="fontSize" type="xs:int" />
+                                               <xs:attribute name="fontStyle" type="xs:int" />
+                                               <xs:attribute name="threshold" type="xs:float" />
+                                               <xs:attribute name="showBootstrap"
+                                                       type="xs:boolean" />
+                                               <xs:attribute name="showDistances"
+                                                       type="xs:boolean" />
+                                               <xs:attribute name="markUnlinked"
+                                                       type="xs:boolean" />
+                                               <xs:attribute name="fitToWindow"
+                                                       type="xs:boolean" />
+                                               <xs:attribute name="currentTree"
+                                                       type="xs:boolean" />
+                                               <xs:attribute name="id" type="xs:ID"
+                                                       use="optional">
+                                                       <xs:annotation>
+                                                               <xs:documentation>
+                                                                       Tree ID added for binding tree
+                                                                       visualization settings to vamsas
+                                                                       document trees in jalview 2.4.1
+                                                               </xs:documentation>
+                                                       </xs:annotation>
+                                               </xs:attribute>
+                                               <xs:attributeGroup ref="jv:swingwindow" />
+                                       </xs:complexType>
                                </xs:element>
                                <xs:element name="FeatureSettings" minOccurs="0">
                                        <xs:complexType>
                                                <xs:sequence>
-                                                       <xs:element name="setting" minOccurs="0" maxOccurs="unbounded">
+                                                       <xs:element name="setting" minOccurs="0"
+                                                               maxOccurs="unbounded">
                                                                <xs:complexType>
-                                                                       <xs:attribute name="type" type="xs:string" use="required"/>
-                                                                       <xs:attribute name="colour" type="xs:int" use="required"/>
-                                                                       <xs:attribute name="display" type="xs:boolean" use="required"/>
-                                                                       <xs:attribute name="order" type="xs:float" use="optional"/>
-                                                                       <xs:attribute name="mincolour" type="xs:int" use="optional">
-                                                                       <xs:annotation><xs:documentation>Optional minimum colour for graduated feature colour</xs:documentation>
-                                                                       </xs:annotation></xs:attribute>
-                                                                       <xs:attribute name="threshold" type="xs:float" use="optional">
-                                                                       <xs:annotation><xs:documentation>threshold value for graduated feature colour</xs:documentation>
-                                                                       </xs:annotation></xs:attribute>
-                                                                       <xs:attribute name="threshstate" type="xs:int" use="optional">
-                                                                       <xs:annotation><xs:documentation>threshold type for graduated feature colour</xs:documentation>
-                                                                       </xs:annotation></xs:attribute>
-                                                                       <xs:attribute name="max" type="xs:float" use="optional"/>
-                                                                       <xs:attribute name="min" type="xs:float" use="optional"/>
-                                                                       <xs:attribute name="colourByLabel" type="xs:boolean" use="optional"/>
-                                                                       <xs:attribute name="autoScale" type="xs:boolean" use="optional"/>
-                                                       </xs:complexType>
+                                                                       <xs:attribute name="type"
+                                                                               type="xs:string" use="required" />
+                                                                       <xs:attribute name="colour"
+                                                                               type="xs:int" use="required" />
+                                                                       <xs:attribute name="display"
+                                                                               type="xs:boolean" use="required" />
+                                                                       <xs:attribute name="order"
+                                                                               type="xs:float" use="optional" />
+                                                                       <xs:attribute name="mincolour"
+                                                                               type="xs:int" use="optional">
+                                                                               <xs:annotation>
+                                                                                       <xs:documentation>
+                                                                                               Optional minimum colour
+                                                                                               for graduated feature
+                                                                                               colour
+                                                                                       </xs:documentation>
+                                                                               </xs:annotation>
+                                                                       </xs:attribute>
+                                                                       <xs:attribute name="threshold"
+                                                                               type="xs:float" use="optional">
+                                                                               <xs:annotation>
+                                                                                       <xs:documentation>
+                                                                                               threshold value for
+                                                                                               graduated feature colour
+                                                                                       </xs:documentation>
+                                                                               </xs:annotation>
+                                                                       </xs:attribute>
+                                                                       <xs:attribute name="threshstate"
+                                                                               type="xs:int" use="optional">
+                                                                               <xs:annotation>
+                                                                                       <xs:documentation>
+                                                                                               threshold type for
+                                                                                               graduated feature colour
+                                                                                       </xs:documentation>
+                                                                               </xs:annotation>
+                                                                       </xs:attribute>
+                                                                       <xs:attribute name="max"
+                                                                               type="xs:float" use="optional" />
+                                                                       <xs:attribute name="min"
+                                                                               type="xs:float" use="optional" />
+                                                                       <xs:attribute name="colourByLabel"
+                                                                               type="xs:boolean" use="optional" />
+                                                                       <xs:attribute name="autoScale"
+                                                                               type="xs:boolean" use="optional" />
+                                                               </xs:complexType>
                                                        </xs:element>
-                                                       <xs:element name="group" minOccurs="0" maxOccurs="unbounded">
+                                                       <xs:element name="group" minOccurs="0"
+                                                               maxOccurs="unbounded">
                                                                <xs:complexType>
-                                                                       <xs:attribute name="name" type="xs:string" use="required"/>
-                                                                       <xs:attribute name="display" type="xs:boolean" use="required"/>
+                                                                       <xs:attribute name="name"
+                                                                               type="xs:string" use="required" />
+                                                                       <xs:attribute name="display"
+                                                                               type="xs:boolean" use="required" />
                                                                </xs:complexType>
                                                        </xs:element>
                                                </xs:sequence>
index 67ce460..160d853 100644 (file)
@@ -283,10 +283,10 @@ public class NJTree
    * 
    * used when the alignment associated to a tree has changed.
    * 
-   * @param alignment
-   *          Vector
+   * @param list
+   *          Sequence set to be associated with tree nodes
    */
-  public void UpdatePlaceHolders(Vector alignment)
+  public void UpdatePlaceHolders(List<SequenceI> list)
   {
     Vector leaves = new Vector();
     findLeaves(top, leaves);
@@ -299,7 +299,7 @@ public class NJTree
     {
       SequenceNode leaf = (SequenceNode) leaves.elementAt(i++);
 
-      if (alignment.contains(leaf.element()))
+      if (list.contains(leaf.element()))
       {
         leaf.setPlaceholder(false);
       }
@@ -308,11 +308,11 @@ public class NJTree
         if (seqmatcher == null)
         {
           // Only create this the first time we need it
-          SequenceI[] seqs = new SequenceI[alignment.size()];
+          SequenceI[] seqs = new SequenceI[list.size()];
 
           for (int j = 0; j < seqs.length; j++)
           {
-            seqs[j] = (SequenceI) alignment.elementAt(j);
+            seqs[j] = (SequenceI) list.get(j);
           }
 
           seqmatcher = new SequenceIdMatcher(seqs);
index 9321524..d41f9f8 100644 (file)
@@ -452,6 +452,8 @@ public class EditCommand implements CommandI
     command.number = start + command.string[0].length;
     for (int i = 0; i < command.seqs.length; i++)
     {
+      boolean newDSWasNeeded = command.oldds != null && command.oldds[i] != null;
+
       /**
        * cut addHistoryItem(new EditCommand("Cut Sequences", EditCommand.CUT,
        * cut, sg.getStartRes(), sg.getEndRes()-sg.getStartRes()+1,
@@ -466,9 +468,47 @@ public class EditCommand implements CommandI
       oldstring = command.seqs[i].getSequenceAsString();
       tmp = new StringBuffer(oldstring.substring(0, start));
       tmp.append(command.string[i]);
+      String nogaprep = jalview.analysis.AlignSeq.extractGaps(
+              jalview.util.Comparison.GapChars, new String(
+                      command.string[i]));
+      int ipos = command.seqs[i].findPosition(start)
+              - command.seqs[i].getStart();
       tmp.append(oldstring.substring(end));
       command.seqs[i].setSequence(tmp.toString());
       command.string[i] = oldstring.substring(start, end).toCharArray();
+      String nogapold = jalview.analysis.AlignSeq.extractGaps(
+              jalview.util.Comparison.GapChars, new String(
+                      command.string[i]));
+      if (!nogaprep.toLowerCase().equals(nogapold.toLowerCase()))
+      {
+        if (newDSWasNeeded)
+        {
+          SequenceI oldds = command.seqs[i].getDatasetSequence();
+          command.seqs[i].setDatasetSequence(command.oldds[i]);
+          command.oldds[i] = oldds;
+        }
+        else
+        {
+          if (command.oldds == null)
+          {
+            command.oldds = new SequenceI[command.seqs.length];
+          }
+          command.oldds[i] = command.seqs[i].getDatasetSequence();
+          SequenceI newds = new Sequence(
+                  command.seqs[i].getDatasetSequence());
+          String fullseq, osp = newds.getSequenceAsString();
+          fullseq = osp.substring(0, ipos) + nogaprep
+                  + osp.substring(ipos + nogaprep.length());
+          newds.setSequence(fullseq.toUpperCase());
+          // TODO: JAL-1131 ensure newly created dataset sequence is added to the set of
+          // dataset sequences associated with the alignment.
+          // TODO: JAL-1131 fix up any annotation associated with new dataset
+          // sequence to ensure that original sequence/annotation relationships
+          // are preserved.
+          command.seqs[i].setDatasetSequence(newds);
+
+        }
+      }
       tmp = null;
       oldstring = null;
     }
index 8672dec..cbf7a5a 100755 (executable)
@@ -4114,7 +4114,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
                   "Secondary Structure Prediction");
           final JMenu seqsrchmenu = new JMenu("Sequence Database Search");
           final JMenu analymenu = new JMenu("Analysis");
-          final JMenu dismenu = new JMenu("Disorder");
+          final JMenu dismenu = new JMenu("Protein Disorder");
           // JAL-940 - only show secondary structure prediction services from
           // the legacy server
           if (// Cache.getDefault("SHOW_JWS1_SERVICES", true)
@@ -4242,6 +4242,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
                 }
               } catch (Exception e)
               {
+                Cache.log.debug("Exception during web service menu building process.",e);
               }
               ;
             }
index a731796..c5d9438 100644 (file)
@@ -58,6 +58,8 @@ import jalview.workers.AlignCalcManager;
 import jalview.workers.ConsensusThread;
 import jalview.workers.ConservationThread;
 import jalview.workers.StrucConsensusThread;
+import jalview.ws.jws2.dm.AAConsSettings;
+import jalview.ws.params.AutoCalcSetting;
 
 /**
  * DOCUMENT ME!
@@ -1290,15 +1292,21 @@ public class AlignViewport extends AlignmentViewport implements SelectionSource,
   {
     return validCharWidth;
   }
-  private jalview.ws.jws2.dm.AAConsSettings preferredAAConsSettings; 
-
-  public jalview.ws.jws2.dm.AAConsSettings getPreferredAAConsSettings()
+  private Hashtable<String, AutoCalcSetting> calcIdParams=new Hashtable<String, AutoCalcSetting>();
+  public AutoCalcSetting getCalcIdSettingsFor(String calcId)
   {
-    return preferredAAConsSettings;
+    return calcIdParams.get(calcId);
   }
-  public void setPreferredAAConsSettings(jalview.ws.jws2.dm.AAConsSettings aaConsSettings)
+
+  public void setCalcIdSettingsFor(String calcId, AutoCalcSetting settings, boolean needsUpdate)
   {
-    preferredAAConsSettings=aaConsSettings;
+    calcIdParams.put(calcId, settings);
+    // TODO: create a restart list to trigger any calculations that need to be restarted after load
+    // calculator.getRegisteredWorkersOfClass(settings.getWorkerClass())
+    if (needsUpdate)
+    {
+      Cache.log.debug("trigger update for "+calcId);
+    }
   }
   
 }
index 45bab7c..ea5d5a7 100644 (file)
@@ -38,6 +38,13 @@ import jalview.schemabinding.version2.*;
 import jalview.schemes.*;
 import jalview.util.Platform;
 import jalview.util.jarInputStreamProvider;
+import jalview.ws.jws2.AAConsClient;
+import jalview.ws.jws2.Jws2Discoverer;
+import jalview.ws.jws2.dm.AAConsSettings;
+import jalview.ws.jws2.jabaws2.Jws2Instance;
+import jalview.ws.params.ArgumentI;
+import jalview.ws.params.AutoCalcSetting;
+import jalview.ws.params.WsParamSetI;
 
 /**
  * Write out the current jalview desktop state as a Jalview XML stream.
@@ -457,6 +464,7 @@ public class Jalview2XML
     }
 
     JSeq jseq;
+    Set<String> calcIdSet=new HashSet<String>();
 
     // SAVE SEQUENCES
     String id = "";
@@ -790,7 +798,6 @@ public class Jalview2XML
         }
       }
     }
-
     // SAVE ANNOTATIONS
     /**
      * store forward refs from an annotationRow to any groups
@@ -876,6 +883,7 @@ public class Jalview2XML
 
         if (aa[i].getCalcId()!=null)
         {
+          calcIdSet.add(aa[i].getCalcId());
           an.setCalcId(aa[i].getCalcId());
         }
 
@@ -1228,6 +1236,15 @@ public class Jalview2XML
         }
       }
     }
+    if (calcIdSet.size()>0)
+    {
+      for (String calcId:calcIdSet)
+      {
+        if (calcId.trim().length()>0) {
+          view.addCalcIdParam(createCalcIdParam(calcId, av));
+        }
+      }
+    }
 
     jms.addViewport(view);
 
@@ -1259,6 +1276,84 @@ public class Jalview2XML
     return object;
   }
 
+  private CalcIdParam createCalcIdParam(String calcId, AlignViewport av)
+  {
+    AutoCalcSetting settings = av.getCalcIdSettingsFor(calcId);
+    if (settings != null)
+    {
+      CalcIdParam vCalcIdParam = new CalcIdParam();
+      vCalcIdParam.setCalcId(calcId);
+      vCalcIdParam.addServiceURL(settings.getServiceURI());
+      // generic URI allowing a third party to resolve another instance of the
+      // service used for this calculation
+      for (String urls:settings.getServiceURLs())
+      {
+        vCalcIdParam.addServiceURL(urls);
+      }
+      vCalcIdParam.setVersion("1.0");
+      if (settings.getPreset() != null)
+      {
+        WsParamSetI setting = settings.getPreset();
+        vCalcIdParam.setName(setting.getName());
+        vCalcIdParam.setDescription(setting.getDescription());
+      }
+      else
+      {
+        vCalcIdParam.setName("");
+        vCalcIdParam.setDescription("Last used parameters");
+      }
+      // need to be able to recover 1) settings 2) user-defined presets or
+      // recreate settings from preset 3) predefined settings provided by
+      // service - or settings that can be transferred (or discarded)
+      vCalcIdParam.setParameters(settings
+              .getWsParamFile().replace("\n", "|\\n|"));
+      vCalcIdParam.setAutoUpdate(settings.isAutoUpdate());
+      // todo - decide if updateImmediately is needed for any projects.
+
+      return vCalcIdParam;
+    }
+    return null;
+  }
+
+  private boolean recoverCalcIdParam(CalcIdParam calcIdParam,
+          AlignViewport av)
+  {
+    if (calcIdParam.getVersion().equals("1.0"))
+    {
+      Jws2Instance service=Jws2Discoverer.getDiscoverer().getPreferredServiceFor(calcIdParam.getServiceURL());
+      if (service!=null)
+      {
+        WsParamSetI parmSet=null;
+        try {
+          parmSet = service.getParamStore().parseServiceParameterFile(calcIdParam.getName(), calcIdParam.getDescription(), calcIdParam.getServiceURL(), calcIdParam.getParameters().replace("|\\n|", "\n"));
+        } catch (IOException x)
+        {
+          warn("Couldn't parse parameter data for "+calcIdParam.getCalcId(), x);
+          return false;
+        }
+        List<ArgumentI> argList=null;
+        if (calcIdParam.getName().length()>0) {
+          parmSet = service.getParamStore().getPreset(calcIdParam.getName());
+          if (parmSet!=null)
+          {
+            // TODO : check we have a good match with settings in AACons - otherwise we'll need to create a new preset
+          }
+        }
+        else {
+          argList = parmSet.getArguments();
+          parmSet=null;
+        }
+        AAConsSettings settings = new AAConsSettings(calcIdParam.isAutoUpdate(), service, parmSet, argList);
+        av.setCalcIdSettingsFor(calcIdParam.getCalcId(), settings, calcIdParam.isNeedsUpdate());
+        return true;
+      } else {
+        warn("Cannot resolve a service for the parameters used in this project. Try configuring a JABAWS server.");
+        return false;
+      }
+    }
+    throw new Error("Unsupported Version for calcIdparam "
+            + calcIdParam.toString());
+  }
   /**
    * External mapping between jalview objects and objects yielding a valid and
    * unique object ID string. This is null for normal Jalview project IO, but
@@ -3272,7 +3367,16 @@ public class Jalview2XML
                 );
       }
     }
-
+    if (view.getCalcIdParam()!=null)
+    {
+      for (CalcIdParam calcIdParam:view.getCalcIdParam())
+      {
+        if (recoverCalcIdParam(calcIdParam, af.viewport)) {
+        } else {
+          warn("Couldn't recover parameters for "+calcIdParam.getCalcId());
+        }
+      }
+    }
     af.setMenusFromViewport(af.viewport);
     // TODO: we don't need to do this if the viewport is aready visible.
     Desktop.addInternalFrame(af, view.getTitle(), view.getWidth(),
@@ -3302,21 +3406,32 @@ public class Jalview2XML
       }
       for (JvAnnotRow auan : autoAlan)
       {
-        visan.put(auan.template.label, auan);
+        visan.put(auan.template.label+(auan.template.getCalcId()==null ? "" : "\t"+auan.template.getCalcId()), auan);
       }
       int hSize = al.getAlignmentAnnotation().length;
       ArrayList<JvAnnotRow> reorder = new ArrayList<JvAnnotRow>();
+      // work through any autoCalculated annotation already on the view
+      // removing it if it should be placed in a different location on the
+      // annotation panel.
+      List<String> remains=new ArrayList(visan.keySet());
       for (int h = 0; h < hSize; h++)
       {
         jalview.datamodel.AlignmentAnnotation jalan = al
                 .getAlignmentAnnotation()[h];
         if (jalan.autoCalculated)
         {
-          JvAnnotRow valan = visan.get(jalan.label);
+          String k;
+          JvAnnotRow valan = visan.get(k=jalan.label);
+          if (jalan.getCalcId()!=null)
+          {
+            valan = visan.get(k=jalan.label+ "\t"+jalan.getCalcId());
+          }
+          
           if (valan != null)
           {
             // delete the auto calculated row from the alignment
-            al.deleteAnnotation(al.getAlignmentAnnotation()[h], false);
+            al.deleteAnnotation(jalan, false);
+            remains.remove(k);
             hSize--;
             h--;
             if (valan != nullAnnot)
@@ -3338,6 +3453,16 @@ public class Jalview2XML
           }
         }
       }
+      // Add any (possibly stale) autocalculated rows that were not appended to the view during construction
+      for (String other:remains)
+      {
+        JvAnnotRow othera=visan.get(other);
+        if (othera!=nullAnnot && othera.template.getCalcId()!=null && othera.template.getCalcId().length()>0)
+        {
+          reorder.add(othera);
+        }
+      }
+      // now put the automatic annotation in its correct place
       int s = 0, srt[] = new int[reorder.size()];
       JvAnnotRow[] rws = new JvAnnotRow[reorder.size()];
       for (JvAnnotRow jvar : reorder)
index 602ded6..14802e7 100755 (executable)
@@ -20,6 +20,8 @@ package jalview.gui;
 import java.beans.*;
 import java.io.*;
 import java.util.*;
+import java.util.List;
+
 import javax.imageio.*;
 
 import java.awt.*;
@@ -152,7 +154,7 @@ public class TreePanel extends GTreePanel
                     .println("new alignment sequences vector value is null");
           }
 
-          tree.UpdatePlaceHolders((Vector) evt.getNewValue());
+          tree.UpdatePlaceHolders((List<SequenceI>) evt.getNewValue());
           treeCanvas.nameHash.clear(); // reset the mapping between canvas
           // rectangles and leafnodes
           repaint();
index b9bd873..689534c 100644 (file)
@@ -1071,6 +1071,10 @@ public class WsJobParameters extends JPanel implements ItemListener,
     }
   }
 
+  public boolean isServiceDefaults()
+  {
+    return (!isModified() && (lastParmSet != null && lastParmSet.equals(SVC_DEF)));
+  }
   public List<ArgumentI> getJobParams()
   {
     return opanp.getCurrentSettings();
index 9452ff5..ab859bd 100644 (file)
@@ -18,7 +18,6 @@
 package jalview.gui;
 
 import java.io.File;
-import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStreamReader;
@@ -29,12 +28,10 @@ import java.util.Hashtable;
 import java.util.List;
 import java.util.StringTokenizer;
 
-import javax.swing.JButton;
 import javax.swing.JOptionPane;
 
 import jalview.bin.Cache;
 import jalview.io.JalviewFileChooser;
-import jalview.ws.jws2.dm.JabaWsParamSet;
 import jalview.ws.params.ParamDatastoreI;
 import jalview.ws.params.ParamManager;
 import jalview.ws.params.WsParamSetI;
index 33cd4bf..16a24f5 100644 (file)
@@ -1,7 +1,8 @@
-#Thu May 24 20:06:46 BST 2012
+#Fri Jul 06 18:02:04 BST 2012
 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
+jalview.schemabinding.version2.CalcIdParam=jalview.schemabinding.version2.descriptors.CalcIdParamDescriptor
 jalview.schemabinding.version2.Tree=jalview.schemabinding.version2.descriptors.TreeDescriptor
 jalview.schemabinding.version2.JalviewModel=jalview.schemabinding.version2.descriptors.JalviewModelDescriptor
 jalview.schemabinding.version2.SequenceType=jalview.schemabinding.version2.descriptors.SequenceTypeDescriptor
@@ -17,6 +18,7 @@ jalview.schemabinding.version2.UserColourScheme=jalview.schemabinding.version2.d
 jalview.schemabinding.version2.DBRef=jalview.schemabinding.version2.descriptors.DBRefDescriptor
 jalview.schemabinding.version2.AlcodMap=jalview.schemabinding.version2.descriptors.AlcodMapDescriptor
 jalview.schemabinding.version2.Annotation=jalview.schemabinding.version2.descriptors.AnnotationDescriptor
+jalview.schemabinding.version2.Wsparameters=jalview.schemabinding.version2.descriptors.WsparametersDescriptor
 jalview.schemabinding.version2.JSeq=jalview.schemabinding.version2.descriptors.JSeqDescriptor
 jalview.schemabinding.version2.Sequence=jalview.schemabinding.version2.descriptors.SequenceDescriptor
 jalview.schemabinding.version2.WebServiceParameterSet=jalview.schemabinding.version2.descriptors.WebServiceParameterSetDescriptor
@@ -32,14 +34,14 @@ jalview.schemabinding.version2.UserColours=jalview.schemabinding.version2.descri
 jalview.schemabinding.version2.Colour=jalview.schemabinding.version2.descriptors.ColourDescriptor
 jalview.schemabinding.version2.MapListFrom=jalview.schemabinding.version2.descriptors.MapListFromDescriptor
 jalview.schemabinding.version2.PdbentryItem=jalview.schemabinding.version2.descriptors.PdbentryItemDescriptor
-jalview.schemabinding.version2.FeatureSettings=jalview.schemabinding.version2.descriptors.FeatureSettingsDescriptor
 jalview.schemabinding.version2.JGroup=jalview.schemabinding.version2.descriptors.JGroupDescriptor
-jalview.schemabinding.version2.MapListTo=jalview.schemabinding.version2.descriptors.MapListToDescriptor
-jalview.schemabinding.version2.JalviewUserColours=jalview.schemabinding.version2.descriptors.JalviewUserColoursDescriptor
+jalview.schemabinding.version2.FeatureSettings=jalview.schemabinding.version2.descriptors.FeatureSettingsDescriptor
 jalview.schemabinding.version2.VamsasModel=jalview.schemabinding.version2.descriptors.VamsasModelDescriptor
+jalview.schemabinding.version2.JalviewUserColours=jalview.schemabinding.version2.descriptors.JalviewUserColoursDescriptor
+jalview.schemabinding.version2.MapListTo=jalview.schemabinding.version2.descriptors.MapListToDescriptor
 jalview.schemabinding.version2.Pdbentry=jalview.schemabinding.version2.descriptors.PdbentryDescriptor
 jalview.schemabinding.version2.HiddenColumns=jalview.schemabinding.version2.descriptors.HiddenColumnsDescriptor
-jalview.schemabinding.version2.DseqFor=jalview.schemabinding.version2.descriptors.DseqForDescriptor
 jalview.schemabinding.version2.Features=jalview.schemabinding.version2.descriptors.FeaturesDescriptor
+jalview.schemabinding.version2.DseqFor=jalview.schemabinding.version2.descriptors.DseqForDescriptor
 jalview.schemabinding.version2.VAMSAS=jalview.schemabinding.version2.descriptors.VAMSASDescriptor
 jalview.schemabinding.version2.MappingChoiceItem=jalview.schemabinding.version2.descriptors.MappingChoiceItemDescriptor
diff --git a/src/jalview/schemabinding/version2/CalcIdParam.java b/src/jalview/schemabinding/version2/CalcIdParam.java
new file mode 100644 (file)
index 0000000..9fc3384
--- /dev/null
@@ -0,0 +1,283 @@
+/*
+ * This class was automatically generated with 
+ * <a href="http://www.castor.org">Castor 1.1</a>, 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 CalcIdParam.
+ * 
+ * @version $Revision$ $Date$
+ */
+public class CalcIdParam extends WebServiceParameterSet 
+implements java.io.Serializable
+{
+
+
+      //--------------------------/
+     //- Class/Member Variables -/
+    //--------------------------/
+
+    /**
+     * 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
+     */
+    private boolean _needsUpdate = false;
+
+    /**
+     * keeps track of state for field: _needsUpdate
+     */
+    private boolean _has_needsUpdate;
+
+    /**
+     * should the calculation be automatically performed on edits
+     */
+    private boolean _autoUpdate;
+
+    /**
+     * keeps track of state for field: _autoUpdate
+     */
+    private boolean _has_autoUpdate;
+
+
+      //----------------/
+     //- Constructors -/
+    //----------------/
+
+    public CalcIdParam() {
+        super();
+    }
+
+
+      //-----------/
+     //- Methods -/
+    //-----------/
+
+    /**
+     */
+    public void deleteAutoUpdate(
+    ) {
+        this._has_autoUpdate= false;
+    }
+
+    /**
+     */
+    public void deleteNeedsUpdate(
+    ) {
+        this._has_needsUpdate= false;
+    }
+
+    /**
+     * Returns the value of field 'autoUpdate'. The field
+     * 'autoUpdate' has the following description: should the
+     * calculation be automatically performed on edits
+     * 
+     * @return the value of field 'AutoUpdate'.
+     */
+    public boolean getAutoUpdate(
+    ) {
+        return this._autoUpdate;
+    }
+
+    /**
+     * Returns the value of field 'calcId'. The field 'calcId' has
+     * the following description: handle for the calculation which
+     * uses this parameter set
+     * 
+     * @return the value of field 'CalcId'.
+     */
+    public java.lang.String getCalcId(
+    ) {
+        return this._calcId;
+    }
+
+    /**
+     * 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
+     * 
+     * @return the value of field 'NeedsUpdate'.
+     */
+    public boolean getNeedsUpdate(
+    ) {
+        return this._needsUpdate;
+    }
+
+    /**
+     * Method hasAutoUpdate.
+     * 
+     * @return true if at least one AutoUpdate has been added
+     */
+    public boolean hasAutoUpdate(
+    ) {
+        return this._has_autoUpdate;
+    }
+
+    /**
+     * Method hasNeedsUpdate.
+     * 
+     * @return true if at least one NeedsUpdate has been added
+     */
+    public boolean hasNeedsUpdate(
+    ) {
+        return this._has_needsUpdate;
+    }
+
+    /**
+     * Returns the value of field 'autoUpdate'. The field
+     * 'autoUpdate' has the following description: should the
+     * calculation be automatically performed on edits
+     * 
+     * @return the value of field 'AutoUpdate'.
+     */
+    public boolean isAutoUpdate(
+    ) {
+        return this._autoUpdate;
+    }
+
+    /**
+     * 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
+     * 
+     * @return the value of field 'NeedsUpdate'.
+     */
+    public boolean isNeedsUpdate(
+    ) {
+        return this._needsUpdate;
+    }
+
+    /**
+     * 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 'autoUpdate'. The field 'autoUpdate'
+     * has the following description: should the calculation be
+     * automatically performed on edits
+     * 
+     * @param autoUpdate the value of field 'autoUpdate'.
+     */
+    public void setAutoUpdate(
+            final boolean autoUpdate) {
+        this._autoUpdate = autoUpdate;
+        this._has_autoUpdate = true;
+    }
+
+    /**
+     * Sets the value of field 'calcId'. The field 'calcId' has the
+     * following description: handle for the calculation which uses
+     * this parameter set
+     * 
+     * @param calcId the value of field 'calcId'.
+     */
+    public void setCalcId(
+            final java.lang.String calcId) {
+        this._calcId = calcId;
+    }
+
+    /**
+     * 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
+     * 
+     * @param needsUpdate the value of field 'needsUpdate'.
+     */
+    public void setNeedsUpdate(
+            final boolean needsUpdate) {
+        this._needsUpdate = needsUpdate;
+        this._has_needsUpdate = 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.CalcIdParam
+     */
+    public static jalview.schemabinding.version2.CalcIdParam unmarshal(
+            final java.io.Reader reader)
+    throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
+        return (jalview.schemabinding.version2.CalcIdParam) Unmarshaller.unmarshal(jalview.schemabinding.version2.CalcIdParam.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);
+    }
+
+}
index 948d7d0..000844e 100644 (file)
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
- * 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 <http://www.gnu.org/licenses/>.
- *******************************************************************************/
 /*
  * This class was automatically generated with 
  * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -389,8 +372,9 @@ public class Viewport implements java.io.Serializable {
     private boolean _has_textColThreshold;
 
     /**
-     * unique id used by jalview to synchronize between stored and
-     * instantiated views
+     * unique id used by jalview to
+     *  synchronize between stored and
+     *  instantiated views
      *  
      */
     private java.lang.String _id;
@@ -445,6 +429,11 @@ public class Viewport implements java.io.Serializable {
      */
     private java.util.Vector _hiddenColumnsList;
 
+    /**
+     * Field _calcIdParamList.
+     */
+    private java.util.Vector _calcIdParamList;
+
 
       //----------------/
      //- Constructors -/
@@ -453,6 +442,7 @@ public class Viewport implements java.io.Serializable {
     public Viewport() {
         super();
         this._hiddenColumnsList = new java.util.Vector();
+        this._calcIdParamList = new java.util.Vector();
     }
 
 
@@ -463,6 +453,34 @@ public class Viewport implements java.io.Serializable {
     /**
      * 
      * 
+     * @param vCalcIdParam
+     * @throws java.lang.IndexOutOfBoundsException if the index
+     * given is outside the bounds of the collection
+     */
+    public void addCalcIdParam(
+            final jalview.schemabinding.version2.CalcIdParam vCalcIdParam)
+    throws java.lang.IndexOutOfBoundsException {
+        this._calcIdParamList.addElement(vCalcIdParam);
+    }
+
+    /**
+     * 
+     * 
+     * @param index
+     * @param vCalcIdParam
+     * @throws java.lang.IndexOutOfBoundsException if the index
+     * given is outside the bounds of the collection
+     */
+    public void addCalcIdParam(
+            final int index,
+            final jalview.schemabinding.version2.CalcIdParam vCalcIdParam)
+    throws java.lang.IndexOutOfBoundsException {
+        this._calcIdParamList.add(index, vCalcIdParam);
+    }
+
+    /**
+     * 
+     * 
      * @param vHiddenColumns
      * @throws java.lang.IndexOutOfBoundsException if the index
      * given is outside the bounds of the collection
@@ -741,6 +759,17 @@ public class Viewport implements java.io.Serializable {
     }
 
     /**
+     * Method enumerateCalcIdParam.
+     * 
+     * @return an Enumeration over all
+     * jalview.schemabinding.version2.CalcIdParam elements
+     */
+    public java.util.Enumeration enumerateCalcIdParam(
+    ) {
+        return this._calcIdParamList.elements();
+    }
+
+    /**
      * Method enumerateHiddenColumns.
      * 
      * @return an Enumeration over all
@@ -772,6 +801,51 @@ public class Viewport implements java.io.Serializable {
     }
 
     /**
+     * Method getCalcIdParam.
+     * 
+     * @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.CalcIdParam at the given index
+     */
+    public jalview.schemabinding.version2.CalcIdParam getCalcIdParam(
+            final int index)
+    throws java.lang.IndexOutOfBoundsException {
+        // check bounds for index
+        if (index < 0 || index >= this._calcIdParamList.size()) {
+            throw new IndexOutOfBoundsException("getCalcIdParam: Index value '" + index + "' not in range [0.." + (this._calcIdParamList.size() - 1) + "]");
+        }
+        
+        return (jalview.schemabinding.version2.CalcIdParam) _calcIdParamList.get(index);
+    }
+
+    /**
+     * Method getCalcIdParam.Returns the contents of the collection
+     * in an Array.  <p>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 <i>know</i>
+     * that the Array returned is of exactly the correct length.
+     * 
+     * @return this collection as an Array
+     */
+    public jalview.schemabinding.version2.CalcIdParam[] getCalcIdParam(
+    ) {
+        jalview.schemabinding.version2.CalcIdParam[] array = new jalview.schemabinding.version2.CalcIdParam[0];
+        return (jalview.schemabinding.version2.CalcIdParam[]) this._calcIdParamList.toArray(array);
+    }
+
+    /**
+     * Method getCalcIdParamCount.
+     * 
+     * @return the size of this collection
+     */
+    public int getCalcIdParamCount(
+    ) {
+        return this._calcIdParamList.size();
+    }
+
+    /**
      * Returns the value of field 'centreColumnLabels'.
      * 
      * @return the value of field 'CentreColumnLabels'.
@@ -921,7 +995,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 instantiated views
+     *  synchronize between stored and
+     *  instantiated views
      *  
      * 
      * @return the value of field 'Id'.
@@ -1876,12 +1951,43 @@ public class Viewport implements java.io.Serializable {
 
     /**
      */
+    public void removeAllCalcIdParam(
+    ) {
+        this._calcIdParamList.clear();
+    }
+
+    /**
+     */
     public void removeAllHiddenColumns(
     ) {
         this._hiddenColumnsList.clear();
     }
 
     /**
+     * Method removeCalcIdParam.
+     * 
+     * @param vCalcIdParam
+     * @return true if the object was removed from the collection.
+     */
+    public boolean removeCalcIdParam(
+            final jalview.schemabinding.version2.CalcIdParam vCalcIdParam) {
+        boolean removed = _calcIdParamList.remove(vCalcIdParam);
+        return removed;
+    }
+
+    /**
+     * Method removeCalcIdParamAt.
+     * 
+     * @param index
+     * @return the element removed from the collection
+     */
+    public jalview.schemabinding.version2.CalcIdParam removeCalcIdParamAt(
+            final int index) {
+        java.lang.Object obj = this._calcIdParamList.remove(index);
+        return (jalview.schemabinding.version2.CalcIdParam) obj;
+    }
+
+    /**
      * Method removeHiddenColumns.
      * 
      * @param vHiddenColumns
@@ -1927,6 +2033,41 @@ public class Viewport implements java.io.Serializable {
     }
 
     /**
+     * 
+     * 
+     * @param index
+     * @param vCalcIdParam
+     * @throws java.lang.IndexOutOfBoundsException if the index
+     * given is outside the bounds of the collection
+     */
+    public void setCalcIdParam(
+            final int index,
+            final jalview.schemabinding.version2.CalcIdParam vCalcIdParam)
+    throws java.lang.IndexOutOfBoundsException {
+        // check bounds for index
+        if (index < 0 || index >= this._calcIdParamList.size()) {
+            throw new IndexOutOfBoundsException("setCalcIdParam: Index value '" + index + "' not in range [0.." + (this._calcIdParamList.size() - 1) + "]");
+        }
+        
+        this._calcIdParamList.set(index, vCalcIdParam);
+    }
+
+    /**
+     * 
+     * 
+     * @param vCalcIdParamArray
+     */
+    public void setCalcIdParam(
+            final jalview.schemabinding.version2.CalcIdParam[] vCalcIdParamArray) {
+        //-- copy array
+        _calcIdParamList.clear();
+        
+        for (int i = 0; i < vCalcIdParamArray.length; i++) {
+                this._calcIdParamList.add(vCalcIdParamArray[i]);
+        }
+    }
+
+    /**
      * Sets the value of field 'centreColumnLabels'.
      * 
      * @param centreColumnLabels the value of field
@@ -2075,7 +2216,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 instantiated views
+     *  synchronize between stored and
+     *  instantiated views
      *  
      * 
      * @param id the value of field 'id'.
diff --git a/src/jalview/schemabinding/version2/descriptors/CalcIdParamDescriptor.java b/src/jalview/schemabinding/version2/descriptors/CalcIdParamDescriptor.java
new file mode 100644 (file)
index 0000000..46e867c
--- /dev/null
@@ -0,0 +1,279 @@
+/*
+ * This class was automatically generated with 
+ * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package jalview.schemabinding.version2.descriptors;
+
+  //---------------------------------/
+ //- Imported classes and packages -/
+//---------------------------------/
+
+import jalview.schemabinding.version2.CalcIdParam;
+
+/**
+ * Class CalcIdParamDescriptor.
+ * 
+ * @version $Revision$ $Date$
+ */
+public class CalcIdParamDescriptor extends jalview.schemabinding.version2.descriptors.WebServiceParameterSetDescriptor {
+
+
+      //--------------------------/
+     //- 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 CalcIdParamDescriptor() {
+        super();
+        setExtendsWithoutFlatten(new jalview.schemabinding.version2.descriptors.WebServiceParameterSetDescriptor());
+        _nsURI = "www.jalview.org";
+        _xmlName = "calcIdParam";
+        _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
+        
+        //-- _calcId
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_calcId", "calcId", 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
+            {
+                CalcIdParam target = (CalcIdParam) object;
+                return target.getCalcId();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    CalcIdParam target = (CalcIdParam) object;
+                    target.setCalcId( (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: _calcId
+        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);
+        //-- _needsUpdate
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_needsUpdate", "needsUpdate", org.exolab.castor.xml.NodeType.Attribute);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                CalcIdParam target = (CalcIdParam) object;
+                if (!target.hasNeedsUpdate()) { return null; }
+                return (target.getNeedsUpdate() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    CalcIdParam target = (CalcIdParam) object;
+                    // if null, use delete method for optional primitives 
+                    if (value == null) {
+                        target.deleteNeedsUpdate();
+                        return;
+                    }
+                    target.setNeedsUpdate( ((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: _needsUpdate
+        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);
+        //-- _autoUpdate
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_autoUpdate", "autoUpdate", org.exolab.castor.xml.NodeType.Attribute);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                CalcIdParam target = (CalcIdParam) object;
+                if (!target.hasAutoUpdate()) { return null; }
+                return (target.getAutoUpdate() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    CalcIdParam target = (CalcIdParam) object;
+                    // ignore null values for non optional primitives
+                    if (value == null) { return; }
+                    
+                    target.setAutoUpdate( ((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.setRequired(true);
+        desc.setMultivalued(false);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _autoUpdate
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(1);
+        { //-- local scope
+            org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+            typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+            fieldValidator.setValidator(typeValidator);
+        }
+        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.CalcIdParam.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;
+    }
+
+}
index c4fc82d..7d067fa 100644 (file)
@@ -1,20 +1,3 @@
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
- * 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 <http://www.gnu.org/licenses/>.
- *******************************************************************************/
 /*
  * This class was automatically generated with 
  * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
@@ -1880,6 +1863,48 @@ public class ViewportDescriptor extends org.exolab.castor.xml.util.XMLClassDescr
         { //-- local scope
         }
         desc.setValidator(fieldValidator);
+        //-- _calcIdParamList
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.CalcIdParam.class, "_calcIdParamList", "calcIdParam", org.exolab.castor.xml.NodeType.Element);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                Viewport target = (Viewport) object;
+                return target.getCalcIdParam();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    Viewport target = (Viewport) object;
+                    target.addCalcIdParam( (jalview.schemabinding.version2.CalcIdParam) value);
+                } catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {
+                try {
+                    Viewport target = (Viewport) object;
+                    target.removeAllCalcIdParam();
+                } catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance(java.lang.Object parent) {
+                return new jalview.schemabinding.version2.CalcIdParam();
+            }
+        };
+        desc.setHandler(handler);
+        desc.setNameSpaceURI("www.jalview.org");
+        desc.setMultivalued(true);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _calcIdParamList
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(0);
+        { //-- local scope
+        }
+        desc.setValidator(fieldValidator);
     }
 
 
index cdc618e..25c849e 100755 (executable)
@@ -29,15 +29,18 @@ public class UserColourScheme extends ResidueColourScheme
 
   public UserColourScheme()
   {
+    super(ResidueProperties.aaIndex);
   }
 
   public UserColourScheme(Color[] newColors)
   {
+    super(ResidueProperties.aaIndex);
     colors = newColors;
   }
 
   public UserColourScheme(String colour)
   {
+    super(ResidueProperties.aaIndex);
     Color col = getColourFromString(colour);
 
     if (col == null)
index b86c856..d1bf303 100644 (file)
@@ -5,6 +5,7 @@ import jalview.datamodel.AlignmentI;
 import jalview.datamodel.Annotation;
 import jalview.gui.AlignFrame;
 import jalview.gui.AlignmentPanel;
+import jalview.ws.jws2.dm.AAConsSettings;
 import jalview.ws.jws2.jabaws2.Jws2Instance;
 import jalview.ws.params.WsParamSetI;
 
@@ -29,8 +30,18 @@ public class AAConsClient extends JabawsAlignCalcWorker
     nucleotidesAllowed = false;
     proteinAllowed = true;
     gapMap=new boolean[0];
+    initViewportParams();
   }
 
+  protected void initViewportParams()
+  {
+    ((jalview.gui.AlignViewport) alignViewport).setCalcIdSettingsFor(getCalcId(), new AAConsSettings(true, service, this.preset, (arguments!=null) ?  JabaParamStore.getJwsArgsfromJaba(arguments) : null), true);
+  }
+  @Override
+  public void updateParameters(WsParamSetI newpreset, java.util.List<Argument> newarguments) {
+    super.updateParameters(newpreset, newarguments);
+    initViewportParams();
+  };
   public String getServiceActionText()
   {
     return "calculating Amino acid consensus using AACons service";
@@ -158,13 +169,17 @@ public class AAConsClient extends JabawsAlignCalcWorker
     }
   }
 
-  private String getCalcId() {
-       // TODO Auto-generated method stub
-       return null;
-}
+  public String getCalcId()
+  {
+    return SequenceAnnotationWSClient.AAConsCalcId;
+  }
 
-public static void removeAAConsAnnotation(AlignmentPanel alignPanel)
+  public static void removeAAConsAnnotation(AlignmentPanel alignPanel)
   {
+    for (AlignmentAnnotation aa: alignPanel.getAlignment().findAnnotation(SequenceAnnotationWSClient.AAConsCalcId))
+    {
+      alignPanel.getAlignment().deleteAnnotation(aa);
+    }
     // List<AlignmentAnnotation>
     // ourannots=alignPanel.getAlignment().findAnnotation(Screen3D.)
     // TODO Auto-generated method stub
index 766bcf7..50f4368 100644 (file)
@@ -272,7 +272,7 @@ public class JabaParamStore implements ParamDatastoreI
     boolean found = false;
     for (String url : urls)
     {
-      if (service.getUri().equalsIgnoreCase(url))
+      if (service.getServiceTypeURI().equals(url) || service.getUri().equalsIgnoreCase(url))
       {
         found = true;
         break;
index 7ef85d3..630faae 100644 (file)
@@ -32,7 +32,7 @@ import compbio.metadata.WrongParameterException;
 
 public abstract class JabawsAlignCalcWorker extends AlignCalcWorker
 {
-
+  Jws2Instance service;
   @SuppressWarnings("unchecked")
   protected SequenceAnnotation aaservice;
 
@@ -57,6 +57,7 @@ public abstract class JabawsAlignCalcWorker extends AlignCalcWorker
     this.guiProgress = alignFrame;
     this.preset = preset;
     this.arguments = paramset;
+    this.service = service;
     aaservice = (SequenceAnnotation) service.service;
 
   }
@@ -82,31 +83,9 @@ public abstract class JabawsAlignCalcWorker extends AlignCalcWorker
   public void updateParameters(final WsParamSetI newpreset,
           final List<Argument> newarguments)
   {
-    if (false) // || calcMan.isWorking(this))
-    {
-      new Thread(new Runnable()
-      {
-        @Override
-        public void run()
-        {
-
-          try
-          {
-            Thread.sleep(200);
-          } catch (InterruptedException x)
-          {
-          }
-          ;
-          updateParameters(newpreset, newarguments);
-        }
-      }).start();
-    }
-    else
-    {
-      preset = newpreset;
-      arguments = newarguments;
-      calcMan.startWorker(this);
-    }
+    preset = newpreset;
+    arguments = newarguments;
+    calcMan.startWorker(this);
   }
 
   public List<Option> getJabaArguments()
@@ -139,7 +118,7 @@ public abstract class JabawsAlignCalcWorker extends AlignCalcWorker
     long progressId = -1;
 
     String rslt = "JOB NOT DEFINED";
-
+    StringBuffer msg=new StringBuffer();
     try
     {
       if (checkDone())
@@ -237,6 +216,7 @@ public abstract class JabawsAlignCalcWorker extends AlignCalcWorker
           if (stats != null)
           {
             System.out.print(stats.getChunk());
+            msg.append(stats);
             rpos = stats.getNextPosition();
           }
         } while (stats != null && rpos > cpos);
@@ -251,7 +231,6 @@ public abstract class JabawsAlignCalcWorker extends AlignCalcWorker
           }
           ;
         }
-
       } while (!finished);
       try
       {
@@ -263,12 +242,13 @@ public abstract class JabawsAlignCalcWorker extends AlignCalcWorker
       scoremanager = aaservice.getAnnotation(rslt);
       if (scoremanager != null)
       {
+        jalview.bin.Cache.log.debug("Updating result annotation from Job "+rslt+" at "+service.getUri());
         updateResultAnnotation(true);
       }
     } catch (JobSubmissionException x)
     {
 
-      System.err.println("submission error:");
+      System.err.println("submission error with "+getServiceActionText()+" :");
       x.printStackTrace();
       calcMan.workerCannotRun(this);
     } catch (ResultNotAvailableException x)
@@ -306,6 +286,14 @@ public abstract class JabawsAlignCalcWorker extends AlignCalcWorker
         }
         ap.paintAlignment(true);
       }
+      if (msg.length()>0)
+      {
+        // TODO: stash message somewhere in annotation or alignment view.
+        // code below shows result in a text box popup
+        /* jalview.gui.CutAndPasteTransfer cap = new jalview.gui.CutAndPasteTransfer();
+        cap.setText(msg.toString());
+        jalview.gui.Desktop.addInternalFrame(cap, "Job Status for "+getServiceActionText(), 600, 400); */
+      }
     }
 
   }
index 2c8c581..cb80863 100644 (file)
@@ -103,7 +103,7 @@ public abstract class Jws2Client extends jalview.ws.WSClient
       WsParamSetI prset = jobParams.getPreset();
       if (prset == null)
       {
-        paramset = JabaParamStore.getJabafromJwsArgs(jobParams
+        paramset = jobParams.isServiceDefaults() ? null : JabaParamStore.getJabafromJwsArgs(jobParams
                 .getJobParams());
       }
       else
index b440de8..c0addfe 100644 (file)
@@ -31,8 +31,12 @@ import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
 import java.net.URL;
 import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Hashtable;
 import java.util.List;
+import java.util.Map;
 import java.util.StringTokenizer;
 import java.util.Vector;
 
@@ -264,7 +268,9 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI
     // dynamically regenerate service list.
     populateWSMenuEntry(wsmenu, alignFrame, null);
   }
-
+  private boolean isRecalculable(String action) {
+    return (action!=null && action.equalsIgnoreCase("conservation"));
+  }
   private void populateWSMenuEntry(JMenu jws2al, final AlignFrame alignFrame, String typeFilter)
   {
     if (running || services == null || services.size() == 0)
@@ -278,13 +284,130 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI
      * for moment we keep them separate.
      */
     JMenu atpoint;
+    List<Jws2Instance> enumerableServices=new ArrayList<Jws2Instance>();
+    //jws2al.removeAll();
+    Map<String, Jws2Instance> preferredHosts=new HashMap<String,Jws2Instance>();
+    Map<String, List<Jws2Instance>> alternates = new HashMap<String, List<Jws2Instance>>();
+    for (Jws2Instance service : services.toArray(new Jws2Instance[0]))
+    {
+      if (!isRecalculable(service.action)) {
+        // add 'one shot' services to be displayed using the classic menu structure
+        enumerableServices.add(service);
+      } else {
+        if (!preferredHosts.containsKey(service.serviceType))
+        {
+          Jws2Instance preferredInstance = getPreferredServiceFor(alignFrame,
+                  service.serviceType);
+          if (preferredInstance != null)
+          {
+            preferredHosts.put(service.serviceType, preferredInstance);
+          }
+          else
+          {
+            preferredHosts.put(service.serviceType, service);
+          }
+        }
+        List<Jws2Instance> ph=alternates.get(service.serviceType);
+        if (preferredHosts.get(service.serviceType)!=service)
+        {
+          if (ph==null)
+          {
+            ph=new ArrayList<Jws2Instance>();
+          }
+          ph.add(service);
+          alternates.put(service.serviceType, ph);
+        }
+      }
+
+    }
+
+    // create GUI element for classic services
+    addEnumeratedServices(jws2al, alignFrame, enumerableServices);
+    // and the instantaneous services
+    for (final Jws2Instance service : preferredHosts.values())
+    {
+      atpoint = JvSwingUtils.findOrCreateMenu(jws2al,service.action);
+      JMenuItem hitm;
+      if (atpoint.getItemCount()>1) {
+        // previous service of this type already present
+        atpoint.addSeparator();
+      }
+      atpoint.add(hitm = new JMenuItem(service.getHost()));
+      hitm.setForeground(Color.blue);
+      hitm.addActionListener(new ActionListener()
+      {
+
+        @Override
+        public void actionPerformed(ActionEvent e)
+        {
+          Desktop.showUrl(service.getHost());
+        }
+      });
+      hitm.setToolTipText(JvSwingUtils
+              .wrapTooltip("Opens the JABAWS server's homepage in web browser"));
+
+      service.attachWSMenuEntry(atpoint, alignFrame);
+      if (alternates.containsKey(service.serviceType))
+      {
+        atpoint.add(hitm=new JMenu("Switch server"));
+        hitm.setToolTipText(JvSwingUtils.wrapTooltip("Choose a server for running this service"));
+        for (final Jws2Instance sv:alternates.get(service.serviceType))
+        {
+          JMenuItem itm;
+          hitm.add(itm=new JMenuItem(sv.getHost()));
+          itm.setForeground(Color.blue);
+          itm.addActionListener(new ActionListener()
+          {
+
+            @Override
+            public void actionPerformed(ActionEvent arg0)
+            {
+              new Thread(new Runnable() { 
+                public void run() {
+                  setPreferredServiceFor(alignFrame, sv.serviceType, sv.action, sv);
+                  changeSupport.firePropertyChange("services", new Vector(), services);
+                };
+              }).start();
+
+            }
+          });
+        }
+        /*hitm.addActionListener(new ActionListener()
+              {
+
+                @Override
+                public void actionPerformed(ActionEvent arg0)
+                {
+                  new Thread(new Runnable() {
+                    @Override
+                    public void run()
+                    {
+                      new SetPreferredServer(alignFrame, service.serviceType, service.action);
+                    }
+                  }).start();
+                }
+              });*/
+      }
+    }
+  }
+  /**
+   * add services using the Java 2.5/2.6/2.7 system which optionally creates submenus to index by host and service program type
+   */
+  private void addEnumeratedServices(final JMenu jws2al, final AlignFrame alignFrame, List<Jws2Instance> enumerableServices)
+  {
+    boolean byhost = Cache.getDefault("WSMENU_BYHOST", false), bytype = Cache
+            .getDefault("WSMENU_BYTYPE", false);
+    /**
+     * eventually, JWS2 services will appear under the same align/etc submenus.
+     * for moment we keep them separate.
+     */
+    JMenu atpoint;
     MsaWSClient msacl = new MsaWSClient();
-    Vector hostLabels = new Vector();
-    jws2al.removeAll();
-    Hashtable<String,String> lasthostFor = new Hashtable<String,String>();
+    List<String> hostLabels = new ArrayList<String>();
+    Hashtable<String, String> lasthostFor = new Hashtable<String, String>();
     Hashtable<String, ArrayList<Jws2Instance>> hosts = new Hashtable<String, ArrayList<Jws2Instance>>();
     ArrayList<String> hostlist=new ArrayList<String>();
-    for (Jws2Instance service : services)
+    for (Jws2Instance service : enumerableServices)
     {
       ArrayList<Jws2Instance> hostservices = hosts.get(service.getHost());
       if (hostservices == null)
@@ -337,7 +460,11 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI
           // contiguous
           // group
           JMenuItem hitm;
-          atpoint.addSeparator();
+          if (hostLabels.contains(host)) {
+            atpoint.addSeparator();
+          } else {
+            hostLabels.add(host);
+          }
           if (lasthostFor.get(service.action) == null || !lasthostFor.get(service.action).equals(host))
           {
             atpoint.add(hitm = new JMenuItem(host));
@@ -355,30 +482,14 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI
                     .wrapTooltip("Opens the JABAWS server's homepage in web browser"));
             lasthostFor.put(service.action,host);
           }
-          hostLabels.addElement(host + service.serviceType
+          hostLabels.add(host + service.serviceType
                   + service.getActionText());
-          // hostLabels.addElement(host + (bytype ?
-          // service.serviceType+service.getActionText() : ""));
         }
         
         service.attachWSMenuEntry(atpoint, alignFrame);
-        /*
-         * JMenuItem sitem = new JMenuItem(service.serviceType);
-         * sitem.setToolTipText("Hosted at " + service.hosturl);
-         * sitem.addActionListener(new ActionListener() {
-         * 
-         * @Override public void actionPerformed(ActionEvent e) { AlignmentView
-         * msa = alignFrame.gatherSequencesForAlignment(); MsaWSClient client =
-         * new MsaWSClient(service, "JWS2 Alignment of " +
-         * alignFrame.getTitle(), msa, false, true,
-         * alignFrame.getViewport().getAlignment().getDataset(), alignFrame); }
-         * });
-         */
       }
     }
-
   }
-
   public static void main(String[] args)
   {
     if (args.length>0)
@@ -701,4 +812,100 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI
     }
     return -2;
   }
+
+  /**
+   * pick the user's preferred service based on a set of URLs (jaba server locations) and service URIs (specifying version and service interface class)
+   * 
+   * @param serviceURL
+   * @return null or best match for given uri/ls.
+   */
+  public Jws2Instance getPreferredServiceFor(String[] serviceURLs)
+  {
+    HashSet<String> urls=new HashSet<String>();
+    urls.addAll(Arrays.asList(serviceURLs));
+    Jws2Instance match=null;
+    for (Jws2Instance svc:services)
+    {
+      if (urls.contains(svc.getServiceTypeURI()))
+      {
+        if (match==null) {
+          // for moment we always pick service from server ordered first in user's preferences
+          match=svc;
+        }
+        if (urls.contains(svc.getUri()))
+        {
+          // stop and return - we've matched type URI and URI for service endpoint
+          return svc;
+        }
+      }
+    }
+    return match;
+  }
+  
+  Map<String, Map<String, String>> preferredServiceMap = new HashMap<String, Map<String, String>>();
+;
+
+  /**
+   * get current preferred service of the given type, or global default
+   * @param af null or a specific alignFrame 
+   * @param serviceType Jws2Instance.serviceType for service
+   * @return null if no service of this type is available, the preferred service for the serviceType and af if specified and if defined. 
+   */
+  public Jws2Instance getPreferredServiceFor(AlignFrame af,
+          String serviceType)
+  {
+    String serviceurl = null;
+    synchronized (preferredServiceMap)
+    {
+      String afid = (af == null) ? "" : af.getViewport().getSequenceSetId();
+      Map<String, String> prefmap = preferredServiceMap.get(afid);
+      if (afid.length() > 0 && prefmap == null)
+      {
+        // recover global setting, if any
+        prefmap = preferredServiceMap.get("");
+      }
+        if (prefmap != null)
+        {
+          serviceurl = prefmap.get(serviceType);
+        }
+      
+    }
+    Jws2Instance response = null;
+    for (Jws2Instance svc : services)
+    {
+      if (svc.serviceType.equals(serviceType))
+      {
+        if (serviceurl == null || serviceurl.equals(svc.getHost()))
+        {
+          response = svc;
+          break;
+        }
+      }
+    }
+    return response;
+  }
+
+  public void setPreferredServiceFor(AlignFrame af, String serviceType,
+          String serviceAction, Jws2Instance selectedServer)
+  {
+    String afid = (af == null) ? "" : af.getViewport().getSequenceSetId();
+    if (preferredServiceMap == null)
+    {
+      preferredServiceMap = new HashMap<String, Map<String, String>>();
+    }
+    Map<String, String> prefmap = preferredServiceMap.get(afid);
+    if (prefmap == null)
+    {
+      prefmap = new HashMap<String, String>();
+      preferredServiceMap.put(afid, prefmap);
+    }
+    prefmap.put(serviceType, selectedServer.getHost());
+    prefmap.put(serviceAction, selectedServer.getHost());
+  }
+
+  public void setPreferredServiceFor(String serviceType,
+          String serviceAction, Jws2Instance selectedServer)
+  {
+    setPreferredServiceFor(null, serviceType, serviceAction, selectedServer);
+  }
 }
index 77cf2ad..d72681d 100644 (file)
@@ -19,6 +19,7 @@ import javax.swing.event.MenuListener;
 import compbio.metadata.Argument;
 
 import jalview.api.AlignCalcWorkerI;
+import jalview.bin.Cache;
 import jalview.datamodel.AlignmentView;
 import jalview.gui.AlignFrame;
 import jalview.gui.Desktop;
@@ -29,12 +30,14 @@ import jalview.ws.jws2.jabaws2.Jws2Instance;
 import jalview.ws.params.WsParamSetI;
 
 /**
- * @author jimp
+ * @author jprocter 
  * 
  */
-public class SequenceAnnotationWSClient extends Jws2Client
+public class SequenceAnnotationWSClient extends Jws2Client 
 {
 
+  public static final String AAConsCalcId = "jabaws2.AACons";
+
   /**
    * initialise a client so its attachWSMenuEntry method can be called.
    */
@@ -49,7 +52,7 @@ public class SequenceAnnotationWSClient extends Jws2Client
     super(alignFrame, preset, null);
     initSequenceAnnotationWSClient(sh, alignFrame, preset, editParams);
   }
-  
+
   public void initSequenceAnnotationWSClient(final Jws2Instance sh,
           AlignFrame alignFrame, WsParamSetI preset, boolean editParams)
   {
@@ -80,9 +83,8 @@ public class SequenceAnnotationWSClient extends Jws2Client
                 .getViewport()
                 .getCalcManager()
                 .registerWorker(
-                        worker = new AAConsClient(sh, alignFrame, this.preset,
-                                paramset));
-        alignFrame.getViewport().setPreferredAAConsSettings(new AAConsSettings(true, sh, this.preset, paramset));
+                        worker = new AAConsClient(sh, alignFrame,
+                                this.preset, paramset));
         alignFrame.getViewport().getCalcManager().startWorker(worker);
 
       }
@@ -99,11 +101,10 @@ public class SequenceAnnotationWSClient extends Jws2Client
         {
           return;
         }
-        alignFrame.getViewport().setPreferredAAConsSettings(new AAConsSettings(true, sh, preset, paramset));
         // reinstate worker if it was blacklisted (might have happened due to
         // invalid parameters)
         alignFrame.getViewport().getCalcManager().workerMayRun(worker);
-        worker.updateParameters(preset, paramset);
+        worker.updateParameters(this.preset, paramset);
 
       }
     }
@@ -129,7 +130,8 @@ public class SequenceAnnotationWSClient extends Jws2Client
           AlignFrame alignFrame, boolean b)
   {
     super(alignFrame, fave.getPreset(), fave.getJobArgset());
-    initSequenceAnnotationWSClient(fave.getService(), alignFrame, fave.getPreset(), b);
+    initSequenceAnnotationWSClient(fave.getService(), alignFrame,
+            fave.getPreset(), b);
   }
 
   /*
@@ -213,8 +215,6 @@ public class SequenceAnnotationWSClient extends Jws2Client
           AAeditSettings = "Change AACons Settings...",
           AAeditSettingsTooltip = "Modify settings for AACons calculations.";
 
-  private SequenceAnnotationWSClient preferredAAConsClient = null;
-
   // private final enableAAConsCalculation(final AlignFrame alignFrame, )
   private void registerAAConsWSInstance(final JMenu wsmenu,
           final Jws2Instance service, final AlignFrame alignFrame)
@@ -230,8 +230,32 @@ public class SequenceAnnotationWSClient extends Jws2Client
         _aaConsEnabled = (JCheckBoxMenuItem) item;
       }
     }
+    // is there an aaCons worker already present - if so, set it to use the
+    // given service handle
+    {
+      List<AlignCalcWorkerI> aaconsClient = alignFrame.getViewport()
+              .getCalcManager()
+              .getRegisteredWorkersOfClass(AAConsClient.class);
+      if (aaconsClient != null && aaconsClient.size() > 0)
+      {
+        AAConsClient worker = (AAConsClient) aaconsClient.get(0);
+        if (!worker.service.hosturl.equals(service.hosturl))
+        {
+         // javax.swing.SwingUtilities.invokeLater(new Runnable()
+          {
+         //   @Override
+         //   public void run()
+            {
+              removeCurrentAAConsWorkerFor(alignFrame);
+              buildCurrentAAConsWorkerFor(alignFrame, service);
+            }
+          }//);
+        }
+      }
+    }
 
-    // is there a service already registered ?
+    // is there a service already registered ? there shouldn't be if we are
+    // being called correctly
     if (_aaConsEnabled == null)
     {
       final JCheckBoxMenuItem aaConsEnabled = new JCheckBoxMenuItem(
@@ -312,55 +336,101 @@ public class SequenceAnnotationWSClient extends Jws2Client
       wsmenu.add(modifyParams);
 
     }
-
   }
 
   private static void showAAConsAnnotationSettingsFor(AlignFrame alignFrame)
   {
     /*
-     * preferred settings
-     * Whether AACons is automatically recalculated
-     * Which AACons server to use
-     * What parameters to use
+     * preferred settings Whether AACons is automatically recalculated Which
+     * AACons server to use What parameters to use
      */
-    AAConsSettings fave= alignFrame.getViewport().getPreferredAAConsSettings();
-    if (fave==null)
+    // could actually do a class search for this too
+    AAConsSettings fave = (AAConsSettings) alignFrame.getViewport()
+            .getCalcIdSettingsFor(AAConsCalcId);
+    if (fave == null)
     {
       fave = createDefaultAAConsSettings();
     }
     new SequenceAnnotationWSClient(fave, alignFrame, true);
 
   }
+
   private static void buildCurrentAAConsWorkerFor(AlignFrame alignFrame)
   {
+    buildCurrentAAConsWorkerFor(alignFrame, null);
+  }
+
+  private static void buildCurrentAAConsWorkerFor(AlignFrame alignFrame,
+          Jws2Instance service)
+  {
     /*
-     * preferred settings
-     * Whether AACons is automatically recalculated
-     * Which AACons server to use
-     * What parameters to use
+     * preferred settings Whether AACons is automatically recalculated Which
+     * AACons server to use What parameters to use
      */
-    AAConsSettings fave= alignFrame.getViewport().getPreferredAAConsSettings();
-    if (fave==null)
+    AAConsSettings fave = (AAConsSettings) alignFrame.getViewport()
+            .getCalcIdSettingsFor(AAConsCalcId);
+    if (fave == null)
     {
-      fave = createDefaultAAConsSettings();
+      fave = createDefaultAAConsSettings(service);
+    }
+    else
+    {
+      if (service != null
+              && !fave.getService().hosturl.equals(service.hosturl))
+      {
+        Cache.log.debug("Changing AACons service to " + service.hosturl
+                + " from " + fave.getService().hosturl);
+        fave.setService(service);
+      }
     }
     new SequenceAnnotationWSClient(fave, alignFrame, false);
   }
 
   private static AAConsSettings createDefaultAAConsSettings()
   {
-    Jws2Instance service=null;
-    // set sensible defaults
-    for (Jws2Instance sv: Jws2Discoverer.getDiscoverer().getServices()) {
-      if (sv.serviceType.toString().equals(compbio.ws.client.Services.AAConWS.toString()))
+    return createDefaultAAConsSettings(null);
+  }
+
+  private static AAConsSettings createDefaultAAConsSettings(
+          Jws2Instance service)
+  {
+    if (service != null)
+    {
+      if (!service.serviceType.toString().equals(
+              compbio.ws.client.Services.AAConWS.toString()))
+      {
+        Cache.log
+                .warn("Ignoring invalid preferred service for AACons calculations (service type was "
+                        + service.serviceType + ")");
+        service = null;
+      }
+      else
       {
-        service = sv;
-        break;
+        // check service is actually in the list of currently avaialable
+        // services
+        if (!Jws2Discoverer.getDiscoverer().getServices().contains(service))
+        {
+          // it isn't ..
+          service = null;
+        }
       }
     }
-    if (service==null)
+    if (service == null)
+    {
+      // get the default service for AACons
+      service = Jws2Discoverer.getDiscoverer().getPreferredServiceFor(null,
+              compbio.ws.client.Services.AAConWS.toString());
+      /*
+       * for (Jws2Instance sv : Jws2Discoverer.getDiscoverer().getServices()) {
+       * if (sv.serviceType.toString().equals(
+       * compbio.ws.client.Services.AAConWS.toString())) { service = sv; break;
+       * } }
+       */
+    }
+    if (service == null)
     {
-      // TODO raise dialog box explaining error, and/or open the JABA preferences menu.
+      // TODO raise dialog box explaining error, and/or open the JABA
+      // preferences menu.
       throw new Error("No AACons service found.");
     }
     return new AAConsSettings(true, service, null, null);
index f2d7126..dbc86c4 100644 (file)
@@ -4,11 +4,15 @@ import java.util.ArrayList;
 import java.util.List;
 
 import compbio.metadata.Argument;
+import compbio.metadata.Option;
 import compbio.metadata.Preset;
 
+import jalview.ws.jws2.JabaParamStore;
 import jalview.ws.jws2.JabaPreset;
+import jalview.ws.jws2.ParameterUtils;
 import jalview.ws.jws2.jabaws2.Jws2Instance;
 import jalview.ws.params.ArgumentI;
+import jalview.ws.params.ParamManager;
 import jalview.ws.params.WsParamSetI;
 
 /**
@@ -17,34 +21,15 @@ import jalview.ws.params.WsParamSetI;
  * @author jprocter TODO: refactor to a generic 'last job and service run'
  *         container ?
  */
-public class AAConsSettings
+public class AAConsSettings extends jalview.ws.params.AutoCalcSetting 
 {
-  boolean autoUpdate;
-
   Jws2Instance service;
 
-  WsParamSetI preset;
-
-  List<Argument> jobArgset;
-
   public AAConsSettings(boolean autoUpdate, Jws2Instance service,
-          WsParamSetI preset, List<Argument> jobArgset)
+          WsParamSetI preset, List<ArgumentI> jobArgset)
   {
-    super();
-    this.autoUpdate = autoUpdate;
+    super(preset, jobArgset, autoUpdate);
     this.service = service;
-    this.preset = preset;
-    this.jobArgset = jobArgset;
-  }
-
-  public boolean isAutoUpdate()
-  {
-    return autoUpdate;
-  }
-
-  public void setAutoUpdate(boolean autoUpdate)
-  {
-    this.autoUpdate = autoUpdate;
   }
 
   public Jws2Instance getService()
@@ -93,26 +78,49 @@ public class AAConsSettings
     }
   }
 
-  public WsParamSetI getPreset()
+  public List<Argument> getJobArgset()
   {
-    return preset;
+    return jobArgset==null ? null : JabaParamStore.getJabafromJwsArgs(jobArgset);
   }
 
-  public void setPreset(WsParamSetI preset)
+  public void setJobArgset(List<Argument> jobArgset)
   {
-    // TODO: test if service URL is in presets
-    this.preset = preset;
+    // TODO: test if parameters valid for service
+    this.jobArgset = jobArgset==null ? null : JabaParamStore.getJwsArgsfromJaba(jobArgset);
   }
 
-  public List<Argument> getJobArgset()
+  public String getWsParamFile()
   {
-    return jobArgset;
+    List<Option> opts=null;
+    if (jobArgset!=null)
+    {
+      opts = JabaParamStore.getJabafromJwsArgs(jobArgset);
+    } else {
+      if (preset!=null)
+      {
+        opts = JabaParamStore.getJabafromJwsArgs(preset.getArguments());
+      }
+    }
+    if (opts==null  || opts.size()==0)
+    {
+      return "";
+    }
+    StringBuffer pset=new StringBuffer();
+    for (String ps:ParameterUtils.writeParameterSet(opts, " "))
+    {
+      pset.append(ps); pset.append("\n");
+    }
+    return pset.toString();
   }
 
-  public void setJobArgset(List<Argument> jobArgset)
+  @Override
+  public String getServiceURI()
   {
-    // TODO: test if parameters valid for service
-    this.jobArgset = jobArgset;
+    return service.getServiceTypeURI();
+  }
+  @Override
+  public String[] getServiceURLs()
+  {
+    return new String[] { service.getUri() };
   }
-
 }
index 49371a8..c8ed885 100644 (file)
@@ -182,4 +182,10 @@ public class Jws2Instance
       new SequenceAnnotationWSClient().attachWSMenuEntry(atpoint, this, alignFrame);
     }
   }
+
+  
+  public String getServiceTypeURI()
+  {
+    return "java:"+serviceType;
+  }
 }
\ No newline at end of file
diff --git a/src/jalview/ws/params/AutoCalcSetting.java b/src/jalview/ws/params/AutoCalcSetting.java
new file mode 100644 (file)
index 0000000..2c9cac5
--- /dev/null
@@ -0,0 +1,70 @@
+package jalview.ws.params;
+
+import java.util.List;
+
+public abstract class AutoCalcSetting
+{
+
+  protected boolean autoUpdate;
+
+  protected WsParamSetI preset;
+
+  protected List<ArgumentI> jobArgset;
+
+  public AutoCalcSetting(WsParamSetI preset2, List<ArgumentI> jobArgset2,
+          boolean autoUpdate2)
+  {
+    autoUpdate = autoUpdate2;
+    preset = preset2;
+    jobArgset = jobArgset2;
+  }
+
+  public boolean isAutoUpdate()
+  {
+    return autoUpdate;
+  }
+
+  public void setAutoUpdate(boolean autoUpdate)
+  {
+    this.autoUpdate = autoUpdate;
+  }
+
+  public WsParamSetI getPreset()
+  {
+    return preset;
+  }
+
+  public void setPreset(WsParamSetI preset)
+  {
+    // TODO: test if service URL is in presets
+    this.preset = preset;
+  }
+
+  public List<ArgumentI> getArgumentSet()
+  {
+    return jobArgset;
+  }
+
+  /**
+   * 
+   * @return characteristic URI for this service. The URI should reflect the
+   *         type and version of this service, enabling the service client code
+   *         to recover the correct client for this calculation.
+   */
+  public abstract String getServiceURI();
+
+  /**
+   * return any concrete service endpoints associated with this calculation.
+   * built in services should return a zero length array
+   * 
+   * @return
+   */
+  public abstract String[] getServiceURLs();
+
+  /**
+   * 
+   * @return stringified representation of the parameters for this setting
+   */
+  public abstract String getWsParamFile();
+
+}