PageRenderTime 56ms CodeModel.GetById 29ms RepoModel.GetById 0ms app.codeStats 0ms

/mojoPortal.Web.Controls/ExtJs/ExtPanel.cs

#
C# | 276 lines | 170 code | 48 blank | 58 comment | 16 complexity | d4235f0fd59803513a87de78ee28a158 MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0, BSD-3-Clause, CPL-1.0, CC-BY-SA-3.0, GPL-2.0
  1. /// Author: Joe Audette
  2. /// Created: 2007-11-01
  3. /// Last Modified: 2007-11-02
  4. ///
  5. /// The use and distribution terms for this software are covered by the
  6. /// Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
  7. /// which can be found in the file CPL.TXT at the root of this distribution.
  8. /// By using this software in any fashion, you are agreeing to be bound by
  9. /// the terms of this license.
  10. ///
  11. /// You must not remove this notice, or any other, from this software.
  12. using System;
  13. using System.Text;
  14. namespace mojoPortal.Web.Controls.ExtJs
  15. {
  16. /// <summary>
  17. /// These ExtJs controls are no longer used in mojoPortal and no longer being maintained, we have standardized on jQuery
  18. /// </summary>
  19. [Obsolete("These ExtJs controls are no longer used in mojoPortal and no longer being maintained, we have standardized on jQuery")]
  20. public class ExtPanel : Container
  21. {
  22. private bool animCollapse = true;
  23. private string autoLoad = string.Empty;
  24. private bool autoScroll = false;
  25. private bool border = true;
  26. private bool collapseFirst = true;
  27. private bool collapsed = false;
  28. private bool collapsible = false;
  29. private bool header = false;
  30. private bool headerAsText = true;
  31. private string title = string.Empty;
  32. private string layout = string.Empty;
  33. private string region = string.Empty;
  34. private bool frame = false;
  35. private string iconCls = string.Empty;
  36. private string ctCls = string.Empty;
  37. private bool usePosition = false;
  38. private int left = 0;
  39. private int top = 100;
  40. /// <summary>
  41. /// The title text to display in the panel header (defaults to ''). When a title is specified the header element will automatically be created and displayed unless header is explicitly set to false.
  42. /// </summary>
  43. public string Title
  44. {
  45. get { return title; }
  46. set { title = value; }
  47. }
  48. /// <summary>
  49. /// The layout type to be used in this container. If not specified, a default Ext.layout.ContainerLayout will be created and used. Valid values are: accordion, anchor, border, card, column, fit, form and table. Specific config values for the chosen layout type can be specified using layoutConfig.
  50. /// </summary>
  51. public string Layout
  52. {
  53. get { return layout; }
  54. set { layout = value; }
  55. }
  56. public string Region
  57. {
  58. get { return region; }
  59. set { region = value; }
  60. }
  61. /// <summary>
  62. /// True to animate the transition when the panel is collapsed, false to skip the animation (defaults to true if the Ext.Fx class is available, otherwise false).
  63. /// </summary>
  64. public bool AnimCollapse
  65. {
  66. get { return animCollapse; }
  67. set { animCollapse = value; }
  68. }
  69. /// <summary>
  70. /// A valid url spec according to the Updater Ext.Updater.update method. If autoLoad is not null, the panel will attempt to load its contents immediately upon render.
  71. /// </summary>
  72. public string AutoLoad
  73. {
  74. get { return autoLoad; }
  75. set { autoLoad = value; }
  76. }
  77. /// <summary>
  78. /// True to use overflow:'auto' on the panel's body element and show scroll bars automatically when necessary, false to clip any overflowing content (defaults to false).
  79. /// </summary>
  80. public bool AutoScroll
  81. {
  82. get { return autoScroll; }
  83. set { autoScroll = value; }
  84. }
  85. /// <summary>
  86. /// True to make sure the collapse/expand toggle button always renders first (to the left of) any other tools in the panel's title bar, false to render it last (defaults to true).
  87. /// </summary>
  88. public bool CollapseFirst
  89. {
  90. get { return collapseFirst; }
  91. set { collapseFirst = value; }
  92. }
  93. /// <summary>
  94. /// True to render the panel collapsed, false to render it expanded (defaults to false).
  95. /// </summary>
  96. public bool Collapsed
  97. {
  98. get { return collapsed; }
  99. set { collapsed = value; }
  100. }
  101. /// <summary>
  102. /// True to make the panel collapsible and have the expand/collapse toggle button automatically rendered into the header tool button area, false to keep the panel statically sized with no button (defaults to false).
  103. /// </summary>
  104. public bool Collapsible
  105. {
  106. get { return collapsible; }
  107. set { collapsible = value; }
  108. }
  109. /// <summary>
  110. ///
  111. /// </summary>
  112. public bool Header
  113. {
  114. get { return header; }
  115. set { header = value; }
  116. }
  117. /// <summary>
  118. /// True to display the panel title in the header, false to hide it (defaults to true).
  119. /// </summary>
  120. public bool HeaderAsText
  121. {
  122. get { return headerAsText; }
  123. set { headerAsText = value; }
  124. }
  125. /// <summary>
  126. /// True to render the panel with custom rounded borders, false to render with plain 1px square borders (defaults to false).
  127. /// </summary>
  128. public bool Frame
  129. {
  130. get { return frame; }
  131. set { frame = value; }
  132. }
  133. /// <summary>
  134. /// A CSS class that will provide a background image to be used as the panel header icon (defaults to '').
  135. /// </summary>
  136. public string IconCls
  137. {
  138. get { return iconCls; }
  139. set { iconCls = value; }
  140. }
  141. /// <summary>
  142. /// An optional extra CSS class that will be added to this component's container (defaults to '').
  143. /// This can be useful for adding customized styles to the container or any of its children
  144. /// using standard CSS rules.
  145. /// </summary>
  146. public string CtCls
  147. {
  148. get { return ctCls; }
  149. set { ctCls = value; }
  150. }
  151. /// <summary>
  152. /// True to display the borders of the panel's body element, false to hide them (defaults to true). By default, the border is a 2px wide inset border, but this can be further altered by setting bodyBorder to false.
  153. /// </summary>
  154. public bool Border
  155. {
  156. get { return border; }
  157. set { border = value; }
  158. }
  159. public bool UsePosition
  160. {
  161. get { return usePosition; }
  162. set { usePosition = value; }
  163. }
  164. public int Left
  165. {
  166. get { return left; }
  167. set { left = value; }
  168. }
  169. public int Top
  170. {
  171. get { return top; }
  172. set { top = value; }
  173. }
  174. public override void RenderControlToScript(StringBuilder script)
  175. {
  176. if (DidRenderScript) return;
  177. script.Append(" { ");
  178. script.Append("contentEl:'" + this.ClientID + "' ");
  179. script.Append(", title: '" + this.Title + "' ");
  180. if (region.Length > 0)
  181. {
  182. script.Append(", region: '" + region + "'");
  183. }
  184. if (layout.Length > 0)
  185. {
  186. script.Append(", layout: '" + layout + "'");
  187. }
  188. if (ctCls.Length > 0)
  189. {
  190. script.Append(", ctCls: '" + ctCls + "'");
  191. }
  192. if ((AutoHeight) && (FixedPixelHeight == 0))
  193. {
  194. script.Append(", autoHeight:true ");
  195. }
  196. if (FixedPixelHeight > 0)
  197. {
  198. script.Append(", height: '" + FixedPixelHeight.ToString() + "'");
  199. }
  200. if ((AutoWidth) && (FixedPixelWidth == 0))
  201. {
  202. script.Append(", autoWidth:true ");
  203. }
  204. if (FixedPixelWidth > 0)
  205. {
  206. script.Append(", width: " + FixedPixelWidth.ToString());
  207. }
  208. if (collapsible)
  209. {
  210. script.Append(", collapsible: true ");
  211. }
  212. if (AutoScroll)
  213. {
  214. script.Append(", autoScroll: true ");
  215. }
  216. if (IconCls.Length > 0)
  217. {
  218. script.Append(", iconCls: '" + IconCls + "' ");
  219. }
  220. if (!Border)
  221. {
  222. script.Append(", border: false ");
  223. }
  224. script.Append(" } ");
  225. DidRenderScript = true;
  226. }
  227. }
  228. }