| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305 |
- //
- // System.Web.UI.WebControls.DataControlField.cs
- //
- // Authors:
- // Sanjay Gupta ([email protected])
- //
- // (C) 2004 Novell, Inc. (http://www.novell.com)
- //
- //
- // Permission is hereby granted, free of charge, to any person obtaining
- // a copy of this software and associated documentation files (the
- // "Software"), to deal in the Software without restriction, including
- // without limitation the rights to use, copy, modify, merge, publish,
- // distribute, sublicense, and/or sell copies of the Software, and to
- // permit persons to whom the Software is furnished to do so, subject to
- // the following conditions:
- //
- // The above copyright notice and this permission notice shall be
- // included in all copies or substantial portions of the Software.
- //
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- //
- #if NET_2_0
- using System.Collections;
- using System.Collections.Specialized;
- using System.Web.UI;
- namespace System.Web.UI.WebControls {
- public abstract class DataControlField : IStateManager, IDataSourceViewSchemaAccessor
- {
- bool tracking = false;
- StateBag viewState;
- object dataSourceViewSchema;
- string accessibleHeaderText;
- Control control;
- Style controlStyle;
- bool designMode;
- TableItemStyle footerStyle;
- string footerText;
- string headerImageUrl;
- TableItemStyle headerStyle;
- string headerText;
- TableItemStyle itemStyle;
- bool showHeader;
- string sortExpression;
- bool visible;
- protected DataControlField()
- {
- viewState = new StateBag ();
- }
- [MonoTODO]
- public virtual void ExtractValuesFromCell (IOrderedDictionary dictionary,
- DataControlFieldCell cell, DataControlRowState rowState, bool includeReadOnly)
- {
- throw new NotImplementedException ();
- }
- [MonoTODO]
- public virtual bool Initialize (bool sortingEnabled, Control control)
- {
- throw new NotImplementedException ();
- }
- [MonoTODO]
- public virtual void InitializeCell (DataControlFieldCell cell,
- DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
- {
- throw new NotImplementedException ();
- }
- [MonoTODO]
- protected virtual void OnFieldChanged ()
- {
- throw new NotImplementedException ();
- }
-
- protected virtual void LoadViewState(object savedState)
- {
- ArrayList items = savedState as ArrayList;
- if (items == null)
- return;
- foreach (Pair p in items) {
- if (((string)p.First).Equals("accessibleHeaderText")) {
- accessibleHeaderText = (string)p.Second;
- continue;
- }
- if (((string)p.First).Equals("footerText")) {
- footerText = (string)p.Second;
- continue;
- }
- if (((string)p.First).Equals("headerImageUrl")) {
- headerImageUrl = (string)p.Second;
- continue;
- }
- if (((string)p.First).Equals("headerText")) {
- headerText = (string)p.Second;
- continue;
- }
- if (((string)p.First).Equals("showHeader")) {
- showHeader = (bool)p.Second;
- continue;
- }
- if (((string)p.First).Equals("sortExpression")) {
- sortExpression = (string)p.Second;
- continue;
- }
- if (((string)p.First).Equals("visible")) {
- visible = (bool)p.Second;
- continue;
- }
- if (((string)p.First).Equals("dataSourceViewSchema"))
- {
- dataSourceViewSchema = p.Second;
- continue;
- }
- }
- }
- protected virtual object SaveViewState()
- {
- ArrayList items = new ArrayList();
- Pair pair = new Pair ();
- if (viewState.IsItemDirty("accessibleHeaderText")) {
- pair.First = "accessibleHeaderText";
- pair.Second = accessibleHeaderText;
- items.Add(pair);
- }
- if (viewState.IsItemDirty("footerText")) {
- pair.First = "footerText";
- pair.Second = footerText;
- items.Add(pair);
- }
- if (viewState.IsItemDirty("headerImageUrl")) {
- pair.First = "headerImageUrl";
- pair.Second = headerImageUrl;
- items.Add(pair);
- }
- if (viewState.IsItemDirty("headerText")) {
- pair.First = "headerText";
- pair.Second = headerText;
- items.Add(pair);
- }
- if (viewState.IsItemDirty("showHeader")) {
- pair.First = "showHeader";
- pair.Second = showHeader;
- items.Add(pair);
- }
- if (viewState.IsItemDirty("sortExpression")) {
- pair.First = "sortExpression";
- pair.Second = sortExpression;
- items.Add(pair);
- }
- if (viewState.IsItemDirty("visible")) {
- pair.First = "visible";
- pair.Second = visible;
- items.Add(pair);
- }
- if (viewState.IsItemDirty("dataSourceViewSchema")) {
- pair.First = "dataSourceViewSchema";
- pair.Second = dataSourceViewSchema;
- items.Add(pair);
- }
- if (items.Count == 0)
- return null;
- else
- return items;
- }
- protected virtual void TrackViewState()
- {
- tracking = true;
- }
-
- [MonoTODO]
- public virtual void ValidateSupportsCallback ()
- {
- throw new NotImplementedException ();
- }
- void IStateManager.LoadViewState(object savedState)
- {
- LoadViewState(savedState);
- }
- object IStateManager.SaveViewState()
- {
- return SaveViewState();
- }
- void IStateManager.TrackViewState()
- {
- TrackViewState();
- }
- public virtual string AccessibleHeaderText {
- get { return (string) viewState ["accessibleHeaderText"]; }
- set {
- accessibleHeaderText = value;
- viewState.SetItemDirty ("accessibleHeaderText", true);
- }
- }
- protected Control Control {
- get { return control; }
- }
- public virtual Style ControlStyle {
- get { return controlStyle; }
- }
-
- protected bool DesignMode {
- get { return designMode; }
- }
- public virtual TableItemStyle FooterStyle {
- get { return footerStyle; }
- }
- public virtual string FooterText {
- get { return (string) viewState ["footerText"]; }
- set {
- footerText = value;
- viewState.SetItemDirty ("footerText", true);
- }
- }
- public virtual string HeaderImageUrl {
- get { return (string) viewState ["headerImageUrl"]; }
- set {
- headerImageUrl = value;
- viewState.SetItemDirty ("headerImageUrl", true);
- }
- }
- public virtual TableItemStyle HeaderStyle {
- get { return headerStyle; }
- }
- public virtual string HeaderText {
- get { return (string) viewState ["headerText"]; }
- set {
- headerText = value;
- viewState.SetItemDirty ("headerText", true);
- }
- }
- public virtual TableItemStyle ItemStyle {
- get { return itemStyle; }
- }
- public virtual bool ShowHeader {
- get { return (bool) viewState ["showHeader"]; }
- set {
- showHeader = value;
- viewState.SetItemDirty ("showHeader", true);
- }
- }
- public virtual string SortExpression {
- get { return (string) viewState ["sortExpression"]; }
- set {
- sortExpression = value;
- viewState.SetItemDirty ("sortExpression", true);
- }
- }
- public bool Visible {
- get { return (bool) viewState ["visible"]; }
- set {
- visible = value;
- viewState.SetItemDirty ("visible", true);
- }
- }
- protected bool IsTrackingViewState
- {
- get { return tracking; }
- }
- bool IStateManager.IsTrackingViewState
- {
- get { return IsTrackingViewState; }
- }
- object IDataSourceViewSchemaAccessor.DataSourceViewSchema {
- get { return viewState ["dataSourceViewSchema"]; }
- set {
- dataSourceViewSchema = value;
- viewState.SetItemDirty ("dataSourceViewSchema", true);
- }
- }
- }
- }
- #endif
|