2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6)
3 * Copyright (C) 2010 J Procter, AM Waterhouse, 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;
20 //---------------------------------/
21 //- Imported classes and packages -/
22 //---------------------------------/
24 import org.exolab.castor.xml.Marshaller;
25 import org.exolab.castor.xml.Unmarshaller;
28 * Class StructureState.
30 * @version $Revision$ $Date$
32 public class StructureState implements java.io.Serializable
35 // --------------------------/
36 // - Class/Member Variables -/
37 // --------------------------/
40 * internal content storage
42 private java.lang.String _content = "";
47 private boolean _visible;
50 * keeps track of state for field: _visible
52 private boolean _has_visible;
60 * keeps track of state for field: _xpos
62 private boolean _has_xpos;
70 * keeps track of state for field: _ypos
72 private boolean _has_ypos;
80 * keeps track of state for field: _width
82 private boolean _has_width;
90 * keeps track of state for field: _height
92 private boolean _has_height;
95 * additional identifier which properly disambiguates the structure view from
96 * any other view with the same attributes. This is not an ID, because it is
97 * possible to have many references to the same physical structure view from
98 * different sequences in an alignment. A structureState element citing the
99 * same viewId will appear for each instance.
101 private java.lang.String _viewId;
107 public StructureState()
119 public void deleteHeight()
121 this._has_height = false;
126 public void deleteVisible()
128 this._has_visible = false;
133 public void deleteWidth()
135 this._has_width = false;
140 public void deleteXpos()
142 this._has_xpos = false;
147 public void deleteYpos()
149 this._has_ypos = false;
153 * Returns the value of field 'content'. The field 'content' has the following
154 * description: internal content storage
156 * @return the value of field 'Content'.
158 public java.lang.String getContent()
160 return this._content;
164 * Returns the value of field 'height'.
166 * @return the value of field 'Height'.
168 public int getHeight()
174 * Returns the value of field 'viewId'. The field 'viewId' has the following
175 * description: additional identifier which properly disambiguates the
176 * structure view from any other view with the same attributes. This is not an
177 * ID, because it is possible to have many references to the same physical
178 * structure view from different sequences in an alignment. A structureState
179 * element citing the same viewId will appear for each instance.
181 * @return the value of field 'ViewId'.
183 public java.lang.String getViewId()
189 * Returns the value of field 'visible'.
191 * @return the value of field 'Visible'.
193 public boolean getVisible()
195 return this._visible;
199 * Returns the value of field 'width'.
201 * @return the value of field 'Width'.
203 public int getWidth()
209 * Returns the value of field 'xpos'.
211 * @return the value of field 'Xpos'.
219 * Returns the value of field 'ypos'.
221 * @return the value of field 'Ypos'.
231 * @return true if at least one Height has been added
233 public boolean hasHeight()
235 return this._has_height;
241 * @return true if at least one Visible has been added
243 public boolean hasVisible()
245 return this._has_visible;
251 * @return true if at least one Width has been added
253 public boolean hasWidth()
255 return this._has_width;
261 * @return true if at least one Xpos has been added
263 public boolean hasXpos()
265 return this._has_xpos;
271 * @return true if at least one Ypos has been added
273 public boolean hasYpos()
275 return this._has_ypos;
281 * @return true if this object is valid according to the schema
283 public boolean isValid()
288 } catch (org.exolab.castor.xml.ValidationException vex)
296 * Returns the value of field 'visible'.
298 * @return the value of field 'Visible'.
300 public boolean isVisible()
302 return this._visible;
309 * @throws org.exolab.castor.xml.MarshalException
310 * if object is null or if any SAXException is thrown during
312 * @throws org.exolab.castor.xml.ValidationException
313 * if this object is an invalid instance according to the schema
315 public void marshal(final java.io.Writer out)
316 throws org.exolab.castor.xml.MarshalException,
317 org.exolab.castor.xml.ValidationException
319 Marshaller.marshal(this, out);
326 * @throws java.io.IOException
327 * if an IOException occurs during marshaling
328 * @throws org.exolab.castor.xml.ValidationException
329 * if this object is an invalid instance according to the schema
330 * @throws org.exolab.castor.xml.MarshalException
331 * if object is null or if any SAXException is thrown during
334 public void marshal(final org.xml.sax.ContentHandler handler)
335 throws java.io.IOException,
336 org.exolab.castor.xml.MarshalException,
337 org.exolab.castor.xml.ValidationException
339 Marshaller.marshal(this, handler);
343 * Sets the value of field 'content'. The field 'content' has the following
344 * description: internal content storage
347 * the value of field 'content'.
349 public void setContent(final java.lang.String content)
351 this._content = content;
355 * Sets the value of field 'height'.
358 * the value of field 'height'.
360 public void setHeight(final int height)
362 this._height = height;
363 this._has_height = true;
367 * Sets the value of field 'viewId'. The field 'viewId' has the following
368 * description: additional identifier which properly disambiguates the
369 * structure view from any other view with the same attributes. This is not an
370 * ID, because it is possible to have many references to the same physical
371 * structure view from different sequences in an alignment. A structureState
372 * element citing the same viewId will appear for each instance.
375 * the value of field 'viewId'.
377 public void setViewId(final java.lang.String viewId)
379 this._viewId = viewId;
383 * Sets the value of field 'visible'.
386 * the value of field 'visible'.
388 public void setVisible(final boolean visible)
390 this._visible = visible;
391 this._has_visible = true;
395 * Sets the value of field 'width'.
398 * the value of field 'width'.
400 public void setWidth(final int width)
403 this._has_width = true;
407 * Sets the value of field 'xpos'.
410 * the value of field 'xpos'.
412 public void setXpos(final int xpos)
415 this._has_xpos = true;
419 * Sets the value of field 'ypos'.
422 * the value of field 'ypos'.
424 public void setYpos(final int ypos)
427 this._has_ypos = true;
434 * @throws org.exolab.castor.xml.MarshalException
435 * if object is null or if any SAXException is thrown during
437 * @throws org.exolab.castor.xml.ValidationException
438 * if this object is an invalid instance according to the schema
439 * @return the unmarshaled jalview.schemabinding.version2.StructureState
441 public static jalview.schemabinding.version2.StructureState unmarshal(
442 final java.io.Reader reader)
443 throws org.exolab.castor.xml.MarshalException,
444 org.exolab.castor.xml.ValidationException
446 return (jalview.schemabinding.version2.StructureState) Unmarshaller
447 .unmarshal(jalview.schemabinding.version2.StructureState.class,
454 * @throws org.exolab.castor.xml.ValidationException
455 * if this object is an invalid instance according to the schema
457 public void validate() throws org.exolab.castor.xml.ValidationException
459 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
460 validator.validate(this);