Ejemplo n.º 1
0
 protected override Element CreateNode()
 {
     var table = Browser.Document.CreateElement("table");
     row = Browser.Document.CreateElement("tr");
     table.AppendChild(row);
     return table;
 }
Ejemplo n.º 2
0
        private void OnMouseMove(Event evt)
        {
            var currentElement = evt.Target;
            if (lastElement != currentElement)
            {
                var current = currentElement;
                while (current != null)
                {
                    var hasMouse = current.As<JsObject>().member("$hasMouse");
                    if (!hasMouse)
                        FireMouseEntered(current);
                    else
                        break;
                    current = current.ParentElement;
                }

                // If the new element is not contained in the last element...
                if (lastElement != null && !currentElement.IsDescendentOf(lastElement))
                {
                    var last = lastElement;
                    while (last != null)
                    {
                        if (!last.Contains(currentElement))
                            FireMouseExited(last);
                        else
                            break;
                        last = last.ParentElement;
                    }
                }

                lastElement = currentElement;
            }
        }
Ejemplo n.º 3
0
        protected override Element CreateNode()
        {
            var table = Browser.Document.CreateElement("table");
            table.Style.Width = "100%";
            table.Style.Height = "100%";
            table.Style.BorderCollapse = "collapse";

            var row = Browser.Document.CreateElement("tr");
            table.AppendChild(row);

            var td = Browser.Document.CreateElement("td");
            td.SetAttribute("align", "center");   // This one little attribute is why table layouts are awesome
            td.Style.VerticalAlign = "middle";

            contentContainer = Browser.Document.CreateElement("div");
            td.AppendChild(contentContainer);

            row.AppendChild(td);

            var outerDiv = Browser.Document.CreateElement("div");
            outerDiv.Style.Width = "100%";
            outerDiv.Style.Height = "100%";
            outerDiv.AppendChild(table);

            return outerDiv;
        }
Ejemplo n.º 4
0
 private Element GetTopRow()
 {
     if (topRow == null)
     {
         topRow = Browser.Document.CreateElement("tr");
         Node.Prepend(topRow);
     }
     return topRow;
 }
Ejemplo n.º 5
0
 private Element GetBottomRow()
 {
     if (bottomRow == null)
     {
         bottomRow = Browser.Document.CreateElement("tr");
         Node.AppendChild(bottomRow);
     }
     return bottomRow;
 }
Ejemplo n.º 6
0
        protected override Element CreateNode()
        {
            label = Browser.Document.CreateElement("span");

            var span = Browser.Document.CreateElement("span");
            checkbox = Browser.Document.CreateElement("input");
            checkbox.SetAttribute("type", "checkbox");
            checkbox.AddEventListener("change", OnJsChanged);
            span.AppendChild(checkbox);
            span.AppendChild(label);

            return span;
        }
Ejemplo n.º 7
0
        private Element GetMiddleRow()
        {
            if (middleRow == null)
            {
                middleRow = Browser.Document.CreateElement("tr");
                if (topRow != null)
                    middleRow.InsertAfter(topRow);
                else
                    Node.Prepend(middleRow);

                if (Spacing != 0 && topRow != null)
                {
                    topCellContent.Style.PaddingBottom = Spacing + "px";
                }
            }
            return middleRow;
        }
Ejemplo n.º 8
0
        protected override Element CreateNode()
        {
            var table = CreateElement("table");

            var row = CreateElement("tr");
            cell = CreateElement("td");
            cell.Style.VerticalAlign = "middle";
            cell.Style.Position = "relative";
            cell.Style.ZIndex = "-1";
            container = CreateElement("div");

            cell.AppendChild(container);
            row.AppendChild(cell);
            table.AppendChild(row);

            return table;
        }
Ejemplo n.º 9
0
        public UnitTester()
        {
            var nameHeader = CreateHeaderCell("Name");
            var passedHeader = CreateHeaderCell("Passed");
            var failedHeader = CreateHeaderCell("Failed");
            var erroredHeader = CreateHeaderCell("Errored");

            header = Browser.Document.CreateElement("tr");
            header.AppendChild(nameHeader);
            header.AppendChild(passedHeader);
            header.AppendChild(failedHeader);
            header.AppendChild(erroredHeader);

            table = Browser.Document.CreateElement("table");
            table.Style.Width = "100%";
            table.AppendChild(header);

            Browser.Document.Body.AppendChild(table);
        }
Ejemplo n.º 10
0
        private Element GetTopCell()
        {
            if (topCell == null)
            {
                topCell = Browser.Document.CreateElement("td");
                topCell.SetAttribute("colspan", "3");
                GetTopRow().AppendChild(topCell);

                topCellContent = Browser.Document.CreateElement("div");
                topCellContent.Style.Width = "100%";
                topCellContent.Style.Height = "100%";
                topCell.AppendChild(topCellContent);

                if (Spacing != 0 && (middleRow != null || bottomRow != null))
                {
                    topCellContent.Style.PaddingBottom = Spacing + "px";
                }
            }

            return topCellContent;
        }
Ejemplo n.º 11
0
        protected override Element CreateNode()
        {
            table = Browser.Document.CreateElement("table");

            var totalNumberOfWeights = columnWidths.Where(x => x.Style == TableWidthStyle.Weight).Sum(x => x.Value);
            var totalPercent = columnWidths.Where(x => x.Style == TableWidthStyle.Percent).Sum(x => x.Value);
            var percentAvailableToWeights = 100 - totalPercent;
            if (percentAvailableToWeights < 0)
                throw new InvalidOperationException("Total amount of percent specified is greater than 100");

            var percentToEachWeight = percentAvailableToWeights / totalNumberOfWeights;
            var extraPercent = percentAvailableToWeights - percentToEachWeight*totalNumberOfWeights;

            // Define columns
            var colgroup = Browser.Document.CreateElement("colgroup");
            foreach (var width in columnWidths)
            {
                var col = Browser.Document.CreateElement("col");
                switch (width.Style)
                {
                    case TableWidthStyle.Pixels:
                        col.Style.Width = width.Value + "px";
                        break;
                    case TableWidthStyle.Weight:
                        var currentWeight = percentToEachWeight * width.Value;
                        currentWeight += extraPercent;
                        extraPercent = 0;
                        col.Style.Width = currentWeight + "%";
                        break;
                    case TableWidthStyle.Percent:
                        col.Style.Width = width.Value + "%";
                        break;
                }
                colgroup.AppendChild(col);
            }
            table.AppendChild(colgroup);

            return table;
        }
Ejemplo n.º 12
0
 public InlineControl(Element node) : base(node)
 {
 }
Ejemplo n.º 13
0
 private void RemoveRightCell()
 {
     if (rightCell != null)
         rightCell.Remove();
     rightCell = null;
     rightCellContent = null;
     RemoveMiddleRowIfEmpty();
 }
Ejemplo n.º 14
0
 private void RemoveLeftCell()
 {
     if (leftCell != null)
         leftCell.Remove();
     leftCell = null;
     leftCellContent = null;
     RemoveMiddleRowIfEmpty();
 }
Ejemplo n.º 15
0
 private void RemoveCenterCell()
 {
     if (centerCell != null)
     {
         centerCell.Remove();
         if (leftCell != null && right == null)
             leftCell.Style.PaddingRight = "";
     }
     centerCell = null;
     centerCellContent = null;
     RemoveMiddleRowIfEmpty();
 }
Ejemplo n.º 16
0
 private void OnMouseDown(Event evt)
 {
     isMouseDown = true;
     mouseDownTarget = evt.Target;
 }
Ejemplo n.º 17
0
 private void RemoveBottomCell()
 {
     if (bottomCell != null)
         bottomCell.Remove();
     bottomCell = null;
     bottomCellContent = null;
     RemoveBottomRow();
 }
Ejemplo n.º 18
0
 private void RemoveMiddleRow()
 {
     if (middleRow != null)
     {
         middleRow.Remove();
         if (topCell != null && bottom == null)
             topCell.Style.PaddingBottom = "";
     }
     middleRow = null;
 }
Ejemplo n.º 19
0
 private void RemoveBottomRow()
 {
     if (bottomRow != null)
         bottomRow.Remove();
     bottomRow = null;
 }
Ejemplo n.º 20
0
//        public HtmlControl(string htmlTag) : base(string.Format("<{0}></{0}>", htmlTag))
//        {
//        }

        public HtmlControl(Element node) : base(node)
        {
        }
Ejemplo n.º 21
0
 private void RemoveTopRow()
 {
     if (topRow != null)
         topRow.Remove();
     topRow = null;
 }
Ejemplo n.º 22
0
        protected override Element CreateNode()
        {
            contentNode = Browser.Document.CreateElement("div");
            contentNode.Style.Height = "100%";

            overlayContainer = Browser.Document.CreateElement("div");
            overlayContainer.Style.Position = "absolute";
            overlayContainer.Style.Display = "none";

            var overlayAnchor = Browser.Document.CreateElement("div");
            overlayAnchor.Style.Position = "relative";
            overlayAnchor.AppendChild(overlayContainer);

            var result = Browser.Document.CreateElement("div");
            result.AppendChild(contentNode);
            result.AppendChild(overlayAnchor);
            result.AddEventListener("mouseentered", OnJsContentMouseEnter);
            result.AddEventListener("mouseexited", OnJsContentMouseLeave);
            result.AddEventListener("click", OnJsContentClick);
            return result;
        }
Ejemplo n.º 23
0
        private Element GetLeftCell()
        {
            if (leftCell == null)
            {
                leftCell = Browser.Document.CreateElement("td");
                leftCell.Style.Height = "100%";
                AdjustColSpan();
                GetMiddleRow().Prepend(leftCell);

                leftCellContent = Browser.Document.CreateElement("div");
                leftCellContent.Style.Width = "100%";
                leftCellContent.Style.Height = "100%";
                leftCell.AppendChild(leftCellContent);

                if (Spacing != 0 && (centerCell != null || rightCell != null))
                {
                    leftCellContent.Style.PaddingLeft = Spacing + "px";
                }
            }
            return leftCellContent;
        }
Ejemplo n.º 24
0
 private void FireMouseExited(Element element)
 {
     element.As<JsObject>().memberset("$hasMouse", false);
     var mouseExitedEvent = Browser.Document.CreateCustomEvent("mouseexited", null);
     element.DispatchEvent(mouseExitedEvent);                                
 }
Ejemplo n.º 25
0
        protected override Element CreateNode()
        {
            headerNode = Browser.Document.CreateElement("div");
            headerNode.Style.Width = "100%";
            headerNode.Style.Position = "fixed";

            contentNode = Browser.Document.CreateElement("div");
            contentNode.Style.Height = "100%";

            var result = Browser.Document.CreateElement("div");
            result.Style.Height = "100%";
            result.AppendChild(headerNode);
            result.AppendChild(contentNode);

            return result;
        }
Ejemplo n.º 26
0
 private void RemoveTopCell()
 {
     if (topCell != null)
         topCell.Remove();
     topCell = null;
     topCellContent = null;
     RemoveTopRow();
 }
Ejemplo n.º 27
0
        private Element GetCenterCell()
        {
            if (centerCell == null)
            {
                centerCell = Browser.Document.CreateElement("td");
                centerCell.Style.Height = "100%";
                centerCell.Style.Width = "100%";
                AdjustColSpan();
                if (leftCell != null)
                    centerCell.InsertAfter(leftCell);
                else
                    GetMiddleRow().Prepend(centerCell);

                centerCellContent = Browser.Document.CreateElement("div");
                centerCellContent.Style.Width = "100%";
                centerCellContent.Style.Height = "100%";
                centerCell.AppendChild(centerCellContent);
            }
            return centerCellContent;
        }
Ejemplo n.º 28
0
 private void FireMouseUp(Element element)
 {
     var mouseExitedEvent = Browser.Document.CreateCustomEvent("mouseup", null);
     element.DispatchEvent(mouseExitedEvent);                                
 }
Ejemplo n.º 29
0
        protected override Element CreateNode()
        {
            table = Browser.Document.CreateElement("table");
            table.Style.Width = "100%";

            var div = Browser.Document.CreateElement("div");
            div.AppendChild(table);

            return div;
        }
Ejemplo n.º 30
0
        private Element GetRightCell()
        {
            if (rightCell == null)
            {
                rightCell = Browser.Document.CreateElement("td");
                rightCell.Style.Height = "100%";
                AdjustColSpan();
                GetMiddleRow().AppendChild(rightCell);

                rightCellContent = Browser.Document.CreateElement("div");
                rightCellContent.Style.Width = "100%";
                rightCellContent.Style.Height = "100%";
                rightCell.AppendChild(rightCellContent);

                if (Spacing != 0 && middleRow != null)
                {
                    rightCellContent.Style.PaddingLeft = Spacing + "px";
                }
            }
            return rightCellContent;
        }