//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//------------------------------------------------------------------------------
namespace System.Web.UI.WebControls.WebParts {
using System;
using System.Web;
using System.Web.Util;
///
///
public abstract class PersonalizationState {
private WebPartManager _webPartManager;
private bool _dirty;
///
///
protected PersonalizationState(WebPartManager webPartManager) {
if (webPartManager == null) {
throw new ArgumentNullException("webPartManager");
}
_webPartManager = webPartManager;
}
///
///
public bool IsDirty {
get {
return _dirty;
}
}
///
///
public abstract bool IsEmpty {
get;
}
///
///
public WebPartManager WebPartManager {
get {
return _webPartManager;
}
}
///
///
public abstract void ApplyWebPartPersonalization(WebPart webPart);
///
///
public abstract void ApplyWebPartManagerPersonalization();
///
///
public abstract void ExtractWebPartPersonalization(WebPart webPart);
///
///
public abstract void ExtractWebPartManagerPersonalization();
// Returns the AuthorizationFilter string for a WebPart before it is instantiated
// Returns null if there is no personalized value for AuthorizationFilter
public abstract string GetAuthorizationFilter(string webPartID);
///
///
protected void SetDirty() {
_dirty = true;
}
///
///
public abstract void SetWebPartDirty(WebPart webPart);
///
///
public abstract void SetWebPartManagerDirty();
///
///
protected void ValidateWebPart(WebPart webPart) {
if (webPart == null) {
throw new ArgumentNullException("webPart");
}
if (_webPartManager.WebParts.Contains(webPart) == false) {
throw new ArgumentException(SR.GetString(SR.UnknownWebPart), "webPart");
}
}
}
}