paging is disabled. Patch by Yaron Shkop.
* PagedDataSource.cs (CopyTo): Improve. Patch by Yaron Shkop.
* TableStyle.cs (AddAttributesToRender): Render border style
collapse. Patch by Yaron Shkop.
* TableStyle.cs:
* TableItemStyle.cs:
* DataGridPagerStyle.cs: Call base copy and merge even if style is of
the wrong type. Patch by Yaron Shkop.
svn path=/trunk/mcs/; revision=19605
+2003-11-03 Jackson Harper <jackson@ximian.com>
+
+ * PagedDataSource.cs (PageCount): Return page count of 1 if there
+ paging is disabled. Patch by Yaron Shkop.
+ * PagedDataSource.cs (CopyTo): Improve. Patch by Yaron Shkop.
+ * TableStyle.cs (AddAttributesToRender): Render border style
+ collapse. Patch by Yaron Shkop.
+ * TableStyle.cs:
+ * TableItemStyle.cs:
+ * DataGridPagerStyle.cs: Call base copy and merge even if style is of
+ the wrong type. Patch by Yaron Shkop.
+
2003-11-03 Jackson Harper <jackson@ximian.com>
* BoundColumn.cs: Render readonly columns. Patch by Mohammad DAMT.
public override void CopyFrom(Style s)
{
- if(s != null && !s.IsEmpty && s is DataGridPagerStyle)
+ if(s != null && !s.IsEmpty)
{
base.CopyFrom(s);
+ if(!(s is DataGridPagerStyle)) return;
+
DataGridPagerStyle from = (DataGridPagerStyle)s;
if(from.IsSet(MODE))
{
public override void MergeWith(Style s)
{
- if(s != null && !s.IsEmpty && s is DataGridPagerStyle)
+ if(s != null && !s.IsEmpty)
{
+ if(base.IsEmpty)
+ {
+ base.CopyFrom(s);
+ return;
+ }
+
base.MergeWith(s);
+
+ if(!(s is DataGridPagerStyle)) return;
+
DataGridPagerStyle with = (DataGridPagerStyle)s;
if(with.IsSet(MODE) && !IsSet(MODE))
{
{
get
{
- if(dataSource != null)
- {
- int total = DataSourceCount;
+ if(dataSource != null) {
if(!IsPagingEnabled)
- {
- return total;
- }
+ return 1;
+
+ int total = DataSourceCount;
return (total + pageSize - 1)/pageSize;
}
return 0;
public void CopyTo(Array array, int index)
{
- foreach(object current in this)
- {
- array.SetValue(array, index++);
- }
+ IEnumerator enumerator = this.GetEnumerator();
+ if(enumerator == null) return;
+
+ while(enumerator.MoveNext())
+ array.SetValue(enumerator.Current, index++);
}
public IEnumerator GetEnumerator()
\r
public override void CopyFrom(Style s)\r
{\r
- if(s!=null && s is TableItemStyle && !s.IsEmpty)\r
+ if(s!=null && !s.IsEmpty)\r
{\r
base.CopyFrom(s);\r
+\r
+ if (!(s is TableItemStyle))\r
+ return;\r
+ \r
TableItemStyle from = (TableItemStyle)s;\r
if(from.IsSet(H_ALIGN))\r
{\r
\r
public override void MergeWith(Style s)\r
{\r
- if(s!=null && s is TableItemStyle && !s.IsEmpty)\r
+ if(s!=null && !s.IsEmpty)\r
{\r
+ if (base.IsEmpty) {\r
+ base.CopyFrom (s);\r
+ return;\r
+ }\r
base.MergeWith(s);\r
+\r
+ if (!(s is TableItemStyle))\r
+ return;\r
+ \r
TableItemStyle with = (TableItemStyle)s;\r
if(with.IsSet(H_ALIGN) && !IsSet(H_ALIGN))\r
{\r
if(CellSpacing >= 0)\r
{\r
writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, CellSpacing.ToString(NumberFormatInfo.InvariantInfo));\r
+ if(CellSpacing == 0)
+ writer.AddStyleAttribute(HtmlTextWriterStyle.BorderCollapse, "collapse");
+
}\r
if(CellPadding >= 0)\r
{\r
{\r
writer.AddAttribute(HtmlTextWriterAttribute.Align, Enum.Format(typeof(HorizontalAlign), HorizontalAlign, "G"));\r
}\r
- string gd = "";\r
+ string gd = String.Empty;
switch(GridLines)\r
{\r
- case GridLines.None: gd = "";\r
- break;\r
+ case GridLines.None: break;
case GridLines.Horizontal: gd = "rows";\r
break;\r
case GridLines.Vertical: gd = "cols";\r
case GridLines.Both: gd = "all";\r
break;\r
}
- if (gd != "")
writer.AddAttribute(HtmlTextWriterAttribute.Rules, gd);
}
public override void MergeWith(Style s)\r
{\r
- if(s != null && s is TableStyle && !s.IsEmpty)\r
+ if(s != null && !s.IsEmpty)\r
{\r
+ if (base.IsEmpty) {
+ base.CopyFrom (s);
+ return;
+ }
base.MergeWith(s);\r
+
+ if (!(s is TableStyle))
+ return;
+
TableStyle with = (TableStyle)s;\r
if(with.IsSet(HOR_ALIGN) && IsSet(HOR_ALIGN))\r
{\r