BlogEntryEditorProvider.cs :  » Bloggers » SubText » Subtext » Extensibility » Providers » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » Bloggers » SubText 
SubText » Subtext » Extensibility » Providers » BlogEntryEditorProvider.cs
#region Disclaimer/Info

///////////////////////////////////////////////////////////////////////////////////////////////////
// Subtext WebLog
// 
// Subtext is an open source weblog system that is a fork of the .TEXT
// weblog system.
//
// For updated news and information please visit http://subtextproject.com/
// Subtext is hosted at Google Code at http://code.google.com/p/subtext/
// The development mailing list is at subtext@googlegroups.com 
//
// This project is licensed under the BSD license.  See the License.txt file for more information.
///////////////////////////////////////////////////////////////////////////////////////////////////

#endregion

using System;
using System.Collections.Specialized;
using System.Configuration.Provider;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Subtext.Extensibility.Providers{
    /// <summary>
    /// Provider for classes that implement the rich text editor 
    /// to edit text visually.
    /// </summary>
    public abstract class BlogEntryEditorProvider : ProviderBase
    {
        private static readonly GenericProviderCollection<BlogEntryEditorProvider> providers =
            ProviderConfigurationHelper.LoadProviderCollection("BlogEntryEditor", out _provider);

        private static BlogEntryEditorProvider _provider;

        protected BlogEntryEditorProvider()
        {
            Height = Unit.Empty;
            Width = Unit.Empty;
        }

        /// <summary>
        /// Returns all the configured Email Providers.
        /// </summary>
        public static GenericProviderCollection<BlogEntryEditorProvider> Providers
        {
            get { return providers; }
        }


        /// <summary>
        /// Id of the control
        /// </summary>
        public virtual string ControlId { get; set; }

        /// <summary>
        /// Width of the editor
        /// </summary>
        public Unit Width { get; set; }

        /// <summary>
        /// Height of the editor
        /// </summary>
        public Unit Height { get; set; }

        /// <summary>
        /// The content of the area
        /// </summary>
        public abstract String Text { get; set; }

        /// <summary>
        /// The content of the area, but XHTML converted
        /// </summary>
        public abstract String Xhtml { get; }

        /// <summary>
        /// Return the RichTextEditorControl to be displayed inside the page
        /// </summary>
        public abstract Control RichTextEditorControl { get; }

        /// <summary>
        /// Returns the default instance of this provider.
        /// </summary>
        /// <returns></returns>
        public static BlogEntryEditorProvider Instance()
        {
            return _provider;
        }

        public override void Initialize(string name, NameValueCollection configValue)
        {
            if(configValue["Width"] != null)
            {
                Width = ParseUnit(configValue["Width"]);
            }

            if(configValue["Height"] != null)
            {
                Height = ParseUnit(configValue["Height"]);
            }

            base.Initialize(name, configValue);
        }

        protected Unit ParseUnit(string s)
        {
            try
            {
                return Unit.Parse(s);
            }
            catch(Exception)
            {
            }
            return Unit.Empty;
        }

        /// <summary>
        /// Initializes the Control to be displayed
        /// </summary>
        public abstract void InitializeControl(object subtextContext);
    }
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.