예제 #1
0
 public void RemoveContentCollectionFactory(IPageContentCollectionFactory f)
 {
     if (this.mContentCollectionFactories.ContainsKey(f.Name))
     {
         this.mContentCollectionFactories.Remove(f.Name);
     }
 }
예제 #2
0
파일: Page.cs 프로젝트: suntabu/axiom
        protected virtual bool PrepareImpl(StreamSerializer stream, ref PageData dataToPopulate)
        {
            //now do the real loading
            if (stream.ReadChunkBegin(CHUNK_ID, CHUNK_VERSION, "Page") == null)
            {
                return(false);
            }

            // pageID check (we should know the ID we're expecting)
            int storedID = -1;

            stream.Read(out storedID);
            if (this.mID.Value != storedID)
            {
                LogManager.Instance.Write("Error: Tried to populate Page ID {0} with data corresponding to page ID {1}",
                                          this.mID.Value,
                                          storedID);
                stream.UndoReadChunk(CHUNK_ID);
                return(false);
            }

            PageManager mgr = Manager;

            while (stream.NextChunkId == Page.CHUNK_CONTENTCOLLECTION_DECLARATION_ID)
            {
                Chunk  collChunk = stream.ReadChunkBegin();
                string factoryName;
                stream.Read(out factoryName);
                stream.ReadChunkEnd(CHUNK_CONTENTCOLLECTION_DECLARATION_ID);
                //Supported type?
                IPageContentCollectionFactory collFact = mgr.GetContentCollectionFactory(factoryName);
                if (collFact != null)
                {
                    PageContentCollection collInst = collFact.CreateInstance();
                    if (collInst.Prepare(stream))
                    {
                        dataToPopulate.collectionsToAdd.Add(collInst);
                    }
                    else
                    {
                        LogManager.Instance.Write("Error preparing PageContentCollection type: {0} in {1}", factoryName, ToString());
                        collFact.DestroyInstance(ref collInst);
                    }
                }
                else
                {
                    LogManager.Instance.Write("Unsupported PageContentCollection type: {0} in {1}", factoryName, ToString());
                    //skip
                    stream.ReadChunkEnd(collChunk.id);
                }
            }

            this.mModified = false;
            return(true);
        }
예제 #3
0
        public void AddContentCollectionFactory(IPageContentCollectionFactory f)
        {
            // note - deliberately allowing overriding
            if (this.mContentCollectionFactories.ContainsKey(f.Name))
            {
                this.mContentCollectionFactories[f.Name] = f;
                return;
            }

            this.mContentCollectionFactories.Add(f.Name, f);
        }
예제 #4
0
        public PageContentCollection CreateContentCollection(string typeName)
        {
            IPageContentCollectionFactory fact = GetContentCollectionFactory(typeName);

            if (fact == null)
            {
                throw new AxiomException(
                          "{0} is not the of a valid PageContentCollectionFactory! PageManager.CreateContentCollection", typeName);
            }

            return(fact.CreateInstance());
        }
예제 #5
0
        public void DestroyContentCollection(ref PageContentCollection coll)
        {
            IPageContentCollectionFactory fact = GetContentCollectionFactory(coll.Type);

            if (fact != null)
            {
                fact.DestroyInstance(ref coll);
            }
            else
            {
                coll.SafeDispose();                 //normally a safe fallback
            }
        }
예제 #6
0
 public PageContentCollection(IPageContentCollectionFactory creator)
     : base()
 {
     this.mCreator = creator;
 }
예제 #7
0
		public PageContentCollection( IPageContentCollectionFactory creator )
			: base()
		{
			this.mCreator = creator;
		}
예제 #8
0
		public void RemoveContentCollectionFactory( IPageContentCollectionFactory f )
		{
			if ( this.mContentCollectionFactories.ContainsKey( f.Name ) )
			{
				this.mContentCollectionFactories.Remove( f.Name );
			}
		}
예제 #9
0
		public void AddContentCollectionFactory( IPageContentCollectionFactory f )
		{
			// note - deliberately allowing overriding
			if ( this.mContentCollectionFactories.ContainsKey( f.Name ) )
			{
				this.mContentCollectionFactories[ f.Name ] = f;
				return;
			}

			this.mContentCollectionFactories.Add( f.Name, f );
		}
예제 #10
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="f"></param>
 public void RemoveContentCollectionFactory(IPageContentCollectionFactory f)
 {
     mContentCollectionFactories.Remove(f.Name);
 }
예제 #11
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="f"></param>
        public void AddContentCollectionFactory(IPageContentCollectionFactory f)
        {
            // note - deliberately allowing overriding
            if (mContentCollectionFactories.ContainsKey(f.Name))
                mContentCollectionFactories.Remove(f.Name);

            mContentCollectionFactories.Add(f.Name, f);
        }