context: /*************************************************************************
   *
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
   * 
   * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
   * 
   * Use is subject to license terms.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License"); you may not
   * use this file except in compliance with the License. You may obtain a copy
   * of the License at http://www.apache.org/licenses/LICENSE-2.0. You can also
   * obtain a copy of the License at http://odftoolkit.org/docs/license.txt
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * 
   * See the License for the specific language governing permissions and
   * limitations under the License.
   *
   ************************************************************************/
  
  using System;
  using AODL.Document;
  using AODL.Document.Forms;
  using System.Xml;
  using AODL.Document.Content;
  
  namespace AODL.Document.Forms.Controls
  {
  	public class ODFRadioButton: ODFFormControl
  	{
  		public override string Type
  		{
  			get
  			{
  				return "radio";
  			}
  		}
  
  		/// <summary>
  		/// Specifies the default value of the control
  		/// </summary>
  		public string Value
  		{
  			get
  			{
  				XmlNode xn = this._node.SelectSingleNode("@form:value", 
  					this._document.NamespaceManager);
  				if (xn == null) return null;
  				return xn.InnerText; 
  			}
  			set
  			{
  				XmlNode nd = this._node.SelectSingleNode("@form:value", 
  					this._document.NamespaceManager);
  				if (nd == null)
  					nd = this.Node.Attributes.Append(this._document.CreateAttribute("value", "form"));
  				nd.InnerText = value;
  			}
  		}
  
  		/// <summary>
  		/// Contains a label for the control
  		/// </summary>
  		public string Label
  		{
  			get
  			{
  				XmlNode xn;
  				xn = this._node.SelectSingleNode("@form:label", 
  					this._document.NamespaceManager);
  				if (xn == null) return null;
  				return xn.InnerText;
  			}
  			set
  			{
  				XmlNode nd = this._node.SelectSingleNode("@form:label", 
  					this._document.NamespaceManager);
  				if (nd == null)
  					nd = this.Node.Attributes.Append(this._document.CreateAttribute("label", "form"));
  				nd.InnerText = value;
  			}
  		}
  
  		/// <summary>
  		/// Specifies whether or not a control can accept user input
  		/// </summary>
  		public XmlBoolean Disabled
  		{
  			get
  			{
  				XmlNode xn = this._node.SelectSingleNode("@form:disabled", 
  					this._document.NamespaceManager);
  				if (xn == null) return XmlBoolean.NotSet;
  
  				string s = xn.InnerText;	
  				XmlBoolean at;
  				switch (s)
  				{
  					case "true": at = XmlBoolean.True; break;
  					case "false": at = XmlBoolean.False; break;
  					default: at = XmlBoolean.NotSet; break;
  				}
  				return at;
  			}
  			set
  			{
  				string s;
  				switch (value)
  				{
  					case XmlBoolean.True: s = "true"; break;
  					case XmlBoolean.False: s = "false"; break;
  					default: return;
  				}
  				XmlNode nd = this._node.SelectSingleNode("@form:disabled", 
  					this._document.NamespaceManager);
  				if (nd == null)
  					nd = this.Node.Attributes.Append(this._document.CreateAttribute("disabled", "form"));
  				nd.InnerText = s;
  			}
  		}
  
  
  		/// <summary>
  		/// Contains additional information about a control.
  		/// </summary>
  		public string Title
  		{
  			get
  			{
  				XmlNode xn = this._node.SelectSingleNode("@form:title", 
  					this._document.NamespaceManager);
  				if (xn == null) return null;
  				return xn.InnerText;
  			}
  			set
  			{
  				XmlNode nd = this._node.SelectSingleNode("@form:title", 
  					this._document.NamespaceManager);
  				if (nd == null)
  					nd = this.Node.Attributes.Append(this._document.CreateAttribute("title", "form"));
  				nd.InnerText = value;
  			}
  		}
  
  		/// <summary>
  		/// Specifies the name of a result set column. The result set is 
  		/// determined by the form which the control belongs to
  		/// </summary>
  		public string DataField
  		{
  			get
  			{
  				XmlNode xn = this._node.SelectSingleNode("@form:data-field", 
  					this._document.NamespaceManager);
  				if (xn == null) return null;
  				return xn.InnerText;
  			}
  			set
  			{
  				XmlNode nd = this._node.SelectSingleNode("@form:data-field", 
  					this._document.NamespaceManager);
  				if (nd == null)
  					nd = this.Node.Attributes.Append(this._document.CreateAttribute("title", "form"));
  				nd.InnerText = value;
  			}
  		}
  
  		/// <summary>
  		/// Specifies the tabbing navigation order of a control within a form
  		/// </summary>
  		public int TabIndex
  		{
  			get
  			{
  				return int.Parse(this._node.SelectSingleNode("@form:tab-index", 
  					this._document.NamespaceManager).InnerText);
  			}
  			set
  			{
  				XmlNode nd = this._node.SelectSingleNode("@form:tab-index", 
  					this._document.NamespaceManager);
  				if (nd == null)
  					nd = this.Node.Attributes.Append(this._document.CreateAttribute("tab-index", "form"));
  				nd.InnerText = value.ToString();
  			}
  		}
  
  		/// <summary>
  		/// Specifies whether or not a control is included in the tabbing 
  		/// navigation order
  		/// </summary>
  		public XmlBoolean TabStop
  		{
  			get
  			{
  				XmlNode xn = this._node.SelectSingleNode("@form:tab-stop", 
  					this._document.NamespaceManager);
  				if (xn == null) return XmlBoolean.NotSet;
  
  				string s = xn.InnerText;	
  				XmlBoolean at;
  				switch (s)
  				{
  					case "true": at = XmlBoolean.True; break;
  					case "false": at = XmlBoolean.False; break;
  
gt: 					default: at = XmlBoolean.NotSet; break;