private HTMLTableElement Table(params HTMLTableRowElement[] rows) { var table = new HTMLTableElement(); table.AppendChildren(rows); return(table); }
public void Render() { var labelWelcome = new HTMLLabelElement { InnerHTML = "Welcome to Pomodoro!", Style = { FontSize = "32px", Margin = "10px" } }; _textBoxName = new HTMLInputElement { Placeholder = "Enter nameā¦", Value = "PomodoroBridgeClient" }; _table = new HTMLTableElement(); var buttonGetAll = new HTMLButtonElement { InnerHTML = "Get all", OnClick = ev => RefreshList() }; var buttonStart = new HTMLButtonElement { InnerHTML = "Start", OnClick = ev => { _api.Start(_textBoxName.Value); RefreshList(); } }; var buttonStop = new HTMLButtonElement { InnerHTML = "Stop", OnClick = ev => { _api.Stop(_textBoxName.Value); RefreshList(); } }; // Add to the document body var htmlBodyElement = Document.Body; htmlBodyElement.AppendChild(labelWelcome); htmlBodyElement.AppendChild(new HTMLBRElement()); htmlBodyElement.AppendChild(_textBoxName); htmlBodyElement.AppendChild(new HTMLBRElement()); htmlBodyElement.AppendChild(buttonGetAll); htmlBodyElement.AppendChild(buttonStart); htmlBodyElement.AppendChild(buttonStop); htmlBodyElement.AppendChild(new HTMLBRElement()); htmlBodyElement.AppendChild(_table); }
public static HTMLTableElement BuildTable() { var tbl = new HTMLTableElement(); tbl.AppendChild(new HTMLElement("tbody")); return(tbl); }
public DataGridViewColumnCollection(DataGridView owner, HTMLTableElement table) { _owner = owner; _controls = new List <DataGridViewColumn>(); header = table.createTHead(); table.appendChild(header); }
static void Refresh(HTMLTableElement table, GameObject gameObject) { if (string.IsNullOrEmpty(gameObject.Name)) { return; } CreateReference(gameObject, table); }
public DataGridViewRowCollection(DataGridView owner, HTMLTableElement table) { _owner = owner; _controls = new List <DataRow>(); body = table.createTBody(); table.appendChild(body); }
public static void CreateCell(HTMLTableElement table, params Node[] toAppend) { var row1 = new HTMLTableRowElement(); table.AppendChild(row1); var cell1 = new HTMLTableDataCellElement(); foreach (var append in toAppend) { cell1.AppendChild(append); } row1.AppendChild(cell1); }
public DataGridView() : base(new HTMLDivElement()) { table = new HTMLTableElement(); Element.appendChild(table); Element.style.overflow = "auto"; Columns = new DataGridViewColumnCollection(this, table); Rows = new DataGridViewRowCollection(this, table); TabStop = false; Element.setAttribute("scope", "table"); }
static void Inspect(HTMLTableElement table, List <Entry> list) { var entry = new Entry(); var cells = table.QuerySelectorAll("table td"); var blub = cells.Select(m => m.TextContent).ToArray(); var path = String.Empty; entry.Rules = cells[2].TextContent; entry.FileName = cells[4].TextContent; entry.Collection = cells[6].TextContent; entry.Text = cells[7].TextContent.Trim(); if (entry.Collection.StartsWith("IBM")) { path = IBMPath(entry.FileName); } else if (entry.Collection.StartsWith("James Clark")) { path = XmlTestPath(entry.FileName); } else if (entry.Collection.StartsWith("Sun")) { path = SunPath(entry.FileName); } else if (entry.Collection.StartsWith("OASIS")) { path = OasisPath(entry.FileName); } else if (entry.Collection.StartsWith("Fuji")) { path = XmlFujiPath(entry.FileName); } else { path = EdUniPath(entry.FileName); } if (File.Exists(path)) { entry.Content = File.ReadAllText(path); list.Add(entry); } }
public static void SetCell(this HTMLTableElement self, int row, int col, Action <HTMLElement> setCell) { var tbody = self.TBodies[0]; var rowsToAdd = row - tbody.Children.Length; while (rowsToAdd-- >= 0) { tbody.AppendChild(new HTMLTableRowElement()); } var tr = tbody.GetChildAtOrNull(row); var colsToAdd = col - tr.Children.Length; while (colsToAdd-- >= 0) { tr.AppendChild(new HTMLTableDataCellElement()); } setCell(tr.GetChildAtOrNull(col)); }
static void SetupLevel() { level.Canvas.OnClick = Click; level.Canvas.Style.Border = "1px solid black"; Document.Body.AppendChild(left = new HTMLDivElement()); Document.Body.AppendChild(right = new HTMLDivElement()); right.AppendChild(table = new HTMLTableElement()); left.Style.Width = "50%"; right.Style.Width = "50%"; left.Style.CssFloat = Float.Left; right.Style.CssFloat = Float.Right; left.AppendChild(level.Canvas); HTMLButtonElement button = new HTMLButtonElement { InnerHTML = "Save", OnClick = e => Save() }; button.Style.Position = Position.Fixed; button.Style.Bottom = "0"; button.Style.Left = "0"; Document.Body.AppendChild(button); }
public static void ShowTableDemo() { var div = new HTMLDivElement(); var table = new HTMLTableElement(); table.CreateTHead(); var tHeadRow = new HTMLTableRowElement(); tHeadRow.AppendChild(new HTMLTableHeaderCellElement() { TextContent = "Name" }); tHeadRow.AppendChild(new HTMLTableHeaderCellElement() { TextContent = "Position" }); tHeadRow.AppendChild(new HTMLTableHeaderCellElement() { TextContent = "Office" }); tHeadRow.AppendChild(new HTMLTableHeaderCellElement() { TextContent = "Age" }); tHeadRow.AppendChild(new HTMLTableHeaderCellElement() { TextContent = "StartDate" }); tHeadRow.AppendChild(new HTMLTableHeaderCellElement() { TextContent = "Salary" }); table.THead.AppendChild(tHeadRow); var tBody = new HTMLTableSectionElement(TableSectionType.Body); table.AppendChild(tBody); div.AppendChild(table); var data = Script.Get("tabledemoJsonData").ToDynamic(); foreach (var dataRow in data) { var row = new HTMLTableRowElement(); row.OnMouseEnter = (ev) => { row.ClassList.Add("highlight"); }; row.OnMouseLeave = (ev) => { row.ClassList.Remove("highlight"); }; row.OnMouseDown = (ev) => { if (row.ClassList.Contains("selected")) { row.ClassList.Remove("selected"); } else { row.ClassList.Add("selected"); } }; row.AppendChild(new HTMLTableDataCellElement() { TextContent = dataRow.Name }); row.AppendChild(new HTMLTableDataCellElement() { TextContent = dataRow.Position }); row.AppendChild(new HTMLTableDataCellElement() { TextContent = dataRow.Office }); row.AppendChild(new HTMLTableDataCellElement() { TextContent = dataRow.Age }); row.AppendChild(new HTMLTableDataCellElement() { TextContent = dataRow.StartDate }); row.AppendChild(new HTMLTableDataCellElement() { TextContent = dataRow.Salary }); tBody.AppendChild(row); } div.Dialog(new DialogParameter() { Title = "Datatable Demo", Width = 960, Height = 600 }); div.DialogEventResize( (ev, ui) => { table.DataTableDraw(); } ); table.DataTable(new DataTableParameter() { ScrollCollapse = true, ScrollY = "100%" }); table.DataTableDraw(); //Bridge.jQuery2.jQuery.Ajax(new Bridge.jQuery2.AjaxOptions //{ // Url = "TextFile1.txt", // ContentType = "application/json; charset=utf-8", // Success = delegate (dynamic data, string str, Bridge.jQuery2.jqXHR jqxhr) // { // var row = new HTMLTableRowElement(); // row.AppendChild(new HTMLTableColElement() { TextContent = data.Name }); // row.AppendChild(new HTMLTableColElement() { TextContent = data.Position }); // row.AppendChild(new HTMLTableColElement() { TextContent = data.Office }); // row.AppendChild(new HTMLTableColElement() { TextContent = data.Age }); // row.AppendChild(new HTMLTableColElement() { TextContent = data.StartDate }); // row.AppendChild(new HTMLTableColElement() { TextContent = data.Salary }); // tBody.AppendChild(row); // } //}); }
public static async Task <LevelEditorReference> CreateReference(GameObject gameObject, HTMLTableElement table, int indent = 0) { if (gameObject.Name == null) { return(null); } HTMLTableRowElement row = new HTMLTableRowElement(); row.Indent(indent); var cell = new HTMLTableDataCellElement(); cell.Style.BorderBottom = "1px solid black"; cell.AppendChild(new HTMLAnchorElement { InnerHTML = gameObject.Name, Href = "javascript:void(0)", OnClick = v => Select(gameObject) }); cell.AppendChild(new Text(" ")); var cross = new HTMLAnchorElement { OnClick = v => Remove(gameObject), Href = "javascript:void(0)" }; cross.AppendChild(LevelEditor.cross = LevelEditor.cross.CloneNode().As <HTMLImageElement>()); cell.AppendChild(cross); row.AppendChild(cell); table.AppendChild(row); LevelEditorReference result = new LevelEditorReference { gameObject = gameObject, cells = new Dictionary <string, HTMLElement>(), members = new Dictionary <string, MemberInfo>() }; string type; if (gameObject is Character) { type = "Character"; } else if (gameObject is Shot) { type = "Shot"; } else if (gameObject is RealGameObject) { type = "Real Thing"; } else if (gameObject is DrawnGameObject) { type = "Illusion"; } else if (gameObject is Movement) { type = "Movement by User"; } else if (gameObject is Shoot_OnKey) { type = "Shooting by User"; } else if (gameObject is Level) { type = "Level"; } else { throw new Exception($"Type not allowed: {gameObject.GetType().FullName}"); } row = new HTMLTableRowElement(); row.Indent(indent); cell = new HTMLTableDataCellElement { InnerHTML = "Type" }; HTMLTableDataCellElement cell2 = new HTMLTableDataCellElement { InnerHTML = type }; result.cells.Add("Type", cell2); row.AppendChild(cell); row.AppendChild(cell2); table.AppendChild(row); List <MemberInfo> fields = new List <MemberInfo>(gameObject.GetType().GetFields()); fields.AddRange(gameObject.GetType().GetProperties()); foreach (var field in fields) { if (field.IsStatic) { continue; } Type memberType; if (field is FieldInfo) { memberType = ((FieldInfo)field).FieldType; } else if (field is PropertyInfo) { memberType = ((PropertyInfo)field).PropertyType; } else { throw new Exception(); } var customAttributes2 = (ObjectCreatorAttribute[])field.GetCustomAttributes(typeof(ObjectCreatorAttribute)); string s; GameObject o; if (allowed.Contains(memberType) || customAttributes2.Length == 1) { object value; if (field is FieldInfo) { value = ((FieldInfo)field).GetValue(gameObject); } else if (field is PropertyInfo) { value = ((PropertyInfo)field).GetValue(gameObject); } else { throw new Exception(); } if (value == null) { continue; } if (customAttributes2.Length == 1) { value = await GameObject.Create(value); } row = new HTMLTableRowElement(); row.Indent(indent); var contentEditable = ContentEditable.True; string valueString; s = value as string; if (s != null) { valueString = s; } else if (value is double) { valueString = ((double)value).ToString(); } else { contentEditable = ContentEditable.False; if (value is List <GameObject> ) { valueString = "List of Objects"; } else if (value is List <OnKeyEvent> ) { valueString = "List of Key Press Actions"; } else if (value is GameObject) { valueString = "Object"; } else { throw new Exception(); } } string name = field.Name; var customAttributes = (LevelEditorNameAttribute[])field.GetCustomAttributes(typeof(LevelEditorNameAttribute)); if (customAttributes.Length == 1) { name = customAttributes[0].LevelEditorName; } cell = new HTMLTableDataCellElement { InnerHTML = name }; cell2 = new HTMLTableDataCellElement { ContentEditable = contentEditable, InnerHTML = valueString }; result.cells.Add(field.Name, cell2); result.members.Add(field.Name, field); row.AppendChild(cell); row.AppendChild(cell2); table.AppendChild(row); if (value is List <GameObject> || value is List <OnKeyEvent> ) { foreach (GameObject _gameObject in (System.Collections.IList)(value as List <GameObject>) ?? (System.Collections.IList)(value as List <OnKeyEvent>)) { await CreateReference(_gameObject, table, indent + 1); } } o = value as GameObject; if (o != null) { await CreateReference(o, table, indent + 1); } } } row = new HTMLTableRowElement(); row.Indent(indent); cell = new HTMLTableDataCellElement(); cell.AppendChild(new HTMLButtonElement { InnerHTML = "Save Changes", OnClick = e => SaveChanges(result) }); row.AppendChild(cell); table.AppendChild(row); return(result); }
public static HTMLTableElement DataTable(this HTMLTableElement table) { new Bridge.jQuery2.jQuery(table).ToDynamic().DataTable(); return(table); }
public Drawer(Options settings, Mandelbrot calculator) { this.Settings = settings; this.Calculator = calculator; // the actual canvas element var canvas = new HTMLCanvasElement(); canvas.Width = 900; canvas.Height = 500; DrawButton = new HTMLButtonElement { InnerHTML = "Draw the Mandelbrot fractal", OnClick = (ev) => { StartDraw(canvas); } }; DrawButton.SetAttribute("style", "font-size:18px;height: 60px; width:95%; border: 2px solid black; cursor: pointer"); // Iteration controls RadiusElement = GetInputNumberElement(null, this.Settings.MaxRadius, 3, 0.5); IterationCountElement = GetInputNumberElement(null, this.Settings.MaxIterations, 4, 100, 0, 100000); // Color controls ColorMapCheckbox = GetCheckboxElement(this.Settings.UseColorMap); ColorScaleElement = GetInputNumberElement(ColorMapCheckbox, this.Settings.ColorScale, 5, 1000); ColorOffsetElement = GetInputNumberElement(ColorMapCheckbox, this.Settings.ColorOffset, 4, 10); // Julia sets JuliaSetCheckbox = GetCheckboxElement(this.Settings.UseJuliaSet); JuliaImElement = GetInputNumberElement(JuliaSetCheckbox, this.Settings.JuliaSetParameter.Im, 5, 0.005, null); JuliaReElement = GetInputNumberElement(JuliaSetCheckbox, this.Settings.JuliaSetParameter.Re, 5, 0.005, null); // Viewport controls XMinElement = GetInputNumberElement(null, this.Settings.XMin, 5, 0.005, -5.0); XMaxElement = GetInputNumberElement(null, this.Settings.XMax, 5, 0.005, 0.0); YMinElement = GetInputNumberElement(null, this.Settings.YMin, 5, 0.005, -5.0); YMaxElement = GetInputNumberElement(null, this.Settings.YMax, 5, 0.005, 0.0); var paramsColumn = new HTMLTableDataCellElement(); var canvasColumn = new HTMLTableDataCellElement(); paramsColumn.SetAttribute("valign", "top"); canvasColumn.SetAttribute("valign", "top"); canvasColumn.AppendChild(canvas); var layoutRow = new HTMLTableRowElement(); layoutRow.AppendChildren(paramsColumn, canvasColumn); var layout = new HTMLTableElement(); var paramsTable = new HTMLTableElement(); paramsTable.AppendChildren( Row(Label("XMin: "), XMinElement), Row(Label("XMax: "), XMaxElement), Row(Label("YMin: "), YMinElement), Row(Label("YMax: "), YMaxElement), Row(Label("Escape radius: "), RadiusElement), Row(Label("Iteration count: "), IterationCountElement), Row(Label("Use color map: "), ColorMapCheckbox), Row(Label("Color scale: "), ColorScaleElement), Row(Label("Color offset: "), ColorOffsetElement), Row(Label("Use Julia set: "), JuliaSetCheckbox), Row(Label("Im: "), JuliaImElement), Row(Label("Re: "), JuliaReElement), Row(new HTMLHRElement(), 2), Row(DrawButton, 2) ); paramsColumn.AppendChild(paramsTable); layout.AppendChild(layoutRow); Document.Body.AppendChild(layout); }
Table Render(HTMLTableElement element) { var table = new Table(); return(table); }
public static HTMLTableElement DataTable(this HTMLTableElement table, DataTableParameter parameter) { new Bridge.jQuery2.jQuery(table).ToDynamic().DataTable(parameter.ToJsObject()); return(table); }
private HTMLTableElement Table(params HTMLTableRowElement[] rows) { var table = new HTMLTableElement(); table.AppendChildren(rows); return table; }