private void Initialize(CatalogPartCollection existingCatalogParts, ICollection catalogParts)
        {
            if (existingCatalogParts != null)
            {
                foreach (CatalogPart existingCatalogPart in existingCatalogParts)
                {
                    // Don't need to check arg, since we know it is valid since it came
                    // from a CatalogPartCollection.
                    InnerList.Add(existingCatalogPart);
                }
            }

            if (catalogParts != null)
            {
                foreach (object obj in catalogParts)
                {
                    if (obj == null)
                    {
                        throw new ArgumentException(SR.GetString(SR.Collection_CantAddNull), "catalogParts");
                    }
                    if (!(obj is CatalogPart))
                    {
                        throw new ArgumentException(SR.GetString(SR.Collection_InvalidType, "CatalogPart"), "catalogParts");
                    }
                    InnerList.Add(obj);
                }
            }
        }
        protected override CatalogPartCollection CreateCatalogParts()
        {
            CatalogPartCollection parts = new CatalogPartCollection();

            if (this._zoneTemplate != null)
            {
                Control container = new NonParentingControl();
                this._zoneTemplate.InstantiateIn(container);
                if (!container.HasControls())
                {
                    return(parts);
                }
                foreach (Control control2 in container.Controls)
                {
                    CatalogPart part = control2 as CatalogPart;
                    if (part != null)
                    {
                        parts.Add(part);
                    }
                    else
                    {
                        LiteralControl control3 = control2 as LiteralControl;
                        if (((control3 == null) || (control3.Text.Trim().Length != 0)) && !base.DesignMode)
                        {
                            throw new InvalidOperationException(System.Web.SR.GetString("CatalogZone_OnlyCatalogParts", new object[] { this.ID }));
                        }
                    }
                }
            }
            return(parts);
        }
Esempio n. 3
0
        protected override CatalogPartCollection CreateCatalogParts() {
            CatalogPartCollection catalogParts = new CatalogPartCollection();

            if (_zoneTemplate != null) {
                // PERF: Instantiate the template into a special control, that does nothing when a child control
                // is added.  This is more performant because the child control is never parented to the temporary
                // control, it's ID is never generated, etc.
                Control container = new NonParentingControl();

                _zoneTemplate.InstantiateIn(container);
                if (container.HasControls()) {
                    foreach (Control control in container.Controls) {
                        CatalogPart part = control as CatalogPart;

                        if (part != null) {
                            catalogParts.Add(part);
                        }
                        else {
                            LiteralControl literal = control as LiteralControl;
                            // Throw an exception if it is *not* a literal containing only whitespace
                            // Don't throw an exception in the designer, since we want only the offending
                            // control to render as an error block, not the whole CatalogZone.
                            if (((literal == null) || (literal.Text.Trim().Length != 0)) && !DesignMode) {
                                throw new InvalidOperationException(SR.GetString(SR.CatalogZone_OnlyCatalogParts, ID));
                            }
                        }
                    }
                }
            }

            return catalogParts;
        }
 protected override CatalogPartCollection CreateCatalogParts()
 {
     CatalogPartCollection parts = new CatalogPartCollection();
     if (this._zoneTemplate != null)
     {
         Control container = new NonParentingControl();
         this._zoneTemplate.InstantiateIn(container);
         if (!container.HasControls())
         {
             return parts;
         }
         foreach (Control control2 in container.Controls)
         {
             CatalogPart part = control2 as CatalogPart;
             if (part != null)
             {
                 parts.Add(part);
             }
             else
             {
                 LiteralControl control3 = control2 as LiteralControl;
                 if (((control3 == null) || (control3.Text.Trim().Length != 0)) && !base.DesignMode)
                 {
                     throw new InvalidOperationException(System.Web.SR.GetString("CatalogZone_OnlyCatalogParts", new object[] { this.ID }));
                 }
             }
         }
     }
     return parts;
 }
Esempio n. 5
0
 private void Initialize(CatalogPartCollection existingCatalogParts, ICollection catalogParts)
 {
     if (existingCatalogParts != null)
     {
         foreach (CatalogPart part in existingCatalogParts)
         {
             base.InnerList.Add(part);
         }
     }
     if (catalogParts != null)
     {
         foreach (object obj2 in catalogParts)
         {
             if (obj2 == null)
             {
                 throw new ArgumentException(System.Web.SR.GetString("Collection_CantAddNull"), "catalogParts");
             }
             if (!(obj2 is CatalogPart))
             {
                 throw new ArgumentException(System.Web.SR.GetString("Collection_InvalidType", new object[] { "CatalogPart" }), "catalogParts");
             }
             base.InnerList.Add(obj2);
         }
     }
 }
 private void Initialize(CatalogPartCollection existingCatalogParts, ICollection catalogParts)
 {
     if (existingCatalogParts != null)
     {
         foreach (CatalogPart part in existingCatalogParts)
         {
             base.InnerList.Add(part);
         }
     }
     if (catalogParts != null)
     {
         foreach (object obj2 in catalogParts)
         {
             if (obj2 == null)
             {
                 throw new ArgumentException(System.Web.SR.GetString("Collection_CantAddNull"), "catalogParts");
             }
             if (!(obj2 is CatalogPart))
             {
                 throw new ArgumentException(System.Web.SR.GetString("Collection_InvalidType", new object[] { "CatalogPart" }), "catalogParts");
             }
             base.InnerList.Add(obj2);
         }
     }
 }
Esempio n. 7
0
        protected override void RenderBody(HtmlTextWriter writer)
        {
            base.RenderBodyTableBeginTag(writer);
            if (base.DesignMode)
            {
                base.RenderDesignerRegionBeginTag(writer, Orientation.Vertical);
            }
            CatalogPartCollection catalogParts = this.CatalogParts;

            if ((catalogParts != null) && (catalogParts.Count > 0))
            {
                bool firstCell = true;
                if (catalogParts.Count > 1)
                {
                    writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                    writer.RenderBeginTag(HtmlTextWriterTag.Td);
                    firstCell = false;
                    this.RenderCatalogPartLinks(writer);
                    writer.RenderEndTag();
                    writer.RenderEndTag();
                }
                System.Web.UI.WebControls.WebParts.CatalogPartChrome catalogPartChrome = this.CatalogPartChrome;
                if (base.DesignMode)
                {
                    foreach (CatalogPart part in catalogParts)
                    {
                        this.RenderCatalogPart(writer, part, catalogPartChrome, ref firstCell);
                    }
                }
                else
                {
                    CatalogPart selectedCatalogPart = this.SelectedCatalogPart;
                    if (selectedCatalogPart != null)
                    {
                        this.RenderCatalogPart(writer, selectedCatalogPart, catalogPartChrome, ref firstCell);
                    }
                }
                writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                writer.AddStyleAttribute(HtmlTextWriterStyle.Padding, "0");
                writer.AddStyleAttribute(HtmlTextWriterStyle.Height, "100%");
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                writer.RenderEndTag();
                writer.RenderEndTag();
            }
            else
            {
                this.RenderEmptyZoneText(writer);
            }
            if (base.DesignMode)
            {
                WebZone.RenderDesignerRegionEndTag(writer);
            }
            WebZone.RenderBodyTableEndTag(writer);
        }
        private void Initialize(CatalogPartCollection existingCatalogParts, ICollection catalogParts) {
            if (existingCatalogParts != null) {
                foreach (CatalogPart existingCatalogPart in existingCatalogParts) {
                    // Don't need to check arg, since we know it is valid since it came
                    // from a CatalogPartCollection.
                    InnerList.Add(existingCatalogPart);
                }
            }

            if (catalogParts != null) {
                foreach (object obj in catalogParts) {
                    if (obj == null) {
                        throw new ArgumentException(SR.GetString(SR.Collection_CantAddNull), "catalogParts");
                    }
                    if (!(obj is CatalogPart)) {
                        throw new ArgumentException(SR.GetString(SR.Collection_InvalidType, "CatalogPart"), "catalogParts");
                    }
                    InnerList.Add(obj);
                }
            }
        }
Esempio n. 9
0
        protected override CatalogPartCollection CreateCatalogParts()
        {
            CatalogPartCollection catalogParts = new CatalogPartCollection();

            if (_zoneTemplate != null)
            {
                // PERF: Instantiate the template into a special control, that does nothing when a child control
                // is added.  This is more performant because the child control is never parented to the temporary
                // control, it's ID is never generated, etc.
                Control container = new NonParentingControl();

                _zoneTemplate.InstantiateIn(container);
                if (container.HasControls())
                {
                    foreach (Control control in container.Controls)
                    {
                        CatalogPart part = control as CatalogPart;

                        if (part != null)
                        {
                            catalogParts.Add(part);
                        }
                        else
                        {
                            LiteralControl literal = control as LiteralControl;
                            // Throw an exception if it is *not* a literal containing only whitespace
                            // Don't throw an exception in the designer, since we want only the offending
                            // control to render as an error block, not the whole CatalogZone.
                            if (((literal == null) || (literal.Text.Trim().Length != 0)) && !DesignMode)
                            {
                                throw new InvalidOperationException(SR.GetString(SR.CatalogZone_OnlyCatalogParts, ID));
                            }
                        }
                    }
                }
            }

            return(catalogParts);
        }
 public CatalogPartCollection(CatalogPartCollection existingCatalogParts, ICollection catalogParts)
 {
     Initialize(existingCatalogParts, catalogParts);
 }
Esempio n. 11
0
 // Called by a derived class if the list of CatalogParts changes, and they want CreateCatalogParts()
 // to be called again.
 protected void InvalidateCatalogParts() {
     _catalogParts = null;
     ChildControlsCreated = false;
 }
 public CatalogPartCollection(CatalogPartCollection existingCatalogParts, ICollection catalogParts) {
     Initialize(existingCatalogParts, catalogParts);
 }
Esempio n. 13
0
 protected void InvalidateCatalogParts()
 {
     this._catalogParts        = null;
     base.ChildControlsCreated = false;
 }
Esempio n. 14
0
        protected override void RenderBody(HtmlTextWriter writer)
        {
            RenderBodyTableBeginTag(writer);
            if (DesignMode)
            {
                RenderDesignerRegionBeginTag(writer, Orientation.Vertical);
            }

            CatalogPartCollection catalogParts = CatalogParts;

            if (catalogParts != null && catalogParts.Count > 0)
            {
                bool firstCell = true;
                // Only render links if there is more than 1 catalog part (VSWhidbey 77672)
                if (catalogParts.Count > 1)
                {
                    writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                    writer.RenderBeginTag(HtmlTextWriterTag.Td);
                    firstCell = false;
                    RenderCatalogPartLinks(writer);
                    writer.RenderEndTag();  // Td
                    writer.RenderEndTag();  // Tr
                }

                CatalogPartChrome chrome = CatalogPartChrome;
                if (DesignMode)
                {
                    foreach (CatalogPart catalogPart in catalogParts)
                    {
                        RenderCatalogPart(writer, catalogPart, chrome, ref firstCell);
                    }
                }
                else
                {
                    CatalogPart selectedCatalogPart = SelectedCatalogPart;
                    if (selectedCatalogPart != null)
                    {
                        RenderCatalogPart(writer, selectedCatalogPart, chrome, ref firstCell);
                    }
                }

                writer.RenderBeginTag(HtmlTextWriterTag.Tr);

                // Mozilla renders padding on an empty TD without this attribute
                writer.AddStyleAttribute(HtmlTextWriterStyle.Padding, "0");

                // Add an extra row with height of 100%, to [....] up any extra space
                // if the height of the zone is larger than its contents
                // Mac IE needs height=100% set on <td> instead of <tr>
                writer.AddStyleAttribute(HtmlTextWriterStyle.Height, "100%");

                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                writer.RenderEndTag(); // Td
                writer.RenderEndTag(); // Tr
            }
            else
            {
                RenderEmptyZoneText(writer);
            }

            if (DesignMode)
            {
                RenderDesignerRegionEndTag(writer);
            }
            RenderBodyTableEndTag(writer);
        }
Esempio n. 15
0
 // Called by a derived class if the list of CatalogParts changes, and they want CreateCatalogParts()
 // to be called again.
 protected void InvalidateCatalogParts()
 {
     _catalogParts        = null;
     ChildControlsCreated = false;
 }
 protected void InvalidateCatalogParts()
 {
     this._catalogParts = null;
     base.ChildControlsCreated = false;
 }