JAL-3181 refactor: extracted buildLinkMenu() for testability
[jalview.git] / src / jalview / schemabinding / version2 / RnaViewer.java
1 /*
2  * This class was automatically generated with 
3  * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
4  * Schema.
5  * $Id$
6  */
7
8 package jalview.schemabinding.version2;
9
10 //---------------------------------/
11 //- Imported classes and packages -/
12 //---------------------------------/
13
14 import org.exolab.castor.xml.Marshaller;
15 import org.exolab.castor.xml.Unmarshaller;
16
17 /**
18  * Reference to a viewer showing RNA structure for this sequence. Schema
19  * supports one viewer showing multiple annotations for multiple sequences,
20  * though currently only one annotation for one sequence (gapped or trimmed) is
21  * used
22  * 
23  * 
24  * @version $Revision$ $Date$
25  */
26 public class RnaViewer implements java.io.Serializable
27 {
28
29   // --------------------------/
30   // - Class/Member Variables -/
31   // --------------------------/
32
33   /**
34    * Field _title.
35    */
36   private java.lang.String _title;
37
38   /**
39    * An id unique to the RNA viewer panel
40    * 
41    */
42   private java.lang.String _viewId;
43
44   /**
45    * horizontal position of split pane divider
46    * 
47    */
48   private int _dividerLocation;
49
50   /**
51    * keeps track of state for field: _dividerLocation
52    */
53   private boolean _has_dividerLocation;
54
55   /**
56    * Index of the selected structure in the viewer panel
57    * 
58    */
59   private int _selectedRna;
60
61   /**
62    * keeps track of state for field: _selectedRna
63    */
64   private boolean _has_selectedRna;
65
66   /**
67    * Field _width.
68    */
69   private int _width;
70
71   /**
72    * keeps track of state for field: _width
73    */
74   private boolean _has_width;
75
76   /**
77    * Field _height.
78    */
79   private int _height;
80
81   /**
82    * keeps track of state for field: _height
83    */
84   private boolean _has_height;
85
86   /**
87    * Field _xpos.
88    */
89   private int _xpos;
90
91   /**
92    * keeps track of state for field: _xpos
93    */
94   private boolean _has_xpos;
95
96   /**
97    * Field _ypos.
98    */
99   private int _ypos;
100
101   /**
102    * keeps track of state for field: _ypos
103    */
104   private boolean _has_ypos;
105
106   /**
107    * Field _secondaryStructureList.
108    */
109   private java.util.Vector _secondaryStructureList;
110
111   // ----------------/
112   // - Constructors -/
113   // ----------------/
114
115   public RnaViewer()
116   {
117     super();
118     this._secondaryStructureList = new java.util.Vector();
119   }
120
121   // -----------/
122   // - Methods -/
123   // -----------/
124
125   /**
126    * 
127    * 
128    * @param vSecondaryStructure
129    * @throws java.lang.IndexOutOfBoundsException
130    *           if the index given is outside the bounds of the collection
131    */
132   public void addSecondaryStructure(
133           final jalview.schemabinding.version2.SecondaryStructure vSecondaryStructure)
134           throws java.lang.IndexOutOfBoundsException
135   {
136     this._secondaryStructureList.addElement(vSecondaryStructure);
137   }
138
139   /**
140    * 
141    * 
142    * @param index
143    * @param vSecondaryStructure
144    * @throws java.lang.IndexOutOfBoundsException
145    *           if the index given is outside the bounds of the collection
146    */
147   public void addSecondaryStructure(
148           final int index,
149           final jalview.schemabinding.version2.SecondaryStructure vSecondaryStructure)
150           throws java.lang.IndexOutOfBoundsException
151   {
152     this._secondaryStructureList.add(index, vSecondaryStructure);
153   }
154
155   /**
156      */
157   public void deleteDividerLocation()
158   {
159     this._has_dividerLocation = false;
160   }
161
162   /**
163      */
164   public void deleteHeight()
165   {
166     this._has_height = false;
167   }
168
169   /**
170      */
171   public void deleteSelectedRna()
172   {
173     this._has_selectedRna = false;
174   }
175
176   /**
177      */
178   public void deleteWidth()
179   {
180     this._has_width = false;
181   }
182
183   /**
184      */
185   public void deleteXpos()
186   {
187     this._has_xpos = false;
188   }
189
190   /**
191      */
192   public void deleteYpos()
193   {
194     this._has_ypos = false;
195   }
196
197   /**
198    * Method enumerateSecondaryStructure.
199    * 
200    * @return an Enumeration over all
201    *         jalview.schemabinding.version2.SecondaryStructure elements
202    */
203   public java.util.Enumeration enumerateSecondaryStructure()
204   {
205     return this._secondaryStructureList.elements();
206   }
207
208   /**
209    * Returns the value of field 'dividerLocation'. The field 'dividerLocation'
210    * has the following description: horizontal position of split pane divider
211    * 
212    * 
213    * @return the value of field 'DividerLocation'.
214    */
215   public int getDividerLocation()
216   {
217     return this._dividerLocation;
218   }
219
220   /**
221    * Returns the value of field 'height'.
222    * 
223    * @return the value of field 'Height'.
224    */
225   public int getHeight()
226   {
227     return this._height;
228   }
229
230   /**
231    * Method getSecondaryStructure.
232    * 
233    * @param index
234    * @throws java.lang.IndexOutOfBoundsException
235    *           if the index given is outside the bounds of the collection
236    * @return the value of the jalview.schemabinding.version2.SecondaryStructure
237    *         at the given index
238    */
239   public jalview.schemabinding.version2.SecondaryStructure getSecondaryStructure(
240           final int index) throws java.lang.IndexOutOfBoundsException
241   {
242     // check bounds for index
243     if (index < 0 || index >= this._secondaryStructureList.size())
244     {
245       throw new IndexOutOfBoundsException(
246               "getSecondaryStructure: Index value '" + index
247                       + "' not in range [0.."
248                       + (this._secondaryStructureList.size() - 1) + "]");
249     }
250
251     return (jalview.schemabinding.version2.SecondaryStructure) _secondaryStructureList
252             .get(index);
253   }
254
255   /**
256    * Method getSecondaryStructure.Returns the contents of the collection in an
257    * Array.
258    * <p>
259    * Note: Just in case the collection contents are changing in another thread,
260    * we pass a 0-length Array of the correct type into the API call. This way we
261    * <i>know</i> that the Array returned is of exactly the correct length.
262    * 
263    * @return this collection as an Array
264    */
265   public jalview.schemabinding.version2.SecondaryStructure[] getSecondaryStructure()
266   {
267     jalview.schemabinding.version2.SecondaryStructure[] array = new jalview.schemabinding.version2.SecondaryStructure[0];
268     return (jalview.schemabinding.version2.SecondaryStructure[]) this._secondaryStructureList
269             .toArray(array);
270   }
271
272   /**
273    * Method getSecondaryStructureCount.
274    * 
275    * @return the size of this collection
276    */
277   public int getSecondaryStructureCount()
278   {
279     return this._secondaryStructureList.size();
280   }
281
282   /**
283    * Returns the value of field 'selectedRna'. The field 'selectedRna' has the
284    * following description: Index of the selected structure in the viewer panel
285    * 
286    * 
287    * @return the value of field 'SelectedRna'.
288    */
289   public int getSelectedRna()
290   {
291     return this._selectedRna;
292   }
293
294   /**
295    * Returns the value of field 'title'.
296    * 
297    * @return the value of field 'Title'.
298    */
299   public java.lang.String getTitle()
300   {
301     return this._title;
302   }
303
304   /**
305    * Returns the value of field 'viewId'. The field 'viewId' has the following
306    * description: An id unique to the RNA viewer panel
307    * 
308    * 
309    * @return the value of field 'ViewId'.
310    */
311   public java.lang.String getViewId()
312   {
313     return this._viewId;
314   }
315
316   /**
317    * Returns the value of field 'width'.
318    * 
319    * @return the value of field 'Width'.
320    */
321   public int getWidth()
322   {
323     return this._width;
324   }
325
326   /**
327    * Returns the value of field 'xpos'.
328    * 
329    * @return the value of field 'Xpos'.
330    */
331   public int getXpos()
332   {
333     return this._xpos;
334   }
335
336   /**
337    * Returns the value of field 'ypos'.
338    * 
339    * @return the value of field 'Ypos'.
340    */
341   public int getYpos()
342   {
343     return this._ypos;
344   }
345
346   /**
347    * Method hasDividerLocation.
348    * 
349    * @return true if at least one DividerLocation has been added
350    */
351   public boolean hasDividerLocation()
352   {
353     return this._has_dividerLocation;
354   }
355
356   /**
357    * Method hasHeight.
358    * 
359    * @return true if at least one Height has been added
360    */
361   public boolean hasHeight()
362   {
363     return this._has_height;
364   }
365
366   /**
367    * Method hasSelectedRna.
368    * 
369    * @return true if at least one SelectedRna has been added
370    */
371   public boolean hasSelectedRna()
372   {
373     return this._has_selectedRna;
374   }
375
376   /**
377    * Method hasWidth.
378    * 
379    * @return true if at least one Width has been added
380    */
381   public boolean hasWidth()
382   {
383     return this._has_width;
384   }
385
386   /**
387    * Method hasXpos.
388    * 
389    * @return true if at least one Xpos has been added
390    */
391   public boolean hasXpos()
392   {
393     return this._has_xpos;
394   }
395
396   /**
397    * Method hasYpos.
398    * 
399    * @return true if at least one Ypos has been added
400    */
401   public boolean hasYpos()
402   {
403     return this._has_ypos;
404   }
405
406   /**
407    * Method isValid.
408    * 
409    * @return true if this object is valid according to the schema
410    */
411   public boolean isValid()
412   {
413     try
414     {
415       validate();
416     } catch (org.exolab.castor.xml.ValidationException vex)
417     {
418       return false;
419     }
420     return true;
421   }
422
423   /**
424    * 
425    * 
426    * @param out
427    * @throws org.exolab.castor.xml.MarshalException
428    *           if object is null or if any SAXException is thrown during
429    *           marshaling
430    * @throws org.exolab.castor.xml.ValidationException
431    *           if this object is an invalid instance according to the schema
432    */
433   public void marshal(final java.io.Writer out)
434           throws org.exolab.castor.xml.MarshalException,
435           org.exolab.castor.xml.ValidationException
436   {
437     Marshaller.marshal(this, out);
438   }
439
440   /**
441    * 
442    * 
443    * @param handler
444    * @throws java.io.IOException
445    *           if an IOException occurs during marshaling
446    * @throws org.exolab.castor.xml.ValidationException
447    *           if this object is an invalid instance according to the schema
448    * @throws org.exolab.castor.xml.MarshalException
449    *           if object is null or if any SAXException is thrown during
450    *           marshaling
451    */
452   public void marshal(final org.xml.sax.ContentHandler handler)
453           throws java.io.IOException,
454           org.exolab.castor.xml.MarshalException,
455           org.exolab.castor.xml.ValidationException
456   {
457     Marshaller.marshal(this, handler);
458   }
459
460   /**
461      */
462   public void removeAllSecondaryStructure()
463   {
464     this._secondaryStructureList.clear();
465   }
466
467   /**
468    * Method removeSecondaryStructure.
469    * 
470    * @param vSecondaryStructure
471    * @return true if the object was removed from the collection.
472    */
473   public boolean removeSecondaryStructure(
474           final jalview.schemabinding.version2.SecondaryStructure vSecondaryStructure)
475   {
476     boolean removed = _secondaryStructureList.remove(vSecondaryStructure);
477     return removed;
478   }
479
480   /**
481    * Method removeSecondaryStructureAt.
482    * 
483    * @param index
484    * @return the element removed from the collection
485    */
486   public jalview.schemabinding.version2.SecondaryStructure removeSecondaryStructureAt(
487           final int index)
488   {
489     java.lang.Object obj = this._secondaryStructureList.remove(index);
490     return (jalview.schemabinding.version2.SecondaryStructure) obj;
491   }
492
493   /**
494    * Sets the value of field 'dividerLocation'. The field 'dividerLocation' has
495    * the following description: horizontal position of split pane divider
496    * 
497    * 
498    * @param dividerLocation
499    *          the value of field 'dividerLocation'.
500    */
501   public void setDividerLocation(final int dividerLocation)
502   {
503     this._dividerLocation = dividerLocation;
504     this._has_dividerLocation = true;
505   }
506
507   /**
508    * Sets the value of field 'height'.
509    * 
510    * @param height
511    *          the value of field 'height'.
512    */
513   public void setHeight(final int height)
514   {
515     this._height = height;
516     this._has_height = true;
517   }
518
519   /**
520    * 
521    * 
522    * @param index
523    * @param vSecondaryStructure
524    * @throws java.lang.IndexOutOfBoundsException
525    *           if the index given is outside the bounds of the collection
526    */
527   public void setSecondaryStructure(
528           final int index,
529           final jalview.schemabinding.version2.SecondaryStructure vSecondaryStructure)
530           throws java.lang.IndexOutOfBoundsException
531   {
532     // check bounds for index
533     if (index < 0 || index >= this._secondaryStructureList.size())
534     {
535       throw new IndexOutOfBoundsException(
536               "setSecondaryStructure: Index value '" + index
537                       + "' not in range [0.."
538                       + (this._secondaryStructureList.size() - 1) + "]");
539     }
540
541     this._secondaryStructureList.set(index, vSecondaryStructure);
542   }
543
544   /**
545    * 
546    * 
547    * @param vSecondaryStructureArray
548    */
549   public void setSecondaryStructure(
550           final jalview.schemabinding.version2.SecondaryStructure[] vSecondaryStructureArray)
551   {
552     // -- copy array
553     _secondaryStructureList.clear();
554
555     for (int i = 0; i < vSecondaryStructureArray.length; i++)
556     {
557       this._secondaryStructureList.add(vSecondaryStructureArray[i]);
558     }
559   }
560
561   /**
562    * Sets the value of field 'selectedRna'. The field 'selectedRna' has the
563    * following description: Index of the selected structure in the viewer panel
564    * 
565    * 
566    * @param selectedRna
567    *          the value of field 'selectedRna'.
568    */
569   public void setSelectedRna(final int selectedRna)
570   {
571     this._selectedRna = selectedRna;
572     this._has_selectedRna = true;
573   }
574
575   /**
576    * Sets the value of field 'title'.
577    * 
578    * @param title
579    *          the value of field 'title'.
580    */
581   public void setTitle(final java.lang.String title)
582   {
583     this._title = title;
584   }
585
586   /**
587    * Sets the value of field 'viewId'. The field 'viewId' has the following
588    * description: An id unique to the RNA viewer panel
589    * 
590    * 
591    * @param viewId
592    *          the value of field 'viewId'.
593    */
594   public void setViewId(final java.lang.String viewId)
595   {
596     this._viewId = viewId;
597   }
598
599   /**
600    * Sets the value of field 'width'.
601    * 
602    * @param width
603    *          the value of field 'width'.
604    */
605   public void setWidth(final int width)
606   {
607     this._width = width;
608     this._has_width = true;
609   }
610
611   /**
612    * Sets the value of field 'xpos'.
613    * 
614    * @param xpos
615    *          the value of field 'xpos'.
616    */
617   public void setXpos(final int xpos)
618   {
619     this._xpos = xpos;
620     this._has_xpos = true;
621   }
622
623   /**
624    * Sets the value of field 'ypos'.
625    * 
626    * @param ypos
627    *          the value of field 'ypos'.
628    */
629   public void setYpos(final int ypos)
630   {
631     this._ypos = ypos;
632     this._has_ypos = true;
633   }
634
635   /**
636    * Method unmarshal.
637    * 
638    * @param reader
639    * @throws org.exolab.castor.xml.MarshalException
640    *           if object is null or if any SAXException is thrown during
641    *           marshaling
642    * @throws org.exolab.castor.xml.ValidationException
643    *           if this object is an invalid instance according to the schema
644    * @return the unmarshaled jalview.schemabinding.version2.RnaViewer
645    */
646   public static jalview.schemabinding.version2.RnaViewer unmarshal(
647           final java.io.Reader reader)
648           throws org.exolab.castor.xml.MarshalException,
649           org.exolab.castor.xml.ValidationException
650   {
651     return (jalview.schemabinding.version2.RnaViewer) Unmarshaller
652             .unmarshal(jalview.schemabinding.version2.RnaViewer.class,
653                     reader);
654   }
655
656   /**
657    * 
658    * 
659    * @throws org.exolab.castor.xml.ValidationException
660    *           if this object is an invalid instance according to the schema
661    */
662   public void validate() throws org.exolab.castor.xml.ValidationException
663   {
664     org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
665     validator.validate(this);
666   }
667
668 }