68a225a21dffaa90c0836548a7caf1b5bcf7993b
[jalview.git] / src / jalview / schemabinding / version2 / StructureState.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
3  * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
4  * 
5  * This file is part of Jalview.
6  * 
7  * Jalview is free software: you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License 
9  * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
10  *  
11  * Jalview is distributed in the hope that it will be useful, but 
12  * WITHOUT ANY WARRANTY; without even the implied warranty 
13  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
14  * PURPOSE.  See the GNU General Public License for more details.
15  * 
16  * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
17  */
18 package jalview.schemabinding.version2;
19
20 //---------------------------------/
21 //- Imported classes and packages -/
22 //---------------------------------/
23
24 import org.exolab.castor.xml.Marshaller;
25 import org.exolab.castor.xml.Unmarshaller;
26
27 /**
28  * Class StructureState.
29  * 
30  * @version $Revision$ $Date$
31  */
32 public class StructureState implements java.io.Serializable
33 {
34
35   // --------------------------/
36   // - Class/Member Variables -/
37   // --------------------------/
38
39   /**
40    * internal content storage
41    */
42   private java.lang.String _content = "";
43
44   /**
45    * Field _visible.
46    */
47   private boolean _visible;
48
49   /**
50    * keeps track of state for field: _visible
51    */
52   private boolean _has_visible;
53
54   /**
55    * additional identifier which properly disambiguates the structure view from
56    * any other view with the same attributes. This is not an ID, because it is
57    * possible to have many references to the same physical structure view from
58    * different sequences in an alignment. A structureState element citing the
59    * same viewId will appear for each instance.
60    * 
61    */
62   private java.lang.String _viewId;
63
64   /**
65    * Flag set if the alignment panel containing this JSeq should be included in
66    * those used to perform a structure superposition (since Jalview 2.7).
67    * 
68    */
69   private boolean _alignwithAlignPanel = true;
70
71   /**
72    * keeps track of state for field: _alignwithAlignPanel
73    */
74   private boolean _has_alignwithAlignPanel;
75
76   /**
77    * Flag set if the alignment panel containing this JSeq should be included in
78    * those used to colour its associated sequences in this structureState(since
79    * Jalview 2.7).
80    * 
81    */
82   private boolean _colourwithAlignPanel = false;
83
84   /**
85    * keeps track of state for field: _colourwithAlignPanel
86    */
87   private boolean _has_colourwithAlignPanel;
88
89   /**
90    * Flag set if the structure display is coloured by the Jmol state, rather
91    * than by one or more linked alignment views.
92    * 
93    */
94   private boolean _colourByJmol = true;
95
96   /**
97    * keeps track of state for field: _colourByJmol
98    */
99   private boolean _has_colourByJmol;
100
101   /**
102    * Field _width.
103    */
104   private int _width;
105
106   /**
107    * keeps track of state for field: _width
108    */
109   private boolean _has_width;
110
111   /**
112    * Field _height.
113    */
114   private int _height;
115
116   /**
117    * keeps track of state for field: _height
118    */
119   private boolean _has_height;
120
121   /**
122    * Field _xpos.
123    */
124   private int _xpos;
125
126   /**
127    * keeps track of state for field: _xpos
128    */
129   private boolean _has_xpos;
130
131   /**
132    * Field _ypos.
133    */
134   private int _ypos;
135
136   /**
137    * keeps track of state for field: _ypos
138    */
139   private boolean _has_ypos;
140
141   // ----------------/
142   // - Constructors -/
143   // ----------------/
144
145   public StructureState()
146   {
147     super();
148     setContent("");
149   }
150
151   // -----------/
152   // - Methods -/
153   // -----------/
154
155   /**
156      */
157   public void deleteAlignwithAlignPanel()
158   {
159     this._has_alignwithAlignPanel = false;
160   }
161
162   /**
163      */
164   public void deleteColourByJmol()
165   {
166     this._has_colourByJmol = false;
167   }
168
169   /**
170      */
171   public void deleteColourwithAlignPanel()
172   {
173     this._has_colourwithAlignPanel = false;
174   }
175
176   /**
177      */
178   public void deleteHeight()
179   {
180     this._has_height = false;
181   }
182
183   /**
184      */
185   public void deleteVisible()
186   {
187     this._has_visible = false;
188   }
189
190   /**
191      */
192   public void deleteWidth()
193   {
194     this._has_width = false;
195   }
196
197   /**
198      */
199   public void deleteXpos()
200   {
201     this._has_xpos = false;
202   }
203
204   /**
205      */
206   public void deleteYpos()
207   {
208     this._has_ypos = false;
209   }
210
211   /**
212    * Returns the value of field 'alignwithAlignPanel'. The field
213    * 'alignwithAlignPanel' has the following description: Flag set if the
214    * alignment panel containing this JSeq should be included in those used to
215    * perform a structure superposition (since Jalview 2.7).
216    * 
217    * 
218    * @return the value of field 'AlignwithAlignPanel'.
219    */
220   public boolean getAlignwithAlignPanel()
221   {
222     return this._alignwithAlignPanel;
223   }
224
225   /**
226    * Returns the value of field 'colourByJmol'. The field 'colourByJmol' has the
227    * following description: Flag set if the structure display is coloured by the
228    * Jmol state, rather than by one or more linked alignment views.
229    * 
230    * 
231    * @return the value of field 'ColourByJmol'.
232    */
233   public boolean getColourByJmol()
234   {
235     return this._colourByJmol;
236   }
237
238   /**
239    * Returns the value of field 'colourwithAlignPanel'. The field
240    * 'colourwithAlignPanel' has the following description: Flag set if the
241    * alignment panel containing this JSeq should be included in those used to
242    * colour its associated sequences in this structureState(since Jalview 2.7).
243    * 
244    * 
245    * @return the value of field 'ColourwithAlignPanel'.
246    */
247   public boolean getColourwithAlignPanel()
248   {
249     return this._colourwithAlignPanel;
250   }
251
252   /**
253    * Returns the value of field 'content'. The field 'content' has the following
254    * description: internal content storage
255    * 
256    * @return the value of field 'Content'.
257    */
258   public java.lang.String getContent()
259   {
260     return this._content;
261   }
262
263   /**
264    * Returns the value of field 'height'.
265    * 
266    * @return the value of field 'Height'.
267    */
268   public int getHeight()
269   {
270     return this._height;
271   }
272
273   /**
274    * Returns the value of field 'viewId'. The field 'viewId' has the following
275    * description: additional identifier which properly disambiguates the
276    * structure view from any other view with the same attributes. This is not an
277    * ID, because it is possible to have many references to the same physical
278    * structure view from different sequences in an alignment. A structureState
279    * element citing the same viewId will appear for each instance.
280    * 
281    * 
282    * @return the value of field 'ViewId'.
283    */
284   public java.lang.String getViewId()
285   {
286     return this._viewId;
287   }
288
289   /**
290    * Returns the value of field 'visible'.
291    * 
292    * @return the value of field 'Visible'.
293    */
294   public boolean getVisible()
295   {
296     return this._visible;
297   }
298
299   /**
300    * Returns the value of field 'width'.
301    * 
302    * @return the value of field 'Width'.
303    */
304   public int getWidth()
305   {
306     return this._width;
307   }
308
309   /**
310    * Returns the value of field 'xpos'.
311    * 
312    * @return the value of field 'Xpos'.
313    */
314   public int getXpos()
315   {
316     return this._xpos;
317   }
318
319   /**
320    * Returns the value of field 'ypos'.
321    * 
322    * @return the value of field 'Ypos'.
323    */
324   public int getYpos()
325   {
326     return this._ypos;
327   }
328
329   /**
330    * Method hasAlignwithAlignPanel.
331    * 
332    * @return true if at least one AlignwithAlignPanel has been added
333    */
334   public boolean hasAlignwithAlignPanel()
335   {
336     return this._has_alignwithAlignPanel;
337   }
338
339   /**
340    * Method hasColourByJmol.
341    * 
342    * @return true if at least one ColourByJmol has been added
343    */
344   public boolean hasColourByJmol()
345   {
346     return this._has_colourByJmol;
347   }
348
349   /**
350    * Method hasColourwithAlignPanel.
351    * 
352    * @return true if at least one ColourwithAlignPanel has been added
353    */
354   public boolean hasColourwithAlignPanel()
355   {
356     return this._has_colourwithAlignPanel;
357   }
358
359   /**
360    * Method hasHeight.
361    * 
362    * @return true if at least one Height has been added
363    */
364   public boolean hasHeight()
365   {
366     return this._has_height;
367   }
368
369   /**
370    * Method hasVisible.
371    * 
372    * @return true if at least one Visible has been added
373    */
374   public boolean hasVisible()
375   {
376     return this._has_visible;
377   }
378
379   /**
380    * Method hasWidth.
381    * 
382    * @return true if at least one Width has been added
383    */
384   public boolean hasWidth()
385   {
386     return this._has_width;
387   }
388
389   /**
390    * Method hasXpos.
391    * 
392    * @return true if at least one Xpos has been added
393    */
394   public boolean hasXpos()
395   {
396     return this._has_xpos;
397   }
398
399   /**
400    * Method hasYpos.
401    * 
402    * @return true if at least one Ypos has been added
403    */
404   public boolean hasYpos()
405   {
406     return this._has_ypos;
407   }
408
409   /**
410    * Returns the value of field 'alignwithAlignPanel'. The field
411    * 'alignwithAlignPanel' has the following description: Flag set if the
412    * alignment panel containing this JSeq should be included in those used to
413    * perform a structure superposition (since Jalview 2.7).
414    * 
415    * 
416    * @return the value of field 'AlignwithAlignPanel'.
417    */
418   public boolean isAlignwithAlignPanel()
419   {
420     return this._alignwithAlignPanel;
421   }
422
423   /**
424    * Returns the value of field 'colourByJmol'. The field 'colourByJmol' has the
425    * following description: Flag set if the structure display is coloured by the
426    * Jmol state, rather than by one or more linked alignment views.
427    * 
428    * 
429    * @return the value of field 'ColourByJmol'.
430    */
431   public boolean isColourByJmol()
432   {
433     return this._colourByJmol;
434   }
435
436   /**
437    * Returns the value of field 'colourwithAlignPanel'. The field
438    * 'colourwithAlignPanel' has the following description: Flag set if the
439    * alignment panel containing this JSeq should be included in those used to
440    * colour its associated sequences in this structureState(since Jalview 2.7).
441    * 
442    * 
443    * @return the value of field 'ColourwithAlignPanel'.
444    */
445   public boolean isColourwithAlignPanel()
446   {
447     return this._colourwithAlignPanel;
448   }
449
450   /**
451    * Method isValid.
452    * 
453    * @return true if this object is valid according to the schema
454    */
455   public boolean isValid()
456   {
457     try
458     {
459       validate();
460     } catch (org.exolab.castor.xml.ValidationException vex)
461     {
462       return false;
463     }
464     return true;
465   }
466
467   /**
468    * Returns the value of field 'visible'.
469    * 
470    * @return the value of field 'Visible'.
471    */
472   public boolean isVisible()
473   {
474     return this._visible;
475   }
476
477   /**
478    * 
479    * 
480    * @param out
481    * @throws org.exolab.castor.xml.MarshalException
482    *           if object is null or if any SAXException is thrown during
483    *           marshaling
484    * @throws org.exolab.castor.xml.ValidationException
485    *           if this object is an invalid instance according to the schema
486    */
487   public void marshal(final java.io.Writer out)
488           throws org.exolab.castor.xml.MarshalException,
489           org.exolab.castor.xml.ValidationException
490   {
491     Marshaller.marshal(this, out);
492   }
493
494   /**
495    * 
496    * 
497    * @param handler
498    * @throws java.io.IOException
499    *           if an IOException occurs during marshaling
500    * @throws org.exolab.castor.xml.ValidationException
501    *           if this object is an invalid instance according to the schema
502    * @throws org.exolab.castor.xml.MarshalException
503    *           if object is null or if any SAXException is thrown during
504    *           marshaling
505    */
506   public void marshal(final org.xml.sax.ContentHandler handler)
507           throws java.io.IOException,
508           org.exolab.castor.xml.MarshalException,
509           org.exolab.castor.xml.ValidationException
510   {
511     Marshaller.marshal(this, handler);
512   }
513
514   /**
515    * Sets the value of field 'alignwithAlignPanel'. The field
516    * 'alignwithAlignPanel' has the following description: Flag set if the
517    * alignment panel containing this JSeq should be included in those used to
518    * perform a structure superposition (since Jalview 2.7).
519    * 
520    * 
521    * @param alignwithAlignPanel
522    *          the value of field 'alignwithAlignPanel'.
523    */
524   public void setAlignwithAlignPanel(final boolean alignwithAlignPanel)
525   {
526     this._alignwithAlignPanel = alignwithAlignPanel;
527     this._has_alignwithAlignPanel = true;
528   }
529
530   /**
531    * Sets the value of field 'colourByJmol'. The field 'colourByJmol' has the
532    * following description: Flag set if the structure display is coloured by the
533    * Jmol state, rather than by one or more linked alignment views.
534    * 
535    * 
536    * @param colourByJmol
537    *          the value of field 'colourByJmol'.
538    */
539   public void setColourByJmol(final boolean colourByJmol)
540   {
541     this._colourByJmol = colourByJmol;
542     this._has_colourByJmol = true;
543   }
544
545   /**
546    * Sets the value of field 'colourwithAlignPanel'. The field
547    * 'colourwithAlignPanel' has the following description: Flag set if the
548    * alignment panel containing this JSeq should be included in those used to
549    * colour its associated sequences in this structureState(since Jalview 2.7).
550    * 
551    * 
552    * @param colourwithAlignPanel
553    *          the value of field 'colourwithAlignPanel'.
554    */
555   public void setColourwithAlignPanel(final boolean colourwithAlignPanel)
556   {
557     this._colourwithAlignPanel = colourwithAlignPanel;
558     this._has_colourwithAlignPanel = true;
559   }
560
561   /**
562    * Sets the value of field 'content'. The field 'content' has the following
563    * description: internal content storage
564    * 
565    * @param content
566    *          the value of field 'content'.
567    */
568   public void setContent(final java.lang.String content)
569   {
570     this._content = content;
571   }
572
573   /**
574    * Sets the value of field 'height'.
575    * 
576    * @param height
577    *          the value of field 'height'.
578    */
579   public void setHeight(final int height)
580   {
581     this._height = height;
582     this._has_height = true;
583   }
584
585   /**
586    * Sets the value of field 'viewId'. The field 'viewId' has the following
587    * description: additional identifier which properly disambiguates the
588    * structure view from any other view with the same attributes. This is not an
589    * ID, because it is possible to have many references to the same physical
590    * structure view from different sequences in an alignment. A structureState
591    * element citing the same viewId will appear for each instance.
592    * 
593    * 
594    * @param viewId
595    *          the value of field 'viewId'.
596    */
597   public void setViewId(final java.lang.String viewId)
598   {
599     this._viewId = viewId;
600   }
601
602   /**
603    * Sets the value of field 'visible'.
604    * 
605    * @param visible
606    *          the value of field 'visible'.
607    */
608   public void setVisible(final boolean visible)
609   {
610     this._visible = visible;
611     this._has_visible = true;
612   }
613
614   /**
615    * Sets the value of field 'width'.
616    * 
617    * @param width
618    *          the value of field 'width'.
619    */
620   public void setWidth(final int width)
621   {
622     this._width = width;
623     this._has_width = true;
624   }
625
626   /**
627    * Sets the value of field 'xpos'.
628    * 
629    * @param xpos
630    *          the value of field 'xpos'.
631    */
632   public void setXpos(final int xpos)
633   {
634     this._xpos = xpos;
635     this._has_xpos = true;
636   }
637
638   /**
639    * Sets the value of field 'ypos'.
640    * 
641    * @param ypos
642    *          the value of field 'ypos'.
643    */
644   public void setYpos(final int ypos)
645   {
646     this._ypos = ypos;
647     this._has_ypos = true;
648   }
649
650   /**
651    * Method unmarshal.
652    * 
653    * @param reader
654    * @throws org.exolab.castor.xml.MarshalException
655    *           if object is null or if any SAXException is thrown during
656    *           marshaling
657    * @throws org.exolab.castor.xml.ValidationException
658    *           if this object is an invalid instance according to the schema
659    * @return the unmarshaled jalview.schemabinding.version2.StructureState
660    */
661   public static jalview.schemabinding.version2.StructureState unmarshal(
662           final java.io.Reader reader)
663           throws org.exolab.castor.xml.MarshalException,
664           org.exolab.castor.xml.ValidationException
665   {
666     return (jalview.schemabinding.version2.StructureState) Unmarshaller
667             .unmarshal(jalview.schemabinding.version2.StructureState.class,
668                     reader);
669   }
670
671   /**
672    * 
673    * 
674    * @throws org.exolab.castor.xml.ValidationException
675    *           if this object is an invalid instance according to the schema
676    */
677   public void validate() throws org.exolab.castor.xml.ValidationException
678   {
679     org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
680     validator.validate(this);
681   }
682
683 }