Example #1
0
        public static AccordionPanel Make(string headerText, string subtext, string id, PanelType type)
        {
            AccordionPanel accor = new AccordionPanel();

            accor.id    = id;
            accor.PType = type;

            jQuery c = new jQuery("<div>");

            if (!string.IsNullOrEmpty(headerText))
            {
                c.Append(new jQuery("<h2>").Html(headerText));
            }

            if (!string.IsNullOrEmpty(subtext))
            {
                c.Append(new jQuery("<h4>").Html(subtext));
            }

            accor.PanelGroup = new jQuery("<div>").AddClass("panel-group").Attr("id", id);

            c.Append(accor.PanelGroup);


            accor.MainContainer = c;

            return(accor);
        }
Example #2
0
        public SplitComponent(SplitDirection direction, float splitPercentage = 50)
        {
            var horiz = direction == SplitDirection.Horizontal;

            splitPercentage = 100 - splitPercentage;
            RootElement     = new jQuery("<div>").AddClass("split-pane", horiz ? "horizontal-percent" : "vertical-percent");
            RootElement.Append(firstContentElement = new jQuery("<div>").AddClass("split-pane-component").Css(horiz ? "bottom" : "right", $"{splitPercentage}%"));
            RootElement.Append(new jQuery("<div>").AddClass("split-pane-divider").Css(horiz ? "bottom" : "right", $"{splitPercentage}%"));
            RootElement.Append(secondContentElement = new jQuery("<div>").AddClass("split-pane-component").Css(horiz ? "height" : "width", $"{splitPercentage}%"));
            ((dynamic)RootElement).splitPane();
        }
Example #3
0
 public PaneComponent(string heading = null)
 {
     RootElement = new jQuery("<div>").AddClass("panel", "panel-default");
     if (heading != null)
     {
         var he = new jQuery("<div>").AddClass("panel-heading");
         he.Append(new jQuery("<h3>").AddClass("panel-title").Text(heading));
         RootElement.Append(he);
     }
     RootElement.Append(contentElement = new jQuery("<div>").AddClass("panel-body"));
 }
Example #4
0
        public jQuery AddPanel(string title, jQuery content, Action <jQueryEvent> clickHandler = null, object panelTag = null)
        {
            panelCount++;

            string className = GetPanelTypeName(PType);


            jQuery panel = new jQuery("<div>").AddClass(className);

            panel.Append(MakePanelTitle(title, "#panel_" + id + panelCount.ToString(), "#" + id, clickHandler, panelTag));
            panel.Append(MakeContentPanel(content, "panel_" + id + panelCount.ToString()));

            PanelGroup.Append(panel);

            return(panel);
        }
Example #5
0
        public static jQuery CreateRadioInput(string id, string label, string[] options)
        {
            jQuery divRadio = new jQuery("<div>");

            divRadio.AddClass("col-sm-10");

            for (int i = 0; i < options.Length; i++)
            {
                divRadio
                .Append(new jQuery("<label>")
                        .AddClass("radio-inline")
                        .Append(new InputElement
                {
                    Type  = InputType.Radio,
                    Id    = id + "-" + i,
                    Name  = id,
                    Value = options[i]
                })
                        .Append(options[i])
                        );
            }

            return(new jQuery("<div>")
                   .AddClass("form-group")
                   .Append(new LabelElement
            {
                ClassName = "control-label col-sm-2",
                HtmlFor = id,
                InnerHTML = label + ":"
            })
                   .Append(divRadio));
        }
Example #6
0
        private static void MakeList()
        {
            jQuery row = new jQuery("<div>").AddClass("row");

            jQuery col1 = new jQuery("<div>").AddClass("col-sm-3").AppendTo(row);
            jQuery col2 = new jQuery("<div>").AddClass("col-sm-9").AppendTo(row);

            row.Get(0).Style.Padding = "20px";

            AccordionPanel p = AccordionPanel.Make("Sharp THREEjs", "(jus a try out :)", "myID", PanelType.panel_default);

            foreach (KeyValuePair <string, List <BaseDemo> > kvp in Demos)
            {
                ListMaker m = new ListMaker();
                foreach (BaseDemo d in kvp.Value)
                {
                    m.AddListItem(d.DemoName, clickDemo, d);
                }

                p.AddPanel(kvp.Key, m.List);
            }

            col1.Append(p.MainContainer);

            row.AppendTo(Document.Body);

            DemoContainer = col2.Get(0);
        }
Example #7
0
 public static jQuery Append(this jQuery root, IEnumerable <jQuery> components)
 {
     foreach (var comp in components)
     {
         root.Append(comp);
     }
     return(root);
 }
Example #8
0
        public PageManager CreatePage(string tabId, string pageId)
        {
            jQuery      tab  = GetTabElement(tabId);
            PageManager page = new PageManager(tab.Append($"<div class='tab' data-tabid='{pageId}'></div>"));

            page.DockTo(tab);
            return(page);
        }
Example #9
0
        public jQuery AddListItem(string text, Action <jQueryEvent> clickHandler, object tag)
        {
            jQuery li = new jQuery("<li>").AddClass("list-group-item").Html(text);

            li.Click(tag, clickHandler);
            List.Append(li);

            return(li);
        }
Example #10
0
        private jQuery MakeContentPanel(jQuery content, string id)
        {
            jQuery panelCollapse = new jQuery("<div>").AddClass("panel-collapse collapse").Attr("id", id);

            if (content != null)
            {
                jQuery panelBody = new jQuery("<div>").AddClass("panel-body");
                panelBody.Append(content);
                panelCollapse.Append(panelBody);
            }
            return(panelCollapse);
        }
Example #11
0
        public static void CreateForm(jQuery container, Form template)
        {
            foreach (FormField field in template.Fields)
            {
                container.Append(App.CreateFormField(field));
            }

            container.Append(new jQuery("<div>")
                             .AddClass("form-group")
                             .Append(new jQuery("<div>")
                                     .AddClass("col-sm-offset-2 col-sm-10")
                                     .Append(new jQuery(new InputElement
            {
                Type       = InputType.Submit,
                Value      = "Submit",
                ClassName  = "btn btn-primary",
                FormAction = SUBMIT_URL,
                FormMethod = "POST"
            }))
                                     )
                             );
        }
Example #12
0
        private jQuery MakePanelTitle(string title, string href, string dataParent, Action <jQueryEvent> clickHandler, object panelTag)
        {
            jQuery panelHeading   = new jQuery("<div>").AddClass("panel-heading");
            jQuery panelTitle     = new jQuery("<h4>").AddClass("panel-title");
            jQuery panelAcoordion = new jQuery("<a>").Attr("data-toggle", "collapse").Attr("data-parent", dataParent).Attr("href", href).Html(title);

            if (clickHandler != null)
            {
                panelAcoordion.Click(panelTag, clickHandler);
            }

            panelTitle.Append(panelAcoordion);
            panelHeading.Append(panelTitle);
            return(panelHeading);
        }
Example #13
0
        public void Mount(string tabId, jQuery docksite)
        {
            jQuery tab = docksite.Children($".tab[data-tabid='{tabId}']");

            if (tab.Length == 0)
            {
                tab = docksite.Append($"<div class='tab' data-tabid='{tabId}'><header></header></div>");
                tab.On("click", "header > a", new Action <MouseEvent>(OnClickTabHeader));
            }
            else
            {
                RefreshTabHeader(tab.First());
                tab.Off("click", "header > a");
                tab.On("click", "header > a", new Action <MouseEvent>(OnClickTabHeader));
            }
        }
Example #14
0
        public void RefreshTabHeader(jQuery tabElement)
        {
            jQuery pages  = tabElement.Children(".page");
            jQuery header = tabElement.Children("header");

            header.Remove("a");
            pages.Each((pid, page) =>
            {
                var jpage = new jQuery(page);
                header.Append($"<a href='' data-pageid='{jpage.Attr("data-pageid")}'>{jpage.Attr("data-page-title")}</a>");
            });

            jQuery active = tabElement.Children(".page.active");

            if (active.Length == 0)
            {
                active = pages.First();
            }
            ShowTab(tabElement, active);
        }
Example #15
0
 public static jQuery Append(this jQuery root, IComponent component)
 {
     return(root.Append(component.RootElement));
 }
Example #16
0
 private static void Fail(jqXHR jqxhr, string str1, string str2, jQuery target)
 {
     target.Append("<b style='color:red;'>Failed to load template !</b>");
 }
Example #17
0
 private static void Success(string data, string str, jqXHR jqxhr, jQuery target)
 {
     target.Append(data);
 }
Example #18
0
 public void Do()
 {
     Element = Untype <TSvg>(document.createElementNS(ToolUtils.SvgNamespace, SvgTagName));
     ParentElement.Append(Untype <Bridge.Html5.Element>(Element));
     RefreshElement(Element);
 }
Example #19
0
		public void AddRow(RowT obj, IEnumerable<IComponent> row) {
			TBody.Append(new jQuery("<tr>").Append(row.Select(x => new jQuery("<td>").Append(x))).Data("row-id", rowBindings.Count).Click(Clicked).DblClick(DoubleClicked));
			rowBindings[rowBindings.Count] = obj;
		}
Example #20
0
		public TableComponent(IEnumerable<IComponent> headings=null) {
			RootElement = new jQuery("<table>").AddClass("table", "table-bordered");
			if(headings != null)
				RootElement.Append(new jQuery("<thead>").Append(new jQuery("<tr>").Append(headings.Select(x => new jQuery("<th>").Append(x)))));
			RootElement.Append(TBody = new jQuery("<tbody>"));
		}
Example #21
0
File: Ui.cs Project: davignola/Dice
        /// <summary>
        /// Add the ui column player container
        /// </summary>
        /// <param name="playerObject"></param>
        public static void AddPlayerContainer(Player playerObject, int playerCount)
        {
            // Get main container
            var scoreboard = jQuery.Select("#" + DiceView.PlayerContainerId);

            // Max 6 item per real row
            var rowIndex = Convert.ToInt32(playerObject.Index / (DiceView.PlayerSlots / DiceView.MinColSizeLg));

            var playerRow = scoreboard.Find(string.Format("[PlayerRowAttribute={0}]", rowIndex));

            if (playerRow.Length <= 0)
            {
                playerRow = new jQuery("<div>")
                            .AddClass("row low-pad")
                            .Attr("PlayerRowAttribute", rowIndex);
                scoreboard.Append(playerRow);

                // correct row heights
                scoreboard.Find("[PlayerRowAttribute]")
                .RemoveClass("fill-height-" + rowIndex)
                .AddClass("fill-height-" + (rowIndex + 1));
            }

            // This is the column
            var playerContainer = new jQuery("<div>");

            playerContainer.Attr(DiceView.PlayerColumnAttribute, playerObject.Index)
            .AddClass("fill-height");
            // Panel with title and scoreboard
            var playerPanel = new jQuery("<div>");

            playerPanel
            .AddClass("panel panel-default low-pad")
            .Attr(DiceView.PlayerPanelAttribute, playerObject.Index)
            .Append(new jQuery("<div>").AddClass("panel-heading low-pad")
                    // Adding title
                    .Append(new jQuery("<h3>").AddClass("panel-title")
                            .Attr("id", DiceView.PlayerPanelTitleBaseId + playerObject.Index)
                            .Append(new jQuery("<span>").AddClass("player-name").Text(playerObject.Name))
                            .Append(new jQuery("<span>").AddClass("glyphicon glyphicon-edit pull-right player-icon")
                                    .On("click", null, playerObject.Index.ToString(), (Action <jQueryEvent>)Ui.ShowRename))))
            // Adding body (scoreboard)
            .Append(new jQuery("<div>").AddClass("panel-body low-pad")
                    .Append(new jQuery("<ul>").AddClass("list-group")
                            .Attr(DiceView.PlayerScoreBoardAttribute, playerObject.Index)))
            // Total in footer
            .Append(new jQuery("<div>").AddClass("panel-footer low-pad")
                    .Append(new jQuery("<h5>")
                            .AddClass("")
                            .Attr(DiceView.PlayerPanelFooterAttribute, playerObject.Index)
                            .Text("Total: 0")));
            // Adding to containers
            playerContainer.Append(playerPanel);
            playerRow.Append(playerContainer);
            // Force wrapping on a new line
            //if ((playerObject.Index + 1) % (DiceView.PlayerSlots / DiceView.MinColSizeLg) == 0)
            //{
            //    scoreboard.Append(new jQuery("<div>").AddClass("clearfix visible-lg-block"));
            //}
            // Break into logical rows on small devices
            if ((playerObject.Index + 1) % (DiceView.PlayerSlots / DiceView.MinColSizeMd) == 0)
            {
                playerRow.Append(new jQuery("<div>").AddClass("clearfix visible-md-block"));
            }
            if ((playerObject.Index + 1) % (DiceView.PlayerSlots / DiceView.MinColSizeSm) == 0)
            {
                playerRow.Append(new jQuery("<div>").AddClass("clearfix visible-sm-block"));
            }
            if ((playerObject.Index + 1) % (DiceView.PlayerSlots / DiceView.MinColSizeXs) == 0)
            {
                playerRow.Append(new jQuery("<div>").AddClass("clearfix visible-xs-block"));
            }
            // update columns classes
            Ui.SetColumnClass(playerCount);
        }
Example #22
0
 public void DockTo(jQuery tab)
 {
     TabManager.Instance.RefreshTabHeader(tab);
     tab.Append(Element);
 }
 public void Mount(string toolbarId, jQuery element)
 {
     element.Append($"<div class='toolbar' data-toolbarid='{toolbarId}'></div>");
 }