コード例 #1
0
        /// <summary>
        /// Generate an HTML TABLE tag for actual website
        /// a given master page generates the page
        /// a page contains master objects related
        /// restricted objects in page are computed equally
        /// </summary>
        /// <param name="refPage">page reference</param>
        /// <param name="masterRefPage">master page reference</param>
        /// <param name="objects">master objects list</param>
        /// <param name="parentConstraint">parent constraint</param>
        /// <returns>html output</returns>
        public OutputHTML GenerateProductionTable(Page refPage, MasterPage masterRefPage, List <MasterObject> objects, ParentConstraint parentConstraint)
        {
            OutputHTML output = new OutputHTML();
            CodeCSS    myCss  = new CodeCSS(this.CSS);
            string     myId   = "horiz" + Project.IncrementedTraceCounter.ToString();

            // compute size
            ParentConstraint newInfos = Routines.ComputeHorizontalZone(parentConstraint, this);
            ConstraintSize   cs       = new ConstraintSize(newInfos.constraintWidth, newInfos.precedingWidth,
                                                           newInfos.maximumWidth, newInfos.constraintHeight,
                                                           newInfos.precedingHeight, newInfos.maximumHeight);

            myCss.Ids = "#" + myId;
            Routines.SetCSSPart(myCss, cs);

            string tag;

            this.Attributes.ToHTML("tr", myId, myCss, this.Events, output.CSS, out tag);
            output.HTML.Append(tag);

            foreach (VerticalZone vz in this.VerticalZones)
            {
                OutputHTML zone = vz.GenerateProductionTable(refPage, masterRefPage, objects, newInfos);
                output.HTML.Append(zone.HTML.ToString());
                output.CSS.Append(zone.CSS.ToString());
                output.JavaScript.Append(zone.JavaScript.ToString());
                output.JavaScriptOnLoad.Append(zone.JavaScriptOnLoad.ToString());
            }
            output.HTML.Append("</tr>");

            output.JavaScript.Append(this.JavaScript.GeneratedCode);
            output.JavaScriptOnLoad.Append(this.JavaScriptOnLoad.GeneratedCode);
            return(output);
        }
コード例 #2
0
        /// <summary>
        /// Generate an HTML DIV tag for design
        /// a given master page generates the page
        /// a page contains master objects related
        /// restricted objects in page are computed equally
        /// </summary>
        /// <param name="refPage">page reference</param>
        /// <param name="masterRefPage">master page reference</param>
        /// <param name="objects">master objects list</param>
        /// <param name="parentConstraint">parent constraint</param>
        /// <returns>html output</returns>
        public OutputHTML GenerateDesignDIV(Page refPage, MasterPage masterRefPage, List <MasterObject> objects, ParentConstraint parentConstraint)
        {
            OutputHTML output = new OutputHTML();
            CodeCSS    myCss  = new CodeCSS(this.CSS);

            if (this.VerticalZones.Count > 0)
            {
                string myId = "horiz" + Project.IncrementedTraceCounter.ToString();

                // compute size
                ParentConstraint newInfos = Routines.ComputeHorizontalZone(parentConstraint, this);
                ConstraintSize   cs       = new ConstraintSize(newInfos.constraintWidth, newInfos.precedingWidth,
                                                               newInfos.maximumWidth, newInfos.constraintHeight,
                                                               newInfos.precedingHeight, newInfos.maximumHeight);

                // set CSS part
                myCss.Ids = "#" + myId;
                Routines.SetCSSPart(myCss, cs);

                string tag;
                this.Attributes.ToHTML("div", myId, myCss, this.Events, output.CSS, out tag);
                output.HTML.Append(tag);


                List <VerticalZone> .Enumerator e = this.VerticalZones.GetEnumerator();
                VerticalZone lastZone             = null;
                if (e.MoveNext())
                {
                    do
                    {
                        if (lastZone != null)
                        {
                            OutputHTML zone = lastZone.GenerateDesignDIV(refPage, masterRefPage, objects, newInfos);
                            output.HTML.Append(zone.HTML.ToString());
                            output.CSS.Append(zone.CSS.ToString());
                            output.JavaScript.Append(zone.JavaScript.ToString());
                            output.JavaScriptOnLoad.Append(zone.JavaScriptOnLoad.ToString());
                        }
                        lastZone = e.Current;
                    } while (e.MoveNext());
                }
                if (lastZone != null)
                {
                    OutputHTML last = lastZone.GenerateDesignDIV(refPage, masterRefPage, objects, newInfos);
                    output.HTML.Append(last.HTML.ToString());
                    output.CSS.Append(last.CSS.ToString());
                    output.JavaScript.Append(last.JavaScript.ToString());
                    output.JavaScriptOnLoad.Append(last.JavaScriptOnLoad.ToString());
                }
                output.HTML.Append("</div>");

                output.JavaScript.Append(this.JavaScript.GeneratedCode);
                output.JavaScriptOnLoad.Append(this.JavaScriptOnLoad.GeneratedCode);
            }
            return(output);
        }
コード例 #3
0
        /// <summary>
        /// Generate page for actual website
        /// A page is the top-level of generation
        /// so, this function works with no argument
        /// </summary>
        /// <returns>html output</returns>
        public OutputHTML GenerateProduction()
        {
            MasterPage selectedMp = Project.CurrentProject.MasterPages.Find(mp => { return(mp.Name == this.MasterPageName); });

            if (selectedMp != null)
            {
                OutputHTML output = selectedMp.GenerateProduction(this);
                return(output);
            }
            else
            {
                throw new KeyNotFoundException(String.Format(Localization.Strings.GetString("ExceptionMasterPageNotExists"), this.MasterPageName, this.Name));
            }
        }
コード例 #4
0
        /// <summary>
        /// Generate design from a page and its objects
        /// </summary>
        /// <param name="refPage">page reference</param>
        /// <param name="objects">object list</param>
        /// <param name="parentConstraint">parent constraint</param>
        /// <returns>html output</returns>
        public OutputHTML GenerateDesign(Page refPage, List <MasterObject> objects, ParentConstraint parentConstraint)
        {
            if (this.IsMasterObject)
            {
                MasterObject selectedMo = Project.CurrentProject.MasterObjects.Find(mo => { return(mo.Name == this.MasterObjectName); });
                if (selectedMo != null)
                {
                    // calcul de la taille maximum de l'objet
                    ParentConstraint newParent = new ParentConstraint(this.Name, parentConstraint);
                    newParent.maximumWidth  = selectedMo.Width;
                    newParent.maximumHeight = selectedMo.Height;
                    Routines.MoveConstraint(newParent, selectedMo.Width, selectedMo.Height, selectedMo.ConstraintWidth, selectedMo.ConstraintHeight);
                    OutputHTML output = selectedMo.GenerateDesign(refPage, objects, newParent);
                    return(output);
                }
                else
                {
                    throw new KeyNotFoundException(String.Format(Localization.Strings.GetString("ExceptionMasterObjectNotExists"), this.MasterObjectName, this.Title));
                }
            }
            else
            {
                OutputHTML html  = new OutputHTML();
                CodeCSS    myCss = new CodeCSS(this.CSS);
                string     myId  = "obj" + Project.IncrementedTraceCounter.ToString();

                ParentConstraint newInfos = Routines.ComputeObject(parentConstraint, this);
                Routines.SetObjectDisposition(newInfos, myCss, newInfos);
                ConstraintSize cs = new ConstraintSize(newInfos.constraintWidth, newInfos.precedingWidth, newInfos.maximumWidth, newInfos.constraintHeight, newInfos.precedingHeight, newInfos.maximumHeight);
                myCss.Ids = "#" + myId;
                Routines.SetCSSPart(myCss, cs);
                string tag;
                this.Attributes.ToHTML("div", myId, myCss, this.Events, html.CSS, out tag);

                html.HTML.Append(tag);

                html.HTML.Append(this.GeneratedHTML);

                html.HTML.Append("</div>");

                html.AppendCSS(this.CSSList.GetListWithoutPrincipal(this.Id));
                html.JavaScript.Append(this.JavaScript.GeneratedCode);
                html.JavaScriptOnLoad.Append(this.JavaScriptOnLoad.GeneratedCode);
                return(html);
            }
        }
コード例 #5
0
        /// <summary>
        /// Génération de la master page sans la page (design)
        /// This is a special case for a master page
        /// A master page can be viewed at design mode.
        /// So, you create a fake page to handle a master page
        /// </summary>
        /// <returns>page html</returns>
        public OutputHTML GenerateDesign()
        {
            // Create a fake page
            Page page = new Page();

            if (this.ConstraintWidth == EnumConstraint.RELATIVE || this.ConstraintHeight == EnumConstraint.RELATIVE)
            {
                OutputHTML html = this.GenerateDesignTable(page);
                return(html);
            }
            else
            {
                // il faut décider si l'on utilise une table ou des div
                // s'il existe une colonne dont countLines > countLines de l'horizontal alors on utilise une table
                // sinon on peut utiliser des div
                bool cannotUseDiv = false;
                foreach (HorizontalZone hz in this.HorizontalZones)
                {
                    bool sup = false;
                    foreach (VerticalZone vz in hz.VerticalZones)
                    {
                        if (vz.CountLines < hz.CountLines)
                        {
                            sup = true;
                        }
                    }
                    if (sup)
                    {
                        cannotUseDiv = true;
                        break;
                    }
                }
                OutputHTML html;
                if (cannotUseDiv)
                {
                    html = this.GenerateDesignTable(page);
                }
                else
                {
                    html = this.GenerateDesignDIV(page);
                }
                return(html);
            }
        }
コード例 #6
0
 /// <summary>
 /// Generate design from nothing
 /// Function to design this object
 /// a master object or a tool
 /// </summary>
 /// <returns>html output</returns>
 public OutputHTML GenerateDesign()
 {
     if (this.IsMasterObject)
     {
         MasterObject selectedMo = Project.CurrentProject.MasterObjects.Find(mo => { return(mo.Name == this.MasterObjectName); });
         if (selectedMo != null)
         {
             OutputHTML output = selectedMo.GenerateDesign();
             return(output);
         }
         else
         {
             throw new KeyNotFoundException(String.Format(Localization.Strings.GetString("ExceptionMasterObjectNotExists"), this.MasterObjectName, this.Title));
         }
     }
     else
     {
         return(Routines.GenerateDesignObject(this));
     }
 }