Files
mono/mcs/class/System.Web/System.Web.UI.WebControls/RadioButtonList.cs
T
Jordi Mas i Hernandez 32408bfd61 2005-08-03 Jordi Mas i Hernandez <[email protected]>
*  CalendarTest.cs: Trackview states

2005-08-02  Jordi Mas i Hernandez <[email protected]>

	*  RadioButtonListTest.cs: test unit

2005-07-29  Jordi Mas i Hernandez <[email protected]>

	* SelectedDatesCollectionTest.cs: new unit test
	* CalendarDayTest.cs: new unit test
	* CalendarTest.cs: more tests for calendar control

2005-07-12  Jordi Mas i Hernandez <[email protected]>

	* ButtonTest.cs: add Default constructors tests
	* ImageButtonTest.cs: Adds ImageButtonTest 

2005-07-11  Jordi Mas i Hernandez <[email protected]>

	* ButtonTest.cs: New unit test for Button

2005-08-04  Jordi Mas i Hernandez  <[email protected]>

	* Calendar.cs: fixes issues with OnDayRender event and others

2005-08-03  Jordi Mas i Hernandez  <[email protected]>

	* Calendar.cs: fixes Save/Load state

2005-08-03  Jordi Mas i Hernandez  <[email protected]>

	* Calendar.cs: bug fixes

2005-08-02  Jordi Mas i Hernandez  <[email protected]>

	* RadioButtonList.cs: bug fixes

2005-08-02  Jordi Mas i Hernandez  <[email protected]>

	* CheckBox.cs, RadioButton.cs: mecanism to avoid exposing  
	AddAttributesToRender
	* RadioButtonList.cs: Implementation

2005-08-01  Jordi Mas i Hernandez  <[email protected]>

	* ImageButton.cs: fixes, complete missing parts

2005-07-29  Jordi Mas i Hernandez  <[email protected]>

	* Calendar.cs: fixes exceptions, bug fixes, new features
	* SelectedDatesCollection.cs: Fixes bugs discovered by the tests
 	* CalendarDay.cs: fixes default value

2005-07-27  Jordi Mas i Hernandez  <[email protected]>

	* Calendar.cs: get the styles right, honors more properties, fixes, fix 
	var names style

2005-07-26  Jordi Mas i Hernandez  <[email protected]>

	* Calendar.cs: selection of dates, state load, save, track, support
	for new properties, many fixes. 

2005-07-23  Jordi Mas i Hernandez  <[email protected]>

	* Button.cs: fixes events, adds attributes

2005-07-22  Jordi Mas i Hernandez  <[email protected]>
	* Calendar.cs: Initial implementation
	* CalendarSelectionMode.cs: fix enum order

2005-07-12  Jordi Mas i Hernandez  <[email protected]>

	* TitleFormat.cs: Add attribute
	* TextBoxMode.cs: Add attribute
	* CalendarDay.cs: Initial implementation
	* ImageButton.cs: Initial implementation
	* CalendarSelectionMode.cs:Initial implementation

2005-07-12  Jordi Mas i Hernandez  <[email protected]>

	* TextBoxMode.cs: simple enum
	* TitleFormat.cs: simple enum

2005-07-10  Jordi Mas i Hernandez  <[email protected]> 
 
	* Button.cs: Initial Button implementation

svn path=/trunk/mcs/; revision=48923
2005-08-26 22:29:03 +00:00

285 lines
6.6 KiB
C#

//
// System.Web.UI.WebControls.RadioButtonList.cs
//
// Authors:
// Jordi Mas i Hernandez ([email protected])
//
// (C) 2005 Novell, Inc (http://www.novell.com)
//
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//
using System.Collections;
using System.ComponentModel;
using System.Collections.Specialized;
namespace System.Web.UI.WebControls {
[ValidationProperty ("SelectedItem")]
public class RadioButtonList : ListControl, IRepeatInfoUser,
INamingContainer, IPostBackDataHandler {
public RadioButtonList ()
{
}
#if ONLY_1_1
[Bindable (true)]
#endif
[DefaultValue (-1)]
public virtual int CellPadding {
get {
if (ControlStyleCreated == false)
return -1; // default value
return ((TableStyle) ControlStyle).CellPadding;
}
set {
((TableStyle) ControlStyle).CellPadding = value;
}
}
#if ONLY_1_1
[Bindable (true)]
#endif
[DefaultValue (-1)]
public virtual int CellSpacing {
get {
if (ControlStyleCreated == false)
return -1; // default value
return ((TableStyle) ControlStyle).CellSpacing;
}
set {
((TableStyle) ControlStyle).CellSpacing = value;
}
}
#if ONLY_1_1
[Bindable (true)]
#endif
[DefaultValue (0)]
public virtual int RepeatColumns {
get {
return ViewState.GetInt ("RepeatColumns", 0);
}
set {
if (value < 0)
throw new ArgumentOutOfRangeException ("The number of columns is set to a negative value.");
ViewState ["RepeatColumns"] = value;
}
}
#if ONLY_1_1
[Bindable (true)]
#endif
[DefaultValue (RepeatDirection.Vertical)]
public virtual RepeatDirection RepeatDirection {
get {
return (RepeatDirection) ViewState.GetInt ("RepeatDirection", (int) RepeatDirection.Vertical);
}
set {
if (value != RepeatDirection.Horizontal && value != RepeatDirection.Vertical)
throw new ArgumentOutOfRangeException ("he display direction of the list is not one of the RepeatDirection values.");
ViewState ["RepeatDirection"] = value;
}
}
#if ONLY_1_1
[Bindable (true)]
#endif
[DefaultValue (RepeatLayout.Table)]
public virtual RepeatLayout RepeatLayout {
get {
return (RepeatLayout) ViewState.GetInt ("RepeatLayout", (int) RepeatLayout.Table);
}
set {
if (value != RepeatLayout.Flow && value != RepeatLayout.Table)
throw new ArgumentOutOfRangeException ("The radio buttons layout is not one of the RepeatLayout values.");
ViewState ["RepeatLayout"] = value;
}
}
#if ONLY_1_1
[Bindable (true)]
#endif
[DefaultValue (TextAlign.Right)]
public virtual TextAlign TextAlign {
get {
return (TextAlign )ViewState.GetInt ("TextAlign", (int) TextAlign.Right);
}
set {
if (value != TextAlign.Left && value != TextAlign.Right)
throw new ArgumentOutOfRangeException ("The label text alignment associated with the radio buttons is not one of the TextAlign values.");
ViewState ["TextAlign"] = value;
}
}
// Interface properties
#if NET_2_0
[MonoTODO]
protected virtual bool HasFooter
{
get {
throw new NotImplementedException ();
}
}
[MonoTODO]
protected virtual bool HasHeader
{
get {
throw new NotImplementedException ();
}
}
[MonoTODO]
protected virtual bool HasSeparators
{
get {
throw new NotImplementedException ();
}
}
[MonoTODO]
protected virtual int RepeatedItemCount
{
get {
throw new NotImplementedException ();
}
}
#endif
bool IRepeatInfoUser.HasFooter {
get { return false; }
}
bool IRepeatInfoUser.HasHeader {
get { return false; }
}
bool IRepeatInfoUser.HasSeparators {
get { return false; }
}
int IRepeatInfoUser.RepeatedItemCount {
get { return Items.Count; }
}
protected override Style CreateControlStyle ()
{
return new TableStyle (ViewState);
}
#if NET_2_0
[MonoTODO]
protected override Control FindControl (string id, int pathOffset)
{
throw new NotImplementedException ();
}
[MonoTODO]
protected virtual Style GetItemStyle (ListItemType itemType, int repeatIndex)
{
throw new NotImplementedException ();
}
[MonoTODO]
protected virtual bool LoadPostData (string postDataKey, NameValueCollection postCollection)
{
throw new NotImplementedException ();
}
[MonoTODO]
protected virtual void RaisePostDataChangedEvent ()
{
throw new NotImplementedException ();
}
[MonoTODO]
protected virtual void RenderItem (ListItemType itemType, int repeatIndex, RepeatInfo repeatInfo, HtmlTextWriter writer)
{
throw new NotImplementedException ();
}
#endif
[MonoTODO]
bool IPostBackDataHandler.LoadPostData (string postDataKey, NameValueCollection postCollection)
{
return true;
}
[MonoTODO]
void IPostBackDataHandler.RaisePostDataChangedEvent ()
{
}
Style IRepeatInfoUser.GetItemStyle (ListItemType itemType, int repeatIndex)
{
return null;
}
void IRepeatInfoUser.RenderItem (ListItemType itemType, int repeatIndex, RepeatInfo repeatInfo, HtmlTextWriter writer)
{
RadioButton radio = new RadioButton ();
radio.Text = Items [repeatIndex].Text;
radio.ID = ClientID + "_" + repeatIndex;
radio.TextAlign = TextAlign;
radio.GroupName = UniqueID;
radio.Page = Page;
radio.Checked = Items [repeatIndex].Selected;
radio.Attributes["Value"] = Items [repeatIndex].Value;
radio.RenderControl (writer);
}
#if NET_2_0
protected internal
#else
protected
#endif
override void Render (HtmlTextWriter writer)
{
RepeatInfo repeat = new RepeatInfo ();
repeat.RepeatColumns = RepeatColumns;
repeat.RepeatDirection = RepeatDirection;
repeat.RepeatLayout = RepeatLayout;
repeat.RenderRepeater (writer, this, ControlStyle, this);
}
}
}