Author: fmantek
Date: Fri Sep 21 05:38:56 2007
New Revision: 265
Added:
trunk/clients/cs/src/gcalendar/webcontentlink.cs
Modified:
trunk/clients/cs/RELEASE_NOTES.HTML
trunk/clients/cs/src/VS2003/gcalendar/gcalendar.csproj
trunk/clients/cs/src/VS2005.mobile/GCalendarMobile/GCalendarMobile.csproj
trunk/clients/cs/src/core/collections.cs
trunk/clients/cs/src/gcalendar/evententry.cs
Log:
added WebcontentLink for the calendar support of Gadgets
Modified: trunk/clients/cs/RELEASE_NOTES.HTML
==============================================================================
--- trunk/clients/cs/RELEASE_NOTES.HTML (original)
+++ trunk/clients/cs/RELEASE_NOTES.HTML Fri Sep 21 05:38:56 2007
@@ -115,6 +115,8 @@
custom feeds/entries. Look at CreateAtomSubElement() in AtomBase. This
is used to create custom clases like WebContentLink in the derived
services</li>
+ <li>Added the webcontentlink class to the Google Calendar Support to enable
+ easier creation of Gadgets in calendars.</li>
</ul>
Modified: trunk/clients/cs/src/VS2003/gcalendar/gcalendar.csproj
==============================================================================
--- trunk/clients/cs/src/VS2003/gcalendar/gcalendar.csproj (original)
+++ trunk/clients/cs/src/VS2003/gcalendar/gcalendar.csproj Fri Sep 21
05:38:56 2007
@@ -160,6 +160,12 @@
SubType = "Code"
BuildAction = "Compile"
/>
+ <File
+ RelPath = "webcontentlink.cs"
+ Link = "..\..\gcalendar\webcontentlink.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
</Include>
</Files>
</CSHARP>
Modified:
trunk/clients/cs/src/VS2005.mobile/GCalendarMobile/GCalendarMobile.csproj
==============================================================================
--- trunk/clients/cs/src/VS2005.mobile/GCalendarMobile/GCalendarMobile.csproj
(original)
+++ trunk/clients/cs/src/VS2005.mobile/GCalendarMobile/GCalendarMobile.csproj
Fri Sep 21 05:38:56 2007
@@ -82,6 +82,9 @@
<Compile Include="..\..\gcalendar\webcontent.cs">
<Link>webcontent.cs</Link>
</Compile>
+ <Compile Include="..\..\gcalendar\webcontentlink.cs">
+ <Link>webcontentlink.cs</Link>
+ </Compile>
<Compile Include="..\..\version\AssemblyVersion.cs">
<Link>AssemblyVersion.cs</Link>
</Compile>
Modified: trunk/clients/cs/src/core/collections.cs
==============================================================================
--- trunk/clients/cs/src/core/collections.cs (original)
+++ trunk/clients/cs/src/core/collections.cs Fri Sep 21 05:38:56 2007
@@ -276,7 +276,7 @@
/// <summary>standard typed accessor method </summary>
protected override void OnValidate( Object value )
{
- if ( value.GetType() !=
Type.GetType("Google.GData.Client.AtomLink") )
+ if ( ! typeof(AtomLink).IsInstanceOfType(value) )
throw new ArgumentException( "value must be of type
Google.GData.Client.AtomLink.", "value" );
}
}
Modified: trunk/clients/cs/src/gcalendar/evententry.cs
==============================================================================
--- trunk/clients/cs/src/gcalendar/evententry.cs (original)
+++ trunk/clients/cs/src/gcalendar/evententry.cs Fri Sep 21 05:38:56 2007
@@ -726,6 +726,22 @@
}
}
+ /// <summary>
+ /// Property to retrieve/set an associated WebContentLink
+ /// </summary>
+ public WebContentLink WebContentLink
+ {
+ get
+ {
+ return this.Links.FindService(WebContentLink.WEB_CONTENT_REL,
+ null) as WebContentLink;
+ }
+ set
+ {
+ this.Links.Add(value);
+ }
+ }
+
#endregion
/// <summary>
@@ -742,9 +758,11 @@
if ((localname.Equals(parser.Nametable.Link)))
{
- // here you could check if you want to create a webcontent and
return
- // an atomLink subclass.
- return new AtomLink();
+ if (reader.GetAttribute(GDataParserNameTable.XmlAttributeRel)
==
+ WebContentLink.WEB_CONTENT_REL)
+ {
+ return new WebContentLink(false);
+ }
}
return base.CreateAtomSubElement(reader, parser);
@@ -829,5 +847,6 @@
}
}
+
Added: trunk/clients/cs/src/gcalendar/webcontentlink.cs
==============================================================================
--- (empty file)
+++ trunk/clients/cs/src/gcalendar/webcontentlink.cs Fri Sep 21 05:38:56 2007
@@ -0,0 +1,159 @@
+/* Copyright (c) 2006 Google Inc.
+ *
+ * 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
+ *
+ * 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.
+*/
+#region Using directives
+
+#define USE_TRACING
+
+using System;
+using System.Xml;
+using System.Collections;
+using Google.GData.Client;
+#endregion
+
+namespace Google.GData.Extensions
+{
+ /// <summary>
+ /// Models a special kind of Atom link that contains a WebContent element.
+ /// </summary>
+ public class WebContentLink : AtomLink
+ {
+ public const string WEB_CONTENT_REL = GDataParserNameTable.NSGCal +
+ "/" + GDataParserNameTable.XmlWebContentElement;
+
+ /// <summary>
+ /// Constructs a new Atom link containing a WebContent extension
+ /// and with the appropriate rel attribute.
+ /// </summary>
+ public WebContentLink() : this(true)
+ {
+ }
+
+ /// <summary>
+ /// Constructs a new Atom link containing a WebContent extension
+ /// and with the appropriate rel attribute.
+ /// This constructor lets you specify if you want the extension
+ /// element to be created for you. The parser sets this to false
+ /// as it refuses to override pre-existing elements (even empty ones.)
+ /// </summary>
+ /// <param name="createWebContent">Optionally create the web content
extension.</param>
+ public WebContentLink(bool createWebContent)
+ {
+ this.Rel = WEB_CONTENT_REL;
+ if (createWebContent)
+ {
+ this.ExtensionElements.Add(new WebContent());
+ }
+ }
+
+
+ /// <summary>
+ /// The icon URL for the WebContent entry is really just the HRef
+ /// of the link itself.
+ /// </summary>
+ public string Icon
+ {
+ get
+ {
+ return this.HRef.ToString();
+ }
+ set
+ {
+ this.HRef = new AtomUri(value);
+ }
+ }
+
+ /// <summary>
+ /// Alias for the Height property of the nested WebContent element.
+ /// </summary>
+ public uint Height
+ {
+ get
+ {
+ return this.WebContent.Height;
+ }
+ set
+ {
+ this.WebContent.Height = value;
+ }
+ }
+
+ /// <summary>
+ /// Alias for the Width property of the nested WebContent element.
+ /// </summary>
+ public uint Width
+ {
+ get
+ {
+ return this.WebContent.Width;
+ }
+ set
+ {
+ this.WebContent.Width = value;
+ }
+ }
+
+ /// <summary>
+ /// Alias for the GadgetPreferences property of the nested
+ /// WebContent element.
+ /// </summary>
+ public SortedList GadgetPreferences
+ {
+ get
+ {
+ return this.WebContent.GadgetPreferences;
+ }
+ set
+ {
+ this.WebContent.GadgetPreferences = value;
+ }
+ }
+
+ /// <summary>
+ /// The Url property just references the Url of the nested
+ /// WebContent element
+ /// </summary>
+ public string Url
+ {
+ get
+ {
+ return this.WebContent.Url;
+ }
+ set
+ {
+ this.WebContent.Url = value;
+ }
+ }
+
+ /// <summary>
+ /// Property that lets one modify the associated WebContent
+ /// entry directly.
+ /// </summary>
+ public WebContent WebContent
+ {
+ get
+ {
+ return (WebContent)
this.FindExtension(GDataParserNameTable.XmlWebContentElement,
+ GDataParserNameTable.NSGCal);
+ }
+ set
+ {
+
this.ReplaceExtension(GDataParserNameTable.XmlWebContentElement,
+ GDataParserNameTable.NSGCal, value);
+ }
+ }
+
+
+ }
+}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Data API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/google-help-dataapi?hl=en
-~----------~----~----~----~------~----~------~--~---