WebPartVerb.cs 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  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.get_IsTrackingViewState ()
  100. {
  101. throw new NotImplementedException ();
  102. }
  103. [WebSysDescriptionAttribute ("Denotes verb is checked or not."),
  104. DefaultValueAttribute (false),
  105. NotifyParentPropertyAttribute (true) ]
  106. public virtual bool Checked {
  107. get { return isChecked; }
  108. set { isChecked = value; }
  109. }
  110. [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden),
  111. BrowsableAttribute (false)]
  112. public string ClientClickHandler {
  113. get { return clientClickHandler; }
  114. }
  115. [LocalizableAttribute (true),
  116. WebSysDescriptionAttribute ("Gives descriptive information about the verb"),
  117. NotifyParentPropertyAttribute (true)]
  118. //WebSysDefaultValueAttribute (string.Empty)]
  119. public virtual string Description {
  120. get { return description; }
  121. set { description = value; }
  122. }
  123. [NotifyParentPropertyAttribute (true),
  124. DefaultValueAttribute (true),
  125. WebSysDescriptionAttribute ("Determines whether verb is enabled.")]
  126. public virtual bool Enabled {
  127. get { return enabled; }
  128. set { enabled = value; }
  129. }
  130. [WebSysDescriptionAttribute ("Denotes URL of the image to be displayed for the verb"),
  131. EditorAttribute ("System.Web.UI.Design.ImageUrlEditor, System.Design",
  132. "System.Drawing.Design.UITypeEditor, System.Drawing"),
  133. LocalizableAttribute (true), NotifyParentPropertyAttribute (true)]
  134. //UrlPropertyAttribute, DefaultValueAttribute (String.Empty)
  135. public string ImageUrl {
  136. get { return imageUrl; }
  137. set { imageUrl = value; }
  138. }
  139. protected virtual bool IsTrackingViewState {
  140. get { throw new NotImplementedException (); }
  141. }
  142. [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden),
  143. BrowsableAttribute (false)]
  144. public WebPartEventHandler ServerClickHandler
  145. {
  146. get { return serverClickHandler; }
  147. }
  148. [WebSysDescriptionAttribute ("Denotes text to be displayed for the verb"),
  149. LocalizableAttribute (true), NotifyParentPropertyAttribute (true)]
  150. //DefaultValueAttribute (String.Empty)
  151. public virtual string Text
  152. {
  153. get { return text; }
  154. set { text = value; }
  155. }
  156. protected StateBag ViewState {
  157. get { return stateBag; }
  158. }
  159. [DefaultValueAttribute (true),
  160. WebSysDescriptionAttribute ("Denotes whether the verb is visible"),
  161. LocalizableAttribute (true), NotifyParentPropertyAttribute (true)]
  162. public bool Visible
  163. {
  164. get { return visible; }
  165. set { visible = value; }
  166. }
  167. }
  168. }
  169. #endif