Beispiel #1
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);
            }
        }
Beispiel #2
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));
     }
 }