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
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/>.
18 package jalview.schemabinding.version2.descriptors;
20 //---------------------------------/
21 //- Imported classes and packages -/
22 //---------------------------------/
24 import jalview.schemabinding.version2.StructureState;
27 * Class StructureStateDescriptor.
29 * @version $Revision$ $Date$
31 public class StructureStateDescriptor extends
32 org.exolab.castor.xml.util.XMLClassDescriptorImpl
35 // --------------------------/
36 // - Class/Member Variables -/
37 // --------------------------/
40 * Field _elementDefinition.
42 private boolean _elementDefinition;
47 private java.lang.String _nsPrefix;
52 private java.lang.String _nsURI;
57 private java.lang.String _xmlName;
63 public StructureStateDescriptor()
66 _nsURI = "www.jalview.org";
67 _xmlName = "structureState";
68 _elementDefinition = true;
69 org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
70 org.exolab.castor.mapping.FieldHandler handler = null;
71 org.exolab.castor.xml.FieldValidator fieldValidator = null;
73 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
74 java.lang.String.class, "_content", "PCDATA",
75 org.exolab.castor.xml.NodeType.Text);
76 desc.setImmutable(true);
77 handler = new org.exolab.castor.xml.XMLFieldHandler()
79 public java.lang.Object getValue(java.lang.Object object)
80 throws IllegalStateException
82 StructureState target = (StructureState) object;
83 return target.getContent();
86 public void setValue(java.lang.Object object, java.lang.Object value)
87 throws IllegalStateException, IllegalArgumentException
91 StructureState target = (StructureState) object;
92 target.setContent((java.lang.String) value);
93 } catch (java.lang.Exception ex)
95 throw new IllegalStateException(ex.toString());
99 public java.lang.Object newInstance(java.lang.Object parent)
104 desc.setHandler(handler);
105 addFieldDescriptor(desc);
107 // -- validation code for: _content
108 fieldValidator = new org.exolab.castor.xml.FieldValidator();
110 org.exolab.castor.xml.validators.StringValidator typeValidator;
111 typeValidator = new org.exolab.castor.xml.validators.StringValidator();
112 fieldValidator.setValidator(typeValidator);
113 typeValidator.setWhiteSpace("preserve");
115 desc.setValidator(fieldValidator);
116 // -- initialize attribute descriptors
119 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
120 java.lang.Boolean.TYPE, "_visible", "visible",
121 org.exolab.castor.xml.NodeType.Attribute);
122 handler = new org.exolab.castor.xml.XMLFieldHandler()
124 public java.lang.Object getValue(java.lang.Object object)
125 throws IllegalStateException
127 StructureState target = (StructureState) object;
128 if (!target.hasVisible())
132 return (target.getVisible() ? java.lang.Boolean.TRUE
133 : java.lang.Boolean.FALSE);
136 public void setValue(java.lang.Object object, java.lang.Object value)
137 throws IllegalStateException, IllegalArgumentException
141 StructureState target = (StructureState) object;
142 // if null, use delete method for optional primitives
145 target.deleteVisible();
148 target.setVisible(((java.lang.Boolean) value).booleanValue());
149 } catch (java.lang.Exception ex)
151 throw new IllegalStateException(ex.toString());
155 public java.lang.Object newInstance(java.lang.Object parent)
160 desc.setHandler(handler);
161 desc.setMultivalued(false);
162 addFieldDescriptor(desc);
164 // -- validation code for: _visible
165 fieldValidator = new org.exolab.castor.xml.FieldValidator();
167 org.exolab.castor.xml.validators.BooleanValidator typeValidator;
168 typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
169 fieldValidator.setValidator(typeValidator);
171 desc.setValidator(fieldValidator);
173 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
174 java.lang.String.class, "_viewId", "viewId",
175 org.exolab.castor.xml.NodeType.Attribute);
176 desc.setImmutable(true);
177 handler = new org.exolab.castor.xml.XMLFieldHandler()
179 public java.lang.Object getValue(java.lang.Object object)
180 throws IllegalStateException
182 StructureState target = (StructureState) object;
183 return target.getViewId();
186 public void setValue(java.lang.Object object, java.lang.Object value)
187 throws IllegalStateException, IllegalArgumentException
191 StructureState target = (StructureState) object;
192 target.setViewId((java.lang.String) value);
193 } catch (java.lang.Exception ex)
195 throw new IllegalStateException(ex.toString());
199 public java.lang.Object newInstance(java.lang.Object parent)
204 desc.setHandler(handler);
205 desc.setMultivalued(false);
206 addFieldDescriptor(desc);
208 // -- validation code for: _viewId
209 fieldValidator = new org.exolab.castor.xml.FieldValidator();
211 org.exolab.castor.xml.validators.StringValidator typeValidator;
212 typeValidator = new org.exolab.castor.xml.validators.StringValidator();
213 fieldValidator.setValidator(typeValidator);
214 typeValidator.setWhiteSpace("preserve");
216 desc.setValidator(fieldValidator);
217 // -- _alignwithAlignPanel
218 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
219 java.lang.Boolean.TYPE, "_alignwithAlignPanel",
220 "alignwithAlignPanel", org.exolab.castor.xml.NodeType.Attribute);
221 handler = new org.exolab.castor.xml.XMLFieldHandler()
223 public java.lang.Object getValue(java.lang.Object object)
224 throws IllegalStateException
226 StructureState target = (StructureState) object;
227 if (!target.hasAlignwithAlignPanel())
231 return (target.getAlignwithAlignPanel() ? java.lang.Boolean.TRUE
232 : java.lang.Boolean.FALSE);
235 public void setValue(java.lang.Object object, java.lang.Object value)
236 throws IllegalStateException, IllegalArgumentException
240 StructureState target = (StructureState) object;
241 // if null, use delete method for optional primitives
244 target.deleteAlignwithAlignPanel();
247 target.setAlignwithAlignPanel(((java.lang.Boolean) value)
249 } catch (java.lang.Exception ex)
251 throw new IllegalStateException(ex.toString());
255 public java.lang.Object newInstance(java.lang.Object parent)
260 desc.setHandler(handler);
261 desc.setMultivalued(false);
262 addFieldDescriptor(desc);
264 // -- validation code for: _alignwithAlignPanel
265 fieldValidator = new org.exolab.castor.xml.FieldValidator();
267 org.exolab.castor.xml.validators.BooleanValidator typeValidator;
268 typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
269 fieldValidator.setValidator(typeValidator);
271 desc.setValidator(fieldValidator);
272 // -- _colourwithAlignPanel
273 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
274 java.lang.Boolean.TYPE, "_colourwithAlignPanel",
275 "colourwithAlignPanel",
276 org.exolab.castor.xml.NodeType.Attribute);
277 handler = new org.exolab.castor.xml.XMLFieldHandler()
279 public java.lang.Object getValue(java.lang.Object object)
280 throws IllegalStateException
282 StructureState target = (StructureState) object;
283 if (!target.hasColourwithAlignPanel())
287 return (target.getColourwithAlignPanel() ? java.lang.Boolean.TRUE
288 : java.lang.Boolean.FALSE);
291 public void setValue(java.lang.Object object, java.lang.Object value)
292 throws IllegalStateException, IllegalArgumentException
296 StructureState target = (StructureState) object;
297 // if null, use delete method for optional primitives
300 target.deleteColourwithAlignPanel();
303 target.setColourwithAlignPanel(((java.lang.Boolean) value)
305 } catch (java.lang.Exception ex)
307 throw new IllegalStateException(ex.toString());
311 public java.lang.Object newInstance(java.lang.Object parent)
316 desc.setHandler(handler);
317 desc.setMultivalued(false);
318 addFieldDescriptor(desc);
320 // -- validation code for: _colourwithAlignPanel
321 fieldValidator = new org.exolab.castor.xml.FieldValidator();
323 org.exolab.castor.xml.validators.BooleanValidator typeValidator;
324 typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
325 fieldValidator.setValidator(typeValidator);
327 desc.setValidator(fieldValidator);
329 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
330 java.lang.Boolean.TYPE, "_colourByJmol", "colourByJmol",
331 org.exolab.castor.xml.NodeType.Attribute);
332 handler = new org.exolab.castor.xml.XMLFieldHandler()
334 public java.lang.Object getValue(java.lang.Object object)
335 throws IllegalStateException
337 StructureState target = (StructureState) object;
338 if (!target.hasColourByJmol())
342 return (target.getColourByJmol() ? java.lang.Boolean.TRUE
343 : java.lang.Boolean.FALSE);
346 public void setValue(java.lang.Object object, java.lang.Object value)
347 throws IllegalStateException, IllegalArgumentException
351 StructureState target = (StructureState) object;
352 // if null, use delete method for optional primitives
355 target.deleteColourByJmol();
358 target.setColourByJmol(((java.lang.Boolean) value).booleanValue());
359 } catch (java.lang.Exception ex)
361 throw new IllegalStateException(ex.toString());
365 public java.lang.Object newInstance(java.lang.Object parent)
370 desc.setHandler(handler);
371 desc.setMultivalued(false);
372 addFieldDescriptor(desc);
374 // -- validation code for: _colourByJmol
375 fieldValidator = new org.exolab.castor.xml.FieldValidator();
377 org.exolab.castor.xml.validators.BooleanValidator typeValidator;
378 typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
379 fieldValidator.setValidator(typeValidator);
381 desc.setValidator(fieldValidator);
383 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
384 java.lang.Integer.TYPE, "_width", "width",
385 org.exolab.castor.xml.NodeType.Attribute);
386 handler = new org.exolab.castor.xml.XMLFieldHandler()
388 public java.lang.Object getValue(java.lang.Object object)
389 throws IllegalStateException
391 StructureState target = (StructureState) object;
392 if (!target.hasWidth())
396 return new java.lang.Integer(target.getWidth());
399 public void setValue(java.lang.Object object, java.lang.Object value)
400 throws IllegalStateException, IllegalArgumentException
404 StructureState target = (StructureState) object;
405 // if null, use delete method for optional primitives
408 target.deleteWidth();
411 target.setWidth(((java.lang.Integer) value).intValue());
412 } catch (java.lang.Exception ex)
414 throw new IllegalStateException(ex.toString());
418 public java.lang.Object newInstance(java.lang.Object parent)
423 desc.setHandler(handler);
424 desc.setMultivalued(false);
425 addFieldDescriptor(desc);
427 // -- validation code for: _width
428 fieldValidator = new org.exolab.castor.xml.FieldValidator();
430 org.exolab.castor.xml.validators.IntValidator typeValidator;
431 typeValidator = new org.exolab.castor.xml.validators.IntValidator();
432 fieldValidator.setValidator(typeValidator);
433 typeValidator.setMinInclusive(-2147483648);
434 typeValidator.setMaxInclusive(2147483647);
436 desc.setValidator(fieldValidator);
438 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
439 java.lang.Integer.TYPE, "_height", "height",
440 org.exolab.castor.xml.NodeType.Attribute);
441 handler = new org.exolab.castor.xml.XMLFieldHandler()
443 public java.lang.Object getValue(java.lang.Object object)
444 throws IllegalStateException
446 StructureState target = (StructureState) object;
447 if (!target.hasHeight())
451 return new java.lang.Integer(target.getHeight());
454 public void setValue(java.lang.Object object, java.lang.Object value)
455 throws IllegalStateException, IllegalArgumentException
459 StructureState target = (StructureState) object;
460 // if null, use delete method for optional primitives
463 target.deleteHeight();
466 target.setHeight(((java.lang.Integer) value).intValue());
467 } catch (java.lang.Exception ex)
469 throw new IllegalStateException(ex.toString());
473 public java.lang.Object newInstance(java.lang.Object parent)
478 desc.setHandler(handler);
479 desc.setMultivalued(false);
480 addFieldDescriptor(desc);
482 // -- validation code for: _height
483 fieldValidator = new org.exolab.castor.xml.FieldValidator();
485 org.exolab.castor.xml.validators.IntValidator typeValidator;
486 typeValidator = new org.exolab.castor.xml.validators.IntValidator();
487 fieldValidator.setValidator(typeValidator);
488 typeValidator.setMinInclusive(-2147483648);
489 typeValidator.setMaxInclusive(2147483647);
491 desc.setValidator(fieldValidator);
493 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
494 java.lang.Integer.TYPE, "_xpos", "xpos",
495 org.exolab.castor.xml.NodeType.Attribute);
496 handler = new org.exolab.castor.xml.XMLFieldHandler()
498 public java.lang.Object getValue(java.lang.Object object)
499 throws IllegalStateException
501 StructureState target = (StructureState) object;
502 if (!target.hasXpos())
506 return new java.lang.Integer(target.getXpos());
509 public void setValue(java.lang.Object object, java.lang.Object value)
510 throws IllegalStateException, IllegalArgumentException
514 StructureState target = (StructureState) object;
515 // if null, use delete method for optional primitives
521 target.setXpos(((java.lang.Integer) value).intValue());
522 } catch (java.lang.Exception ex)
524 throw new IllegalStateException(ex.toString());
528 public java.lang.Object newInstance(java.lang.Object parent)
533 desc.setHandler(handler);
534 desc.setMultivalued(false);
535 addFieldDescriptor(desc);
537 // -- validation code for: _xpos
538 fieldValidator = new org.exolab.castor.xml.FieldValidator();
540 org.exolab.castor.xml.validators.IntValidator typeValidator;
541 typeValidator = new org.exolab.castor.xml.validators.IntValidator();
542 fieldValidator.setValidator(typeValidator);
543 typeValidator.setMinInclusive(-2147483648);
544 typeValidator.setMaxInclusive(2147483647);
546 desc.setValidator(fieldValidator);
548 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
549 java.lang.Integer.TYPE, "_ypos", "ypos",
550 org.exolab.castor.xml.NodeType.Attribute);
551 handler = new org.exolab.castor.xml.XMLFieldHandler()
553 public java.lang.Object getValue(java.lang.Object object)
554 throws IllegalStateException
556 StructureState target = (StructureState) object;
557 if (!target.hasYpos())
561 return new java.lang.Integer(target.getYpos());
564 public void setValue(java.lang.Object object, java.lang.Object value)
565 throws IllegalStateException, IllegalArgumentException
569 StructureState target = (StructureState) object;
570 // if null, use delete method for optional primitives
576 target.setYpos(((java.lang.Integer) value).intValue());
577 } catch (java.lang.Exception ex)
579 throw new IllegalStateException(ex.toString());
583 public java.lang.Object newInstance(java.lang.Object parent)
588 desc.setHandler(handler);
589 desc.setMultivalued(false);
590 addFieldDescriptor(desc);
592 // -- validation code for: _ypos
593 fieldValidator = new org.exolab.castor.xml.FieldValidator();
595 org.exolab.castor.xml.validators.IntValidator typeValidator;
596 typeValidator = new org.exolab.castor.xml.validators.IntValidator();
597 fieldValidator.setValidator(typeValidator);
598 typeValidator.setMinInclusive(-2147483648);
599 typeValidator.setMaxInclusive(2147483647);
601 desc.setValidator(fieldValidator);
602 // -- initialize element descriptors
611 * Method getAccessMode.
613 * @return the access mode specified for this class.
615 public org.exolab.castor.mapping.AccessMode getAccessMode()
621 * Method getIdentity.
623 * @return the identity field, null if this class has no identity.
625 public org.exolab.castor.mapping.FieldDescriptor getIdentity()
627 return super.getIdentity();
631 * Method getJavaClass.
633 * @return the Java class represented by this descriptor.
635 public java.lang.Class getJavaClass()
637 return jalview.schemabinding.version2.StructureState.class;
641 * Method getNameSpacePrefix.
643 * @return the namespace prefix to use when marshaling as XML.
645 public java.lang.String getNameSpacePrefix()
651 * Method getNameSpaceURI.
653 * @return the namespace URI used when marshaling and unmarshaling as XML.
655 public java.lang.String getNameSpaceURI()
661 * Method getValidator.
663 * @return a specific validator for the class described by this
666 public org.exolab.castor.xml.TypeValidator getValidator()
674 * @return the XML Name for the Class being described.
676 public java.lang.String getXMLName()
682 * Method isElementDefinition.
684 * @return true if XML schema definition of this Class is that of a global
685 * element or element with anonymous type definition.
687 public boolean isElementDefinition()
689 return _elementDefinition;