2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
3 * Copyright (C) 2014 The Jalview Authors
5 * This file is part of Jalview.
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
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
21 package jalview.schemabinding.version2.descriptors;
23 //---------------------------------/
24 //- Imported classes and packages -/
25 //---------------------------------/
27 import jalview.schemabinding.version2.StructureState;
30 * Class StructureStateDescriptor.
32 * @version $Revision$ $Date$
34 public class StructureStateDescriptor extends
35 org.exolab.castor.xml.util.XMLClassDescriptorImpl
38 // --------------------------/
39 // - Class/Member Variables -/
40 // --------------------------/
43 * Field _elementDefinition.
45 private boolean _elementDefinition;
50 private java.lang.String _nsPrefix;
55 private java.lang.String _nsURI;
60 private java.lang.String _xmlName;
66 public StructureStateDescriptor()
69 _nsURI = "www.jalview.org";
70 _xmlName = "structureState";
71 _elementDefinition = true;
72 org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
73 org.exolab.castor.mapping.FieldHandler handler = null;
74 org.exolab.castor.xml.FieldValidator fieldValidator = null;
76 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
77 java.lang.String.class, "_content", "PCDATA",
78 org.exolab.castor.xml.NodeType.Text);
79 desc.setImmutable(true);
80 handler = new org.exolab.castor.xml.XMLFieldHandler()
82 public java.lang.Object getValue(java.lang.Object object)
83 throws IllegalStateException
85 StructureState target = (StructureState) object;
86 return target.getContent();
89 public void setValue(java.lang.Object object, java.lang.Object value)
90 throws IllegalStateException, IllegalArgumentException
94 StructureState target = (StructureState) object;
95 target.setContent((java.lang.String) value);
96 } catch (java.lang.Exception ex)
98 throw new IllegalStateException(ex.toString());
102 public java.lang.Object newInstance(java.lang.Object parent)
107 desc.setHandler(handler);
108 addFieldDescriptor(desc);
110 // -- validation code for: _content
111 fieldValidator = new org.exolab.castor.xml.FieldValidator();
113 org.exolab.castor.xml.validators.StringValidator typeValidator;
114 typeValidator = new org.exolab.castor.xml.validators.StringValidator();
115 fieldValidator.setValidator(typeValidator);
116 typeValidator.setWhiteSpace("preserve");
118 desc.setValidator(fieldValidator);
119 // -- initialize attribute descriptors
122 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
123 java.lang.Boolean.TYPE, "_visible", "visible",
124 org.exolab.castor.xml.NodeType.Attribute);
125 handler = new org.exolab.castor.xml.XMLFieldHandler()
127 public java.lang.Object getValue(java.lang.Object object)
128 throws IllegalStateException
130 StructureState target = (StructureState) object;
131 if (!target.hasVisible())
135 return (target.getVisible() ? java.lang.Boolean.TRUE
136 : java.lang.Boolean.FALSE);
139 public void setValue(java.lang.Object object, java.lang.Object value)
140 throws IllegalStateException, IllegalArgumentException
144 StructureState target = (StructureState) object;
145 // if null, use delete method for optional primitives
148 target.deleteVisible();
151 target.setVisible(((java.lang.Boolean) value).booleanValue());
152 } catch (java.lang.Exception ex)
154 throw new IllegalStateException(ex.toString());
158 public java.lang.Object newInstance(java.lang.Object parent)
163 desc.setHandler(handler);
164 desc.setMultivalued(false);
165 addFieldDescriptor(desc);
167 // -- validation code for: _visible
168 fieldValidator = new org.exolab.castor.xml.FieldValidator();
170 org.exolab.castor.xml.validators.BooleanValidator typeValidator;
171 typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
172 fieldValidator.setValidator(typeValidator);
174 desc.setValidator(fieldValidator);
176 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
177 java.lang.String.class, "_viewId", "viewId",
178 org.exolab.castor.xml.NodeType.Attribute);
179 desc.setImmutable(true);
180 handler = new org.exolab.castor.xml.XMLFieldHandler()
182 public java.lang.Object getValue(java.lang.Object object)
183 throws IllegalStateException
185 StructureState target = (StructureState) object;
186 return target.getViewId();
189 public void setValue(java.lang.Object object, java.lang.Object value)
190 throws IllegalStateException, IllegalArgumentException
194 StructureState target = (StructureState) object;
195 target.setViewId((java.lang.String) value);
196 } catch (java.lang.Exception ex)
198 throw new IllegalStateException(ex.toString());
202 public java.lang.Object newInstance(java.lang.Object parent)
207 desc.setHandler(handler);
208 desc.setMultivalued(false);
209 addFieldDescriptor(desc);
211 // -- validation code for: _viewId
212 fieldValidator = new org.exolab.castor.xml.FieldValidator();
214 org.exolab.castor.xml.validators.StringValidator typeValidator;
215 typeValidator = new org.exolab.castor.xml.validators.StringValidator();
216 fieldValidator.setValidator(typeValidator);
217 typeValidator.setWhiteSpace("preserve");
219 desc.setValidator(fieldValidator);
220 // -- _alignwithAlignPanel
221 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
222 java.lang.Boolean.TYPE, "_alignwithAlignPanel",
223 "alignwithAlignPanel", org.exolab.castor.xml.NodeType.Attribute);
224 handler = new org.exolab.castor.xml.XMLFieldHandler()
226 public java.lang.Object getValue(java.lang.Object object)
227 throws IllegalStateException
229 StructureState target = (StructureState) object;
230 if (!target.hasAlignwithAlignPanel())
234 return (target.getAlignwithAlignPanel() ? java.lang.Boolean.TRUE
235 : java.lang.Boolean.FALSE);
238 public void setValue(java.lang.Object object, java.lang.Object value)
239 throws IllegalStateException, IllegalArgumentException
243 StructureState target = (StructureState) object;
244 // if null, use delete method for optional primitives
247 target.deleteAlignwithAlignPanel();
250 target.setAlignwithAlignPanel(((java.lang.Boolean) value)
252 } catch (java.lang.Exception ex)
254 throw new IllegalStateException(ex.toString());
258 public java.lang.Object newInstance(java.lang.Object parent)
263 desc.setHandler(handler);
264 desc.setMultivalued(false);
265 addFieldDescriptor(desc);
267 // -- validation code for: _alignwithAlignPanel
268 fieldValidator = new org.exolab.castor.xml.FieldValidator();
270 org.exolab.castor.xml.validators.BooleanValidator typeValidator;
271 typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
272 fieldValidator.setValidator(typeValidator);
274 desc.setValidator(fieldValidator);
275 // -- _colourwithAlignPanel
276 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
277 java.lang.Boolean.TYPE, "_colourwithAlignPanel",
278 "colourwithAlignPanel",
279 org.exolab.castor.xml.NodeType.Attribute);
280 handler = new org.exolab.castor.xml.XMLFieldHandler()
282 public java.lang.Object getValue(java.lang.Object object)
283 throws IllegalStateException
285 StructureState target = (StructureState) object;
286 if (!target.hasColourwithAlignPanel())
290 return (target.getColourwithAlignPanel() ? java.lang.Boolean.TRUE
291 : java.lang.Boolean.FALSE);
294 public void setValue(java.lang.Object object, java.lang.Object value)
295 throws IllegalStateException, IllegalArgumentException
299 StructureState target = (StructureState) object;
300 // if null, use delete method for optional primitives
303 target.deleteColourwithAlignPanel();
306 target.setColourwithAlignPanel(((java.lang.Boolean) value)
308 } catch (java.lang.Exception ex)
310 throw new IllegalStateException(ex.toString());
314 public java.lang.Object newInstance(java.lang.Object parent)
319 desc.setHandler(handler);
320 desc.setMultivalued(false);
321 addFieldDescriptor(desc);
323 // -- validation code for: _colourwithAlignPanel
324 fieldValidator = new org.exolab.castor.xml.FieldValidator();
326 org.exolab.castor.xml.validators.BooleanValidator typeValidator;
327 typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
328 fieldValidator.setValidator(typeValidator);
330 desc.setValidator(fieldValidator);
332 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
333 java.lang.Boolean.TYPE, "_colourByJmol", "colourByJmol",
334 org.exolab.castor.xml.NodeType.Attribute);
335 handler = new org.exolab.castor.xml.XMLFieldHandler()
337 public java.lang.Object getValue(java.lang.Object object)
338 throws IllegalStateException
340 StructureState target = (StructureState) object;
341 if (!target.hasColourByJmol())
345 return (target.getColourByJmol() ? java.lang.Boolean.TRUE
346 : java.lang.Boolean.FALSE);
349 public void setValue(java.lang.Object object, java.lang.Object value)
350 throws IllegalStateException, IllegalArgumentException
354 StructureState target = (StructureState) object;
355 // if null, use delete method for optional primitives
358 target.deleteColourByJmol();
361 target.setColourByJmol(((java.lang.Boolean) value).booleanValue());
362 } catch (java.lang.Exception ex)
364 throw new IllegalStateException(ex.toString());
368 public java.lang.Object newInstance(java.lang.Object parent)
373 desc.setHandler(handler);
374 desc.setMultivalued(false);
375 addFieldDescriptor(desc);
377 // -- validation code for: _colourByJmol
378 fieldValidator = new org.exolab.castor.xml.FieldValidator();
380 org.exolab.castor.xml.validators.BooleanValidator typeValidator;
381 typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
382 fieldValidator.setValidator(typeValidator);
384 desc.setValidator(fieldValidator);
386 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
387 java.lang.Integer.TYPE, "_width", "width",
388 org.exolab.castor.xml.NodeType.Attribute);
389 handler = new org.exolab.castor.xml.XMLFieldHandler()
391 public java.lang.Object getValue(java.lang.Object object)
392 throws IllegalStateException
394 StructureState target = (StructureState) object;
395 if (!target.hasWidth())
399 return new java.lang.Integer(target.getWidth());
402 public void setValue(java.lang.Object object, java.lang.Object value)
403 throws IllegalStateException, IllegalArgumentException
407 StructureState target = (StructureState) object;
408 // if null, use delete method for optional primitives
411 target.deleteWidth();
414 target.setWidth(((java.lang.Integer) value).intValue());
415 } catch (java.lang.Exception ex)
417 throw new IllegalStateException(ex.toString());
421 public java.lang.Object newInstance(java.lang.Object parent)
426 desc.setHandler(handler);
427 desc.setMultivalued(false);
428 addFieldDescriptor(desc);
430 // -- validation code for: _width
431 fieldValidator = new org.exolab.castor.xml.FieldValidator();
433 org.exolab.castor.xml.validators.IntValidator typeValidator;
434 typeValidator = new org.exolab.castor.xml.validators.IntValidator();
435 fieldValidator.setValidator(typeValidator);
436 typeValidator.setMinInclusive(-2147483648);
437 typeValidator.setMaxInclusive(2147483647);
439 desc.setValidator(fieldValidator);
441 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
442 java.lang.Integer.TYPE, "_height", "height",
443 org.exolab.castor.xml.NodeType.Attribute);
444 handler = new org.exolab.castor.xml.XMLFieldHandler()
446 public java.lang.Object getValue(java.lang.Object object)
447 throws IllegalStateException
449 StructureState target = (StructureState) object;
450 if (!target.hasHeight())
454 return new java.lang.Integer(target.getHeight());
457 public void setValue(java.lang.Object object, java.lang.Object value)
458 throws IllegalStateException, IllegalArgumentException
462 StructureState target = (StructureState) object;
463 // if null, use delete method for optional primitives
466 target.deleteHeight();
469 target.setHeight(((java.lang.Integer) value).intValue());
470 } catch (java.lang.Exception ex)
472 throw new IllegalStateException(ex.toString());
476 public java.lang.Object newInstance(java.lang.Object parent)
481 desc.setHandler(handler);
482 desc.setMultivalued(false);
483 addFieldDescriptor(desc);
485 // -- validation code for: _height
486 fieldValidator = new org.exolab.castor.xml.FieldValidator();
488 org.exolab.castor.xml.validators.IntValidator typeValidator;
489 typeValidator = new org.exolab.castor.xml.validators.IntValidator();
490 fieldValidator.setValidator(typeValidator);
491 typeValidator.setMinInclusive(-2147483648);
492 typeValidator.setMaxInclusive(2147483647);
494 desc.setValidator(fieldValidator);
496 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
497 java.lang.Integer.TYPE, "_xpos", "xpos",
498 org.exolab.castor.xml.NodeType.Attribute);
499 handler = new org.exolab.castor.xml.XMLFieldHandler()
501 public java.lang.Object getValue(java.lang.Object object)
502 throws IllegalStateException
504 StructureState target = (StructureState) object;
505 if (!target.hasXpos())
509 return new java.lang.Integer(target.getXpos());
512 public void setValue(java.lang.Object object, java.lang.Object value)
513 throws IllegalStateException, IllegalArgumentException
517 StructureState target = (StructureState) object;
518 // if null, use delete method for optional primitives
524 target.setXpos(((java.lang.Integer) value).intValue());
525 } catch (java.lang.Exception ex)
527 throw new IllegalStateException(ex.toString());
531 public java.lang.Object newInstance(java.lang.Object parent)
536 desc.setHandler(handler);
537 desc.setMultivalued(false);
538 addFieldDescriptor(desc);
540 // -- validation code for: _xpos
541 fieldValidator = new org.exolab.castor.xml.FieldValidator();
543 org.exolab.castor.xml.validators.IntValidator typeValidator;
544 typeValidator = new org.exolab.castor.xml.validators.IntValidator();
545 fieldValidator.setValidator(typeValidator);
546 typeValidator.setMinInclusive(-2147483648);
547 typeValidator.setMaxInclusive(2147483647);
549 desc.setValidator(fieldValidator);
551 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
552 java.lang.Integer.TYPE, "_ypos", "ypos",
553 org.exolab.castor.xml.NodeType.Attribute);
554 handler = new org.exolab.castor.xml.XMLFieldHandler()
556 public java.lang.Object getValue(java.lang.Object object)
557 throws IllegalStateException
559 StructureState target = (StructureState) object;
560 if (!target.hasYpos())
564 return new java.lang.Integer(target.getYpos());
567 public void setValue(java.lang.Object object, java.lang.Object value)
568 throws IllegalStateException, IllegalArgumentException
572 StructureState target = (StructureState) object;
573 // if null, use delete method for optional primitives
579 target.setYpos(((java.lang.Integer) value).intValue());
580 } catch (java.lang.Exception ex)
582 throw new IllegalStateException(ex.toString());
586 public java.lang.Object newInstance(java.lang.Object parent)
591 desc.setHandler(handler);
592 desc.setMultivalued(false);
593 addFieldDescriptor(desc);
595 // -- validation code for: _ypos
596 fieldValidator = new org.exolab.castor.xml.FieldValidator();
598 org.exolab.castor.xml.validators.IntValidator typeValidator;
599 typeValidator = new org.exolab.castor.xml.validators.IntValidator();
600 fieldValidator.setValidator(typeValidator);
601 typeValidator.setMinInclusive(-2147483648);
602 typeValidator.setMaxInclusive(2147483647);
604 desc.setValidator(fieldValidator);
605 // -- initialize element descriptors
614 * Method getAccessMode.
616 * @return the access mode specified for this class.
618 public org.exolab.castor.mapping.AccessMode getAccessMode()
624 * Method getIdentity.
626 * @return the identity field, null if this class has no identity.
628 public org.exolab.castor.mapping.FieldDescriptor getIdentity()
630 return super.getIdentity();
634 * Method getJavaClass.
636 * @return the Java class represented by this descriptor.
638 public java.lang.Class getJavaClass()
640 return jalview.schemabinding.version2.StructureState.class;
644 * Method getNameSpacePrefix.
646 * @return the namespace prefix to use when marshaling as XML.
648 public java.lang.String getNameSpacePrefix()
654 * Method getNameSpaceURI.
656 * @return the namespace URI used when marshaling and unmarshaling as XML.
658 public java.lang.String getNameSpaceURI()
664 * Method getValidator.
666 * @return a specific validator for the class described by this
669 public org.exolab.castor.xml.TypeValidator getValidator()
677 * @return the XML Name for the Class being described.
679 public java.lang.String getXMLName()
685 * Method isElementDefinition.
687 * @return true if XML schema definition of this Class is that of a global
688 * element or element with anonymous type definition.
690 public boolean isElementDefinition()
692 return _elementDefinition;