/// <summary> /// Render a selectable table /// </summary> /// <param name="data"></param> public void RenderControl(UXViewSelectableDataTable data) { MasterObject mo = new MasterObject(); RenderCSSProperties(data, mo.CSS); mo.Name = data.Name + "_outer_masterObject"; mo.Width = 100; mo.Height = 100; mo.ConstraintWidth = EnumConstraint.RELATIVE; mo.ConstraintHeight = EnumConstraint.RELATIVE; mo.CountColumns = 1; mo.CountLines = 1; mo.HTMLBefore = "<div id='" + mo.Name + "_in' onmouseout='javascript:LeaveArrow();'>"; mo.HTMLAfter = "</div>"; HorizontalZone h = new HorizontalZone(); h.ConstraintWidth = EnumConstraint.RELATIVE; h.ConstraintHeight = EnumConstraint.RELATIVE; h.Width = 100; h.Height = 100; h.CountLines = 1; mo.HorizontalZones.Add(h); VerticalZone v = new VerticalZone(); v.Width = 100; v.Height = 100; data.Get("Disposition", (s, x) => { v.Disposition = Enum.Parse(typeof(Disposition), x.Value); }); v.ConstraintWidth = EnumConstraint.RELATIVE; v.ConstraintHeight = EnumConstraint.RELATIVE; v.CountLines = 1; v.CountColumns = 1; h.VerticalZones.Add(v); this.project.MasterObjects.Add(mo); HTMLObject obj = new HTMLObject(mo); obj.Container = this.currentContainer; this.currentObject.Objects.Add(obj); this.project.Instances.Add(obj); currentContainer = mo.HorizontalZones[0].VerticalZones[0].Name; RenderControl(data as UXViewDataTable); }
/// <summary> /// Render a single row of a table /// </summary> /// <param name="row">row to render</param> public void RenderControl(UXRow row) { HorizontalZone h = new HorizontalZone(); RenderCSSProperties(row, h.CSS); row.Get("Width", (s, v) => { h.Width = Convert.ToUInt32(v.Value); }); row.Get("Height", (s, v) => { h.Height = Convert.ToUInt32(v.Value); }); row.Get("Constraint-Width", (x, y) => { EnumConstraint c; if (Enum.TryParse <EnumConstraint>(y.Value, out c)) { h.ConstraintWidth = c; } else { h.ConstraintWidth = EnumConstraint.AUTO; } }); row.Get("Constraint-Height", (x, y) => { EnumConstraint c; if (Enum.TryParse <EnumConstraint>(y.Value, out c)) { h.ConstraintHeight = c; } else { h.ConstraintHeight = EnumConstraint.AUTO; } }); h.CountLines = 1; this.currentObject.HorizontalZones.Add(h); dynamic previousObject = this.currentObject; string normalBackground = "Transparent"; row.Get("BackColor", (s, v) => { normalBackground = v.Value; }); if (row.IsSelectable) { HTMLEvent ev = new HTMLEvent("onmouseover"); ev.Raise.Add((o, e) => { return("this.style.backgroundColor = \"" + row.BackgroundSelectable + "\";"); }); h.Events.Add(ev); ev = new HTMLEvent("onmouseout"); ev.Raise.Add((o, e) => { return("this.style.backgroundColor = \"" + normalBackground + "\";"); }); h.Events.Add(ev); } if (row.IsClickable) { HTMLEvent ev = new HTMLEvent("onclick"); ev.Raise.Add((o, e) => { return("this.style.backgroundColor = \"" + row.BackgroundClickable + "\"; serverSideCall(\"row\",\"" + row.Id + "\");"); }); h.Events.Add(ev); } for (int pos_column = 0; pos_column < row.ColumnCount; ++pos_column) { this.currentObject = h; if (row.Children.ElementAt(pos_column) != null) { RenderControl(row.Children.ElementAt(pos_column)); } } this.currentObject = previousObject; }