JAL-1432 updated copyright notices
[jalview.git] / src / jalview / schemabinding / version2 / descriptors / StructureStateDescriptor.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.0b1)
3  * Copyright (C) 2014 The Jalview Authors
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  * The Jalview Authors are detailed in the 'AUTHORS' file.
18  */
19 package jalview.schemabinding.version2.descriptors;
20
21 //---------------------------------/
22 //- Imported classes and packages -/
23 //---------------------------------/
24
25 import jalview.schemabinding.version2.StructureState;
26
27 /**
28  * Class StructureStateDescriptor.
29  * 
30  * @version $Revision$ $Date$
31  */
32 public class StructureStateDescriptor extends
33         org.exolab.castor.xml.util.XMLClassDescriptorImpl
34 {
35
36   // --------------------------/
37   // - Class/Member Variables -/
38   // --------------------------/
39
40   /**
41    * Field _elementDefinition.
42    */
43   private boolean _elementDefinition;
44
45   /**
46    * Field _nsPrefix.
47    */
48   private java.lang.String _nsPrefix;
49
50   /**
51    * Field _nsURI.
52    */
53   private java.lang.String _nsURI;
54
55   /**
56    * Field _xmlName.
57    */
58   private java.lang.String _xmlName;
59
60   // ----------------/
61   // - Constructors -/
62   // ----------------/
63
64   public StructureStateDescriptor()
65   {
66     super();
67     _nsURI = "www.jalview.org";
68     _xmlName = "structureState";
69     _elementDefinition = true;
70     org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
71     org.exolab.castor.mapping.FieldHandler handler = null;
72     org.exolab.castor.xml.FieldValidator fieldValidator = null;
73     // -- _content
74     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
75             java.lang.String.class, "_content", "PCDATA",
76             org.exolab.castor.xml.NodeType.Text);
77     desc.setImmutable(true);
78     handler = new org.exolab.castor.xml.XMLFieldHandler()
79     {
80       public java.lang.Object getValue(java.lang.Object object)
81               throws IllegalStateException
82       {
83         StructureState target = (StructureState) object;
84         return target.getContent();
85       }
86
87       public void setValue(java.lang.Object object, java.lang.Object value)
88               throws IllegalStateException, IllegalArgumentException
89       {
90         try
91         {
92           StructureState target = (StructureState) object;
93           target.setContent((java.lang.String) value);
94         } catch (java.lang.Exception ex)
95         {
96           throw new IllegalStateException(ex.toString());
97         }
98       }
99
100       public java.lang.Object newInstance(java.lang.Object parent)
101       {
102         return null;
103       }
104     };
105     desc.setHandler(handler);
106     addFieldDescriptor(desc);
107
108     // -- validation code for: _content
109     fieldValidator = new org.exolab.castor.xml.FieldValidator();
110     { // -- local scope
111       org.exolab.castor.xml.validators.StringValidator typeValidator;
112       typeValidator = new org.exolab.castor.xml.validators.StringValidator();
113       fieldValidator.setValidator(typeValidator);
114       typeValidator.setWhiteSpace("preserve");
115     }
116     desc.setValidator(fieldValidator);
117     // -- initialize attribute descriptors
118
119     // -- _visible
120     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
121             java.lang.Boolean.TYPE, "_visible", "visible",
122             org.exolab.castor.xml.NodeType.Attribute);
123     handler = new org.exolab.castor.xml.XMLFieldHandler()
124     {
125       public java.lang.Object getValue(java.lang.Object object)
126               throws IllegalStateException
127       {
128         StructureState target = (StructureState) object;
129         if (!target.hasVisible())
130         {
131           return null;
132         }
133         return (target.getVisible() ? java.lang.Boolean.TRUE
134                 : java.lang.Boolean.FALSE);
135       }
136
137       public void setValue(java.lang.Object object, java.lang.Object value)
138               throws IllegalStateException, IllegalArgumentException
139       {
140         try
141         {
142           StructureState target = (StructureState) object;
143           // if null, use delete method for optional primitives
144           if (value == null)
145           {
146             target.deleteVisible();
147             return;
148           }
149           target.setVisible(((java.lang.Boolean) value).booleanValue());
150         } catch (java.lang.Exception ex)
151         {
152           throw new IllegalStateException(ex.toString());
153         }
154       }
155
156       public java.lang.Object newInstance(java.lang.Object parent)
157       {
158         return null;
159       }
160     };
161     desc.setHandler(handler);
162     desc.setMultivalued(false);
163     addFieldDescriptor(desc);
164
165     // -- validation code for: _visible
166     fieldValidator = new org.exolab.castor.xml.FieldValidator();
167     { // -- local scope
168       org.exolab.castor.xml.validators.BooleanValidator typeValidator;
169       typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
170       fieldValidator.setValidator(typeValidator);
171     }
172     desc.setValidator(fieldValidator);
173     // -- _viewId
174     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
175             java.lang.String.class, "_viewId", "viewId",
176             org.exolab.castor.xml.NodeType.Attribute);
177     desc.setImmutable(true);
178     handler = new org.exolab.castor.xml.XMLFieldHandler()
179     {
180       public java.lang.Object getValue(java.lang.Object object)
181               throws IllegalStateException
182       {
183         StructureState target = (StructureState) object;
184         return target.getViewId();
185       }
186
187       public void setValue(java.lang.Object object, java.lang.Object value)
188               throws IllegalStateException, IllegalArgumentException
189       {
190         try
191         {
192           StructureState target = (StructureState) object;
193           target.setViewId((java.lang.String) value);
194         } catch (java.lang.Exception ex)
195         {
196           throw new IllegalStateException(ex.toString());
197         }
198       }
199
200       public java.lang.Object newInstance(java.lang.Object parent)
201       {
202         return null;
203       }
204     };
205     desc.setHandler(handler);
206     desc.setMultivalued(false);
207     addFieldDescriptor(desc);
208
209     // -- validation code for: _viewId
210     fieldValidator = new org.exolab.castor.xml.FieldValidator();
211     { // -- local scope
212       org.exolab.castor.xml.validators.StringValidator typeValidator;
213       typeValidator = new org.exolab.castor.xml.validators.StringValidator();
214       fieldValidator.setValidator(typeValidator);
215       typeValidator.setWhiteSpace("preserve");
216     }
217     desc.setValidator(fieldValidator);
218     // -- _alignwithAlignPanel
219     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
220             java.lang.Boolean.TYPE, "_alignwithAlignPanel",
221             "alignwithAlignPanel", org.exolab.castor.xml.NodeType.Attribute);
222     handler = new org.exolab.castor.xml.XMLFieldHandler()
223     {
224       public java.lang.Object getValue(java.lang.Object object)
225               throws IllegalStateException
226       {
227         StructureState target = (StructureState) object;
228         if (!target.hasAlignwithAlignPanel())
229         {
230           return null;
231         }
232         return (target.getAlignwithAlignPanel() ? java.lang.Boolean.TRUE
233                 : java.lang.Boolean.FALSE);
234       }
235
236       public void setValue(java.lang.Object object, java.lang.Object value)
237               throws IllegalStateException, IllegalArgumentException
238       {
239         try
240         {
241           StructureState target = (StructureState) object;
242           // if null, use delete method for optional primitives
243           if (value == null)
244           {
245             target.deleteAlignwithAlignPanel();
246             return;
247           }
248           target.setAlignwithAlignPanel(((java.lang.Boolean) value)
249                   .booleanValue());
250         } catch (java.lang.Exception ex)
251         {
252           throw new IllegalStateException(ex.toString());
253         }
254       }
255
256       public java.lang.Object newInstance(java.lang.Object parent)
257       {
258         return null;
259       }
260     };
261     desc.setHandler(handler);
262     desc.setMultivalued(false);
263     addFieldDescriptor(desc);
264
265     // -- validation code for: _alignwithAlignPanel
266     fieldValidator = new org.exolab.castor.xml.FieldValidator();
267     { // -- local scope
268       org.exolab.castor.xml.validators.BooleanValidator typeValidator;
269       typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
270       fieldValidator.setValidator(typeValidator);
271     }
272     desc.setValidator(fieldValidator);
273     // -- _colourwithAlignPanel
274     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
275             java.lang.Boolean.TYPE, "_colourwithAlignPanel",
276             "colourwithAlignPanel",
277             org.exolab.castor.xml.NodeType.Attribute);
278     handler = new org.exolab.castor.xml.XMLFieldHandler()
279     {
280       public java.lang.Object getValue(java.lang.Object object)
281               throws IllegalStateException
282       {
283         StructureState target = (StructureState) object;
284         if (!target.hasColourwithAlignPanel())
285         {
286           return null;
287         }
288         return (target.getColourwithAlignPanel() ? java.lang.Boolean.TRUE
289                 : java.lang.Boolean.FALSE);
290       }
291
292       public void setValue(java.lang.Object object, java.lang.Object value)
293               throws IllegalStateException, IllegalArgumentException
294       {
295         try
296         {
297           StructureState target = (StructureState) object;
298           // if null, use delete method for optional primitives
299           if (value == null)
300           {
301             target.deleteColourwithAlignPanel();
302             return;
303           }
304           target.setColourwithAlignPanel(((java.lang.Boolean) value)
305                   .booleanValue());
306         } catch (java.lang.Exception ex)
307         {
308           throw new IllegalStateException(ex.toString());
309         }
310       }
311
312       public java.lang.Object newInstance(java.lang.Object parent)
313       {
314         return null;
315       }
316     };
317     desc.setHandler(handler);
318     desc.setMultivalued(false);
319     addFieldDescriptor(desc);
320
321     // -- validation code for: _colourwithAlignPanel
322     fieldValidator = new org.exolab.castor.xml.FieldValidator();
323     { // -- local scope
324       org.exolab.castor.xml.validators.BooleanValidator typeValidator;
325       typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
326       fieldValidator.setValidator(typeValidator);
327     }
328     desc.setValidator(fieldValidator);
329     // -- _colourByJmol
330     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
331             java.lang.Boolean.TYPE, "_colourByJmol", "colourByJmol",
332             org.exolab.castor.xml.NodeType.Attribute);
333     handler = new org.exolab.castor.xml.XMLFieldHandler()
334     {
335       public java.lang.Object getValue(java.lang.Object object)
336               throws IllegalStateException
337       {
338         StructureState target = (StructureState) object;
339         if (!target.hasColourByJmol())
340         {
341           return null;
342         }
343         return (target.getColourByJmol() ? java.lang.Boolean.TRUE
344                 : java.lang.Boolean.FALSE);
345       }
346
347       public void setValue(java.lang.Object object, java.lang.Object value)
348               throws IllegalStateException, IllegalArgumentException
349       {
350         try
351         {
352           StructureState target = (StructureState) object;
353           // if null, use delete method for optional primitives
354           if (value == null)
355           {
356             target.deleteColourByJmol();
357             return;
358           }
359           target.setColourByJmol(((java.lang.Boolean) value).booleanValue());
360         } catch (java.lang.Exception ex)
361         {
362           throw new IllegalStateException(ex.toString());
363         }
364       }
365
366       public java.lang.Object newInstance(java.lang.Object parent)
367       {
368         return null;
369       }
370     };
371     desc.setHandler(handler);
372     desc.setMultivalued(false);
373     addFieldDescriptor(desc);
374
375     // -- validation code for: _colourByJmol
376     fieldValidator = new org.exolab.castor.xml.FieldValidator();
377     { // -- local scope
378       org.exolab.castor.xml.validators.BooleanValidator typeValidator;
379       typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
380       fieldValidator.setValidator(typeValidator);
381     }
382     desc.setValidator(fieldValidator);
383     // -- _width
384     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
385             java.lang.Integer.TYPE, "_width", "width",
386             org.exolab.castor.xml.NodeType.Attribute);
387     handler = new org.exolab.castor.xml.XMLFieldHandler()
388     {
389       public java.lang.Object getValue(java.lang.Object object)
390               throws IllegalStateException
391       {
392         StructureState target = (StructureState) object;
393         if (!target.hasWidth())
394         {
395           return null;
396         }
397         return new java.lang.Integer(target.getWidth());
398       }
399
400       public void setValue(java.lang.Object object, java.lang.Object value)
401               throws IllegalStateException, IllegalArgumentException
402       {
403         try
404         {
405           StructureState target = (StructureState) object;
406           // if null, use delete method for optional primitives
407           if (value == null)
408           {
409             target.deleteWidth();
410             return;
411           }
412           target.setWidth(((java.lang.Integer) value).intValue());
413         } catch (java.lang.Exception ex)
414         {
415           throw new IllegalStateException(ex.toString());
416         }
417       }
418
419       public java.lang.Object newInstance(java.lang.Object parent)
420       {
421         return null;
422       }
423     };
424     desc.setHandler(handler);
425     desc.setMultivalued(false);
426     addFieldDescriptor(desc);
427
428     // -- validation code for: _width
429     fieldValidator = new org.exolab.castor.xml.FieldValidator();
430     { // -- local scope
431       org.exolab.castor.xml.validators.IntValidator typeValidator;
432       typeValidator = new org.exolab.castor.xml.validators.IntValidator();
433       fieldValidator.setValidator(typeValidator);
434       typeValidator.setMinInclusive(-2147483648);
435       typeValidator.setMaxInclusive(2147483647);
436     }
437     desc.setValidator(fieldValidator);
438     // -- _height
439     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
440             java.lang.Integer.TYPE, "_height", "height",
441             org.exolab.castor.xml.NodeType.Attribute);
442     handler = new org.exolab.castor.xml.XMLFieldHandler()
443     {
444       public java.lang.Object getValue(java.lang.Object object)
445               throws IllegalStateException
446       {
447         StructureState target = (StructureState) object;
448         if (!target.hasHeight())
449         {
450           return null;
451         }
452         return new java.lang.Integer(target.getHeight());
453       }
454
455       public void setValue(java.lang.Object object, java.lang.Object value)
456               throws IllegalStateException, IllegalArgumentException
457       {
458         try
459         {
460           StructureState target = (StructureState) object;
461           // if null, use delete method for optional primitives
462           if (value == null)
463           {
464             target.deleteHeight();
465             return;
466           }
467           target.setHeight(((java.lang.Integer) value).intValue());
468         } catch (java.lang.Exception ex)
469         {
470           throw new IllegalStateException(ex.toString());
471         }
472       }
473
474       public java.lang.Object newInstance(java.lang.Object parent)
475       {
476         return null;
477       }
478     };
479     desc.setHandler(handler);
480     desc.setMultivalued(false);
481     addFieldDescriptor(desc);
482
483     // -- validation code for: _height
484     fieldValidator = new org.exolab.castor.xml.FieldValidator();
485     { // -- local scope
486       org.exolab.castor.xml.validators.IntValidator typeValidator;
487       typeValidator = new org.exolab.castor.xml.validators.IntValidator();
488       fieldValidator.setValidator(typeValidator);
489       typeValidator.setMinInclusive(-2147483648);
490       typeValidator.setMaxInclusive(2147483647);
491     }
492     desc.setValidator(fieldValidator);
493     // -- _xpos
494     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
495             java.lang.Integer.TYPE, "_xpos", "xpos",
496             org.exolab.castor.xml.NodeType.Attribute);
497     handler = new org.exolab.castor.xml.XMLFieldHandler()
498     {
499       public java.lang.Object getValue(java.lang.Object object)
500               throws IllegalStateException
501       {
502         StructureState target = (StructureState) object;
503         if (!target.hasXpos())
504         {
505           return null;
506         }
507         return new java.lang.Integer(target.getXpos());
508       }
509
510       public void setValue(java.lang.Object object, java.lang.Object value)
511               throws IllegalStateException, IllegalArgumentException
512       {
513         try
514         {
515           StructureState target = (StructureState) object;
516           // if null, use delete method for optional primitives
517           if (value == null)
518           {
519             target.deleteXpos();
520             return;
521           }
522           target.setXpos(((java.lang.Integer) value).intValue());
523         } catch (java.lang.Exception ex)
524         {
525           throw new IllegalStateException(ex.toString());
526         }
527       }
528
529       public java.lang.Object newInstance(java.lang.Object parent)
530       {
531         return null;
532       }
533     };
534     desc.setHandler(handler);
535     desc.setMultivalued(false);
536     addFieldDescriptor(desc);
537
538     // -- validation code for: _xpos
539     fieldValidator = new org.exolab.castor.xml.FieldValidator();
540     { // -- local scope
541       org.exolab.castor.xml.validators.IntValidator typeValidator;
542       typeValidator = new org.exolab.castor.xml.validators.IntValidator();
543       fieldValidator.setValidator(typeValidator);
544       typeValidator.setMinInclusive(-2147483648);
545       typeValidator.setMaxInclusive(2147483647);
546     }
547     desc.setValidator(fieldValidator);
548     // -- _ypos
549     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
550             java.lang.Integer.TYPE, "_ypos", "ypos",
551             org.exolab.castor.xml.NodeType.Attribute);
552     handler = new org.exolab.castor.xml.XMLFieldHandler()
553     {
554       public java.lang.Object getValue(java.lang.Object object)
555               throws IllegalStateException
556       {
557         StructureState target = (StructureState) object;
558         if (!target.hasYpos())
559         {
560           return null;
561         }
562         return new java.lang.Integer(target.getYpos());
563       }
564
565       public void setValue(java.lang.Object object, java.lang.Object value)
566               throws IllegalStateException, IllegalArgumentException
567       {
568         try
569         {
570           StructureState target = (StructureState) object;
571           // if null, use delete method for optional primitives
572           if (value == null)
573           {
574             target.deleteYpos();
575             return;
576           }
577           target.setYpos(((java.lang.Integer) value).intValue());
578         } catch (java.lang.Exception ex)
579         {
580           throw new IllegalStateException(ex.toString());
581         }
582       }
583
584       public java.lang.Object newInstance(java.lang.Object parent)
585       {
586         return null;
587       }
588     };
589     desc.setHandler(handler);
590     desc.setMultivalued(false);
591     addFieldDescriptor(desc);
592
593     // -- validation code for: _ypos
594     fieldValidator = new org.exolab.castor.xml.FieldValidator();
595     { // -- local scope
596       org.exolab.castor.xml.validators.IntValidator typeValidator;
597       typeValidator = new org.exolab.castor.xml.validators.IntValidator();
598       fieldValidator.setValidator(typeValidator);
599       typeValidator.setMinInclusive(-2147483648);
600       typeValidator.setMaxInclusive(2147483647);
601     }
602     desc.setValidator(fieldValidator);
603     // -- initialize element descriptors
604
605   }
606
607   // -----------/
608   // - Methods -/
609   // -----------/
610
611   /**
612    * Method getAccessMode.
613    * 
614    * @return the access mode specified for this class.
615    */
616   public org.exolab.castor.mapping.AccessMode getAccessMode()
617   {
618     return null;
619   }
620
621   /**
622    * Method getIdentity.
623    * 
624    * @return the identity field, null if this class has no identity.
625    */
626   public org.exolab.castor.mapping.FieldDescriptor getIdentity()
627   {
628     return super.getIdentity();
629   }
630
631   /**
632    * Method getJavaClass.
633    * 
634    * @return the Java class represented by this descriptor.
635    */
636   public java.lang.Class getJavaClass()
637   {
638     return jalview.schemabinding.version2.StructureState.class;
639   }
640
641   /**
642    * Method getNameSpacePrefix.
643    * 
644    * @return the namespace prefix to use when marshaling as XML.
645    */
646   public java.lang.String getNameSpacePrefix()
647   {
648     return _nsPrefix;
649   }
650
651   /**
652    * Method getNameSpaceURI.
653    * 
654    * @return the namespace URI used when marshaling and unmarshaling as XML.
655    */
656   public java.lang.String getNameSpaceURI()
657   {
658     return _nsURI;
659   }
660
661   /**
662    * Method getValidator.
663    * 
664    * @return a specific validator for the class described by this
665    *         ClassDescriptor.
666    */
667   public org.exolab.castor.xml.TypeValidator getValidator()
668   {
669     return this;
670   }
671
672   /**
673    * Method getXMLName.
674    * 
675    * @return the XML Name for the Class being described.
676    */
677   public java.lang.String getXMLName()
678   {
679     return _xmlName;
680   }
681
682   /**
683    * Method isElementDefinition.
684    * 
685    * @return true if XML schema definition of this Class is that of a global
686    *         element or element with anonymous type definition.
687    */
688   public boolean isElementDefinition()
689   {
690     return _elementDefinition;
691   }
692
693 }