2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.0b1)
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 of the License, or (at your option) any later version.
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.
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.
19 package jalview.schemabinding.version2.descriptors;
21 //---------------------------------/
22 //- Imported classes and packages -/
23 //---------------------------------/
25 import jalview.schemabinding.version2.StructureState;
28 * Class StructureStateDescriptor.
30 * @version $Revision$ $Date$
32 public class StructureStateDescriptor extends
33 org.exolab.castor.xml.util.XMLClassDescriptorImpl
36 // --------------------------/
37 // - Class/Member Variables -/
38 // --------------------------/
41 * Field _elementDefinition.
43 private boolean _elementDefinition;
48 private java.lang.String _nsPrefix;
53 private java.lang.String _nsURI;
58 private java.lang.String _xmlName;
64 public StructureStateDescriptor()
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;
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()
80 public java.lang.Object getValue(java.lang.Object object)
81 throws IllegalStateException
83 StructureState target = (StructureState) object;
84 return target.getContent();
87 public void setValue(java.lang.Object object, java.lang.Object value)
88 throws IllegalStateException, IllegalArgumentException
92 StructureState target = (StructureState) object;
93 target.setContent((java.lang.String) value);
94 } catch (java.lang.Exception ex)
96 throw new IllegalStateException(ex.toString());
100 public java.lang.Object newInstance(java.lang.Object parent)
105 desc.setHandler(handler);
106 addFieldDescriptor(desc);
108 // -- validation code for: _content
109 fieldValidator = new org.exolab.castor.xml.FieldValidator();
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");
116 desc.setValidator(fieldValidator);
117 // -- initialize attribute descriptors
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()
125 public java.lang.Object getValue(java.lang.Object object)
126 throws IllegalStateException
128 StructureState target = (StructureState) object;
129 if (!target.hasVisible())
133 return (target.getVisible() ? java.lang.Boolean.TRUE
134 : java.lang.Boolean.FALSE);
137 public void setValue(java.lang.Object object, java.lang.Object value)
138 throws IllegalStateException, IllegalArgumentException
142 StructureState target = (StructureState) object;
143 // if null, use delete method for optional primitives
146 target.deleteVisible();
149 target.setVisible(((java.lang.Boolean) value).booleanValue());
150 } catch (java.lang.Exception ex)
152 throw new IllegalStateException(ex.toString());
156 public java.lang.Object newInstance(java.lang.Object parent)
161 desc.setHandler(handler);
162 desc.setMultivalued(false);
163 addFieldDescriptor(desc);
165 // -- validation code for: _visible
166 fieldValidator = new org.exolab.castor.xml.FieldValidator();
168 org.exolab.castor.xml.validators.BooleanValidator typeValidator;
169 typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
170 fieldValidator.setValidator(typeValidator);
172 desc.setValidator(fieldValidator);
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()
180 public java.lang.Object getValue(java.lang.Object object)
181 throws IllegalStateException
183 StructureState target = (StructureState) object;
184 return target.getViewId();
187 public void setValue(java.lang.Object object, java.lang.Object value)
188 throws IllegalStateException, IllegalArgumentException
192 StructureState target = (StructureState) object;
193 target.setViewId((java.lang.String) value);
194 } catch (java.lang.Exception ex)
196 throw new IllegalStateException(ex.toString());
200 public java.lang.Object newInstance(java.lang.Object parent)
205 desc.setHandler(handler);
206 desc.setMultivalued(false);
207 addFieldDescriptor(desc);
209 // -- validation code for: _viewId
210 fieldValidator = new org.exolab.castor.xml.FieldValidator();
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");
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()
224 public java.lang.Object getValue(java.lang.Object object)
225 throws IllegalStateException
227 StructureState target = (StructureState) object;
228 if (!target.hasAlignwithAlignPanel())
232 return (target.getAlignwithAlignPanel() ? java.lang.Boolean.TRUE
233 : java.lang.Boolean.FALSE);
236 public void setValue(java.lang.Object object, java.lang.Object value)
237 throws IllegalStateException, IllegalArgumentException
241 StructureState target = (StructureState) object;
242 // if null, use delete method for optional primitives
245 target.deleteAlignwithAlignPanel();
248 target.setAlignwithAlignPanel(((java.lang.Boolean) value)
250 } catch (java.lang.Exception ex)
252 throw new IllegalStateException(ex.toString());
256 public java.lang.Object newInstance(java.lang.Object parent)
261 desc.setHandler(handler);
262 desc.setMultivalued(false);
263 addFieldDescriptor(desc);
265 // -- validation code for: _alignwithAlignPanel
266 fieldValidator = new org.exolab.castor.xml.FieldValidator();
268 org.exolab.castor.xml.validators.BooleanValidator typeValidator;
269 typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
270 fieldValidator.setValidator(typeValidator);
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()
280 public java.lang.Object getValue(java.lang.Object object)
281 throws IllegalStateException
283 StructureState target = (StructureState) object;
284 if (!target.hasColourwithAlignPanel())
288 return (target.getColourwithAlignPanel() ? java.lang.Boolean.TRUE
289 : java.lang.Boolean.FALSE);
292 public void setValue(java.lang.Object object, java.lang.Object value)
293 throws IllegalStateException, IllegalArgumentException
297 StructureState target = (StructureState) object;
298 // if null, use delete method for optional primitives
301 target.deleteColourwithAlignPanel();
304 target.setColourwithAlignPanel(((java.lang.Boolean) value)
306 } catch (java.lang.Exception ex)
308 throw new IllegalStateException(ex.toString());
312 public java.lang.Object newInstance(java.lang.Object parent)
317 desc.setHandler(handler);
318 desc.setMultivalued(false);
319 addFieldDescriptor(desc);
321 // -- validation code for: _colourwithAlignPanel
322 fieldValidator = new org.exolab.castor.xml.FieldValidator();
324 org.exolab.castor.xml.validators.BooleanValidator typeValidator;
325 typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
326 fieldValidator.setValidator(typeValidator);
328 desc.setValidator(fieldValidator);
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()
335 public java.lang.Object getValue(java.lang.Object object)
336 throws IllegalStateException
338 StructureState target = (StructureState) object;
339 if (!target.hasColourByJmol())
343 return (target.getColourByJmol() ? java.lang.Boolean.TRUE
344 : java.lang.Boolean.FALSE);
347 public void setValue(java.lang.Object object, java.lang.Object value)
348 throws IllegalStateException, IllegalArgumentException
352 StructureState target = (StructureState) object;
353 // if null, use delete method for optional primitives
356 target.deleteColourByJmol();
359 target.setColourByJmol(((java.lang.Boolean) value).booleanValue());
360 } catch (java.lang.Exception ex)
362 throw new IllegalStateException(ex.toString());
366 public java.lang.Object newInstance(java.lang.Object parent)
371 desc.setHandler(handler);
372 desc.setMultivalued(false);
373 addFieldDescriptor(desc);
375 // -- validation code for: _colourByJmol
376 fieldValidator = new org.exolab.castor.xml.FieldValidator();
378 org.exolab.castor.xml.validators.BooleanValidator typeValidator;
379 typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
380 fieldValidator.setValidator(typeValidator);
382 desc.setValidator(fieldValidator);
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()
389 public java.lang.Object getValue(java.lang.Object object)
390 throws IllegalStateException
392 StructureState target = (StructureState) object;
393 if (!target.hasWidth())
397 return new java.lang.Integer(target.getWidth());
400 public void setValue(java.lang.Object object, java.lang.Object value)
401 throws IllegalStateException, IllegalArgumentException
405 StructureState target = (StructureState) object;
406 // if null, use delete method for optional primitives
409 target.deleteWidth();
412 target.setWidth(((java.lang.Integer) value).intValue());
413 } catch (java.lang.Exception ex)
415 throw new IllegalStateException(ex.toString());
419 public java.lang.Object newInstance(java.lang.Object parent)
424 desc.setHandler(handler);
425 desc.setMultivalued(false);
426 addFieldDescriptor(desc);
428 // -- validation code for: _width
429 fieldValidator = new org.exolab.castor.xml.FieldValidator();
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);
437 desc.setValidator(fieldValidator);
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()
444 public java.lang.Object getValue(java.lang.Object object)
445 throws IllegalStateException
447 StructureState target = (StructureState) object;
448 if (!target.hasHeight())
452 return new java.lang.Integer(target.getHeight());
455 public void setValue(java.lang.Object object, java.lang.Object value)
456 throws IllegalStateException, IllegalArgumentException
460 StructureState target = (StructureState) object;
461 // if null, use delete method for optional primitives
464 target.deleteHeight();
467 target.setHeight(((java.lang.Integer) value).intValue());
468 } catch (java.lang.Exception ex)
470 throw new IllegalStateException(ex.toString());
474 public java.lang.Object newInstance(java.lang.Object parent)
479 desc.setHandler(handler);
480 desc.setMultivalued(false);
481 addFieldDescriptor(desc);
483 // -- validation code for: _height
484 fieldValidator = new org.exolab.castor.xml.FieldValidator();
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);
492 desc.setValidator(fieldValidator);
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()
499 public java.lang.Object getValue(java.lang.Object object)
500 throws IllegalStateException
502 StructureState target = (StructureState) object;
503 if (!target.hasXpos())
507 return new java.lang.Integer(target.getXpos());
510 public void setValue(java.lang.Object object, java.lang.Object value)
511 throws IllegalStateException, IllegalArgumentException
515 StructureState target = (StructureState) object;
516 // if null, use delete method for optional primitives
522 target.setXpos(((java.lang.Integer) value).intValue());
523 } catch (java.lang.Exception ex)
525 throw new IllegalStateException(ex.toString());
529 public java.lang.Object newInstance(java.lang.Object parent)
534 desc.setHandler(handler);
535 desc.setMultivalued(false);
536 addFieldDescriptor(desc);
538 // -- validation code for: _xpos
539 fieldValidator = new org.exolab.castor.xml.FieldValidator();
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);
547 desc.setValidator(fieldValidator);
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()
554 public java.lang.Object getValue(java.lang.Object object)
555 throws IllegalStateException
557 StructureState target = (StructureState) object;
558 if (!target.hasYpos())
562 return new java.lang.Integer(target.getYpos());
565 public void setValue(java.lang.Object object, java.lang.Object value)
566 throws IllegalStateException, IllegalArgumentException
570 StructureState target = (StructureState) object;
571 // if null, use delete method for optional primitives
577 target.setYpos(((java.lang.Integer) value).intValue());
578 } catch (java.lang.Exception ex)
580 throw new IllegalStateException(ex.toString());
584 public java.lang.Object newInstance(java.lang.Object parent)
589 desc.setHandler(handler);
590 desc.setMultivalued(false);
591 addFieldDescriptor(desc);
593 // -- validation code for: _ypos
594 fieldValidator = new org.exolab.castor.xml.FieldValidator();
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);
602 desc.setValidator(fieldValidator);
603 // -- initialize element descriptors
612 * Method getAccessMode.
614 * @return the access mode specified for this class.
616 public org.exolab.castor.mapping.AccessMode getAccessMode()
622 * Method getIdentity.
624 * @return the identity field, null if this class has no identity.
626 public org.exolab.castor.mapping.FieldDescriptor getIdentity()
628 return super.getIdentity();
632 * Method getJavaClass.
634 * @return the Java class represented by this descriptor.
636 public java.lang.Class getJavaClass()
638 return jalview.schemabinding.version2.StructureState.class;
642 * Method getNameSpacePrefix.
644 * @return the namespace prefix to use when marshaling as XML.
646 public java.lang.String getNameSpacePrefix()
652 * Method getNameSpaceURI.
654 * @return the namespace URI used when marshaling and unmarshaling as XML.
656 public java.lang.String getNameSpaceURI()
662 * Method getValidator.
664 * @return a specific validator for the class described by this
667 public org.exolab.castor.xml.TypeValidator getValidator()
675 * @return the XML Name for the Class being described.
677 public java.lang.String getXMLName()
683 * Method isElementDefinition.
685 * @return true if XML schema definition of this Class is that of a global
686 * element or element with anonymous type definition.
688 public boolean isElementDefinition()
690 return _elementDefinition;