Esempio n. 1
0
        virtual public void SetUp()
        {
            LoggerFactory.GetInstance().SetLogger(new SysoLogger(3));
            tag.Parent = new Tag("defaultRoot");
            basicPara.Add(basic);
            extraPara.Add(extra);
            cell1Row1.AddElement(basicPara);
            cell2Row1.AddElement(extraPara);
            cell3Row1.AddElement(basicPara);
            cell4Row1.AddElement(extraPara);
            cell4Row1.Rowspan = 2;
            cells1.Add(cell1Row1);
            cells1.Add(cell2Row1);
            cells1.Add(cell3Row1);
            cells1.Add(cell4Row1);
            row1 = new TableRowElement(cells1, TableRowElement.Place.BODY);

            cell1Row2.AddElement(extraPara);
            cell2Row2.AddElement(basicPara);
//		Tag t = new Tag(null, new HashMap<String, String>());
//		t.getAttributes().put("col-span", "2");
            cell2Row2.Colspan = 2;
            cell3Row2.AddElement(extraPara);
            cells2.Add(cell1Row2);
            cells2.Add(cell2Row2);
            //cells2.Add(cell3Row2);
            row2 = new TableRowElement(cells2, TableRowElement.Place.BODY);

            rows.Add(row1);
            rows.Add(row2);
        }
Esempio n. 2
0
        private void AddCell(TableRowElement row, string tagName, string label)
        {
            Element cell = (TableCellElement)Document.CreateElement(tagName);

            row.AppendChild(cell);
            cell.InnerHTML = label;
        }
Esempio n. 3
0
        private void RenderColumnHeaders()
        {
            // Create a row for the column headers
            TableRowElement header = _table.InsertRow();

            header.ID = "headerRow";

            // Create a cell for the first column where we will also add row headers
            TableCellElement blankCell = header.InsertCell(0);

            blankCell.ID = "blankCell";

            // Create 26 Column Headers and name them with the letters of the English Alphabets
            // Iterating through the ASCII indexes for A-Z
            for (int i = 65; i < 91; i++)
            {
                // Create a cell element in the header row starting at index 1
                TableCellElement cell = header.InsertCell(i - 64);

                // Set the cell id to the letter corresponding to the ASCII index
                cell.ID = string.FromCharCode(i);

                // Set the value of the cell toe the letter corresponding to the ASCII index
                cell.TextContent = string.FromCharCode(i);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Create rows in the spreadsheet
        /// </summary>
        /// <param name="rowCount">Number of rows to create</param>
        private void RenderRows(int rowCount)
        {
            // We're iterating from row index 1 because we want the title of the rows
            // to be equal to the index. In addition, row 0 is the column header row
            for (int rowIndex = 1; rowIndex <= rowCount; rowIndex++)
            {
                // Create a new row in the table
                TableRowElement row = _table.InsertRow(rowIndex);

                // Create a row header cell and set its id and value to the row index
                TableCellElement cell = row.InsertCell(0);
                cell.ID          = rowIndex.ToString();
                cell.TextContent = rowIndex.ToString();

                // Create cells for each column in the spreadsheet from A to Z
                for (int cellIndex = 65; cellIndex < 91; cellIndex++)
                {
                    // Insert cells at the corresponding column index (starting from column 1)
                    cell = row.InsertCell(cellIndex - 64);

                    // Create a text input element inside the cell
                    InputElement input = (InputElement)Document.CreateElement("input");
                    input.Type = "text";

                    // Set the ID of the element to the Column Letter and Row Number like A1, B1, etc.
                    input.ID = string.FromCharCode(cellIndex) + rowIndex;

                    // Add the input element as a child of the cell
                    cell.AppendChild(input);

                    // Create and attach spreadsheet events to this input element
                    AttachEvents(input);
                }
            }
        }
Esempio n. 5
0
 /// <summary>Visits the provided <paramref name="tableRow"/> element.</summary>
 /// <param name="tableRow">The <see cref="TableRowElement"/> to visit.</param>
 protected internal override void Visit(TableRowElement tableRow)
 {
     BeginElement("tr");
     foreach (var cell in tableRow.Cells)
     {
         cell.Accept(this);
     }
     EndElement();
 }
Esempio n. 6
0
        protected override void onLoad()
        {
            var newBtn = Document.GetElementById <ButtonElement>("newBtn");

            newBtn.OnClick = (ev) =>
            {
                Navigation <New> .Go();
            };

            var dynamodb = new DynamoDB();

            var param = new ScanParams
            {
                TableName            = "stock",
                ProjectionExpression = "product, quantity"
            };

            dynamodb.scan(param, (err, data) =>
            {
                if (err != null)
                {
                    Toast.Error(err.stack.ToString()); // an error occurred
                }
                else
                {
                    foreach (var item in data.Items)
                    {
                        var row = new TableRowElement();

                        var productTD       = new TableDataCellElement();
                        productTD.InnerHTML = item.produto.S;

                        row.AppendChild(productTD);

                        var quantityTD       = new TableDataCellElement();
                        quantityTD.InnerHTML = item.quantidade.N;
                        row.AppendChild(quantityTD);

                        var editBtn       = new ButtonElement();
                        editBtn.ClassName = "btn btn-default";
                        editBtn.InnerHTML = "Edit";

                        var editTD = new TableDataCellElement();
                        editTD.AppendChild(editBtn);
                        editBtn.OnClick = (ev) =>
                        {
                            Navigation <Edit> .Go(item.produto.S, int.Parse(item.quantidade.N));
                        };

                        row.AppendChild(editTD);

                        var tbody = Document.GetElementById <TableSectionElement>("table-body");
                        tbody.AppendChild(row);
                    }
                }
            });
        }
Esempio n. 7
0
        protected override TableCellElement CreateElement()
        {
            var element = MockRepository.GenerateStub <IWebElement>();

            element.Stub(x => x.TagName).Return("table");
            this.parentTable = new TableElement(element);

            element = MockRepository.GenerateStub <IWebElement>();
            element.Stub(x => x.TagName).Return("tr");
            this.parentRow = new TableRowElement(element, this.parentTable, 1);
            return(new TableCellElement(this.WebElement, this.parentRow, 2));
        }
Esempio n. 8
0
        public string GetRowClass(int index)
        {
            if (index < 0 || index >= numRows)
            {
                return(null);
            }

                        #if CLIENT
            if (isAttached && !rebuilding)
            {
                TableRowElement tr      = (TableRowElement)GetValuesTBody().Rows[index];
                var             classes = (string[])tr.ClassName.Split(" ").Filter(delegate(object x) { string s = (string)x; return(s == EvenRowClass || s == OddRowClass || s == SelectedRowClass); });
                return(classes.Length > 0 ? classes[0] : null);
            }
                        #endif
            return((string)rowClassesIfNotRendered[index]);
        }
Esempio n. 9
0
 public IList <string> GetTexts(int row)
 {
     if (row < 0 || row >= numRows)
     {
         return(null);
     }
                 #if CLIENT
     if (isAttached && !rebuilding)
     {
         TableRowElement tr     = (TableRowElement)GetValuesTBody().Rows[row];
         var             result = new List <string>();
         for (int i = 0; i < tr.Cells.Length; i++)
         {
             result.Add(jQuery.FromElement(tr.Cells[i]).GetText());
         }
         return(result);
     }
     return(rowTextsIfNotRendered[row]);
                 #else
     return(new List <string>(rowTextsIfNotRendered[row]));
                 #endif
 }
Esempio n. 10
0
        public void TableRowElementForValidElement()
        {
            var tableRowElement = new TableRowElement(_tableSearchFilterDemoPage.TaskTableRow);

            tableRowElement.Should().NotBeNull();
        }
Esempio n. 11
0
        protected override void Init()
        {
            AddSystem(new MenuBackgroundSystem());

            CanPause = false;

            BuildMenuButton("Back", 530, delegate(ElementEvent e)
            {
                CurrentGame.ShowTitleScreen();
            });

            Element title = BuildMenuButton("High Scores", 80, null);

            title.ClassName += " MenuTitle";

            HighScore[] scores = (HighScore[])Json.Parse((string)Window.LocalStorage[SpaceDinosGame.HighScoresKey]);

            TableElement table = (TableElement)Document.CreateElement("TABLE");

            table.ClassName = "HighScores";
            _overlay.AppendChild(table);
            Element tableBody = Document.CreateElement("TBODY");

            table.AppendChild(tableBody);

            TableRowElement row = (TableRowElement)Document.CreateElement("TR");

            tableBody.AppendChild(row);

            AddCell(row, "TH", string.Empty);
            AddCell(row, "TH", "Score");
            AddCell(row, "TH", "Level");
            AddCell(row, "TH", "Name");

            for (int i = 0; i < 10; i++)
            {
                row = (TableRowElement)Document.CreateElement("TR");
                tableBody.AppendChild(row);

                switch (i)
                {
                case 0:
                    AddCell(row, "TD", "1st");
                    break;

                case 1:
                    AddCell(row, "TD", "2nd");
                    break;

                case 2:
                    AddCell(row, "TD", "3rd");
                    break;

                default:
                    AddCell(row, "TD", (i + 1) + "th");
                    break;
                }

                AddCell(row, "TD", scores[i].Score.ToString());
                AddCell(row, "TD", scores[i].Level.ToString());
                AddCell(row, "TD", scores[i].Name);
            }

            jQuery.FromElement(_overlay).Show();
        }
Esempio n. 12
0
 /// <summary>Visits the provided <paramref name="tableRow"/> element.</summary>
 /// <param name="tableRow">The <see cref="TableRowElement"/> to visit.</param>
 protected internal abstract void Visit(TableRowElement tableRow);