struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hus...@apache.org
Subject svn commit: r209749 - in /struts/sandbox/trunk/overdrive/Nexus: Core/Core.csproj Extras/Extras.csproj Test/Test.csproj Web/BaseGridPage.aspx.cs Web/NexusDataGrid.cs Web/Web.csproj
Date Fri, 08 Jul 2005 12:51:04 GMT
Author: husted
Date: Fri Jul  8 05:51:03 2005
New Revision: 209749

URL: http://svn.apache.org/viewcvs?rev=209749&view=rev
Log:
OVR-19
* Add NexusDataGrid to provide for mouse-rollovers and other special UI effects.

Added:
    struts/sandbox/trunk/overdrive/Nexus/Web/NexusDataGrid.cs
Modified:
    struts/sandbox/trunk/overdrive/Nexus/Core/Core.csproj
    struts/sandbox/trunk/overdrive/Nexus/Extras/Extras.csproj
    struts/sandbox/trunk/overdrive/Nexus/Test/Test.csproj
    struts/sandbox/trunk/overdrive/Nexus/Web/BaseGridPage.aspx.cs
    struts/sandbox/trunk/overdrive/Nexus/Web/Web.csproj

Modified: struts/sandbox/trunk/overdrive/Nexus/Core/Core.csproj
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Core/Core.csproj?rev=209749&r1=209748&r2=209749&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Core/Core.csproj (original)
+++ struts/sandbox/trunk/overdrive/Nexus/Core/Core.csproj Fri Jul  8 05:51:03 2005
@@ -29,7 +29,7 @@
                     CheckForOverflowUnderflow = "false"
                     ConfigurationOverrideFile = ""
                     DefineConstants = "DEBUG;TRACE"
-                    DocumentationFile = "Agility.Core"
+                    DocumentationFile = "Nexus.Core.xml"
                     DebugSymbols = "true"
                     FileAlignment = "4096"
                     IncrementalBuild = "false"

Modified: struts/sandbox/trunk/overdrive/Nexus/Extras/Extras.csproj
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Extras/Extras.csproj?rev=209749&r1=209748&r2=209749&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Extras/Extras.csproj (original)
+++ struts/sandbox/trunk/overdrive/Nexus/Extras/Extras.csproj Fri Jul  8 05:51:03 2005
@@ -29,7 +29,7 @@
                     CheckForOverflowUnderflow = "false"
                     ConfigurationOverrideFile = ""
                     DefineConstants = "DEBUG;TRACE"
-                    DocumentationFile = ""
+                    DocumentationFile = "Nexus.Extras.xml"
                     DebugSymbols = "true"
                     FileAlignment = "4096"
                     IncrementalBuild = "false"

Modified: struts/sandbox/trunk/overdrive/Nexus/Test/Test.csproj
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Test/Test.csproj?rev=209749&r1=209748&r2=209749&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Test/Test.csproj (original)
+++ struts/sandbox/trunk/overdrive/Nexus/Test/Test.csproj Fri Jul  8 05:51:03 2005
@@ -29,7 +29,7 @@
                     CheckForOverflowUnderflow = "false"
                     ConfigurationOverrideFile = ""
                     DefineConstants = "DEBUG;TRACE"
-                    DocumentationFile = "Nexus.Test"
+                    DocumentationFile = "Nexus.Test.xml"
                     DebugSymbols = "true"
                     FileAlignment = "4096"
                     IncrementalBuild = "false"

Modified: struts/sandbox/trunk/overdrive/Nexus/Web/BaseGridPage.aspx.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Web/BaseGridPage.aspx.cs?rev=209749&r1=209748&r2=209749&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Web/BaseGridPage.aspx.cs (original)
+++ struts/sandbox/trunk/overdrive/Nexus/Web/BaseGridPage.aspx.cs Fri Jul  8 05:51:03 2005
@@ -231,7 +231,7 @@
 		/// <summary>
 		/// Render the list as a DataGrid.
 		/// </summary>
-		protected DataGrid list_report;
+		protected NexusDataGrid list_report;
 
 		/// <summary>
 		/// Invoke display for adding a new entry.

Added: struts/sandbox/trunk/overdrive/Nexus/Web/NexusDataGrid.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Web/NexusDataGrid.cs?rev=209749&view=auto
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Web/NexusDataGrid.cs (added)
+++ struts/sandbox/trunk/overdrive/Nexus/Web/NexusDataGrid.cs Fri Jul  8 05:51:03 2005
@@ -0,0 +1,130 @@
+using System;
+using System.ComponentModel;
+using System.Drawing;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+
+namespace Nexus.Web
+{
+	public class NexusDataGrid : DataGrid
+	{
+		#region Public Properties
+
+		[Bindable (true), Category ("Appearance"), TypeConverter (typeof (WebColorConverter)),
+		Description ("Specifies the color a row is highlighted when the mouse is over it.")]
+		public Color RowHighlightColor
+		{
+			get
+			{
+				object o = ViewState ["RowHighlightColor"];
+				if (o == null)
+					return Color.Empty;
+				else
+					return (Color) o;
+			}
+			set { ViewState ["RowHighlightColor"] = value; }
+		}
+
+		[DefaultValue (""),
+		Description ("Specifies the CommandName used in the server-side DataGrid event when the
row is clicked.")]
+		public string RowClickEventCommandName
+		{
+			get
+			{
+				object o = ViewState ["RowClickEventCommandName"];
+				if (o == null)
+					return string.Empty;
+				else
+					return (string) o;
+			}
+			set { ViewState ["RowClickEventCommandName"] = value; }
+		}
+
+		[DefaultValue (true),
+		Description ("Indicates whether or not rows are highlighted/clickable.")]
+		public bool RowSelectionEnabled
+		{
+			get
+			{
+				object o = ViewState ["RowSelectionEnabled"];
+				if (o == null)
+					return true;
+				else
+					return (bool) o;
+			}
+			set { ViewState ["RowSelectionEnabled"] = value; }
+		}
+
+		#endregion
+
+		#region Overridden DataGrid Methods
+
+		protected override DataGridItem CreateItem (int itemIndex, int dataSourceIndex, ListItemType
itemType)
+		{
+			// Create the NexusDataGridItem
+			NexusDataGridItem item = new NexusDataGridItem (itemIndex, dataSourceIndex, itemType);
+
+			// Set the client-side onmouseover and onmouseout if RowSelectionEnabled == true
+			if (RowSelectionEnabled && itemType != ListItemType.Header && itemType
!= ListItemType.Footer
+				&& itemType != ListItemType.Pager)
+			{
+				item.Attributes ["onmouseover"] = "javascript:nexusDG_changeBackColor(this, true);";
+				item.Attributes ["onmouseout"] = "javascript:nexusDG_changeBackColor(this, false);";
+			}
+
+			// return the NexusDataGridItem
+			return item;
+		}
+
+		protected override void OnPreRender (EventArgs e)
+		{
+			base.OnPreRender (e);
+
+			if (!RowSelectionEnabled) return; // exit if not RowSelectionEnabled == true
+
+			// add the client-side script to change the background color
+			const string SCRIPT_KEY = "nexusDGscript";
+			const string SCRIPT = @"<script language=""JavaScript"">
+<!--
+var lastColorUsed;
+function nexusDG_changeBackColor(row, highlight)
+{{
+	if (row.className!=""EditItemStyle"")
+	{{
+		if (highlight)
+		{{
+			lastClassUsed = row.className;
+			row.className = ""HighlightedItemStyle"";
+		}}
+		else
+			row.className = lastClassUsed;
+	}}
+}}
+// -->
+</script>";
+
+			if (RowHighlightColor != Color.Empty && !Page.IsClientScriptBlockRegistered (SCRIPT_KEY))
+				Page.RegisterClientScriptBlock (SCRIPT_KEY, SCRIPT);
+		}
+
+		#endregion
+	}
+
+	public class NexusDataGridItem : DataGridItem, IPostBackEventHandler
+	{
+		public NexusDataGridItem (int itemIndex, int dataSetIndex, ListItemType itemType) : base
(itemIndex, dataSetIndex, itemType)
+		{
+		}
+
+		#region IPostBackEventHandler Members
+
+		public void RaisePostBackEvent (string eventArgument)
+		{
+			CommandEventArgs commandArgs = new CommandEventArgs (eventArgument, null);
+			DataGridCommandEventArgs args = new DataGridCommandEventArgs (this, this, commandArgs);
+			base.RaiseBubbleEvent (this, args);
+		}
+
+		#endregion
+	}
+}
\ No newline at end of file

Modified: struts/sandbox/trunk/overdrive/Nexus/Web/Web.csproj
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Web/Web.csproj?rev=209749&r1=209748&r2=209749&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Web/Web.csproj (original)
+++ struts/sandbox/trunk/overdrive/Nexus/Web/Web.csproj Fri Jul  8 05:51:03 2005
@@ -29,7 +29,7 @@
                     CheckForOverflowUnderflow = "false"
                     ConfigurationOverrideFile = ""
                     DefineConstants = "DEBUG;TRACE"
-                    DocumentationFile = "Nexus.Web"
+                    DocumentationFile = "Nexus.Web.xml"
                     DebugSymbols = "true"
                     FileAlignment = "4096"
                     IncrementalBuild = "false"
@@ -163,6 +163,11 @@
                 <File
                     RelPath = "Messages.resx"
                     BuildAction = "EmbeddedResource"
+                />
+                <File
+                    RelPath = "NexusDataGrid.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
                 />
                 <File
                     RelPath = "Web.config"



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Mime
View raw message