WebPartVerb.cs 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. //
  2. // System.Web.UI.WebControls.WebParts.WebPartVerb.cs
  3. //
  4. // Authors:
  5. // Sanjay Gupta ([email protected])
  6. //
  7. // (C) 2004 Novell, Inc (http://www.novell.com)
  8. //
  9. //
  10. // Permission is hereby granted, free of charge, to any person obtaining
  11. // a copy of this software and associated documentation files (the
  12. // "Software"), to deal in the Software without restriction, including
  13. // without limitation the rights to use, copy, modify, merge, publish,
  14. // distribute, sublicense, and/or sell copies of the Software, and to
  15. // permit persons to whom the Software is furnished to do so, subject to
  16. // the following conditions:
  17. //
  18. // The above copyright notice and this permission notice shall be
  19. // included in all copies or substantial portions of the Software.
  20. //
  21. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  22. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  23. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  24. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  25. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  26. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  27. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  28. //
  29. #if NET_2_0
  30. using System.Web;
  31. using System.Web.UI;
  32. using System.ComponentModel;
  33. using System;
  34. namespace System.Web.UI.WebControls.WebParts
  35. {
  36. [TypeConverterAttribute ("System.Web.UI.WebControls.WebParts.WebPartVerbConverter, System.Web")]
  37. public class WebPartVerb : IStateManager
  38. {
  39. private string clientClickHandler;
  40. private WebPartEventHandler serverClickHandler;
  41. private StateBag stateBag;
  42. private bool isChecked = false;
  43. private string description = string.Empty;
  44. private bool enabled = true;
  45. private string imageUrl = string.Empty;
  46. private string text = string.Empty;
  47. private bool visible = true;
  48. public WebPartVerb (string clientHandler)
  49. {
  50. this.clientClickHandler = clientHandler;
  51. stateBag = new StateBag ();
  52. stateBag.Add ("clientClickHandler", clientHandler);
  53. }
  54. public WebPartVerb (WebPartEventHandler serverHandler)
  55. {
  56. this.serverClickHandler = serverHandler;
  57. stateBag = new StateBag ();
  58. stateBag.Add ("serverClickHandler", serverHandler);
  59. }
  60. public WebPartVerb (WebPartEventHandler serverHandler, string clientHandler)
  61. {
  62. this.serverClickHandler = serverHandler;
  63. this.clientClickHandler = clientHandler;
  64. stateBag = new StateBag ();
  65. stateBag.Add ("serverClickHandler", serverHandler);
  66. stateBag.Add ("clientClickHandler", clientHandler);
  67. }
  68. [MonoTODO]
  69. protected virtual void LoadViewState (object savedState)
  70. {
  71. throw new NotImplementedException ();
  72. }
  73. [MonoTODO]
  74. protected virtual object SaveViewState()
  75. {
  76. throw new NotImplementedException ();
  77. }
  78. [MonoTODO]
  79. protected virtual void TrackViewState()
  80. {
  81. throw new NotImplementedException();
  82. }
  83. [MonoTODO]
  84. void IStateManager.LoadViewState (object savedState)
  85. {
  86. throw new NotImplementedException ();
  87. }
  88. [MonoTODO]
  89. object IStateManager.SaveViewState ()
  90. {
  91. throw new NotImplementedException ();
  92. }
  93. [MonoTODO]
  94. void IStateManager.TrackViewState ()
  95. {
  96. throw new NotImplementedException ();
  97. }
  98. [MonoTODO]
  99. bool IStateManager.IsTrackingViewState {
  100. get {
  101. throw new NotImplementedException ();
  102. }
  103. }
  104. [WebSysDescriptionAttribute ("Denotes verb is checked or not."),
  105. DefaultValueAttribute (false),
  106. NotifyParentPropertyAttribute (true) ]
  107. public virtual bool Checked {
  108. get { return isChecked; }
  109. set { isChecked = value; }
  110. }
  111. [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden),
  112. BrowsableAttribute (false)]
  113. public string ClientClickHandler {
  114. get { return clientClickHandler; }
  115. }
  116. [LocalizableAttribute (true),
  117. WebSysDescriptionAttribute ("Gives descriptive information about the verb"),
  118. NotifyParentPropertyAttribute (true)]
  119. //WebSysDefaultValueAttribute (string.Empty)]
  120. public virtual string Description {
  121. get { return description; }
  122. set { description = value; }
  123. }
  124. [NotifyParentPropertyAttribute (true),
  125. DefaultValueAttribute (true),
  126. WebSysDescriptionAttribute ("Determines whether verb is enabled.")]
  127. public virtual bool Enabled {
  128. get { return enabled; }
  129. set { enabled = value; }
  130. }
  131. [WebSysDescriptionAttribute ("Denotes URL of the image to be displayed for the verb"),
  132. EditorAttribute ("System.Web.UI.Design.ImageUrlEditor, System.Design",
  133. "System.Drawing.Design.UITypeEditor, System.Drawing"),
  134. LocalizableAttribute (true), NotifyParentPropertyAttribute (true)]
  135. //UrlPropertyAttribute, DefaultValueAttribute (String.Empty)
  136. public string ImageUrl {
  137. get { return imageUrl; }
  138. set { imageUrl = value; }
  139. }
  140. protected virtual bool IsTrackingViewState {
  141. get { throw new NotImplementedException (); }
  142. }
  143. [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden),
  144. BrowsableAttribute (false)]
  145. public WebPartEventHandler ServerClickHandler
  146. {
  147. get { return serverClickHandler; }
  148. }
  149. [WebSysDescriptionAttribute ("Denotes text to be displayed for the verb"),
  150. LocalizableAttribute (true), NotifyParentPropertyAttribute (true)]
  151. //DefaultValueAttribute (String.Empty)
  152. public virtual string Text
  153. {
  154. get { return text; }
  155. set { text = value; }
  156. }
  157. protected StateBag ViewState {
  158. get { return stateBag; }
  159. }
  160. [DefaultValueAttribute (true),
  161. WebSysDescriptionAttribute ("Denotes whether the verb is visible"),
  162. LocalizableAttribute (true), NotifyParentPropertyAttribute (true)]
  163. public bool Visible
  164. {
  165. get { return visible; }
  166. set { visible = value; }
  167. }
  168. }
  169. }
  170. #endif